blob_id stringlengths 40 40 | bodies listlengths 2 6 | bodies_text stringlengths 196 6.73k | class_docstring stringlengths 0 700 | class_name stringlengths 1 86 | detected_licenses listlengths 0 45 | format_version stringclasses 1
value | full_text stringlengths 438 7.52k | id stringlengths 40 40 | length_bytes int64 506 50k | license_type stringclasses 2
values | methods listlengths 2 6 | n_methods int64 2 6 | original_id stringlengths 38 40 ⌀ | prompt stringlengths 153 4.25k | prompted_full_text stringlengths 645 10.7k | revision_id stringlengths 40 40 | skeleton stringlengths 162 4.34k | snapshot_name stringclasses 1
value | snapshot_source_dir stringclasses 1
value | solution stringlengths 302 7.33k | source stringclasses 1
value | source_path stringlengths 4 177 | source_repo stringlengths 6 110 | split stringclasses 1
value | star_events_count int64 0 209k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
c3aaf0ee533e346a02fd9548f8f84618e50da679 | [
"assert isinstance(model, BaseEstimator), \"`model` isn't a scikit-learn model\"\nBaseEstimator.__init__(self)\nTransformerMixin.__init__(self)\nself.periods = periods\nself.freq = freq\nself.model = model",
"if 'site' in X.columns:\n raise ValueError('site should be an index, not a column')\nself.n_features =... | <|body_start_0|>
assert isinstance(model, BaseEstimator), "`model` isn't a scikit-learn model"
BaseEstimator.__init__(self)
TransformerMixin.__init__(self)
self.periods = periods
self.freq = freq
self.model = model
<|end_body_0|>
<|body_start_1|>
if 'site' in X.c... | Wraps a scikit-learn model, lags the data, and deals with NAs. | LagWrapper | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LagWrapper:
"""Wraps a scikit-learn model, lags the data, and deals with NAs."""
def __init__(self, model, periods=1, freq='30min'):
"""Lags a dataset. Lags all features. Missing data is dropped for fitting, and replaced with the mean for predict. :periods: Number of timesteps to lag... | stack_v2_sparse_classes_36k_train_020100 | 19,534 | permissive | [
{
"docstring": "Lags a dataset. Lags all features. Missing data is dropped for fitting, and replaced with the mean for predict. :periods: Number of timesteps to lag by",
"name": "__init__",
"signature": "def __init__(self, model, periods=1, freq='30min')"
},
{
"docstring": "Fit the model with X ... | 6 | stack_v2_sparse_classes_30k_train_010063 | Implement the Python class `LagWrapper` described below.
Class description:
Wraps a scikit-learn model, lags the data, and deals with NAs.
Method signatures and docstrings:
- def __init__(self, model, periods=1, freq='30min'): Lags a dataset. Lags all features. Missing data is dropped for fitting, and replaced with t... | Implement the Python class `LagWrapper` described below.
Class description:
Wraps a scikit-learn model, lags the data, and deals with NAs.
Method signatures and docstrings:
- def __init__(self, model, periods=1, freq='30min'): Lags a dataset. Lags all features. Missing data is dropped for fitting, and replaced with t... | b82c3f50f69f2cd5be5e97897009e1afee6b167d | <|skeleton|>
class LagWrapper:
"""Wraps a scikit-learn model, lags the data, and deals with NAs."""
def __init__(self, model, periods=1, freq='30min'):
"""Lags a dataset. Lags all features. Missing data is dropped for fitting, and replaced with the mean for predict. :periods: Number of timesteps to lag... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LagWrapper:
"""Wraps a scikit-learn model, lags the data, and deals with NAs."""
def __init__(self, model, periods=1, freq='30min'):
"""Lags a dataset. Lags all features. Missing data is dropped for fitting, and replaced with the mean for predict. :periods: Number of timesteps to lag by"""
... | the_stack_v2_python_sparse | empirical_lsm/transforms.py | naught101/empirical_lsm | train | 3 |
922bcc5bc4db04ab16c9a71eefea7ef056793bb9 | [
"for i in range(len(array) - 1):\n min_index = i\n for j in range(i + 1, len(array)):\n if array[j] < array[min_index]:\n min_index = j\n if min_index != i:\n array[i], array[min_index] = (array[min_index], array[i])\n print(i, ': ', array)\nreturn array",
"for _ in range(len(... | <|body_start_0|>
for i in range(len(array) - 1):
min_index = i
for j in range(i + 1, len(array)):
if array[j] < array[min_index]:
min_index = j
if min_index != i:
array[i], array[min_index] = (array[min_index], array[i])
... | Implements two sorting algorithms: selection sort and bubble sort | Sort | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Sort:
"""Implements two sorting algorithms: selection sort and bubble sort"""
def selection_sort(array):
"""Sort a list of numbers using selection sort"""
<|body_0|>
def bubble_sort(array):
"""Sort a list of numbers using bubble sort"""
<|body_1|>
<|end_... | stack_v2_sparse_classes_36k_train_020101 | 1,959 | no_license | [
{
"docstring": "Sort a list of numbers using selection sort",
"name": "selection_sort",
"signature": "def selection_sort(array)"
},
{
"docstring": "Sort a list of numbers using bubble sort",
"name": "bubble_sort",
"signature": "def bubble_sort(array)"
}
] | 2 | null | Implement the Python class `Sort` described below.
Class description:
Implements two sorting algorithms: selection sort and bubble sort
Method signatures and docstrings:
- def selection_sort(array): Sort a list of numbers using selection sort
- def bubble_sort(array): Sort a list of numbers using bubble sort | Implement the Python class `Sort` described below.
Class description:
Implements two sorting algorithms: selection sort and bubble sort
Method signatures and docstrings:
- def selection_sort(array): Sort a list of numbers using selection sort
- def bubble_sort(array): Sort a list of numbers using bubble sort
<|skele... | d7cb9f9407eec0ea71fed45e9968133c35514e40 | <|skeleton|>
class Sort:
"""Implements two sorting algorithms: selection sort and bubble sort"""
def selection_sort(array):
"""Sort a list of numbers using selection sort"""
<|body_0|>
def bubble_sort(array):
"""Sort a list of numbers using bubble sort"""
<|body_1|>
<|end_... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Sort:
"""Implements two sorting algorithms: selection sort and bubble sort"""
def selection_sort(array):
"""Sort a list of numbers using selection sort"""
for i in range(len(array) - 1):
min_index = i
for j in range(i + 1, len(array)):
if array[j] <... | the_stack_v2_python_sparse | week13/sort.py | myfairladywenwen/cs5001 | train | 0 |
617c36c3d44eab3b7174c786139419d506b83de5 | [
"steps = 0\nend = 0\nmaxpostion = 0\nfor i in range(len(nums) - 1):\n maxpostion = max(maxpostion, nums[i] + i)\n if i == end:\n end = maxpostion\n steps += 1\nreturn steps",
"start = 0\nsteps = 0\nwhile start < len(nums) - 1:\n maxPosition = nums[start] + start\n if maxPosition >= len(n... | <|body_start_0|>
steps = 0
end = 0
maxpostion = 0
for i in range(len(nums) - 1):
maxpostion = max(maxpostion, nums[i] + i)
if i == end:
end = maxpostion
steps += 1
return steps
<|end_body_0|>
<|body_start_1|>
start ... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def jump1(self, nums: list) -> int:
"""贪心算法 :param list[int] nums: :return: int"""
<|body_0|>
def jump2(self, nums: list) -> int:
"""贪心算法 :param list[int] nums: :return: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
steps = 0
... | stack_v2_sparse_classes_36k_train_020102 | 2,008 | no_license | [
{
"docstring": "贪心算法 :param list[int] nums: :return: int",
"name": "jump1",
"signature": "def jump1(self, nums: list) -> int"
},
{
"docstring": "贪心算法 :param list[int] nums: :return: int",
"name": "jump2",
"signature": "def jump2(self, nums: list) -> int"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def jump1(self, nums: list) -> int: 贪心算法 :param list[int] nums: :return: int
- def jump2(self, nums: list) -> int: 贪心算法 :param list[int] nums: :return: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def jump1(self, nums: list) -> int: 贪心算法 :param list[int] nums: :return: int
- def jump2(self, nums: list) -> int: 贪心算法 :param list[int] nums: :return: int
<|skeleton|>
class So... | 837957ea22aa07ce28a6c23ea0419bd2011e1f88 | <|skeleton|>
class Solution:
def jump1(self, nums: list) -> int:
"""贪心算法 :param list[int] nums: :return: int"""
<|body_0|>
def jump2(self, nums: list) -> int:
"""贪心算法 :param list[int] nums: :return: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def jump1(self, nums: list) -> int:
"""贪心算法 :param list[int] nums: :return: int"""
steps = 0
end = 0
maxpostion = 0
for i in range(len(nums) - 1):
maxpostion = max(maxpostion, nums[i] + i)
if i == end:
end = maxpostion
... | the_stack_v2_python_sparse | 华为题库/跳跃游戏II.py | 2226171237/Algorithmpractice | train | 0 | |
a71866d5049b9b675fa61fd7d9bad96c63f8fea6 | [
"try:\n payload = {'exp': datetime.datetime.utcnow() + datetime.timedelta(days=0, seconds=10), 'iat': datetime.datetime.utcnow(), 'iss': 'ken', 'data': {'id': user_id, 'login_time': login_time}}\n return jwt.encode(payload, current_app.config['SECRET_KEY'], algorithm='HS256')\nexcept Exception as e:\n retu... | <|body_start_0|>
try:
payload = {'exp': datetime.datetime.utcnow() + datetime.timedelta(days=0, seconds=10), 'iat': datetime.datetime.utcnow(), 'iss': 'ken', 'data': {'id': user_id, 'login_time': login_time}}
return jwt.encode(payload, current_app.config['SECRET_KEY'], algorithm='HS256')... | Auth | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Auth:
def encode_auth_token(user_id, login_time):
"""生成认证Token :param user_id: int :param login_time: int(timestamp) :return: string"""
<|body_0|>
def decode_auth_token(auth_token):
"""验证Token :param auth_token: :return: integer|string"""
<|body_1|>
def ... | stack_v2_sparse_classes_36k_train_020103 | 3,044 | no_license | [
{
"docstring": "生成认证Token :param user_id: int :param login_time: int(timestamp) :return: string",
"name": "encode_auth_token",
"signature": "def encode_auth_token(user_id, login_time)"
},
{
"docstring": "验证Token :param auth_token: :return: integer|string",
"name": "decode_auth_token",
"s... | 3 | stack_v2_sparse_classes_30k_train_001364 | Implement the Python class `Auth` described below.
Class description:
Implement the Auth class.
Method signatures and docstrings:
- def encode_auth_token(user_id, login_time): 生成认证Token :param user_id: int :param login_time: int(timestamp) :return: string
- def decode_auth_token(auth_token): 验证Token :param auth_token... | Implement the Python class `Auth` described below.
Class description:
Implement the Auth class.
Method signatures and docstrings:
- def encode_auth_token(user_id, login_time): 生成认证Token :param user_id: int :param login_time: int(timestamp) :return: string
- def decode_auth_token(auth_token): 验证Token :param auth_token... | 121fb26d816da0f76df8083d2fd37ca92c904338 | <|skeleton|>
class Auth:
def encode_auth_token(user_id, login_time):
"""生成认证Token :param user_id: int :param login_time: int(timestamp) :return: string"""
<|body_0|>
def decode_auth_token(auth_token):
"""验证Token :param auth_token: :return: integer|string"""
<|body_1|>
def ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Auth:
def encode_auth_token(user_id, login_time):
"""生成认证Token :param user_id: int :param login_time: int(timestamp) :return: string"""
try:
payload = {'exp': datetime.datetime.utcnow() + datetime.timedelta(days=0, seconds=10), 'iat': datetime.datetime.utcnow(), 'iss': 'ken', 'data... | the_stack_v2_python_sparse | train_module/src/Data_Processing/DataSet/token/auths.py | limingzhang513/lmzrepository | train | 0 | |
7f91ea3c98907597d5448f682966786f1d91b46c | [
"self._value = cookie\nself._quoted = False\nif len(self._value) > 1 and self._value.startswith('\"') and self._value.endswith('\"'):\n self._value = self._value[1:-1]\n self._quoted = True",
"if self._quoted:\n yield ('\"' + payload + '\"')\nelse:\n yield payload"
] | <|body_start_0|>
self._value = cookie
self._quoted = False
if len(self._value) > 1 and self._value.startswith('"') and self._value.endswith('"'):
self._value = self._value[1:-1]
self._quoted = True
<|end_body_0|>
<|body_start_1|>
if self._quoted:
yiel... | This is for simple cookies. They are normally single values. The entire value can be replaced with a payload. | SimpleCookie | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SimpleCookie:
"""This is for simple cookies. They are normally single values. The entire value can be replaced with a payload."""
def __init__(self, cookie):
"""Sets the string and removes quotes."""
<|body_0|>
def replace(self, payload):
"""Replace entire cookie... | stack_v2_sparse_classes_36k_train_020104 | 3,236 | permissive | [
{
"docstring": "Sets the string and removes quotes.",
"name": "__init__",
"signature": "def __init__(self, cookie)"
},
{
"docstring": "Replace entire cookie value and add back quotes. List will have a single item. :param payload: payload string :return: list of replacements",
"name": "replac... | 2 | stack_v2_sparse_classes_30k_train_017286 | Implement the Python class `SimpleCookie` described below.
Class description:
This is for simple cookies. They are normally single values. The entire value can be replaced with a payload.
Method signatures and docstrings:
- def __init__(self, cookie): Sets the string and removes quotes.
- def replace(self, payload): ... | Implement the Python class `SimpleCookie` described below.
Class description:
This is for simple cookies. They are normally single values. The entire value can be replaced with a payload.
Method signatures and docstrings:
- def __init__(self, cookie): Sets the string and removes quotes.
- def replace(self, payload): ... | 4483b301034a096b716646a470a6642b3df8ce61 | <|skeleton|>
class SimpleCookie:
"""This is for simple cookies. They are normally single values. The entire value can be replaced with a payload."""
def __init__(self, cookie):
"""Sets the string and removes quotes."""
<|body_0|>
def replace(self, payload):
"""Replace entire cookie... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SimpleCookie:
"""This is for simple cookies. They are normally single values. The entire value can be replaced with a payload."""
def __init__(self, cookie):
"""Sets the string and removes quotes."""
self._value = cookie
self._quoted = False
if len(self._value) > 1 and sel... | the_stack_v2_python_sparse | ava/parsers/cookie.py | indeedsecurity/ava-ce | train | 3 |
eaa320e938be09cb305c2264b867fc230b4d064d | [
"super().__init__(n)\nself.pin_A = None\nself.pin_B = None",
"if self.pin_A == None:\n return int(input('Enter Pin A input for gate {} --> '.format(self.get_label())))\nelse:\n return self.pin_A.get_from().get_output()",
"if self.pin_B == None:\n return int(input('Enter Pin B input for gate {} --> '.fo... | <|body_start_0|>
super().__init__(n)
self.pin_A = None
self.pin_B = None
<|end_body_0|>
<|body_start_1|>
if self.pin_A == None:
return int(input('Enter Pin A input for gate {} --> '.format(self.get_label())))
else:
return self.pin_A.get_from().get_output(... | Binary gate class. Args: n (str): Logic gate label description Attributes: pin_A (LogicGate): Logic gate reference pin_B (LogicGate): Logic gate reference | BinaryGate | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BinaryGate:
"""Binary gate class. Args: n (str): Logic gate label description Attributes: pin_A (LogicGate): Logic gate reference pin_B (LogicGate): Logic gate reference"""
def __init__(self, n):
"""Binnary gate __init__ method Args: n (str): Logic gate label description"""
<... | stack_v2_sparse_classes_36k_train_020105 | 9,556 | no_license | [
{
"docstring": "Binnary gate __init__ method Args: n (str): Logic gate label description",
"name": "__init__",
"signature": "def __init__(self, n)"
},
{
"docstring": "Returns pin A logic gate reference. Returns: (LogicGate): Returns pin A logic gate",
"name": "get_pin_A",
"signature": "d... | 4 | stack_v2_sparse_classes_30k_train_001806 | Implement the Python class `BinaryGate` described below.
Class description:
Binary gate class. Args: n (str): Logic gate label description Attributes: pin_A (LogicGate): Logic gate reference pin_B (LogicGate): Logic gate reference
Method signatures and docstrings:
- def __init__(self, n): Binnary gate __init__ method... | Implement the Python class `BinaryGate` described below.
Class description:
Binary gate class. Args: n (str): Logic gate label description Attributes: pin_A (LogicGate): Logic gate reference pin_B (LogicGate): Logic gate reference
Method signatures and docstrings:
- def __init__(self, n): Binnary gate __init__ method... | a9e0f8a7c77ff5b6a3befca5ab93030a9ae35313 | <|skeleton|>
class BinaryGate:
"""Binary gate class. Args: n (str): Logic gate label description Attributes: pin_A (LogicGate): Logic gate reference pin_B (LogicGate): Logic gate reference"""
def __init__(self, n):
"""Binnary gate __init__ method Args: n (str): Logic gate label description"""
<... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BinaryGate:
"""Binary gate class. Args: n (str): Logic gate label description Attributes: pin_A (LogicGate): Logic gate reference pin_B (LogicGate): Logic gate reference"""
def __init__(self, n):
"""Binnary gate __init__ method Args: n (str): Logic gate label description"""
super().__init... | the_stack_v2_python_sparse | Section1_Introduction/logic_gates.py | miguel-osuna/PS-Algos-and-DS-using-Python | train | 0 |
435b2f192cd22e0af748734c701b465bcc46ee9f | [
"agent = request.user.userinfo.agent\ndata = ModelMessage.get_msg_info(agent_id=agent.id)\ndata['password'] = ''\ncontext = {'status': 200, 'msg': '获取数据成功', 'data': data}\nreturn Response(context)",
"agent = request.user.userinfo.agent\nobj = ModelMessage.objects.get_or_create(agent=agent, type=2)[0]\nmsg_seriali... | <|body_start_0|>
agent = request.user.userinfo.agent
data = ModelMessage.get_msg_info(agent_id=agent.id)
data['password'] = ''
context = {'status': 200, 'msg': '获取数据成功', 'data': data}
return Response(context)
<|end_body_0|>
<|body_start_1|>
agent = request.user.userinfo.... | 短信设置 | Message | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Message:
"""短信设置"""
def get(self, request):
"""获取短信设置信息"""
<|body_0|>
def put(self, request):
"""修改短信设置信息"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
agent = request.user.userinfo.agent
data = ModelMessage.get_msg_info(agent_id=agent... | stack_v2_sparse_classes_36k_train_020106 | 32,690 | no_license | [
{
"docstring": "获取短信设置信息",
"name": "get",
"signature": "def get(self, request)"
},
{
"docstring": "修改短信设置信息",
"name": "put",
"signature": "def put(self, request)"
}
] | 2 | null | Implement the Python class `Message` described below.
Class description:
短信设置
Method signatures and docstrings:
- def get(self, request): 获取短信设置信息
- def put(self, request): 修改短信设置信息 | Implement the Python class `Message` described below.
Class description:
短信设置
Method signatures and docstrings:
- def get(self, request): 获取短信设置信息
- def put(self, request): 修改短信设置信息
<|skeleton|>
class Message:
"""短信设置"""
def get(self, request):
"""获取短信设置信息"""
<|body_0|>
def put(self, re... | d6e025d7e9d9e3aecfd399c77f376130edd8a2df | <|skeleton|>
class Message:
"""短信设置"""
def get(self, request):
"""获取短信设置信息"""
<|body_0|>
def put(self, request):
"""修改短信设置信息"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Message:
"""短信设置"""
def get(self, request):
"""获取短信设置信息"""
agent = request.user.userinfo.agent
data = ModelMessage.get_msg_info(agent_id=agent.id)
data['password'] = ''
context = {'status': 200, 'msg': '获取数据成功', 'data': data}
return Response(context)
d... | the_stack_v2_python_sparse | soc_system/views/set_views.py | sundw2015/841 | train | 4 |
50893a8b3042df00ed29eb9bfb38c65750eafe95 | [
"directory, name, extension = self._split_file_name(file_name)\nextension = self.extension if extension == '' else extension\nfile_name = directory + os.sep + name + extension\nif not file_name.endswith(self.extension):\n raise FileFormatError(\"Invalid file format. '{}' file expected.\".format(self.extension))\... | <|body_start_0|>
directory, name, extension = self._split_file_name(file_name)
extension = self.extension if extension == '' else extension
file_name = directory + os.sep + name + extension
if not file_name.endswith(self.extension):
raise FileFormatError("Invalid file format.... | Reads a Sudoku game file. | SudokuGameReader | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SudokuGameReader:
"""Reads a Sudoku game file."""
def read_game(self, file_name):
"""Reads a Sudoku game file and returns a Sudoku game object. @param file_name: the name of the file."""
<|body_0|>
def open_sudoku_file(self, file_name, mode='r'):
"""Opens a file ... | stack_v2_sparse_classes_36k_train_020107 | 1,940 | no_license | [
{
"docstring": "Reads a Sudoku game file and returns a Sudoku game object. @param file_name: the name of the file.",
"name": "read_game",
"signature": "def read_game(self, file_name)"
},
{
"docstring": "Opens a file using a context manager. @param file_name: the name of the file. @param mode: th... | 3 | stack_v2_sparse_classes_30k_train_016305 | Implement the Python class `SudokuGameReader` described below.
Class description:
Reads a Sudoku game file.
Method signatures and docstrings:
- def read_game(self, file_name): Reads a Sudoku game file and returns a Sudoku game object. @param file_name: the name of the file.
- def open_sudoku_file(self, file_name, mod... | Implement the Python class `SudokuGameReader` described below.
Class description:
Reads a Sudoku game file.
Method signatures and docstrings:
- def read_game(self, file_name): Reads a Sudoku game file and returns a Sudoku game object. @param file_name: the name of the file.
- def open_sudoku_file(self, file_name, mod... | 27cc2f7cb52ea787191095c2e581729c22bba62a | <|skeleton|>
class SudokuGameReader:
"""Reads a Sudoku game file."""
def read_game(self, file_name):
"""Reads a Sudoku game file and returns a Sudoku game object. @param file_name: the name of the file."""
<|body_0|>
def open_sudoku_file(self, file_name, mode='r'):
"""Opens a file ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SudokuGameReader:
"""Reads a Sudoku game file."""
def read_game(self, file_name):
"""Reads a Sudoku game file and returns a Sudoku game object. @param file_name: the name of the file."""
directory, name, extension = self._split_file_name(file_name)
extension = self.extension if ex... | the_stack_v2_python_sparse | src/sudoku/reader/game_reader.py | pysudoku/sudoku | train | 1 |
1c8c929ab841d566a7478ce99b3b02fe5071e1b9 | [
"output_buffers = {}\nfor name, shape in output_shapes.items():\n ort_type = TypeHelper.get_output_type(ort_session, name)\n torch_type = TypeHelper.ort_type_to_torch_type(ort_type)\n output_buffers[name] = torch.empty(numpy.prod(shape), dtype=torch_type, device=device)\nreturn output_buffers",
"if name_... | <|body_start_0|>
output_buffers = {}
for name, shape in output_shapes.items():
ort_type = TypeHelper.get_output_type(ort_session, name)
torch_type = TypeHelper.ort_type_to_torch_type(ort_type)
output_buffers[name] = torch.empty(numpy.prod(shape), dtype=torch_type, dev... | IOBindingHelper | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IOBindingHelper:
def get_output_buffers(ort_session: InferenceSession, output_shapes, device):
"""Returns a dictionary of output name as key, and 1D tensor as value. The tensor has enough space for given shape."""
<|body_0|>
def prepare_io_binding(ort_session, input_ids: tor... | stack_v2_sparse_classes_36k_train_020108 | 12,305 | permissive | [
{
"docstring": "Returns a dictionary of output name as key, and 1D tensor as value. The tensor has enough space for given shape.",
"name": "get_output_buffers",
"signature": "def get_output_buffers(ort_session: InferenceSession, output_shapes, device)"
},
{
"docstring": "Returnas IO binding obje... | 3 | stack_v2_sparse_classes_30k_train_010023 | Implement the Python class `IOBindingHelper` described below.
Class description:
Implement the IOBindingHelper class.
Method signatures and docstrings:
- def get_output_buffers(ort_session: InferenceSession, output_shapes, device): Returns a dictionary of output name as key, and 1D tensor as value. The tensor has eno... | Implement the Python class `IOBindingHelper` described below.
Class description:
Implement the IOBindingHelper class.
Method signatures and docstrings:
- def get_output_buffers(ort_session: InferenceSession, output_shapes, device): Returns a dictionary of output name as key, and 1D tensor as value. The tensor has eno... | 5e747071be882efd6b54d7a7421042e68dcd6aff | <|skeleton|>
class IOBindingHelper:
def get_output_buffers(ort_session: InferenceSession, output_shapes, device):
"""Returns a dictionary of output name as key, and 1D tensor as value. The tensor has enough space for given shape."""
<|body_0|>
def prepare_io_binding(ort_session, input_ids: tor... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class IOBindingHelper:
def get_output_buffers(ort_session: InferenceSession, output_shapes, device):
"""Returns a dictionary of output name as key, and 1D tensor as value. The tensor has enough space for given shape."""
output_buffers = {}
for name, shape in output_shapes.items():
... | the_stack_v2_python_sparse | onnxruntime/python/tools/transformers/io_binding_helper.py | microsoft/onnxruntime | train | 9,912 | |
18c4f2a4415d2a64da9e4294b7f7daa37f0674f7 | [
"edu = User.objects.create(username='eduadmin', user_type=USER_TYPE['eduadmin'])\nedu.set_password('adminedu')\nedu.save()\nteachers, courses = ([], [])\nsubjects = ['Math', 'Chinese', 'English', 'Comp']\ntimes = ['8:00', '10:00', '14:00', '16:00']\nfor index in range(4):\n teacher = Teacher.objects.create(name=... | <|body_start_0|>
edu = User.objects.create(username='eduadmin', user_type=USER_TYPE['eduadmin'])
edu.set_password('adminedu')
edu.save()
teachers, courses = ([], [])
subjects = ['Math', 'Chinese', 'English', 'Comp']
times = ['8:00', '10:00', '14:00', '16:00']
for ... | 该类用来测试教务老师查询退款信息 | EduCheckRefundTestCase | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EduCheckRefundTestCase:
"""该类用来测试教务老师查询退款信息"""
def setUp(self):
"""初始化测试样例数据"""
<|body_0|>
def test_with_course_message_name(self):
"""测试课程名称的模糊搜索"""
<|body_1|>
def test_with_course_message_id(self):
"""测试课程 id 搜索"""
<|body_2|>
d... | stack_v2_sparse_classes_36k_train_020109 | 22,106 | no_license | [
{
"docstring": "初始化测试样例数据",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "测试课程名称的模糊搜索",
"name": "test_with_course_message_name",
"signature": "def test_with_course_message_name(self)"
},
{
"docstring": "测试课程 id 搜索",
"name": "test_with_course_message_id",
... | 4 | stack_v2_sparse_classes_30k_train_012740 | Implement the Python class `EduCheckRefundTestCase` described below.
Class description:
该类用来测试教务老师查询退款信息
Method signatures and docstrings:
- def setUp(self): 初始化测试样例数据
- def test_with_course_message_name(self): 测试课程名称的模糊搜索
- def test_with_course_message_id(self): 测试课程 id 搜索
- def test_without_course_message(self): 测试... | Implement the Python class `EduCheckRefundTestCase` described below.
Class description:
该类用来测试教务老师查询退款信息
Method signatures and docstrings:
- def setUp(self): 初始化测试样例数据
- def test_with_course_message_name(self): 测试课程名称的模糊搜索
- def test_with_course_message_id(self): 测试课程 id 搜索
- def test_without_course_message(self): 测试... | cbbb688f4156eb8679db70fbdf306416d72e2b14 | <|skeleton|>
class EduCheckRefundTestCase:
"""该类用来测试教务老师查询退款信息"""
def setUp(self):
"""初始化测试样例数据"""
<|body_0|>
def test_with_course_message_name(self):
"""测试课程名称的模糊搜索"""
<|body_1|>
def test_with_course_message_id(self):
"""测试课程 id 搜索"""
<|body_2|>
d... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class EduCheckRefundTestCase:
"""该类用来测试教务老师查询退款信息"""
def setUp(self):
"""初始化测试样例数据"""
edu = User.objects.create(username='eduadmin', user_type=USER_TYPE['eduadmin'])
edu.set_password('adminedu')
edu.save()
teachers, courses = ([], [])
subjects = ['Math', 'Chinese... | the_stack_v2_python_sparse | server/api/test_edu.py | ASAKARUM/manage_system | train | 0 |
b85aaa0672f5f3600d8a08215e59bebde4f9c3f4 | [
"pools = [_GkeNodePoolTargetParser.Parse(dataproc, gke_cluster, arg_pool, support_shuffle_service) for arg_pool in arg_pools]\nGkeNodePoolTargetsParser._ValidateUniqueNames(pools)\nGkeNodePoolTargetsParser._ValidateRoles(dataproc, pools)\nGkeNodePoolTargetsParser._ValidatePoolsHaveSameLocation(pools)\nGkeNodePoolTa... | <|body_start_0|>
pools = [_GkeNodePoolTargetParser.Parse(dataproc, gke_cluster, arg_pool, support_shuffle_service) for arg_pool in arg_pools]
GkeNodePoolTargetsParser._ValidateUniqueNames(pools)
GkeNodePoolTargetsParser._ValidateRoles(dataproc, pools)
GkeNodePoolTargetsParser._ValidatePo... | Parses all the --pools flags into a list of GkeNodePoolTarget messages. | GkeNodePoolTargetsParser | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GkeNodePoolTargetsParser:
"""Parses all the --pools flags into a list of GkeNodePoolTarget messages."""
def Parse(dataproc, gke_cluster, arg_pools, support_shuffle_service=False):
"""Parses all the --pools flags into a list of GkeNodePoolTarget messages. Args: dataproc: The Dataproc ... | stack_v2_sparse_classes_36k_train_020110 | 19,343 | permissive | [
{
"docstring": "Parses all the --pools flags into a list of GkeNodePoolTarget messages. Args: dataproc: The Dataproc API version to use for GkeNodePoolTarget messages. gke_cluster: The GKE cluster's relative name, for example, 'projects/p1/locations/l1/clusters/c1'. arg_pools: The list of dict[str, any] generat... | 5 | stack_v2_sparse_classes_30k_train_020613 | Implement the Python class `GkeNodePoolTargetsParser` described below.
Class description:
Parses all the --pools flags into a list of GkeNodePoolTarget messages.
Method signatures and docstrings:
- def Parse(dataproc, gke_cluster, arg_pools, support_shuffle_service=False): Parses all the --pools flags into a list of ... | Implement the Python class `GkeNodePoolTargetsParser` described below.
Class description:
Parses all the --pools flags into a list of GkeNodePoolTarget messages.
Method signatures and docstrings:
- def Parse(dataproc, gke_cluster, arg_pools, support_shuffle_service=False): Parses all the --pools flags into a list of ... | 392abf004b16203030e6efd2f0af24db7c8d669e | <|skeleton|>
class GkeNodePoolTargetsParser:
"""Parses all the --pools flags into a list of GkeNodePoolTarget messages."""
def Parse(dataproc, gke_cluster, arg_pools, support_shuffle_service=False):
"""Parses all the --pools flags into a list of GkeNodePoolTarget messages. Args: dataproc: The Dataproc ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GkeNodePoolTargetsParser:
"""Parses all the --pools flags into a list of GkeNodePoolTarget messages."""
def Parse(dataproc, gke_cluster, arg_pools, support_shuffle_service=False):
"""Parses all the --pools flags into a list of GkeNodePoolTarget messages. Args: dataproc: The Dataproc API version t... | the_stack_v2_python_sparse | lib/googlecloudsdk/command_lib/dataproc/gke_clusters.py | google-cloud-sdk-unofficial/google-cloud-sdk | train | 9 |
8c1a3f07977b699cdb70ac5fa35d6a3d0805990f | [
"d = {}\nl = len(nums)\nfor i in range(l):\n d[nums[i]] = d.get(nums[i], 0) + 1\nfor k, v in d.items():\n if v > 1:\n return k",
"if len(nums) > 1:\n slow = nums[0]\n fast = nums[nums[0]]\n while slow != fast:\n slow = nums[slow]\n fast = nums[nums[fast]]\n fast = 0\n whi... | <|body_start_0|>
d = {}
l = len(nums)
for i in range(l):
d[nums[i]] = d.get(nums[i], 0) + 1
for k, v in d.items():
if v > 1:
return k
<|end_body_0|>
<|body_start_1|>
if len(nums) > 1:
slow = nums[0]
fast = nums[nums... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def findDuplicate(self, nums):
""":type nums: List[int] :rtype: int 通常能想到的方案"""
<|body_0|>
def findDuplicate1(self, nums):
""":type nums: List[int] :rtype: int 想象成链表,判断是否有环,利用快慢指针 空间复杂度为1,时间复杂度为n [3,1,3,4,2] 首先第一个数字3指向下标3的数字4, 数字4指向下标4的数字2 数字2指向下标2的数字3 数字1指... | stack_v2_sparse_classes_36k_train_020111 | 3,381 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: int 通常能想到的方案",
"name": "findDuplicate",
"signature": "def findDuplicate(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: int 想象成链表,判断是否有环,利用快慢指针 空间复杂度为1,时间复杂度为n [3,1,3,4,2] 首先第一个数字3指向下标3的数字4, 数字4指向下标4的数字2 数字2指向下标2的数字3 数字1指向下标1的数字1 举例来说,假... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findDuplicate(self, nums): :type nums: List[int] :rtype: int 通常能想到的方案
- def findDuplicate1(self, nums): :type nums: List[int] :rtype: int 想象成链表,判断是否有环,利用快慢指针 空间复杂度为1,时间复杂度为n ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def findDuplicate(self, nums): :type nums: List[int] :rtype: int 通常能想到的方案
- def findDuplicate1(self, nums): :type nums: List[int] :rtype: int 想象成链表,判断是否有环,利用快慢指针 空间复杂度为1,时间复杂度为n ... | 069bb0b751ef7f469036b9897436eb5d138ffa24 | <|skeleton|>
class Solution:
def findDuplicate(self, nums):
""":type nums: List[int] :rtype: int 通常能想到的方案"""
<|body_0|>
def findDuplicate1(self, nums):
""":type nums: List[int] :rtype: int 想象成链表,判断是否有环,利用快慢指针 空间复杂度为1,时间复杂度为n [3,1,3,4,2] 首先第一个数字3指向下标3的数字4, 数字4指向下标4的数字2 数字2指向下标2的数字3 数字1指... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def findDuplicate(self, nums):
""":type nums: List[int] :rtype: int 通常能想到的方案"""
d = {}
l = len(nums)
for i in range(l):
d[nums[i]] = d.get(nums[i], 0) + 1
for k, v in d.items():
if v > 1:
return k
def findDuplicate1... | the_stack_v2_python_sparse | 算法/数组/寻找重复数.py | RichieSong/algorithm | train | 0 | |
fd07e6d050c95e989a313342eef7c5ad2f2a6734 | [
"super(LuisNet, self).__init__()\nself.threshold = params.defm_dcsn_threshold\nif 'glove' in params.embed_types:\n print('- Using glove embeddings')\n self.word_embed_type = 'glove'\n self.defm_embed_size = params.glove_embedding_size\n self.embedding = nn.Embedding(params.glove_vocab_size, params.defm_... | <|body_start_0|>
super(LuisNet, self).__init__()
self.threshold = params.defm_dcsn_threshold
if 'glove' in params.embed_types:
print('- Using glove embeddings')
self.word_embed_type = 'glove'
self.defm_embed_size = params.glove_embedding_size
self.... | This is the standard way to define your own network in PyTorch. You typically choose the components (e.g. LSTMs, linear layers etc.) of your network in the __init__ function. You then apply these layers on the input step-by-step in the forward function. You can use torch.nn.functional to apply functions such as F.relu,... | LuisNet | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LuisNet:
"""This is the standard way to define your own network in PyTorch. You typically choose the components (e.g. LSTMs, linear layers etc.) of your network in the __init__ function. You then apply these layers on the input step-by-step in the forward function. You can use torch.nn.functional... | stack_v2_sparse_classes_36k_train_020112 | 14,561 | no_license | [
{
"docstring": "We define a definition model which predicts if a sentence is a definition setnence or not. - an embedding layer: maps input to word embeddings - cnn layer: convolves over words in sentences - max pool: pooling layer - bilstm: applying the Bi-LSTM on the sequential input returns an output for eac... | 2 | stack_v2_sparse_classes_30k_train_021149 | Implement the Python class `LuisNet` described below.
Class description:
This is the standard way to define your own network in PyTorch. You typically choose the components (e.g. LSTMs, linear layers etc.) of your network in the __init__ function. You then apply these layers on the input step-by-step in the forward fu... | Implement the Python class `LuisNet` described below.
Class description:
This is the standard way to define your own network in PyTorch. You typically choose the components (e.g. LSTMs, linear layers etc.) of your network in the __init__ function. You then apply these layers on the input step-by-step in the forward fu... | 33c704480411bccc79dfefbe1b51d0f2123ec1a8 | <|skeleton|>
class LuisNet:
"""This is the standard way to define your own network in PyTorch. You typically choose the components (e.g. LSTMs, linear layers etc.) of your network in the __init__ function. You then apply these layers on the input step-by-step in the forward function. You can use torch.nn.functional... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LuisNet:
"""This is the standard way to define your own network in PyTorch. You typically choose the components (e.g. LSTMs, linear layers etc.) of your network in the __init__ function. You then apply these layers on the input step-by-step in the forward function. You can use torch.nn.functional to apply fun... | the_stack_v2_python_sparse | src_def/model/net.py | FelixFra/cs224n_glossary_extraction | train | 0 |
cfe69ac359b64afe4ceded30eae25b518446c36c | [
"new_images = [Image(filepath=filepath_image, guest_id=guest_id) for filepath_image in filepath_images]\ndb.session.add_all(new_images)\ndb.session.commit()",
"if guest_id:\n images = db.session.query(Image).filter_by(guest_id=guest_id).all()\nelse:\n images = db.session.query(Image).all()\nreturn images",
... | <|body_start_0|>
new_images = [Image(filepath=filepath_image, guest_id=guest_id) for filepath_image in filepath_images]
db.session.add_all(new_images)
db.session.commit()
<|end_body_0|>
<|body_start_1|>
if guest_id:
images = db.session.query(Image).filter_by(guest_id=guest_i... | Image | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Image:
def add_images(filepath_images, guest_id):
"""Add new labeled images to the database"""
<|body_0|>
def get_images(guest_id=False):
"""get all labeled images from the image table, returns images of guest if specified"""
<|body_1|>
def update_image(... | stack_v2_sparse_classes_36k_train_020113 | 1,986 | no_license | [
{
"docstring": "Add new labeled images to the database",
"name": "add_images",
"signature": "def add_images(filepath_images, guest_id)"
},
{
"docstring": "get all labeled images from the image table, returns images of guest if specified",
"name": "get_images",
"signature": "def get_image... | 3 | stack_v2_sparse_classes_30k_train_010535 | Implement the Python class `Image` described below.
Class description:
Implement the Image class.
Method signatures and docstrings:
- def add_images(filepath_images, guest_id): Add new labeled images to the database
- def get_images(guest_id=False): get all labeled images from the image table, returns images of guest... | Implement the Python class `Image` described below.
Class description:
Implement the Image class.
Method signatures and docstrings:
- def add_images(filepath_images, guest_id): Add new labeled images to the database
- def get_images(guest_id=False): get all labeled images from the image table, returns images of guest... | ef19d31c78f10071848d20d5b5e5b18d5f245aac | <|skeleton|>
class Image:
def add_images(filepath_images, guest_id):
"""Add new labeled images to the database"""
<|body_0|>
def get_images(guest_id=False):
"""get all labeled images from the image table, returns images of guest if specified"""
<|body_1|>
def update_image(... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Image:
def add_images(filepath_images, guest_id):
"""Add new labeled images to the database"""
new_images = [Image(filepath=filepath_image, guest_id=guest_id) for filepath_image in filepath_images]
db.session.add_all(new_images)
db.session.commit()
def get_images(guest_id=... | the_stack_v2_python_sparse | models/image_model.py | assignon/smart_mirror_dashboard | train | 0 | |
9239f64f45ed7572cbf068ecc6175937dd70cd8f | [
"WuiContentBase.__init__(self, fnDPrint=fnDPrint, oDisp=oDisp)\nself.aoEntries = aoEntries\nself.sRepository = sRepository\nself.iRevision = iRevision\nself.cEntries = cEntries",
"sHtml = '<div class=\"tmvcstimeline tmvcstimelinetooltip\">\\n'\noCurDate = None\nfor oEntry in self.aoEntries:\n oTsZulu = db.dbTi... | <|body_start_0|>
WuiContentBase.__init__(self, fnDPrint=fnDPrint, oDisp=oDisp)
self.aoEntries = aoEntries
self.sRepository = sRepository
self.iRevision = iRevision
self.cEntries = cEntries
<|end_body_0|>
<|body_start_1|>
sHtml = '<div class="tmvcstimeline tmvcstimelineto... | WUI VCS history tooltip generator. | WuiVcsHistoryTooltip | [
"MIT",
"GPL-2.0-only",
"LicenseRef-scancode-unknown-license-reference",
"CDDL-1.0",
"LicenseRef-scancode-warranty-disclaimer",
"GPL-1.0-or-later",
"LGPL-2.1-or-later",
"GPL-2.0-or-later",
"MPL-1.0",
"LicenseRef-scancode-generic-exception",
"Apache-2.0",
"OpenSSL"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WuiVcsHistoryTooltip:
"""WUI VCS history tooltip generator."""
def __init__(self, aoEntries, sRepository, iRevision, cEntries, fnDPrint, oDisp):
"""Override initialization"""
<|body_0|>
def show(self):
"""Generates the tooltip. Returns (sTitle, HTML)."""
... | stack_v2_sparse_classes_36k_train_020114 | 3,435 | permissive | [
{
"docstring": "Override initialization",
"name": "__init__",
"signature": "def __init__(self, aoEntries, sRepository, iRevision, cEntries, fnDPrint, oDisp)"
},
{
"docstring": "Generates the tooltip. Returns (sTitle, HTML).",
"name": "show",
"signature": "def show(self)"
}
] | 2 | null | Implement the Python class `WuiVcsHistoryTooltip` described below.
Class description:
WUI VCS history tooltip generator.
Method signatures and docstrings:
- def __init__(self, aoEntries, sRepository, iRevision, cEntries, fnDPrint, oDisp): Override initialization
- def show(self): Generates the tooltip. Returns (sTitl... | Implement the Python class `WuiVcsHistoryTooltip` described below.
Class description:
WUI VCS history tooltip generator.
Method signatures and docstrings:
- def __init__(self, aoEntries, sRepository, iRevision, cEntries, fnDPrint, oDisp): Override initialization
- def show(self): Generates the tooltip. Returns (sTitl... | 6f78952d58da52ea4f0e55b2ab297f28e80c1160 | <|skeleton|>
class WuiVcsHistoryTooltip:
"""WUI VCS history tooltip generator."""
def __init__(self, aoEntries, sRepository, iRevision, cEntries, fnDPrint, oDisp):
"""Override initialization"""
<|body_0|>
def show(self):
"""Generates the tooltip. Returns (sTitle, HTML)."""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class WuiVcsHistoryTooltip:
"""WUI VCS history tooltip generator."""
def __init__(self, aoEntries, sRepository, iRevision, cEntries, fnDPrint, oDisp):
"""Override initialization"""
WuiContentBase.__init__(self, fnDPrint=fnDPrint, oDisp=oDisp)
self.aoEntries = aoEntries
self.sRep... | the_stack_v2_python_sparse | third_party/virtualbox/src/VBox/ValidationKit/testmanager/webui/wuivcshistory.py | thalium/icebox | train | 585 |
ed06c94ecd08b8020d4a1cc881aa3b78fa6d4d61 | [
"self.words_len = []\nself.len_variats = set()\nself.word2id = dict()\nself.pos_chars = defaultdict(set)",
"if word in self.word2id:\n return\nwid = len(self.words_len)\nself.word2id[word] = wid\nself.words_len.append(len(word))\nself.len_variats.add(len(word))\nfor pos, c in enumerate(word):\n self.pos_cha... | <|body_start_0|>
self.words_len = []
self.len_variats = set()
self.word2id = dict()
self.pos_chars = defaultdict(set)
<|end_body_0|>
<|body_start_1|>
if word in self.word2id:
return
wid = len(self.words_len)
self.word2id[word] = wid
self.words... | WordDictionary | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WordDictionary:
def __init__(self):
"""Initialize your data structure here."""
<|body_0|>
def addWord(self, word):
"""Adds a word into the data structure. :type word: str :rtype: void"""
<|body_1|>
def search(self, word):
"""Returns if the word i... | stack_v2_sparse_classes_36k_train_020115 | 2,262 | no_license | [
{
"docstring": "Initialize your data structure here.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Adds a word into the data structure. :type word: str :rtype: void",
"name": "addWord",
"signature": "def addWord(self, word)"
},
{
"docstring": "Returns... | 3 | stack_v2_sparse_classes_30k_train_016096 | Implement the Python class `WordDictionary` described below.
Class description:
Implement the WordDictionary class.
Method signatures and docstrings:
- def __init__(self): Initialize your data structure here.
- def addWord(self, word): Adds a word into the data structure. :type word: str :rtype: void
- def search(sel... | Implement the Python class `WordDictionary` described below.
Class description:
Implement the WordDictionary class.
Method signatures and docstrings:
- def __init__(self): Initialize your data structure here.
- def addWord(self, word): Adds a word into the data structure. :type word: str :rtype: void
- def search(sel... | 501c347004c140a82a95461e1dbcef6775b3d9da | <|skeleton|>
class WordDictionary:
def __init__(self):
"""Initialize your data structure here."""
<|body_0|>
def addWord(self, word):
"""Adds a word into the data structure. :type word: str :rtype: void"""
<|body_1|>
def search(self, word):
"""Returns if the word i... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class WordDictionary:
def __init__(self):
"""Initialize your data structure here."""
self.words_len = []
self.len_variats = set()
self.word2id = dict()
self.pos_chars = defaultdict(set)
def addWord(self, word):
"""Adds a word into the data structure. :type word: ... | the_stack_v2_python_sparse | 211-add_and_search_words.py | dkrotx/leetcode | train | 0 | |
359b15ff803de97b0aeb235956aee0ab54090d39 | [
"super().__init__(**kwargs)\nn_layer = len(neurons)\nself.mlp = MLP(neurons=neurons, activations=[activation] * n_layer)\nneurons = neurons[:-1] + [1]\nacts = [activation] * (n_layer - 1) + ['sigmoid']\nself.weight = MLP(neurons=neurons, activations=acts)\nself.neurons = neurons\nself.activation = activation\nself.... | <|body_start_0|>
super().__init__(**kwargs)
n_layer = len(neurons)
self.mlp = MLP(neurons=neurons, activations=[activation] * n_layer)
neurons = neurons[:-1] + [1]
acts = [activation] * (n_layer - 1) + ['sigmoid']
self.weight = MLP(neurons=neurons, activations=acts)
... | Perform a weighted average of the readout field. Weights are learnable from this layer | WeightedReadout | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WeightedReadout:
"""Perform a weighted average of the readout field. Weights are learnable from this layer"""
def __init__(self, neurons: List[int], activation='swish', field: str='atoms', **kwargs):
"""Args: neurons (list): list of number of neurons in each layer activation (str): a... | stack_v2_sparse_classes_36k_train_020116 | 8,087 | permissive | [
{
"docstring": "Args: neurons (list): list of number of neurons in each layer activation (str): activation function field (str): the field to perform the readout, choose from \"atoms\" or \"bonds\" **kwargs:",
"name": "__init__",
"signature": "def __init__(self, neurons: List[int], activation='swish', f... | 3 | stack_v2_sparse_classes_30k_train_000780 | Implement the Python class `WeightedReadout` described below.
Class description:
Perform a weighted average of the readout field. Weights are learnable from this layer
Method signatures and docstrings:
- def __init__(self, neurons: List[int], activation='swish', field: str='atoms', **kwargs): Args: neurons (list): li... | Implement the Python class `WeightedReadout` described below.
Class description:
Perform a weighted average of the readout field. Weights are learnable from this layer
Method signatures and docstrings:
- def __init__(self, neurons: List[int], activation='swish', field: str='atoms', **kwargs): Args: neurons (list): li... | 1f89ecb564b2691c810cd106c3476b15a8699bb7 | <|skeleton|>
class WeightedReadout:
"""Perform a weighted average of the readout field. Weights are learnable from this layer"""
def __init__(self, neurons: List[int], activation='swish', field: str='atoms', **kwargs):
"""Args: neurons (list): list of number of neurons in each layer activation (str): a... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class WeightedReadout:
"""Perform a weighted average of the readout field. Weights are learnable from this layer"""
def __init__(self, neurons: List[int], activation='swish', field: str='atoms', **kwargs):
"""Args: neurons (list): list of number of neurons in each layer activation (str): activation fun... | the_stack_v2_python_sparse | m3gnet/layers/_readout.py | materialsvirtuallab/m3gnet | train | 175 |
249f3044d5293ce14866cf9db907fb0a4a80f45b | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn FileHash()",
"from .file_hash_type import FileHashType\nfrom .file_hash_type import FileHashType\nfields: Dict[str, Callable[[Any], None]] = {'hashType': lambda n: setattr(self, 'hash_type', n.get_enum_value(FileHashType)), 'hashValue'... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return FileHash()
<|end_body_0|>
<|body_start_1|>
from .file_hash_type import FileHashType
from .file_hash_type import FileHashType
fields: Dict[str, Callable[[Any], None]] = {'hashType... | FileHash | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FileHash:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> FileHash:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: FileHash... | stack_v2_sparse_classes_36k_train_020117 | 2,909 | permissive | [
{
"docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: FileHash",
"name": "create_from_discriminator_value",
"signature": "def create_from_discriminator_value(pars... | 3 | null | Implement the Python class `FileHash` described below.
Class description:
Implement the FileHash class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> FileHash: Creates a new instance of the appropriate class based on discriminator value Args: parse_no... | Implement the Python class `FileHash` described below.
Class description:
Implement the FileHash class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> FileHash: Creates a new instance of the appropriate class based on discriminator value Args: parse_no... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class FileHash:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> FileHash:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: FileHash... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FileHash:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> FileHash:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: FileHash"""
if... | the_stack_v2_python_sparse | msgraph/generated/models/file_hash.py | microsoftgraph/msgraph-sdk-python | train | 135 | |
4f89da3cd0a34cb113e61d9694ff10fc4519053d | [
"EventHandler.__init__(self)\nself._gui = gui\nself._peg = peg\nself._monitor = Monitor()",
"if event.getDescription() == 'mouse click':\n hole = event.getTrigger()\n hole.removeHandler(self)\n box = Layer()\n box.move(hole.getReferencePoint().getX(), hole.getReferencePoint().getY())\n box.setDepth... | <|body_start_0|>
EventHandler.__init__(self)
self._gui = gui
self._peg = peg
self._monitor = Monitor()
<|end_body_0|>
<|body_start_1|>
if event.getDescription() == 'mouse click':
hole = event.getTrigger()
hole.removeHandler(self)
box = Layer()... | Manager for an overlay to select a peg color. | PegHandler | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PegHandler:
"""Manager for an overlay to select a peg color."""
def __init__(self, gui, peg):
"""Create a new PegHandler instance. gui reference to the user interface peg integer indicating which peg is being set"""
<|body_0|>
def handle(self, event):
"""Display ... | stack_v2_sparse_classes_36k_train_020118 | 6,736 | no_license | [
{
"docstring": "Create a new PegHandler instance. gui reference to the user interface peg integer indicating which peg is being set",
"name": "__init__",
"signature": "def __init__(self, gui, peg)"
},
{
"docstring": "Display options when the user mouse clicks on a peg.",
"name": "handle",
... | 2 | null | Implement the Python class `PegHandler` described below.
Class description:
Manager for an overlay to select a peg color.
Method signatures and docstrings:
- def __init__(self, gui, peg): Create a new PegHandler instance. gui reference to the user interface peg integer indicating which peg is being set
- def handle(s... | Implement the Python class `PegHandler` described below.
Class description:
Manager for an overlay to select a peg color.
Method signatures and docstrings:
- def __init__(self, gui, peg): Create a new PegHandler instance. gui reference to the user interface peg integer indicating which peg is being set
- def handle(s... | 2d008e9cedc33d9e24420bef14b73b28ff54cdbf | <|skeleton|>
class PegHandler:
"""Manager for an overlay to select a peg color."""
def __init__(self, gui, peg):
"""Create a new PegHandler instance. gui reference to the user interface peg integer indicating which peg is being set"""
<|body_0|>
def handle(self, event):
"""Display ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PegHandler:
"""Manager for an overlay to select a peg color."""
def __init__(self, gui, peg):
"""Create a new PegHandler instance. gui reference to the user interface peg integer indicating which peg is being set"""
EventHandler.__init__(self)
self._gui = gui
self._peg = p... | the_stack_v2_python_sparse | C152/sourcecode/ch15/MastermindGUI.py | nrichgels/ClassCode | train | 2 |
ce77e21c9e98a71c86d22d13e2fa1b1bc3fd870d | [
"self._attr_current_option = None\nself.entity_domain = ENTITY_DOMAIN\nsuper().__init__(config_entry=config_entry, coordinator=coordinator, description=description)",
"self._attr_current_option = option\nawait self.async_update_ha_state()\nasync_dispatcher_send(self.hass, SIGNAL_HDHOMERUN_CHANNEL_SOURCE_CHANGE, s... | <|body_start_0|>
self._attr_current_option = None
self.entity_domain = ENTITY_DOMAIN
super().__init__(config_entry=config_entry, coordinator=coordinator, description=description)
<|end_body_0|>
<|body_start_1|>
self._attr_current_option = option
await self.async_update_ha_state(... | Representation for a select entity. | HDHomeRunSelect | [
"Unlicense"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HDHomeRunSelect:
"""Representation for a select entity."""
def __init__(self, coordinator: DataUpdateCoordinator, config_entry: ConfigEntry, description: HDHomeRunSelectDescription) -> None:
"""Initialise."""
<|body_0|>
async def async_select_option(self, option: str) ->... | stack_v2_sparse_classes_36k_train_020119 | 3,793 | permissive | [
{
"docstring": "Initialise.",
"name": "__init__",
"signature": "def __init__(self, coordinator: DataUpdateCoordinator, config_entry: ConfigEntry, description: HDHomeRunSelectDescription) -> None"
},
{
"docstring": "Select the option.",
"name": "async_select_option",
"signature": "async d... | 3 | stack_v2_sparse_classes_30k_train_012355 | Implement the Python class `HDHomeRunSelect` described below.
Class description:
Representation for a select entity.
Method signatures and docstrings:
- def __init__(self, coordinator: DataUpdateCoordinator, config_entry: ConfigEntry, description: HDHomeRunSelectDescription) -> None: Initialise.
- async def async_sel... | Implement the Python class `HDHomeRunSelect` described below.
Class description:
Representation for a select entity.
Method signatures and docstrings:
- def __init__(self, coordinator: DataUpdateCoordinator, config_entry: ConfigEntry, description: HDHomeRunSelectDescription) -> None: Initialise.
- async def async_sel... | 8548d9999ddd54f13d6a307e013abcb8c897a74e | <|skeleton|>
class HDHomeRunSelect:
"""Representation for a select entity."""
def __init__(self, coordinator: DataUpdateCoordinator, config_entry: ConfigEntry, description: HDHomeRunSelectDescription) -> None:
"""Initialise."""
<|body_0|>
async def async_select_option(self, option: str) ->... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class HDHomeRunSelect:
"""Representation for a select entity."""
def __init__(self, coordinator: DataUpdateCoordinator, config_entry: ConfigEntry, description: HDHomeRunSelectDescription) -> None:
"""Initialise."""
self._attr_current_option = None
self.entity_domain = ENTITY_DOMAIN
... | the_stack_v2_python_sparse | custom_components/hdhomerun/select.py | bacco007/HomeAssistantConfig | train | 98 |
ffbf208412b492015c705404f5941e1f9068fb59 | [
"self.directory = directory\nself.files_summary = {}\nself.analyze_files()",
"try:\n d_open = os.listdir(self.directory)\n os.chdir(self.directory)\nexcept NotADirectoryError:\n raise 'Directory is not Found.'\nelse:\n for file_name in d_open:\n if file_name.endswith('.py'):\n try:\n... | <|body_start_0|>
self.directory = directory
self.files_summary = {}
self.analyze_files()
<|end_body_0|>
<|body_start_1|>
try:
d_open = os.listdir(self.directory)
os.chdir(self.directory)
except NotADirectoryError:
raise 'Directory is not Found... | Class which consist of 3 functions solely for file analyzing purpose | FileAnalyzer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FileAnalyzer:
"""Class which consist of 3 functions solely for file analyzing purpose"""
def __init__(self, directory):
"""Initializes the variable or fucntion"""
<|body_0|>
def analyze_files(self):
"""Your To Analyze the file and create a counts of character and... | stack_v2_sparse_classes_36k_train_020120 | 4,569 | no_license | [
{
"docstring": "Initializes the variable or fucntion",
"name": "__init__",
"signature": "def __init__(self, directory)"
},
{
"docstring": "Your To Analyze the file and create a counts of character and so on.",
"name": "analyze_files",
"signature": "def analyze_files(self)"
},
{
"... | 3 | stack_v2_sparse_classes_30k_train_014258 | Implement the Python class `FileAnalyzer` described below.
Class description:
Class which consist of 3 functions solely for file analyzing purpose
Method signatures and docstrings:
- def __init__(self, directory): Initializes the variable or fucntion
- def analyze_files(self): Your To Analyze the file and create a co... | Implement the Python class `FileAnalyzer` described below.
Class description:
Class which consist of 3 functions solely for file analyzing purpose
Method signatures and docstrings:
- def __init__(self, directory): Initializes the variable or fucntion
- def analyze_files(self): Your To Analyze the file and create a co... | 228897e2a76c45b5c7c7e40711cfd81adf1037cb | <|skeleton|>
class FileAnalyzer:
"""Class which consist of 3 functions solely for file analyzing purpose"""
def __init__(self, directory):
"""Initializes the variable or fucntion"""
<|body_0|>
def analyze_files(self):
"""Your To Analyze the file and create a counts of character and... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FileAnalyzer:
"""Class which consist of 3 functions solely for file analyzing purpose"""
def __init__(self, directory):
"""Initializes the variable or fucntion"""
self.directory = directory
self.files_summary = {}
self.analyze_files()
def analyze_files(self):
... | the_stack_v2_python_sparse | HomeWork08/HW08_Dinesh_Nadar.py | DineshNadar95/CS-810 | train | 0 |
686b289763b6521bff11a3f2da1858d35227ce18 | [
"self.stemmer = stemmer\nself.queries = queries\nself.mesures = mesures\nself.models = models\nlog.info('%s instancié, avec %d requêtes, %d mesures et %d modèles.', self.__class__.__name__, len(self.queries), len(self.mesures), len(self.models))",
"log.info(\"Début de l'évaluation\")\nlog_start = time.time()\nmes... | <|body_start_0|>
self.stemmer = stemmer
self.queries = queries
self.mesures = mesures
self.models = models
log.info('%s instancié, avec %d requêtes, %d mesures et %d modèles.', self.__class__.__name__, len(self.queries), len(self.mesures), len(self.models))
<|end_body_0|>
<|body... | Évaluateur EvalIRModel | EvalIRModel | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EvalIRModel:
"""Évaluateur EvalIRModel"""
def __init__(self, stemmer, queries, mesures, models):
"""Initialise un évaluateur de modèles :param queries: Requêtes à tester :param mesures: Mesures à utiliser :param models: Liste de modèles à évaluer"""
<|body_0|>
def eval(s... | stack_v2_sparse_classes_36k_train_020121 | 4,687 | no_license | [
{
"docstring": "Initialise un évaluateur de modèles :param queries: Requêtes à tester :param mesures: Mesures à utiliser :param models: Liste de modèles à évaluer",
"name": "__init__",
"signature": "def __init__(self, stemmer, queries, mesures, models)"
},
{
"docstring": "Évalue une liste de mod... | 2 | stack_v2_sparse_classes_30k_train_013246 | Implement the Python class `EvalIRModel` described below.
Class description:
Évaluateur EvalIRModel
Method signatures and docstrings:
- def __init__(self, stemmer, queries, mesures, models): Initialise un évaluateur de modèles :param queries: Requêtes à tester :param mesures: Mesures à utiliser :param models: Liste d... | Implement the Python class `EvalIRModel` described below.
Class description:
Évaluateur EvalIRModel
Method signatures and docstrings:
- def __init__(self, stemmer, queries, mesures, models): Initialise un évaluateur de modèles :param queries: Requêtes à tester :param mesures: Mesures à utiliser :param models: Liste d... | 378ec0e7522c7bb041c087c6085c54dc5ccd3a6f | <|skeleton|>
class EvalIRModel:
"""Évaluateur EvalIRModel"""
def __init__(self, stemmer, queries, mesures, models):
"""Initialise un évaluateur de modèles :param queries: Requêtes à tester :param mesures: Mesures à utiliser :param models: Liste de modèles à évaluer"""
<|body_0|>
def eval(s... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class EvalIRModel:
"""Évaluateur EvalIRModel"""
def __init__(self, stemmer, queries, mesures, models):
"""Initialise un évaluateur de modèles :param queries: Requêtes à tester :param mesures: Mesures à utiliser :param models: Liste de modèles à évaluer"""
self.stemmer = stemmer
self.que... | the_stack_v2_python_sparse | Code/Mesures.py | Benlog/RI | train | 0 |
92e681dc31b1f699c166c3367b7e34f444b8d761 | [
"self.snake = collections.deque([(0, 0)])\nself.food = collections.deque(food)\nself.width = width\nself.height = height\nself.d = {'U': (-1, 0), 'L': (0, -1), 'R': (0, 1), 'D': (1, 0)}",
"\"\"\"\n 1. check out of boundary\n 2. deque to store snake, add to the top and delete the last one in the dequ... | <|body_start_0|>
self.snake = collections.deque([(0, 0)])
self.food = collections.deque(food)
self.width = width
self.height = height
self.d = {'U': (-1, 0), 'L': (0, -1), 'R': (0, 1), 'D': (1, 0)}
<|end_body_0|>
<|body_start_1|>
"""
1. check out of bound... | SnakeGame | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SnakeGame:
def __init__(self, width: int, height: int, food: List[List[int]]):
"""Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], t... | stack_v2_sparse_classes_36k_train_020122 | 2,091 | no_license | [
{
"docstring": "Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is at [1,0].",
"name": "__init__",
"signature": "def __init__(self, widt... | 2 | null | Implement the Python class `SnakeGame` described below.
Class description:
Implement the SnakeGame class.
Method signatures and docstrings:
- def __init__(self, width: int, height: int, food: List[List[int]]): Initialize your data structure here. @param width - screen width @param height - screen height @param food -... | Implement the Python class `SnakeGame` described below.
Class description:
Implement the SnakeGame class.
Method signatures and docstrings:
- def __init__(self, width: int, height: int, food: List[List[int]]): Initialize your data structure here. @param width - screen width @param height - screen height @param food -... | e431ff831ddd5f26891e6ee4506a20d7972b4f02 | <|skeleton|>
class SnakeGame:
def __init__(self, width: int, height: int, food: List[List[int]]):
"""Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], t... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SnakeGame:
def __init__(self, width: int, height: int, food: List[List[int]]):
"""Initialize your data structure here. @param width - screen width @param height - screen height @param food - A list of food positions E.g food = [[1,1], [1,0]] means the first food is positioned at [1,1], the second is a... | the_stack_v2_python_sparse | leetcode_python/353.Design_Snake_Game.py | zihuaweng/leetcode-solutions | train | 4 | |
ed92b882459bb173298447219338286e8d89f537 | [
"self._announce_text = announce_text\nself._logger = logger\nself._start_byte = start_byte\nself._override_total_size = override_total_size\nself._last_byte_written = False",
"if not self._logger.isEnabledFor(logging.INFO) or self._last_byte_written:\n return\nif self._override_total_size:\n total_size = se... | <|body_start_0|>
self._announce_text = announce_text
self._logger = logger
self._start_byte = start_byte
self._override_total_size = override_total_size
self._last_byte_written = False
<|end_body_0|>
<|body_start_1|>
if not self._logger.isEnabledFor(logging.INFO) or self... | Outputs progress info for large operations like file copy or hash. | FileProgressCallbackHandler | [
"LGPL-2.0-or-later",
"GPL-1.0-or-later",
"MIT",
"Apache-2.0",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FileProgressCallbackHandler:
"""Outputs progress info for large operations like file copy or hash."""
def __init__(self, announce_text, logger, start_byte=0, override_total_size=None):
"""Initializes the callback handler. Args: announce_text: String describing the operation. logger: ... | stack_v2_sparse_classes_36k_train_020123 | 7,111 | permissive | [
{
"docstring": "Initializes the callback handler. Args: announce_text: String describing the operation. logger: For outputting log messages. start_byte: The beginning of the file component, if one is being used. override_total_size: The size of the file component, if one is being used.",
"name": "__init__",... | 2 | stack_v2_sparse_classes_30k_train_021368 | Implement the Python class `FileProgressCallbackHandler` described below.
Class description:
Outputs progress info for large operations like file copy or hash.
Method signatures and docstrings:
- def __init__(self, announce_text, logger, start_byte=0, override_total_size=None): Initializes the callback handler. Args:... | Implement the Python class `FileProgressCallbackHandler` described below.
Class description:
Outputs progress info for large operations like file copy or hash.
Method signatures and docstrings:
- def __init__(self, announce_text, logger, start_byte=0, override_total_size=None): Initializes the callback handler. Args:... | 72a05af97787001756bae2511b7985e61498c965 | <|skeleton|>
class FileProgressCallbackHandler:
"""Outputs progress info for large operations like file copy or hash."""
def __init__(self, announce_text, logger, start_byte=0, override_total_size=None):
"""Initializes the callback handler. Args: announce_text: String describing the operation. logger: ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FileProgressCallbackHandler:
"""Outputs progress info for large operations like file copy or hash."""
def __init__(self, announce_text, logger, start_byte=0, override_total_size=None):
"""Initializes the callback handler. Args: announce_text: String describing the operation. logger: For outputtin... | the_stack_v2_python_sparse | third_party/catapult/third_party/gsutil/gslib/progress_callback.py | metux/chromium-suckless | train | 5 |
0c6db7059aab96191c0df3fd45593ce4ba828e34 | [
"self.contextName = contextName\nself.lineNum = lineNum\nself.srcText = srcText\nself.comment = comment\nself.transType = 'unfinished'\nself.transText = ''",
"lines = [' <message>', f' <location filename=\"{self.contextName}.py\" line=\"{self.lineNum}\"/>', f' <source>{escape(self.srcText)}</sour... | <|body_start_0|>
self.contextName = contextName
self.lineNum = lineNum
self.srcText = srcText
self.comment = comment
self.transType = 'unfinished'
self.transText = ''
<|end_body_0|>
<|body_start_1|>
lines = [' <message>', f' <location filename="{self.co... | Class to hold data for and output a single translation string. | TransItem | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TransItem:
"""Class to hold data for and output a single translation string."""
def __init__(self, contextName, lineNum, srcText, comment=''):
"""Initialize the tramslation string item. Arguments: contextName -- a string containing the filename-based context lineNum -- the line of th... | stack_v2_sparse_classes_36k_train_020124 | 10,355 | no_license | [
{
"docstring": "Initialize the tramslation string item. Arguments: contextName -- a string containing the filename-based context lineNum -- the line of the first occurrence in the source code srcText -- the untranslated source text string comment -- optional comment from source as a guide to translation",
"... | 2 | null | Implement the Python class `TransItem` described below.
Class description:
Class to hold data for and output a single translation string.
Method signatures and docstrings:
- def __init__(self, contextName, lineNum, srcText, comment=''): Initialize the tramslation string item. Arguments: contextName -- a string contai... | Implement the Python class `TransItem` described below.
Class description:
Class to hold data for and output a single translation string.
Method signatures and docstrings:
- def __init__(self, contextName, lineNum, srcText, comment=''): Initialize the tramslation string item. Arguments: contextName -- a string contai... | c9429496e8ed15116746a23f3a90f262cf54f755 | <|skeleton|>
class TransItem:
"""Class to hold data for and output a single translation string."""
def __init__(self, contextName, lineNum, srcText, comment=''):
"""Initialize the tramslation string item. Arguments: contextName -- a string containing the filename-based context lineNum -- the line of th... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TransItem:
"""Class to hold data for and output a single translation string."""
def __init__(self, contextName, lineNum, srcText, comment=''):
"""Initialize the tramslation string item. Arguments: contextName -- a string containing the filename-based context lineNum -- the line of the first occur... | the_stack_v2_python_sparse | working/translations/gettrans.py | doug-101/TreeLine | train | 121 |
d581c5363c634e5700d37cd421f2d800495f72df | [
"try:\n classroom = classroom_table.objects.all()\nexcept:\n return Response({'error': '查询失败'})\nclassroom_serializer = ClassRoomSerializer(classroom, many=True)\nclassroom_dict = classroom_serializer.data\nreturn Response(classroom_dict)",
"classroom_info = request.data\ncrid = classroom_info.getlist('crid... | <|body_start_0|>
try:
classroom = classroom_table.objects.all()
except:
return Response({'error': '查询失败'})
classroom_serializer = ClassRoomSerializer(classroom, many=True)
classroom_dict = classroom_serializer.data
return Response(classroom_dict)
<|end_bod... | ClassRoomView | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ClassRoomView:
def get(self, request):
"""查询所有"""
<|body_0|>
def post(self, request):
"""创建"""
<|body_1|>
def put(self, request, pk):
"""修改"""
<|body_2|>
def patch(self, request, pk):
"""局部更新"""
<|body_3|>
def de... | stack_v2_sparse_classes_36k_train_020125 | 3,158 | permissive | [
{
"docstring": "查询所有",
"name": "get",
"signature": "def get(self, request)"
},
{
"docstring": "创建",
"name": "post",
"signature": "def post(self, request)"
},
{
"docstring": "修改",
"name": "put",
"signature": "def put(self, request, pk)"
},
{
"docstring": "局部更新",
... | 5 | stack_v2_sparse_classes_30k_train_014676 | Implement the Python class `ClassRoomView` described below.
Class description:
Implement the ClassRoomView class.
Method signatures and docstrings:
- def get(self, request): 查询所有
- def post(self, request): 创建
- def put(self, request, pk): 修改
- def patch(self, request, pk): 局部更新
- def delete(self, request): 删除 | Implement the Python class `ClassRoomView` described below.
Class description:
Implement the ClassRoomView class.
Method signatures and docstrings:
- def get(self, request): 查询所有
- def post(self, request): 创建
- def put(self, request, pk): 修改
- def patch(self, request, pk): 局部更新
- def delete(self, request): 删除
<|skel... | 0e926292d86070f6f42066e73374ea74e39ca169 | <|skeleton|>
class ClassRoomView:
def get(self, request):
"""查询所有"""
<|body_0|>
def post(self, request):
"""创建"""
<|body_1|>
def put(self, request, pk):
"""修改"""
<|body_2|>
def patch(self, request, pk):
"""局部更新"""
<|body_3|>
def de... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ClassRoomView:
def get(self, request):
"""查询所有"""
try:
classroom = classroom_table.objects.all()
except:
return Response({'error': '查询失败'})
classroom_serializer = ClassRoomSerializer(classroom, many=True)
classroom_dict = classroom_serializer.dat... | the_stack_v2_python_sparse | ETMS/ETMS/apps/classroom/views.py | 17605272633/ETMS | train | 1 | |
5f2c7feea19aaa5589a3bc8153f48a4d44710683 | [
"delete_database()\ntest_import = import_data('csvfiles', 'inventory.csv', 'customers.csv', 'rental.csv')\nself.assertEqual(test_import, ((4, 4, 4), (0, 0, 0)))\ndelete_database()\ntest_import = import_data('csvfiles', 'inventory1.csv', 'customers.csv', 'rental.csv')\nself.assertEqual(test_import, ((0, 4, 4), (1, 0... | <|body_start_0|>
delete_database()
test_import = import_data('csvfiles', 'inventory.csv', 'customers.csv', 'rental.csv')
self.assertEqual(test_import, ((4, 4, 4), (0, 0, 0)))
delete_database()
test_import = import_data('csvfiles', 'inventory1.csv', 'customers.csv', 'rental.csv')
... | "test for database.py | TestDatabase | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestDatabase:
""""test for database.py"""
def test_import_data(self):
"""test import_data"""
<|body_0|>
def test_show_rentals(self):
"""test for show_rentals"""
<|body_1|>
def test_show_available_products(self):
"""rest for show_available_pro... | stack_v2_sparse_classes_36k_train_020126 | 2,486 | no_license | [
{
"docstring": "test import_data",
"name": "test_import_data",
"signature": "def test_import_data(self)"
},
{
"docstring": "test for show_rentals",
"name": "test_show_rentals",
"signature": "def test_show_rentals(self)"
},
{
"docstring": "rest for show_available_products",
"n... | 3 | null | Implement the Python class `TestDatabase` described below.
Class description:
"test for database.py
Method signatures and docstrings:
- def test_import_data(self): test import_data
- def test_show_rentals(self): test for show_rentals
- def test_show_available_products(self): rest for show_available_products | Implement the Python class `TestDatabase` described below.
Class description:
"test for database.py
Method signatures and docstrings:
- def test_import_data(self): test import_data
- def test_show_rentals(self): test for show_rentals
- def test_show_available_products(self): rest for show_available_products
<|skelet... | 5dac60f39e3909ff05b26721d602ed20f14d6be3 | <|skeleton|>
class TestDatabase:
""""test for database.py"""
def test_import_data(self):
"""test import_data"""
<|body_0|>
def test_show_rentals(self):
"""test for show_rentals"""
<|body_1|>
def test_show_available_products(self):
"""rest for show_available_pro... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestDatabase:
""""test for database.py"""
def test_import_data(self):
"""test import_data"""
delete_database()
test_import = import_data('csvfiles', 'inventory.csv', 'customers.csv', 'rental.csv')
self.assertEqual(test_import, ((4, 4, 4), (0, 0, 0)))
delete_databas... | the_stack_v2_python_sparse | students/lauraannf/lessons/lesson09/assignment/test_database.py | JavaRod/SP_Python220B_2019 | train | 1 |
286a2078ee2b759347da8b8528e23b1dba1c4d96 | [
"url = 'https://www.erlangcha.com/api/storiesList?page=1'\nheaders = process_headers('page=1')\nyield scrapy.Request(url, headers=headers)",
"results = json.loads(response.text)\ndata = results.get('data', {})\nif not data:\n return\ncontent = data.get('content', [])\nfor result in content:\n stories_logo =... | <|body_start_0|>
url = 'https://www.erlangcha.com/api/storiesList?page=1'
headers = process_headers('page=1')
yield scrapy.Request(url, headers=headers)
<|end_body_0|>
<|body_start_1|>
results = json.loads(response.text)
data = results.get('data', {})
if not data:
... | ErlangchaSpider | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ErlangchaSpider:
def start_requests(self):
"""请求列表页"""
<|body_0|>
def parse(self, response):
"""解析列表页,列表页翻页"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
url = 'https://www.erlangcha.com/api/storiesList?page=1'
headers = process_headers('p... | stack_v2_sparse_classes_36k_train_020127 | 2,444 | permissive | [
{
"docstring": "请求列表页",
"name": "start_requests",
"signature": "def start_requests(self)"
},
{
"docstring": "解析列表页,列表页翻页",
"name": "parse",
"signature": "def parse(self, response)"
}
] | 2 | stack_v2_sparse_classes_30k_train_010496 | Implement the Python class `ErlangchaSpider` described below.
Class description:
Implement the ErlangchaSpider class.
Method signatures and docstrings:
- def start_requests(self): 请求列表页
- def parse(self, response): 解析列表页,列表页翻页 | Implement the Python class `ErlangchaSpider` described below.
Class description:
Implement the ErlangchaSpider class.
Method signatures and docstrings:
- def start_requests(self): 请求列表页
- def parse(self, response): 解析列表页,列表页翻页
<|skeleton|>
class ErlangchaSpider:
def start_requests(self):
"""请求列表页"""
... | 5922e39bee47bf4114ab06670f49e32eb1bc4b1d | <|skeleton|>
class ErlangchaSpider:
def start_requests(self):
"""请求列表页"""
<|body_0|>
def parse(self, response):
"""解析列表页,列表页翻页"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ErlangchaSpider:
def start_requests(self):
"""请求列表页"""
url = 'https://www.erlangcha.com/api/storiesList?page=1'
headers = process_headers('page=1')
yield scrapy.Request(url, headers=headers)
def parse(self, response):
"""解析列表页,列表页翻页"""
results = json.loads(... | the_stack_v2_python_sparse | credit_china/spiders/erlangcha.py | pythonyhd/reverse_spider | train | 9 | |
68d79cdfd0acb25ff9ba7bb3cc7cb325cd5a22e1 | [
"person = model.Person.get(self.subdomain, self.params.id)\nif not person:\n return self.error(400, 'No person with ID: %r' % self.params.id)\nself.render('templates/delete.html', person=person, view_url=self.get_url('/view', id=self.params.id), captcha_html=self.get_captcha_html())",
"person = model.Person.ge... | <|body_start_0|>
person = model.Person.get(self.subdomain, self.params.id)
if not person:
return self.error(400, 'No person with ID: %r' % self.params.id)
self.render('templates/delete.html', person=person, view_url=self.get_url('/view', id=self.params.id), captcha_html=self.get_capt... | Handles a user request to delete a person record. | Delete | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Delete:
"""Handles a user request to delete a person record."""
def get(self):
"""Prompts the user with a Turing test before carrying out deletion."""
<|body_0|>
def post(self):
"""If the user passed the Turing test, delete the record."""
<|body_1|>
... | stack_v2_sparse_classes_36k_train_020128 | 5,176 | permissive | [
{
"docstring": "Prompts the user with a Turing test before carrying out deletion.",
"name": "get",
"signature": "def get(self)"
},
{
"docstring": "If the user passed the Turing test, delete the record.",
"name": "post",
"signature": "def post(self)"
},
{
"docstring": "Returns a U... | 4 | stack_v2_sparse_classes_30k_train_009258 | Implement the Python class `Delete` described below.
Class description:
Handles a user request to delete a person record.
Method signatures and docstrings:
- def get(self): Prompts the user with a Turing test before carrying out deletion.
- def post(self): If the user passed the Turing test, delete the record.
- def ... | Implement the Python class `Delete` described below.
Class description:
Handles a user request to delete a person record.
Method signatures and docstrings:
- def get(self): Prompts the user with a Turing test before carrying out deletion.
- def post(self): If the user passed the Turing test, delete the record.
- def ... | 58604c9efcd4ef792f4b6e99660867001eb434fd | <|skeleton|>
class Delete:
"""Handles a user request to delete a person record."""
def get(self):
"""Prompts the user with a Turing test before carrying out deletion."""
<|body_0|>
def post(self):
"""If the user passed the Turing test, delete the record."""
<|body_1|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Delete:
"""Handles a user request to delete a person record."""
def get(self):
"""Prompts the user with a Turing test before carrying out deletion."""
person = model.Person.get(self.subdomain, self.params.id)
if not person:
return self.error(400, 'No person with ID: %r... | the_stack_v2_python_sparse | app/delete.py | luiseduardohdbackup/pet-finder | train | 0 |
ce6cb605239ff0916f89997d17095504028617f5 | [
"self.A = A\nself.index = 0\nself.used = 0",
"count = 0\ntarget = self.used + n\nwhile self.index < len(self.A) and count + self.A[self.index] < target:\n count += self.A[self.index]\n self.index += 2\nif self.index >= len(self.A):\n return -1\nelse:\n self.used = target - count\n return self.A[sel... | <|body_start_0|>
self.A = A
self.index = 0
self.used = 0
<|end_body_0|>
<|body_start_1|>
count = 0
target = self.used + n
while self.index < len(self.A) and count + self.A[self.index] < target:
count += self.A[self.index]
self.index += 2
i... | RLEIterator | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RLEIterator:
def __init__(self, A):
""":type A: List[int]"""
<|body_0|>
def next(self, n):
""":type n: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.A = A
self.index = 0
self.used = 0
<|end_body_0|>
<|body_sta... | stack_v2_sparse_classes_36k_train_020129 | 3,282 | no_license | [
{
"docstring": ":type A: List[int]",
"name": "__init__",
"signature": "def __init__(self, A)"
},
{
"docstring": ":type n: int :rtype: int",
"name": "next",
"signature": "def next(self, n)"
}
] | 2 | null | Implement the Python class `RLEIterator` described below.
Class description:
Implement the RLEIterator class.
Method signatures and docstrings:
- def __init__(self, A): :type A: List[int]
- def next(self, n): :type n: int :rtype: int | Implement the Python class `RLEIterator` described below.
Class description:
Implement the RLEIterator class.
Method signatures and docstrings:
- def __init__(self, A): :type A: List[int]
- def next(self, n): :type n: int :rtype: int
<|skeleton|>
class RLEIterator:
def __init__(self, A):
""":type A: Lis... | 635af6e22aa8eef8e7920a585d43a45a891a8157 | <|skeleton|>
class RLEIterator:
def __init__(self, A):
""":type A: List[int]"""
<|body_0|>
def next(self, n):
""":type n: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RLEIterator:
def __init__(self, A):
""":type A: List[int]"""
self.A = A
self.index = 0
self.used = 0
def next(self, n):
""":type n: int :rtype: int"""
count = 0
target = self.used + n
while self.index < len(self.A) and count + self.A[self.in... | the_stack_v2_python_sparse | code900RLEIterator.py | cybelewang/leetcode-python | train | 0 | |
2de5036a7a089c7c99425d83c4510d2e8881f2cb | [
"try:\n st = self.get_all_objects(Store)\n serializer = serializers.StoreSerializer(st, many=True)\n return Utils.dispatch_success(request, serializer.data)\nexcept Exception as e:\n return self.internal_server_error(request, e)",
"try:\n print(request.data)\n serializer = serializers.StoreSeria... | <|body_start_0|>
try:
st = self.get_all_objects(Store)
serializer = serializers.StoreSerializer(st, many=True)
return Utils.dispatch_success(request, serializer.data)
except Exception as e:
return self.internal_server_error(request, e)
<|end_body_0|>
<|bo... | StoreList | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StoreList:
def get(self, request, *args, **kwargs):
"""Get the list of Store :param request: :param args: :param kwargs: :return:"""
<|body_0|>
def post(self, request, *args, **kwargs):
"""Create a store :param request: { "name": "Mr. Mechanic", "branch": "Palavakkam... | stack_v2_sparse_classes_36k_train_020130 | 4,727 | permissive | [
{
"docstring": "Get the list of Store :param request: :param args: :param kwargs: :return:",
"name": "get",
"signature": "def get(self, request, *args, **kwargs)"
},
{
"docstring": "Create a store :param request: { \"name\": \"Mr. Mechanic\", \"branch\": \"Palavakkam\", \"type\": \"SPARE\", # SE... | 2 | stack_v2_sparse_classes_30k_train_017903 | Implement the Python class `StoreList` described below.
Class description:
Implement the StoreList class.
Method signatures and docstrings:
- def get(self, request, *args, **kwargs): Get the list of Store :param request: :param args: :param kwargs: :return:
- def post(self, request, *args, **kwargs): Create a store :... | Implement the Python class `StoreList` described below.
Class description:
Implement the StoreList class.
Method signatures and docstrings:
- def get(self, request, *args, **kwargs): Get the list of Store :param request: :param args: :param kwargs: :return:
- def post(self, request, *args, **kwargs): Create a store :... | 1e31affddf60d2de72445a85dd2055bdeba6f670 | <|skeleton|>
class StoreList:
def get(self, request, *args, **kwargs):
"""Get the list of Store :param request: :param args: :param kwargs: :return:"""
<|body_0|>
def post(self, request, *args, **kwargs):
"""Create a store :param request: { "name": "Mr. Mechanic", "branch": "Palavakkam... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class StoreList:
def get(self, request, *args, **kwargs):
"""Get the list of Store :param request: :param args: :param kwargs: :return:"""
try:
st = self.get_all_objects(Store)
serializer = serializers.StoreSerializer(st, many=True)
return Utils.dispatch_success(r... | the_stack_v2_python_sparse | the_mechanic_backend/v0/accounts/views.py | muthukumar4999/the-mechanic-backend | train | 0 | |
3dcb50b06d8766228abd7327313a68cd5b38097e | [
"if sys.platform == 'win32':\n return QWinSplitterHandle(self.orientation(), self)\nreturn QSplitterHandle(self.orientation(), self)",
"old = self.orientation()\nif old != orientation:\n super(QCustomSplitter, self).setOrientation(orientation)\n if sys.platform == 'win32':\n for idx in xrange(self... | <|body_start_0|>
if sys.platform == 'win32':
return QWinSplitterHandle(self.orientation(), self)
return QSplitterHandle(self.orientation(), self)
<|end_body_0|>
<|body_start_1|>
old = self.orientation()
if old != orientation:
super(QCustomSplitter, self).setOrien... | A custom QSplitter which handles children of type QSplitItem. | QCustomSplitter | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class QCustomSplitter:
"""A custom QSplitter which handles children of type QSplitItem."""
def createHandle(self):
"""A reimplemented virtual method to create splitter handles. On win32 platforms, this will return a custom QSplitterHandle which works around an issue with handle not drawing... | stack_v2_sparse_classes_36k_train_020131 | 8,228 | permissive | [
{
"docstring": "A reimplemented virtual method to create splitter handles. On win32 platforms, this will return a custom QSplitterHandle which works around an issue with handle not drawing nicely. On all other platforms, a normal QSplitterHandler widget.",
"name": "createHandle",
"signature": "def creat... | 3 | null | Implement the Python class `QCustomSplitter` described below.
Class description:
A custom QSplitter which handles children of type QSplitItem.
Method signatures and docstrings:
- def createHandle(self): A reimplemented virtual method to create splitter handles. On win32 platforms, this will return a custom QSplitterH... | Implement the Python class `QCustomSplitter` described below.
Class description:
A custom QSplitter which handles children of type QSplitItem.
Method signatures and docstrings:
- def createHandle(self): A reimplemented virtual method to create splitter handles. On win32 platforms, this will return a custom QSplitterH... | 1544e7fb371b8f941cfa2fde682795e479380284 | <|skeleton|>
class QCustomSplitter:
"""A custom QSplitter which handles children of type QSplitItem."""
def createHandle(self):
"""A reimplemented virtual method to create splitter handles. On win32 platforms, this will return a custom QSplitterHandle which works around an issue with handle not drawing... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class QCustomSplitter:
"""A custom QSplitter which handles children of type QSplitItem."""
def createHandle(self):
"""A reimplemented virtual method to create splitter handles. On win32 platforms, this will return a custom QSplitterHandle which works around an issue with handle not drawing nicely. On a... | the_stack_v2_python_sparse | enaml/qt/qt_splitter.py | MatthieuDartiailh/enaml | train | 26 |
0611b6fca551bb8e52cd0e5f936df4e4658e0188 | [
"self.root_public_folder_list = root_public_folder_list\nself.target_folder_path = target_folder_path\nself.target_root_public_folder = target_root_public_folder",
"if dictionary is None:\n return None\nroot_public_folder_list = None\nif dictionary.get('rootPublicFolderList') != None:\n root_public_folder_l... | <|body_start_0|>
self.root_public_folder_list = root_public_folder_list
self.target_folder_path = target_folder_path
self.target_root_public_folder = target_root_public_folder
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
root_public_folder_list ... | Implementation of the 'PublicFoldersRestoreParameters' model. Specifies information needed for recovering O365 Public Folders in O365Publicfolders environment. Attributes: root_public_folder_list (list of RootPublicFolder): Specifies the list of Public Folders to be restored. target_folder_path (string): Specifies the ... | PublicFoldersRestoreParameters | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PublicFoldersRestoreParameters:
"""Implementation of the 'PublicFoldersRestoreParameters' model. Specifies information needed for recovering O365 Public Folders in O365Publicfolders environment. Attributes: root_public_folder_list (list of RootPublicFolder): Specifies the list of Public Folders t... | stack_v2_sparse_classes_36k_train_020132 | 3,002 | permissive | [
{
"docstring": "Constructor for the PublicFoldersRestoreParameters class",
"name": "__init__",
"signature": "def __init__(self, root_public_folder_list=None, target_folder_path=None, target_root_public_folder=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dic... | 2 | stack_v2_sparse_classes_30k_train_017094 | Implement the Python class `PublicFoldersRestoreParameters` described below.
Class description:
Implementation of the 'PublicFoldersRestoreParameters' model. Specifies information needed for recovering O365 Public Folders in O365Publicfolders environment. Attributes: root_public_folder_list (list of RootPublicFolder):... | Implement the Python class `PublicFoldersRestoreParameters` described below.
Class description:
Implementation of the 'PublicFoldersRestoreParameters' model. Specifies information needed for recovering O365 Public Folders in O365Publicfolders environment. Attributes: root_public_folder_list (list of RootPublicFolder):... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class PublicFoldersRestoreParameters:
"""Implementation of the 'PublicFoldersRestoreParameters' model. Specifies information needed for recovering O365 Public Folders in O365Publicfolders environment. Attributes: root_public_folder_list (list of RootPublicFolder): Specifies the list of Public Folders t... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PublicFoldersRestoreParameters:
"""Implementation of the 'PublicFoldersRestoreParameters' model. Specifies information needed for recovering O365 Public Folders in O365Publicfolders environment. Attributes: root_public_folder_list (list of RootPublicFolder): Specifies the list of Public Folders to be restored... | the_stack_v2_python_sparse | cohesity_management_sdk/models/public_folders_restore_parameters.py | cohesity/management-sdk-python | train | 24 |
f73e4bcf78273940cbba1f31c19d6d28be77824b | [
"for fld in ['DomainNameFields', 'WorkstationFields']:\n yield (fld, self[fld])\nreturn",
"for _, item in self.enumerate():\n yield item\nreturn",
"for item in self.iterate():\n yield item\nreturn"
] | <|body_start_0|>
for fld in ['DomainNameFields', 'WorkstationFields']:
yield (fld, self[fld])
return
<|end_body_0|>
<|body_start_1|>
for _, item in self.enumerate():
yield item
return
<|end_body_1|>
<|body_start_2|>
for item in self.iterate():
... | NEGOTIATE_MESSAGE | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NEGOTIATE_MESSAGE:
def enumerate(self):
"""Yield the name and field that compose the message type payload."""
<|body_0|>
def iterate(self):
"""Yield each field that composes the message type payload."""
<|body_1|>
def Fields(self):
"""Yield all o... | stack_v2_sparse_classes_36k_train_020133 | 31,838 | permissive | [
{
"docstring": "Yield the name and field that compose the message type payload.",
"name": "enumerate",
"signature": "def enumerate(self)"
},
{
"docstring": "Yield each field that composes the message type payload.",
"name": "iterate",
"signature": "def iterate(self)"
},
{
"docstr... | 3 | null | Implement the Python class `NEGOTIATE_MESSAGE` described below.
Class description:
Implement the NEGOTIATE_MESSAGE class.
Method signatures and docstrings:
- def enumerate(self): Yield the name and field that compose the message type payload.
- def iterate(self): Yield each field that composes the message type payloa... | Implement the Python class `NEGOTIATE_MESSAGE` described below.
Class description:
Implement the NEGOTIATE_MESSAGE class.
Method signatures and docstrings:
- def enumerate(self): Yield the name and field that compose the message type payload.
- def iterate(self): Yield each field that composes the message type payloa... | e02b014dc764ed822288210248c9438a843af8a9 | <|skeleton|>
class NEGOTIATE_MESSAGE:
def enumerate(self):
"""Yield the name and field that compose the message type payload."""
<|body_0|>
def iterate(self):
"""Yield each field that composes the message type payload."""
<|body_1|>
def Fields(self):
"""Yield all o... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NEGOTIATE_MESSAGE:
def enumerate(self):
"""Yield the name and field that compose the message type payload."""
for fld in ['DomainNameFields', 'WorkstationFields']:
yield (fld, self[fld])
return
def iterate(self):
"""Yield each field that composes the message ty... | the_stack_v2_python_sparse | template/protocol/nlmp.py | arizvisa/syringe | train | 36 | |
120a6de172fefe594e6a580d6cd4538fa5ba97db | [
"self.c = c\nself.at = c.atFileCommands\nself.at.outputList = []",
"at = self.at\nat.os(s[:-1] if s.endswith('\\n') else s)\nat.onl()",
"at = self.at\ngnx = p.v.fileIndex\nlevel = p.level()\nif level > 2:\n s = '%s: *%s* %s' % (gnx, level, p.h)\nelse:\n s = '%s: %s %s' % (gnx, '*' * level, p.h)\nat.os('%s... | <|body_start_0|>
self.c = c
self.at = c.atFileCommands
self.at.outputList = []
<|end_body_0|>
<|body_start_1|>
at = self.at
at.os(s[:-1] if s.endswith('\n') else s)
at.onl()
<|end_body_1|>
<|body_start_2|>
at = self.at
gnx = p.v.fileIndex
level =... | The base writer class for all writers in leo.plugins.writers. | BaseWriter | [
"BSD-3-Clause",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BaseWriter:
"""The base writer class for all writers in leo.plugins.writers."""
def __init__(self, c: Cmdr) -> None:
"""Ctor for leo.plugins.writers.BaseWriter."""
<|body_0|>
def put(self, s: str) -> None:
"""Write line s using at.os, taking special care of newli... | stack_v2_sparse_classes_36k_train_020134 | 1,404 | permissive | [
{
"docstring": "Ctor for leo.plugins.writers.BaseWriter.",
"name": "__init__",
"signature": "def __init__(self, c: Cmdr) -> None"
},
{
"docstring": "Write line s using at.os, taking special care of newlines.",
"name": "put",
"signature": "def put(self, s: str) -> None"
},
{
"docs... | 3 | null | Implement the Python class `BaseWriter` described below.
Class description:
The base writer class for all writers in leo.plugins.writers.
Method signatures and docstrings:
- def __init__(self, c: Cmdr) -> None: Ctor for leo.plugins.writers.BaseWriter.
- def put(self, s: str) -> None: Write line s using at.os, taking ... | Implement the Python class `BaseWriter` described below.
Class description:
The base writer class for all writers in leo.plugins.writers.
Method signatures and docstrings:
- def __init__(self, c: Cmdr) -> None: Ctor for leo.plugins.writers.BaseWriter.
- def put(self, s: str) -> None: Write line s using at.os, taking ... | a3f6c3ebda805dc40cd93123948f153a26eccee5 | <|skeleton|>
class BaseWriter:
"""The base writer class for all writers in leo.plugins.writers."""
def __init__(self, c: Cmdr) -> None:
"""Ctor for leo.plugins.writers.BaseWriter."""
<|body_0|>
def put(self, s: str) -> None:
"""Write line s using at.os, taking special care of newli... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BaseWriter:
"""The base writer class for all writers in leo.plugins.writers."""
def __init__(self, c: Cmdr) -> None:
"""Ctor for leo.plugins.writers.BaseWriter."""
self.c = c
self.at = c.atFileCommands
self.at.outputList = []
def put(self, s: str) -> None:
"""... | the_stack_v2_python_sparse | leo/plugins/writers/basewriter.py | leo-editor/leo-editor | train | 1,671 |
0e831601ce60cbd7e239d58aec965b526a19cb21 | [
"super(MeasureMBDsystem, self).__init__(measure_type, parent=parent)\nif name is None:\n self._name = 'MBD_system_' + measure_type\nelse:\n self._name = name\nif MBD_system is None:\n self.MBD_system = self._parent._parent\nelse:\n self.MBD_system = MBD_system\nself.x = []\nself.y_variables = ['kinetic_... | <|body_start_0|>
super(MeasureMBDsystem, self).__init__(measure_type, parent=parent)
if name is None:
self._name = 'MBD_system_' + measure_type
else:
self._name = name
if MBD_system is None:
self.MBD_system = self._parent._parent
else:
... | classdocs | MeasureMBDsystem | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MeasureMBDsystem:
"""classdocs"""
def __init__(self, measure_type, MBD_system=None, name=None, parent=None):
"""Constructor"""
<|body_0|>
def _measure(self, step, h, t, q):
""":param t: :return q: vector of state of MBD system"""
<|body_1|>
<|end_skeleto... | stack_v2_sparse_classes_36k_train_020135 | 1,863 | no_license | [
{
"docstring": "Constructor",
"name": "__init__",
"signature": "def __init__(self, measure_type, MBD_system=None, name=None, parent=None)"
},
{
"docstring": ":param t: :return q: vector of state of MBD system",
"name": "_measure",
"signature": "def _measure(self, step, h, t, q)"
}
] | 2 | stack_v2_sparse_classes_30k_train_018448 | Implement the Python class `MeasureMBDsystem` described below.
Class description:
classdocs
Method signatures and docstrings:
- def __init__(self, measure_type, MBD_system=None, name=None, parent=None): Constructor
- def _measure(self, step, h, t, q): :param t: :return q: vector of state of MBD system | Implement the Python class `MeasureMBDsystem` described below.
Class description:
classdocs
Method signatures and docstrings:
- def __init__(self, measure_type, MBD_system=None, name=None, parent=None): Constructor
- def _measure(self, step, h, t, q): :param t: :return q: vector of state of MBD system
<|skeleton|>
c... | 5e6a54dee662206664dde022ccca372f966b1789 | <|skeleton|>
class MeasureMBDsystem:
"""classdocs"""
def __init__(self, measure_type, MBD_system=None, name=None, parent=None):
"""Constructor"""
<|body_0|>
def _measure(self, step, h, t, q):
""":param t: :return q: vector of state of MBD system"""
<|body_1|>
<|end_skeleto... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MeasureMBDsystem:
"""classdocs"""
def __init__(self, measure_type, MBD_system=None, name=None, parent=None):
"""Constructor"""
super(MeasureMBDsystem, self).__init__(measure_type, parent=parent)
if name is None:
self._name = 'MBD_system_' + measure_type
else:
... | the_stack_v2_python_sparse | MBD_system/measure/measure_MBD_system.py | xupeiwust/DyS | train | 0 |
4f3901abda7eb63d34bc0f8cb786235a013196b0 | [
"def bits_to_abbr(target, bits):\n abbr = []\n pre = 0\n for i in range(len(target)):\n if bits & 1:\n if i - pre > 0:\n abbr.append(str(i - pre))\n pre = i + 1\n abbr.append(str(target[i]))\n elif i == len(target) - 1:\n abbr.append(... | <|body_start_0|>
def bits_to_abbr(target, bits):
abbr = []
pre = 0
for i in range(len(target)):
if bits & 1:
if i - pre > 0:
abbr.append(str(i - pre))
pre = i + 1
abbr.append(s... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def minAbbreviationAC(self, target, dictionary):
""":type target: str :type dictionary: List[str] :rtype: str"""
<|body_0|>
def minAbbreviation(self, target, dictionary):
""":type target: str :type dictionary: List[str] :rtype: str"""
<|body_1|>
<|... | stack_v2_sparse_classes_36k_train_020136 | 3,484 | no_license | [
{
"docstring": ":type target: str :type dictionary: List[str] :rtype: str",
"name": "minAbbreviationAC",
"signature": "def minAbbreviationAC(self, target, dictionary)"
},
{
"docstring": ":type target: str :type dictionary: List[str] :rtype: str",
"name": "minAbbreviation",
"signature": "... | 2 | stack_v2_sparse_classes_30k_train_017279 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minAbbreviationAC(self, target, dictionary): :type target: str :type dictionary: List[str] :rtype: str
- def minAbbreviation(self, target, dictionary): :type target: str :typ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minAbbreviationAC(self, target, dictionary): :type target: str :type dictionary: List[str] :rtype: str
- def minAbbreviation(self, target, dictionary): :type target: str :typ... | 810575368ecffa97677bdb51744d1f716140bbb1 | <|skeleton|>
class Solution:
def minAbbreviationAC(self, target, dictionary):
""":type target: str :type dictionary: List[str] :rtype: str"""
<|body_0|>
def minAbbreviation(self, target, dictionary):
""":type target: str :type dictionary: List[str] :rtype: str"""
<|body_1|>
<|... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def minAbbreviationAC(self, target, dictionary):
""":type target: str :type dictionary: List[str] :rtype: str"""
def bits_to_abbr(target, bits):
abbr = []
pre = 0
for i in range(len(target)):
if bits & 1:
if i - ... | the_stack_v2_python_sparse | M/MinimumUniqueWordAbbreviation.py | bssrdf/pyleet | train | 2 | |
7a1a23832f754c1cdffa2092a35164588b230f60 | [
"mask_bad = None\nif not cbook.iterable(X):\n vtype = 'scalar'\n xa = np.array([X])\nelse:\n vtype = 'array'\n xma = ma.array(X, copy=True)\n xa = xma.filled(0)\n mask_bad = ma.getmask(xma)\nif xa.dtype.char in np.typecodes['Float']:\n np.putmask(xa, xa == 1.0, 0.9999999)\n if NP_CLIP_OUT:\n... | <|body_start_0|>
mask_bad = None
if not cbook.iterable(X):
vtype = 'scalar'
xa = np.array([X])
else:
vtype = 'array'
xma = ma.array(X, copy=True)
xa = xma.filled(0)
mask_bad = ma.getmask(xma)
if xa.dtype.char in np.t... | MixedAlphaColormap | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MixedAlphaColormap:
def lut_indices(X):
"""Convert the normalized scalar array X to indices into this colormap's LUT, including indices into i_bad, i_over, i_under."""
<|body_0|>
def fast_lookup(self, Xi, alpha=1.0, bytes=False):
"""*X* is already in the form of LUT ... | stack_v2_sparse_classes_36k_train_020137 | 7,736 | no_license | [
{
"docstring": "Convert the normalized scalar array X to indices into this colormap's LUT, including indices into i_bad, i_over, i_under.",
"name": "lut_indices",
"signature": "def lut_indices(X)"
},
{
"docstring": "*X* is already in the form of LUT indices, simply perform an indexing into the L... | 4 | stack_v2_sparse_classes_30k_train_010503 | Implement the Python class `MixedAlphaColormap` described below.
Class description:
Implement the MixedAlphaColormap class.
Method signatures and docstrings:
- def lut_indices(X): Convert the normalized scalar array X to indices into this colormap's LUT, including indices into i_bad, i_over, i_under.
- def fast_looku... | Implement the Python class `MixedAlphaColormap` described below.
Class description:
Implement the MixedAlphaColormap class.
Method signatures and docstrings:
- def lut_indices(X): Convert the normalized scalar array X to indices into this colormap's LUT, including indices into i_bad, i_over, i_under.
- def fast_looku... | e03e56d745b112e13c7ba5432bb103f8f1005f33 | <|skeleton|>
class MixedAlphaColormap:
def lut_indices(X):
"""Convert the normalized scalar array X to indices into this colormap's LUT, including indices into i_bad, i_over, i_under."""
<|body_0|>
def fast_lookup(self, Xi, alpha=1.0, bytes=False):
"""*X* is already in the form of LUT ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MixedAlphaColormap:
def lut_indices(X):
"""Convert the normalized scalar array X to indices into this colormap's LUT, including indices into i_bad, i_over, i_under."""
mask_bad = None
if not cbook.iterable(X):
vtype = 'scalar'
xa = np.array([X])
else:
... | the_stack_v2_python_sparse | xipy/colors/color_mapping.py | miketrumpis/xipy | train | 2 | |
b14eeb0bab5b203b0556ebcd5edfe42ca80882af | [
"self.min_value, self.max_value = validate_fp_params(signed, n_bits, n_frac)\nif n_bits not in [8, 16, 32, 64]:\n raise ValueError('n_bits: {}: Must be 8, 16, 32 or 64.'.format(n_bits))\nself.bytes_per_element = n_bits / 8\nself.dtype = self.dtypes[signed, n_bits]\nself.n_frac = n_frac",
"vals = np.clip(values... | <|body_start_0|>
self.min_value, self.max_value = validate_fp_params(signed, n_bits, n_frac)
if n_bits not in [8, 16, 32, 64]:
raise ValueError('n_bits: {}: Must be 8, 16, 32 or 64.'.format(n_bits))
self.bytes_per_element = n_bits / 8
self.dtype = self.dtypes[signed, n_bits]
... | A callable which converts Numpy arrays of floats to fixed point arrays. General usage is to create a new converter and then call this on arrays of values. The `dtype` of the returned array is determined from the parameters passed. For example:: >>> f = NumpyFloatToFixConverter(signed=True, n_bits=8, n_frac=4) Will conv... | NumpyFloatToFixConverter | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NumpyFloatToFixConverter:
"""A callable which converts Numpy arrays of floats to fixed point arrays. General usage is to create a new converter and then call this on arrays of values. The `dtype` of the returned array is determined from the parameters passed. For example:: >>> f = NumpyFloatToFix... | stack_v2_sparse_classes_36k_train_020138 | 9,712 | permissive | [
{
"docstring": "Create a new converter from floats into ints. Parameters ---------- signed : bool Indicates that the converted values are to be signed or otherwise. n_bits : int The number of bits each value will use overall (must be 8, 16, 32, or 64). n_frac : int The number of fractional bits.",
"name": "... | 2 | null | Implement the Python class `NumpyFloatToFixConverter` described below.
Class description:
A callable which converts Numpy arrays of floats to fixed point arrays. General usage is to create a new converter and then call this on arrays of values. The `dtype` of the returned array is determined from the parameters passed... | Implement the Python class `NumpyFloatToFixConverter` described below.
Class description:
A callable which converts Numpy arrays of floats to fixed point arrays. General usage is to create a new converter and then call this on arrays of values. The `dtype` of the returned array is determined from the parameters passed... | 04fa1eaf78778edea3ba3afa4c527d20c491718e | <|skeleton|>
class NumpyFloatToFixConverter:
"""A callable which converts Numpy arrays of floats to fixed point arrays. General usage is to create a new converter and then call this on arrays of values. The `dtype` of the returned array is determined from the parameters passed. For example:: >>> f = NumpyFloatToFix... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NumpyFloatToFixConverter:
"""A callable which converts Numpy arrays of floats to fixed point arrays. General usage is to create a new converter and then call this on arrays of values. The `dtype` of the returned array is determined from the parameters passed. For example:: >>> f = NumpyFloatToFixConverter(sig... | the_stack_v2_python_sparse | src/spinnaker_ros_lsm/venv/lib/python2.7/site-packages/rig/type_casts.py | Roboy/LSM_SpiNNaker_MyoArm | train | 2 |
7958ed8a10f73b13a6f0a3ecaeed1a970aba1576 | [
"argument = 0\nexpected = False\nlab04.is_prime_number(argument)\nself.assertEqual(expected, lab04.is_prime_number(argument), 'The number is zero.')",
"argument = 1\nexpected = False\nlab04.is_prime_number(argument)\nself.assertEqual(expected, lab04.is_prime_number(argument), 'The number is the smallest positive ... | <|body_start_0|>
argument = 0
expected = False
lab04.is_prime_number(argument)
self.assertEqual(expected, lab04.is_prime_number(argument), 'The number is zero.')
<|end_body_0|>
<|body_start_1|>
argument = 1
expected = False
lab04.is_prime_number(argument)
... | Test | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Test:
def test_is_prime_number_zero(self):
"""Test number zero."""
<|body_0|>
def test_is_prime_number_smallest_positive_integer(self):
"""Test the smallest positive integer."""
<|body_1|>
def test_is_prime_number_smallest_prime(self):
"""Test in... | stack_v2_sparse_classes_36k_train_020139 | 1,757 | no_license | [
{
"docstring": "Test number zero.",
"name": "test_is_prime_number_zero",
"signature": "def test_is_prime_number_zero(self)"
},
{
"docstring": "Test the smallest positive integer.",
"name": "test_is_prime_number_smallest_positive_integer",
"signature": "def test_is_prime_number_smallest_p... | 5 | stack_v2_sparse_classes_30k_train_017034 | Implement the Python class `Test` described below.
Class description:
Implement the Test class.
Method signatures and docstrings:
- def test_is_prime_number_zero(self): Test number zero.
- def test_is_prime_number_smallest_positive_integer(self): Test the smallest positive integer.
- def test_is_prime_number_smallest... | Implement the Python class `Test` described below.
Class description:
Implement the Test class.
Method signatures and docstrings:
- def test_is_prime_number_zero(self): Test number zero.
- def test_is_prime_number_smallest_positive_integer(self): Test the smallest positive integer.
- def test_is_prime_number_smallest... | 48df12f90d2b82167606f8573137f34840e2b6b3 | <|skeleton|>
class Test:
def test_is_prime_number_zero(self):
"""Test number zero."""
<|body_0|>
def test_is_prime_number_smallest_positive_integer(self):
"""Test the smallest positive integer."""
<|body_1|>
def test_is_prime_number_smallest_prime(self):
"""Test in... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Test:
def test_is_prime_number_zero(self):
"""Test number zero."""
argument = 0
expected = False
lab04.is_prime_number(argument)
self.assertEqual(expected, lab04.is_prime_number(argument), 'The number is zero.')
def test_is_prime_number_smallest_positive_integer(se... | the_stack_v2_python_sparse | lab04/test_is_prime_number.py | dafu2020/Mini-Python-Projects | train | 0 | |
4cf1078293df8c7eed6b10e3e2a8f707ab9c9710 | [
"self.folder_id = folder_id\nself.folder_key = folder_key\nself.is_entire_folder_required = is_entire_folder_required\nself.item_id_vec = item_id_vec",
"if dictionary is None:\n return None\nfolder_id = dictionary.get('folderId')\nfolder_key = dictionary.get('folderKey')\nis_entire_folder_required = dictionary... | <|body_start_0|>
self.folder_id = folder_id
self.folder_key = folder_key
self.is_entire_folder_required = is_entire_folder_required
self.item_id_vec = item_id_vec
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
folder_id = dictionary.get('f... | Implementation of the 'RestoreOutlookParams_Folder' model. This will be set in case of partial mailbox recovery. Attributes: folder_id (string): The Unique ID of the folder. folder_key (long|int): The Unique key of the folder. is_entire_folder_required (bool): Specify if the entire folder is to be restored. item_id_vec... | RestoreOutlookParams_Folder | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RestoreOutlookParams_Folder:
"""Implementation of the 'RestoreOutlookParams_Folder' model. This will be set in case of partial mailbox recovery. Attributes: folder_id (string): The Unique ID of the folder. folder_key (long|int): The Unique key of the folder. is_entire_folder_required (bool): Spec... | stack_v2_sparse_classes_36k_train_020140 | 2,357 | permissive | [
{
"docstring": "Constructor for the RestoreOutlookParams_Folder class",
"name": "__init__",
"signature": "def __init__(self, folder_id=None, folder_key=None, is_entire_folder_required=None, item_id_vec=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dictionary... | 2 | stack_v2_sparse_classes_30k_train_003236 | Implement the Python class `RestoreOutlookParams_Folder` described below.
Class description:
Implementation of the 'RestoreOutlookParams_Folder' model. This will be set in case of partial mailbox recovery. Attributes: folder_id (string): The Unique ID of the folder. folder_key (long|int): The Unique key of the folder.... | Implement the Python class `RestoreOutlookParams_Folder` described below.
Class description:
Implementation of the 'RestoreOutlookParams_Folder' model. This will be set in case of partial mailbox recovery. Attributes: folder_id (string): The Unique ID of the folder. folder_key (long|int): The Unique key of the folder.... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class RestoreOutlookParams_Folder:
"""Implementation of the 'RestoreOutlookParams_Folder' model. This will be set in case of partial mailbox recovery. Attributes: folder_id (string): The Unique ID of the folder. folder_key (long|int): The Unique key of the folder. is_entire_folder_required (bool): Spec... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RestoreOutlookParams_Folder:
"""Implementation of the 'RestoreOutlookParams_Folder' model. This will be set in case of partial mailbox recovery. Attributes: folder_id (string): The Unique ID of the folder. folder_key (long|int): The Unique key of the folder. is_entire_folder_required (bool): Specify if the en... | the_stack_v2_python_sparse | cohesity_management_sdk/models/restore_outlook_params_folder.py | cohesity/management-sdk-python | train | 24 |
b6d751bee3e871bce59453d32b8c4bb19b1aa645 | [
"self.parser = reqparse.RequestParser()\nself.parser.add_argument('token')\nsuper(Position, self).__init__()",
"args = self.parser.parse_args()\ntoken = args['token']\ndata = me.getAllPositions()\nprint(data)\nl = [o.__dict__ for o in data]\nreturn {'result_code': 'success', 'data': l}"
] | <|body_start_0|>
self.parser = reqparse.RequestParser()
self.parser.add_argument('token')
super(Position, self).__init__()
<|end_body_0|>
<|body_start_1|>
args = self.parser.parse_args()
token = args['token']
data = me.getAllPositions()
print(data)
l = [o... | 持仓 | Position | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Position:
"""持仓"""
def __init__(self):
"""初始化"""
<|body_0|>
def get(self):
"""查询"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.parser = reqparse.RequestParser()
self.parser.add_argument('token')
super(Position, self).__ini... | stack_v2_sparse_classes_36k_train_020141 | 24,002 | permissive | [
{
"docstring": "初始化",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "查询",
"name": "get",
"signature": "def get(self)"
}
] | 2 | stack_v2_sparse_classes_30k_val_000282 | Implement the Python class `Position` described below.
Class description:
持仓
Method signatures and docstrings:
- def __init__(self): 初始化
- def get(self): 查询 | Implement the Python class `Position` described below.
Class description:
持仓
Method signatures and docstrings:
- def __init__(self): 初始化
- def get(self): 查询
<|skeleton|>
class Position:
"""持仓"""
def __init__(self):
"""初始化"""
<|body_0|>
def get(self):
"""查询"""
<|body_1|>
... | c316649161086da2543d39bf0455d0f793cdd08f | <|skeleton|>
class Position:
"""持仓"""
def __init__(self):
"""初始化"""
<|body_0|>
def get(self):
"""查询"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Position:
"""持仓"""
def __init__(self):
"""初始化"""
self.parser = reqparse.RequestParser()
self.parser.add_argument('token')
super(Position, self).__init__()
def get(self):
"""查询"""
args = self.parser.parse_args()
token = args['token']
dat... | the_stack_v2_python_sparse | WebTrader/webServer.py | webclinic017/riskBacktestingPlatform | train | 0 |
bd06b81b7ae3795ed7781c82647574e76d458b9b | [
"self.conn = ofconn\nself.send_flow_removed = sfr\nmc.get_client()\nserver.register_event_handler(ofevents.pktin.name, self)\nserver.register_event_handler(ofevents.flow_removed.name, self)",
"if isinstance(event, ofevents.pktin):\n if pu.is_multicast_mac(event.match.dl_dst):\n return True\n key = sw... | <|body_start_0|>
self.conn = ofconn
self.send_flow_removed = sfr
mc.get_client()
server.register_event_handler(ofevents.pktin.name, self)
server.register_event_handler(ofevents.flow_removed.name, self)
<|end_body_0|>
<|body_start_1|>
if isinstance(event, ofevents.pktin):... | Class to perform per flow learning switch Install flow rules with exact matches @author ykk @date Feb 2011 | learningswitch | [
"LicenseRef-scancode-x11-stanford"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class learningswitch:
"""Class to perform per flow learning switch Install flow rules with exact matches @author ykk @date Feb 2011"""
def __init__(self, server, ofconn, sfr=False):
"""Initialize @param server yapc core @param conn reference to connections @param sfr send flow removed or n... | stack_v2_sparse_classes_36k_train_020142 | 2,330 | permissive | [
{
"docstring": "Initialize @param server yapc core @param conn reference to connections @param sfr send flow removed or not",
"name": "__init__",
"signature": "def __init__(self, server, ofconn, sfr=False)"
},
{
"docstring": "Event handler @param event event to handle @return false if flow can b... | 3 | null | Implement the Python class `learningswitch` described below.
Class description:
Class to perform per flow learning switch Install flow rules with exact matches @author ykk @date Feb 2011
Method signatures and docstrings:
- def __init__(self, server, ofconn, sfr=False): Initialize @param server yapc core @param conn r... | Implement the Python class `learningswitch` described below.
Class description:
Class to perform per flow learning switch Install flow rules with exact matches @author ykk @date Feb 2011
Method signatures and docstrings:
- def __init__(self, server, ofconn, sfr=False): Initialize @param server yapc core @param conn r... | c3f5a31b74d5587671329eea9582ac8aed0c58a4 | <|skeleton|>
class learningswitch:
"""Class to perform per flow learning switch Install flow rules with exact matches @author ykk @date Feb 2011"""
def __init__(self, server, ofconn, sfr=False):
"""Initialize @param server yapc core @param conn reference to connections @param sfr send flow removed or n... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class learningswitch:
"""Class to perform per flow learning switch Install flow rules with exact matches @author ykk @date Feb 2011"""
def __init__(self, server, ofconn, sfr=False):
"""Initialize @param server yapc core @param conn reference to connections @param sfr send flow removed or not"""
... | the_stack_v2_python_sparse | yapc/forwarding/switching.py | yapkke/yapc | train | 1 |
96583bc8c5ec1f6d0656edc10035738d24ee5b0c | [
"self.prefix_list = defaultdict(list)\nself.prefix_set = defaultdict(dict)\nself.suffix_list = defaultdict(list)\nself.suffix_set = defaultdict(dict)\nfor i in reversed(range(len(words))):\n for j in range(len(words[i]) + 1):\n prefix = words[i][0:j]\n suffix = words[i][j:len(words[i])]\n se... | <|body_start_0|>
self.prefix_list = defaultdict(list)
self.prefix_set = defaultdict(dict)
self.suffix_list = defaultdict(list)
self.suffix_set = defaultdict(dict)
for i in reversed(range(len(words))):
for j in range(len(words[i]) + 1):
prefix = words[i... | WordFilter | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WordFilter:
def __init__(self, words):
""":type words: List[str]"""
<|body_0|>
def f(self, prefix, suffix):
""":type prefix: str :type suffix: str :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.prefix_list = defaultdict(list)
... | stack_v2_sparse_classes_36k_train_020143 | 1,570 | no_license | [
{
"docstring": ":type words: List[str]",
"name": "__init__",
"signature": "def __init__(self, words)"
},
{
"docstring": ":type prefix: str :type suffix: str :rtype: int",
"name": "f",
"signature": "def f(self, prefix, suffix)"
}
] | 2 | null | Implement the Python class `WordFilter` described below.
Class description:
Implement the WordFilter class.
Method signatures and docstrings:
- def __init__(self, words): :type words: List[str]
- def f(self, prefix, suffix): :type prefix: str :type suffix: str :rtype: int | Implement the Python class `WordFilter` described below.
Class description:
Implement the WordFilter class.
Method signatures and docstrings:
- def __init__(self, words): :type words: List[str]
- def f(self, prefix, suffix): :type prefix: str :type suffix: str :rtype: int
<|skeleton|>
class WordFilter:
def __in... | 516d5f08fc9b1b71b14d43687221a06d07dc51fc | <|skeleton|>
class WordFilter:
def __init__(self, words):
""":type words: List[str]"""
<|body_0|>
def f(self, prefix, suffix):
""":type prefix: str :type suffix: str :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class WordFilter:
def __init__(self, words):
""":type words: List[str]"""
self.prefix_list = defaultdict(list)
self.prefix_set = defaultdict(dict)
self.suffix_list = defaultdict(list)
self.suffix_set = defaultdict(dict)
for i in reversed(range(len(words))):
... | the_stack_v2_python_sparse | src/_745_1.py | lydxlx1/LeetCode | train | 110 | |
de0cb2a799521a982c4ccc2e9ba4f890877ab8ee | [
"self._patterns = []\nself.flags = flags\nself.rules = rules or []\nself.branch_size = min(branch_size, len(self.rules))\n\ndef make_pattern(rules, flags=0):\n \"\"\"Compile a rules to single branch with groups.\"\"\"\n return re.compile('|'.join(('(?P<I{name}>{regex})'.format(name=name, regex=regex) for name... | <|body_start_0|>
self._patterns = []
self.flags = flags
self.rules = rules or []
self.branch_size = min(branch_size, len(self.rules))
def make_pattern(rules, flags=0):
"""Compile a rules to single branch with groups."""
return re.compile('|'.join(('(?P<I{... | Index implementation based on build-in Python SRE module. | Index | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Index:
"""Index implementation based on build-in Python SRE module."""
def __init__(self, rules=None, flags=0, branch_size=MAXGROUPS - 1):
"""Initialize index structures. :param rules: list of tuples (regular expression, data) :param flags: additional flags passed to SRE parser :para... | stack_v2_sparse_classes_36k_train_020144 | 5,611 | permissive | [
{
"docstring": "Initialize index structures. :param rules: list of tuples (regular expression, data) :param flags: additional flags passed to SRE parser :param branch_size: number of groups in a branch (max. 99)",
"name": "__init__",
"signature": "def __init__(self, rules=None, flags=0, branch_size=MAXG... | 2 | stack_v2_sparse_classes_30k_train_011741 | Implement the Python class `Index` described below.
Class description:
Index implementation based on build-in Python SRE module.
Method signatures and docstrings:
- def __init__(self, rules=None, flags=0, branch_size=MAXGROUPS - 1): Initialize index structures. :param rules: list of tuples (regular expression, data) ... | Implement the Python class `Index` described below.
Class description:
Index implementation based on build-in Python SRE module.
Method signatures and docstrings:
- def __init__(self, rules=None, flags=0, branch_size=MAXGROUPS - 1): Initialize index structures. :param rules: list of tuples (regular expression, data) ... | 407225ea250b9ebd5d1172cf93c8bf77a7bdcf16 | <|skeleton|>
class Index:
"""Index implementation based on build-in Python SRE module."""
def __init__(self, rules=None, flags=0, branch_size=MAXGROUPS - 1):
"""Initialize index structures. :param rules: list of tuples (regular expression, data) :param flags: additional flags passed to SRE parser :para... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Index:
"""Index implementation based on build-in Python SRE module."""
def __init__(self, rules=None, flags=0, branch_size=MAXGROUPS - 1):
"""Initialize index structures. :param rules: list of tuples (regular expression, data) :param flags: additional flags passed to SRE parser :param branch_size... | the_stack_v2_python_sparse | dojson/overdo.py | inveniosoftware/dojson | train | 11 |
e7951d43461af4e86c73af8bee8db5684f2cfa5b | [
"self.netG = generator\nself.netC = critic\nself.device = device\nself.optim = torch.optim.SGD\nself.verbose = verbose\nself.lr = learning_rate\nself.netG = self.netG.double().to(device)\nself.netC = self.netC.double().to(device)\nfor parameter in self.netG.parameters():\n parameter.requires_grad = False\nfor pa... | <|body_start_0|>
self.netG = generator
self.netC = critic
self.device = device
self.optim = torch.optim.SGD
self.verbose = verbose
self.lr = learning_rate
self.netG = self.netG.double().to(device)
self.netC = self.netC.double().to(device)
for param... | CriticProjector | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CriticProjector:
def __init__(self, generator, critic, device, learning_rate=0.0001, verbose=False):
""":param generator: object of the generator :param critic: object of the critic :param device: torch.device, where the operations should be placed :param learning_rate: learning rate for... | stack_v2_sparse_classes_36k_train_020145 | 1,726 | no_license | [
{
"docstring": ":param generator: object of the generator :param critic: object of the critic :param device: torch.device, where the operations should be placed :param learning_rate: learning rate for SGD :param verbose: print loss if True",
"name": "__init__",
"signature": "def __init__(self, generator... | 2 | stack_v2_sparse_classes_30k_train_001362 | Implement the Python class `CriticProjector` described below.
Class description:
Implement the CriticProjector class.
Method signatures and docstrings:
- def __init__(self, generator, critic, device, learning_rate=0.0001, verbose=False): :param generator: object of the generator :param critic: object of the critic :p... | Implement the Python class `CriticProjector` described below.
Class description:
Implement the CriticProjector class.
Method signatures and docstrings:
- def __init__(self, generator, critic, device, learning_rate=0.0001, verbose=False): :param generator: object of the generator :param critic: object of the critic :p... | 6209e97b0c48999f47d539d44f2aef47a5894a7a | <|skeleton|>
class CriticProjector:
def __init__(self, generator, critic, device, learning_rate=0.0001, verbose=False):
""":param generator: object of the generator :param critic: object of the critic :param device: torch.device, where the operations should be placed :param learning_rate: learning rate for... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CriticProjector:
def __init__(self, generator, critic, device, learning_rate=0.0001, verbose=False):
""":param generator: object of the generator :param critic: object of the critic :param device: torch.device, where the operations should be placed :param learning_rate: learning rate for SGD :param ve... | the_stack_v2_python_sparse | LSVG/backprojection/criticprojector.py | CariusLars/ImprovingVideoGeneration | train | 4 | |
2d09cb0bf59a4e42ac447144f1006d9c022613ec | [
"cpus1 = [systeminfo.GetCpu(), systeminfo.GetCpu(), systeminfo.GetCpu(systeminfo.UPDATE_CPU_SEC), systeminfo.GetCpu(update_sec=systeminfo.UPDATE_CPU_SEC)]\ncpus2 = [systeminfo.GetCpu(10), systeminfo.GetCpu(10), systeminfo.GetCpu(update_sec=10)]\nself.assertTrue(all((id(x) == id(cpus1[0]) for x in cpus1)))\nself.ass... | <|body_start_0|>
cpus1 = [systeminfo.GetCpu(), systeminfo.GetCpu(), systeminfo.GetCpu(systeminfo.UPDATE_CPU_SEC), systeminfo.GetCpu(update_sec=systeminfo.UPDATE_CPU_SEC)]
cpus2 = [systeminfo.GetCpu(10), systeminfo.GetCpu(10), systeminfo.GetCpu(update_sec=10)]
self.assertTrue(all((id(x) == id(cpu... | Unittests for checking that information class caching. | InfoClassCacheTest | [
"LGPL-2.0-or-later",
"GPL-1.0-or-later",
"MIT",
"Apache-2.0",
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InfoClassCacheTest:
"""Unittests for checking that information class caching."""
def testGetCpu(self):
"""Test caching explicitly for Cpu information objects."""
<|body_0|>
def testGetMemory(self):
"""Test caching explicitly for Memory information objects."""
... | stack_v2_sparse_classes_36k_train_020146 | 18,026 | permissive | [
{
"docstring": "Test caching explicitly for Cpu information objects.",
"name": "testGetCpu",
"signature": "def testGetCpu(self)"
},
{
"docstring": "Test caching explicitly for Memory information objects.",
"name": "testGetMemory",
"signature": "def testGetMemory(self)"
},
{
"docs... | 3 | null | Implement the Python class `InfoClassCacheTest` described below.
Class description:
Unittests for checking that information class caching.
Method signatures and docstrings:
- def testGetCpu(self): Test caching explicitly for Cpu information objects.
- def testGetMemory(self): Test caching explicitly for Memory inform... | Implement the Python class `InfoClassCacheTest` described below.
Class description:
Unittests for checking that information class caching.
Method signatures and docstrings:
- def testGetCpu(self): Test caching explicitly for Cpu information objects.
- def testGetMemory(self): Test caching explicitly for Memory inform... | 72a05af97787001756bae2511b7985e61498c965 | <|skeleton|>
class InfoClassCacheTest:
"""Unittests for checking that information class caching."""
def testGetCpu(self):
"""Test caching explicitly for Cpu information objects."""
<|body_0|>
def testGetMemory(self):
"""Test caching explicitly for Memory information objects."""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class InfoClassCacheTest:
"""Unittests for checking that information class caching."""
def testGetCpu(self):
"""Test caching explicitly for Cpu information objects."""
cpus1 = [systeminfo.GetCpu(), systeminfo.GetCpu(), systeminfo.GetCpu(systeminfo.UPDATE_CPU_SEC), systeminfo.GetCpu(update_sec=s... | the_stack_v2_python_sparse | third_party/chromite/mobmonitor/system/systeminfo_unittest.py | metux/chromium-suckless | train | 5 |
c51d97656d2c65892e5423d0c820b5fe8bb65f82 | [
"super().__init__()\nself.in_features = in_features\nself.groups = groups or ['last', 'avg_droplast', 'max_droplast', 'softmax_droplast']\nself.out_features = in_features * len(self.groups)\ngroups = {}\nfor key in self.groups:\n if isinstance(key, str):\n groups[key] = _get_pooling(key, self.in_features)... | <|body_start_0|>
super().__init__()
self.in_features = in_features
self.groups = groups or ['last', 'avg_droplast', 'max_droplast', 'softmax_droplast']
self.out_features = in_features * len(self.groups)
groups = {}
for key in self.groups:
if isinstance(key, st... | @TODO: Docs. Contribution is welcome. | LamaPooling | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LamaPooling:
"""@TODO: Docs. Contribution is welcome."""
def __init__(self, in_features, groups=None):
"""@TODO: Docs. Contribution is welcome."""
<|body_0|>
def forward(self, x: torch.Tensor, mask: torch.Tensor=None) -> torch.Tensor:
"""Forward method of the LAM... | stack_v2_sparse_classes_36k_train_020147 | 6,469 | permissive | [
{
"docstring": "@TODO: Docs. Contribution is welcome.",
"name": "__init__",
"signature": "def __init__(self, in_features, groups=None)"
},
{
"docstring": "Forward method of the LAMA. Args: x: tensor of size (batch_size, history_len, feature_size) mask: mask to use for attention compute Returns: ... | 2 | null | Implement the Python class `LamaPooling` described below.
Class description:
@TODO: Docs. Contribution is welcome.
Method signatures and docstrings:
- def __init__(self, in_features, groups=None): @TODO: Docs. Contribution is welcome.
- def forward(self, x: torch.Tensor, mask: torch.Tensor=None) -> torch.Tensor: Forw... | Implement the Python class `LamaPooling` described below.
Class description:
@TODO: Docs. Contribution is welcome.
Method signatures and docstrings:
- def __init__(self, in_features, groups=None): @TODO: Docs. Contribution is welcome.
- def forward(self, x: torch.Tensor, mask: torch.Tensor=None) -> torch.Tensor: Forw... | e99f90655d0efcf22559a46e928f0f98c9807ebf | <|skeleton|>
class LamaPooling:
"""@TODO: Docs. Contribution is welcome."""
def __init__(self, in_features, groups=None):
"""@TODO: Docs. Contribution is welcome."""
<|body_0|>
def forward(self, x: torch.Tensor, mask: torch.Tensor=None) -> torch.Tensor:
"""Forward method of the LAM... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LamaPooling:
"""@TODO: Docs. Contribution is welcome."""
def __init__(self, in_features, groups=None):
"""@TODO: Docs. Contribution is welcome."""
super().__init__()
self.in_features = in_features
self.groups = groups or ['last', 'avg_droplast', 'max_droplast', 'softmax_dr... | the_stack_v2_python_sparse | catalyst/contrib/layers/lama.py | catalyst-team/catalyst | train | 3,038 |
d1cb926dd1be3ad99e9c1313b899a2b599d37748 | [
"if s[0] == '0':\n return 0\ndp = [0 for _ in range(len(s))]\ndp[0] = 1\nfor i in range(1, len(s)):\n if s[i] == '0' and s[i - 1] not in ['1', '2']:\n return 0\n elif s[i] == '0':\n dp[i] = dp[i - 2] if i > 1 else 1\n elif 11 <= int(s[i - 1:i + 1]) <= 26:\n dp[i] = dp[i - 1] + dp[i ... | <|body_start_0|>
if s[0] == '0':
return 0
dp = [0 for _ in range(len(s))]
dp[0] = 1
for i in range(1, len(s)):
if s[i] == '0' and s[i - 1] not in ['1', '2']:
return 0
elif s[i] == '0':
dp[i] = dp[i - 2] if i > 1 else 1
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def numDecodings(self, s):
""":type s: str :rtype: int"""
<|body_0|>
def numDecodings(self, s):
""":type s: str :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if s[0] == '0':
return 0
dp = [0 for _ in range... | stack_v2_sparse_classes_36k_train_020148 | 2,200 | no_license | [
{
"docstring": ":type s: str :rtype: int",
"name": "numDecodings",
"signature": "def numDecodings(self, s)"
},
{
"docstring": ":type s: str :rtype: int",
"name": "numDecodings",
"signature": "def numDecodings(self, s)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def numDecodings(self, s): :type s: str :rtype: int
- def numDecodings(self, s): :type s: str :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def numDecodings(self, s): :type s: str :rtype: int
- def numDecodings(self, s): :type s: str :rtype: int
<|skeleton|>
class Solution:
def numDecodings(self, s):
""... | a509b383a42f54313970168d9faa11f088f18708 | <|skeleton|>
class Solution:
def numDecodings(self, s):
""":type s: str :rtype: int"""
<|body_0|>
def numDecodings(self, s):
""":type s: str :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def numDecodings(self, s):
""":type s: str :rtype: int"""
if s[0] == '0':
return 0
dp = [0 for _ in range(len(s))]
dp[0] = 1
for i in range(1, len(s)):
if s[i] == '0' and s[i - 1] not in ['1', '2']:
return 0
... | the_stack_v2_python_sparse | 0091_Decode_Ways.py | bingli8802/leetcode | train | 0 | |
26785751065b87146ccd135f98b0c68a1ef80a91 | [
"url = '/api/v1.2/graph-connections'\ncode, res = Request().request(method='post', path=url, json=body, types='hubble')\nreturn (code, res)",
"url = '/api/v1.2/graph-connections'\ncode, res = Request().request(method='get', path=url, params=param, types='hubble')\nreturn (code, res)",
"url = '/api/v1.2/graph-co... | <|body_start_0|>
url = '/api/v1.2/graph-connections'
code, res = Request().request(method='post', path=url, json=body, types='hubble')
return (code, res)
<|end_body_0|>
<|body_start_1|>
url = '/api/v1.2/graph-connections'
code, res = Request().request(method='get', path=url, par... | 图链接接口 | GraphConnection | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GraphConnection:
"""图链接接口"""
def add_graph_connect(body, auth=None):
"""添加图链接 :param auth: :param body :return:"""
<|body_0|>
def get_graph_connect(param=None, auth=None):
"""查看图链接 :param param: :param auth: :return:"""
<|body_1|>
def update_graph_co... | stack_v2_sparse_classes_36k_train_020149 | 26,078 | no_license | [
{
"docstring": "添加图链接 :param auth: :param body :return:",
"name": "add_graph_connect",
"signature": "def add_graph_connect(body, auth=None)"
},
{
"docstring": "查看图链接 :param param: :param auth: :return:",
"name": "get_graph_connect",
"signature": "def get_graph_connect(param=None, auth=No... | 4 | stack_v2_sparse_classes_30k_train_007846 | Implement the Python class `GraphConnection` described below.
Class description:
图链接接口
Method signatures and docstrings:
- def add_graph_connect(body, auth=None): 添加图链接 :param auth: :param body :return:
- def get_graph_connect(param=None, auth=None): 查看图链接 :param param: :param auth: :return:
- def update_graph_connec... | Implement the Python class `GraphConnection` described below.
Class description:
图链接接口
Method signatures and docstrings:
- def add_graph_connect(body, auth=None): 添加图链接 :param auth: :param body :return:
- def get_graph_connect(param=None, auth=None): 查看图链接 :param param: :param auth: :return:
- def update_graph_connec... | 89e5b34ab925bcc0bbc4ad63302e96c62a420399 | <|skeleton|>
class GraphConnection:
"""图链接接口"""
def add_graph_connect(body, auth=None):
"""添加图链接 :param auth: :param body :return:"""
<|body_0|>
def get_graph_connect(param=None, auth=None):
"""查看图链接 :param param: :param auth: :return:"""
<|body_1|>
def update_graph_co... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GraphConnection:
"""图链接接口"""
def add_graph_connect(body, auth=None):
"""添加图链接 :param auth: :param body :return:"""
url = '/api/v1.2/graph-connections'
code, res = Request().request(method='post', path=url, json=body, types='hubble')
return (code, res)
def get_graph_co... | the_stack_v2_python_sparse | src/common/hubble_api.py | hugegraph/hugegraph-test | train | 1 |
9ca24f0e1499c623fd774e66e967d1c854e0aff9 | [
"\"\"\"\n insert the tree..\n it has the links we dont have to link it again.\n \"\"\"\nself.list = []\nself.list.append(root)\nfor item in self.list:\n if item.left != None:\n self.list.append(item.left)\n if item.right != None:\n self.list.append(item.right)",
"\"\"\"\n ... | <|body_start_0|>
"""
insert the tree..
it has the links we dont have to link it again.
"""
self.list = []
self.list.append(root)
for item in self.list:
if item.left != None:
self.list.append(item.left)
... | CBTInserter | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CBTInserter:
def __init__(self, root):
""":type root: TreeNode"""
<|body_0|>
def insert(self, v):
""":type v: int :rtype: int"""
<|body_1|>
def get_root(self):
""":rtype: TreeNode"""
<|body_2|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_36k_train_020150 | 2,522 | no_license | [
{
"docstring": ":type root: TreeNode",
"name": "__init__",
"signature": "def __init__(self, root)"
},
{
"docstring": ":type v: int :rtype: int",
"name": "insert",
"signature": "def insert(self, v)"
},
{
"docstring": ":rtype: TreeNode",
"name": "get_root",
"signature": "de... | 3 | stack_v2_sparse_classes_30k_train_004632 | Implement the Python class `CBTInserter` described below.
Class description:
Implement the CBTInserter class.
Method signatures and docstrings:
- def __init__(self, root): :type root: TreeNode
- def insert(self, v): :type v: int :rtype: int
- def get_root(self): :rtype: TreeNode | Implement the Python class `CBTInserter` described below.
Class description:
Implement the CBTInserter class.
Method signatures and docstrings:
- def __init__(self, root): :type root: TreeNode
- def insert(self, v): :type v: int :rtype: int
- def get_root(self): :rtype: TreeNode
<|skeleton|>
class CBTInserter:
... | 11c81645893fd65f585c3f558ea837c7dd3cb654 | <|skeleton|>
class CBTInserter:
def __init__(self, root):
""":type root: TreeNode"""
<|body_0|>
def insert(self, v):
""":type v: int :rtype: int"""
<|body_1|>
def get_root(self):
""":rtype: TreeNode"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CBTInserter:
def __init__(self, root):
""":type root: TreeNode"""
"""
insert the tree..
it has the links we dont have to link it again.
"""
self.list = []
self.list.append(root)
for item in self.list:
if item.l... | the_stack_v2_python_sparse | LC_Complete_Binary_Tree_Inserter.py | venkatsvpr/Problems_Solved | train | 5 | |
bd67633b39631b5cfd14494d54a551a946e0095c | [
"for i in range(k):\n s = nums[0]\n for j in range(1, len(nums)):\n nums[j], s = (s, nums[j])\n nums[0] = s\nreturn nums",
"if nums:\n k = k % len(nums)\n nums[:] = nums[-k:] + nums[:-k]\nreturn nums",
"if len(nums) == 0 or k == 0:\n return\n\ndef reverse(start, end, s):\n while star... | <|body_start_0|>
for i in range(k):
s = nums[0]
for j in range(1, len(nums)):
nums[j], s = (s, nums[j])
nums[0] = s
return nums
<|end_body_0|>
<|body_start_1|>
if nums:
k = k % len(nums)
nums[:] = nums[-k:] + nums[:-k]
... | 给定一个数组,将数组中的元素向右移动 k 个位置,其中 k 是非负数。 输入: [1,2,3,4,5,6,7] 和 k = 3 输出: [5,6,7,1,2,3,4] 解释: 向右旋转 1 步: [7,1,2,3,4,5,6] 向右旋转 2 步: [6,7,1,2,3,4,5] 向右旋转 3 步: [5,6,7,1,2,3,4] | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
"""给定一个数组,将数组中的元素向右移动 k 个位置,其中 k 是非负数。 输入: [1,2,3,4,5,6,7] 和 k = 3 输出: [5,6,7,1,2,3,4] 解释: 向右旋转 1 步: [7,1,2,3,4,5,6] 向右旋转 2 步: [6,7,1,2,3,4,5] 向右旋转 3 步: [5,6,7,1,2,3,4]"""
def rotate1(self, nums, k):
""":param nums: list[int] :param k: int :return: list[int]"""
<|bo... | stack_v2_sparse_classes_36k_train_020151 | 1,769 | no_license | [
{
"docstring": ":param nums: list[int] :param k: int :return: list[int]",
"name": "rotate1",
"signature": "def rotate1(self, nums, k)"
},
{
"docstring": ":param nums: list[int] :param k: int :return: list[int]",
"name": "rotate2",
"signature": "def rotate2(self, nums, k)"
},
{
"d... | 3 | stack_v2_sparse_classes_30k_train_011983 | Implement the Python class `Solution` described below.
Class description:
给定一个数组,将数组中的元素向右移动 k 个位置,其中 k 是非负数。 输入: [1,2,3,4,5,6,7] 和 k = 3 输出: [5,6,7,1,2,3,4] 解释: 向右旋转 1 步: [7,1,2,3,4,5,6] 向右旋转 2 步: [6,7,1,2,3,4,5] 向右旋转 3 步: [5,6,7,1,2,3,4]
Method signatures and docstrings:
- def rotate1(self, nums, k): :param nums: l... | Implement the Python class `Solution` described below.
Class description:
给定一个数组,将数组中的元素向右移动 k 个位置,其中 k 是非负数。 输入: [1,2,3,4,5,6,7] 和 k = 3 输出: [5,6,7,1,2,3,4] 解释: 向右旋转 1 步: [7,1,2,3,4,5,6] 向右旋转 2 步: [6,7,1,2,3,4,5] 向右旋转 3 步: [5,6,7,1,2,3,4]
Method signatures and docstrings:
- def rotate1(self, nums, k): :param nums: l... | 40bca64cf3ed2fbc670b9e2cdf4f88d6c7b68134 | <|skeleton|>
class Solution:
"""给定一个数组,将数组中的元素向右移动 k 个位置,其中 k 是非负数。 输入: [1,2,3,4,5,6,7] 和 k = 3 输出: [5,6,7,1,2,3,4] 解释: 向右旋转 1 步: [7,1,2,3,4,5,6] 向右旋转 2 步: [6,7,1,2,3,4,5] 向右旋转 3 步: [5,6,7,1,2,3,4]"""
def rotate1(self, nums, k):
""":param nums: list[int] :param k: int :return: list[int]"""
<|bo... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
"""给定一个数组,将数组中的元素向右移动 k 个位置,其中 k 是非负数。 输入: [1,2,3,4,5,6,7] 和 k = 3 输出: [5,6,7,1,2,3,4] 解释: 向右旋转 1 步: [7,1,2,3,4,5,6] 向右旋转 2 步: [6,7,1,2,3,4,5] 向右旋转 3 步: [5,6,7,1,2,3,4]"""
def rotate1(self, nums, k):
""":param nums: list[int] :param k: int :return: list[int]"""
for i in range(k)... | the_stack_v2_python_sparse | Array/three.py | okliou/lcode | train | 0 |
9cfbc9dfa72cdbbf43b496a559894a2a864fbbaf | [
"super().__init__(app, pipeline, id=id, config=config)\nself.Connection = pipeline.locate_connection(app, connection)\nself.Index = self.Config['index']\nif request_body is not None:\n self.RequestBody = request_body\nelse:\n self.RequestBody = {'query': {'bool': {'must': {'match_all': {}}}}}",
"request_bod... | <|body_start_0|>
super().__init__(app, pipeline, id=id, config=config)
self.Connection = pipeline.locate_connection(app, connection)
self.Index = self.Config['index']
if request_body is not None:
self.RequestBody = request_body
else:
self.RequestBody = {'q... | Description: | ElasticSearchAggsSource | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ElasticSearchAggsSource:
"""Description:"""
def __init__(self, app, pipeline, connection, request_body=None, id=None, config=None):
"""Description: **Parameters** app : Application Name of the `Application <https://asab.readthedocs.io/en/latest/asab/application.html>`_. pipeline : Pi... | stack_v2_sparse_classes_36k_train_020152 | 5,123 | permissive | [
{
"docstring": "Description: **Parameters** app : Application Name of the `Application <https://asab.readthedocs.io/en/latest/asab/application.html>`_. pipeline : Pipeline Name of the Pipeline. connection : Connection Information of the connection. request_body JSON, default = None Request body needed for the r... | 4 | null | Implement the Python class `ElasticSearchAggsSource` described below.
Class description:
Description:
Method signatures and docstrings:
- def __init__(self, app, pipeline, connection, request_body=None, id=None, config=None): Description: **Parameters** app : Application Name of the `Application <https://asab.readthe... | Implement the Python class `ElasticSearchAggsSource` described below.
Class description:
Description:
Method signatures and docstrings:
- def __init__(self, app, pipeline, connection, request_body=None, id=None, config=None): Description: **Parameters** app : Application Name of the `Application <https://asab.readthe... | 11ee3689d0ff6e9b662deeb3fc5e18bb0aabc8f2 | <|skeleton|>
class ElasticSearchAggsSource:
"""Description:"""
def __init__(self, app, pipeline, connection, request_body=None, id=None, config=None):
"""Description: **Parameters** app : Application Name of the `Application <https://asab.readthedocs.io/en/latest/asab/application.html>`_. pipeline : Pi... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ElasticSearchAggsSource:
"""Description:"""
def __init__(self, app, pipeline, connection, request_body=None, id=None, config=None):
"""Description: **Parameters** app : Application Name of the `Application <https://asab.readthedocs.io/en/latest/asab/application.html>`_. pipeline : Pipeline Name o... | the_stack_v2_python_sparse | bspump/elasticsearch/source.py | LibertyAces/BitSwanPump | train | 24 |
b18572fb2a0bc3493a5e188da3fc468d39c03b54 | [
"self.parse_input()\nemulator = Emulator(6)\nemulator.registers[0] = 16457176\n\ndef dump_registers_at_ip28(ip):\n if ip == 28:\n raise RuntimeError()\ntry:\n self.execute_program(emulator, callback=dump_registers_at_ip28)\nexcept RuntimeError:\n print(f'Final register state: {emulator.registers}. A... | <|body_start_0|>
self.parse_input()
emulator = Emulator(6)
emulator.registers[0] = 16457176
def dump_registers_at_ip28(ip):
if ip == 28:
raise RuntimeError()
try:
self.execute_program(emulator, callback=dump_registers_at_ip28)
exce... | Day 21 challenges | Challenge | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Challenge:
"""Day 21 challenges"""
def challenge1(self):
"""Day 21 challenge 1"""
<|body_0|>
def challenge2(self):
"""Day 21 challenge 2"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.parse_input()
emulator = Emulator(6)
em... | stack_v2_sparse_classes_36k_train_020153 | 2,839 | permissive | [
{
"docstring": "Day 21 challenge 1",
"name": "challenge1",
"signature": "def challenge1(self)"
},
{
"docstring": "Day 21 challenge 2",
"name": "challenge2",
"signature": "def challenge2(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_011086 | Implement the Python class `Challenge` described below.
Class description:
Day 21 challenges
Method signatures and docstrings:
- def challenge1(self): Day 21 challenge 1
- def challenge2(self): Day 21 challenge 2 | Implement the Python class `Challenge` described below.
Class description:
Day 21 challenges
Method signatures and docstrings:
- def challenge1(self): Day 21 challenge 1
- def challenge2(self): Day 21 challenge 2
<|skeleton|>
class Challenge:
"""Day 21 challenges"""
def challenge1(self):
"""Day 21 c... | 6671ef8c16a837f697bb3fb91004d1bd892814ba | <|skeleton|>
class Challenge:
"""Day 21 challenges"""
def challenge1(self):
"""Day 21 challenge 1"""
<|body_0|>
def challenge2(self):
"""Day 21 challenge 2"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Challenge:
"""Day 21 challenges"""
def challenge1(self):
"""Day 21 challenge 1"""
self.parse_input()
emulator = Emulator(6)
emulator.registers[0] = 16457176
def dump_registers_at_ip28(ip):
if ip == 28:
raise RuntimeError()
try:
... | the_stack_v2_python_sparse | 2018/day21/challenge.py | ericgreveson/adventofcode | train | 0 |
0b00876629e88842b24b0f76c751b49a1a704001 | [
"self.server = server\ncredentials = pika.PlainCredentials(EnvironmentVariables.RABBITMQ_USER_DEFAULT.get_env(), EnvironmentVariables.RABBITMQ_PASS_DEFAULT.get_env())\nself._connection = pika.BlockingConnection(pika.ConnectionParameters(self.server.host, credentials=credentials))\nself._channel = self._connection.c... | <|body_start_0|>
self.server = server
credentials = pika.PlainCredentials(EnvironmentVariables.RABBITMQ_USER_DEFAULT.get_env(), EnvironmentVariables.RABBITMQ_PASS_DEFAULT.get_env())
self._connection = pika.BlockingConnection(pika.ConnectionParameters(self.server.host, credentials=credentials))
... | RabbitMQ | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RabbitMQ:
def __init__(self, server):
""":param server: Object of RabbitmqConfigure"""
<|body_0|>
def publish(self, message={}):
""":param message: message to be publish in JSON format"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.server = se... | stack_v2_sparse_classes_36k_train_020154 | 1,557 | no_license | [
{
"docstring": ":param server: Object of RabbitmqConfigure",
"name": "__init__",
"signature": "def __init__(self, server)"
},
{
"docstring": ":param message: message to be publish in JSON format",
"name": "publish",
"signature": "def publish(self, message={})"
}
] | 2 | stack_v2_sparse_classes_30k_train_002145 | Implement the Python class `RabbitMQ` described below.
Class description:
Implement the RabbitMQ class.
Method signatures and docstrings:
- def __init__(self, server): :param server: Object of RabbitmqConfigure
- def publish(self, message={}): :param message: message to be publish in JSON format | Implement the Python class `RabbitMQ` described below.
Class description:
Implement the RabbitMQ class.
Method signatures and docstrings:
- def __init__(self, server): :param server: Object of RabbitmqConfigure
- def publish(self, message={}): :param message: message to be publish in JSON format
<|skeleton|>
class R... | cf354309d3473cfd694b51d605388094516ec552 | <|skeleton|>
class RabbitMQ:
def __init__(self, server):
""":param server: Object of RabbitmqConfigure"""
<|body_0|>
def publish(self, message={}):
""":param message: message to be publish in JSON format"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RabbitMQ:
def __init__(self, server):
""":param server: Object of RabbitmqConfigure"""
self.server = server
credentials = pika.PlainCredentials(EnvironmentVariables.RABBITMQ_USER_DEFAULT.get_env(), EnvironmentVariables.RABBITMQ_PASS_DEFAULT.get_env())
self._connection = pika.Bl... | the_stack_v2_python_sparse | 0.2_PYTHON_RABBITMQ_DOCKER/producer/app/rabbitmq.py | FernandoBLima/python-sample-projects | train | 0 | |
9302b01b38104213c8e092873a450fd19cf9d2c3 | [
"super().__init__(**kwargs)\nself.alpha = alpha\nself.gamma = gamma\nself.label_smoothing = label_smoothing",
"class_targets = y_true\nclass_outputs, mask = y_pred\nalpha = tf.convert_to_tensor(self.alpha, dtype=y_pred[0][0].dtype)\ngamma = tf.convert_to_tensor(self.gamma, dtype=y_pred[0][0].dtype)\ntotal_loss = ... | <|body_start_0|>
super().__init__(**kwargs)
self.alpha = alpha
self.gamma = gamma
self.label_smoothing = label_smoothing
<|end_body_0|>
<|body_start_1|>
class_targets = y_true
class_outputs, mask = y_pred
alpha = tf.convert_to_tensor(self.alpha, dtype=y_pred[0][0... | Compute the focal loss between `logits` and the golden `target` values. Focal loss = -(1-pt)^gamma * log(pt) where pt is the probability of being classified to the true class. | ClassFocalLoss | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ClassFocalLoss:
"""Compute the focal loss between `logits` and the golden `target` values. Focal loss = -(1-pt)^gamma * log(pt) where pt is the probability of being classified to the true class."""
def __init__(self, alpha, gamma, label_smoothing=0.0, **kwargs):
"""Initialize focal l... | stack_v2_sparse_classes_36k_train_020155 | 2,607 | no_license | [
{
"docstring": "Initialize focal loss. Args: alpha: A float32 scalar multiplying alpha to the loss from positive examples and (1-alpha) to the loss from negative examples. gamma: A float32 scalar modulating loss from hard and easy examples. label_smoothing: Float in [0, 1]. If > `0` then smooth the labels. **kw... | 2 | stack_v2_sparse_classes_30k_train_018168 | Implement the Python class `ClassFocalLoss` described below.
Class description:
Compute the focal loss between `logits` and the golden `target` values. Focal loss = -(1-pt)^gamma * log(pt) where pt is the probability of being classified to the true class.
Method signatures and docstrings:
- def __init__(self, alpha, ... | Implement the Python class `ClassFocalLoss` described below.
Class description:
Compute the focal loss between `logits` and the golden `target` values. Focal loss = -(1-pt)^gamma * log(pt) where pt is the probability of being classified to the true class.
Method signatures and docstrings:
- def __init__(self, alpha, ... | b7549701b0b1a7e4cc2c8275df2bc6c7a3253d24 | <|skeleton|>
class ClassFocalLoss:
"""Compute the focal loss between `logits` and the golden `target` values. Focal loss = -(1-pt)^gamma * log(pt) where pt is the probability of being classified to the true class."""
def __init__(self, alpha, gamma, label_smoothing=0.0, **kwargs):
"""Initialize focal l... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ClassFocalLoss:
"""Compute the focal loss between `logits` and the golden `target` values. Focal loss = -(1-pt)^gamma * log(pt) where pt is the probability of being classified to the true class."""
def __init__(self, alpha, gamma, label_smoothing=0.0, **kwargs):
"""Initialize focal loss. Args: al... | the_stack_v2_python_sparse | AIServer/ai_api/ai_models/losses/class_loss.py | tfwcn/tensorflow2-machine-vision | train | 1 |
e0d0c6359170889d6800872f530c7cc9083355b5 | [
"self.cpu_irqs = []\nself.num_cpus = 0\nsuper().__init__('/proc/interrupts')\nself.read()",
"lines = self.content.split('\\n')\nfor cpu_id in lines[0].split():\n if not cpu_id:\n continue\n if cpu_id.startswith('CPU'):\n self.cpu_irqs.append(IRQList(cpu_id[-1]))\nfor irq_line in lines[1:]:\n ... | <|body_start_0|>
self.cpu_irqs = []
self.num_cpus = 0
super().__init__('/proc/interrupts')
self.read()
<|end_body_0|>
<|body_start_1|>
lines = self.content.split('\n')
for cpu_id in lines[0].split():
if not cpu_id:
continue
if cpu_... | Object represents the /proc/interrupts file. | ProcInterrupts | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProcInterrupts:
"""Object represents the /proc/interrupts file."""
def __init__(self):
"""Read file by calling base class constructor then parse the contents."""
<|body_0|>
def read(self):
"""Parses contents of /proc/interrupts"""
<|body_1|>
def dump... | stack_v2_sparse_classes_36k_train_020156 | 2,181 | permissive | [
{
"docstring": "Read file by calling base class constructor then parse the contents.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Parses contents of /proc/interrupts",
"name": "read",
"signature": "def read(self)"
},
{
"docstring": "Print information... | 3 | stack_v2_sparse_classes_30k_train_003813 | Implement the Python class `ProcInterrupts` described below.
Class description:
Object represents the /proc/interrupts file.
Method signatures and docstrings:
- def __init__(self): Read file by calling base class constructor then parse the contents.
- def read(self): Parses contents of /proc/interrupts
- def dump(sel... | Implement the Python class `ProcInterrupts` described below.
Class description:
Object represents the /proc/interrupts file.
Method signatures and docstrings:
- def __init__(self): Read file by calling base class constructor then parse the contents.
- def read(self): Parses contents of /proc/interrupts
- def dump(sel... | 5fc781852dcdf55c3a807e97692224a28c0913f6 | <|skeleton|>
class ProcInterrupts:
"""Object represents the /proc/interrupts file."""
def __init__(self):
"""Read file by calling base class constructor then parse the contents."""
<|body_0|>
def read(self):
"""Parses contents of /proc/interrupts"""
<|body_1|>
def dump... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ProcInterrupts:
"""Object represents the /proc/interrupts file."""
def __init__(self):
"""Read file by calling base class constructor then parse the contents."""
self.cpu_irqs = []
self.num_cpus = 0
super().__init__('/proc/interrupts')
self.read()
def read(sel... | the_stack_v2_python_sparse | proc_scraper/proc_interrupts.py | EwanC/pyProc | train | 0 |
83f3204fa991a623d37f90d788c34e45f3827d20 | [
"cost_calc = cc.CostCalculator()\ncompressed_model_cost = cost_calc.compute_network_cost(compressed_layers)\nif cost_metric is CostMetric.memory:\n savings = network_cost.memory - compressed_model_cost.memory\n ratio = savings / network_cost.memory\nelse:\n savings = network_cost.mac - compressed_model_cos... | <|body_start_0|>
cost_calc = cc.CostCalculator()
compressed_model_cost = cost_calc.compute_network_cost(compressed_layers)
if cost_metric is CostMetric.memory:
savings = network_cost.memory - compressed_model_cost.memory
ratio = savings / network_cost.memory
else:... | A class for calculating the statistics for a model | ModelStats | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ModelStats:
"""A class for calculating the statistics for a model"""
def compute_compression_ratio(compressed_layers, cost_metric, network_cost):
"""Computes the compression ratio of a model :param compressed_layers: layers which are compressed :param cost_metric: cost metric is memo... | stack_v2_sparse_classes_36k_train_020157 | 4,927 | permissive | [
{
"docstring": "Computes the compression ratio of a model :param compressed_layers: layers which are compressed :param cost_metric: cost metric is memory or mac :param network_cost: mac and memory cost calculated for the entire network :return: It returns the compression ratio for a network",
"name": "compu... | 3 | stack_v2_sparse_classes_30k_train_014677 | Implement the Python class `ModelStats` described below.
Class description:
A class for calculating the statistics for a model
Method signatures and docstrings:
- def compute_compression_ratio(compressed_layers, cost_metric, network_cost): Computes the compression ratio of a model :param compressed_layers: layers whi... | Implement the Python class `ModelStats` described below.
Class description:
A class for calculating the statistics for a model
Method signatures and docstrings:
- def compute_compression_ratio(compressed_layers, cost_metric, network_cost): Computes the compression ratio of a model :param compressed_layers: layers whi... | 5a406e657082b6a4f6e4bf48f0e46e085cb1e351 | <|skeleton|>
class ModelStats:
"""A class for calculating the statistics for a model"""
def compute_compression_ratio(compressed_layers, cost_metric, network_cost):
"""Computes the compression ratio of a model :param compressed_layers: layers which are compressed :param cost_metric: cost metric is memo... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ModelStats:
"""A class for calculating the statistics for a model"""
def compute_compression_ratio(compressed_layers, cost_metric, network_cost):
"""Computes the compression ratio of a model :param compressed_layers: layers which are compressed :param cost_metric: cost metric is memory or mac :pa... | the_stack_v2_python_sparse | TrainingExtensions/torch/src/python/aimet_torch/svd/model_stats_calculator.py | quic/aimet | train | 1,676 |
e37f9761297ea70a7a756ee1d25a3011e779dc09 | [
"if root == None:\n return None\nqueue, encode = ([root], '')\nencode += str(root.val) + '#'\nwhile len(queue):\n curr = queue.pop(0)\n children = curr.children\n s = ' '.join([str(c.val) for c in children])\n queue.extend(children)\n encode += s + '#'\nreturn encode",
"if data == None:\n ret... | <|body_start_0|>
if root == None:
return None
queue, encode = ([root], '')
encode += str(root.val) + '#'
while len(queue):
curr = queue.pop(0)
children = curr.children
s = ' '.join([str(c.val) for c in children])
queue.extend(ch... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: Node :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: Node"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|... | stack_v2_sparse_classes_36k_train_020158 | 1,562 | no_license | [
{
"docstring": "Encodes a tree to a single string. :type root: Node :rtype: str",
"name": "serialize",
"signature": "def serialize(self, root)"
},
{
"docstring": "Decodes your encoded data to tree. :type data: str :rtype: Node",
"name": "deserialize",
"signature": "def deserialize(self, ... | 2 | null | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: Node :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype: Nod... | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: Node :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype: Nod... | b0ce69985c51a9a794397cd98a996fca0e91d7d1 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: Node :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: Node"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: Node :rtype: str"""
if root == None:
return None
queue, encode = ([root], '')
encode += str(root.val) + '#'
while len(queue):
curr = queue.pop(0)
chil... | the_stack_v2_python_sparse | Solutions/428-Serialize-and-Deserialize-N-ary-Tree/python.py | JerryHu1994/LeetCode-Practice | train | 0 | |
aeba100ae16d359a3c27282700eae1b499eb9ec7 | [
"self.image_set = image_set\nself.position = position\nself.length = length\nself.rotation = rotation\nself.health = length\nself.have_sunken = False\nself.hit_parts = [False] * length",
"self.health -= 1\nself.hit_parts[part] = True\nif self.health <= 0:\n self.have_sunken = True\n return True\nelse:\n ... | <|body_start_0|>
self.image_set = image_set
self.position = position
self.length = length
self.rotation = rotation
self.health = length
self.have_sunken = False
self.hit_parts = [False] * length
<|end_body_0|>
<|body_start_1|>
self.health -= 1
sel... | Base class for a ship A Ship have a image set (texture), a coordinate where the ship starts, a lenth and a rotation ment to be used together with the Board class example: ship_texure1 = [U, #, ^] <- the order is important, it have to be (bottom-part, middle-part, top-part) (stern, deck, prow) ship1 = Ship(image_set=shi... | Ship | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Ship:
"""Base class for a ship A Ship have a image set (texture), a coordinate where the ship starts, a lenth and a rotation ment to be used together with the Board class example: ship_texure1 = [U, #, ^] <- the order is important, it have to be (bottom-part, middle-part, top-part) (stern, deck, ... | stack_v2_sparse_classes_36k_train_020159 | 2,768 | no_license | [
{
"docstring": ":param image_set (list[surface]): what texture this ship uses (bottom-part, middle-part, top-part) (stern, deck, prow) :param position (tuple[int,int]): (x, y) index where the ship starts :param length (int): the lenght of the ship :param rotation (tuple[int,int]): the rotation of the ship",
... | 2 | stack_v2_sparse_classes_30k_train_020374 | Implement the Python class `Ship` described below.
Class description:
Base class for a ship A Ship have a image set (texture), a coordinate where the ship starts, a lenth and a rotation ment to be used together with the Board class example: ship_texure1 = [U, #, ^] <- the order is important, it have to be (bottom-part... | Implement the Python class `Ship` described below.
Class description:
Base class for a ship A Ship have a image set (texture), a coordinate where the ship starts, a lenth and a rotation ment to be used together with the Board class example: ship_texure1 = [U, #, ^] <- the order is important, it have to be (bottom-part... | bdf7a3358845a61e736af39c419e5fd7b3064e1f | <|skeleton|>
class Ship:
"""Base class for a ship A Ship have a image set (texture), a coordinate where the ship starts, a lenth and a rotation ment to be used together with the Board class example: ship_texure1 = [U, #, ^] <- the order is important, it have to be (bottom-part, middle-part, top-part) (stern, deck, ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Ship:
"""Base class for a ship A Ship have a image set (texture), a coordinate where the ship starts, a lenth and a rotation ment to be used together with the Board class example: ship_texure1 = [U, #, ^] <- the order is important, it have to be (bottom-part, middle-part, top-part) (stern, deck, prow) ship1 =... | the_stack_v2_python_sparse | BattleShips/framework/ship.py | Abooow/BattleShips | train | 0 |
eca67efc9f7b6b2bef712863a4c7d81dc5f4fe2e | [
"model._needs_content_types()\ninlines = []\nfor content_type in model._feincms_content_types:\n if not self.can_add_content(request, content_type):\n continue\n attrs = {'__module__': model.__module__, 'model': content_type}\n if hasattr(content_type, 'feincms_item_editor_inline'):\n inline ... | <|body_start_0|>
model._needs_content_types()
inlines = []
for content_type in model._feincms_content_types:
if not self.can_add_content(request, content_type):
continue
attrs = {'__module__': model.__module__, 'model': content_type}
if hasattr... | PageAdmin | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PageAdmin:
def get_feincms_inlines(self, model, request):
"""Generate genuine django inlines for registered content types."""
<|body_0|>
def get_changeform_initial_data(self, request):
"""Copy initial data from parent"""
<|body_1|>
<|end_skeleton|>
<|body_s... | stack_v2_sparse_classes_36k_train_020160 | 8,715 | permissive | [
{
"docstring": "Generate genuine django inlines for registered content types.",
"name": "get_feincms_inlines",
"signature": "def get_feincms_inlines(self, model, request)"
},
{
"docstring": "Copy initial data from parent",
"name": "get_changeform_initial_data",
"signature": "def get_chan... | 2 | null | Implement the Python class `PageAdmin` described below.
Class description:
Implement the PageAdmin class.
Method signatures and docstrings:
- def get_feincms_inlines(self, model, request): Generate genuine django inlines for registered content types.
- def get_changeform_initial_data(self, request): Copy initial data... | Implement the Python class `PageAdmin` described below.
Class description:
Implement the PageAdmin class.
Method signatures and docstrings:
- def get_feincms_inlines(self, model, request): Generate genuine django inlines for registered content types.
- def get_changeform_initial_data(self, request): Copy initial data... | 7d3f116830075f05a8c9a105ae6f7f80f7a6444c | <|skeleton|>
class PageAdmin:
def get_feincms_inlines(self, model, request):
"""Generate genuine django inlines for registered content types."""
<|body_0|>
def get_changeform_initial_data(self, request):
"""Copy initial data from parent"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PageAdmin:
def get_feincms_inlines(self, model, request):
"""Generate genuine django inlines for registered content types."""
model._needs_content_types()
inlines = []
for content_type in model._feincms_content_types:
if not self.can_add_content(request, content_typ... | the_stack_v2_python_sparse | leonardo/module/web/admin.py | django-leonardo/django-leonardo | train | 108 | |
46be2cd9065ea8c1819aef150a6dfcf104b1c3e9 | [
"top1 = super().pop()\ntop2 = super().pop()\n_sum = top1 + top2\nsuper().append(_sum)\nreturn _sum",
"top1 = super().pop()\ntop2 = super().pop()\n_sub = top1 - top2\nsuper().append(_sub)\nreturn _sub",
"top1 = super().pop()\ntop2 = super().pop()\n_mul = top1 * top2\nsuper().append(_mul)\nreturn _mul",
"top1 =... | <|body_start_0|>
top1 = super().pop()
top2 = super().pop()
_sum = top1 + top2
super().append(_sum)
return _sum
<|end_body_0|>
<|body_start_1|>
top1 = super().pop()
top2 = super().pop()
_sub = top1 - top2
super().append(_sub)
return _sub
<|... | ExtendedStack | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ExtendedStack:
def sum(self):
"""операция сложения :return:top1+top2"""
<|body_0|>
def sub(self):
"""операция вычитания :return:"""
<|body_1|>
def mul(self):
"""операция умножения :return:"""
<|body_2|>
def div(self):
"""опер... | stack_v2_sparse_classes_36k_train_020161 | 998 | no_license | [
{
"docstring": "операция сложения :return:top1+top2",
"name": "sum",
"signature": "def sum(self)"
},
{
"docstring": "операция вычитания :return:",
"name": "sub",
"signature": "def sub(self)"
},
{
"docstring": "операция умножения :return:",
"name": "mul",
"signature": "def... | 4 | stack_v2_sparse_classes_30k_test_001055 | Implement the Python class `ExtendedStack` described below.
Class description:
Implement the ExtendedStack class.
Method signatures and docstrings:
- def sum(self): операция сложения :return:top1+top2
- def sub(self): операция вычитания :return:
- def mul(self): операция умножения :return:
- def div(self): операция ц... | Implement the Python class `ExtendedStack` described below.
Class description:
Implement the ExtendedStack class.
Method signatures and docstrings:
- def sum(self): операция сложения :return:top1+top2
- def sub(self): операция вычитания :return:
- def mul(self): операция умножения :return:
- def div(self): операция ц... | c165bfed507332387e4fefa3106369188f1f667a | <|skeleton|>
class ExtendedStack:
def sum(self):
"""операция сложения :return:top1+top2"""
<|body_0|>
def sub(self):
"""операция вычитания :return:"""
<|body_1|>
def mul(self):
"""операция умножения :return:"""
<|body_2|>
def div(self):
"""опер... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ExtendedStack:
def sum(self):
"""операция сложения :return:top1+top2"""
top1 = super().pop()
top2 = super().pop()
_sum = top1 + top2
super().append(_sum)
return _sum
def sub(self):
"""операция вычитания :return:"""
top1 = super().pop()
... | the_stack_v2_python_sparse | 01/src/ex_1_6_08.py | jul-star/Stepik_BasicUse | train | 0 | |
a0f73e2479d15fe70279cb7aebc608800e82b15d | [
"for cls in self._middleware_classes:\n middleware = cls(self.get_response)\n if hasattr(middleware, 'process_view'):\n result = middleware.process_view(request, view_func, view_args, view_kwargs)\n if result:\n return result\nreturn None",
"for cls in self._middleware_classes:\n ... | <|body_start_0|>
for cls in self._middleware_classes:
middleware = cls(self.get_response)
if hasattr(middleware, 'process_view'):
result = middleware.process_view(request, view_func, view_args, view_kwargs)
if result:
return result
... | Middleware to execute middleware from extensions. The process_*() methods iterate over all extensions' middleware, calling the given method if it exists. The semantics of how Django executes each method are preserved. This middleware should be loaded after the main extension middleware (djblets.extensions.middleware.Ex... | ExtensionsMiddlewareRunner | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ExtensionsMiddlewareRunner:
"""Middleware to execute middleware from extensions. The process_*() methods iterate over all extensions' middleware, calling the given method if it exists. The semantics of how Django executes each method are preserved. This middleware should be loaded after the main ... | stack_v2_sparse_classes_36k_train_020162 | 6,661 | no_license | [
{
"docstring": "Process a view through extension middleware. Args: request (django.http.HttpRequest): The request object. view_func (callable): The view callable. view_args (list): Positional arguments to pass to the view. view_kwargs (dict): Keyword arguments to pass to the view. Returns: django.http.HttpRespo... | 5 | null | Implement the Python class `ExtensionsMiddlewareRunner` described below.
Class description:
Middleware to execute middleware from extensions. The process_*() methods iterate over all extensions' middleware, calling the given method if it exists. The semantics of how Django executes each method are preserved. This midd... | Implement the Python class `ExtensionsMiddlewareRunner` described below.
Class description:
Middleware to execute middleware from extensions. The process_*() methods iterate over all extensions' middleware, calling the given method if it exists. The semantics of how Django executes each method are preserved. This midd... | 99ea69d80a3a393b0da4da3152ef26e808dd8487 | <|skeleton|>
class ExtensionsMiddlewareRunner:
"""Middleware to execute middleware from extensions. The process_*() methods iterate over all extensions' middleware, calling the given method if it exists. The semantics of how Django executes each method are preserved. This middleware should be loaded after the main ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ExtensionsMiddlewareRunner:
"""Middleware to execute middleware from extensions. The process_*() methods iterate over all extensions' middleware, calling the given method if it exists. The semantics of how Django executes each method are preserved. This middleware should be loaded after the main extension mid... | the_stack_v2_python_sparse | djblets/extensions/middleware.py | chipx86/djblets | train | 2 |
7ebd4b2b6ddbfbd34eef881fd61d7a56c11cbf74 | [
"query = Citation.select().join(Text).where(Text.display == True).where(Text.valid == True)\nfor row in query_bar(query):\n doc = {}\n doc['_id'] = row.id\n doc['text_id'] = row.text_id\n doc['document_id'] = row.document_id\n doc['corpus'] = row.text.corpus\n subfield = row.subfield\n if subfi... | <|body_start_0|>
query = Citation.select().join(Text).where(Text.display == True).where(Text.valid == True)
for row in query_bar(query):
doc = {}
doc['_id'] = row.id
doc['text_id'] = row.text_id
doc['document_id'] = row.document_id
doc['corpus'... | Citation_Index | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Citation_Index:
def es_stream_docs(cls):
"""Stream Elasticsearch docs. Yields: dict: The next document."""
<|body_0|>
def compute_ranking(cls, filters={}, depth=100000.0):
"""Given a set of query filters, count the number of times each text is cited on documents that... | stack_v2_sparse_classes_36k_train_020163 | 6,798 | permissive | [
{
"docstring": "Stream Elasticsearch docs. Yields: dict: The next document.",
"name": "es_stream_docs",
"signature": "def es_stream_docs(cls)"
},
{
"docstring": "Given a set of query filters, count the number of times each text is cited on documents that match the criteria. Args: filters (dict):... | 5 | stack_v2_sparse_classes_30k_train_005087 | Implement the Python class `Citation_Index` described below.
Class description:
Implement the Citation_Index class.
Method signatures and docstrings:
- def es_stream_docs(cls): Stream Elasticsearch docs. Yields: dict: The next document.
- def compute_ranking(cls, filters={}, depth=100000.0): Given a set of query filt... | Implement the Python class `Citation_Index` described below.
Class description:
Implement the Citation_Index class.
Method signatures and docstrings:
- def es_stream_docs(cls): Stream Elasticsearch docs. Yields: dict: The next document.
- def compute_ranking(cls, filters={}, depth=100000.0): Given a set of query filt... | 078cfd4c5a257fbfb0901d43bfbc6350824eed4e | <|skeleton|>
class Citation_Index:
def es_stream_docs(cls):
"""Stream Elasticsearch docs. Yields: dict: The next document."""
<|body_0|>
def compute_ranking(cls, filters={}, depth=100000.0):
"""Given a set of query filters, count the number of times each text is cited on documents that... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Citation_Index:
def es_stream_docs(cls):
"""Stream Elasticsearch docs. Yields: dict: The next document."""
query = Citation.select().join(Text).where(Text.display == True).where(Text.valid == True)
for row in query_bar(query):
doc = {}
doc['_id'] = row.id
... | the_stack_v2_python_sparse | osp/citations/models/citation_index.py | davidmcclure/open-syllabus-project | train | 220 | |
74516029ec1c00c14d4399a6f6de56f91eab217e | [
"if not type(ff) is FFCavPhSocket:\n raise TypeError('The type ' + type(ff).__name__ + ' is not a valid socket forcefield')\nsuper(InputFFCavPhSocket, self).store(ff)\nself.charge_array.store(ff.charge_array)\nself.apply_photon.store(ff.apply_photon)\nself.E0.store(ff.E0)\nself.omega_c.store(ff.omega_c)\nself.ph... | <|body_start_0|>
if not type(ff) is FFCavPhSocket:
raise TypeError('The type ' + type(ff).__name__ + ' is not a valid socket forcefield')
super(InputFFCavPhSocket, self).store(ff)
self.charge_array.store(ff.charge_array)
self.apply_photon.store(ff.apply_photon)
self.E... | InputFFCavPhSocket | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InputFFCavPhSocket:
def store(self, ff):
"""Takes a ForceField instance and stores a minimal representation of it. Args: ff: A ForceField object with a FFCavPhSocket forcemodel object."""
<|body_0|>
def fetch(self):
"""Creates a ForceSocket object. Returns: A ForceSo... | stack_v2_sparse_classes_36k_train_020164 | 33,115 | no_license | [
{
"docstring": "Takes a ForceField instance and stores a minimal representation of it. Args: ff: A ForceField object with a FFCavPhSocket forcemodel object.",
"name": "store",
"signature": "def store(self, ff)"
},
{
"docstring": "Creates a ForceSocket object. Returns: A ForceSocket object with t... | 2 | null | Implement the Python class `InputFFCavPhSocket` described below.
Class description:
Implement the InputFFCavPhSocket class.
Method signatures and docstrings:
- def store(self, ff): Takes a ForceField instance and stores a minimal representation of it. Args: ff: A ForceField object with a FFCavPhSocket forcemodel obje... | Implement the Python class `InputFFCavPhSocket` described below.
Class description:
Implement the InputFFCavPhSocket class.
Method signatures and docstrings:
- def store(self, ff): Takes a ForceField instance and stores a minimal representation of it. Args: ff: A ForceField object with a FFCavPhSocket forcemodel obje... | 57f255266d4668bafef0881d1e7cbf8a27270ddd | <|skeleton|>
class InputFFCavPhSocket:
def store(self, ff):
"""Takes a ForceField instance and stores a minimal representation of it. Args: ff: A ForceField object with a FFCavPhSocket forcemodel object."""
<|body_0|>
def fetch(self):
"""Creates a ForceSocket object. Returns: A ForceSo... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class InputFFCavPhSocket:
def store(self, ff):
"""Takes a ForceField instance and stores a minimal representation of it. Args: ff: A ForceField object with a FFCavPhSocket forcemodel object."""
if not type(ff) is FFCavPhSocket:
raise TypeError('The type ' + type(ff).__name__ + ' is not a... | the_stack_v2_python_sparse | ipi/inputs/forcefields.py | i-pi/i-pi | train | 170 | |
75d9e1068d435c020ad51e2e56fb7200ffeffaa0 | [
"serializer = UsersRetrievalSerializer(data=request.query_params)\nserializer.is_valid(raise_exception=True)\nunauthorized = serializer.validated_data['unauthorized']\nusers_per_page = serializer.validated_data['users_per_page']\npage_number = serializer.validated_data['page_number']\nusers = User.nodes.order_by('f... | <|body_start_0|>
serializer = UsersRetrievalSerializer(data=request.query_params)
serializer.is_valid(raise_exception=True)
unauthorized = serializer.validated_data['unauthorized']
users_per_page = serializer.validated_data['users_per_page']
page_number = serializer.validated_dat... | UserView | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserView:
def get(self, request):
"""Retrieve a list of users and the number of all users with the given authorization criterion"""
<|body_0|>
def delete(self, request):
"""Delete an existing user"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
seri... | stack_v2_sparse_classes_36k_train_020165 | 14,872 | permissive | [
{
"docstring": "Retrieve a list of users and the number of all users with the given authorization criterion",
"name": "get",
"signature": "def get(self, request)"
},
{
"docstring": "Delete an existing user",
"name": "delete",
"signature": "def delete(self, request)"
}
] | 2 | stack_v2_sparse_classes_30k_train_006329 | Implement the Python class `UserView` described below.
Class description:
Implement the UserView class.
Method signatures and docstrings:
- def get(self, request): Retrieve a list of users and the number of all users with the given authorization criterion
- def delete(self, request): Delete an existing user | Implement the Python class `UserView` described below.
Class description:
Implement the UserView class.
Method signatures and docstrings:
- def get(self, request): Retrieve a list of users and the number of all users with the given authorization criterion
- def delete(self, request): Delete an existing user
<|skelet... | a5c8afba1c4f118d56742c147d8f79be5241f66a | <|skeleton|>
class UserView:
def get(self, request):
"""Retrieve a list of users and the number of all users with the given authorization criterion"""
<|body_0|>
def delete(self, request):
"""Delete an existing user"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UserView:
def get(self, request):
"""Retrieve a list of users and the number of all users with the given authorization criterion"""
serializer = UsersRetrievalSerializer(data=request.query_params)
serializer.is_valid(raise_exception=True)
unauthorized = serializer.validated_dat... | the_stack_v2_python_sparse | e7gzly/views.py | naderabdalghani/e7gzly-api | train | 0 | |
377810d07b9d61c9129779459ac6f0ecbb23a903 | [
"logger = logging.getLogger(__name__)\nif diseases == None or len(diseases) == 0:\n return []\nfile = open(postgap.Globals.DATABASES_DIR + '/Neale_UKB.txt')\nres = [self.get_association(line, diseases, iris) for line in file]\nres = filter(lambda X: X is not None, res)\nlogger.info('\\tFound %i GWAS SNPs associa... | <|body_start_0|>
logger = logging.getLogger(__name__)
if diseases == None or len(diseases) == 0:
return []
file = open(postgap.Globals.DATABASES_DIR + '/Neale_UKB.txt')
res = [self.get_association(line, diseases, iris) for line in file]
res = filter(lambda X: X is not... | Neale_UKB | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Neale_UKB:
def run(self, diseases, iris):
"""Returns all GWAS SNPs associated to a disease in Neale_UKB Args: * [ string ] (trait descriptions) * [ string ] (trait Ontology IRIs) Returntype: [ GWAS_Association ]"""
<|body_0|>
def get_association(self, line, diseases, iris):
... | stack_v2_sparse_classes_36k_train_020166 | 27,853 | permissive | [
{
"docstring": "Returns all GWAS SNPs associated to a disease in Neale_UKB Args: * [ string ] (trait descriptions) * [ string ] (trait Ontology IRIs) Returntype: [ GWAS_Association ]",
"name": "run",
"signature": "def run(self, diseases, iris)"
},
{
"docstring": "Neale_UKB file format:",
"na... | 2 | stack_v2_sparse_classes_30k_train_016307 | Implement the Python class `Neale_UKB` described below.
Class description:
Implement the Neale_UKB class.
Method signatures and docstrings:
- def run(self, diseases, iris): Returns all GWAS SNPs associated to a disease in Neale_UKB Args: * [ string ] (trait descriptions) * [ string ] (trait Ontology IRIs) Returntype:... | Implement the Python class `Neale_UKB` described below.
Class description:
Implement the Neale_UKB class.
Method signatures and docstrings:
- def run(self, diseases, iris): Returns all GWAS SNPs associated to a disease in Neale_UKB Args: * [ string ] (trait descriptions) * [ string ] (trait Ontology IRIs) Returntype:... | d5a2d7b9238347c9a598fa8ac0da8cb737c6b6a6 | <|skeleton|>
class Neale_UKB:
def run(self, diseases, iris):
"""Returns all GWAS SNPs associated to a disease in Neale_UKB Args: * [ string ] (trait descriptions) * [ string ] (trait Ontology IRIs) Returntype: [ GWAS_Association ]"""
<|body_0|>
def get_association(self, line, diseases, iris):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Neale_UKB:
def run(self, diseases, iris):
"""Returns all GWAS SNPs associated to a disease in Neale_UKB Args: * [ string ] (trait descriptions) * [ string ] (trait Ontology IRIs) Returntype: [ GWAS_Association ]"""
logger = logging.getLogger(__name__)
if diseases == None or len(disease... | the_stack_v2_python_sparse | lib/postgap/GWAS.py | Ensembl/postgap | train | 41 | |
5cc0af136995007d3feb3ab48281ec7e918c3ea1 | [
"response = self._get(endpoint=f'/lis/getbyminutes/0?api_key={self.token}&headers=false')\nif response.status_code == 200:\n demisto.info('Get healthchecks on LIS API: [OK]')\n return True\nelse:\n demisto.error('Get healthchecks on LIS API: [FAILED]', response.text, response.status_code, response.reason)\... | <|body_start_0|>
response = self._get(endpoint=f'/lis/getbyminutes/0?api_key={self.token}&headers=false')
if response.status_code == 200:
demisto.info('Get healthchecks on LIS API: [OK]')
return True
else:
demisto.error('Get healthchecks on LIS API: [FAILED]',... | Client class to interact with the service API. | GwClient | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GwClient:
"""Client class to interact with the service API."""
def test_module(self):
"""Return True if status_code == 200 and False instead. Raises: GwAPIException: If status_code != 200."""
<|body_0|>
def get_by_minute(self, minute) -> list:
"""Retrieve the dat... | stack_v2_sparse_classes_36k_train_020167 | 11,780 | permissive | [
{
"docstring": "Return True if status_code == 200 and False instead. Raises: GwAPIException: If status_code != 200.",
"name": "test_module",
"signature": "def test_module(self)"
},
{
"docstring": "Retrieve the data from Gatewatcher CTI feed by minute. Max 1440 minutes. Args: minute: Number of mi... | 3 | null | Implement the Python class `GwClient` described below.
Class description:
Client class to interact with the service API.
Method signatures and docstrings:
- def test_module(self): Return True if status_code == 200 and False instead. Raises: GwAPIException: If status_code != 200.
- def get_by_minute(self, minute) -> l... | Implement the Python class `GwClient` described below.
Class description:
Client class to interact with the service API.
Method signatures and docstrings:
- def test_module(self): Return True if status_code == 200 and False instead. Raises: GwAPIException: If status_code != 200.
- def get_by_minute(self, minute) -> l... | 890def5a0e0ae8d6eaa538148249ddbc851dbb6b | <|skeleton|>
class GwClient:
"""Client class to interact with the service API."""
def test_module(self):
"""Return True if status_code == 200 and False instead. Raises: GwAPIException: If status_code != 200."""
<|body_0|>
def get_by_minute(self, minute) -> list:
"""Retrieve the dat... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GwClient:
"""Client class to interact with the service API."""
def test_module(self):
"""Return True if status_code == 200 and False instead. Raises: GwAPIException: If status_code != 200."""
response = self._get(endpoint=f'/lis/getbyminutes/0?api_key={self.token}&headers=false')
... | the_stack_v2_python_sparse | Packs/Gatewatcher-LIS/Integrations/LastInfoSec/LastInfoSec.py | demisto/content | train | 1,023 |
1cca1d82afb73004e48db66d49b47c1f279e93f4 | [
"super().__init__(transforms)\nself.root = root\nself.label_name = label_name\ni = 0\npathname = os.path.join(root, '**', self.filename_glob)\nfor filepath in glob.iglob(pathname, recursive=True):\n try:\n with fiona.open(filepath) as src:\n if crs is None:\n crs = CRS.from_dict(... | <|body_start_0|>
super().__init__(transforms)
self.root = root
self.label_name = label_name
i = 0
pathname = os.path.join(root, '**', self.filename_glob)
for filepath in glob.iglob(pathname, recursive=True):
try:
with fiona.open(filepath) as sr... | Abstract base class for :class:`GeoDataset` stored as vector files. | VectorDataset | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VectorDataset:
"""Abstract base class for :class:`GeoDataset` stored as vector files."""
def __init__(self, root: str='data', crs: Optional[CRS]=None, res: float=0.0001, transforms: Optional[Callable[[dict[str, Any]], dict[str, Any]]]=None, label_name: Optional[str]=None) -> None:
""... | stack_v2_sparse_classes_36k_train_020168 | 35,954 | permissive | [
{
"docstring": "Initialize a new Dataset instance. Args: root: root directory where dataset can be found crs: :term:`coordinate reference system (CRS)` to warp to (defaults to the CRS of the first file found) res: resolution of the dataset in units of CRS transforms: a function/transform that takes input sample... | 2 | null | Implement the Python class `VectorDataset` described below.
Class description:
Abstract base class for :class:`GeoDataset` stored as vector files.
Method signatures and docstrings:
- def __init__(self, root: str='data', crs: Optional[CRS]=None, res: float=0.0001, transforms: Optional[Callable[[dict[str, Any]], dict[s... | Implement the Python class `VectorDataset` described below.
Class description:
Abstract base class for :class:`GeoDataset` stored as vector files.
Method signatures and docstrings:
- def __init__(self, root: str='data', crs: Optional[CRS]=None, res: float=0.0001, transforms: Optional[Callable[[dict[str, Any]], dict[s... | 29985861614b3b93f9ef5389469ebb98570de7dd | <|skeleton|>
class VectorDataset:
"""Abstract base class for :class:`GeoDataset` stored as vector files."""
def __init__(self, root: str='data', crs: Optional[CRS]=None, res: float=0.0001, transforms: Optional[Callable[[dict[str, Any]], dict[str, Any]]]=None, label_name: Optional[str]=None) -> None:
""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class VectorDataset:
"""Abstract base class for :class:`GeoDataset` stored as vector files."""
def __init__(self, root: str='data', crs: Optional[CRS]=None, res: float=0.0001, transforms: Optional[Callable[[dict[str, Any]], dict[str, Any]]]=None, label_name: Optional[str]=None) -> None:
"""Initialize a... | the_stack_v2_python_sparse | torchgeo/datasets/geo.py | microsoft/torchgeo | train | 1,724 |
0733917ce563f07838de2714fcc883b1e51a6821 | [
"if not os.path.exists(conf_file):\n raise ValueError('%s do not exist' % conf_file)\nself.model_info = dict()\nwith open(conf_file) as f:\n for line in f:\n info = ModelInfo()\n json_format.Parse(line, info)\n if info.model_type not in self.model_info:\n self.model_info[info.m... | <|body_start_0|>
if not os.path.exists(conf_file):
raise ValueError('%s do not exist' % conf_file)
self.model_info = dict()
with open(conf_file) as f:
for line in f:
info = ModelInfo()
json_format.Parse(line, info)
if info.m... | Setting from file | Setting | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Setting:
"""Setting from file"""
def __init__(self, conf_file):
""":param conf_file:"""
<|body_0|>
def get_model_info(self, model_type):
""":param model_type: :return:list"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not os.path.exists(con... | stack_v2_sparse_classes_36k_train_020169 | 1,237 | no_license | [
{
"docstring": ":param conf_file:",
"name": "__init__",
"signature": "def __init__(self, conf_file)"
},
{
"docstring": ":param model_type: :return:list",
"name": "get_model_info",
"signature": "def get_model_info(self, model_type)"
}
] | 2 | stack_v2_sparse_classes_30k_train_016989 | Implement the Python class `Setting` described below.
Class description:
Setting from file
Method signatures and docstrings:
- def __init__(self, conf_file): :param conf_file:
- def get_model_info(self, model_type): :param model_type: :return:list | Implement the Python class `Setting` described below.
Class description:
Setting from file
Method signatures and docstrings:
- def __init__(self, conf_file): :param conf_file:
- def get_model_info(self, model_type): :param model_type: :return:list
<|skeleton|>
class Setting:
"""Setting from file"""
def __in... | c3c453f402bedc7a22dc0f873a602180f94678ef | <|skeleton|>
class Setting:
"""Setting from file"""
def __init__(self, conf_file):
""":param conf_file:"""
<|body_0|>
def get_model_info(self, model_type):
""":param model_type: :return:list"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Setting:
"""Setting from file"""
def __init__(self, conf_file):
""":param conf_file:"""
if not os.path.exists(conf_file):
raise ValueError('%s do not exist' % conf_file)
self.model_info = dict()
with open(conf_file) as f:
for line in f:
... | the_stack_v2_python_sparse | model-serving/model_serving/setting.py | StevenYang88/tuanxian_price | train | 0 |
d5f3f5672bbc26e921e40e75080ad7584c1d2bba | [
"super(GlobalLocalDiscriminator, self).__init__()\ncond_nc = cfg.cond_nc\nbg_cond_nc = cfg.bg_cond_nc\nndf = cfg.ndf\nn_layers = cfg.n_layers\nmax_nf_mult = cfg.max_nf_mult\nnorm_type = cfg.norm_type\nuse_sigmoid = cfg.use_sigmoid\nself.global_model = PatchDiscriminator(cond_nc, ndf=ndf, n_layers=n_layers, max_nf_m... | <|body_start_0|>
super(GlobalLocalDiscriminator, self).__init__()
cond_nc = cfg.cond_nc
bg_cond_nc = cfg.bg_cond_nc
ndf = cfg.ndf
n_layers = cfg.n_layers
max_nf_mult = cfg.max_nf_mult
norm_type = cfg.norm_type
use_sigmoid = cfg.use_sigmoid
self.glo... | GlobalLocalDiscriminator | [
"MIT",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-proprietary-license",
"Apache-2.0",
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GlobalLocalDiscriminator:
def __init__(self, cfg, use_aug_bg=False):
"""Args: cfg (dict or EasyDict): the configurations, and it contains the followings, --cond_nc (int): the input dimension; --ndf (int): the number of filters at the first layer, default is 64; --n_layers (int): the numb... | stack_v2_sparse_classes_36k_train_020170 | 11,501 | permissive | [
{
"docstring": "Args: cfg (dict or EasyDict): the configurations, and it contains the followings, --cond_nc (int): the input dimension; --ndf (int): the number of filters at the first layer, default is 64; --n_layers (int): the number of downsampling operations, such as the convolution with stride 2, default is... | 2 | stack_v2_sparse_classes_30k_train_019336 | Implement the Python class `GlobalLocalDiscriminator` described below.
Class description:
Implement the GlobalLocalDiscriminator class.
Method signatures and docstrings:
- def __init__(self, cfg, use_aug_bg=False): Args: cfg (dict or EasyDict): the configurations, and it contains the followings, --cond_nc (int): the ... | Implement the Python class `GlobalLocalDiscriminator` described below.
Class description:
Implement the GlobalLocalDiscriminator class.
Method signatures and docstrings:
- def __init__(self, cfg, use_aug_bg=False): Args: cfg (dict or EasyDict): the configurations, and it contains the followings, --cond_nc (int): the ... | fcf9a18ffd66bf3fdd3eea4153a3bc4785131848 | <|skeleton|>
class GlobalLocalDiscriminator:
def __init__(self, cfg, use_aug_bg=False):
"""Args: cfg (dict or EasyDict): the configurations, and it contains the followings, --cond_nc (int): the input dimension; --ndf (int): the number of filters at the first layer, default is 64; --n_layers (int): the numb... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GlobalLocalDiscriminator:
def __init__(self, cfg, use_aug_bg=False):
"""Args: cfg (dict or EasyDict): the configurations, and it contains the followings, --cond_nc (int): the input dimension; --ndf (int): the number of filters at the first layer, default is 64; --n_layers (int): the number of downsamp... | the_stack_v2_python_sparse | iPERCore/models/networks/discriminators/multi_scale_dis.py | iPERDance/iPERCore | train | 2,520 | |
48201e7863e826b5560b4ea2884a0f08900f6291 | [
"comp = ''\nif not root:\n return ''\nq = [root]\ncomp += str(root.val) + '|'\nwhile q:\n if q[0].left:\n q.append(q[0].left)\n comp += str(q[0].left.val) + '|'\n else:\n comp += 'n|'\n if q[0].right:\n q.append(q[0].right)\n comp += str(q[0].right.val) + '|'\n else... | <|body_start_0|>
comp = ''
if not root:
return ''
q = [root]
comp += str(root.val) + '|'
while q:
if q[0].left:
q.append(q[0].left)
comp += str(q[0].left.val) + '|'
else:
comp += 'n|'
... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|>
<|body_... | stack_v2_sparse_classes_36k_train_020171 | 2,172 | no_license | [
{
"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 | null | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: 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:... | 2d87d22bd2072d92ce9976ce19be79d6c57398cd | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
comp = ''
if not root:
return ''
q = [root]
comp += str(root.val) + '|'
while q:
if q[0].left:
q.append(q[0].left)... | the_stack_v2_python_sparse | DSA/leetcode/297.serialize-and-deserialize-binary-tree.py | kaydee0502/Data-Structure-and-Algorithms-using-Python | train | 1 | |
d2112df21b53cccd5c44a7e4e3bf4fd61f17b0b9 | [
"if list_of_dists is None:\n list_of_dists = [uniform]\nself.dists = list_of_dists\nself.k = len(list_of_dists)",
"if dist_args is None:\n dist_args = [()]\nif dist_kwargs is None:\n dist_kwargs = [{}]\nweights = np.atleast_1d(weights)\ndist_args = np.atleast_1d(dist_args)\ndist_kwargs = np.atleast_1d(di... | <|body_start_0|>
if list_of_dists is None:
list_of_dists = [uniform]
self.dists = list_of_dists
self.k = len(list_of_dists)
<|end_body_0|>
<|body_start_1|>
if dist_args is None:
dist_args = [()]
if dist_kwargs is None:
dist_kwargs = [{}]
... | A base class representing a "mixture" distribution: a weighted linear combination of underlying statistical distributions, with positive semi-definite weights adding to 1. | mixture | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class mixture:
"""A base class representing a "mixture" distribution: a weighted linear combination of underlying statistical distributions, with positive semi-definite weights adding to 1."""
def __init__(self, list_of_dists=None):
"""A mixture instance, with same pdf(), rvs() API as scip... | stack_v2_sparse_classes_36k_train_020172 | 14,912 | no_license | [
{
"docstring": "A mixture instance, with same pdf(), rvs() API as scipy.stats.rv_continuous instances Parameters ---------- list_of_dists : list, optional The underlying stastical distributions of type rv_continuous, by default [uniform]",
"name": "__init__",
"signature": "def __init__(self, list_of_dis... | 3 | stack_v2_sparse_classes_30k_train_011437 | Implement the Python class `mixture` described below.
Class description:
A base class representing a "mixture" distribution: a weighted linear combination of underlying statistical distributions, with positive semi-definite weights adding to 1.
Method signatures and docstrings:
- def __init__(self, list_of_dists=None... | Implement the Python class `mixture` described below.
Class description:
A base class representing a "mixture" distribution: a weighted linear combination of underlying statistical distributions, with positive semi-definite weights adding to 1.
Method signatures and docstrings:
- def __init__(self, list_of_dists=None... | 0b002f1477efb6b5fcaddc4a282c35883165a42a | <|skeleton|>
class mixture:
"""A base class representing a "mixture" distribution: a weighted linear combination of underlying statistical distributions, with positive semi-definite weights adding to 1."""
def __init__(self, list_of_dists=None):
"""A mixture instance, with same pdf(), rvs() API as scip... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class mixture:
"""A base class representing a "mixture" distribution: a weighted linear combination of underlying statistical distributions, with positive semi-definite weights adding to 1."""
def __init__(self, list_of_dists=None):
"""A mixture instance, with same pdf(), rvs() API as scipy.stats.rv_co... | the_stack_v2_python_sparse | zatkins/deteff/modules/monte_carlo.py | simonsobs/readout-script-dev | train | 1 |
0b93c42909fc34633c47f2947358e58ac8ec92d2 | [
"super().__init__(recursive_serialize=True)\nself.noserialize += ['taskunits', 'compute_id']\nself.id = id\nself.__class__.processor = processor\nself.input_data = input_data\nself.splitter = splitter if splitter else Splitter()\nself.combiner = combiner if combiner else Combiner()\nself.taskunits = {}",
"m = has... | <|body_start_0|>
super().__init__(recursive_serialize=True)
self.noserialize += ['taskunits', 'compute_id']
self.id = id
self.__class__.processor = processor
self.input_data = input_data
self.splitter = splitter if splitter else Splitter()
self.combiner = combiner... | Represents a job to be handled by a master node. An instance of this class represents a job to be run on a distributed system cluster. The job defines a splitter, a combiner, the input to the job, the processor for the taskunits. | Job | [
"WTFPL"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Job:
"""Represents a job to be handled by a master node. An instance of this class represents a job to be run on a distributed system cluster. The job defines a splitter, a combiner, the input to the job, the processor for the taskunits."""
def __init__(self, id=None, input_data=None, proces... | stack_v2_sparse_classes_36k_train_020173 | 5,447 | permissive | [
{
"docstring": ":param input_data: An elementary type. :param splitter: An instance of Splitter. Default used if None. :param combiner: An instance of Combiner. Default used if None. :param processor: A function which processes input to a TaskUnit.",
"name": "__init__",
"signature": "def __init__(self, ... | 2 | stack_v2_sparse_classes_30k_val_001001 | Implement the Python class `Job` described below.
Class description:
Represents a job to be handled by a master node. An instance of this class represents a job to be run on a distributed system cluster. The job defines a splitter, a combiner, the input to the job, the processor for the taskunits.
Method signatures a... | Implement the Python class `Job` described below.
Class description:
Represents a job to be handled by a master node. An instance of this class represents a job to be run on a distributed system cluster. The job defines a splitter, a combiner, the input to the job, the processor for the taskunits.
Method signatures a... | 97a46f165475f71b1cd0b10626232cd586e102b3 | <|skeleton|>
class Job:
"""Represents a job to be handled by a master node. An instance of this class represents a job to be run on a distributed system cluster. The job defines a splitter, a combiner, the input to the job, the processor for the taskunits."""
def __init__(self, id=None, input_data=None, proces... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Job:
"""Represents a job to be handled by a master node. An instance of this class represents a job to be run on a distributed system cluster. The job defines a splitter, a combiner, the input to the job, the processor for the taskunits."""
def __init__(self, id=None, input_data=None, processor=None, spl... | the_stack_v2_python_sparse | job.py | mtahmed/antnest | train | 1 |
f794eaf6b2d62937ef1857823bf97b3b89513482 | [
"self.namespace = Failure.namespace\nif StanzaBase.setup(self, xml):\n self['condition'] = 'not-authorized'\nself.xml.tag = self.tag_name()",
"for child in self.xml:\n if '{%s}' % self.namespace in child.tag:\n cond = child.tag.split('}', 1)[-1]\n if cond in self.conditions:\n retur... | <|body_start_0|>
self.namespace = Failure.namespace
if StanzaBase.setup(self, xml):
self['condition'] = 'not-authorized'
self.xml.tag = self.tag_name()
<|end_body_0|>
<|body_start_1|>
for child in self.xml:
if '{%s}' % self.namespace in child.tag:
... | Failure | [
"MIT",
"BSD-3-Clause",
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Failure:
def setup(self, xml=None):
"""Populate the stanza object using an optional XML object. Overrides ElementBase.setup. Sets a default error type and condition, and changes the parent stanza's type to 'error'. Arguments: xml -- Use an existing XML object for the stanza's values."""
... | stack_v2_sparse_classes_36k_train_020174 | 2,360 | permissive | [
{
"docstring": "Populate the stanza object using an optional XML object. Overrides ElementBase.setup. Sets a default error type and condition, and changes the parent stanza's type to 'error'. Arguments: xml -- Use an existing XML object for the stanza's values.",
"name": "setup",
"signature": "def setup... | 4 | null | Implement the Python class `Failure` described below.
Class description:
Implement the Failure class.
Method signatures and docstrings:
- def setup(self, xml=None): Populate the stanza object using an optional XML object. Overrides ElementBase.setup. Sets a default error type and condition, and changes the parent sta... | Implement the Python class `Failure` described below.
Class description:
Implement the Failure class.
Method signatures and docstrings:
- def setup(self, xml=None): Populate the stanza object using an optional XML object. Overrides ElementBase.setup. Sets a default error type and condition, and changes the parent sta... | cc1d470397de768ffcc41d2ed5ac3118d19f09f5 | <|skeleton|>
class Failure:
def setup(self, xml=None):
"""Populate the stanza object using an optional XML object. Overrides ElementBase.setup. Sets a default error type and condition, and changes the parent stanza's type to 'error'. Arguments: xml -- Use an existing XML object for the stanza's values."""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Failure:
def setup(self, xml=None):
"""Populate the stanza object using an optional XML object. Overrides ElementBase.setup. Sets a default error type and condition, and changes the parent stanza's type to 'error'. Arguments: xml -- Use an existing XML object for the stanza's values."""
self.n... | the_stack_v2_python_sparse | sleekxmpp/features/feature_mechanisms/stanza/failure.py | fritzy/SleekXMPP | train | 658 | |
1e354c99cfaae71fe77fed7d25d407945e3d5a19 | [
"request_dict = rest_utils.get_json_and_verify_params({'tenant_name': {'type': str}, 'group_name': {'type': str}, 'role': {'type': str}})\nrest_utils.validate_inputs(request_dict)\nrole_name = request_dict.get('role')\nif role_name:\n rest_utils.verify_role(role_name)\nelse:\n role_name = constants.DEFAULT_TE... | <|body_start_0|>
request_dict = rest_utils.get_json_and_verify_params({'tenant_name': {'type': str}, 'group_name': {'type': str}, 'role': {'type': str}})
rest_utils.validate_inputs(request_dict)
role_name = request_dict.get('role')
if role_name:
rest_utils.verify_role(role_na... | TenantGroups | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TenantGroups:
def put(self, multi_tenancy):
"""Add a group to a tenant"""
<|body_0|>
def patch(self, multi_tenancy):
"""Update role in group tenant association."""
<|body_1|>
def delete(self, multi_tenancy):
"""Remove a group from a tenant"""
... | stack_v2_sparse_classes_36k_train_020175 | 10,735 | permissive | [
{
"docstring": "Add a group to a tenant",
"name": "put",
"signature": "def put(self, multi_tenancy)"
},
{
"docstring": "Update role in group tenant association.",
"name": "patch",
"signature": "def patch(self, multi_tenancy)"
},
{
"docstring": "Remove a group from a tenant",
... | 3 | null | Implement the Python class `TenantGroups` described below.
Class description:
Implement the TenantGroups class.
Method signatures and docstrings:
- def put(self, multi_tenancy): Add a group to a tenant
- def patch(self, multi_tenancy): Update role in group tenant association.
- def delete(self, multi_tenancy): Remove... | Implement the Python class `TenantGroups` described below.
Class description:
Implement the TenantGroups class.
Method signatures and docstrings:
- def put(self, multi_tenancy): Add a group to a tenant
- def patch(self, multi_tenancy): Update role in group tenant association.
- def delete(self, multi_tenancy): Remove... | c0de6442e1d7653fad824d75e571802a74eee605 | <|skeleton|>
class TenantGroups:
def put(self, multi_tenancy):
"""Add a group to a tenant"""
<|body_0|>
def patch(self, multi_tenancy):
"""Update role in group tenant association."""
<|body_1|>
def delete(self, multi_tenancy):
"""Remove a group from a tenant"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TenantGroups:
def put(self, multi_tenancy):
"""Add a group to a tenant"""
request_dict = rest_utils.get_json_and_verify_params({'tenant_name': {'type': str}, 'group_name': {'type': str}, 'role': {'type': str}})
rest_utils.validate_inputs(request_dict)
role_name = request_dict.g... | the_stack_v2_python_sparse | rest-service/manager_rest/rest/resources_v3/tenants.py | cloudify-cosmo/cloudify-manager | train | 146 | |
6744895894e45ee7455520b2fbc0baa617c56ff9 | [
"if root is None:\n return ''\nreturn f'{root.val},{self.serialize(root.left)}{self.serialize(root.right)}'",
"def insert(node, val):\n if node is None:\n return TreeNode(val)\n if val < node.val:\n node.left = insert(node.left, val)\n else:\n node.right = insert(node.right, val)\... | <|body_start_0|>
if root is None:
return ''
return f'{root.val},{self.serialize(root.left)}{self.serialize(root.right)}'
<|end_body_0|>
<|body_start_1|>
def insert(node, val):
if node is None:
return TreeNode(val)
if val < node.val:
... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root: Optional[TreeNode]) -> str:
"""Encodes a tree to a single string."""
<|body_0|>
def deserialize(self, data: str) -> Optional[TreeNode]:
"""Decodes your encoded data to tree."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_36k_train_020176 | 2,004 | no_license | [
{
"docstring": "Encodes a tree to a single string.",
"name": "serialize",
"signature": "def serialize(self, root: Optional[TreeNode]) -> str"
},
{
"docstring": "Decodes your encoded data to tree.",
"name": "deserialize",
"signature": "def deserialize(self, data: str) -> Optional[TreeNode... | 2 | stack_v2_sparse_classes_30k_val_001103 | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root: Optional[TreeNode]) -> str: Encodes a tree to a single string.
- def deserialize(self, data: str) -> Optional[TreeNode]: Decodes your encoded data to tree. | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root: Optional[TreeNode]) -> str: Encodes a tree to a single string.
- def deserialize(self, data: str) -> Optional[TreeNode]: Decodes your encoded data to tree.
<... | 157cbaeeff74130e5105e58a6b4cdf66403a8a6f | <|skeleton|>
class Codec:
def serialize(self, root: Optional[TreeNode]) -> str:
"""Encodes a tree to a single string."""
<|body_0|>
def deserialize(self, data: str) -> Optional[TreeNode]:
"""Decodes your encoded data to tree."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Codec:
def serialize(self, root: Optional[TreeNode]) -> str:
"""Encodes a tree to a single string."""
if root is None:
return ''
return f'{root.val},{self.serialize(root.left)}{self.serialize(root.right)}'
def deserialize(self, data: str) -> Optional[TreeNode]:
... | the_stack_v2_python_sparse | Leetcode/449. Serialize and Deserialize BST.py | xiaohuanlin/Algorithms | train | 1 | |
bea5dda528c53b852fd3982c2664849662e0b203 | [
"assert 'nvars' in cparams\nassert 'c_s' in cparams\nassert 'u_adv' in cparams\nassert 'x_bounds' in cparams\nassert 'z_bounds' in cparams\nfor k, v in cparams.items():\n setattr(self, k, v)\nsuper(acoustic_2d_imex, self).__init__(self.nvars, dtype_u, dtype_f)\nself.N = [self.nvars[1], self.nvars[2]]\nself.bc_ho... | <|body_start_0|>
assert 'nvars' in cparams
assert 'c_s' in cparams
assert 'u_adv' in cparams
assert 'x_bounds' in cparams
assert 'z_bounds' in cparams
for k, v in cparams.items():
setattr(self, k, v)
super(acoustic_2d_imex, self).__init__(self.nvars, d... | Example implementing the forced 1D heat equation with Dirichlet-0 BC in [0,1] Attributes: solver: Sharpclaw solver state: Sharclaw state domain: Sharpclaw domain | acoustic_2d_imex | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class acoustic_2d_imex:
"""Example implementing the forced 1D heat equation with Dirichlet-0 BC in [0,1] Attributes: solver: Sharpclaw solver state: Sharclaw state domain: Sharpclaw domain"""
def __init__(self, cparams, dtype_u, dtype_f):
"""Initialization routine Args: cparams: custom par... | stack_v2_sparse_classes_36k_train_020177 | 4,902 | permissive | [
{
"docstring": "Initialization routine Args: cparams: custom parameters for the example dtype_u: particle data type (will be passed parent class) dtype_f: acceleration data type (will be passed parent class)",
"name": "__init__",
"signature": "def __init__(self, cparams, dtype_u, dtype_f)"
},
{
... | 6 | null | Implement the Python class `acoustic_2d_imex` described below.
Class description:
Example implementing the forced 1D heat equation with Dirichlet-0 BC in [0,1] Attributes: solver: Sharpclaw solver state: Sharclaw state domain: Sharpclaw domain
Method signatures and docstrings:
- def __init__(self, cparams, dtype_u, d... | Implement the Python class `acoustic_2d_imex` described below.
Class description:
Example implementing the forced 1D heat equation with Dirichlet-0 BC in [0,1] Attributes: solver: Sharpclaw solver state: Sharclaw state domain: Sharpclaw domain
Method signatures and docstrings:
- def __init__(self, cparams, dtype_u, d... | 1a51834bedffd4472e344bed28f4d766614b1537 | <|skeleton|>
class acoustic_2d_imex:
"""Example implementing the forced 1D heat equation with Dirichlet-0 BC in [0,1] Attributes: solver: Sharpclaw solver state: Sharclaw state domain: Sharpclaw domain"""
def __init__(self, cparams, dtype_u, dtype_f):
"""Initialization routine Args: cparams: custom par... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class acoustic_2d_imex:
"""Example implementing the forced 1D heat equation with Dirichlet-0 BC in [0,1] Attributes: solver: Sharpclaw solver state: Sharclaw state domain: Sharpclaw domain"""
def __init__(self, cparams, dtype_u, dtype_f):
"""Initialization routine Args: cparams: custom parameters for t... | the_stack_v2_python_sparse | pySDC/playgrounds/deprecated/acoustic_2d_imex/ProblemClass.py | Parallel-in-Time/pySDC | train | 30 |
9260ad2fd3713862ad3bc1f99a7a0fd0db740e7e | [
"rem = 0\nfor i, x in enumerate(nums):\n if rem < i:\n return False\n if rem >= len(nums) - 1:\n return True\n rem = max(rem, i + x)",
"last = len(nums) - 1\nfor i in range(len(nums) - 1):\n ind = len(nums) - i - 2\n if ind + nums[ind] >= last:\n last = ind\nreturn last == 0"
] | <|body_start_0|>
rem = 0
for i, x in enumerate(nums):
if rem < i:
return False
if rem >= len(nums) - 1:
return True
rem = max(rem, i + x)
<|end_body_0|>
<|body_start_1|>
last = len(nums) - 1
for i in range(len(nums) - 1... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def canJump(self, nums: List[int]) -> bool:
"""We traverse through the array from left to right and try to reach the furthest point at each iteration. If we can reach the last point, return true."""
<|body_0|>
def canJump2(self, nums: List[int]) -> bool:
""... | stack_v2_sparse_classes_36k_train_020178 | 1,409 | no_license | [
{
"docstring": "We traverse through the array from left to right and try to reach the furthest point at each iteration. If we can reach the last point, return true.",
"name": "canJump",
"signature": "def canJump(self, nums: List[int]) -> bool"
},
{
"docstring": "Now, traverse from right to left,... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def canJump(self, nums: List[int]) -> bool: We traverse through the array from left to right and try to reach the furthest point at each iteration. If we can reach the last point... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def canJump(self, nums: List[int]) -> bool: We traverse through the array from left to right and try to reach the furthest point at each iteration. If we can reach the last point... | 9a0e41d2d718803eb297430995e464fcab472a55 | <|skeleton|>
class Solution:
def canJump(self, nums: List[int]) -> bool:
"""We traverse through the array from left to right and try to reach the furthest point at each iteration. If we can reach the last point, return true."""
<|body_0|>
def canJump2(self, nums: List[int]) -> bool:
""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def canJump(self, nums: List[int]) -> bool:
"""We traverse through the array from left to right and try to reach the furthest point at each iteration. If we can reach the last point, return true."""
rem = 0
for i, x in enumerate(nums):
if rem < i:
... | the_stack_v2_python_sparse | leetcode/55.py | evinpinar/competitive_python | train | 0 | |
84d4433455d6c315aebcabd2b3b48ec2008642b3 | [
"if driver:\n self.driver = driver\nelse:\n self.driver = bu.get_driver()\nif log_in:\n bu.login(self.driver)\nself.verbose = verbose\nself.to_place = {0: ('Los Angeles Chargers', 0, 150), 1: ('Jacksonville Jaguars', 1, 250), 2: ('Tennessee Titans', 2, 350)}\nself.to_delete = [1, 2]\nself.bet_slip = []\nse... | <|body_start_0|>
if driver:
self.driver = driver
else:
self.driver = bu.get_driver()
if log_in:
bu.login(self.driver)
self.verbose = verbose
self.to_place = {0: ('Los Angeles Chargers', 0, 150), 1: ('Jacksonville Jaguars', 1, 250), 2: ('Tenness... | Better is a class for interacting with the utilities functions for interacting with bovada using python selenium. opt. args driver - selenium webdriver log_in - bool. determines whether the login() function is called on init verbose - bool. extra print statements | Better | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Better:
"""Better is a class for interacting with the utilities functions for interacting with bovada using python selenium. opt. args driver - selenium webdriver log_in - bool. determines whether the login() function is called on init verbose - bool. extra print statements"""
def __init__(s... | stack_v2_sparse_classes_36k_train_020179 | 2,251 | permissive | [
{
"docstring": "the log_in is sick but the captcha sucks, we are literally just fuelling waymo",
"name": "__init__",
"signature": "def __init__(self, driver=None, log_in=False, verbose=True)"
},
{
"docstring": "run() adds self.to_place into bovada betslip then the bets are deleted and removed fr... | 4 | stack_v2_sparse_classes_30k_train_000994 | Implement the Python class `Better` described below.
Class description:
Better is a class for interacting with the utilities functions for interacting with bovada using python selenium. opt. args driver - selenium webdriver log_in - bool. determines whether the login() function is called on init verbose - bool. extra ... | Implement the Python class `Better` described below.
Class description:
Better is a class for interacting with the utilities functions for interacting with bovada using python selenium. opt. args driver - selenium webdriver log_in - bool. determines whether the login() function is called on init verbose - bool. extra ... | 7eadee83a1bf5d447efd42ebab69197a4e73d52a | <|skeleton|>
class Better:
"""Better is a class for interacting with the utilities functions for interacting with bovada using python selenium. opt. args driver - selenium webdriver log_in - bool. determines whether the login() function is called on init verbose - bool. extra print statements"""
def __init__(s... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Better:
"""Better is a class for interacting with the utilities functions for interacting with bovada using python selenium. opt. args driver - selenium webdriver log_in - bool. determines whether the login() function is called on init verbose - bool. extra print statements"""
def __init__(self, driver=N... | the_stack_v2_python_sparse | sips/lines/bov/better/better.py | anandijain/sips | train | 5 |
45875aa1c617a37d699aaeca3a03eb159683be69 | [
"box = Box(name, width, height, depth, max_weight)\nself.append_bin(box)\nreturn box",
"item = Item(payload, width, height, depth, weight)\nself.append_item(item)\nreturn item"
] | <|body_start_0|>
box = Box(name, width, height, depth, max_weight)
self.append_bin(box)
return box
<|end_body_0|>
<|body_start_1|>
item = Item(payload, width, height, depth, weight)
self.append_item(item)
return item
<|end_body_1|>
| 3D Packer inherited from :class:`AbstractPacker`. | Packer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Packer:
"""3D Packer inherited from :class:`AbstractPacker`."""
def add_bin(self, name: str, width: float, height: float, depth: float, max_weight: float=UNLIMITED_WEIGHT) -> Box:
"""Add a 3D :class:`Box` container."""
<|body_0|>
def add_item(self, payload, width: float,... | stack_v2_sparse_classes_36k_train_020180 | 21,513 | permissive | [
{
"docstring": "Add a 3D :class:`Box` container.",
"name": "add_bin",
"signature": "def add_bin(self, name: str, width: float, height: float, depth: float, max_weight: float=UNLIMITED_WEIGHT) -> Box"
},
{
"docstring": "Add a 3D :class:`Item` to pack.",
"name": "add_item",
"signature": "d... | 2 | null | Implement the Python class `Packer` described below.
Class description:
3D Packer inherited from :class:`AbstractPacker`.
Method signatures and docstrings:
- def add_bin(self, name: str, width: float, height: float, depth: float, max_weight: float=UNLIMITED_WEIGHT) -> Box: Add a 3D :class:`Box` container.
- def add_i... | Implement the Python class `Packer` described below.
Class description:
3D Packer inherited from :class:`AbstractPacker`.
Method signatures and docstrings:
- def add_bin(self, name: str, width: float, height: float, depth: float, max_weight: float=UNLIMITED_WEIGHT) -> Box: Add a 3D :class:`Box` container.
- def add_i... | ba6ab0264dcb6833173042a37b1b5ae878d75113 | <|skeleton|>
class Packer:
"""3D Packer inherited from :class:`AbstractPacker`."""
def add_bin(self, name: str, width: float, height: float, depth: float, max_weight: float=UNLIMITED_WEIGHT) -> Box:
"""Add a 3D :class:`Box` container."""
<|body_0|>
def add_item(self, payload, width: float,... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Packer:
"""3D Packer inherited from :class:`AbstractPacker`."""
def add_bin(self, name: str, width: float, height: float, depth: float, max_weight: float=UNLIMITED_WEIGHT) -> Box:
"""Add a 3D :class:`Box` container."""
box = Box(name, width, height, depth, max_weight)
self.append_... | the_stack_v2_python_sparse | src/ezdxf/addons/binpacking.py | mozman/ezdxf | train | 750 |
a2eeabe5ed0de5baddcb4192c0823e2b3ada6dc8 | [
"words_len = {i: set() for i in range(1, 8)}\nfor word in words:\n words_len[len(word)].add(word)\nprint(words_len)\nstart = [word for word in words_len[7]]\nfor i in range(6, 0, -1):\n add_word = []\n for word in words_len[i]:\n flag = True\n for w in start:\n if w[-i:] == word:\n... | <|body_start_0|>
words_len = {i: set() for i in range(1, 8)}
for word in words:
words_len[len(word)].add(word)
print(words_len)
start = [word for word in words_len[7]]
for i in range(6, 0, -1):
add_word = []
for word in words_len[i]:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def minimumLengthEncoding(self, words):
""":type words: List[str] :rtype: int overtime"""
<|body_0|>
def minimumLengthEncoding_1(self, words):
""":type words: List[str] :rtype: int 243ms"""
<|body_1|>
def minimumLengthEncoding_2(self, words):
... | stack_v2_sparse_classes_36k_train_020181 | 21,107 | no_license | [
{
"docstring": ":type words: List[str] :rtype: int overtime",
"name": "minimumLengthEncoding",
"signature": "def minimumLengthEncoding(self, words)"
},
{
"docstring": ":type words: List[str] :rtype: int 243ms",
"name": "minimumLengthEncoding_1",
"signature": "def minimumLengthEncoding_1(... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minimumLengthEncoding(self, words): :type words: List[str] :rtype: int overtime
- def minimumLengthEncoding_1(self, words): :type words: List[str] :rtype: int 243ms
- def min... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minimumLengthEncoding(self, words): :type words: List[str] :rtype: int overtime
- def minimumLengthEncoding_1(self, words): :type words: List[str] :rtype: int 243ms
- def min... | 679a2b246b8b6bb7fc55ed1c8096d3047d6d4461 | <|skeleton|>
class Solution:
def minimumLengthEncoding(self, words):
""":type words: List[str] :rtype: int overtime"""
<|body_0|>
def minimumLengthEncoding_1(self, words):
""":type words: List[str] :rtype: int 243ms"""
<|body_1|>
def minimumLengthEncoding_2(self, words):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def minimumLengthEncoding(self, words):
""":type words: List[str] :rtype: int overtime"""
words_len = {i: set() for i in range(1, 8)}
for word in words:
words_len[len(word)].add(word)
print(words_len)
start = [word for word in words_len[7]]
... | the_stack_v2_python_sparse | ShortEncodingOfWords_MID_820.py | 953250587/leetcode-python | train | 2 | |
290e8cd268006000cee9af28736b19d9a4ad31e6 | [
"super(Obelisk, self).at_object_creation()\nself.db.tutorial_info = 'This object changes its desc randomly, and makes sure to remember which one you saw.'\nself.locks.add('get:false()')",
"clueindex = random.randint(0, len(OBELISK_DESCS) - 1)\nstring = 'The surface of the obelisk seem to waver, shift and writhe u... | <|body_start_0|>
super(Obelisk, self).at_object_creation()
self.db.tutorial_info = 'This object changes its desc randomly, and makes sure to remember which one you saw.'
self.locks.add('get:false()')
<|end_body_0|>
<|body_start_1|>
clueindex = random.randint(0, len(OBELISK_DESCS) - 1)
... | This object changes its description randomly. | Obelisk | [
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Obelisk:
"""This object changes its description randomly."""
def at_object_creation(self):
"""Called when object is created."""
<|body_0|>
def return_appearance(self, caller):
"""Overload the default version of this hook."""
<|body_1|>
<|end_skeleton|>
... | stack_v2_sparse_classes_36k_train_020182 | 36,948 | permissive | [
{
"docstring": "Called when object is created.",
"name": "at_object_creation",
"signature": "def at_object_creation(self)"
},
{
"docstring": "Overload the default version of this hook.",
"name": "return_appearance",
"signature": "def return_appearance(self, caller)"
}
] | 2 | stack_v2_sparse_classes_30k_train_016624 | Implement the Python class `Obelisk` described below.
Class description:
This object changes its description randomly.
Method signatures and docstrings:
- def at_object_creation(self): Called when object is created.
- def return_appearance(self, caller): Overload the default version of this hook. | Implement the Python class `Obelisk` described below.
Class description:
This object changes its description randomly.
Method signatures and docstrings:
- def at_object_creation(self): Called when object is created.
- def return_appearance(self, caller): Overload the default version of this hook.
<|skeleton|>
class ... | 4515b6b569f919b18223ff2b241ea70f3e787e1e | <|skeleton|>
class Obelisk:
"""This object changes its description randomly."""
def at_object_creation(self):
"""Called when object is created."""
<|body_0|>
def return_appearance(self, caller):
"""Overload the default version of this hook."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Obelisk:
"""This object changes its description randomly."""
def at_object_creation(self):
"""Called when object is created."""
super(Obelisk, self).at_object_creation()
self.db.tutorial_info = 'This object changes its desc randomly, and makes sure to remember which one you saw.'
... | the_stack_v2_python_sparse | contrib/tutorial_world/objects.py | mergederg/deuterium | train | 1 |
79575c5fea651d5e1a6fe98b16726856357bf7c4 | [
"if model._meta.app_label == 'auth':\n return 'geo'\nreturn 'default'",
"if model._meta.app_label == 'auth':\n return 'geo'\nreturn 'default'",
"if obj1._meta.app_label == 'auth' or obj2._meta.app_label == 'auth':\n return True\nreturn 'default'",
"if app_label == 'auth':\n return db == 'geo'\nret... | <|body_start_0|>
if model._meta.app_label == 'auth':
return 'geo'
return 'default'
<|end_body_0|>
<|body_start_1|>
if model._meta.app_label == 'auth':
return 'geo'
return 'default'
<|end_body_1|>
<|body_start_2|>
if obj1._meta.app_label == 'auth' or obj2... | Docs:hrrps://docs.djangoproject.com/en/1.9/topics/db/multi-db/#an-example A router to control all database operations on models in the auth application. $ ./manage.py migrate $ ./manage.py migrate --database=geo | DBRouter | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DBRouter:
"""Docs:hrrps://docs.djangoproject.com/en/1.9/topics/db/multi-db/#an-example A router to control all database operations on models in the auth application. $ ./manage.py migrate $ ./manage.py migrate --database=geo"""
def db_for_read(self, model, **hints):
"""Attempts to re... | stack_v2_sparse_classes_36k_train_020183 | 1,323 | no_license | [
{
"docstring": "Attempts to read auth models go to 'geo'.",
"name": "db_for_read",
"signature": "def db_for_read(self, model, **hints)"
},
{
"docstring": "Attenps to write auth models go to 'geo'.",
"name": "db_for_write",
"signature": "def db_for_write(self, model, **hints)"
},
{
... | 4 | stack_v2_sparse_classes_30k_test_000799 | Implement the Python class `DBRouter` described below.
Class description:
Docs:hrrps://docs.djangoproject.com/en/1.9/topics/db/multi-db/#an-example A router to control all database operations on models in the auth application. $ ./manage.py migrate $ ./manage.py migrate --database=geo
Method signatures and docstrings... | Implement the Python class `DBRouter` described below.
Class description:
Docs:hrrps://docs.djangoproject.com/en/1.9/topics/db/multi-db/#an-example A router to control all database operations on models in the auth application. $ ./manage.py migrate $ ./manage.py migrate --database=geo
Method signatures and docstrings... | b3e7bf45435ae12c551c9ea5debd0e601ced40bd | <|skeleton|>
class DBRouter:
"""Docs:hrrps://docs.djangoproject.com/en/1.9/topics/db/multi-db/#an-example A router to control all database operations on models in the auth application. $ ./manage.py migrate $ ./manage.py migrate --database=geo"""
def db_for_read(self, model, **hints):
"""Attempts to re... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DBRouter:
"""Docs:hrrps://docs.djangoproject.com/en/1.9/topics/db/multi-db/#an-example A router to control all database operations on models in the auth application. $ ./manage.py migrate $ ./manage.py migrate --database=geo"""
def db_for_read(self, model, **hints):
"""Attempts to read auth model... | the_stack_v2_python_sparse | myblog_project/myblog_project/routers.py | ppic9965/mydjango-project | train | 0 |
28166d3b47e0a9e14d626e7cc08bd3448d38b196 | [
"qs = self.queryset\nif not self.request.user.is_staff:\n qs = qs.filter(registrations__status='ACTIVE').distinct()\nreturn qs",
"instance = self.get_object()\nfor reg in instance.registrations.all():\n if reg.person.expired_date is None:\n raise exceptions.ValidationError('Organization has registrat... | <|body_start_0|>
qs = self.queryset
if not self.request.user.is_staff:
qs = qs.filter(registrations__status='ACTIVE').distinct()
return qs
<|end_body_0|>
<|body_start_1|>
instance = self.get_object()
for reg in instance.registrations.all():
if reg.person.... | get: Returns the specified drilling organization put: Replaces the specified record with a new one patch: Updates a drilling organization with the fields/values provided in the request body delete: Removes the specified drilling organization record | OrganizationDetailView | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OrganizationDetailView:
"""get: Returns the specified drilling organization put: Replaces the specified record with a new one patch: Updates a drilling organization with the fields/values provided in the request body delete: Removes the specified drilling organization record"""
def get_query... | stack_v2_sparse_classes_36k_train_020184 | 22,178 | permissive | [
{
"docstring": "Filter out organizations with no registered drillers if user is anonymous",
"name": "get_queryset",
"signature": "def get_queryset(self)"
},
{
"docstring": "Set expired_date to current date",
"name": "destroy",
"signature": "def destroy(self, request, *args, **kwargs)"
... | 2 | stack_v2_sparse_classes_30k_train_014440 | Implement the Python class `OrganizationDetailView` described below.
Class description:
get: Returns the specified drilling organization put: Replaces the specified record with a new one patch: Updates a drilling organization with the fields/values provided in the request body delete: Removes the specified drilling or... | Implement the Python class `OrganizationDetailView` described below.
Class description:
get: Returns the specified drilling organization put: Replaces the specified record with a new one patch: Updates a drilling organization with the fields/values provided in the request body delete: Removes the specified drilling or... | cb47ec1d0c31b6f1586843e491f7cb5f1b98d61a | <|skeleton|>
class OrganizationDetailView:
"""get: Returns the specified drilling organization put: Replaces the specified record with a new one patch: Updates a drilling organization with the fields/values provided in the request body delete: Removes the specified drilling organization record"""
def get_query... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class OrganizationDetailView:
"""get: Returns the specified drilling organization put: Replaces the specified record with a new one patch: Updates a drilling organization with the fields/values provided in the request body delete: Removes the specified drilling organization record"""
def get_queryset(self):
... | the_stack_v2_python_sparse | app/registries/views.py | cvarjao/gwells | train | 0 |
8bb4f6f1ed7ae3877a15339332a44f808fc3483b | [
"if len(points) < 2:\n return len(points)\npoints.sort(key=lambda x: x[0])\ncount = 0\nlast = points[0]\nfor point in points[1:]:\n if point[0] > last[1]:\n count += 1\n last = point\n else:\n last = [point[0], min(point[1], last[1])]\nreturn count + 1",
"if len(points) < 2:\n ret... | <|body_start_0|>
if len(points) < 2:
return len(points)
points.sort(key=lambda x: x[0])
count = 0
last = points[0]
for point in points[1:]:
if point[0] > last[1]:
count += 1
last = point
else:
las... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def _findMinArrowShots(self, points):
""":type points: List[List[int]] :rtype: int"""
<|body_0|>
def findMinArrowShots(self, points):
""":type points: List[List[int]] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if len(point... | stack_v2_sparse_classes_36k_train_020185 | 2,662 | permissive | [
{
"docstring": ":type points: List[List[int]] :rtype: int",
"name": "_findMinArrowShots",
"signature": "def _findMinArrowShots(self, points)"
},
{
"docstring": ":type points: List[List[int]] :rtype: int",
"name": "findMinArrowShots",
"signature": "def findMinArrowShots(self, points)"
}... | 2 | stack_v2_sparse_classes_30k_train_005797 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def _findMinArrowShots(self, points): :type points: List[List[int]] :rtype: int
- def findMinArrowShots(self, points): :type points: List[List[int]] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def _findMinArrowShots(self, points): :type points: List[List[int]] :rtype: int
- def findMinArrowShots(self, points): :type points: List[List[int]] :rtype: int
<|skeleton|>
cla... | 0dd67edca4e0b0323cb5a7239f02ea46383cd15a | <|skeleton|>
class Solution:
def _findMinArrowShots(self, points):
""":type points: List[List[int]] :rtype: int"""
<|body_0|>
def findMinArrowShots(self, points):
""":type points: List[List[int]] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def _findMinArrowShots(self, points):
""":type points: List[List[int]] :rtype: int"""
if len(points) < 2:
return len(points)
points.sort(key=lambda x: x[0])
count = 0
last = points[0]
for point in points[1:]:
if point[0] > last[... | the_stack_v2_python_sparse | 452.minimum-number-of-arrows-to-burst-balloons.py | windard/leeeeee | train | 0 | |
5e7b52ecb441c4972fd4855ac4edcc1747d8f79f | [
"super(SegNet, self).__init__()\nself.layer_1 = SegnetLayer_Encoder(in_channels, 64, 2)\nself.layer_2 = SegnetLayer_Encoder(64, 128, 2)\nself.layer_3 = SegnetLayer_Encoder(128, 256, 3)\nself.layer_4 = SegnetLayer_Encoder(256, 512, 3)\nself.layer_5 = SegnetLayer_Encoder(512, 512, 3)\nself.layer_6 = SegnetLayer_Decod... | <|body_start_0|>
super(SegNet, self).__init__()
self.layer_1 = SegnetLayer_Encoder(in_channels, 64, 2)
self.layer_2 = SegnetLayer_Encoder(64, 128, 2)
self.layer_3 = SegnetLayer_Encoder(128, 256, 3)
self.layer_4 = SegnetLayer_Encoder(256, 512, 3)
self.layer_5 = SegnetLayer... | Derived Class to define a Segnet Architecture of NN Attributes ---------- in_channels : int The input size of the network. n_classes : int The output size of the network. References ---------- SegNet: A Deep Convolutional Encoder-Decoder Architecture for Image Segmentation Vijay Badrinarayanan, Alex Kendall, Roberto Ci... | SegNet | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SegNet:
"""Derived Class to define a Segnet Architecture of NN Attributes ---------- in_channels : int The input size of the network. n_classes : int The output size of the network. References ---------- SegNet: A Deep Convolutional Encoder-Decoder Architecture for Image Segmentation Vijay Badrin... | stack_v2_sparse_classes_36k_train_020186 | 20,094 | no_license | [
{
"docstring": "Sequential Instanciation of the different Layers",
"name": "__init__",
"signature": "def __init__(self, in_channels=3, n_classes=21)"
},
{
"docstring": "Sequential Computation, see nn.Module.forward methods PyTorch",
"name": "forward",
"signature": "def forward(self, inpu... | 3 | stack_v2_sparse_classes_30k_train_020245 | Implement the Python class `SegNet` described below.
Class description:
Derived Class to define a Segnet Architecture of NN Attributes ---------- in_channels : int The input size of the network. n_classes : int The output size of the network. References ---------- SegNet: A Deep Convolutional Encoder-Decoder Architect... | Implement the Python class `SegNet` described below.
Class description:
Derived Class to define a Segnet Architecture of NN Attributes ---------- in_channels : int The input size of the network. n_classes : int The output size of the network. References ---------- SegNet: A Deep Convolutional Encoder-Decoder Architect... | 3b63f360e67013d5962082e57fb36ebfb37d8920 | <|skeleton|>
class SegNet:
"""Derived Class to define a Segnet Architecture of NN Attributes ---------- in_channels : int The input size of the network. n_classes : int The output size of the network. References ---------- SegNet: A Deep Convolutional Encoder-Decoder Architecture for Image Segmentation Vijay Badrin... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SegNet:
"""Derived Class to define a Segnet Architecture of NN Attributes ---------- in_channels : int The input size of the network. n_classes : int The output size of the network. References ---------- SegNet: A Deep Convolutional Encoder-Decoder Architecture for Image Segmentation Vijay Badrinarayanan, Ale... | the_stack_v2_python_sparse | segmentation/models/nn.py | Kivo0/vibotorch | train | 0 |
cef5b5026620e7414d8db700a6d0319eb6e04664 | [
"if not isinstance(calculation, Q2rCalculation):\n raise QEOutputParsingError('Input calc must be a Q2rCalculation')\nself._calc = calculation\nsuper(Q2rParser, self).__init__(calculation)",
"from aiida.common.exceptions import InvalidOperation\nsuccessful = True\ntry:\n out_folder = retrieved[self._calc._g... | <|body_start_0|>
if not isinstance(calculation, Q2rCalculation):
raise QEOutputParsingError('Input calc must be a Q2rCalculation')
self._calc = calculation
super(Q2rParser, self).__init__(calculation)
<|end_body_0|>
<|body_start_1|>
from aiida.common.exceptions import Invali... | This class is the implementation of the Parser class for Q2r. | Q2rParser | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Q2rParser:
"""This class is the implementation of the Parser class for Q2r."""
def __init__(self, calculation):
"""Initialize the instance of Q2rParser"""
<|body_0|>
def parse_with_retrieved(self, retrieved):
"""Parses the datafolder, stores results. This parser ... | stack_v2_sparse_classes_36k_train_020187 | 2,730 | permissive | [
{
"docstring": "Initialize the instance of Q2rParser",
"name": "__init__",
"signature": "def __init__(self, calculation)"
},
{
"docstring": "Parses the datafolder, stores results. This parser for this simple code does simply store in the DB a node representing the file of forces in real space",
... | 2 | stack_v2_sparse_classes_30k_train_012260 | Implement the Python class `Q2rParser` described below.
Class description:
This class is the implementation of the Parser class for Q2r.
Method signatures and docstrings:
- def __init__(self, calculation): Initialize the instance of Q2rParser
- def parse_with_retrieved(self, retrieved): Parses the datafolder, stores ... | Implement the Python class `Q2rParser` described below.
Class description:
This class is the implementation of the Parser class for Q2r.
Method signatures and docstrings:
- def __init__(self, calculation): Initialize the instance of Q2rParser
- def parse_with_retrieved(self, retrieved): Parses the datafolder, stores ... | 79e5704c2a470e888c7007d52886afd3370a5e27 | <|skeleton|>
class Q2rParser:
"""This class is the implementation of the Parser class for Q2r."""
def __init__(self, calculation):
"""Initialize the instance of Q2rParser"""
<|body_0|>
def parse_with_retrieved(self, retrieved):
"""Parses the datafolder, stores results. This parser ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Q2rParser:
"""This class is the implementation of the Parser class for Q2r."""
def __init__(self, calculation):
"""Initialize the instance of Q2rParser"""
if not isinstance(calculation, Q2rCalculation):
raise QEOutputParsingError('Input calc must be a Q2rCalculation')
... | the_stack_v2_python_sparse | aiida_quantumespresso/parsers/q2r.py | AntimoMarrazzo/aiida-quantumespresso | train | 0 |
1732d5b7c63ff0329a0cc5299b4f3ce9cbe490c3 | [
"def serialize(root):\n if not root:\n return\n nodes.append(root.val)\n serialize(root.left)\n serialize(root.right)\nnodes = []\nserialize(root)\nreturn ' '.join(map(str, nodes))",
"def deseralize(q, minVal, maxVal):\n if not q:\n return None\n if q[0] > maxVal or q[0] < minVal:\... | <|body_start_0|>
def serialize(root):
if not root:
return
nodes.append(root.val)
serialize(root.left)
serialize(root.right)
nodes = []
serialize(root)
return ' '.join(map(str, nodes))
<|end_body_0|>
<|body_start_1|>
... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|>
<|body_... | stack_v2_sparse_classes_36k_train_020188 | 1,425 | no_license | [
{
"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_019651 | 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:... | fa02b469344cf7c82510249fba9aa59ae0cb4cc0 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
def serialize(root):
if not root:
return
nodes.append(root.val)
serialize(root.left)
serialize(root.right)
nodes =... | the_stack_v2_python_sparse | SerializeandDeserializeBST.py | jiangshen95/UbuntuLeetCode | train | 0 | |
52dc8de910660bb2056ffd6b644b4ebc6ac6c54a | [
"nref = int(nelem / len(grads_each_dim))\nblocks = [sparse.matrix(nref, nparam) for _ in grads_each_dim]\njacobian = sparse.matrix(nelem, nparam)\nfor i in range(nparam):\n for j, block in enumerate(blocks):\n grad = grads_each_dim[j]\n block[:, i] = grad[i]\n grads_each_dim[j][i] = None\nfo... | <|body_start_0|>
nref = int(nelem / len(grads_each_dim))
blocks = [sparse.matrix(nref, nparam) for _ in grads_each_dim]
jacobian = sparse.matrix(nelem, nparam)
for i in range(nparam):
for j, block in enumerate(blocks):
grad = grads_each_dim[j]
... | Mixin class to build a sparse Jacobian from gradients of the prediction formula stored as sparse vectors, and allow concatenation of gradient vectors that employed sparse storage. | SparseGradientsMixin | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SparseGradientsMixin:
"""Mixin class to build a sparse Jacobian from gradients of the prediction formula stored as sparse vectors, and allow concatenation of gradient vectors that employed sparse storage."""
def _build_jacobian(grads_each_dim, nelem=None, nparam=None):
"""construct J... | stack_v2_sparse_classes_36k_train_020189 | 26,096 | permissive | [
{
"docstring": "construct Jacobian from lists of sparse gradient vectors.",
"name": "_build_jacobian",
"signature": "def _build_jacobian(grads_each_dim, nelem=None, nparam=None)"
},
{
"docstring": "concatenate sparse gradient vectors and return a flex.double.",
"name": "_concatenate_gradient... | 2 | stack_v2_sparse_classes_30k_train_005068 | Implement the Python class `SparseGradientsMixin` described below.
Class description:
Mixin class to build a sparse Jacobian from gradients of the prediction formula stored as sparse vectors, and allow concatenation of gradient vectors that employed sparse storage.
Method signatures and docstrings:
- def _build_jacob... | Implement the Python class `SparseGradientsMixin` described below.
Class description:
Mixin class to build a sparse Jacobian from gradients of the prediction formula stored as sparse vectors, and allow concatenation of gradient vectors that employed sparse storage.
Method signatures and docstrings:
- def _build_jacob... | 88bf7f7c5ac44defc046ebf0719cde748092cfff | <|skeleton|>
class SparseGradientsMixin:
"""Mixin class to build a sparse Jacobian from gradients of the prediction formula stored as sparse vectors, and allow concatenation of gradient vectors that employed sparse storage."""
def _build_jacobian(grads_each_dim, nelem=None, nparam=None):
"""construct J... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SparseGradientsMixin:
"""Mixin class to build a sparse Jacobian from gradients of the prediction formula stored as sparse vectors, and allow concatenation of gradient vectors that employed sparse storage."""
def _build_jacobian(grads_each_dim, nelem=None, nparam=None):
"""construct Jacobian from ... | the_stack_v2_python_sparse | src/dials/algorithms/refinement/target.py | dials/dials | train | 71 |
b73f67c30a8632085dba56aff0e0ada7b3ee1a40 | [
"super(PromoTextRemover, self).__init__()\nself._language = language\nif flask.current_app:\n self._config = config_parser.get_config_contents(_PROMO_TEXT_REMOVAL_OPTIMIZER_CONFIG_OVERRIDE_KEY, _PROMO_TEXT_REMOVAL_OPTIMIZER_CONFIG_FILE_NAME.format(language))\nelse:\n self._config = PROMO_TEXT_REMOVER_CONFIG\n... | <|body_start_0|>
super(PromoTextRemover, self).__init__()
self._language = language
if flask.current_app:
self._config = config_parser.get_config_contents(_PROMO_TEXT_REMOVAL_OPTIMIZER_CONFIG_OVERRIDE_KEY, _PROMO_TEXT_REMOVAL_OPTIMIZER_CONFIG_FILE_NAME.format(language))
else:... | A class that removes text from a field of a product. | PromoTextRemover | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PromoTextRemover:
"""A class that removes text from a field of a product."""
def __init__(self, language: str) -> None:
"""Initializes PromoTextRemover. Args: language: The configured language code."""
<|body_0|>
def remove_text_from_field(self, product: Dict[str, Any], ... | stack_v2_sparse_classes_36k_train_020190 | 5,102 | permissive | [
{
"docstring": "Initializes PromoTextRemover. Args: language: The configured language code.",
"name": "__init__",
"signature": "def __init__(self, language: str) -> None"
},
{
"docstring": "Removes text and regex patterns in the config file from a product field. Args: product: A product data. fi... | 5 | null | Implement the Python class `PromoTextRemover` described below.
Class description:
A class that removes text from a field of a product.
Method signatures and docstrings:
- def __init__(self, language: str) -> None: Initializes PromoTextRemover. Args: language: The configured language code.
- def remove_text_from_field... | Implement the Python class `PromoTextRemover` described below.
Class description:
A class that removes text from a field of a product.
Method signatures and docstrings:
- def __init__(self, language: str) -> None: Initializes PromoTextRemover. Args: language: The configured language code.
- def remove_text_from_field... | 58588ce54f8ea065fdc7501398b1b2e10f8adc41 | <|skeleton|>
class PromoTextRemover:
"""A class that removes text from a field of a product."""
def __init__(self, language: str) -> None:
"""Initializes PromoTextRemover. Args: language: The configured language code."""
<|body_0|>
def remove_text_from_field(self, product: Dict[str, Any], ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PromoTextRemover:
"""A class that removes text from a field of a product."""
def __init__(self, language: str) -> None:
"""Initializes PromoTextRemover. Args: language: The configured language code."""
super(PromoTextRemover, self).__init__()
self._language = language
if f... | the_stack_v2_python_sparse | shoptimizer_api/util/promo_text_remover.py | google/shoptimizer | train | 43 |
509abe117df1913a360a8ad9403179e3e3a7f5d4 | [
"VapiInterface.__init__(self, config, _BaseImagesStub)\nself._VAPI_OPERATION_IDS = {}\nself._VAPI_OPERATION_IDS.update({'import_from_imgdb_task': 'import_from_imgdb$task'})\nself._VAPI_OPERATION_IDS.update({'list_task': 'list$task'})\nself._VAPI_OPERATION_IDS.update({'delete_task': 'delete$task'})\nself._VAPI_OPERA... | <|body_start_0|>
VapiInterface.__init__(self, config, _BaseImagesStub)
self._VAPI_OPERATION_IDS = {}
self._VAPI_OPERATION_IDS.update({'import_from_imgdb_task': 'import_from_imgdb$task'})
self._VAPI_OPERATION_IDS.update({'list_task': 'list$task'})
self._VAPI_OPERATION_IDS.update({... | The ``BaseImages`` class provides methods to manage trusted instances of ESX software on a cluster level. This class was added in vSphere API 7.0.0. | BaseImages | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BaseImages:
"""The ``BaseImages`` class provides methods to manage trusted instances of ESX software on a cluster level. This class was added in vSphere API 7.0.0."""
def __init__(self, config):
""":type config: :class:`vmware.vapi.bindings.stub.StubConfiguration` :param config: Conf... | stack_v2_sparse_classes_36k_train_020191 | 27,176 | permissive | [
{
"docstring": ":type config: :class:`vmware.vapi.bindings.stub.StubConfiguration` :param config: Configuration to be used for creating the stub.",
"name": "__init__",
"signature": "def __init__(self, config)"
},
{
"docstring": "Import ESX metadata as a new trusted base image to each host in the... | 5 | null | Implement the Python class `BaseImages` described below.
Class description:
The ``BaseImages`` class provides methods to manage trusted instances of ESX software on a cluster level. This class was added in vSphere API 7.0.0.
Method signatures and docstrings:
- def __init__(self, config): :type config: :class:`vmware.... | Implement the Python class `BaseImages` described below.
Class description:
The ``BaseImages`` class provides methods to manage trusted instances of ESX software on a cluster level. This class was added in vSphere API 7.0.0.
Method signatures and docstrings:
- def __init__(self, config): :type config: :class:`vmware.... | c07e1be98615201139b26c28db3aa584c4254b66 | <|skeleton|>
class BaseImages:
"""The ``BaseImages`` class provides methods to manage trusted instances of ESX software on a cluster level. This class was added in vSphere API 7.0.0."""
def __init__(self, config):
""":type config: :class:`vmware.vapi.bindings.stub.StubConfiguration` :param config: Conf... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BaseImages:
"""The ``BaseImages`` class provides methods to manage trusted instances of ESX software on a cluster level. This class was added in vSphere API 7.0.0."""
def __init__(self, config):
""":type config: :class:`vmware.vapi.bindings.stub.StubConfiguration` :param config: Configuration to ... | the_stack_v2_python_sparse | com/vmware/vcenter/trusted_infrastructure/trust_authority_clusters/attestation/os/esx_client.py | adammillerio/vsphere-automation-sdk-python | train | 0 |
aad76427e9121e75b08a41e78999e58238f29674 | [
"n = len(arr)\ndp = [1] * n\nnums = [(num, i) for i, num in enumerate(arr)]\nnums.sort()\nfor num, i in nums:\n pre = num\n for j in range(i + 1, min(n, i + d + 1)):\n if pre >= arr[j]:\n continue\n pre = arr[j]\n dp[j] = max(dp[j], dp[i] + 1)\n pre = num\n for j in range... | <|body_start_0|>
n = len(arr)
dp = [1] * n
nums = [(num, i) for i, num in enumerate(arr)]
nums.sort()
for num, i in nums:
pre = num
for j in range(i + 1, min(n, i + d + 1)):
if pre >= arr[j]:
continue
pre... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxJumps1(self, arr: List[int], d: int) -> int:
"""思路:动态规划 类似最长上升子序列子序列的,每次用最矮的去更新旁边的高度 @param arr: @param d: @return:"""
<|body_0|>
def maxJumps2(self, arr: List[int], d: int) -> int:
"""思路:动态规划 类似最长上升子序列子序列的,每次用最矮的去更新旁边的高度 @param arr: @param d: @retur... | stack_v2_sparse_classes_36k_train_020192 | 3,389 | no_license | [
{
"docstring": "思路:动态规划 类似最长上升子序列子序列的,每次用最矮的去更新旁边的高度 @param arr: @param d: @return:",
"name": "maxJumps1",
"signature": "def maxJumps1(self, arr: List[int], d: int) -> int"
},
{
"docstring": "思路:动态规划 类似最长上升子序列子序列的,每次用最矮的去更新旁边的高度 @param arr: @param d: @return:",
"name": "maxJumps2",
"sign... | 2 | stack_v2_sparse_classes_30k_train_007155 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxJumps1(self, arr: List[int], d: int) -> int: 思路:动态规划 类似最长上升子序列子序列的,每次用最矮的去更新旁边的高度 @param arr: @param d: @return:
- def maxJumps2(self, arr: List[int], d: int) -> int: 思路:动... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxJumps1(self, arr: List[int], d: int) -> int: 思路:动态规划 类似最长上升子序列子序列的,每次用最矮的去更新旁边的高度 @param arr: @param d: @return:
- def maxJumps2(self, arr: List[int], d: int) -> int: 思路:动... | e43ee86c5a8cdb808da09b4b6138e10275abadb5 | <|skeleton|>
class Solution:
def maxJumps1(self, arr: List[int], d: int) -> int:
"""思路:动态规划 类似最长上升子序列子序列的,每次用最矮的去更新旁边的高度 @param arr: @param d: @return:"""
<|body_0|>
def maxJumps2(self, arr: List[int], d: int) -> int:
"""思路:动态规划 类似最长上升子序列子序列的,每次用最矮的去更新旁边的高度 @param arr: @param d: @retur... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def maxJumps1(self, arr: List[int], d: int) -> int:
"""思路:动态规划 类似最长上升子序列子序列的,每次用最矮的去更新旁边的高度 @param arr: @param d: @return:"""
n = len(arr)
dp = [1] * n
nums = [(num, i) for i, num in enumerate(arr)]
nums.sort()
for num, i in nums:
pre = num... | the_stack_v2_python_sparse | LeetCode/跳跃游戏/1340. 跳跃游戏 V.py | yiming1012/MyLeetCode | train | 2 | |
b4a0942d39d7d82a7fce1fc4503633ab8d2758b9 | [
"super(InceptionV3, self).__init__()\nself.resize_input = resize_input\nself.normalize_input = normalize_input\nself.output_blocks = sorted(output_blocks)\nself.last_needed_block = max(output_blocks)\nassert self.last_needed_block <= 3, 'Last possible output block index is 3'\nself.blocks = nn.ModuleList()\nincepti... | <|body_start_0|>
super(InceptionV3, self).__init__()
self.resize_input = resize_input
self.normalize_input = normalize_input
self.output_blocks = sorted(output_blocks)
self.last_needed_block = max(output_blocks)
assert self.last_needed_block <= 3, 'Last possible output bl... | Pretrained InceptionV3 network returning feature maps | InceptionV3 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InceptionV3:
"""Pretrained InceptionV3 network returning feature maps"""
def __init__(self, output_blocks=[DEFAULT_BLOCK_INDEX], resize_input=True, normalize_input=False, requires_grad=False):
"""Build pretrained InceptionV3 Parameters ---------- output_blocks : list of int Indices o... | stack_v2_sparse_classes_36k_train_020193 | 7,364 | no_license | [
{
"docstring": "Build pretrained InceptionV3 Parameters ---------- output_blocks : list of int Indices of blocks to return features of. Possible values are: - 0: corresponds to output of first max pooling - 1: corresponds to output of second max pooling - 2: corresponds to output which is fed to aux classifier ... | 2 | stack_v2_sparse_classes_30k_train_017537 | Implement the Python class `InceptionV3` described below.
Class description:
Pretrained InceptionV3 network returning feature maps
Method signatures and docstrings:
- def __init__(self, output_blocks=[DEFAULT_BLOCK_INDEX], resize_input=True, normalize_input=False, requires_grad=False): Build pretrained InceptionV3 Pa... | Implement the Python class `InceptionV3` described below.
Class description:
Pretrained InceptionV3 network returning feature maps
Method signatures and docstrings:
- def __init__(self, output_blocks=[DEFAULT_BLOCK_INDEX], resize_input=True, normalize_input=False, requires_grad=False): Build pretrained InceptionV3 Pa... | 563d80107a76029db3495dda1f52d4c7de9686f3 | <|skeleton|>
class InceptionV3:
"""Pretrained InceptionV3 network returning feature maps"""
def __init__(self, output_blocks=[DEFAULT_BLOCK_INDEX], resize_input=True, normalize_input=False, requires_grad=False):
"""Build pretrained InceptionV3 Parameters ---------- output_blocks : list of int Indices o... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class InceptionV3:
"""Pretrained InceptionV3 network returning feature maps"""
def __init__(self, output_blocks=[DEFAULT_BLOCK_INDEX], resize_input=True, normalize_input=False, requires_grad=False):
"""Build pretrained InceptionV3 Parameters ---------- output_blocks : list of int Indices of blocks to r... | the_stack_v2_python_sparse | Imagedatasets/inception.py | JosephineRabbit/Relation-GAN | train | 1 |
4cfe5c4b03850fac545fa0387224e0ca0f480d2f | [
"products = response.css('.itdetail01')\nfor _, product in enumerate(products):\n product = products[_]\n price = product.xpath(f\".//input[contains(@name, 'price[{_ + 1}]')]/@value\").get()\n if float(price) > 0.0:\n yield {'VENDORID': 25, 'VENDOR': 'PLATES AND BEYOND', 'ITEMNO': product.xpath(f\".... | <|body_start_0|>
products = response.css('.itdetail01')
for _, product in enumerate(products):
product = products[_]
price = product.xpath(f".//input[contains(@name, 'price[{_ + 1}]')]/@value").get()
if float(price) > 0.0:
yield {'VENDORID': 25, 'VENDO... | platesandbeyondSpider | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class platesandbeyondSpider:
def parse_category(self, response, category):
"""Grabbing items from a category page. @cb_kwargs {"category": "Health and Beauty"} @url http://platesandbeyond.com/ais101/itemdisp.php?action=Menu&dept=HEALT @returns items 3 @partial { "VENDORID": 25, "VENDOR": "PLAT... | stack_v2_sparse_classes_36k_train_020194 | 3,300 | no_license | [
{
"docstring": "Grabbing items from a category page. @cb_kwargs {\"category\": \"Health and Beauty\"} @url http://platesandbeyond.com/ais101/itemdisp.php?action=Menu&dept=HEALT @returns items 3 @partial { \"VENDORID\": 25, \"VENDOR\": \"PLATES AND BEYOND\", \"ITEMNO\": \"10298-12\", \"CATEGORY\": \"Health and B... | 2 | null | Implement the Python class `platesandbeyondSpider` described below.
Class description:
Implement the platesandbeyondSpider class.
Method signatures and docstrings:
- def parse_category(self, response, category): Grabbing items from a category page. @cb_kwargs {"category": "Health and Beauty"} @url http://platesandbey... | Implement the Python class `platesandbeyondSpider` described below.
Class description:
Implement the platesandbeyondSpider class.
Method signatures and docstrings:
- def parse_category(self, response, category): Grabbing items from a category page. @cb_kwargs {"category": "Health and Beauty"} @url http://platesandbey... | 025babe4a03553d720806828f89929c6e773d683 | <|skeleton|>
class platesandbeyondSpider:
def parse_category(self, response, category):
"""Grabbing items from a category page. @cb_kwargs {"category": "Health and Beauty"} @url http://platesandbeyond.com/ais101/itemdisp.php?action=Menu&dept=HEALT @returns items 3 @partial { "VENDORID": 25, "VENDOR": "PLAT... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class platesandbeyondSpider:
def parse_category(self, response, category):
"""Grabbing items from a category page. @cb_kwargs {"category": "Health and Beauty"} @url http://platesandbeyond.com/ais101/itemdisp.php?action=Menu&dept=HEALT @returns items 3 @partial { "VENDORID": 25, "VENDOR": "PLATES AND BEYOND"... | the_stack_v2_python_sparse | data_scraping/gmd/spiders/platesandbeyond.py | panky2202/scrapy-dev | train | 1 | |
75e371e38a143a5fced80493ddbed002b991b9be | [
"if ife1 == ife2 or not count:\n return False\nif not ife1.is_structured or not ife2.is_structured:\n return True\ncount = float(count)\nreturn max(count / ife1.internal, count / ife2.internal) >= CUTOFF",
"same = coll.defaultdict(dict)\nrest = coll.defaultdict(dict)\nfor ife1, ife2 in it.product(ifes, repe... | <|body_start_0|>
if ife1 == ife2 or not count:
return False
if not ife1.is_structured or not ife2.is_structured:
return True
count = float(count)
return max(count / ife1.internal, count / ife2.internal) >= CUTOFF
<|end_body_0|>
<|body_start_1|>
same = col... | This is a class to take a list of chains and find all that are structured. The main entry point is to simply call it. Other methods are available but these only do part of the tasks required for creating structured groupings. | Grouper | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Grouper:
"""This is a class to take a list of chains and find all that are structured. The main entry point is to simply call it. Other methods are available but these only do part of the tasks required for creating structured groupings."""
def should_join(self, ife1, ife2, count):
"... | stack_v2_sparse_classes_36k_train_020195 | 6,177 | no_license | [
{
"docstring": "Detect if two ifes should be joined. This will consider the types of interactions and the ratio of internal base pairs to external base pairs. :ife1: The first ife chain. :ife2: The second ife chain. :count: The number of external base pairs between these chains. :returns: True if the chains sho... | 5 | stack_v2_sparse_classes_30k_train_016325 | Implement the Python class `Grouper` described below.
Class description:
This is a class to take a list of chains and find all that are structured. The main entry point is to simply call it. Other methods are available but these only do part of the tasks required for creating structured groupings.
Method signatures a... | Implement the Python class `Grouper` described below.
Class description:
This is a class to take a list of chains and find all that are structured. The main entry point is to simply call it. Other methods are available but these only do part of the tasks required for creating structured groupings.
Method signatures a... | 1982e10a56885e56d79aac69365b9ff78c0e3d92 | <|skeleton|>
class Grouper:
"""This is a class to take a list of chains and find all that are structured. The main entry point is to simply call it. Other methods are available but these only do part of the tasks required for creating structured groupings."""
def should_join(self, ife1, ife2, count):
"... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Grouper:
"""This is a class to take a list of chains and find all that are structured. The main entry point is to simply call it. Other methods are available but these only do part of the tasks required for creating structured groupings."""
def should_join(self, ife1, ife2, count):
"""Detect if t... | the_stack_v2_python_sparse | pymotifs/ife/grouper.py | BGSU-RNA/RNA-3D-Hub-core | train | 3 |
c792f5a506a2121e38ff87b924075d711fef584d | [
"opts = SCons.Variables.Variables()\nopts.Add('ANSWER', 'THE answer to THE question', '42')\nargs = {'ANSWER': 'answer', 'UNKNOWN': 'unknown'}\nenv = Environment()\nopts.Update(env, args)\nr = opts.UnknownVariables()\nassert r == {'UNKNOWN': 'unknown'}, r\nassert env['ANSWER'] == 'answer', env['ANSWER']",
"opts =... | <|body_start_0|>
opts = SCons.Variables.Variables()
opts.Add('ANSWER', 'THE answer to THE question', '42')
args = {'ANSWER': 'answer', 'UNKNOWN': 'unknown'}
env = Environment()
opts.Update(env, args)
r = opts.UnknownVariables()
assert r == {'UNKNOWN': 'unknown'}, ... | UnknownVariablesTestCase | [
"MIT",
"LicenseRef-scancode-free-unknown",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UnknownVariablesTestCase:
def test_unknown(self) -> None:
"""Test the UnknownVariables() method"""
<|body_0|>
def test_AddOptionUpdatesUnknown(self) -> None:
"""Test updating of the 'unknown' dict"""
<|body_1|>
def test_AddOptionWithAliasUpdatesUnknown(s... | stack_v2_sparse_classes_36k_train_020196 | 20,589 | permissive | [
{
"docstring": "Test the UnknownVariables() method",
"name": "test_unknown",
"signature": "def test_unknown(self) -> None"
},
{
"docstring": "Test updating of the 'unknown' dict",
"name": "test_AddOptionUpdatesUnknown",
"signature": "def test_AddOptionUpdatesUnknown(self) -> None"
},
... | 3 | stack_v2_sparse_classes_30k_train_006176 | Implement the Python class `UnknownVariablesTestCase` described below.
Class description:
Implement the UnknownVariablesTestCase class.
Method signatures and docstrings:
- def test_unknown(self) -> None: Test the UnknownVariables() method
- def test_AddOptionUpdatesUnknown(self) -> None: Test updating of the 'unknown... | Implement the Python class `UnknownVariablesTestCase` described below.
Class description:
Implement the UnknownVariablesTestCase class.
Method signatures and docstrings:
- def test_unknown(self) -> None: Test the UnknownVariables() method
- def test_AddOptionUpdatesUnknown(self) -> None: Test updating of the 'unknown... | b2a7d7066a2b854460a334a5fe737ea389655e6e | <|skeleton|>
class UnknownVariablesTestCase:
def test_unknown(self) -> None:
"""Test the UnknownVariables() method"""
<|body_0|>
def test_AddOptionUpdatesUnknown(self) -> None:
"""Test updating of the 'unknown' dict"""
<|body_1|>
def test_AddOptionWithAliasUpdatesUnknown(s... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UnknownVariablesTestCase:
def test_unknown(self) -> None:
"""Test the UnknownVariables() method"""
opts = SCons.Variables.Variables()
opts.Add('ANSWER', 'THE answer to THE question', '42')
args = {'ANSWER': 'answer', 'UNKNOWN': 'unknown'}
env = Environment()
opt... | the_stack_v2_python_sparse | SCons/Variables/VariablesTests.py | SCons/scons | train | 1,827 | |
0edc94ada8a585d6c73bec2d02eea7cfa60d3189 | [
"if not in_str or num_row == 1:\n print(in_str)\n return\nif num_row <= 0:\n print(f'Number of rows enetered {num_row} is not valid')\n return\nchar_index = 0\nin_str_len = len(in_str)\ninterval = num_row - 1\noverall_list = []\nfor x in range(in_str_len):\n if char_index >= in_str_len:\n brea... | <|body_start_0|>
if not in_str or num_row == 1:
print(in_str)
return
if num_row <= 0:
print(f'Number of rows enetered {num_row} is not valid')
return
char_index = 0
in_str_len = len(in_str)
interval = num_row - 1
overall_lis... | ZigZag | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ZigZag:
def convert(self, in_str: str, num_row: int) -> None:
"""# Algorithm # when x = 0 or interval (num-1) or multiple of intervals -> print chars in all rows (n) # when x == y or x - interval or x - (multiple of intervals) -> print char in that position only # Edge and negative cases... | stack_v2_sparse_classes_36k_train_020197 | 3,916 | no_license | [
{
"docstring": "# Algorithm # when x = 0 or interval (num-1) or multiple of intervals -> print chars in all rows (n) # when x == y or x - interval or x - (multiple of intervals) -> print char in that position only # Edge and negative cases: ## '' str -> print empty str ## when num_row = 1 -> print str as is (no... | 2 | stack_v2_sparse_classes_30k_train_005648 | Implement the Python class `ZigZag` described below.
Class description:
Implement the ZigZag class.
Method signatures and docstrings:
- def convert(self, in_str: str, num_row: int) -> None: # Algorithm # when x = 0 or interval (num-1) or multiple of intervals -> print chars in all rows (n) # when x == y or x - interv... | Implement the Python class `ZigZag` described below.
Class description:
Implement the ZigZag class.
Method signatures and docstrings:
- def convert(self, in_str: str, num_row: int) -> None: # Algorithm # when x = 0 or interval (num-1) or multiple of intervals -> print chars in all rows (n) # when x == y or x - interv... | 9f00341461177ecf7f76a8658f7c9bf2d37b02dc | <|skeleton|>
class ZigZag:
def convert(self, in_str: str, num_row: int) -> None:
"""# Algorithm # when x = 0 or interval (num-1) or multiple of intervals -> print chars in all rows (n) # when x == y or x - interval or x - (multiple of intervals) -> print char in that position only # Edge and negative cases... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ZigZag:
def convert(self, in_str: str, num_row: int) -> None:
"""# Algorithm # when x = 0 or interval (num-1) or multiple of intervals -> print chars in all rows (n) # when x == y or x - interval or x - (multiple of intervals) -> print char in that position only # Edge and negative cases: ## '' str ->... | the_stack_v2_python_sparse | src/coding_interview/zig_zag.py | dattatembare/python-examples | train | 0 | |
5a9bc394abfec97c2ed61fdca423b0a26c146d42 | [
"threading.Thread.__init__(self)\nself.taskBuffer = taskBuffer\nif log_stream:\n self.log_stream = log_stream\nelse:\n self.log_stream = _logger\nif hasattr(panda_config, 'CRIC_URL_SCHEDCONFIG'):\n self.CRIC_URL_SCHEDCONFIG = panda_config.CRIC_URL_SCHEDCONFIG\nelse:\n self.CRIC_URL_SCHEDCONFIG = 'https:... | <|body_start_0|>
threading.Thread.__init__(self)
self.taskBuffer = taskBuffer
if log_stream:
self.log_stream = log_stream
else:
self.log_stream = _logger
if hasattr(panda_config, 'CRIC_URL_SCHEDCONFIG'):
self.CRIC_URL_SCHEDCONFIG = panda_config... | Downloads the CRIC schedconfig dump and stores it in the DB, one row per queue | SchedconfigJsonDumper | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SchedconfigJsonDumper:
"""Downloads the CRIC schedconfig dump and stores it in the DB, one row per queue"""
def __init__(self, taskBuffer, log_stream=None):
"""Initialization and configuration"""
<|body_0|>
def run(self):
"""Principal function"""
<|body_1... | stack_v2_sparse_classes_36k_train_020198 | 38,097 | permissive | [
{
"docstring": "Initialization and configuration",
"name": "__init__",
"signature": "def __init__(self, taskBuffer, log_stream=None)"
},
{
"docstring": "Principal function",
"name": "run",
"signature": "def run(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_002273 | Implement the Python class `SchedconfigJsonDumper` described below.
Class description:
Downloads the CRIC schedconfig dump and stores it in the DB, one row per queue
Method signatures and docstrings:
- def __init__(self, taskBuffer, log_stream=None): Initialization and configuration
- def run(self): Principal functio... | Implement the Python class `SchedconfigJsonDumper` described below.
Class description:
Downloads the CRIC schedconfig dump and stores it in the DB, one row per queue
Method signatures and docstrings:
- def __init__(self, taskBuffer, log_stream=None): Initialization and configuration
- def run(self): Principal functio... | 365a9feb55d493b208e3052428f0b524e63e4178 | <|skeleton|>
class SchedconfigJsonDumper:
"""Downloads the CRIC schedconfig dump and stores it in the DB, one row per queue"""
def __init__(self, taskBuffer, log_stream=None):
"""Initialization and configuration"""
<|body_0|>
def run(self):
"""Principal function"""
<|body_1... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SchedconfigJsonDumper:
"""Downloads the CRIC schedconfig dump and stores it in the DB, one row per queue"""
def __init__(self, taskBuffer, log_stream=None):
"""Initialization and configuration"""
threading.Thread.__init__(self)
self.taskBuffer = taskBuffer
if log_stream:
... | the_stack_v2_python_sparse | pandaserver/configurator/Configurator.py | PanDAWMS/panda-server | train | 8 |
6135d22edf85e7f974ce4f3c62c492b1c4318f20 | [
"if len(self.raw_data) < SAMPLE_BYTES:\n raise SampleException('Flort_kn__stc_imodemParserDataParticleKey: No regex match of parsed sample data: [%s]', self.raw_data)\ntry:\n fields_prof = struct.unpack('>I f f f f h h h', self.raw_data)\n time_stamp = int(fields_prof[0])\n scatter = int(fields_prof[5])... | <|body_start_0|>
if len(self.raw_data) < SAMPLE_BYTES:
raise SampleException('Flort_kn__stc_imodemParserDataParticleKey: No regex match of parsed sample data: [%s]', self.raw_data)
try:
fields_prof = struct.unpack('>I f f f f h h h', self.raw_data)
time_stamp = int(fi... | Class for parsing data from the FLORT_KN__STC_IMODEM data set | Flort_kn__stc_imodemParserDataParticle | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Flort_kn__stc_imodemParserDataParticle:
"""Class for parsing data from the FLORT_KN__STC_IMODEM data set"""
def _build_parsed_values(self):
"""Take something in the data format and turn it into a particle with the appropriate tag. @throws SampleException If there is a problem with sa... | stack_v2_sparse_classes_36k_train_020199 | 4,612 | no_license | [
{
"docstring": "Take something in the data format and turn it into a particle with the appropriate tag. @throws SampleException If there is a problem with sample creation",
"name": "_build_parsed_values",
"signature": "def _build_parsed_values(self)"
},
{
"docstring": "Quick equality check for t... | 2 | stack_v2_sparse_classes_30k_train_012282 | Implement the Python class `Flort_kn__stc_imodemParserDataParticle` described below.
Class description:
Class for parsing data from the FLORT_KN__STC_IMODEM data set
Method signatures and docstrings:
- def _build_parsed_values(self): Take something in the data format and turn it into a particle with the appropriate t... | Implement the Python class `Flort_kn__stc_imodemParserDataParticle` described below.
Class description:
Class for parsing data from the FLORT_KN__STC_IMODEM data set
Method signatures and docstrings:
- def _build_parsed_values(self): Take something in the data format and turn it into a particle with the appropriate t... | e1485ecda888a331a1554450a1d16c58941b6391 | <|skeleton|>
class Flort_kn__stc_imodemParserDataParticle:
"""Class for parsing data from the FLORT_KN__STC_IMODEM data set"""
def _build_parsed_values(self):
"""Take something in the data format and turn it into a particle with the appropriate tag. @throws SampleException If there is a problem with sa... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Flort_kn__stc_imodemParserDataParticle:
"""Class for parsing data from the FLORT_KN__STC_IMODEM data set"""
def _build_parsed_values(self):
"""Take something in the data format and turn it into a particle with the appropriate tag. @throws SampleException If there is a problem with sample creation... | the_stack_v2_python_sparse | mi/dataset/parser/flort_kn__stc_imodem.py | kstiemke/marine-integrations | train | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.