blob_id stringlengths 40 40 | bodies listlengths 2 6 | bodies_text stringlengths 196 7.73k | class_docstring stringlengths 0 700 | class_name stringlengths 1 86 | detected_licenses listlengths 0 45 | format_version stringclasses 1
value | full_text stringlengths 378 8.64k | id stringlengths 44 44 | length_bytes int64 505 50k | license_type stringclasses 2
values | methods listlengths 2 6 | n_methods int64 2 6 | original_id stringlengths 38 40 ⌀ | prompt stringlengths 153 4.88k | prompted_full_text stringlengths 565 12.5k | revision_id stringlengths 40 40 | skeleton stringlengths 162 5.05k | snapshot_name stringclasses 1
value | snapshot_source_dir stringclasses 1
value | snapshot_total_rows int64 75.8k 75.8k | solution stringlengths 242 8.3k | source stringclasses 1
value | source_path stringlengths 4 177 | source_repo stringlengths 6 110 | split stringclasses 1
value | star_events_count int64 0 209k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
5bdbe1be9354c5424de8de13a2317aad2cbc47c8 | [
"osm_user_details_url = f\"{current_app.config['OSM_SERVER_URL']}/api/0.6/user/{user_id}.json\"\nresponse = requests.get(osm_user_details_url)\nif response.status_code != 200:\n raise OSMServiceError('Bad response from OSM')\nreturn OSMService._parse_osm_user_details_response(response.json())",
"osm_user = osm... | <|body_start_0|>
osm_user_details_url = f"{current_app.config['OSM_SERVER_URL']}/api/0.6/user/{user_id}.json"
response = requests.get(osm_user_details_url)
if response.status_code != 200:
raise OSMServiceError('Bad response from OSM')
return OSMService._parse_osm_user_details... | OSMService | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OSMService:
def get_osm_details_for_user(user_id: int) -> UserOSMDTO:
"""Gets OSM details for the user from OSM API :param user_id: user_id in scope :raises OSMServiceError"""
<|body_0|>
def _parse_osm_user_details_response(osm_response: dict, user_element='user') -> UserOSM... | stack_v2_sparse_classes_75kplus_train_003000 | 1,488 | permissive | [
{
"docstring": "Gets OSM details for the user from OSM API :param user_id: user_id in scope :raises OSMServiceError",
"name": "get_osm_details_for_user",
"signature": "def get_osm_details_for_user(user_id: int) -> UserOSMDTO"
},
{
"docstring": "Parses the OSM user details response and extracts u... | 2 | stack_v2_sparse_classes_30k_train_052337 | Implement the Python class `OSMService` described below.
Class description:
Implement the OSMService class.
Method signatures and docstrings:
- def get_osm_details_for_user(user_id: int) -> UserOSMDTO: Gets OSM details for the user from OSM API :param user_id: user_id in scope :raises OSMServiceError
- def _parse_osm... | Implement the Python class `OSMService` described below.
Class description:
Implement the OSMService class.
Method signatures and docstrings:
- def get_osm_details_for_user(user_id: int) -> UserOSMDTO: Gets OSM details for the user from OSM API :param user_id: user_id in scope :raises OSMServiceError
- def _parse_osm... | 45bf3937c74902226096aee5b49e7abea62df524 | <|skeleton|>
class OSMService:
def get_osm_details_for_user(user_id: int) -> UserOSMDTO:
"""Gets OSM details for the user from OSM API :param user_id: user_id in scope :raises OSMServiceError"""
<|body_0|>
def _parse_osm_user_details_response(osm_response: dict, user_element='user') -> UserOSM... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class OSMService:
def get_osm_details_for_user(user_id: int) -> UserOSMDTO:
"""Gets OSM details for the user from OSM API :param user_id: user_id in scope :raises OSMServiceError"""
osm_user_details_url = f"{current_app.config['OSM_SERVER_URL']}/api/0.6/user/{user_id}.json"
response = reques... | the_stack_v2_python_sparse | backend/services/users/osm_service.py | hotosm/tasking-manager | train | 526 | |
8b893ead3f4c1784e92aa77dc237bb61f365fa1a | [
"self.num_cores = num_cores if not hasattr(CONFIG, 'NUM_CORES') else CONFIG.NUM_CORES\nself.rewrite = rewrite\nif isinstance(num_imgs, int):\n num_imgs = get_indices(CONFIG.INPUT_DIR) if num_imgs == 0 else get_indices(CONFIG.INPUT_DIR)[:num_imgs]\nelif not isinstance(num_imgs, (list, tuple)):\n raise ValueErr... | <|body_start_0|>
self.num_cores = num_cores if not hasattr(CONFIG, 'NUM_CORES') else CONFIG.NUM_CORES
self.rewrite = rewrite
if isinstance(num_imgs, int):
num_imgs = get_indices(CONFIG.INPUT_DIR) if num_imgs == 0 else get_indices(CONFIG.INPUT_DIR)[:num_imgs]
elif not isinstan... | ComputeMetrics | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ComputeMetrics:
def __init__(self, num_cores=1, num_imgs=len(os.listdir(CONFIG.INPUT_DIR)), rewrite=True):
"""object initialization :param num_cores: (int) number of cores used for parallelization :param num_imgs: (int) number of images to be processed :param rewrite: (boolean) overwrite... | stack_v2_sparse_classes_75kplus_train_003001 | 18,931 | permissive | [
{
"docstring": "object initialization :param num_cores: (int) number of cores used for parallelization :param num_imgs: (int) number of images to be processed :param rewrite: (boolean) overwrite existing files if True",
"name": "__init__",
"signature": "def __init__(self, num_cores=1, num_imgs=len(os.li... | 5 | stack_v2_sparse_classes_30k_train_030559 | Implement the Python class `ComputeMetrics` described below.
Class description:
Implement the ComputeMetrics class.
Method signatures and docstrings:
- def __init__(self, num_cores=1, num_imgs=len(os.listdir(CONFIG.INPUT_DIR)), rewrite=True): object initialization :param num_cores: (int) number of cores used for para... | Implement the Python class `ComputeMetrics` described below.
Class description:
Implement the ComputeMetrics class.
Method signatures and docstrings:
- def __init__(self, num_cores=1, num_imgs=len(os.listdir(CONFIG.INPUT_DIR)), rewrite=True): object initialization :param num_cores: (int) number of cores used for para... | 59ec960b9527cedf059a722fd8387ba38e1d79f3 | <|skeleton|>
class ComputeMetrics:
def __init__(self, num_cores=1, num_imgs=len(os.listdir(CONFIG.INPUT_DIR)), rewrite=True):
"""object initialization :param num_cores: (int) number of cores used for parallelization :param num_imgs: (int) number of images to be processed :param rewrite: (boolean) overwrite... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ComputeMetrics:
def __init__(self, num_cores=1, num_imgs=len(os.listdir(CONFIG.INPUT_DIR)), rewrite=True):
"""object initialization :param num_cores: (int) number of cores used for parallelization :param num_imgs: (int) number of images to be processed :param rewrite: (boolean) overwrite existing file... | the_stack_v2_python_sparse | src/MetaSeg/functions/main_functions.py | mrottmann/OODRetrieval | train | 0 | |
49894df219e40238550e88364f9285d77d9ed199 | [
"def searchrow(start, end):\n if start > end:\n return -1\n mid = start + (end - start) // 2\n if matrix[mid][0] <= target <= matrix[mid][-1]:\n return mid\n elif target < matrix[mid][0]:\n return searchrow(start, mid - 1)\n else:\n return searchrow(mid + 1, end)\n\ndef se... | <|body_start_0|>
def searchrow(start, end):
if start > end:
return -1
mid = start + (end - start) // 2
if matrix[mid][0] <= target <= matrix[mid][-1]:
return mid
elif target < matrix[mid][0]:
return searchrow(start, ... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def searchMatrix(self, matrix, target):
""":type matrix: List[List[int]] :type target: int :rtype: bool 两次二分搜索 时间击败62.95%,内存击败15.94%"""
<|body_0|>
def searchMatrix1(self, matrix, target):
""":type matrix: List[List[int]] :type target: int :rtype: bool 一次二分搜... | stack_v2_sparse_classes_75kplus_train_003002 | 3,120 | no_license | [
{
"docstring": ":type matrix: List[List[int]] :type target: int :rtype: bool 两次二分搜索 时间击败62.95%,内存击败15.94%",
"name": "searchMatrix",
"signature": "def searchMatrix(self, matrix, target)"
},
{
"docstring": ":type matrix: List[List[int]] :type target: int :rtype: bool 一次二分搜索 时间击败62.95%,内存击败13.28%",... | 2 | stack_v2_sparse_classes_30k_train_019921 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def searchMatrix(self, matrix, target): :type matrix: List[List[int]] :type target: int :rtype: bool 两次二分搜索 时间击败62.95%,内存击败15.94%
- def searchMatrix1(self, matrix, target): :type... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def searchMatrix(self, matrix, target): :type matrix: List[List[int]] :type target: int :rtype: bool 两次二分搜索 时间击败62.95%,内存击败15.94%
- def searchMatrix1(self, matrix, target): :type... | 2dc982e690b153c33bc7e27a63604f754a0df90c | <|skeleton|>
class Solution:
def searchMatrix(self, matrix, target):
""":type matrix: List[List[int]] :type target: int :rtype: bool 两次二分搜索 时间击败62.95%,内存击败15.94%"""
<|body_0|>
def searchMatrix1(self, matrix, target):
""":type matrix: List[List[int]] :type target: int :rtype: bool 一次二分搜... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def searchMatrix(self, matrix, target):
""":type matrix: List[List[int]] :type target: int :rtype: bool 两次二分搜索 时间击败62.95%,内存击败15.94%"""
def searchrow(start, end):
if start > end:
return -1
mid = start + (end - start) // 2
if matrix[... | the_stack_v2_python_sparse | 74_search-a-2d-matrix.py | 95275059/Algorithm | train | 0 | |
d2e255737b5c37972a519266509de2d4291e2ac5 | [
"i = 0\nwhile i < len(arr):\n if len(arr[i:]) < m * k:\n return False\n j = 1\n while j < k:\n if arr[i:i + m] != arr[i + m * j:i + m * (j + 1)]:\n i += 1\n break\n elif arr[i:i + m] == arr[i + m * j:i + m * (j + 1)]:\n j += 1\n if j == k:\n r... | <|body_start_0|>
i = 0
while i < len(arr):
if len(arr[i:]) < m * k:
return False
j = 1
while j < k:
if arr[i:i + m] != arr[i + m * j:i + m * (j + 1)]:
i += 1
break
elif arr[i:i + m... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def containsPattern(self, arr, m, k):
""":type arr: List[int] :type m: int :type k: int :rtype: bool"""
<|body_0|>
def containsPattern(self, arr, m, k):
""":type arr: List[int] :type m: int :type k: int :rtype: bool"""
<|body_1|>
def containsPa... | stack_v2_sparse_classes_75kplus_train_003003 | 1,339 | no_license | [
{
"docstring": ":type arr: List[int] :type m: int :type k: int :rtype: bool",
"name": "containsPattern",
"signature": "def containsPattern(self, arr, m, k)"
},
{
"docstring": ":type arr: List[int] :type m: int :type k: int :rtype: bool",
"name": "containsPattern",
"signature": "def conta... | 3 | stack_v2_sparse_classes_30k_train_029787 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def containsPattern(self, arr, m, k): :type arr: List[int] :type m: int :type k: int :rtype: bool
- def containsPattern(self, arr, m, k): :type arr: List[int] :type m: int :type ... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def containsPattern(self, arr, m, k): :type arr: List[int] :type m: int :type k: int :rtype: bool
- def containsPattern(self, arr, m, k): :type arr: List[int] :type m: int :type ... | a509b383a42f54313970168d9faa11f088f18708 | <|skeleton|>
class Solution:
def containsPattern(self, arr, m, k):
""":type arr: List[int] :type m: int :type k: int :rtype: bool"""
<|body_0|>
def containsPattern(self, arr, m, k):
""":type arr: List[int] :type m: int :type k: int :rtype: bool"""
<|body_1|>
def containsPa... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def containsPattern(self, arr, m, k):
""":type arr: List[int] :type m: int :type k: int :rtype: bool"""
i = 0
while i < len(arr):
if len(arr[i:]) < m * k:
return False
j = 1
while j < k:
if arr[i:i + m] != ar... | the_stack_v2_python_sparse | 1566_Detect_Pattern_of_Length_M_Repeated_K_or_More.py | bingli8802/leetcode | train | 0 | |
4891077b67943375a0724ff567039f0c30228bdc | [
"super().__init__()\nChannelwiseGRU.global_count += 1\nself.step = 0\nself.size = size\nself.num_channels = num_channels\nself.name = name if name else f'gru{ChannelwiseGRU.global_count}'\nself.data_layout = 'data_parallel'\nscale = 1 / math.sqrt(self.size)\nself.weights = list(make_iterable(weights))\nweight_name ... | <|body_start_0|>
super().__init__()
ChannelwiseGRU.global_count += 1
self.step = 0
self.size = size
self.num_channels = num_channels
self.name = name if name else f'gru{ChannelwiseGRU.global_count}'
self.data_layout = 'data_parallel'
scale = 1 / math.sqrt(... | Channelwise extension of Gated-recurrent unit for 2D input. Implementation mostly taken from: https://pytorch.org/docs/stable/generated/torch.nn.GRUCell.html#torch.nn.GRUCell | ChannelwiseGRU | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ChannelwiseGRU:
"""Channelwise extension of Gated-recurrent unit for 2D input. Implementation mostly taken from: https://pytorch.org/docs/stable/generated/torch.nn.GRUCell.html#torch.nn.GRUCell"""
def __init__(self, num_channels, size, bias=True, weights=[], name=None):
"""Initialize... | stack_v2_sparse_classes_75kplus_train_003004 | 18,287 | permissive | [
{
"docstring": "Initialize GRU cell. Args: num_channels (int): The number of rows in the matrix to perform GRU size (int): Size of output tensor. bias (bool): Whether to apply biases after linearity. weights (`Weights` or iterator of `Weights`): Weights in fully-connected layer. There are at most four - two mat... | 2 | stack_v2_sparse_classes_30k_train_004381 | Implement the Python class `ChannelwiseGRU` described below.
Class description:
Channelwise extension of Gated-recurrent unit for 2D input. Implementation mostly taken from: https://pytorch.org/docs/stable/generated/torch.nn.GRUCell.html#torch.nn.GRUCell
Method signatures and docstrings:
- def __init__(self, num_chan... | Implement the Python class `ChannelwiseGRU` described below.
Class description:
Channelwise extension of Gated-recurrent unit for 2D input. Implementation mostly taken from: https://pytorch.org/docs/stable/generated/torch.nn.GRUCell.html#torch.nn.GRUCell
Method signatures and docstrings:
- def __init__(self, num_chan... | e8cf85eed2acbd3383892bf7cb2d88b44c194f4f | <|skeleton|>
class ChannelwiseGRU:
"""Channelwise extension of Gated-recurrent unit for 2D input. Implementation mostly taken from: https://pytorch.org/docs/stable/generated/torch.nn.GRUCell.html#torch.nn.GRUCell"""
def __init__(self, num_channels, size, bias=True, weights=[], name=None):
"""Initialize... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ChannelwiseGRU:
"""Channelwise extension of Gated-recurrent unit for 2D input. Implementation mostly taken from: https://pytorch.org/docs/stable/generated/torch.nn.GRUCell.html#torch.nn.GRUCell"""
def __init__(self, num_channels, size, bias=True, weights=[], name=None):
"""Initialize GRU cell. Ar... | the_stack_v2_python_sparse | python/lbann/modules/rnn.py | LLNL/lbann | train | 225 |
23367faf94eea5a02c092d577c9e7764d4ed1799 | [
"super().__init__(**kwargs)\nself.dirty_path = os.path.expanduser(path)\nreturn",
"params = {}\nif self._mimetype:\n params['mime'] = self._mimetype\nif self._name:\n params['name'] = self._name\nreturn 'file://{path}{params}'.format(path=self.quote(self.dirty_path), params='?{}'.format(self.urlencode(param... | <|body_start_0|>
super().__init__(**kwargs)
self.dirty_path = os.path.expanduser(path)
return
<|end_body_0|>
<|body_start_1|>
params = {}
if self._mimetype:
params['mime'] = self._mimetype
if self._name:
params['name'] = self._name
return ... | A wrapper for File based attachment sources | AttachFile | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AttachFile:
"""A wrapper for File based attachment sources"""
def __init__(self, path, **kwargs):
"""Initialize Local File Attachment Object"""
<|body_0|>
def url(self, privacy=False, *args, **kwargs):
"""Returns the URL built dynamically based on specified argum... | stack_v2_sparse_classes_75kplus_train_003005 | 4,970 | permissive | [
{
"docstring": "Initialize Local File Attachment Object",
"name": "__init__",
"signature": "def __init__(self, path, **kwargs)"
},
{
"docstring": "Returns the URL built dynamically based on specified arguments.",
"name": "url",
"signature": "def url(self, privacy=False, *args, **kwargs)"... | 4 | stack_v2_sparse_classes_30k_train_024321 | Implement the Python class `AttachFile` described below.
Class description:
A wrapper for File based attachment sources
Method signatures and docstrings:
- def __init__(self, path, **kwargs): Initialize Local File Attachment Object
- def url(self, privacy=False, *args, **kwargs): Returns the URL built dynamically bas... | Implement the Python class `AttachFile` described below.
Class description:
A wrapper for File based attachment sources
Method signatures and docstrings:
- def __init__(self, path, **kwargs): Initialize Local File Attachment Object
- def url(self, privacy=False, *args, **kwargs): Returns the URL built dynamically bas... | be3baed7e3d33bae973f1714df4ebbf65aa33f85 | <|skeleton|>
class AttachFile:
"""A wrapper for File based attachment sources"""
def __init__(self, path, **kwargs):
"""Initialize Local File Attachment Object"""
<|body_0|>
def url(self, privacy=False, *args, **kwargs):
"""Returns the URL built dynamically based on specified argum... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AttachFile:
"""A wrapper for File based attachment sources"""
def __init__(self, path, **kwargs):
"""Initialize Local File Attachment Object"""
super().__init__(**kwargs)
self.dirty_path = os.path.expanduser(path)
return
def url(self, privacy=False, *args, **kwargs):
... | the_stack_v2_python_sparse | apprise/attachment/AttachFile.py | caronc/apprise | train | 8,426 |
2fab4d5f487081f9ab51d3515305d7fb72b5b220 | [
"n = self.getBinaryDigits(num)\nbase = num >> (n + 1 >> 1)\nwhile base * base < num:\n base += 1\nreturn base * base == num",
"n = 0\nwhile num != 0:\n n += 1\n num >>= 1\nreturn n"
] | <|body_start_0|>
n = self.getBinaryDigits(num)
base = num >> (n + 1 >> 1)
while base * base < num:
base += 1
return base * base == num
<|end_body_0|>
<|body_start_1|>
n = 0
while num != 0:
n += 1
num >>= 1
return n
<|end_body_1... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def isPerfectSquare(self, num):
""":type num: int :rtype: bool"""
<|body_0|>
def getBinaryDigits(self, num):
""":type num: int :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
n = self.getBinaryDigits(num)
base = num >> ... | stack_v2_sparse_classes_75kplus_train_003006 | 1,084 | no_license | [
{
"docstring": ":type num: int :rtype: bool",
"name": "isPerfectSquare",
"signature": "def isPerfectSquare(self, num)"
},
{
"docstring": ":type num: int :rtype: int",
"name": "getBinaryDigits",
"signature": "def getBinaryDigits(self, num)"
}
] | 2 | stack_v2_sparse_classes_30k_train_050284 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isPerfectSquare(self, num): :type num: int :rtype: bool
- def getBinaryDigits(self, num): :type num: int :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def isPerfectSquare(self, num): :type num: int :rtype: bool
- def getBinaryDigits(self, num): :type num: int :rtype: int
<|skeleton|>
class Solution:
def isPerfectSquare(se... | b5a9cf15b9178deb22a6d373f1669c6990378ae2 | <|skeleton|>
class Solution:
def isPerfectSquare(self, num):
""":type num: int :rtype: bool"""
<|body_0|>
def getBinaryDigits(self, num):
""":type num: int :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def isPerfectSquare(self, num):
""":type num: int :rtype: bool"""
n = self.getBinaryDigits(num)
base = num >> (n + 1 >> 1)
while base * base < num:
base += 1
return base * base == num
def getBinaryDigits(self, num):
""":type num: int :... | the_stack_v2_python_sparse | 0300-0399/367/367.py | vicch/leetcode | train | 0 | |
a21e8d30c31b895d443b8390dbda5bd94b97cec0 | [
"self.comb = preferences.BooleanPreference().getFromValue('Comb Hair:', True)\ndirectoryRadio = []\nself.directoryPreference = preferences.RadioLabel().getFromRadioLabel('Comb All Unmodified Files in a Directory', 'File or Directory Choice:', directoryRadio, False)\nself.filePreference = preferences.Radio().getFrom... | <|body_start_0|>
self.comb = preferences.BooleanPreference().getFromValue('Comb Hair:', True)
directoryRadio = []
self.directoryPreference = preferences.RadioLabel().getFromRadioLabel('Comb All Unmodified Files in a Directory', 'File or Directory Choice:', directoryRadio, False)
self.fil... | A class to handle the comb preferences. | CombPreferences | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CombPreferences:
"""A class to handle the comb preferences."""
def __init__(self):
"""Set the default preferences, execute title & preferences filename."""
<|body_0|>
def execute(self):
"""Comb button has been clicked."""
<|body_1|>
<|end_skeleton|>
<|b... | stack_v2_sparse_classes_75kplus_train_003007 | 18,088 | no_license | [
{
"docstring": "Set the default preferences, execute title & preferences filename.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Comb button has been clicked.",
"name": "execute",
"signature": "def execute(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_048097 | Implement the Python class `CombPreferences` described below.
Class description:
A class to handle the comb preferences.
Method signatures and docstrings:
- def __init__(self): Set the default preferences, execute title & preferences filename.
- def execute(self): Comb button has been clicked. | Implement the Python class `CombPreferences` described below.
Class description:
A class to handle the comb preferences.
Method signatures and docstrings:
- def __init__(self): Set the default preferences, execute title & preferences filename.
- def execute(self): Comb button has been clicked.
<|skeleton|>
class Com... | e9c79463de7d4230a440f2ab1700dd89411db0e9 | <|skeleton|>
class CombPreferences:
"""A class to handle the comb preferences."""
def __init__(self):
"""Set the default preferences, execute title & preferences filename."""
<|body_0|>
def execute(self):
"""Comb button has been clicked."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CombPreferences:
"""A class to handle the comb preferences."""
def __init__(self):
"""Set the default preferences, execute title & preferences filename."""
self.comb = preferences.BooleanPreference().getFromValue('Comb Hair:', True)
directoryRadio = []
self.directoryPrefer... | the_stack_v2_python_sparse | Toolchain/comb.py | dmstan/linuxCNC_to_3DPrinter | train | 0 |
385ba30c18b985af4c7510b455cac50ab483fbbc | [
"if value:\n self._issue_cmd('hostevent set 0x%x' % self.REC_MODE)\nelse:\n self._issue_cmd('hostevent clear 0x%x' % self.REC_MODE)\n self._issue_cmd('hostevent clearb 0x%x' % self.REC_MODE)",
"try:\n result = self._issue_cmd_get_results('hostevent', ['Events:\\\\s+(0x\\\\w+)'])[0][1]\n value = int... | <|body_start_0|>
if value:
self._issue_cmd('hostevent set 0x%x' % self.REC_MODE)
else:
self._issue_cmd('hostevent clear 0x%x' % self.REC_MODE)
self._issue_cmd('hostevent clearb 0x%x' % self.REC_MODE)
<|end_body_0|>
<|body_start_1|>
try:
result = s... | Object to access drv=arm_ec controls. Note, instances of this object get dispatched via base class, HwDriver's get/set method. That method ultimately calls: "_[GS]et_%s" % params['subtype'] below. For example, a control to read rec_mode would be dispatched to call _Get_rec_mode. | armEc | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class armEc:
"""Object to access drv=arm_ec controls. Note, instances of this object get dispatched via base class, HwDriver's get/set method. That method ultimately calls: "_[GS]et_%s" % params['subtype'] below. For example, a control to read rec_mode would be dispatched to call _Get_rec_mode."""
... | stack_v2_sparse_classes_75kplus_train_003008 | 1,861 | permissive | [
{
"docstring": "Setter of rec_mode. Sending the following EC commands via UART sets rec_mode on: hostevent set 0x4000 and the following sets rec mode off hostevent clear 0x4000 hostevent clearb 0x4000 Args: value: 0: rec_mode off; 1: rec_mode on.",
"name": "_Set_rec_mode",
"signature": "def _Set_rec_mod... | 2 | null | Implement the Python class `armEc` described below.
Class description:
Object to access drv=arm_ec controls. Note, instances of this object get dispatched via base class, HwDriver's get/set method. That method ultimately calls: "_[GS]et_%s" % params['subtype'] below. For example, a control to read rec_mode would be di... | Implement the Python class `armEc` described below.
Class description:
Object to access drv=arm_ec controls. Note, instances of this object get dispatched via base class, HwDriver's get/set method. That method ultimately calls: "_[GS]et_%s" % params['subtype'] below. For example, a control to read rec_mode would be di... | c7d50190837497dafc45f6efe18bf01d6e70cfd2 | <|skeleton|>
class armEc:
"""Object to access drv=arm_ec controls. Note, instances of this object get dispatched via base class, HwDriver's get/set method. That method ultimately calls: "_[GS]et_%s" % params['subtype'] below. For example, a control to read rec_mode would be dispatched to call _Get_rec_mode."""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class armEc:
"""Object to access drv=arm_ec controls. Note, instances of this object get dispatched via base class, HwDriver's get/set method. That method ultimately calls: "_[GS]et_%s" % params['subtype'] below. For example, a control to read rec_mode would be dispatched to call _Get_rec_mode."""
def _Set_rec... | the_stack_v2_python_sparse | servo/drv/arm_ec.py | mmind/servo-hdctools | train | 2 |
d658ac46d9feade1e2fa5663cc98817b6b2e0ffc | [
"assert dataset, 'Groundtruth should not be empty.'\nassert isinstance(dataset, dict), 'annotation file format {} not supported'.format(type(dataset))\nself.anns, self.cats, self.imgs = (dict(), dict(), dict())\nself.dataset = copy.deepcopy(dataset)\nself.createIndex()",
"res = MaskCOCO()\nres.dataset['images'] =... | <|body_start_0|>
assert dataset, 'Groundtruth should not be empty.'
assert isinstance(dataset, dict), 'annotation file format {} not supported'.format(type(dataset))
self.anns, self.cats, self.imgs = (dict(), dict(), dict())
self.dataset = copy.deepcopy(dataset)
self.createIndex(... | COCO object for mask evaluation. | MaskCOCO | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MaskCOCO:
"""COCO object for mask evaluation."""
def reset(self, dataset):
"""Reset the dataset and groundtruth data index in this object. Args: dataset: dict of groundtruth data. It should has similar structure as the COCO groundtruth JSON file. Must contains three keys: {'images', ... | stack_v2_sparse_classes_75kplus_train_003009 | 28,082 | permissive | [
{
"docstring": "Reset the dataset and groundtruth data index in this object. Args: dataset: dict of groundtruth data. It should has similar structure as the COCO groundtruth JSON file. Must contains three keys: {'images', 'annotations', 'categories'}. 'images': list of image information dictionary. Required key... | 3 | null | Implement the Python class `MaskCOCO` described below.
Class description:
COCO object for mask evaluation.
Method signatures and docstrings:
- def reset(self, dataset): Reset the dataset and groundtruth data index in this object. Args: dataset: dict of groundtruth data. It should has similar structure as the COCO gro... | Implement the Python class `MaskCOCO` described below.
Class description:
COCO object for mask evaluation.
Method signatures and docstrings:
- def reset(self, dataset): Reset the dataset and groundtruth data index in this object. Args: dataset: dict of groundtruth data. It should has similar structure as the COCO gro... | b828e794dea9bd284497e5747152f4efae43b947 | <|skeleton|>
class MaskCOCO:
"""COCO object for mask evaluation."""
def reset(self, dataset):
"""Reset the dataset and groundtruth data index in this object. Args: dataset: dict of groundtruth data. It should has similar structure as the COCO groundtruth JSON file. Must contains three keys: {'images', ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MaskCOCO:
"""COCO object for mask evaluation."""
def reset(self, dataset):
"""Reset the dataset and groundtruth data index in this object. Args: dataset: dict of groundtruth data. It should has similar structure as the COCO groundtruth JSON file. Must contains three keys: {'images', 'annotations'... | the_stack_v2_python_sparse | tftrt/benchmarking-python/nvidia_examples/mrcnn_tf2/utils.py | tensorflow/tensorrt | train | 753 |
fe3478288142d13ea71cf0da0b272a466b2b7531 | [
"tk.Frame.__init__(self, master)\nself.grid(sticky='NEWS')\nself.createWidgets()\nfor column in range(self.grid_size()[0]):\n self.columnconfigure(column, weight=1)\nfor row in range(self.grid_size()[1]):\n self.rowconfigure(row, weight=1)",
"self.b = tk.Label(self, text='a = ')\nself.b.grid(row=1, column=0... | <|body_start_0|>
tk.Frame.__init__(self, master)
self.grid(sticky='NEWS')
self.createWidgets()
for column in range(self.grid_size()[0]):
self.columnconfigure(column, weight=1)
for row in range(self.grid_size()[1]):
self.rowconfigure(row, weight=1)
<|end_bo... | Polinom class. | Polinom | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Polinom:
"""Polinom class."""
def __init__(self, master=None):
"""Initialize."""
<|body_0|>
def createWidgets(self):
"""Create main widgets."""
<|body_1|>
def solver(self):
"""Get coefficients and solve equation."""
<|body_2|>
<|end_... | stack_v2_sparse_classes_75kplus_train_003010 | 5,403 | no_license | [
{
"docstring": "Initialize.",
"name": "__init__",
"signature": "def __init__(self, master=None)"
},
{
"docstring": "Create main widgets.",
"name": "createWidgets",
"signature": "def createWidgets(self)"
},
{
"docstring": "Get coefficients and solve equation.",
"name": "solver... | 3 | stack_v2_sparse_classes_30k_val_002038 | Implement the Python class `Polinom` described below.
Class description:
Polinom class.
Method signatures and docstrings:
- def __init__(self, master=None): Initialize.
- def createWidgets(self): Create main widgets.
- def solver(self): Get coefficients and solve equation. | Implement the Python class `Polinom` described below.
Class description:
Polinom class.
Method signatures and docstrings:
- def __init__(self, master=None): Initialize.
- def createWidgets(self): Create main widgets.
- def solver(self): Get coefficients and solve equation.
<|skeleton|>
class Polinom:
"""Polinom ... | 99c08fdfc2c01322c75f833d221f9c594bfe8043 | <|skeleton|>
class Polinom:
"""Polinom class."""
def __init__(self, master=None):
"""Initialize."""
<|body_0|>
def createWidgets(self):
"""Create main widgets."""
<|body_1|>
def solver(self):
"""Get coefficients and solve equation."""
<|body_2|>
<|end_... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Polinom:
"""Polinom class."""
def __init__(self, master=None):
"""Initialize."""
tk.Frame.__init__(self, master)
self.grid(sticky='NEWS')
self.createWidgets()
for column in range(self.grid_size()[0]):
self.columnconfigure(column, weight=1)
for r... | the_stack_v2_python_sparse | PyProj/Application/Polinoms.py | Tyapkins/PythonProject2021 | train | 0 |
cf8f8823815d4a8c8400819219615043332acc79 | [
"super(ArtnetRobot, self).__init__(use_from_page=None)\nself.generator = generator\nself.cacheSources()",
"regex = u'http\\\\:\\\\/\\\\/www\\\\.artnet\\\\.com\\\\/artists\\\\/([^\\\\/\\\\s]+)'\nbaseurl = u'http://www.artnet.com/artists/%s/'\ntext = page.get()\nmatch = re.search(regex, text)\nif not match:\n py... | <|body_start_0|>
super(ArtnetRobot, self).__init__(use_from_page=None)
self.generator = generator
self.cacheSources()
<|end_body_0|>
<|body_start_1|>
regex = u'http\\:\\/\\/www\\.artnet\\.com\\/artists\\/([^\\/\\s]+)'
baseurl = u'http://www.artnet.com/artists/%s/'
text =... | A bot to import artnet ids from Wikipedia | ArtnetRobot | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ArtnetRobot:
"""A bot to import artnet ids from Wikipedia"""
def __init__(self, generator):
"""Constructor. @param generator: A generator that yields Page objects. @type generator: iterator"""
<|body_0|>
def treat(self, page, item):
"""Treat each page."""
... | stack_v2_sparse_classes_75kplus_train_003011 | 2,426 | no_license | [
{
"docstring": "Constructor. @param generator: A generator that yields Page objects. @type generator: iterator",
"name": "__init__",
"signature": "def __init__(self, generator)"
},
{
"docstring": "Treat each page.",
"name": "treat",
"signature": "def treat(self, page, item)"
}
] | 2 | stack_v2_sparse_classes_30k_train_024326 | Implement the Python class `ArtnetRobot` described below.
Class description:
A bot to import artnet ids from Wikipedia
Method signatures and docstrings:
- def __init__(self, generator): Constructor. @param generator: A generator that yields Page objects. @type generator: iterator
- def treat(self, page, item): Treat ... | Implement the Python class `ArtnetRobot` described below.
Class description:
A bot to import artnet ids from Wikipedia
Method signatures and docstrings:
- def __init__(self, generator): Constructor. @param generator: A generator that yields Page objects. @type generator: iterator
- def treat(self, page, item): Treat ... | 99a96e49cfe6b2d3151da7ad5469792d80171be3 | <|skeleton|>
class ArtnetRobot:
"""A bot to import artnet ids from Wikipedia"""
def __init__(self, generator):
"""Constructor. @param generator: A generator that yields Page objects. @type generator: iterator"""
<|body_0|>
def treat(self, page, item):
"""Treat each page."""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ArtnetRobot:
"""A bot to import artnet ids from Wikipedia"""
def __init__(self, generator):
"""Constructor. @param generator: A generator that yields Page objects. @type generator: iterator"""
super(ArtnetRobot, self).__init__(use_from_page=None)
self.generator = generator
... | the_stack_v2_python_sparse | bot/wikidata/artnet_enwp_import.py | multichill/toollabs | train | 18 |
91d39835a6925a6a310d84e9141cf87aca8f6e62 | [
"self.input_disks = [[2, 1, 2], [3, 2, 3], [2, 2, 8], [2, 3, 4], [1, 3, 1], [4, 4, 5]]\nself.output = [[2, 1, 2], [3, 2, 3], [4, 4, 5]]\nreturn (self.input_disks, self.output)",
"disks, output = self.setUp()\noutput_method = diskStacking(disks)\nself.assertEqual(output, output_method)"
] | <|body_start_0|>
self.input_disks = [[2, 1, 2], [3, 2, 3], [2, 2, 8], [2, 3, 4], [1, 3, 1], [4, 4, 5]]
self.output = [[2, 1, 2], [3, 2, 3], [4, 4, 5]]
return (self.input_disks, self.output)
<|end_body_0|>
<|body_start_1|>
disks, output = self.setUp()
output_method = diskStacking... | Class with unittests for DiskStacking.py | test_DiskStacking | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class test_DiskStacking:
"""Class with unittests for DiskStacking.py"""
def setUp(self):
"""Sets up input."""
<|body_0|>
def test_user_input(self):
"""Checks if method works properly."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.input_disks = ... | stack_v2_sparse_classes_75kplus_train_003012 | 910 | no_license | [
{
"docstring": "Sets up input.",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "Checks if method works properly.",
"name": "test_user_input",
"signature": "def test_user_input(self)"
}
] | 2 | null | Implement the Python class `test_DiskStacking` described below.
Class description:
Class with unittests for DiskStacking.py
Method signatures and docstrings:
- def setUp(self): Sets up input.
- def test_user_input(self): Checks if method works properly. | Implement the Python class `test_DiskStacking` described below.
Class description:
Class with unittests for DiskStacking.py
Method signatures and docstrings:
- def setUp(self): Sets up input.
- def test_user_input(self): Checks if method works properly.
<|skeleton|>
class test_DiskStacking:
"""Class with unittes... | 3aa62ad36c3b06b2a3b05f1f8e2a9e21d68b371f | <|skeleton|>
class test_DiskStacking:
"""Class with unittests for DiskStacking.py"""
def setUp(self):
"""Sets up input."""
<|body_0|>
def test_user_input(self):
"""Checks if method works properly."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class test_DiskStacking:
"""Class with unittests for DiskStacking.py"""
def setUp(self):
"""Sets up input."""
self.input_disks = [[2, 1, 2], [3, 2, 3], [2, 2, 8], [2, 3, 4], [1, 3, 1], [4, 4, 5]]
self.output = [[2, 1, 2], [3, 2, 3], [4, 4, 5]]
return (self.input_disks, self.outp... | the_stack_v2_python_sparse | AlgoExpert_algorithms/Hard/DiskStacking/test_DiskStacking.py | JakubKazimierski/PythonPortfolio | train | 9 |
7678c0146afcfe24fad1401d4474d098fa05d29c | [
"super(SourceTraitSearchForm, self).__init__(*args, **kwargs)\nself.helper = FormHelper(self)\nself.helper.form_method = 'get'\nself.helper.form_class = 'form-horizontal'\nself.helper.label_class = 'col-sm-2'\nself.helper.field_class = 'col-sm-10'\nself.helper.layout = Layout(Row(Div(name_checkbox_layout, 'descript... | <|body_start_0|>
super(SourceTraitSearchForm, self).__init__(*args, **kwargs)
self.helper = FormHelper(self)
self.helper.form_method = 'get'
self.helper.form_class = 'form-horizontal'
self.helper.label_class = 'col-sm-2'
self.helper.field_class = 'col-sm-10'
self.... | Form to handle django-watson searches for SourceTrait objects. This form class is a Subclass of crispy_forms.Form. Crispy forms is a Django app that improves upon the built in Django Form object. | SourceTraitSearchForm | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SourceTraitSearchForm:
"""Form to handle django-watson searches for SourceTrait objects. This form class is a Subclass of crispy_forms.Form. Crispy forms is a Django app that improves upon the built in Django Form object."""
def __init__(self, *args, **kwargs):
"""Initialize form wit... | stack_v2_sparse_classes_75kplus_train_003013 | 19,577 | permissive | [
{
"docstring": "Initialize form with formatting and submit button.",
"name": "__init__",
"signature": "def __init__(self, *args, **kwargs)"
},
{
"docstring": "Perform additional multi-field cleaning to make sure that either description or name is entered.",
"name": "clean",
"signature": ... | 2 | stack_v2_sparse_classes_30k_train_021122 | Implement the Python class `SourceTraitSearchForm` described below.
Class description:
Form to handle django-watson searches for SourceTrait objects. This form class is a Subclass of crispy_forms.Form. Crispy forms is a Django app that improves upon the built in Django Form object.
Method signatures and docstrings:
-... | Implement the Python class `SourceTraitSearchForm` described below.
Class description:
Form to handle django-watson searches for SourceTrait objects. This form class is a Subclass of crispy_forms.Form. Crispy forms is a Django app that improves upon the built in Django Form object.
Method signatures and docstrings:
-... | 89ae277f5ba1357580d78c3527f26200686308a6 | <|skeleton|>
class SourceTraitSearchForm:
"""Form to handle django-watson searches for SourceTrait objects. This form class is a Subclass of crispy_forms.Form. Crispy forms is a Django app that improves upon the built in Django Form object."""
def __init__(self, *args, **kwargs):
"""Initialize form wit... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SourceTraitSearchForm:
"""Form to handle django-watson searches for SourceTrait objects. This form class is a Subclass of crispy_forms.Form. Crispy forms is a Django app that improves upon the built in Django Form object."""
def __init__(self, *args, **kwargs):
"""Initialize form with formatting ... | the_stack_v2_python_sparse | trait_browser/forms.py | UW-GAC/pie | train | 0 |
2995bab221ef9fd4fcf4aee4f976a3abd3c71946 | [
"self.screen_width = 1200\nself.screen_height = 800\nself.bg_color = (230, 230, 230)\nself.ship_limit = 3\nself.bullet_width = 3\nself.bullet_heigh = 15\nself.bullet_color = (60, 60, 60)\nself.bullet_allowed = 3\nself.speed_scale = 1.1\nself.score_scale = 1.5\nself.initialize_dynamic_setting()",
"self.ship_speed_... | <|body_start_0|>
self.screen_width = 1200
self.screen_height = 800
self.bg_color = (230, 230, 230)
self.ship_limit = 3
self.bullet_width = 3
self.bullet_heigh = 15
self.bullet_color = (60, 60, 60)
self.bullet_allowed = 3
self.speed_scale = 1.1
... | 存储 alien invasion 中的所有设置 | Settings | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Settings:
"""存储 alien invasion 中的所有设置"""
def __init__(self):
"""初始化游戏设置"""
<|body_0|>
def initialize_dynamic_setting(self):
"""初始化动态变量"""
<|body_1|>
def increase_speed(self):
"""提速!!!"""
<|body_2|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_75kplus_train_003014 | 1,490 | no_license | [
{
"docstring": "初始化游戏设置",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "初始化动态变量",
"name": "initialize_dynamic_setting",
"signature": "def initialize_dynamic_setting(self)"
},
{
"docstring": "提速!!!",
"name": "increase_speed",
"signature": "def in... | 3 | stack_v2_sparse_classes_30k_train_013009 | Implement the Python class `Settings` described below.
Class description:
存储 alien invasion 中的所有设置
Method signatures and docstrings:
- def __init__(self): 初始化游戏设置
- def initialize_dynamic_setting(self): 初始化动态变量
- def increase_speed(self): 提速!!! | Implement the Python class `Settings` described below.
Class description:
存储 alien invasion 中的所有设置
Method signatures and docstrings:
- def __init__(self): 初始化游戏设置
- def initialize_dynamic_setting(self): 初始化动态变量
- def increase_speed(self): 提速!!!
<|skeleton|>
class Settings:
"""存储 alien invasion 中的所有设置"""
def... | 3cad30bbfa55d7d489580e7390afb85badd50a54 | <|skeleton|>
class Settings:
"""存储 alien invasion 中的所有设置"""
def __init__(self):
"""初始化游戏设置"""
<|body_0|>
def initialize_dynamic_setting(self):
"""初始化动态变量"""
<|body_1|>
def increase_speed(self):
"""提速!!!"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Settings:
"""存储 alien invasion 中的所有设置"""
def __init__(self):
"""初始化游戏设置"""
self.screen_width = 1200
self.screen_height = 800
self.bg_color = (230, 230, 230)
self.ship_limit = 3
self.bullet_width = 3
self.bullet_heigh = 15
self.bullet_color =... | the_stack_v2_python_sparse | PythonCrashCourse/alien_invasion/settings.py | z2bns/MyOwnLearningJourney | train | 0 |
7a39b1b569ff74212a85c3533e495161c9b73281 | [
"self.name = []\nself.spatial = []\nself.spectral = []\nself.temporal = []",
"w = np.where(np.array(self.name).astype('str') == name)[0]\nif len(w) > 0:\n print('!!!! WARNING !!!! The source you are trying to add already exist.')\n print(' Doing nothing.')\nelse:\n self.name.append(name)... | <|body_start_0|>
self.name = []
self.spatial = []
self.spectral = []
self.temporal = []
<|end_body_0|>
<|body_start_1|>
w = np.where(np.array(self.name).astype('str') == name)[0]
if len(w) > 0:
print('!!!! WARNING !!!! The source you are trying to add already... | PointSource class. This class defines a PointSource object. This is a list of individual point source, with coresponding parameters. Attributes ---------- - name : the name of the sources - spatial : the spatial properties of the sources - spectral : the spectral properties of the sources - temporal : the temporal prop... | CompactSource | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CompactSource:
"""PointSource class. This class defines a PointSource object. This is a list of individual point source, with coresponding parameters. Attributes ---------- - name : the name of the sources - spatial : the spatial properties of the sources - spectral : the spectral properties of t... | stack_v2_sparse_classes_75kplus_train_003015 | 6,121 | no_license | [
{
"docstring": "Initialize the PointSource object. By default the list is empty. Parameters ---------- - name (str): the label of the source - coord (skycoord object): the coordinates of the source - spec_param (dict) : the spectral properties of the source - time_param (dict) : the temporal properties of the s... | 4 | stack_v2_sparse_classes_30k_train_024992 | Implement the Python class `CompactSource` described below.
Class description:
PointSource class. This class defines a PointSource object. This is a list of individual point source, with coresponding parameters. Attributes ---------- - name : the name of the sources - spatial : the spatial properties of the sources - ... | Implement the Python class `CompactSource` described below.
Class description:
PointSource class. This class defines a PointSource object. This is a list of individual point source, with coresponding parameters. Attributes ---------- - name : the name of the sources - spatial : the spatial properties of the sources - ... | 660125b16820e6b0dc85fc201595d21648e058d7 | <|skeleton|>
class CompactSource:
"""PointSource class. This class defines a PointSource object. This is a list of individual point source, with coresponding parameters. Attributes ---------- - name : the name of the sources - spatial : the spatial properties of the sources - spectral : the spectral properties of t... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CompactSource:
"""PointSource class. This class defines a PointSource object. This is a list of individual point source, with coresponding parameters. Attributes ---------- - name : the name of the sources - spatial : the spatial properties of the sources - spectral : the spectral properties of the sources - ... | the_stack_v2_python_sparse | Tools/compact_source.py | astroolka/ClusterPipe | train | 0 |
da1af5003dead7ee2619f6550db68c603373ecbd | [
"if archivo_modelo is not None:\n self.vectorizador = cargar_objeto(archivo_modelo)\nelse:\n self.vectorizador = doc2vec.Doc2Vec(vector_size=n_elementos, min_count=minima_cuenta, epochs=epocas, seed=semilla)",
"if isinstance(lista_textos, str):\n lista_textos = [lista_textos]\nfor i, linea in enumerate(l... | <|body_start_0|>
if archivo_modelo is not None:
self.vectorizador = cargar_objeto(archivo_modelo)
else:
self.vectorizador = doc2vec.Doc2Vec(vector_size=n_elementos, min_count=minima_cuenta, epochs=epocas, seed=semilla)
<|end_body_0|>
<|body_start_1|>
if isinstance(lista_... | VectorizadorDoc2Vec | [
"X11",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VectorizadorDoc2Vec:
def __init__(self, n_elementos=100, minima_cuenta=5, epocas=20, semilla=1, archivo_modelo=None):
"""Constructor de la clase `VectorizadorDoc2Vec`. Permite hacer vectorizaciones usando `Doc2Vec`. :param n_elementos: Hace referencia al número de elementos o característ... | stack_v2_sparse_classes_75kplus_train_003016 | 28,242 | permissive | [
{
"docstring": "Constructor de la clase `VectorizadorDoc2Vec`. Permite hacer vectorizaciones usando `Doc2Vec`. :param n_elementos: Hace referencia al número de elementos o características (columnas) en las matrices de salida. Valor por defecto `100`. :type n_elementos: int, opcional :param minima_cuenta: Frecue... | 5 | stack_v2_sparse_classes_30k_train_038796 | Implement the Python class `VectorizadorDoc2Vec` described below.
Class description:
Implement the VectorizadorDoc2Vec class.
Method signatures and docstrings:
- def __init__(self, n_elementos=100, minima_cuenta=5, epocas=20, semilla=1, archivo_modelo=None): Constructor de la clase `VectorizadorDoc2Vec`. Permite hace... | Implement the Python class `VectorizadorDoc2Vec` described below.
Class description:
Implement the VectorizadorDoc2Vec class.
Method signatures and docstrings:
- def __init__(self, n_elementos=100, minima_cuenta=5, epocas=20, semilla=1, archivo_modelo=None): Constructor de la clase `VectorizadorDoc2Vec`. Permite hace... | b6f7b22e4423769d6cc12d04049f3efa28593897 | <|skeleton|>
class VectorizadorDoc2Vec:
def __init__(self, n_elementos=100, minima_cuenta=5, epocas=20, semilla=1, archivo_modelo=None):
"""Constructor de la clase `VectorizadorDoc2Vec`. Permite hacer vectorizaciones usando `Doc2Vec`. :param n_elementos: Hace referencia al número de elementos o característ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class VectorizadorDoc2Vec:
def __init__(self, n_elementos=100, minima_cuenta=5, epocas=20, semilla=1, archivo_modelo=None):
"""Constructor de la clase `VectorizadorDoc2Vec`. Permite hacer vectorizaciones usando `Doc2Vec`. :param n_elementos: Hace referencia al número de elementos o características (columnas... | the_stack_v2_python_sparse | contexto/vectorizacion.py | Erik93sanches/ConTexto | train | 0 | |
4566edfc665af9d418fc8f243902a4308f34769f | [
"self.data_bounds = data_bounds\nself._tr = Range(from_bounds=NDC, to_bounds=self.data_bounds)\nself._tri = self._tr.inverse()\nself.set_nbins(nbinsx, nbinsy)",
"nbinsx = self._bins_margin * nbinsx if _is_integer(nbinsx) else self._default_nbinsx\nnbinsy = self._bins_margin * nbinsy if _is_integer(nbinsy) else se... | <|body_start_0|>
self.data_bounds = data_bounds
self._tr = Range(from_bounds=NDC, to_bounds=self.data_bounds)
self._tri = self._tr.inverse()
self.set_nbins(nbinsx, nbinsy)
<|end_body_0|>
<|body_start_1|>
nbinsx = self._bins_margin * nbinsx if _is_integer(nbinsx) else self._defau... | Determine the location of ticks in a view. Constructor ----------- nbinsx : int Number of ticks on the x axis. nbinsy : int Number of ticks on the y axis. data_bounds : 4-tuple Initial coordinates of the viewport, as (xmin, ymin, xmax, ymax), in data coordinates. These are the data coordinates of the lower left and upp... | AxisLocator | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AxisLocator:
"""Determine the location of ticks in a view. Constructor ----------- nbinsx : int Number of ticks on the x axis. nbinsy : int Number of ticks on the y axis. data_bounds : 4-tuple Initial coordinates of the viewport, as (xmin, ymin, xmax, ymax), in data coordinates. These are the dat... | stack_v2_sparse_classes_75kplus_train_003017 | 9,151 | permissive | [
{
"docstring": "data_bounds is the initial bounds of the view in data coordinates.",
"name": "__init__",
"signature": "def __init__(self, nbinsx=None, nbinsy=None, data_bounds=None)"
},
{
"docstring": "Change the number of bins on the x and y axes.",
"name": "set_nbins",
"signature": "de... | 4 | stack_v2_sparse_classes_30k_train_018193 | Implement the Python class `AxisLocator` described below.
Class description:
Determine the location of ticks in a view. Constructor ----------- nbinsx : int Number of ticks on the x axis. nbinsy : int Number of ticks on the y axis. data_bounds : 4-tuple Initial coordinates of the viewport, as (xmin, ymin, xmax, ymax),... | Implement the Python class `AxisLocator` described below.
Class description:
Determine the location of ticks in a view. Constructor ----------- nbinsx : int Number of ticks on the x axis. nbinsy : int Number of ticks on the y axis. data_bounds : 4-tuple Initial coordinates of the viewport, as (xmin, ymin, xmax, ymax),... | 642c875994b44618c3b3157d6e6f4425450813f8 | <|skeleton|>
class AxisLocator:
"""Determine the location of ticks in a view. Constructor ----------- nbinsx : int Number of ticks on the x axis. nbinsy : int Number of ticks on the y axis. data_bounds : 4-tuple Initial coordinates of the viewport, as (xmin, ymin, xmax, ymax), in data coordinates. These are the dat... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class AxisLocator:
"""Determine the location of ticks in a view. Constructor ----------- nbinsx : int Number of ticks on the x axis. nbinsy : int Number of ticks on the y axis. data_bounds : 4-tuple Initial coordinates of the viewport, as (xmin, ymin, xmax, ymax), in data coordinates. These are the data coordinates... | the_stack_v2_python_sparse | phy/plot/axes.py | cortex-lab/phy | train | 192 |
c6e43a48fbf63a2ad9d47381ec24f8af1f06ca76 | [
"self.scheduler = scheduler\nself.disposable = disposable\nself.is_disposed = False\nself.lock = config['concurrency'].RLock()\nsuper(ScheduledDisposable, self).__init__()",
"parent = self\n\ndef action(scheduler, state):\n \"\"\"Scheduled dispose action\"\"\"\n should_dispose = False\n with self.lock:\n... | <|body_start_0|>
self.scheduler = scheduler
self.disposable = disposable
self.is_disposed = False
self.lock = config['concurrency'].RLock()
super(ScheduledDisposable, self).__init__()
<|end_body_0|>
<|body_start_1|>
parent = self
def action(scheduler, state):
... | Represents a disposable resource whose disposal invocation will be scheduled on the specified Scheduler | ScheduledDisposable | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ScheduledDisposable:
"""Represents a disposable resource whose disposal invocation will be scheduled on the specified Scheduler"""
def __init__(self, scheduler, disposable):
"""Initializes a new instance of the ScheduledDisposable class that uses a Scheduler on which to dispose the d... | stack_v2_sparse_classes_75kplus_train_003018 | 1,123 | permissive | [
{
"docstring": "Initializes a new instance of the ScheduledDisposable class that uses a Scheduler on which to dispose the disposable.",
"name": "__init__",
"signature": "def __init__(self, scheduler, disposable)"
},
{
"docstring": "Disposes the wrapped disposable on the provided scheduler.",
... | 2 | null | Implement the Python class `ScheduledDisposable` described below.
Class description:
Represents a disposable resource whose disposal invocation will be scheduled on the specified Scheduler
Method signatures and docstrings:
- def __init__(self, scheduler, disposable): Initializes a new instance of the ScheduledDisposa... | Implement the Python class `ScheduledDisposable` described below.
Class description:
Represents a disposable resource whose disposal invocation will be scheduled on the specified Scheduler
Method signatures and docstrings:
- def __init__(self, scheduler, disposable): Initializes a new instance of the ScheduledDisposa... | 6b68d0069aef5bfed6ab40d1d5a94a3382b41619 | <|skeleton|>
class ScheduledDisposable:
"""Represents a disposable resource whose disposal invocation will be scheduled on the specified Scheduler"""
def __init__(self, scheduler, disposable):
"""Initializes a new instance of the ScheduledDisposable class that uses a Scheduler on which to dispose the d... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ScheduledDisposable:
"""Represents a disposable resource whose disposal invocation will be scheduled on the specified Scheduler"""
def __init__(self, scheduler, disposable):
"""Initializes a new instance of the ScheduledDisposable class that uses a Scheduler on which to dispose the disposable."""... | the_stack_v2_python_sparse | rx/disposables/scheduleddisposable.py | Sprytile/Sprytile | train | 860 |
3ab71a97991f147c5f54400ea288a8f42002c9aa | [
"super().__init__(reduction=reduction, name=name)\nself.pos_weight = pos_weight\nself.neg_weight = neg_weight\nself.from_logits = from_logits",
"y_true = K.flatten(y_true)\ny_pred = K.flatten(y_pred)\nmask = tf.not_equal(y_true, 0)\ny_true = tf.cast(y_true, y_pred.dtype)\ny_true_masked = tf.boolean_mask(y_true - ... | <|body_start_0|>
super().__init__(reduction=reduction, name=name)
self.pos_weight = pos_weight
self.neg_weight = neg_weight
self.from_logits = from_logits
<|end_body_0|>
<|body_start_1|>
y_true = K.flatten(y_true)
y_pred = K.flatten(y_pred)
mask = tf.not_equal(y_... | Version of `masked_binary_crossentropy` with class weights. A version of the binary cross-entropy loss function with masked labels and class weights. Classes labelled 0 in y_true are masked, those labelled 1 correspond to 0 in y_pred and those labelled 2 to 1 in y_pred (i.e. offset by -1). Class weightings are applied ... | WeightedMaskedBinaryCrossEntropy | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WeightedMaskedBinaryCrossEntropy:
"""Version of `masked_binary_crossentropy` with class weights. A version of the binary cross-entropy loss function with masked labels and class weights. Classes labelled 0 in y_true are masked, those labelled 1 correspond to 0 in y_pred and those labelled 2 to 1 ... | stack_v2_sparse_classes_75kplus_train_003019 | 5,273 | permissive | [
{
"docstring": "Initialise a `WeightedMaskedBinaryCrossEntropy` loss Parameters ---------- pos_weight : float Weight for positive class (labelled 2 in y_true). neg_weight : float Weight for negative class (labelled 1 in y_true). from_logits : bool Treat y_pred as logits rather than probabilities. reduction : Ke... | 3 | stack_v2_sparse_classes_30k_train_015925 | Implement the Python class `WeightedMaskedBinaryCrossEntropy` described below.
Class description:
Version of `masked_binary_crossentropy` with class weights. A version of the binary cross-entropy loss function with masked labels and class weights. Classes labelled 0 in y_true are masked, those labelled 1 correspond to... | Implement the Python class `WeightedMaskedBinaryCrossEntropy` described below.
Class description:
Version of `masked_binary_crossentropy` with class weights. A version of the binary cross-entropy loss function with masked labels and class weights. Classes labelled 0 in y_true are masked, those labelled 1 correspond to... | cfd0a32f11c733c52c2818b697077feb991ff788 | <|skeleton|>
class WeightedMaskedBinaryCrossEntropy:
"""Version of `masked_binary_crossentropy` with class weights. A version of the binary cross-entropy loss function with masked labels and class weights. Classes labelled 0 in y_true are masked, those labelled 1 correspond to 0 in y_pred and those labelled 2 to 1 ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class WeightedMaskedBinaryCrossEntropy:
"""Version of `masked_binary_crossentropy` with class weights. A version of the binary cross-entropy loss function with masked labels and class weights. Classes labelled 0 in y_true are masked, those labelled 1 correspond to 0 in y_pred and those labelled 2 to 1 in y_pred (i.... | the_stack_v2_python_sparse | sequence_unet/metrics.py | allydunham/sequence_unet | train | 16 |
1e31d43762e4fa63dc32a1b9216399a47d518d83 | [
"test_class = CLFMonitor('')\ntest_class.hit_average = {'current_hit_count': (AVERAGE_TRAFFIC_TOLERANCE + 1) * AVERAGE_TRAFFIC_INTERVAL, 'average_count': 0, 'last_taken': datetime.now() - timedelta(seconds=AVERAGE_TRAFFIC_INTERVAL + 10)}\ntest_class.update_average()\nself.assertTrue(test_class.high_traffic_mode)",
... | <|body_start_0|>
test_class = CLFMonitor('')
test_class.hit_average = {'current_hit_count': (AVERAGE_TRAFFIC_TOLERANCE + 1) * AVERAGE_TRAFFIC_INTERVAL, 'average_count': 0, 'last_taken': datetime.now() - timedelta(seconds=AVERAGE_TRAFFIC_INTERVAL + 10)}
test_class.update_average()
self.as... | Test the alert case. | TestAlerts | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestAlerts:
"""Test the alert case."""
def test_high_traffic_exceed(self):
"""Test to see if there is high traffic."""
<|body_0|>
def test_high_traffic_recede(self):
"""Test to see if the recession of traffic is understood."""
<|body_1|>
<|end_skeleton|>... | stack_v2_sparse_classes_75kplus_train_003020 | 1,696 | no_license | [
{
"docstring": "Test to see if there is high traffic.",
"name": "test_high_traffic_exceed",
"signature": "def test_high_traffic_exceed(self)"
},
{
"docstring": "Test to see if the recession of traffic is understood.",
"name": "test_high_traffic_recede",
"signature": "def test_high_traffi... | 2 | stack_v2_sparse_classes_30k_train_015933 | Implement the Python class `TestAlerts` described below.
Class description:
Test the alert case.
Method signatures and docstrings:
- def test_high_traffic_exceed(self): Test to see if there is high traffic.
- def test_high_traffic_recede(self): Test to see if the recession of traffic is understood. | Implement the Python class `TestAlerts` described below.
Class description:
Test the alert case.
Method signatures and docstrings:
- def test_high_traffic_exceed(self): Test to see if there is high traffic.
- def test_high_traffic_recede(self): Test to see if the recession of traffic is understood.
<|skeleton|>
clas... | 509e418042a54f314f74e5326d89c584aeecf171 | <|skeleton|>
class TestAlerts:
"""Test the alert case."""
def test_high_traffic_exceed(self):
"""Test to see if there is high traffic."""
<|body_0|>
def test_high_traffic_recede(self):
"""Test to see if the recession of traffic is understood."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestAlerts:
"""Test the alert case."""
def test_high_traffic_exceed(self):
"""Test to see if there is high traffic."""
test_class = CLFMonitor('')
test_class.hit_average = {'current_hit_count': (AVERAGE_TRAFFIC_TOLERANCE + 1) * AVERAGE_TRAFFIC_INTERVAL, 'average_count': 0, 'last_t... | the_stack_v2_python_sparse | pre2022/Datadog/interview/test_high_traffic_alerts.py | sinanm89/Interview-Questions | train | 1 |
bbcbc6137354e6fafe61f54a929babdec2ed7be8 | [
"super().__init__(data)\ntrack = config.get_option_from_section(consts.DisplayOptions.G2.value, 'track')\nself.display_options = self.DisplayOptions(track)",
"tmp_cpel = str(file.TempFileName())\ng2_path = config.get_option_from_section('g2', 'path')\ng2_path = os.path.expanduser(g2_path)\nlogger.info('G2 path: %... | <|body_start_0|>
super().__init__(data)
track = config.get_option_from_section(consts.DisplayOptions.G2.value, 'track')
self.display_options = self.DisplayOptions(track)
<|end_body_0|>
<|body_start_1|>
tmp_cpel = str(file.TempFileName())
g2_path = config.get_option_from_section(... | The class representing g2 windows. | G2 | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class G2:
"""The class representing g2 windows."""
def __init__(self, data):
"""Initialise the object. :param data: A `data_io.EventData` object that encapsulated the collected data we want to display using g2."""
<|body_0|>
def show(self):
"""Calls g2 to show a track ... | stack_v2_sparse_classes_75kplus_train_003021 | 2,628 | permissive | [
{
"docstring": "Initialise the object. :param data: A `data_io.EventData` object that encapsulated the collected data we want to display using g2.",
"name": "__init__",
"signature": "def __init__(self, data)"
},
{
"docstring": "Calls g2 to show a track separated graph. The conversion for the MAR... | 2 | stack_v2_sparse_classes_30k_train_025128 | Implement the Python class `G2` described below.
Class description:
The class representing g2 windows.
Method signatures and docstrings:
- def __init__(self, data): Initialise the object. :param data: A `data_io.EventData` object that encapsulated the collected data we want to display using g2.
- def show(self): Call... | Implement the Python class `G2` described below.
Class description:
The class representing g2 windows.
Method signatures and docstrings:
- def __init__(self, data): Initialise the object. :param data: A `data_io.EventData` object that encapsulated the collected data we want to display using g2.
- def show(self): Call... | d36c3203cefdd4690ba2ecf076e5e9fca05cbc80 | <|skeleton|>
class G2:
"""The class representing g2 windows."""
def __init__(self, data):
"""Initialise the object. :param data: A `data_io.EventData` object that encapsulated the collected data we want to display using g2."""
<|body_0|>
def show(self):
"""Calls g2 to show a track ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class G2:
"""The class representing g2 windows."""
def __init__(self, data):
"""Initialise the object. :param data: A `data_io.EventData` object that encapsulated the collected data we want to display using g2."""
super().__init__(data)
track = config.get_option_from_section(consts.Disp... | the_stack_v2_python_sparse | marple/display/interface/g2.py | ensoft/marple | train | 7 |
223ac648cfb9b99950a4d8f433345db1e6de34aa | [
"self.data = []\nself.figsize = figsize\nself.fig = plt.figure(figsize=self.figsize)\nself.ax = self.fig.add_subplot(1, 1, 1)\nplt.xlabel('Step')\nplt.ylabel('Reward')\nplt.gca().xaxis.set_major_locator(MaxNLocator(integer=True))\nplt.tight_layout()\nplt.show(block=False)\nself.line, = self.ax.plot(self.data)",
"... | <|body_start_0|>
self.data = []
self.figsize = figsize
self.fig = plt.figure(figsize=self.figsize)
self.ax = self.fig.add_subplot(1, 1, 1)
plt.xlabel('Step')
plt.ylabel('Reward')
plt.gca().xaxis.set_major_locator(MaxNLocator(integer=True))
plt.tight_layout... | A simple realtime plot to show the value of a discrete line. | RealtimePlot | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RealtimePlot:
"""A simple realtime plot to show the value of a discrete line."""
def __init__(self, figsize: tuple=(4, 4)) -> None:
"""Initialize a new realtime plot. Args: figsize: the size of the figure to draw Returns: None"""
<|body_0|>
def __call__(self, datum: floa... | stack_v2_sparse_classes_75kplus_train_003022 | 1,809 | permissive | [
{
"docstring": "Initialize a new realtime plot. Args: figsize: the size of the figure to draw Returns: None",
"name": "__init__",
"signature": "def __init__(self, figsize: tuple=(4, 4)) -> None"
},
{
"docstring": "Update the plot with a new piece of datum. Args: datum: the number to add to the p... | 2 | stack_v2_sparse_classes_30k_train_008032 | Implement the Python class `RealtimePlot` described below.
Class description:
A simple realtime plot to show the value of a discrete line.
Method signatures and docstrings:
- def __init__(self, figsize: tuple=(4, 4)) -> None: Initialize a new realtime plot. Args: figsize: the size of the figure to draw Returns: None
... | Implement the Python class `RealtimePlot` described below.
Class description:
A simple realtime plot to show the value of a discrete line.
Method signatures and docstrings:
- def __init__(self, figsize: tuple=(4, 4)) -> None: Initialize a new realtime plot. Args: figsize: the size of the figure to draw Returns: None
... | 87424d8813eac100d360ec2ce6df6dcf0e3ef9d3 | <|skeleton|>
class RealtimePlot:
"""A simple realtime plot to show the value of a discrete line."""
def __init__(self, figsize: tuple=(4, 4)) -> None:
"""Initialize a new realtime plot. Args: figsize: the size of the figure to draw Returns: None"""
<|body_0|>
def __call__(self, datum: floa... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RealtimePlot:
"""A simple realtime plot to show the value of a discrete line."""
def __init__(self, figsize: tuple=(4, 4)) -> None:
"""Initialize a new realtime plot. Args: figsize: the size of the figure to draw Returns: None"""
self.data = []
self.figsize = figsize
self.... | the_stack_v2_python_sparse | gym_tetris/_app/visualize/realtime_plot.py | Olloxan/gym-tetris | train | 0 |
cbf8b8f0f9d3e39546ace500cfb6e2e8eea78c1a | [
"cls = self.__class__\nself.provider = provider\nif provider is None:\n self.provider = ModelDataDualProvider(cn.GGENE_ID, constraints=constraints)\n self.provider.do()\nself.lines = ModelDataProvider.getLinesForRows(self.provider.df_X)\nself._is_plot = is_plot",
"XLIM = [-2, 2]\nYLIM = [-3.5, 3.5]\nunique_... | <|body_start_0|>
cls = self.__class__
self.provider = provider
if provider is None:
self.provider = ModelDataDualProvider(cn.GGENE_ID, constraints=constraints)
self.provider.do()
self.lines = ModelDataProvider.getLinesForRows(self.provider.df_X)
self._is_p... | PhenotypePlot | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PhenotypePlot:
def __init__(self, constraints=None, provider=None, is_plot=True):
""":param list-of-booleanFunction constraints: :param ModelDataDualProvider provider:"""
<|body_0|>
def scatter(self, parms=PlotParms(), is_errorbars=False, colors='bgry', legend=None):
... | stack_v2_sparse_classes_75kplus_train_003023 | 2,730 | permissive | [
{
"docstring": ":param list-of-booleanFunction constraints: :param ModelDataDualProvider provider:",
"name": "__init__",
"signature": "def __init__(self, constraints=None, provider=None, is_plot=True)"
},
{
"docstring": "Construct a scatter plot of RATE vs. YIELD coloring by line. :param PlotPar... | 3 | null | Implement the Python class `PhenotypePlot` described below.
Class description:
Implement the PhenotypePlot class.
Method signatures and docstrings:
- def __init__(self, constraints=None, provider=None, is_plot=True): :param list-of-booleanFunction constraints: :param ModelDataDualProvider provider:
- def scatter(self... | Implement the Python class `PhenotypePlot` described below.
Class description:
Implement the PhenotypePlot class.
Method signatures and docstrings:
- def __init__(self, constraints=None, provider=None, is_plot=True): :param list-of-booleanFunction constraints: :param ModelDataDualProvider provider:
- def scatter(self... | 704435e66c58677bab24f27820458870092924e2 | <|skeleton|>
class PhenotypePlot:
def __init__(self, constraints=None, provider=None, is_plot=True):
""":param list-of-booleanFunction constraints: :param ModelDataDualProvider provider:"""
<|body_0|>
def scatter(self, parms=PlotParms(), is_errorbars=False, colors='bgry', legend=None):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PhenotypePlot:
def __init__(self, constraints=None, provider=None, is_plot=True):
""":param list-of-booleanFunction constraints: :param ModelDataDualProvider provider:"""
cls = self.__class__
self.provider = provider
if provider is None:
self.provider = ModelDataDua... | the_stack_v2_python_sparse | microbepy/plot/phenotype_plot.py | ScienceStacks/microbepy | train | 1 | |
1fbe9e22e1320ee0332ec8a9a68baefb7870bf3c | [
"if not nums:\n return False\nhmap = {}\nfor i in range(len(nums)):\n if nums[i] in hmap:\n hmap[nums[i]].append(i)\n if hmap[nums[i]][-1] - hmap[nums[i]][-2] <= k:\n return True\n else:\n hmap[nums[i]] = [i]\nreturn False",
"if not nums:\n return False\nhmap = {}\nfor ... | <|body_start_0|>
if not nums:
return False
hmap = {}
for i in range(len(nums)):
if nums[i] in hmap:
hmap[nums[i]].append(i)
if hmap[nums[i]][-1] - hmap[nums[i]][-2] <= k:
return True
else:
hma... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def containsNearbyDuplicate1(self, nums, k):
""":type nums: List[int] :type k: int :rtype: bool"""
<|body_0|>
def containsNearbyDuplicate(self, nums, k):
""":type nums: List[int] :type k: int :rtype: bool"""
<|body_1|>
<|end_skeleton|>
<|body_star... | stack_v2_sparse_classes_75kplus_train_003024 | 1,342 | no_license | [
{
"docstring": ":type nums: List[int] :type k: int :rtype: bool",
"name": "containsNearbyDuplicate1",
"signature": "def containsNearbyDuplicate1(self, nums, k)"
},
{
"docstring": ":type nums: List[int] :type k: int :rtype: bool",
"name": "containsNearbyDuplicate",
"signature": "def conta... | 2 | stack_v2_sparse_classes_30k_train_032658 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def containsNearbyDuplicate1(self, nums, k): :type nums: List[int] :type k: int :rtype: bool
- def containsNearbyDuplicate(self, nums, k): :type nums: List[int] :type k: int :rty... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def containsNearbyDuplicate1(self, nums, k): :type nums: List[int] :type k: int :rtype: bool
- def containsNearbyDuplicate(self, nums, k): :type nums: List[int] :type k: int :rty... | 27e1a7dc757f4a254dc94dd16619e2f3d73895a7 | <|skeleton|>
class Solution:
def containsNearbyDuplicate1(self, nums, k):
""":type nums: List[int] :type k: int :rtype: bool"""
<|body_0|>
def containsNearbyDuplicate(self, nums, k):
""":type nums: List[int] :type k: int :rtype: bool"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def containsNearbyDuplicate1(self, nums, k):
""":type nums: List[int] :type k: int :rtype: bool"""
if not nums:
return False
hmap = {}
for i in range(len(nums)):
if nums[i] in hmap:
hmap[nums[i]].append(i)
if hma... | the_stack_v2_python_sparse | problems/219_Contains_Duplicate_II.py | johnnyshi1225/leetcode | train | 2 | |
8f6f38d668f7395138dce21cf56d7cb453ffbd98 | [
"ctx.save_for_backward(FM0, FM1)\nctx.d_max = d_max\nctx.stride = stride\nout = _ext.pointwise_correlation_forward(FM0, FM1, d_max, stride)\nreturn out",
"FM0, FM1 = ctx.saved_tensors\ngrad_FM0, grad_FM1 = _ext.pointwise_correlation_backward(grad_out, FM0, FM1, ctx.d_max, ctx.stride)\nreturn (grad_FM0, grad_FM1, ... | <|body_start_0|>
ctx.save_for_backward(FM0, FM1)
ctx.d_max = d_max
ctx.stride = stride
out = _ext.pointwise_correlation_forward(FM0, FM1, d_max, stride)
return out
<|end_body_0|>
<|body_start_1|>
FM0, FM1 = ctx.saved_tensors
grad_FM0, grad_FM1 = _ext.pointwise_co... | pointwise local correlations. see https://arxiv.org/abs/1710.03958 | PointwiseCorrelationFunction | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PointwiseCorrelationFunction:
"""pointwise local correlations. see https://arxiv.org/abs/1710.03958"""
def forward(ctx, FM0: Tensor, FM1: Tensor, d_max: int, stride: int) -> Tensor:
"""pointwise correlations between FM0 and FM1. Args: FM0: (|B|, C, H, W) feature map at time t. FM1: (... | stack_v2_sparse_classes_75kplus_train_003025 | 2,899 | no_license | [
{
"docstring": "pointwise correlations between FM0 and FM1. Args: FM0: (|B|, C, H, W) feature map at time t. FM1: (|B|, C, H, W) feature mat at time t+tau. d_max: maximum displacement. stride: stride between displacements. Returns: out: (|B|, H, W, (2d+1), (2d+1)) pointwise correlations.",
"name": "forward"... | 2 | stack_v2_sparse_classes_30k_train_041205 | Implement the Python class `PointwiseCorrelationFunction` described below.
Class description:
pointwise local correlations. see https://arxiv.org/abs/1710.03958
Method signatures and docstrings:
- def forward(ctx, FM0: Tensor, FM1: Tensor, d_max: int, stride: int) -> Tensor: pointwise correlations between FM0 and FM1... | Implement the Python class `PointwiseCorrelationFunction` described below.
Class description:
pointwise local correlations. see https://arxiv.org/abs/1710.03958
Method signatures and docstrings:
- def forward(ctx, FM0: Tensor, FM1: Tensor, d_max: int, stride: int) -> Tensor: pointwise correlations between FM0 and FM1... | 5790b8932f2e7b2727a7937dc656f589fa9ec1ac | <|skeleton|>
class PointwiseCorrelationFunction:
"""pointwise local correlations. see https://arxiv.org/abs/1710.03958"""
def forward(ctx, FM0: Tensor, FM1: Tensor, d_max: int, stride: int) -> Tensor:
"""pointwise correlations between FM0 and FM1. Args: FM0: (|B|, C, H, W) feature map at time t. FM1: (... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PointwiseCorrelationFunction:
"""pointwise local correlations. see https://arxiv.org/abs/1710.03958"""
def forward(ctx, FM0: Tensor, FM1: Tensor, d_max: int, stride: int) -> Tensor:
"""pointwise correlations between FM0 and FM1. Args: FM0: (|B|, C, H, W) feature map at time t. FM1: (|B|, C, H, W)... | the_stack_v2_python_sparse | detect_to_track/models/pointwise_correlation/pointwise_correlation.py | wxinbeings/detect-to-track | train | 1 |
6a57fffdb409a6b8e64f72b3fb76e340804a9358 | [
"if batch_max_steps % hop_size != 0:\n batch_max_steps += -(batch_max_steps % hop_size)\nassert batch_max_steps % hop_size == 0\nself.batch_max_steps = batch_max_steps\nself.batch_max_frames = batch_max_steps // hop_size\nself.hop_size = hop_size\nself.aux_context_window = aux_context_window\nself.start_offset =... | <|body_start_0|>
if batch_max_steps % hop_size != 0:
batch_max_steps += -(batch_max_steps % hop_size)
assert batch_max_steps % hop_size == 0
self.batch_max_steps = batch_max_steps
self.batch_max_frames = batch_max_steps // hop_size
self.hop_size = hop_size
sel... | Collate functor for training vocoders. | Clip | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Clip:
"""Collate functor for training vocoders."""
def __init__(self, batch_max_steps=20480, hop_size=256, aux_context_window=0):
"""Initialize customized collater for DataLoader. Args: batch_max_steps (int): The maximum length of input signal in batch. hop_size (int): Hop size of au... | stack_v2_sparse_classes_75kplus_train_003026 | 9,681 | permissive | [
{
"docstring": "Initialize customized collater for DataLoader. Args: batch_max_steps (int): The maximum length of input signal in batch. hop_size (int): Hop size of auxiliary features. aux_context_window (int): Context window size for auxiliary feature conv.",
"name": "__init__",
"signature": "def __ini... | 3 | null | Implement the Python class `Clip` described below.
Class description:
Collate functor for training vocoders.
Method signatures and docstrings:
- def __init__(self, batch_max_steps=20480, hop_size=256, aux_context_window=0): Initialize customized collater for DataLoader. Args: batch_max_steps (int): The maximum length... | Implement the Python class `Clip` described below.
Class description:
Collate functor for training vocoders.
Method signatures and docstrings:
- def __init__(self, batch_max_steps=20480, hop_size=256, aux_context_window=0): Initialize customized collater for DataLoader. Args: batch_max_steps (int): The maximum length... | 17854a04d43c231eff66bfed9d6aa55e94a29e79 | <|skeleton|>
class Clip:
"""Collate functor for training vocoders."""
def __init__(self, batch_max_steps=20480, hop_size=256, aux_context_window=0):
"""Initialize customized collater for DataLoader. Args: batch_max_steps (int): The maximum length of input signal in batch. hop_size (int): Hop size of au... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Clip:
"""Collate functor for training vocoders."""
def __init__(self, batch_max_steps=20480, hop_size=256, aux_context_window=0):
"""Initialize customized collater for DataLoader. Args: batch_max_steps (int): The maximum length of input signal in batch. hop_size (int): Hop size of auxiliary featu... | the_stack_v2_python_sparse | paddlespeech/t2s/datasets/vocoder_batch_fn.py | anniyanvr/DeepSpeech-1 | train | 0 |
16d5c13fe9713e83a50b237a68bcdfce220bbacc | [
"scheduler_instance = getattr(self, self._scheduler_field, None)\nif scheduler_instance is None:\n raise WechatyPluginError('there is an error')\nassert isinstance(scheduler_instance, AsyncIOScheduler)\nreturn scheduler_instance",
"if getattr(self, self._scheduler_field, None) is not None:\n raise WechatyPu... | <|body_start_0|>
scheduler_instance = getattr(self, self._scheduler_field, None)
if scheduler_instance is None:
raise WechatyPluginError('there is an error')
assert isinstance(scheduler_instance, AsyncIOScheduler)
return scheduler_instance
<|end_body_0|>
<|body_start_1|>
... | scheduler mixin for wechaty | WechatySchedulerMixin | [
"Apache-2.0",
"LicenseRef-scancode-free-unknown"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WechatySchedulerMixin:
"""scheduler mixin for wechaty"""
def scheduler(self) -> AsyncIOScheduler:
"""get the scheduler"""
<|body_0|>
def scheduler(self, scheduler_instance: AsyncIOScheduler) -> None:
"""set the scheduler Args: scheduler_instance (AsyncIOScheduler... | stack_v2_sparse_classes_75kplus_train_003027 | 35,609 | permissive | [
{
"docstring": "get the scheduler",
"name": "scheduler",
"signature": "def scheduler(self) -> AsyncIOScheduler"
},
{
"docstring": "set the scheduler Args: scheduler_instance (AsyncIOScheduler): the instance of the scheduler",
"name": "scheduler",
"signature": "def scheduler(self, schedul... | 4 | stack_v2_sparse_classes_30k_train_025809 | Implement the Python class `WechatySchedulerMixin` described below.
Class description:
scheduler mixin for wechaty
Method signatures and docstrings:
- def scheduler(self) -> AsyncIOScheduler: get the scheduler
- def scheduler(self, scheduler_instance: AsyncIOScheduler) -> None: set the scheduler Args: scheduler_insta... | Implement the Python class `WechatySchedulerMixin` described below.
Class description:
scheduler mixin for wechaty
Method signatures and docstrings:
- def scheduler(self) -> AsyncIOScheduler: get the scheduler
- def scheduler(self, scheduler_instance: AsyncIOScheduler) -> None: set the scheduler Args: scheduler_insta... | e9a04a98a3b01f287760e2d2a4514e4a80ecd15f | <|skeleton|>
class WechatySchedulerMixin:
"""scheduler mixin for wechaty"""
def scheduler(self) -> AsyncIOScheduler:
"""get the scheduler"""
<|body_0|>
def scheduler(self, scheduler_instance: AsyncIOScheduler) -> None:
"""set the scheduler Args: scheduler_instance (AsyncIOScheduler... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class WechatySchedulerMixin:
"""scheduler mixin for wechaty"""
def scheduler(self) -> AsyncIOScheduler:
"""get the scheduler"""
scheduler_instance = getattr(self, self._scheduler_field, None)
if scheduler_instance is None:
raise WechatyPluginError('there is an error')
... | the_stack_v2_python_sparse | src/wechaty/plugin.py | wechaty/python-wechaty | train | 1,266 |
2ca896048ca7bd589f7b9e2c6683912333343845 | [
"num_rows = args.get('rows') or 100\nquery = g.db.query(Machine)\nif args['realm'] == 'local':\n query = query.filter(Machine.realm == 'local', Machine.instance_name == args['instance_name'])\nelse:\n query = query.filter(Machine.realm == args['realm'], Machine.instance_name == args['instance_name'], Machine.... | <|body_start_0|>
num_rows = args.get('rows') or 100
query = g.db.query(Machine)
if args['realm'] == 'local':
query = query.filter(Machine.realm == 'local', Machine.instance_name == args['instance_name'])
else:
query = query.filter(Machine.realm == args['realm'], M... | The interface to battle server machines. Each physical machine (for example ec2 instance) has a machine resource here. Each machine resource has zero or more battle server resources. A machine is defined as a set of the parameters for the post call below. If an instance gets a new publicIP address for example, it will ... | MachinesAPI | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MachinesAPI:
"""The interface to battle server machines. Each physical machine (for example ec2 instance) has a machine resource here. Each machine resource has zero or more battle server resources. A machine is defined as a set of the parameters for the post call below. If an instance gets a new... | stack_v2_sparse_classes_75kplus_train_003028 | 10,491 | permissive | [
{
"docstring": "Get a list of machines",
"name": "get",
"signature": "def get(self, args)"
},
{
"docstring": "Register a machine",
"name": "post",
"signature": "def post(self, args)"
}
] | 2 | stack_v2_sparse_classes_30k_train_027355 | Implement the Python class `MachinesAPI` described below.
Class description:
The interface to battle server machines. Each physical machine (for example ec2 instance) has a machine resource here. Each machine resource has zero or more battle server resources. A machine is defined as a set of the parameters for the pos... | Implement the Python class `MachinesAPI` described below.
Class description:
The interface to battle server machines. Each physical machine (for example ec2 instance) has a machine resource here. Each machine resource has zero or more battle server resources. A machine is defined as a set of the parameters for the pos... | 2771bb46db7fd331448f9db3cfb257fab7f89bcc | <|skeleton|>
class MachinesAPI:
"""The interface to battle server machines. Each physical machine (for example ec2 instance) has a machine resource here. Each machine resource has zero or more battle server resources. A machine is defined as a set of the parameters for the post call below. If an instance gets a new... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MachinesAPI:
"""The interface to battle server machines. Each physical machine (for example ec2 instance) has a machine resource here. Each machine resource has zero or more battle server resources. A machine is defined as a set of the parameters for the post call below. If an instance gets a new publicIP add... | the_stack_v2_python_sparse | driftbase/api/machines.py | directivegames/drift-base | train | 1 |
2ef601b6b82a6cd9749b697cd4c42d0d4ce7c62e | [
"self.t = t0\nself.y = y0\nself.t_bound = t_bound\nself.step_size = stepsize\nself._fun = fun\nself.direction = 1 * (self.t_bound >= t0) - 1 * (not self.t_bound < t0)",
"if self.t >= self.t_bound and self.direction == 1 or (self.t <= self.t_bound and self.direction == -1):\n warnings.warn('Out of bounds set by... | <|body_start_0|>
self.t = t0
self.y = y0
self.t_bound = t_bound
self.step_size = stepsize
self._fun = fun
self.direction = 1 * (self.t_bound >= t0) - 1 * (not self.t_bound < t0)
<|end_body_0|>
<|body_start_1|>
if self.t >= self.t_bound and self.direction == 1 or ... | Class for Defining Runge-Kutta 4th Order ODE solving method | RK4naive | [
"LicenseRef-scancode-proprietary-license",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RK4naive:
"""Class for Defining Runge-Kutta 4th Order ODE solving method"""
def __init__(self, fun, t0, y0, t_bound, stepsize):
"""Initialization Parameters ---------- fun : function Should accept t, y as parameters, and return same type as y t0 : float Initial t y0 : ~numpy.array or... | stack_v2_sparse_classes_75kplus_train_003029 | 3,387 | permissive | [
{
"docstring": "Initialization Parameters ---------- fun : function Should accept t, y as parameters, and return same type as y t0 : float Initial t y0 : ~numpy.array or float Initial y t_bound : float Boundary time - the integration won't continue beyond it. It also determines the direction of the integration.... | 2 | stack_v2_sparse_classes_30k_train_013729 | Implement the Python class `RK4naive` described below.
Class description:
Class for Defining Runge-Kutta 4th Order ODE solving method
Method signatures and docstrings:
- def __init__(self, fun, t0, y0, t_bound, stepsize): Initialization Parameters ---------- fun : function Should accept t, y as parameters, and return... | Implement the Python class `RK4naive` described below.
Class description:
Class for Defining Runge-Kutta 4th Order ODE solving method
Method signatures and docstrings:
- def __init__(self, fun, t0, y0, t_bound, stepsize): Initialization Parameters ---------- fun : function Should accept t, y as parameters, and return... | 1bd1b27e142b0a0ec2e26bf2611468dbf50d9cf8 | <|skeleton|>
class RK4naive:
"""Class for Defining Runge-Kutta 4th Order ODE solving method"""
def __init__(self, fun, t0, y0, t_bound, stepsize):
"""Initialization Parameters ---------- fun : function Should accept t, y as parameters, and return same type as y t0 : float Initial t y0 : ~numpy.array or... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RK4naive:
"""Class for Defining Runge-Kutta 4th Order ODE solving method"""
def __init__(self, fun, t0, y0, t_bound, stepsize):
"""Initialization Parameters ---------- fun : function Should accept t, y as parameters, and return same type as y t0 : float Initial t y0 : ~numpy.array or float Initia... | the_stack_v2_python_sparse | src/einsteinpy/integrators/runge_kutta.py | einsteinpy/einsteinpy | train | 594 |
9b90b36c2bec9a4ac48b4f86ddd61635ec17ba97 | [
"res = True\nfor i in range(len(nums)):\n if nums[i] == 0:\n res = False\n for j in range(i):\n if nums[j] + j > i:\n res = True\n break\n if not res:\n return res\nreturn res",
"def helper(idx):\n if idx == 0:\n return True\n for i ... | <|body_start_0|>
res = True
for i in range(len(nums)):
if nums[i] == 0:
res = False
for j in range(i):
if nums[j] + j > i:
res = True
break
if not res:
return res
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def canJump(self, nums):
""":type nums: List[int] :rtype: bool"""
<|body_0|>
def canJump1(self, nums):
""":type nums: List[int] :rtype: bool"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
res = True
for i in range(len(nums)):
... | stack_v2_sparse_classes_75kplus_train_003030 | 895 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: bool",
"name": "canJump",
"signature": "def canJump(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: bool",
"name": "canJump1",
"signature": "def canJump1(self, nums)"
}
] | 2 | stack_v2_sparse_classes_30k_val_001248 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def canJump(self, nums): :type nums: List[int] :rtype: bool
- def canJump1(self, nums): :type nums: List[int] :rtype: bool | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def canJump(self, nums): :type nums: List[int] :rtype: bool
- def canJump1(self, nums): :type nums: List[int] :rtype: bool
<|skeleton|>
class Solution:
def canJump(self, nu... | f1d780b7e8b91b4df704651514018143c6931f9d | <|skeleton|>
class Solution:
def canJump(self, nums):
""":type nums: List[int] :rtype: bool"""
<|body_0|>
def canJump1(self, nums):
""":type nums: List[int] :rtype: bool"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def canJump(self, nums):
""":type nums: List[int] :rtype: bool"""
res = True
for i in range(len(nums)):
if nums[i] == 0:
res = False
for j in range(i):
if nums[j] + j > i:
res = True
... | the_stack_v2_python_sparse | ProgramForLeetCode/LeetCode/55_canJump.py | DQDH/Algorithm_Code | train | 0 | |
e833f9f54cb10e807ad46cb9139d30a2c6a3cd87 | [
"super(PickupShield, self).__init__()\nself.animation = GFX().pickups['shield']\nself.image = self.animation[0]\nself.rect = self.image.get_rect()\nself.rect.centerx = position[0]\nself.rect.centery = position[1]\nself.movement_speed = 0.1\nself.num_frames = len(self.animation)\nself.frame = 0\nself.timer = 0\nself... | <|body_start_0|>
super(PickupShield, self).__init__()
self.animation = GFX().pickups['shield']
self.image = self.animation[0]
self.rect = self.image.get_rect()
self.rect.centerx = position[0]
self.rect.centery = position[1]
self.movement_speed = 0.1
self.n... | PickupShield | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PickupShield:
def __init__(self, position):
"""Adds lives or score to player when touched, moves down the level. :param position: list x,y where pickup should spawn"""
<|body_0|>
def update(self, dt):
"""Update movement and animation"""
<|body_1|>
def pi... | stack_v2_sparse_classes_75kplus_train_003031 | 1,619 | permissive | [
{
"docstring": "Adds lives or score to player when touched, moves down the level. :param position: list x,y where pickup should spawn",
"name": "__init__",
"signature": "def __init__(self, position)"
},
{
"docstring": "Update movement and animation",
"name": "update",
"signature": "def u... | 3 | stack_v2_sparse_classes_30k_train_017569 | Implement the Python class `PickupShield` described below.
Class description:
Implement the PickupShield class.
Method signatures and docstrings:
- def __init__(self, position): Adds lives or score to player when touched, moves down the level. :param position: list x,y where pickup should spawn
- def update(self, dt)... | Implement the Python class `PickupShield` described below.
Class description:
Implement the PickupShield class.
Method signatures and docstrings:
- def __init__(self, position): Adds lives or score to player when touched, moves down the level. :param position: list x,y where pickup should spawn
- def update(self, dt)... | 2d02242e136227e533a70a8f1921d2567379c2d2 | <|skeleton|>
class PickupShield:
def __init__(self, position):
"""Adds lives or score to player when touched, moves down the level. :param position: list x,y where pickup should spawn"""
<|body_0|>
def update(self, dt):
"""Update movement and animation"""
<|body_1|>
def pi... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PickupShield:
def __init__(self, position):
"""Adds lives or score to player when touched, moves down the level. :param position: list x,y where pickup should spawn"""
super(PickupShield, self).__init__()
self.animation = GFX().pickups['shield']
self.image = self.animation[0]
... | the_stack_v2_python_sparse | src/pickups.py | velezd/space-war-2027 | train | 0 | |
edb8e5be5423bf9b6dbb2eca318689671900fde9 | [
"self._calc = WazeRouteCalculator\nself.origin = origin\nself.destination = destination\nself.region = region\nself.include = include\nself.exclude = exclude\nself.realtime = realtime\nself.units = units\nself.duration = None\nself.distance = None\nself.route = None\nself.avoid_toll_roads = avoid_toll_roads\nself.a... | <|body_start_0|>
self._calc = WazeRouteCalculator
self.origin = origin
self.destination = destination
self.region = region
self.include = include
self.exclude = exclude
self.realtime = realtime
self.units = units
self.duration = None
self.d... | WazeTravelTime Data object. | WazeTravelTimeData | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WazeTravelTimeData:
"""WazeTravelTime Data object."""
def __init__(self, origin, destination, region, include, exclude, realtime, units, vehicle_type, avoid_toll_roads, avoid_subscription_roads, avoid_ferries):
"""Set up WazeRouteCalculator."""
<|body_0|>
def update(self... | stack_v2_sparse_classes_75kplus_train_003032 | 11,036 | permissive | [
{
"docstring": "Set up WazeRouteCalculator.",
"name": "__init__",
"signature": "def __init__(self, origin, destination, region, include, exclude, realtime, units, vehicle_type, avoid_toll_roads, avoid_subscription_roads, avoid_ferries)"
},
{
"docstring": "Update WazeRouteCalculator Sensor.",
... | 2 | stack_v2_sparse_classes_30k_train_003915 | Implement the Python class `WazeTravelTimeData` described below.
Class description:
WazeTravelTime Data object.
Method signatures and docstrings:
- def __init__(self, origin, destination, region, include, exclude, realtime, units, vehicle_type, avoid_toll_roads, avoid_subscription_roads, avoid_ferries): Set up WazeRo... | Implement the Python class `WazeTravelTimeData` described below.
Class description:
WazeTravelTime Data object.
Method signatures and docstrings:
- def __init__(self, origin, destination, region, include, exclude, realtime, units, vehicle_type, avoid_toll_roads, avoid_subscription_roads, avoid_ferries): Set up WazeRo... | ed4ab403deaed9e8c95e0db728477fcb012bf4fa | <|skeleton|>
class WazeTravelTimeData:
"""WazeTravelTime Data object."""
def __init__(self, origin, destination, region, include, exclude, realtime, units, vehicle_type, avoid_toll_roads, avoid_subscription_roads, avoid_ferries):
"""Set up WazeRouteCalculator."""
<|body_0|>
def update(self... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class WazeTravelTimeData:
"""WazeTravelTime Data object."""
def __init__(self, origin, destination, region, include, exclude, realtime, units, vehicle_type, avoid_toll_roads, avoid_subscription_roads, avoid_ferries):
"""Set up WazeRouteCalculator."""
self._calc = WazeRouteCalculator
sel... | the_stack_v2_python_sparse | homeassistant/components/waze_travel_time/sensor.py | tchellomello/home-assistant | train | 8 |
a81b6d9eccbd074b17a02cc3b33d0165adb47b40 | [
"if parser.values.user and parser.values.wiki and parser.values.passwd:\n try:\n self.dokuwiki = DokuWikiClient(parser.values.wiki, parser.values.user, parser.values.passwd, parser.values.http_basic_auth)\n except DokuWikiXMLRPCError as error:\n parser.error(error)\n except DokuWikiURLError a... | <|body_start_0|>
if parser.values.user and parser.values.wiki and parser.values.passwd:
try:
self.dokuwiki = DokuWikiClient(parser.values.wiki, parser.values.user, parser.values.passwd, parser.values.http_basic_auth)
except DokuWikiXMLRPCError as error:
pa... | Callback class used by the option parser. Instantiates a new DokuWikiClient. It retrieves and outputs the data for the specified callback. The callback is specified in the option parser. The option destination has to match a DokuWikiClient method. | Callback | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Callback:
"""Callback class used by the option parser. Instantiates a new DokuWikiClient. It retrieves and outputs the data for the specified callback. The callback is specified in the option parser. The option destination has to match a DokuWikiClient method."""
def __init__(self, option, o... | stack_v2_sparse_classes_75kplus_train_003033 | 17,297 | permissive | [
{
"docstring": "Initalize callback object.",
"name": "__init__",
"signature": "def __init__(self, option, opt_str, value, parser)"
},
{
"docstring": "Check if the additional arguments contain a Wiki page id.",
"name": "_get_page_id",
"signature": "def _get_page_id(self)"
},
{
"do... | 3 | stack_v2_sparse_classes_30k_val_002265 | Implement the Python class `Callback` described below.
Class description:
Callback class used by the option parser. Instantiates a new DokuWikiClient. It retrieves and outputs the data for the specified callback. The callback is specified in the option parser. The option destination has to match a DokuWikiClient metho... | Implement the Python class `Callback` described below.
Class description:
Callback class used by the option parser. Instantiates a new DokuWikiClient. It retrieves and outputs the data for the specified callback. The callback is specified in the option parser. The option destination has to match a DokuWikiClient metho... | de3ba9d85a3cce4fb9bba4881adff688ea8ee801 | <|skeleton|>
class Callback:
"""Callback class used by the option parser. Instantiates a new DokuWikiClient. It retrieves and outputs the data for the specified callback. The callback is specified in the option parser. The option destination has to match a DokuWikiClient method."""
def __init__(self, option, o... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Callback:
"""Callback class used by the option parser. Instantiates a new DokuWikiClient. It retrieves and outputs the data for the specified callback. The callback is specified in the option parser. The option destination has to match a DokuWikiClient method."""
def __init__(self, option, opt_str, value... | the_stack_v2_python_sparse | wiki/dokuwikixmlrpc.py | stlemme/python-dokuwiki-export | train | 1 |
a639412340c7c976da22e0ae2f1cb875ddf94df8 | [
"r = Round.query.get(round_id)\nif r is not None:\n c = Couple.query.get(couple_id)\n if c is not None:\n r.add_couple(c)\n return r.progress_data()\nabort(404, 'Unknown round_id')",
"r = Round.query.get(round_id)\nif r is not None:\n c = Couple.query.get(couple_id)\n if c is not None:\n... | <|body_start_0|>
r = Round.query.get(round_id)
if r is not None:
c = Couple.query.get(couple_id)
if c is not None:
r.add_couple(c)
return r.progress_data()
abort(404, 'Unknown round_id')
<|end_body_0|>
<|body_start_1|>
r = Round.qu... | RoundAPIProgressCoupleSpecific | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RoundAPIProgressCoupleSpecific:
def patch(self, round_id, couple_id):
"""Add a couple to a round"""
<|body_0|>
def delete(self, round_id, couple_id):
"""Remove a couple from a round"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
r = Round.query.get... | stack_v2_sparse_classes_75kplus_train_003034 | 25,303 | no_license | [
{
"docstring": "Add a couple to a round",
"name": "patch",
"signature": "def patch(self, round_id, couple_id)"
},
{
"docstring": "Remove a couple from a round",
"name": "delete",
"signature": "def delete(self, round_id, couple_id)"
}
] | 2 | stack_v2_sparse_classes_30k_train_053360 | Implement the Python class `RoundAPIProgressCoupleSpecific` described below.
Class description:
Implement the RoundAPIProgressCoupleSpecific class.
Method signatures and docstrings:
- def patch(self, round_id, couple_id): Add a couple to a round
- def delete(self, round_id, couple_id): Remove a couple from a round | Implement the Python class `RoundAPIProgressCoupleSpecific` described below.
Class description:
Implement the RoundAPIProgressCoupleSpecific class.
Method signatures and docstrings:
- def patch(self, round_id, couple_id): Add a couple to a round
- def delete(self, round_id, couple_id): Remove a couple from a round
<... | 079b109fd13683a31d1d632faa5ab72cf0e78ddf | <|skeleton|>
class RoundAPIProgressCoupleSpecific:
def patch(self, round_id, couple_id):
"""Add a couple to a round"""
<|body_0|>
def delete(self, round_id, couple_id):
"""Remove a couple from a round"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RoundAPIProgressCoupleSpecific:
def patch(self, round_id, couple_id):
"""Add a couple to a round"""
r = Round.query.get(round_id)
if r is not None:
c = Couple.query.get(couple_id)
if c is not None:
r.add_couple(c)
return r.progres... | the_stack_v2_python_sparse | backend/apis/round/apis.py | AlenAlic/DANCE | train | 0 | |
6552011a1bac4cf9c1be883ae4907f5822c63704 | [
"queryset = self.filter_queryset(self.get_queryset())\npage = self.paginate_queryset(queryset)\nif page is not None:\n serializer = self.get_serializer(page, many=True)\n return self.get_paginated_response(serializer.data[0])\nserializer = self.get_serializer(queryset, many=True)\nreturn Response(serializer.d... | <|body_start_0|>
queryset = self.filter_queryset(self.get_queryset())
page = self.paginate_queryset(queryset)
if page is not None:
serializer = self.get_serializer(page, many=True)
return self.get_paginated_response(serializer.data[0])
serializer = self.get_serial... | 用于进行 apk的版本控制。 对应 ApkVersion 模型,通过过滤器对不同的软件提供不同的接口。 提供返回某一apk的版本,或者返回某一apk的最新版本。 只有systemuser可以增加、修改、删除apk版本信息。 其他普通用户和未登录用户只有查看权限。 | ApkVersionViewSet | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ApkVersionViewSet:
"""用于进行 apk的版本控制。 对应 ApkVersion 模型,通过过滤器对不同的软件提供不同的接口。 提供返回某一apk的版本,或者返回某一apk的最新版本。 只有systemuser可以增加、修改、删除apk版本信息。 其他普通用户和未登录用户只有查看权限。"""
def newest_apk(self, request, *args, **kwargs):
"""自定义GET方法,以只读的方式,返回最新的 ApkVersion URL: http://www.zhuiyinggu.com:33333/apk/ap... | stack_v2_sparse_classes_75kplus_train_003035 | 2,795 | no_license | [
{
"docstring": "自定义GET方法,以只读的方式,返回最新的 ApkVersion URL: http://www.zhuiyinggu.com:33333/apk/apk_version/newest/",
"name": "newest_apk",
"signature": "def newest_apk(self, request, *args, **kwargs)"
},
{
"docstring": "覆写 update() 设置partial属性为True使其序列化时字段可以部分更新",
"name": "update",
"signature... | 2 | stack_v2_sparse_classes_30k_train_017138 | Implement the Python class `ApkVersionViewSet` described below.
Class description:
用于进行 apk的版本控制。 对应 ApkVersion 模型,通过过滤器对不同的软件提供不同的接口。 提供返回某一apk的版本,或者返回某一apk的最新版本。 只有systemuser可以增加、修改、删除apk版本信息。 其他普通用户和未登录用户只有查看权限。
Method signatures and docstrings:
- def newest_apk(self, request, *args, **kwargs): 自定义GET方法,以只读的方式,返回最... | Implement the Python class `ApkVersionViewSet` described below.
Class description:
用于进行 apk的版本控制。 对应 ApkVersion 模型,通过过滤器对不同的软件提供不同的接口。 提供返回某一apk的版本,或者返回某一apk的最新版本。 只有systemuser可以增加、修改、删除apk版本信息。 其他普通用户和未登录用户只有查看权限。
Method signatures and docstrings:
- def newest_apk(self, request, *args, **kwargs): 自定义GET方法,以只读的方式,返回最... | 99dd2e7f32c7f817de832b253b8ab5d6757cddba | <|skeleton|>
class ApkVersionViewSet:
"""用于进行 apk的版本控制。 对应 ApkVersion 模型,通过过滤器对不同的软件提供不同的接口。 提供返回某一apk的版本,或者返回某一apk的最新版本。 只有systemuser可以增加、修改、删除apk版本信息。 其他普通用户和未登录用户只有查看权限。"""
def newest_apk(self, request, *args, **kwargs):
"""自定义GET方法,以只读的方式,返回最新的 ApkVersion URL: http://www.zhuiyinggu.com:33333/apk/ap... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ApkVersionViewSet:
"""用于进行 apk的版本控制。 对应 ApkVersion 模型,通过过滤器对不同的软件提供不同的接口。 提供返回某一apk的版本,或者返回某一apk的最新版本。 只有systemuser可以增加、修改、删除apk版本信息。 其他普通用户和未登录用户只有查看权限。"""
def newest_apk(self, request, *args, **kwargs):
"""自定义GET方法,以只读的方式,返回最新的 ApkVersion URL: http://www.zhuiyinggu.com:33333/apk/apk_version/new... | the_stack_v2_python_sparse | zhuiyinggu/apps/apk_manage/views.py | AmirHuang/zhuiyinggu | train | 0 |
571bcf30e6b812b369cbd04484a6d5dc3f723c47 | [
"if len(s) == 1:\n return False\nmatches = ['()', '[]', '{}']\nmisses = []\nremover = self.removeMatches(s, matches)\nfor i in remover:\n misses.append(i)\nreturn not len(misses) or ('', '') in misses",
"miss = ''\nwhile any((match in s for match in matches)):\n for match in matches:\n s = s.repla... | <|body_start_0|>
if len(s) == 1:
return False
matches = ['()', '[]', '{}']
misses = []
remover = self.removeMatches(s, matches)
for i in remover:
misses.append(i)
return not len(misses) or ('', '') in misses
<|end_body_0|>
<|body_start_1|>
... | GeneratorSolution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GeneratorSolution:
def isValid(self, s: str) -> bool:
"""Check that open characters in a string are properly closed. --- Arguments: - s: str. A string of characters to check. Returns: - Boolean"""
<|body_0|>
def removeMatches(self, s: str, matches: List[str]) -> Generator:
... | stack_v2_sparse_classes_75kplus_train_003036 | 6,240 | permissive | [
{
"docstring": "Check that open characters in a string are properly closed. --- Arguments: - s: str. A string of characters to check. Returns: - Boolean",
"name": "isValid",
"signature": "def isValid(self, s: str) -> bool"
},
{
"docstring": "Remove matching characters from a string. --- Argument... | 2 | stack_v2_sparse_classes_30k_train_046523 | Implement the Python class `GeneratorSolution` described below.
Class description:
Implement the GeneratorSolution class.
Method signatures and docstrings:
- def isValid(self, s: str) -> bool: Check that open characters in a string are properly closed. --- Arguments: - s: str. A string of characters to check. Returns... | Implement the Python class `GeneratorSolution` described below.
Class description:
Implement the GeneratorSolution class.
Method signatures and docstrings:
- def isValid(self, s: str) -> bool: Check that open characters in a string are properly closed. --- Arguments: - s: str. A string of characters to check. Returns... | beb7278970a01e3428e721fc2d64782a1da26e82 | <|skeleton|>
class GeneratorSolution:
def isValid(self, s: str) -> bool:
"""Check that open characters in a string are properly closed. --- Arguments: - s: str. A string of characters to check. Returns: - Boolean"""
<|body_0|>
def removeMatches(self, s: str, matches: List[str]) -> Generator:
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GeneratorSolution:
def isValid(self, s: str) -> bool:
"""Check that open characters in a string are properly closed. --- Arguments: - s: str. A string of characters to check. Returns: - Boolean"""
if len(s) == 1:
return False
matches = ['()', '[]', '{}']
misses = []... | the_stack_v2_python_sparse | py/algorythms/leet/leetcode_0020_valid_parentheses_solutions.py | br3ndonland/algorithms | train | 2 | |
146ac2047a9cf5f5b91173bb242c75328f7319c6 | [
"self.n_threads = n_threads\nself.config = config\nself.environ = environ\nself.inq = Q.Queue()\nself.outq = Q.Queue()\nself.done = th.Event()\nself.error_handler = error_handler",
"for profile in profiles:\n for context in all_contexts(profile, self.environ):\n pprofile = populate_profile(profile, cont... | <|body_start_0|>
self.n_threads = n_threads
self.config = config
self.environ = environ
self.inq = Q.Queue()
self.outq = Q.Queue()
self.done = th.Event()
self.error_handler = error_handler
<|end_body_0|>
<|body_start_1|>
for profile in profiles:
... | Threaded requests. | ThreadedReq | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ThreadedReq:
"""Threaded requests."""
def __init__(self, n_threads, config, environ, error_handler=None):
"""constructor"""
<|body_0|>
def run(self, profiles):
"""Process all profiles: use do_responses to obtain results."""
<|body_1|>
def do_requests... | stack_v2_sparse_classes_75kplus_train_003037 | 2,279 | permissive | [
{
"docstring": "constructor",
"name": "__init__",
"signature": "def __init__(self, n_threads, config, environ, error_handler=None)"
},
{
"docstring": "Process all profiles: use do_responses to obtain results.",
"name": "run",
"signature": "def run(self, profiles)"
},
{
"docstring... | 4 | stack_v2_sparse_classes_30k_train_007919 | Implement the Python class `ThreadedReq` described below.
Class description:
Threaded requests.
Method signatures and docstrings:
- def __init__(self, n_threads, config, environ, error_handler=None): constructor
- def run(self, profiles): Process all profiles: use do_responses to obtain results.
- def do_requests(sel... | Implement the Python class `ThreadedReq` described below.
Class description:
Threaded requests.
Method signatures and docstrings:
- def __init__(self, n_threads, config, environ, error_handler=None): constructor
- def run(self, profiles): Process all profiles: use do_responses to obtain results.
- def do_requests(sel... | 6dcc4ca6ea0abd2767fcd51aae0d74b11427e157 | <|skeleton|>
class ThreadedReq:
"""Threaded requests."""
def __init__(self, n_threads, config, environ, error_handler=None):
"""constructor"""
<|body_0|>
def run(self, profiles):
"""Process all profiles: use do_responses to obtain results."""
<|body_1|>
def do_requests... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ThreadedReq:
"""Threaded requests."""
def __init__(self, n_threads, config, environ, error_handler=None):
"""constructor"""
self.n_threads = n_threads
self.config = config
self.environ = environ
self.inq = Q.Queue()
self.outq = Q.Queue()
self.done =... | the_stack_v2_python_sparse | pbutils/request/threaded_rec.py | phonybone/phonybone_utils | train | 0 |
45c29a7eefb56518fc7b467420fac13bec718a19 | [
"if visible_gpu_idx is not None:\n warnings.warn('we can not set the visible gpu idx like this')\nhvd.init()\ngpus = tf.config.experimental.list_physical_devices('GPU')\nfor gpu in gpus:\n tf.config.experimental.set_memory_growth(gpu, True)\nif gpus:\n tf.config.experimental.set_visible_devices(gpus[hvd.lo... | <|body_start_0|>
if visible_gpu_idx is not None:
warnings.warn('we can not set the visible gpu idx like this')
hvd.init()
gpus = tf.config.experimental.list_physical_devices('GPU')
for gpu in gpus:
tf.config.experimental.set_memory_growth(gpu, True)
if gpu... | A multi-processer solver based on Horovod | HorovodSolver | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HorovodSolver:
"""A multi-processer solver based on Horovod"""
def initialize_devices(visible_gpu_idx=None):
"""initialize hvd devices, should be called firstly"""
<|body_0|>
def train_step(self, samples):
"""train the model 1 step"""
<|body_1|>
def ... | stack_v2_sparse_classes_75kplus_train_003038 | 5,130 | permissive | [
{
"docstring": "initialize hvd devices, should be called firstly",
"name": "initialize_devices",
"signature": "def initialize_devices(visible_gpu_idx=None)"
},
{
"docstring": "train the model 1 step",
"name": "train_step",
"signature": "def train_step(self, samples)"
},
{
"docstr... | 4 | stack_v2_sparse_classes_30k_train_015991 | Implement the Python class `HorovodSolver` described below.
Class description:
A multi-processer solver based on Horovod
Method signatures and docstrings:
- def initialize_devices(visible_gpu_idx=None): initialize hvd devices, should be called firstly
- def train_step(self, samples): train the model 1 step
- def trai... | Implement the Python class `HorovodSolver` described below.
Class description:
A multi-processer solver based on Horovod
Method signatures and docstrings:
- def initialize_devices(visible_gpu_idx=None): initialize hvd devices, should be called firstly
- def train_step(self, samples): train the model 1 step
- def trai... | 702526fd60a444391f33a51321c279d9178c55fb | <|skeleton|>
class HorovodSolver:
"""A multi-processer solver based on Horovod"""
def initialize_devices(visible_gpu_idx=None):
"""initialize hvd devices, should be called firstly"""
<|body_0|>
def train_step(self, samples):
"""train the model 1 step"""
<|body_1|>
def ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class HorovodSolver:
"""A multi-processer solver based on Horovod"""
def initialize_devices(visible_gpu_idx=None):
"""initialize hvd devices, should be called firstly"""
if visible_gpu_idx is not None:
warnings.warn('we can not set the visible gpu idx like this')
hvd.init()
... | the_stack_v2_python_sparse | athena/horovod_main.py | Joefi/athena | train | 2 |
6d13594c616df7afaa64c093578aa4e4c3c64b01 | [
"dp = [0] * len(books)\ndp[0] = books[0][1]\nfor i, (w, h) in enumerate(books[1:], start=1):\n ti = i - 1\n mxh = h\n dp[i] = h + dp[ti]\n while ti > -1 and w + books[ti][0] <= shelf_width:\n mxh = max(mxh, books[ti][1])\n dp[i] = min(dp[i], mxh + (dp[ti - 1] if ti > 0 else 0))\n w ... | <|body_start_0|>
dp = [0] * len(books)
dp[0] = books[0][1]
for i, (w, h) in enumerate(books[1:], start=1):
ti = i - 1
mxh = h
dp[i] = h + dp[ti]
while ti > -1 and w + books[ti][0] <= shelf_width:
mxh = max(mxh, books[ti][1])
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def minHeightShelves(self, books, shelf_width):
""":type books: List[List[int]] :type shelf_width: int :rtype: int"""
<|body_0|>
def minHeightShelves2(self, books, shelf_width):
""":type books: List[List[int]] :type shelf_width: int :rtype: int"""
<... | stack_v2_sparse_classes_75kplus_train_003039 | 4,978 | no_license | [
{
"docstring": ":type books: List[List[int]] :type shelf_width: int :rtype: int",
"name": "minHeightShelves",
"signature": "def minHeightShelves(self, books, shelf_width)"
},
{
"docstring": ":type books: List[List[int]] :type shelf_width: int :rtype: int",
"name": "minHeightShelves2",
"s... | 2 | stack_v2_sparse_classes_30k_train_015354 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minHeightShelves(self, books, shelf_width): :type books: List[List[int]] :type shelf_width: int :rtype: int
- def minHeightShelves2(self, books, shelf_width): :type books: Li... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minHeightShelves(self, books, shelf_width): :type books: List[List[int]] :type shelf_width: int :rtype: int
- def minHeightShelves2(self, books, shelf_width): :type books: Li... | dbdb227e12f329e4ca064b338f1fbdca42f3a848 | <|skeleton|>
class Solution:
def minHeightShelves(self, books, shelf_width):
""":type books: List[List[int]] :type shelf_width: int :rtype: int"""
<|body_0|>
def minHeightShelves2(self, books, shelf_width):
""":type books: List[List[int]] :type shelf_width: int :rtype: int"""
<... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def minHeightShelves(self, books, shelf_width):
""":type books: List[List[int]] :type shelf_width: int :rtype: int"""
dp = [0] * len(books)
dp[0] = books[0][1]
for i, (w, h) in enumerate(books[1:], start=1):
ti = i - 1
mxh = h
dp[i]... | the_stack_v2_python_sparse | LC1105.py | Qiao-Liang/LeetCode | train | 0 | |
554036d7a7d6e1c93ffef90ec9aacd083710c9da | [
"self.opsim_version = opsim_version\nwith sqlite3.connect(opsim_db_file) as con:\n if opsim_version == 1:\n query = 'select obsHistID, descDitheredRA, descDitheredDec, filter from summary'\n if visit_range is not None:\n query += f' where {visit_range[0]} <= obsHistID and obsHistID <= {v... | <|body_start_0|>
self.opsim_version = opsim_version
with sqlite3.connect(opsim_db_file) as con:
if opsim_version == 1:
query = 'select obsHistID, descDitheredRA, descDitheredDec, filter from summary'
if visit_range is not None:
query += f' ... | Class to compute overlaps of sensor-visits with a sky map. | OverlapFinder | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OverlapFinder:
"""Class to compute overlaps of sensor-visits with a sky map."""
def __init__(self, opsim_db_file, skymap_polygons, seed=42, opsim_version=2, visit_range=None):
"""Parameters ---------- opsim_db_file : str OpSim database cadence file. skymap_polygons : SkyMapPolygons O... | stack_v2_sparse_classes_75kplus_train_003040 | 9,101 | permissive | [
{
"docstring": "Parameters ---------- opsim_db_file : str OpSim database cadence file. skymap_polygons : SkyMapPolygons Object containing the ConvexPolygons for the patches in the sky map. seed : int [42] Seed for the random number generator.",
"name": "__init__",
"signature": "def __init__(self, opsim_... | 2 | stack_v2_sparse_classes_30k_train_009655 | Implement the Python class `OverlapFinder` described below.
Class description:
Class to compute overlaps of sensor-visits with a sky map.
Method signatures and docstrings:
- def __init__(self, opsim_db_file, skymap_polygons, seed=42, opsim_version=2, visit_range=None): Parameters ---------- opsim_db_file : str OpSim ... | Implement the Python class `OverlapFinder` described below.
Class description:
Class to compute overlaps of sensor-visits with a sky map.
Method signatures and docstrings:
- def __init__(self, opsim_db_file, skymap_polygons, seed=42, opsim_version=2, visit_range=None): Parameters ---------- opsim_db_file : str OpSim ... | 926d1b7ed0e8ea89479893f1148f9ead1ccbcc9f | <|skeleton|>
class OverlapFinder:
"""Class to compute overlaps of sensor-visits with a sky map."""
def __init__(self, opsim_db_file, skymap_polygons, seed=42, opsim_version=2, visit_range=None):
"""Parameters ---------- opsim_db_file : str OpSim database cadence file. skymap_polygons : SkyMapPolygons O... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class OverlapFinder:
"""Class to compute overlaps of sensor-visits with a sky map."""
def __init__(self, opsim_db_file, skymap_polygons, seed=42, opsim_version=2, visit_range=None):
"""Parameters ---------- opsim_db_file : str OpSim database cadence file. skymap_polygons : SkyMapPolygons Object contain... | the_stack_v2_python_sparse | python/desc/gen3_workflow/resource_estimator/OverlapFinder.py | LSSTDESC/gen3_workflow | train | 9 |
11b3b7ba442e5925c518da045e01e48748e48c7e | [
"course_id = request.query_params.get('course_id')\ncomments = CoursesComments.objects.filter(course=course_id).order_by('-date')\nserializer = CourseCommentsGetSerializator(comments, many=True)\nreturn Response(serializer.data)",
"data_comment = request.data\nuser = YouYodaUser.objects.get(auth_token=request.hea... | <|body_start_0|>
course_id = request.query_params.get('course_id')
comments = CoursesComments.objects.filter(course=course_id).order_by('-date')
serializer = CourseCommentsGetSerializator(comments, many=True)
return Response(serializer.data)
<|end_body_0|>
<|body_start_1|>
data_... | Takes data from CoursesSerializator for view top rate courses | CourseComments | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CourseComments:
"""Takes data from CoursesSerializator for view top rate courses"""
def get(self, request):
"""Get course_id as params and filter comments"""
<|body_0|>
def post(self, request):
"""Push comment to db with CommentsPostSerializator"""
<|body... | stack_v2_sparse_classes_75kplus_train_003041 | 4,136 | no_license | [
{
"docstring": "Get course_id as params and filter comments",
"name": "get",
"signature": "def get(self, request)"
},
{
"docstring": "Push comment to db with CommentsPostSerializator",
"name": "post",
"signature": "def post(self, request)"
}
] | 2 | stack_v2_sparse_classes_30k_test_000990 | Implement the Python class `CourseComments` described below.
Class description:
Takes data from CoursesSerializator for view top rate courses
Method signatures and docstrings:
- def get(self, request): Get course_id as params and filter comments
- def post(self, request): Push comment to db with CommentsPostSerializa... | Implement the Python class `CourseComments` described below.
Class description:
Takes data from CoursesSerializator for view top rate courses
Method signatures and docstrings:
- def get(self, request): Get course_id as params and filter comments
- def post(self, request): Push comment to db with CommentsPostSerializa... | 62b4f1cc79b4c71cc44bb741fb20af066c7023a5 | <|skeleton|>
class CourseComments:
"""Takes data from CoursesSerializator for view top rate courses"""
def get(self, request):
"""Get course_id as params and filter comments"""
<|body_0|>
def post(self, request):
"""Push comment to db with CommentsPostSerializator"""
<|body... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CourseComments:
"""Takes data from CoursesSerializator for view top rate courses"""
def get(self, request):
"""Get course_id as params and filter comments"""
course_id = request.query_params.get('course_id')
comments = CoursesComments.objects.filter(course=course_id).order_by('-da... | the_stack_v2_python_sparse | backend/appsrc/views/comment.py | OleksandrHavrylchyk/YouYoda | train | 0 |
741c6773ee9da987a6884ccf683917d9f868c4c8 | [
"kwargs = super(NewbobRelative, cls).load_initial_kwargs_from_config(config)\nkwargs.update({'relativeErrorThreshold': config.float('newbob_relative_error_threshold', -0.01), 'learningRateDecayFactor': config.float('newbob_learning_rate_decay', 0.5)})\nreturn kwargs",
"super(NewbobRelative, self).__init__(**kwarg... | <|body_start_0|>
kwargs = super(NewbobRelative, cls).load_initial_kwargs_from_config(config)
kwargs.update({'relativeErrorThreshold': config.float('newbob_relative_error_threshold', -0.01), 'learningRateDecayFactor': config.float('newbob_learning_rate_decay', 0.5)})
return kwargs
<|end_body_0|>
... | NewbobRelative | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NewbobRelative:
def load_initial_kwargs_from_config(cls, config):
""":type config: Config.Config :rtype: dict[str]"""
<|body_0|>
def __init__(self, relativeErrorThreshold, learningRateDecayFactor, **kwargs):
""":param float defaultLearningRate: learning rate for epoc... | stack_v2_sparse_classes_75kplus_train_003042 | 19,323 | no_license | [
{
"docstring": ":type config: Config.Config :rtype: dict[str]",
"name": "load_initial_kwargs_from_config",
"signature": "def load_initial_kwargs_from_config(cls, config)"
},
{
"docstring": ":param float defaultLearningRate: learning rate for epoch 1+2 :type relativeErrorThreshold: float :type le... | 3 | stack_v2_sparse_classes_30k_train_035213 | Implement the Python class `NewbobRelative` described below.
Class description:
Implement the NewbobRelative class.
Method signatures and docstrings:
- def load_initial_kwargs_from_config(cls, config): :type config: Config.Config :rtype: dict[str]
- def __init__(self, relativeErrorThreshold, learningRateDecayFactor, ... | Implement the Python class `NewbobRelative` described below.
Class description:
Implement the NewbobRelative class.
Method signatures and docstrings:
- def load_initial_kwargs_from_config(cls, config): :type config: Config.Config :rtype: dict[str]
- def __init__(self, relativeErrorThreshold, learningRateDecayFactor, ... | d494b3041069d377d6a7a9c296a14334f2fa5acc | <|skeleton|>
class NewbobRelative:
def load_initial_kwargs_from_config(cls, config):
""":type config: Config.Config :rtype: dict[str]"""
<|body_0|>
def __init__(self, relativeErrorThreshold, learningRateDecayFactor, **kwargs):
""":param float defaultLearningRate: learning rate for epoc... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class NewbobRelative:
def load_initial_kwargs_from_config(cls, config):
""":type config: Config.Config :rtype: dict[str]"""
kwargs = super(NewbobRelative, cls).load_initial_kwargs_from_config(config)
kwargs.update({'relativeErrorThreshold': config.float('newbob_relative_error_threshold', -0.... | the_stack_v2_python_sparse | python/rwth-i6_returnn/returnn-master/LearningRateControl.py | LiuFang816/SALSTM_py_data | train | 10 | |
0b63cea36cb8c595f61f9c440a4895e229cc0e7f | [
"strings = doc.elementsByTagName('string')\nfor i in range(strings.count()):\n strings.item(i).toElement().setAttribute('notr', 'true')\nreturn doc",
"file = QtCore.QFile(filename)\nif not file.open(QtCore.QFile.ReadOnly):\n print(f'failed ot open file \"{filename}\"')\n sys.exit(-1)\ndoc = QtXml.QDomDoc... | <|body_start_0|>
strings = doc.elementsByTagName('string')
for i in range(strings.count()):
strings.item(i).toElement().setAttribute('notr', 'true')
return doc
<|end_body_0|>
<|body_start_1|>
file = QtCore.QFile(filename)
if not file.open(QtCore.QFile.ReadOnly):
... | docstring for QtDesigner_UiFile_Modifications. | QtDesigner_UiFile_Modifications | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class QtDesigner_UiFile_Modifications:
"""docstring for QtDesigner_UiFile_Modifications."""
def make_non_translatable(cls, doc):
"""removes the Translatable properties from all strings"""
<|body_0|>
def modify_ui_file(cls, filename='/path/of/your_file.ui'):
"""the main... | stack_v2_sparse_classes_75kplus_train_003043 | 2,596 | permissive | [
{
"docstring": "removes the Translatable properties from all strings",
"name": "make_non_translatable",
"signature": "def make_non_translatable(cls, doc)"
},
{
"docstring": "the main call function. Opens the file, loads it into XML, modifies it if needed, and then writes it back out.",
"name... | 2 | null | Implement the Python class `QtDesigner_UiFile_Modifications` described below.
Class description:
docstring for QtDesigner_UiFile_Modifications.
Method signatures and docstrings:
- def make_non_translatable(cls, doc): removes the Translatable properties from all strings
- def modify_ui_file(cls, filename='/path/of/you... | Implement the Python class `QtDesigner_UiFile_Modifications` described below.
Class description:
docstring for QtDesigner_UiFile_Modifications.
Method signatures and docstrings:
- def make_non_translatable(cls, doc): removes the Translatable properties from all strings
- def modify_ui_file(cls, filename='/path/of/you... | ff9e456eeb715fada3b40a0a7a1c7dd92aab4a6f | <|skeleton|>
class QtDesigner_UiFile_Modifications:
"""docstring for QtDesigner_UiFile_Modifications."""
def make_non_translatable(cls, doc):
"""removes the Translatable properties from all strings"""
<|body_0|>
def modify_ui_file(cls, filename='/path/of/your_file.ui'):
"""the main... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class QtDesigner_UiFile_Modifications:
"""docstring for QtDesigner_UiFile_Modifications."""
def make_non_translatable(cls, doc):
"""removes the Translatable properties from all strings"""
strings = doc.elementsByTagName('string')
for i in range(strings.count()):
strings.item... | the_stack_v2_python_sparse | src/pyphocorehelpers/scripts/programmatically_modiffy_ui_file.py | CommanderPho/pyPhoCoreHelpers | train | 1 |
2cc8c65f7ac3e9bcec99ca0d291f007fa6ca7e69 | [
"self.masterd_uid = GetUid(constants.MASTERD_USER, _getpwnam)\nself.masterd_gid = GetGid(constants.MASTERD_GROUP, _getgrnam)\nself.confd_uid = GetUid(constants.CONFD_USER, _getpwnam)\nself.confd_gid = GetGid(constants.CONFD_GROUP, _getgrnam)\nself.wconfd_uid = GetUid(constants.WCONFD_USER, _getpwnam)\nself.wconfd_g... | <|body_start_0|>
self.masterd_uid = GetUid(constants.MASTERD_USER, _getpwnam)
self.masterd_gid = GetGid(constants.MASTERD_GROUP, _getgrnam)
self.confd_uid = GetUid(constants.CONFD_USER, _getpwnam)
self.confd_gid = GetGid(constants.CONFD_GROUP, _getgrnam)
self.wconfd_uid = GetUid(... | Resolves Ganeti uids and gids by name. @ivar masterd_uid: The resolved uid of the masterd user @ivar masterd_gid: The resolved gid of the masterd group @ivar confd_uid: The resolved uid of the confd user @ivar confd_gid: The resolved gid of the confd group @ivar wconfd_uid: The resolved uid of the wconfd user @ivar wco... | GetentResolver | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GetentResolver:
"""Resolves Ganeti uids and gids by name. @ivar masterd_uid: The resolved uid of the masterd user @ivar masterd_gid: The resolved gid of the masterd group @ivar confd_uid: The resolved uid of the confd user @ivar confd_gid: The resolved gid of the confd group @ivar wconfd_uid: The... | stack_v2_sparse_classes_75kplus_train_003044 | 9,287 | permissive | [
{
"docstring": "Initialize the resolver.",
"name": "__init__",
"signature": "def __init__(self, _getpwnam=pwd.getpwnam, _getgrnam=grp.getgrnam)"
},
{
"docstring": "Looks which Ganeti user belongs to this uid. @param uid: The uid to lookup @returns The user name associated with that uid",
"na... | 5 | null | Implement the Python class `GetentResolver` described below.
Class description:
Resolves Ganeti uids and gids by name. @ivar masterd_uid: The resolved uid of the masterd user @ivar masterd_gid: The resolved gid of the masterd group @ivar confd_uid: The resolved uid of the confd user @ivar confd_gid: The resolved gid o... | Implement the Python class `GetentResolver` described below.
Class description:
Resolves Ganeti uids and gids by name. @ivar masterd_uid: The resolved uid of the masterd user @ivar masterd_gid: The resolved gid of the masterd group @ivar confd_uid: The resolved uid of the confd user @ivar confd_gid: The resolved gid o... | 456ea285a7583183c2c8e5bcffe9006ec8a9d658 | <|skeleton|>
class GetentResolver:
"""Resolves Ganeti uids and gids by name. @ivar masterd_uid: The resolved uid of the masterd user @ivar masterd_gid: The resolved gid of the masterd group @ivar confd_uid: The resolved uid of the confd user @ivar confd_gid: The resolved gid of the confd group @ivar wconfd_uid: The... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GetentResolver:
"""Resolves Ganeti uids and gids by name. @ivar masterd_uid: The resolved uid of the masterd user @ivar masterd_gid: The resolved gid of the masterd group @ivar confd_uid: The resolved uid of the confd user @ivar confd_gid: The resolved gid of the confd group @ivar wconfd_uid: The resolved uid... | the_stack_v2_python_sparse | lib/runtime.py | ganeti/ganeti | train | 465 |
dcb3401a9110b7c3383f2bb9d596bd8f0e54e97d | [
"outputs = sorted(StreamAlertOutput.get_all_outputs().keys())\nset_parser = generate_subparser(subparser, 'set', description=cls.description, help=cls.description, subcommand=True)\nset_parser.add_argument('service', choices=outputs, metavar='SERVICE', help='Create a new StreamAlert output for one of the available ... | <|body_start_0|>
outputs = sorted(StreamAlertOutput.get_all_outputs().keys())
set_parser = generate_subparser(subparser, 'set', description=cls.description, help=cls.description, subcommand=True)
set_parser.add_argument('service', choices=outputs, metavar='SERVICE', help='Create a new StreamAler... | OutputSetSubCommand | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OutputSetSubCommand:
def setup_subparser(cls, subparser):
"""Setup: manage.py output set [options] Args: outputs (list): List of available output services"""
<|body_0|>
def handler(cls, options, config):
"""Configure a new output for this service Args: options (argpa... | stack_v2_sparse_classes_75kplus_train_003045 | 19,044 | permissive | [
{
"docstring": "Setup: manage.py output set [options] Args: outputs (list): List of available output services",
"name": "setup_subparser",
"signature": "def setup_subparser(cls, subparser)"
},
{
"docstring": "Configure a new output for this service Args: options (argparse.Namespace): Basically a... | 2 | stack_v2_sparse_classes_30k_train_010800 | Implement the Python class `OutputSetSubCommand` described below.
Class description:
Implement the OutputSetSubCommand class.
Method signatures and docstrings:
- def setup_subparser(cls, subparser): Setup: manage.py output set [options] Args: outputs (list): List of available output services
- def handler(cls, option... | Implement the Python class `OutputSetSubCommand` described below.
Class description:
Implement the OutputSetSubCommand class.
Method signatures and docstrings:
- def setup_subparser(cls, subparser): Setup: manage.py output set [options] Args: outputs (list): List of available output services
- def handler(cls, option... | 75ba140d2e1aa6e903313d88326920adcb8bff45 | <|skeleton|>
class OutputSetSubCommand:
def setup_subparser(cls, subparser):
"""Setup: manage.py output set [options] Args: outputs (list): List of available output services"""
<|body_0|>
def handler(cls, options, config):
"""Configure a new output for this service Args: options (argpa... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class OutputSetSubCommand:
def setup_subparser(cls, subparser):
"""Setup: manage.py output set [options] Args: outputs (list): List of available output services"""
outputs = sorted(StreamAlertOutput.get_all_outputs().keys())
set_parser = generate_subparser(subparser, 'set', description=cls.d... | the_stack_v2_python_sparse | streamalert_cli/outputs/handler.py | avmi/streamalert | train | 0 | |
727b2ceaed4d461d6f589bf46d782654d59fa9d4 | [
"try:\n import IPython\nexcept ImportError:\n if willful:\n req_missing(['IPython'], 'use the IPython console')\n raise\nelse:\n site = self.context['site']\n nikola_site = self.context['nikola_site']\n conf = self.context['conf']\n commands = self.context['commands']\n IPython.embed(... | <|body_start_0|>
try:
import IPython
except ImportError:
if willful:
req_missing(['IPython'], 'use the IPython console')
raise
else:
site = self.context['site']
nikola_site = self.context['nikola_site']
conf ... | Start debugging console. | CommandConsole | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CommandConsole:
"""Start debugging console."""
def ipython(self, willful=True):
"""Run an IPython shell."""
<|body_0|>
def bpython(self, willful=True):
"""Run a bpython shell."""
<|body_1|>
def plain(self, willful=True):
"""Run a plain Python... | stack_v2_sparse_classes_75kplus_train_003046 | 5,906 | permissive | [
{
"docstring": "Run an IPython shell.",
"name": "ipython",
"signature": "def ipython(self, willful=True)"
},
{
"docstring": "Run a bpython shell.",
"name": "bpython",
"signature": "def bpython(self, willful=True)"
},
{
"docstring": "Run a plain Python shell.",
"name": "plain"... | 4 | stack_v2_sparse_classes_30k_train_002137 | Implement the Python class `CommandConsole` described below.
Class description:
Start debugging console.
Method signatures and docstrings:
- def ipython(self, willful=True): Run an IPython shell.
- def bpython(self, willful=True): Run a bpython shell.
- def plain(self, willful=True): Run a plain Python shell.
- def _... | Implement the Python class `CommandConsole` described below.
Class description:
Start debugging console.
Method signatures and docstrings:
- def ipython(self, willful=True): Run an IPython shell.
- def bpython(self, willful=True): Run a bpython shell.
- def plain(self, willful=True): Run a plain Python shell.
- def _... | 2b10e9952bac5a1119e6845c7a2c28273aca9775 | <|skeleton|>
class CommandConsole:
"""Start debugging console."""
def ipython(self, willful=True):
"""Run an IPython shell."""
<|body_0|>
def bpython(self, willful=True):
"""Run a bpython shell."""
<|body_1|>
def plain(self, willful=True):
"""Run a plain Python... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CommandConsole:
"""Start debugging console."""
def ipython(self, willful=True):
"""Run an IPython shell."""
try:
import IPython
except ImportError:
if willful:
req_missing(['IPython'], 'use the IPython console')
raise
els... | the_stack_v2_python_sparse | nikola/plugins/command/console.py | getnikola/nikola | train | 2,142 |
641545540bcfb7496d5a8ce06bae2ef61738eee0 | [
"tp = type(e)\ntb = e.__traceback__\ntraceback_str = 'Traceback (most recent call last):\\n' + ''.join(traceback.format_tb(tb))\ntry:\n attributes = e.get_attributes()\nexcept AttributeError:\n attributes = {}\nreturn (sy.serde.msgpack.serde._simplify(worker, tp.__name__), sy.serde.msgpack.serde._simplify(wor... | <|body_start_0|>
tp = type(e)
tb = e.__traceback__
traceback_str = 'Traceback (most recent call last):\n' + ''.join(traceback.format_tb(tb))
try:
attributes = e.get_attributes()
except AttributeError:
attributes = {}
return (sy.serde.msgpack.serde.... | Raised when calling get on a pointer to a tensor which does not allow get to be called on it. This can happen do to sensitivity being too high | GetNotPermittedError | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GetNotPermittedError:
"""Raised when calling get on a pointer to a tensor which does not allow get to be called on it. This can happen do to sensitivity being too high"""
def simplify(worker: 'sy.workers.AbstractWorker', e):
"""Serialize information about an Exception which was raise... | stack_v2_sparse_classes_75kplus_train_003047 | 15,166 | permissive | [
{
"docstring": "Serialize information about an Exception which was raised to forward it",
"name": "simplify",
"signature": "def simplify(worker: 'sy.workers.AbstractWorker', e)"
},
{
"docstring": "Detail and re-raise an Exception forwarded by another worker",
"name": "detail",
"signature... | 2 | stack_v2_sparse_classes_30k_train_039587 | Implement the Python class `GetNotPermittedError` described below.
Class description:
Raised when calling get on a pointer to a tensor which does not allow get to be called on it. This can happen do to sensitivity being too high
Method signatures and docstrings:
- def simplify(worker: 'sy.workers.AbstractWorker', e):... | Implement the Python class `GetNotPermittedError` described below.
Class description:
Raised when calling get on a pointer to a tensor which does not allow get to be called on it. This can happen do to sensitivity being too high
Method signatures and docstrings:
- def simplify(worker: 'sy.workers.AbstractWorker', e):... | cc4765bed880ad38a02505834f63df39e0815328 | <|skeleton|>
class GetNotPermittedError:
"""Raised when calling get on a pointer to a tensor which does not allow get to be called on it. This can happen do to sensitivity being too high"""
def simplify(worker: 'sy.workers.AbstractWorker', e):
"""Serialize information about an Exception which was raise... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class GetNotPermittedError:
"""Raised when calling get on a pointer to a tensor which does not allow get to be called on it. This can happen do to sensitivity being too high"""
def simplify(worker: 'sy.workers.AbstractWorker', e):
"""Serialize information about an Exception which was raised to forward ... | the_stack_v2_python_sparse | syft/exceptions.py | tudorcebere/PySyft | train | 2 |
553aa3e8e2e8bf366ec80caf2dfa415dc5e4c5e0 | [
"super(BasicBlock, self).__init__()\nself.downsample = downsample\nself._make_midout = nn.Sequential(nn.Conv2d(in_channels, out_channels, kernel_size=(3, 1), stride=(stride, 1), padding=(1, 0), bias=False), nn.BatchNorm2d(out_channels), nn.ReLU(inplace=True), nn.Conv2d(out_channels, out_channels, kernel_size=(1, 3)... | <|body_start_0|>
super(BasicBlock, self).__init__()
self.downsample = downsample
self._make_midout = nn.Sequential(nn.Conv2d(in_channels, out_channels, kernel_size=(3, 1), stride=(stride, 1), padding=(1, 0), bias=False), nn.BatchNorm2d(out_channels), nn.ReLU(inplace=True), nn.Conv2d(out_channels... | 用于ResNet18和34的残差块, 2个3x3的卷积优化为 2个(1*3 + 3*1) | BasicBlock | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BasicBlock:
"""用于ResNet18和34的残差块, 2个3x3的卷积优化为 2个(1*3 + 3*1)"""
def __init__(self, in_channels, out_channels, stride=1, downsample=None):
"""小残差块初始化 :param: in_channels 卷积层输入通道数 :param: out_channels 卷积层输出通道数 :param: stride 卷积层步长 :param: downsample 是否要调整, 为下采样网络结构"""
<|body_0|>... | stack_v2_sparse_classes_75kplus_train_003048 | 36,979 | no_license | [
{
"docstring": "小残差块初始化 :param: in_channels 卷积层输入通道数 :param: out_channels 卷积层输出通道数 :param: stride 卷积层步长 :param: downsample 是否要调整, 为下采样网络结构",
"name": "__init__",
"signature": "def __init__(self, in_channels, out_channels, stride=1, downsample=None)"
},
{
"docstring": "前向传播 :param: x 图片变量 return o... | 2 | stack_v2_sparse_classes_30k_train_002418 | Implement the Python class `BasicBlock` described below.
Class description:
用于ResNet18和34的残差块, 2个3x3的卷积优化为 2个(1*3 + 3*1)
Method signatures and docstrings:
- def __init__(self, in_channels, out_channels, stride=1, downsample=None): 小残差块初始化 :param: in_channels 卷积层输入通道数 :param: out_channels 卷积层输出通道数 :param: stride 卷积层步长... | Implement the Python class `BasicBlock` described below.
Class description:
用于ResNet18和34的残差块, 2个3x3的卷积优化为 2个(1*3 + 3*1)
Method signatures and docstrings:
- def __init__(self, in_channels, out_channels, stride=1, downsample=None): 小残差块初始化 :param: in_channels 卷积层输入通道数 :param: out_channels 卷积层输出通道数 :param: stride 卷积层步长... | 2a68fd854bc5b1806319dfc40e36e084f9c4c5d0 | <|skeleton|>
class BasicBlock:
"""用于ResNet18和34的残差块, 2个3x3的卷积优化为 2个(1*3 + 3*1)"""
def __init__(self, in_channels, out_channels, stride=1, downsample=None):
"""小残差块初始化 :param: in_channels 卷积层输入通道数 :param: out_channels 卷积层输出通道数 :param: stride 卷积层步长 :param: downsample 是否要调整, 为下采样网络结构"""
<|body_0|>... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class BasicBlock:
"""用于ResNet18和34的残差块, 2个3x3的卷积优化为 2个(1*3 + 3*1)"""
def __init__(self, in_channels, out_channels, stride=1, downsample=None):
"""小残差块初始化 :param: in_channels 卷积层输入通道数 :param: out_channels 卷积层输出通道数 :param: stride 卷积层步长 :param: downsample 是否要调整, 为下采样网络结构"""
super(BasicBlock, self)... | the_stack_v2_python_sparse | code_keh/2d/Pytorch_nets_channel1.py | ruichen9/3DCTLungDiseaseDiagnosis | train | 0 |
c182b8e97260b28b7a632be915b7e48b1c25373f | [
"self.canvas = canvas\nself.width = screenwidth\nself.height = screenheight\nc = lambda: random.randint(0, 255)\nself.color = '#%02x%02x%02x' % (c(), c(), c())\nself.xpos = random.randint(20, int(screenwidth) - 50)\nself.ypos = random.randint(20, int(screenheight) - 50)\nself.radius = random.randint(50, 150)\nself.... | <|body_start_0|>
self.canvas = canvas
self.width = screenwidth
self.height = screenheight
c = lambda: random.randint(0, 255)
self.color = '#%02x%02x%02x' % (c(), c(), c())
self.xpos = random.randint(20, int(screenwidth) - 50)
self.ypos = random.randint(20, int(scr... | Ball | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Ball:
def __init__(self, canvas, screenwidth, screenheight):
"""构建球的初始属性 :param canvas: 画布 :param screenwidth: 屏幕的宽度 :param screenheight: 屏幕的高度"""
<|body_0|>
def create_ball(self):
"""创建一个球, 颜色, 位置都是随机出现的 :return:"""
<|body_1|>
def move_ball(self):
... | stack_v2_sparse_classes_75kplus_train_003049 | 3,342 | no_license | [
{
"docstring": "构建球的初始属性 :param canvas: 画布 :param screenwidth: 屏幕的宽度 :param screenheight: 屏幕的高度",
"name": "__init__",
"signature": "def __init__(self, canvas, screenwidth, screenheight)"
},
{
"docstring": "创建一个球, 颜色, 位置都是随机出现的 :return:",
"name": "create_ball",
"signature": "def create_ba... | 3 | stack_v2_sparse_classes_30k_train_019429 | Implement the Python class `Ball` described below.
Class description:
Implement the Ball class.
Method signatures and docstrings:
- def __init__(self, canvas, screenwidth, screenheight): 构建球的初始属性 :param canvas: 画布 :param screenwidth: 屏幕的宽度 :param screenheight: 屏幕的高度
- def create_ball(self): 创建一个球, 颜色, 位置都是随机出现的 :retu... | Implement the Python class `Ball` described below.
Class description:
Implement the Ball class.
Method signatures and docstrings:
- def __init__(self, canvas, screenwidth, screenheight): 构建球的初始属性 :param canvas: 画布 :param screenwidth: 屏幕的宽度 :param screenheight: 屏幕的高度
- def create_ball(self): 创建一个球, 颜色, 位置都是随机出现的 :retu... | 838f1f821d1974fb9ed7945cf24b20520fc2c8dd | <|skeleton|>
class Ball:
def __init__(self, canvas, screenwidth, screenheight):
"""构建球的初始属性 :param canvas: 画布 :param screenwidth: 屏幕的宽度 :param screenheight: 屏幕的高度"""
<|body_0|>
def create_ball(self):
"""创建一个球, 颜色, 位置都是随机出现的 :return:"""
<|body_1|>
def move_ball(self):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Ball:
def __init__(self, canvas, screenwidth, screenheight):
"""构建球的初始属性 :param canvas: 画布 :param screenwidth: 屏幕的宽度 :param screenheight: 屏幕的高度"""
self.canvas = canvas
self.width = screenwidth
self.height = screenheight
c = lambda: random.randint(0, 255)
self.co... | the_stack_v2_python_sparse | items_actual/ScreenSaver.py | lj1064201288/python_dell_windows | train | 0 | |
f36544964ab2a32eec870eed70a41fc7979871be | [
"super().parse_command_line(argv)\nself.build_kernel_argv(self.extra_args)\nself.filenames_to_run = self.extra_args[:]",
"self.log.debug('jupyter run: initialize...')\nsuper().initialize(argv)\nJupyterConsoleApp.initialize(self)\nsignal.signal(signal.SIGINT, self.handle_sigint)\nself.init_kernel_info()",
"if se... | <|body_start_0|>
super().parse_command_line(argv)
self.build_kernel_argv(self.extra_args)
self.filenames_to_run = self.extra_args[:]
<|end_body_0|>
<|body_start_1|>
self.log.debug('jupyter run: initialize...')
super().initialize(argv)
JupyterConsoleApp.initialize(self)
... | An Jupyter Console app to run files. | RunApp | [
"BSD-3-Clause",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RunApp:
"""An Jupyter Console app to run files."""
def parse_command_line(self, argv=None):
"""Parse the command line arguments."""
<|body_0|>
def initialize(self, argv=None):
"""Initialize the app."""
<|body_1|>
def handle_sigint(self, *args):
... | stack_v2_sparse_classes_75kplus_train_003050 | 4,496 | permissive | [
{
"docstring": "Parse the command line arguments.",
"name": "parse_command_line",
"signature": "def parse_command_line(self, argv=None)"
},
{
"docstring": "Initialize the app.",
"name": "initialize",
"signature": "def initialize(self, argv=None)"
},
{
"docstring": "Handle SIGINT.... | 5 | stack_v2_sparse_classes_30k_train_025514 | Implement the Python class `RunApp` described below.
Class description:
An Jupyter Console app to run files.
Method signatures and docstrings:
- def parse_command_line(self, argv=None): Parse the command line arguments.
- def initialize(self, argv=None): Initialize the app.
- def handle_sigint(self, *args): Handle SI... | Implement the Python class `RunApp` described below.
Class description:
An Jupyter Console app to run files.
Method signatures and docstrings:
- def parse_command_line(self, argv=None): Parse the command line arguments.
- def initialize(self, argv=None): Initialize the app.
- def handle_sigint(self, *args): Handle SI... | f5042e35b945aded77b23470ead62d7eacefde92 | <|skeleton|>
class RunApp:
"""An Jupyter Console app to run files."""
def parse_command_line(self, argv=None):
"""Parse the command line arguments."""
<|body_0|>
def initialize(self, argv=None):
"""Initialize the app."""
<|body_1|>
def handle_sigint(self, *args):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RunApp:
"""An Jupyter Console app to run files."""
def parse_command_line(self, argv=None):
"""Parse the command line arguments."""
super().parse_command_line(argv)
self.build_kernel_argv(self.extra_args)
self.filenames_to_run = self.extra_args[:]
def initialize(self,... | the_stack_v2_python_sparse | contrib/python/jupyter-client/py3/jupyter_client/runapp.py | catboost/catboost | train | 8,012 |
ef4b802277d23ef6a454fee993b86a3bb6379e9c | [
"self.artifact_location = artifact_location\nself.artifact_payload = artifact_payload\nself.polling_interval = polling_interval\nself.polling_halted = polling_halted\nself.artifact = first_artifact\nself.artifact_retrieval_count = 1\nself.artifact_last_retrieved = datetime.datetime.utcnow()\nself.meta = self.artifa... | <|body_start_0|>
self.artifact_location = artifact_location
self.artifact_payload = artifact_payload
self.polling_interval = polling_interval
self.polling_halted = polling_halted
self.artifact = first_artifact
self.artifact_retrieval_count = 1
self.artifact_last_r... | ArtifactTracer | ArtifactTracer | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ArtifactTracer:
"""ArtifactTracer"""
def __init__(self, artifact_location, artifact_payload, polling_interval, polling_halted, first_artifact):
""":param artifact_location: (str) artifact location :param artifact_payload: (target_decisioning_engine.types.decisioning_artifact.Decision... | stack_v2_sparse_classes_75kplus_train_003051 | 11,531 | permissive | [
{
"docstring": ":param artifact_location: (str) artifact location :param artifact_payload: (target_decisioning_engine.types.decisioning_artifact.DecisioningArtifact) artifact :param polling_interval: (int) polling interval :param polling_halted: (bool) is polling currently paused :param first_artifact: (target_... | 3 | stack_v2_sparse_classes_30k_val_002078 | Implement the Python class `ArtifactTracer` described below.
Class description:
ArtifactTracer
Method signatures and docstrings:
- def __init__(self, artifact_location, artifact_payload, polling_interval, polling_halted, first_artifact): :param artifact_location: (str) artifact location :param artifact_payload: (targ... | Implement the Python class `ArtifactTracer` described below.
Class description:
ArtifactTracer
Method signatures and docstrings:
- def __init__(self, artifact_location, artifact_payload, polling_interval, polling_halted, first_artifact): :param artifact_location: (str) artifact location :param artifact_payload: (targ... | f3e9b1bb6c8e1984e3d758ab1fe1a71225ade13e | <|skeleton|>
class ArtifactTracer:
"""ArtifactTracer"""
def __init__(self, artifact_location, artifact_payload, polling_interval, polling_halted, first_artifact):
""":param artifact_location: (str) artifact location :param artifact_payload: (target_decisioning_engine.types.decisioning_artifact.Decision... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ArtifactTracer:
"""ArtifactTracer"""
def __init__(self, artifact_location, artifact_payload, polling_interval, polling_halted, first_artifact):
""":param artifact_location: (str) artifact location :param artifact_payload: (target_decisioning_engine.types.decisioning_artifact.DecisioningArtifact) ... | the_stack_v2_python_sparse | target_decisioning_engine/trace_provider.py | 5amfung/target-python-sdk | train | 0 |
56a0c0403512f509984909c748a90c54b5fd934f | [
"self.position = np.array([0, 0, 0])\nself.t = time.time()\ntry:\n self.sub = rospy.Subscriber('/firefly/odometry_sensor1/odometry', Odometry, self.odometry_callback, queue_size=1, tcp_nodelay=True)\n rospy.spin()\nexcept:\n print('problem subscribing to odometry topic')",
"if time >= 1.0 and time <= 2.0... | <|body_start_0|>
self.position = np.array([0, 0, 0])
self.t = time.time()
try:
self.sub = rospy.Subscriber('/firefly/odometry_sensor1/odometry', Odometry, self.odometry_callback, queue_size=1, tcp_nodelay=True)
rospy.spin()
except:
print('problem subsc... | intermittent_callback | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class intermittent_callback:
def __init__(self):
"""initialization"""
<|body_0|>
def get_flag(self, time):
"""generates a flag based on time"""
<|body_1|>
def odometry_callback(self, data):
"""get the odometry of the quadrotor"""
<|body_2|>
<|... | stack_v2_sparse_classes_75kplus_train_003052 | 1,822 | no_license | [
{
"docstring": "initialization",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "generates a flag based on time",
"name": "get_flag",
"signature": "def get_flag(self, time)"
},
{
"docstring": "get the odometry of the quadrotor",
"name": "odometry_call... | 3 | stack_v2_sparse_classes_30k_train_050378 | Implement the Python class `intermittent_callback` described below.
Class description:
Implement the intermittent_callback class.
Method signatures and docstrings:
- def __init__(self): initialization
- def get_flag(self, time): generates a flag based on time
- def odometry_callback(self, data): get the odometry of t... | Implement the Python class `intermittent_callback` described below.
Class description:
Implement the intermittent_callback class.
Method signatures and docstrings:
- def __init__(self): initialization
- def get_flag(self, time): generates a flag based on time
- def odometry_callback(self, data): get the odometry of t... | 255e573a42660420fa0d3ce6dac252df8d737c8c | <|skeleton|>
class intermittent_callback:
def __init__(self):
"""initialization"""
<|body_0|>
def get_flag(self, time):
"""generates a flag based on time"""
<|body_1|>
def odometry_callback(self, data):
"""get the odometry of the quadrotor"""
<|body_2|>
<|... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class intermittent_callback:
def __init__(self):
"""initialization"""
self.position = np.array([0, 0, 0])
self.t = time.time()
try:
self.sub = rospy.Subscriber('/firefly/odometry_sensor1/odometry', Odometry, self.odometry_callback, queue_size=1, tcp_nodelay=True)
... | the_stack_v2_python_sparse | geometric_controller/src/subscribing_check.py | indsy123/Quadrotor-Navigation-using-Receding-Horizon-planning | train | 3 | |
77eb92cca9d81aa92e7b39d928773174d538e53d | [
"if not change:\n obj.group = Group.objects.create(name='users - ' + obj.name)\n obj.officers_group = Group.objects.create(name='officers - ' + obj.name)\n obj.group.user_set.add(obj.main_user)\n obj.officers_group.user_set.add(obj.main_user)\n perms = ['add_c4cjob', 'delete_c4cjob', 'change_c4cjob',... | <|body_start_0|>
if not change:
obj.group = Group.objects.create(name='users - ' + obj.name)
obj.officers_group = Group.objects.create(name='officers - ' + obj.name)
obj.group.user_set.add(obj.main_user)
obj.officers_group.user_set.add(obj.main_user)
p... | C4CAdminBranch | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class C4CAdminBranch:
def save_model(self, request, obj, form, change):
"""Automatically creates the two groups needed by the new branch"""
<|body_0|>
def delete_model(self, request, obj):
"""Deletes the branch"""
<|body_1|>
def delete_selected(self, request, ... | stack_v2_sparse_classes_75kplus_train_003053 | 7,662 | no_license | [
{
"docstring": "Automatically creates the two groups needed by the new branch",
"name": "save_model",
"signature": "def save_model(self, request, obj, form, change)"
},
{
"docstring": "Deletes the branch",
"name": "delete_model",
"signature": "def delete_model(self, request, obj)"
},
... | 3 | null | Implement the Python class `C4CAdminBranch` described below.
Class description:
Implement the C4CAdminBranch class.
Method signatures and docstrings:
- def save_model(self, request, obj, form, change): Automatically creates the two groups needed by the new branch
- def delete_model(self, request, obj): Deletes the br... | Implement the Python class `C4CAdminBranch` described below.
Class description:
Implement the C4CAdminBranch class.
Method signatures and docstrings:
- def save_model(self, request, obj, form, change): Automatically creates the two groups needed by the new branch
- def delete_model(self, request, obj): Deletes the br... | 77c8eae04abd7b59fbb060897a3e7ef7d828d474 | <|skeleton|>
class C4CAdminBranch:
def save_model(self, request, obj, form, change):
"""Automatically creates the two groups needed by the new branch"""
<|body_0|>
def delete_model(self, request, obj):
"""Deletes the branch"""
<|body_1|>
def delete_selected(self, request, ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class C4CAdminBranch:
def save_model(self, request, obj, form, change):
"""Automatically creates the two groups needed by the new branch"""
if not change:
obj.group = Group.objects.create(name='users - ' + obj.name)
obj.officers_group = Group.objects.create(name='officers - '... | the_stack_v2_python_sparse | c4c_app/admin.py | madetaille/care4care | train | 0 | |
cbac572faec4bd92f3085989de816772a9b4bdb6 | [
"self.file_name = file_name\nself.extension = extension\nself.bs = BingSearch()\nself.results = []",
"companies = []\ntry:\n with open(self.file_name, 'rb') as csv_file:\n reader = csv.reader(csv_file, delimiter=',', quotechar='\"')\n for row in reader:\n if row[0].lower() == 'url':\n ... | <|body_start_0|>
self.file_name = file_name
self.extension = extension
self.bs = BingSearch()
self.results = []
<|end_body_0|>
<|body_start_1|>
companies = []
try:
with open(self.file_name, 'rb') as csv_file:
reader = csv.reader(csv_file, deli... | FileCrawler | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FileCrawler:
def __init__(self, file_name, extension):
"""Initialize file name, extension and BingSearch object."""
<|body_0|>
def get_companies(self):
"""Read specified file and return list of companies with metadata."""
<|body_1|>
def crawl(self):
... | stack_v2_sparse_classes_75kplus_train_003054 | 9,725 | no_license | [
{
"docstring": "Initialize file name, extension and BingSearch object.",
"name": "__init__",
"signature": "def __init__(self, file_name, extension)"
},
{
"docstring": "Read specified file and return list of companies with metadata.",
"name": "get_companies",
"signature": "def get_compani... | 3 | stack_v2_sparse_classes_30k_val_001792 | Implement the Python class `FileCrawler` described below.
Class description:
Implement the FileCrawler class.
Method signatures and docstrings:
- def __init__(self, file_name, extension): Initialize file name, extension and BingSearch object.
- def get_companies(self): Read specified file and return list of companies... | Implement the Python class `FileCrawler` described below.
Class description:
Implement the FileCrawler class.
Method signatures and docstrings:
- def __init__(self, file_name, extension): Initialize file name, extension and BingSearch object.
- def get_companies(self): Read specified file and return list of companies... | c8d6483f64edab6ee33e67b6ab159fcccae092f4 | <|skeleton|>
class FileCrawler:
def __init__(self, file_name, extension):
"""Initialize file name, extension and BingSearch object."""
<|body_0|>
def get_companies(self):
"""Read specified file and return list of companies with metadata."""
<|body_1|>
def crawl(self):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class FileCrawler:
def __init__(self, file_name, extension):
"""Initialize file name, extension and BingSearch object."""
self.file_name = file_name
self.extension = extension
self.bs = BingSearch()
self.results = []
def get_companies(self):
"""Read specified fil... | the_stack_v2_python_sparse | oocrawlers/file_finder.py | OpenOil-UG/oocrawlers | train | 3 | |
4b62a580f7f36a842d6abc1de65e3634314a8af2 | [
"self.persons = persons\nself.times = times\nself.status = []\nself.data = {}\nself.vote = defaultdict(list)\nfor person in self.persons:\n self.data[person] = self.data.get(person, 0) + 1\n if self.data[person] - 1 in self.vote and person in self.vote[self.data[person] - 1]:\n self.vote[self.data[pers... | <|body_start_0|>
self.persons = persons
self.times = times
self.status = []
self.data = {}
self.vote = defaultdict(list)
for person in self.persons:
self.data[person] = self.data.get(person, 0) + 1
if self.data[person] - 1 in self.vote and person i... | TopVotedCandidate | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TopVotedCandidate:
def __init__(self, persons, times):
""":type persons: List[int] :type times: List[int]"""
<|body_0|>
def qq(self, t):
""":type t: int :rtype: int"""
<|body_1|>
def q(self, t):
""":type t: int :rtype: int"""
<|body_2|>
... | stack_v2_sparse_classes_75kplus_train_003055 | 4,074 | permissive | [
{
"docstring": ":type persons: List[int] :type times: List[int]",
"name": "__init__",
"signature": "def __init__(self, persons, times)"
},
{
"docstring": ":type t: int :rtype: int",
"name": "qq",
"signature": "def qq(self, t)"
},
{
"docstring": ":type t: int :rtype: int",
"na... | 3 | stack_v2_sparse_classes_30k_test_001350 | Implement the Python class `TopVotedCandidate` described below.
Class description:
Implement the TopVotedCandidate class.
Method signatures and docstrings:
- def __init__(self, persons, times): :type persons: List[int] :type times: List[int]
- def qq(self, t): :type t: int :rtype: int
- def q(self, t): :type t: int :... | Implement the Python class `TopVotedCandidate` described below.
Class description:
Implement the TopVotedCandidate class.
Method signatures and docstrings:
- def __init__(self, persons, times): :type persons: List[int] :type times: List[int]
- def qq(self, t): :type t: int :rtype: int
- def q(self, t): :type t: int :... | 0dd67edca4e0b0323cb5a7239f02ea46383cd15a | <|skeleton|>
class TopVotedCandidate:
def __init__(self, persons, times):
""":type persons: List[int] :type times: List[int]"""
<|body_0|>
def qq(self, t):
""":type t: int :rtype: int"""
<|body_1|>
def q(self, t):
""":type t: int :rtype: int"""
<|body_2|>
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TopVotedCandidate:
def __init__(self, persons, times):
""":type persons: List[int] :type times: List[int]"""
self.persons = persons
self.times = times
self.status = []
self.data = {}
self.vote = defaultdict(list)
for person in self.persons:
s... | the_stack_v2_python_sparse | 911.online-election.py | windard/leeeeee | train | 0 | |
29fe1cb837431776190034c1ce443d52e818fe9d | [
"LP = self.calc_local_params_fast(Data, LP, nCoordAscentItersLP, convThrLP, doOnlySomeDocsLP)\nfor rep in xrange(nHardItersLP):\n LP = self.get_hard_word_variational(Data, LP)\n for d in xrange(Data.nDoc):\n start = Data.doc_range[d, 0]\n stop = Data.doc_range[d, 1]\n LP['DocTopicCount'][... | <|body_start_0|>
LP = self.calc_local_params_fast(Data, LP, nCoordAscentItersLP, convThrLP, doOnlySomeDocsLP)
for rep in xrange(nHardItersLP):
LP = self.get_hard_word_variational(Data, LP)
for d in xrange(Data.nDoc):
start = Data.doc_range[d, 0]
st... | HDPSoft2Hard | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HDPSoft2Hard:
def calc_local_params(self, Data, LP, nCoordAscentItersLP=20, convThrLP=0.01, nHardItersLP=1, doOnlySomeDocsLP=True, **kwargs):
"""Calculate document-specific quantities (E-step) using hard assignments. Alternate updates to two terms until convergence (1) Approx posterior o... | stack_v2_sparse_classes_75kplus_train_003056 | 6,039 | permissive | [
{
"docstring": "Calculate document-specific quantities (E-step) using hard assignments. Alternate updates to two terms until convergence (1) Approx posterior on topic-token assignment q(word_variational | word_token_variables) (2) Approx posterior on doc-topic probabilities q(doc_variational | document_topic_va... | 4 | stack_v2_sparse_classes_30k_test_000983 | Implement the Python class `HDPSoft2Hard` described below.
Class description:
Implement the HDPSoft2Hard class.
Method signatures and docstrings:
- def calc_local_params(self, Data, LP, nCoordAscentItersLP=20, convThrLP=0.01, nHardItersLP=1, doOnlySomeDocsLP=True, **kwargs): Calculate document-specific quantities (E-... | Implement the Python class `HDPSoft2Hard` described below.
Class description:
Implement the HDPSoft2Hard class.
Method signatures and docstrings:
- def calc_local_params(self, Data, LP, nCoordAscentItersLP=20, convThrLP=0.01, nHardItersLP=1, doOnlySomeDocsLP=True, **kwargs): Calculate document-specific quantities (E-... | 0d5de8fc3d680a2c79bd0e9384b506229787c74f | <|skeleton|>
class HDPSoft2Hard:
def calc_local_params(self, Data, LP, nCoordAscentItersLP=20, convThrLP=0.01, nHardItersLP=1, doOnlySomeDocsLP=True, **kwargs):
"""Calculate document-specific quantities (E-step) using hard assignments. Alternate updates to two terms until convergence (1) Approx posterior o... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class HDPSoft2Hard:
def calc_local_params(self, Data, LP, nCoordAscentItersLP=20, convThrLP=0.01, nHardItersLP=1, doOnlySomeDocsLP=True, **kwargs):
"""Calculate document-specific quantities (E-step) using hard assignments. Alternate updates to two terms until convergence (1) Approx posterior on topic-token ... | the_stack_v2_python_sparse | refinery/bnpy/bnpy-dev/bnpy/allocmodel/admix/HDPSoft2Hard.py | ajbloureiro/refinery | train | 0 | |
6669f046325fce1b723249070853479750b0712c | [
"wlt = {'win': 0, 'loss': 0, 'tie': 0}\nfor match in matches:\n match.unpack_json()\n if match.has_been_played():\n if match.winning_alliance == '':\n wlt['tie'] += 1\n elif team_key in match.alliances[match.winning_alliance]['teams']:\n wlt['win'] += 1\n else:\n ... | <|body_start_0|>
wlt = {'win': 0, 'loss': 0, 'tie': 0}
for match in matches:
match.unpack_json()
if match.has_been_played():
if match.winning_alliance == '':
wlt['tie'] += 1
elif team_key in match.alliances[match.winning_allianc... | Helper class for Events. | EventHelper | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EventHelper:
"""Helper class for Events."""
def getTeamWLTFromMatches(self, team_key, matches):
"""Given a team_key and some matches, find the Win Loss Tie."""
<|body_0|>
def getTeamWLT(self, team_key, event_key):
"""Given a team_key, and an event_key, find the W... | stack_v2_sparse_classes_75kplus_train_003057 | 2,660 | no_license | [
{
"docstring": "Given a team_key and some matches, find the Win Loss Tie.",
"name": "getTeamWLTFromMatches",
"signature": "def getTeamWLTFromMatches(self, team_key, matches)"
},
{
"docstring": "Given a team_key, and an event_key, find the Win Loss Tie.",
"name": "getTeamWLT",
"signature"... | 2 | stack_v2_sparse_classes_30k_train_042686 | Implement the Python class `EventHelper` described below.
Class description:
Helper class for Events.
Method signatures and docstrings:
- def getTeamWLTFromMatches(self, team_key, matches): Given a team_key and some matches, find the Win Loss Tie.
- def getTeamWLT(self, team_key, event_key): Given a team_key, and an ... | Implement the Python class `EventHelper` described below.
Class description:
Helper class for Events.
Method signatures and docstrings:
- def getTeamWLTFromMatches(self, team_key, matches): Given a team_key and some matches, find the Win Loss Tie.
- def getTeamWLT(self, team_key, event_key): Given a team_key, and an ... | b31040c33cbe80fac9b1bf5a2856defb9d3e189e | <|skeleton|>
class EventHelper:
"""Helper class for Events."""
def getTeamWLTFromMatches(self, team_key, matches):
"""Given a team_key and some matches, find the Win Loss Tie."""
<|body_0|>
def getTeamWLT(self, team_key, event_key):
"""Given a team_key, and an event_key, find the W... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class EventHelper:
"""Helper class for Events."""
def getTeamWLTFromMatches(self, team_key, matches):
"""Given a team_key and some matches, find the Win Loss Tie."""
wlt = {'win': 0, 'loss': 0, 'tie': 0}
for match in matches:
match.unpack_json()
if match.has_been... | the_stack_v2_python_sparse | helpers/event_helper.py | Apple101Review/the-blue-alliance | train | 0 |
d3d0fa5a5fb275115480ca085ef2a4ca5c824bfb | [
"lines = read_file('globalbss.info')\n\ndef mapper(l):\n items = l.strip().split()\n return (items[0][1:].upper(), items[1])\nreturn map(mapper, lines)",
"u_fl = filter(lambda f: not f.is_lib, fl)\nif docfg:\n _cg = cg()\n _cg.set_funcs(fl)\n il = _cg.visit(il)\nil = re.adjust_loclabel(il)\nre.reas... | <|body_start_0|>
lines = read_file('globalbss.info')
def mapper(l):
items = l.strip().split()
return (items[0][1:].upper(), items[1])
return map(mapper, lines)
<|end_body_0|>
<|body_start_1|>
u_fl = filter(lambda f: not f.is_lib, fl)
if docfg:
... | Code analysis skeleton | Analysis | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Analysis:
"""Code analysis skeleton"""
def global_bss():
"""Load external bss variable information"""
<|body_0|>
def analyze(il, fl, re, docfg=False):
"""Analyze code :param il: instruction list :param fl: function list :param re: symbol reconstruction object :pa... | stack_v2_sparse_classes_75kplus_train_003058 | 1,907 | no_license | [
{
"docstring": "Load external bss variable information",
"name": "global_bss",
"signature": "def global_bss()"
},
{
"docstring": "Analyze code :param il: instruction list :param fl: function list :param re: symbol reconstruction object :param docfg: True to evaluate call graph and cfg :return: [... | 3 | stack_v2_sparse_classes_30k_train_031432 | Implement the Python class `Analysis` described below.
Class description:
Code analysis skeleton
Method signatures and docstrings:
- def global_bss(): Load external bss variable information
- def analyze(il, fl, re, docfg=False): Analyze code :param il: instruction list :param fl: function list :param re: symbol reco... | Implement the Python class `Analysis` described below.
Class description:
Code analysis skeleton
Method signatures and docstrings:
- def global_bss(): Load external bss variable information
- def analyze(il, fl, re, docfg=False): Analyze code :param il: instruction list :param fl: function list :param re: symbol reco... | aff27a9f7281e76e935a5b085160038767363eed | <|skeleton|>
class Analysis:
"""Code analysis skeleton"""
def global_bss():
"""Load external bss variable information"""
<|body_0|>
def analyze(il, fl, re, docfg=False):
"""Analyze code :param il: instruction list :param fl: function list :param re: symbol reconstruction object :pa... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Analysis:
"""Code analysis skeleton"""
def global_bss():
"""Load external bss variable information"""
lines = read_file('globalbss.info')
def mapper(l):
items = l.strip().split()
return (items[0][1:].upper(), items[1])
return map(mapper, lines)
... | the_stack_v2_python_sparse | src/analysis/analysis_process.py | jimwangzx/adversarial-example----GNN-malware-Uroboros-ELF- | train | 0 |
603713d2a360516ff027e00865a7650f45099e93 | [
"func = self._module.empirical_covariance\ndata = self._data\ncovariance = func(data.values, *args, **kwargs)\ncovariance = self._constructor(covariance, index=data.columns, columns=data.columns)\nreturn covariance",
"func = self._module.ledoit_wolf\ndata = self._data\nshrunk_cov, shrinkage = func(data.values, *a... | <|body_start_0|>
func = self._module.empirical_covariance
data = self._data
covariance = func(data.values, *args, **kwargs)
covariance = self._constructor(covariance, index=data.columns, columns=data.columns)
return covariance
<|end_body_0|>
<|body_start_1|>
func = self.... | Accessor to ``sklearn.covariance``. | CovarianceMethods | [
"Python-2.0",
"Apache-2.0",
"BSD-3-Clause",
"LicenseRef-scancode-unknown"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CovarianceMethods:
"""Accessor to ``sklearn.covariance``."""
def empirical_covariance(self, *args, **kwargs):
"""Call ``sklearn.covariance.empirical_covariance`` using automatic mapping. - ``X``: ``ModelFrame.data``"""
<|body_0|>
def ledoit_wolf(self, *args, **kwargs):
... | stack_v2_sparse_classes_75kplus_train_003059 | 1,575 | permissive | [
{
"docstring": "Call ``sklearn.covariance.empirical_covariance`` using automatic mapping. - ``X``: ``ModelFrame.data``",
"name": "empirical_covariance",
"signature": "def empirical_covariance(self, *args, **kwargs)"
},
{
"docstring": "Call ``sklearn.covariance.ledoit_wolf`` using automatic mappi... | 3 | null | Implement the Python class `CovarianceMethods` described below.
Class description:
Accessor to ``sklearn.covariance``.
Method signatures and docstrings:
- def empirical_covariance(self, *args, **kwargs): Call ``sklearn.covariance.empirical_covariance`` using automatic mapping. - ``X``: ``ModelFrame.data``
- def ledoi... | Implement the Python class `CovarianceMethods` described below.
Class description:
Accessor to ``sklearn.covariance``.
Method signatures and docstrings:
- def empirical_covariance(self, *args, **kwargs): Call ``sklearn.covariance.empirical_covariance`` using automatic mapping. - ``X``: ``ModelFrame.data``
- def ledoi... | 2c9002f16bb5c265e0d14f4a2314c86eeaa35cb6 | <|skeleton|>
class CovarianceMethods:
"""Accessor to ``sklearn.covariance``."""
def empirical_covariance(self, *args, **kwargs):
"""Call ``sklearn.covariance.empirical_covariance`` using automatic mapping. - ``X``: ``ModelFrame.data``"""
<|body_0|>
def ledoit_wolf(self, *args, **kwargs):
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CovarianceMethods:
"""Accessor to ``sklearn.covariance``."""
def empirical_covariance(self, *args, **kwargs):
"""Call ``sklearn.covariance.empirical_covariance`` using automatic mapping. - ``X``: ``ModelFrame.data``"""
func = self._module.empirical_covariance
data = self._data
... | the_stack_v2_python_sparse | lib/python2.7/site-packages/pandas_ml/skaccessors/covariance.py | wangyum/Anaconda | train | 11 |
2f8be3e29d5f38fee2c29cec8682943e6b6c626a | [
"try:\n query = self.request.dbsession.query(models.Service)\n one = query.filter(models.Service.name == name).first()\n if one:\n one.url = baseurl(url)\n one.type = kwargs.get('type', 'WPS')\n one.purl = kwargs.get('purl', '')\n one._verify = int(kwargs.get('verify', 1))\n ... | <|body_start_0|>
try:
query = self.request.dbsession.query(models.Service)
one = query.filter(models.Service.name == name).first()
if one:
one.url = baseurl(url)
one.type = kwargs.get('type', 'WPS')
one.purl = kwargs.get('purl',... | Stores a services. It inserts or updates the service with a given name. | ServiceStore | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ServiceStore:
"""Stores a services. It inserts or updates the service with a given name."""
def save_service(self, name, url, *args, **kwargs):
"""Stores an OWS service in database (insert or update). :param name: A service name string. :param url: A URL string."""
<|body_0|>... | stack_v2_sparse_classes_75kplus_train_003060 | 3,805 | permissive | [
{
"docstring": "Stores an OWS service in database (insert or update). :param name: A service name string. :param url: A URL string.",
"name": "save_service",
"signature": "def save_service(self, name, url, *args, **kwargs)"
},
{
"docstring": "Removes service identified by name.",
"name": "de... | 6 | stack_v2_sparse_classes_30k_test_001136 | Implement the Python class `ServiceStore` described below.
Class description:
Stores a services. It inserts or updates the service with a given name.
Method signatures and docstrings:
- def save_service(self, name, url, *args, **kwargs): Stores an OWS service in database (insert or update). :param name: A service nam... | Implement the Python class `ServiceStore` described below.
Class description:
Stores a services. It inserts or updates the service with a given name.
Method signatures and docstrings:
- def save_service(self, name, url, *args, **kwargs): Stores an OWS service in database (insert or update). :param name: A service nam... | aca67f1fb7f9014ccb8718666b865287da7c61d5 | <|skeleton|>
class ServiceStore:
"""Stores a services. It inserts or updates the service with a given name."""
def save_service(self, name, url, *args, **kwargs):
"""Stores an OWS service in database (insert or update). :param name: A service name string. :param url: A URL string."""
<|body_0|>... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ServiceStore:
"""Stores a services. It inserts or updates the service with a given name."""
def save_service(self, name, url, *args, **kwargs):
"""Stores an OWS service in database (insert or update). :param name: A service name string. :param url: A URL string."""
try:
query ... | the_stack_v2_python_sparse | twitcher/store.py | bird-house/twitcher | train | 16 |
54482548e006f91520e0825a953e52077c717afe | [
"if self.file:\n return self.file.url\nelse:\n return ''",
"if not self.file or rendition_size == 'none':\n return self.file.url\nelse:\n return self.get_rendition('fill-{}'.format(rendition_size)).url"
] | <|body_start_0|>
if self.file:
return self.file.url
else:
return ''
<|end_body_0|>
<|body_start_1|>
if not self.file or rendition_size == 'none':
return self.file.url
else:
return self.get_rendition('fill-{}'.format(rendition_size)).url
<|... | WithApiRenditionMixin | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WithApiRenditionMixin:
def link(self):
"""link"""
<|body_0|>
def generate_and_get_rendition(self, rendition_size):
"""generate_and_get_rendition"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if self.file:
return self.file.url
e... | stack_v2_sparse_classes_75kplus_train_003061 | 516 | permissive | [
{
"docstring": "link",
"name": "link",
"signature": "def link(self)"
},
{
"docstring": "generate_and_get_rendition",
"name": "generate_and_get_rendition",
"signature": "def generate_and_get_rendition(self, rendition_size)"
}
] | 2 | stack_v2_sparse_classes_30k_train_040390 | Implement the Python class `WithApiRenditionMixin` described below.
Class description:
Implement the WithApiRenditionMixin class.
Method signatures and docstrings:
- def link(self): link
- def generate_and_get_rendition(self, rendition_size): generate_and_get_rendition | Implement the Python class `WithApiRenditionMixin` described below.
Class description:
Implement the WithApiRenditionMixin class.
Method signatures and docstrings:
- def link(self): link
- def generate_and_get_rendition(self, rendition_size): generate_and_get_rendition
<|skeleton|>
class WithApiRenditionMixin:
... | eba52a4e95110acff952ee901a2b16c27c65c96a | <|skeleton|>
class WithApiRenditionMixin:
def link(self):
"""link"""
<|body_0|>
def generate_and_get_rendition(self, rendition_size):
"""generate_and_get_rendition"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class WithApiRenditionMixin:
def link(self):
"""link"""
if self.file:
return self.file.url
else:
return ''
def generate_and_get_rendition(self, rendition_size):
"""generate_and_get_rendition"""
if not self.file or rendition_size == 'none':
... | the_stack_v2_python_sparse | wagtailapiimagerendition/models.py | nhsuk/wagtail-apiimagerendition | train | 4 | |
85916d336328f7f703a77cd71ba4db60f09c7734 | [
"if isinstance(key, int):\n return RouterAlert(key)\nif key not in RouterAlert._member_map_:\n return extend_enum(RouterAlert, key, default)\nreturn RouterAlert[key]",
"if not (isinstance(value, int) and 0 <= value <= 65535):\n raise ValueError('%r is not a valid %s' % (value, cls.__name__))\nif 70 <= va... | <|body_start_0|>
if isinstance(key, int):
return RouterAlert(key)
if key not in RouterAlert._member_map_:
return extend_enum(RouterAlert, key, default)
return RouterAlert[key]
<|end_body_0|>
<|body_start_1|>
if not (isinstance(value, int) and 0 <= value <= 65535)... | [RouterAlert] IPv6 Router Alert Option Values | RouterAlert | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RouterAlert:
"""[RouterAlert] IPv6 Router Alert Option Values"""
def get(key: 'int | str', default: 'int'=-1) -> 'RouterAlert':
"""Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:"""
<|body_0|>
def ... | stack_v2_sparse_classes_75kplus_train_003062 | 8,804 | permissive | [
{
"docstring": "Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:",
"name": "get",
"signature": "def get(key: 'int | str', default: 'int'=-1) -> 'RouterAlert'"
},
{
"docstring": "Lookup function used when value is not found.... | 2 | stack_v2_sparse_classes_30k_train_017693 | Implement the Python class `RouterAlert` described below.
Class description:
[RouterAlert] IPv6 Router Alert Option Values
Method signatures and docstrings:
- def get(key: 'int | str', default: 'int'=-1) -> 'RouterAlert': Backport support for original codes. Args: key: Key to get enum item. default: Default value if ... | Implement the Python class `RouterAlert` described below.
Class description:
[RouterAlert] IPv6 Router Alert Option Values
Method signatures and docstrings:
- def get(key: 'int | str', default: 'int'=-1) -> 'RouterAlert': Backport support for original codes. Args: key: Key to get enum item. default: Default value if ... | a6fe49ec58f09e105bec5a00fb66d9b3f22730d9 | <|skeleton|>
class RouterAlert:
"""[RouterAlert] IPv6 Router Alert Option Values"""
def get(key: 'int | str', default: 'int'=-1) -> 'RouterAlert':
"""Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:"""
<|body_0|>
def ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RouterAlert:
"""[RouterAlert] IPv6 Router Alert Option Values"""
def get(key: 'int | str', default: 'int'=-1) -> 'RouterAlert':
"""Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:"""
if isinstance(key, int):
... | the_stack_v2_python_sparse | pcapkit/const/ipv6/router_alert.py | JarryShaw/PyPCAPKit | train | 204 |
7e4f0ac9d705f08ffefab5ae0178bbb2940f29da | [
"\"\"\"输出关闭连接或断开连接的缘由信息,并随后终止reactor\"\"\"\nprint('关闭 connection: %s' % reason.getErrorMessage())\nreactor.stop()",
"\"\"\"在反应器无法建立时的缘由信息,并随后终止reactor\"\"\"\nprint('Connection failed: %s' % reason.getErrorMessage)\nreactor.stop()"
] | <|body_start_0|>
"""输出关闭连接或断开连接的缘由信息,并随后终止reactor"""
print('关闭 connection: %s' % reason.getErrorMessage())
reactor.stop()
<|end_body_0|>
<|body_start_1|>
"""在反应器无法建立时的缘由信息,并随后终止reactor"""
print('Connection failed: %s' % reason.getErrorMessage)
reactor.stop()
<|end_body_1... | 继承ClientFatory类的子类,用来管理连接 该子类实现连接关闭或连接错误时输出具体信息,并终止reactor | BasicClientFactory | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BasicClientFactory:
"""继承ClientFatory类的子类,用来管理连接 该子类实现连接关闭或连接错误时输出具体信息,并终止reactor"""
def clientConnectionLost(self, connector, reason):
"""重载父类方法"""
<|body_0|>
def clientConnectionFailed(self, connector, reason):
"""重载父类方法"""
<|body_1|>
<|end_skeleton|>
... | stack_v2_sparse_classes_75kplus_train_003063 | 1,840 | permissive | [
{
"docstring": "重载父类方法",
"name": "clientConnectionLost",
"signature": "def clientConnectionLost(self, connector, reason)"
},
{
"docstring": "重载父类方法",
"name": "clientConnectionFailed",
"signature": "def clientConnectionFailed(self, connector, reason)"
}
] | 2 | stack_v2_sparse_classes_30k_train_032431 | Implement the Python class `BasicClientFactory` described below.
Class description:
继承ClientFatory类的子类,用来管理连接 该子类实现连接关闭或连接错误时输出具体信息,并终止reactor
Method signatures and docstrings:
- def clientConnectionLost(self, connector, reason): 重载父类方法
- def clientConnectionFailed(self, connector, reason): 重载父类方法 | Implement the Python class `BasicClientFactory` described below.
Class description:
继承ClientFatory类的子类,用来管理连接 该子类实现连接关闭或连接错误时输出具体信息,并终止reactor
Method signatures and docstrings:
- def clientConnectionLost(self, connector, reason): 重载父类方法
- def clientConnectionFailed(self, connector, reason): 重载父类方法
<|skeleton|>
class... | f5bfe9b70062ff0e589c5e611b9dc8d3cc888582 | <|skeleton|>
class BasicClientFactory:
"""继承ClientFatory类的子类,用来管理连接 该子类实现连接关闭或连接错误时输出具体信息,并终止reactor"""
def clientConnectionLost(self, connector, reason):
"""重载父类方法"""
<|body_0|>
def clientConnectionFailed(self, connector, reason):
"""重载父类方法"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class BasicClientFactory:
"""继承ClientFatory类的子类,用来管理连接 该子类实现连接关闭或连接错误时输出具体信息,并终止reactor"""
def clientConnectionLost(self, connector, reason):
"""重载父类方法"""
"""输出关闭连接或断开连接的缘由信息,并随后终止reactor"""
print('关闭 connection: %s' % reason.getErrorMessage())
reactor.stop()
def clientConn... | the_stack_v2_python_sparse | code/twisted_basic/t3connectTCP_client.py | KEVINYZY/python_web_Crawler_DA_ML_DL | train | 0 |
23b31130b4832a2bc345131e56c86bf99e17af72 | [
"if not key or not len(key):\n raise ValueError('Key cannot be empty.')\nqry = 'INSERT INTO cc_cache(cache_key,cache_value) VALUES(%s,%s) ON DUPLICATE KEY UPDATE cache_value = %s;'\ndata = (key, value, value)\ntry:\n self.execute(qry, data, commit=True)\n return True\nexcept Exception as e:\n raise Exce... | <|body_start_0|>
if not key or not len(key):
raise ValueError('Key cannot be empty.')
qry = 'INSERT INTO cc_cache(cache_key,cache_value) VALUES(%s,%s) ON DUPLICATE KEY UPDATE cache_value = %s;'
data = (key, value, value)
try:
self.execute(qry, data, commit=True)
... | CacheHandler | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CacheHandler:
def set_cache_value(self, key: str, value: str) -> bool:
"""Creates a new cache entry in the cache. Values are overwritten for existing keys. Args: key: key in the cache value: value associated with the key Returns: bool: True on successful insert or False otherwise. Raises... | stack_v2_sparse_classes_75kplus_train_003064 | 2,941 | permissive | [
{
"docstring": "Creates a new cache entry in the cache. Values are overwritten for existing keys. Args: key: key in the cache value: value associated with the key Returns: bool: True on successful insert or False otherwise. Raises: ValueError: if key is None or empty",
"name": "set_cache_value",
"signat... | 2 | null | Implement the Python class `CacheHandler` described below.
Class description:
Implement the CacheHandler class.
Method signatures and docstrings:
- def set_cache_value(self, key: str, value: str) -> bool: Creates a new cache entry in the cache. Values are overwritten for existing keys. Args: key: key in the cache val... | Implement the Python class `CacheHandler` described below.
Class description:
Implement the CacheHandler class.
Method signatures and docstrings:
- def set_cache_value(self, key: str, value: str) -> bool: Creates a new cache entry in the cache. Values are overwritten for existing keys. Args: key: key in the cache val... | b0daad06df118d27e62e178e123170e8f189065e | <|skeleton|>
class CacheHandler:
def set_cache_value(self, key: str, value: str) -> bool:
"""Creates a new cache entry in the cache. Values are overwritten for existing keys. Args: key: key in the cache value: value associated with the key Returns: bool: True on successful insert or False otherwise. Raises... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class CacheHandler:
def set_cache_value(self, key: str, value: str) -> bool:
"""Creates a new cache entry in the cache. Values are overwritten for existing keys. Args: key: key in the cache value: value associated with the key Returns: bool: True on successful insert or False otherwise. Raises: ValueError: ... | the_stack_v2_python_sparse | cerebralcortex/core/data_manager/sql/cache_handler.py | brinnaebent/CerebralCortex-Kernel | train | 0 | |
368e026c820cd0581ee5d587db8669c564bb4c82 | [
"self.event_plotter_list = event_plotter_list\nself.n_points = len(event_plotter_list)\nself.views = view_list\nself.n_plots = len(view_list)",
"if same_scale:\n self.set_same_scale()\nif figsize is None:\n figsize = (1 + self.n_plots * 3, self.n_points * 3)\nfig, axs = plt.subplots(self.n_points, self.n_pl... | <|body_start_0|>
self.event_plotter_list = event_plotter_list
self.n_points = len(event_plotter_list)
self.views = view_list
self.n_plots = len(view_list)
<|end_body_0|>
<|body_start_1|>
if same_scale:
self.set_same_scale()
if figsize is None:
fig... | Class for plotting list of views at different points in instrument | PlotOverview | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PlotOverview:
"""Class for plotting list of views at different points in instrument"""
def __init__(self, event_plotter_list, view_list):
"""Stores list of event plotters and views, able to create figure parameters: event_plotter_list : list of EventPlotter objects EventPlotter objec... | stack_v2_sparse_classes_75kplus_train_003065 | 3,057 | permissive | [
{
"docstring": "Stores list of event plotters and views, able to create figure parameters: event_plotter_list : list of EventPlotter objects EventPlotter objects for each investigated point in instrument view_list : list of View objects View specifications which will all be used for each point",
"name": "__... | 3 | null | Implement the Python class `PlotOverview` described below.
Class description:
Class for plotting list of views at different points in instrument
Method signatures and docstrings:
- def __init__(self, event_plotter_list, view_list): Stores list of event plotters and views, able to create figure parameters: event_plott... | Implement the Python class `PlotOverview` described below.
Class description:
Class for plotting list of views at different points in instrument
Method signatures and docstrings:
- def __init__(self, event_plotter_list, view_list): Stores list of event plotters and views, able to create figure parameters: event_plott... | f8e17f34377cecf11914e23cb6fb7231baeae304 | <|skeleton|>
class PlotOverview:
"""Class for plotting list of views at different points in instrument"""
def __init__(self, event_plotter_list, view_list):
"""Stores list of event plotters and views, able to create figure parameters: event_plotter_list : list of EventPlotter objects EventPlotter objec... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PlotOverview:
"""Class for plotting list of views at different points in instrument"""
def __init__(self, event_plotter_list, view_list):
"""Stores list of event plotters and views, able to create figure parameters: event_plotter_list : list of EventPlotter objects EventPlotter objects for each i... | the_stack_v2_python_sparse | mcstasscript/instrument_diagnostics/plot_overview.py | PaNOSC-ViNYL/McStasScript | train | 8 |
7d7d37163c88858e4549c80b13bda84f2316794e | [
"if not head:\n return False\npointer1 = head\npointer2 = head\nwhile pointer1 is not None and pointer2 is not None:\n pointer1 = pointer1.next\n try:\n pointer2 = pointer2.next.next\n except Exception as e:\n return False\n if pointer1 == pointer2:\n return True\nreturn False",
... | <|body_start_0|>
if not head:
return False
pointer1 = head
pointer2 = head
while pointer1 is not None and pointer2 is not None:
pointer1 = pointer1.next
try:
pointer2 = pointer2.next.next
except Exception as e:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def hasCycle(self, head):
""":type head: ListNode :rtype: bool"""
<|body_0|>
def hasCycle2(self, head):
""":type head: ListNode :rtype: bool"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not head:
return False
poin... | stack_v2_sparse_classes_75kplus_train_003066 | 1,079 | no_license | [
{
"docstring": ":type head: ListNode :rtype: bool",
"name": "hasCycle",
"signature": "def hasCycle(self, head)"
},
{
"docstring": ":type head: ListNode :rtype: bool",
"name": "hasCycle2",
"signature": "def hasCycle2(self, head)"
}
] | 2 | stack_v2_sparse_classes_30k_train_052988 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def hasCycle(self, head): :type head: ListNode :rtype: bool
- def hasCycle2(self, head): :type head: ListNode :rtype: bool | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def hasCycle(self, head): :type head: ListNode :rtype: bool
- def hasCycle2(self, head): :type head: ListNode :rtype: bool
<|skeleton|>
class Solution:
def hasCycle(self, h... | d4a33dc28a6d3f99d5179fdb6a83b2ab8c5a0beb | <|skeleton|>
class Solution:
def hasCycle(self, head):
""":type head: ListNode :rtype: bool"""
<|body_0|>
def hasCycle2(self, head):
""":type head: ListNode :rtype: bool"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def hasCycle(self, head):
""":type head: ListNode :rtype: bool"""
if not head:
return False
pointer1 = head
pointer2 = head
while pointer1 is not None and pointer2 is not None:
pointer1 = pointer1.next
try:
p... | the_stack_v2_python_sparse | leetcode/141_linked_list_cycle.py | 294150302hxq/python_learn | train | 0 | |
f8cf9eeb033e5f1c1c88fbf2eb4afb0f38333559 | [
"active_ids = self._context.get('active_ids', False)\nproductions = self.env['mrp.production'].browse(active_ids)\nfor production in productions:\n production.action_cancel()\nreturn True",
"if any((workorder.state == 'progress' for workorder in self.mapped('workorder_ids'))):\n raise UserError(_('You can n... | <|body_start_0|>
active_ids = self._context.get('active_ids', False)
productions = self.env['mrp.production'].browse(active_ids)
for production in productions:
production.action_cancel()
return True
<|end_body_0|>
<|body_start_1|>
if any((workorder.state == 'progress... | mrp_cancel_more | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class mrp_cancel_more:
def cancel_mrp_order(self):
"""Cancels the production order and related stock moves. @return: True"""
<|body_0|>
def action_cancel(self):
"""Cancels production order, unfinished stock moves and set procurement orders in exception"""
<|body_1|... | stack_v2_sparse_classes_75kplus_train_003067 | 2,560 | no_license | [
{
"docstring": "Cancels the production order and related stock moves. @return: True",
"name": "cancel_mrp_order",
"signature": "def cancel_mrp_order(self)"
},
{
"docstring": "Cancels production order, unfinished stock moves and set procurement orders in exception",
"name": "action_cancel",
... | 2 | stack_v2_sparse_classes_30k_train_008190 | Implement the Python class `mrp_cancel_more` described below.
Class description:
Implement the mrp_cancel_more class.
Method signatures and docstrings:
- def cancel_mrp_order(self): Cancels the production order and related stock moves. @return: True
- def action_cancel(self): Cancels production order, unfinished stoc... | Implement the Python class `mrp_cancel_more` described below.
Class description:
Implement the mrp_cancel_more class.
Method signatures and docstrings:
- def cancel_mrp_order(self): Cancels the production order and related stock moves. @return: True
- def action_cancel(self): Cancels production order, unfinished stoc... | c04e2b9730db07848c153d8245d2df65ec4e2c8f | <|skeleton|>
class mrp_cancel_more:
def cancel_mrp_order(self):
"""Cancels the production order and related stock moves. @return: True"""
<|body_0|>
def action_cancel(self):
"""Cancels production order, unfinished stock moves and set procurement orders in exception"""
<|body_1|... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class mrp_cancel_more:
def cancel_mrp_order(self):
"""Cancels the production order and related stock moves. @return: True"""
active_ids = self._context.get('active_ids', False)
productions = self.env['mrp.production'].browse(active_ids)
for production in productions:
prod... | the_stack_v2_python_sparse | altinkaya_mrp/wizard/mrp_cancel_wizard.py | aaltinisik/customaddons | train | 15 | |
ebbf1c5e3d2f47ac239c2c3e4672199483e98ba7 | [
"child_bday_1 = '1 Jan 2019'\nchild_bday_2 = '1 Jan 1990'\nwedding_date_1 = '1 Jan 2018'\nwedding_date_2 = '1 Jan 1985'\ndivorce_date = '2 Jan 2018'\nself.assertTrue(birthAfterMarriageOfParents(child_bday_1, wedding_date_1, 'NA'))\nself.assertTrue(birthAfterMarriageOfParents(child_bday_1, wedding_date_2, 'NA'))\nse... | <|body_start_0|>
child_bday_1 = '1 Jan 2019'
child_bday_2 = '1 Jan 1990'
wedding_date_1 = '1 Jan 2018'
wedding_date_2 = '1 Jan 1985'
divorce_date = '2 Jan 2018'
self.assertTrue(birthAfterMarriageOfParents(child_bday_1, wedding_date_1, 'NA'))
self.assertTrue(birthA... | TestSprint1Methods | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestSprint1Methods:
def testBirthAfterMarriageOfParents(self):
"""Child must be born after the parents' wedding or before 9 months after their divorce"""
<|body_0|>
def testBirthBeforeDeathOfParents(self):
"""Child must be born before the death of their mother and be... | stack_v2_sparse_classes_75kplus_train_003068 | 1,936 | no_license | [
{
"docstring": "Child must be born after the parents' wedding or before 9 months after their divorce",
"name": "testBirthAfterMarriageOfParents",
"signature": "def testBirthAfterMarriageOfParents(self)"
},
{
"docstring": "Child must be born before the death of their mother and before 9 months af... | 2 | null | Implement the Python class `TestSprint1Methods` described below.
Class description:
Implement the TestSprint1Methods class.
Method signatures and docstrings:
- def testBirthAfterMarriageOfParents(self): Child must be born after the parents' wedding or before 9 months after their divorce
- def testBirthBeforeDeathOfPa... | Implement the Python class `TestSprint1Methods` described below.
Class description:
Implement the TestSprint1Methods class.
Method signatures and docstrings:
- def testBirthAfterMarriageOfParents(self): Child must be born after the parents' wedding or before 9 months after their divorce
- def testBirthBeforeDeathOfPa... | 4d2511e5bcbf0c4d8799a189e320823fbe6644b1 | <|skeleton|>
class TestSprint1Methods:
def testBirthAfterMarriageOfParents(self):
"""Child must be born after the parents' wedding or before 9 months after their divorce"""
<|body_0|>
def testBirthBeforeDeathOfParents(self):
"""Child must be born before the death of their mother and be... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestSprint1Methods:
def testBirthAfterMarriageOfParents(self):
"""Child must be born after the parents' wedding or before 9 months after their divorce"""
child_bday_1 = '1 Jan 2019'
child_bday_2 = '1 Jan 1990'
wedding_date_1 = '1 Jan 2018'
wedding_date_2 = '1 Jan 1985'
... | the_stack_v2_python_sparse | Project 03/BirthBeforeMorDofParentsTest.py | Tc-blip/SSW555 | train | 0 | |
9237d0880bf1a7c429641301c29e827405bb4982 | [
"my_vars.conf_matrix = {my_vars.TP: {1, 2}, my_vars.TN: {7}, my_vars.FP: {3, 4, 5, 6}, my_vars.FN: {0}}\nscore = f1(my_vars.conf_matrix)\ncorrect = 2 * 1 / 3 * 2 / 3\nself.assertTrue(score == correct)",
"my_vars.conf_matrix = {my_vars.TP: {0, 1, 6}, my_vars.TN: {}, my_vars.FP: {4}, my_vars.FN: {2, 3, 5, 7}}\ncorr... | <|body_start_0|>
my_vars.conf_matrix = {my_vars.TP: {1, 2}, my_vars.TN: {7}, my_vars.FP: {3, 4, 5, 6}, my_vars.FN: {0}}
score = f1(my_vars.conf_matrix)
correct = 2 * 1 / 3 * 2 / 3
self.assertTrue(score == correct)
<|end_body_0|>
<|body_start_1|>
my_vars.conf_matrix = {my_vars.TP... | Test f1() in utils.py | TestF1 | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestF1:
"""Test f1() in utils.py"""
def test_f1_high_recall(self):
"""Tests if F1 is computed correctly"""
<|body_0|>
def test_f1_high_precision(self):
"""Tests if F1 is computed correctly"""
<|body_1|>
def test_f1_zero(self):
"""Tests if F1 ... | stack_v2_sparse_classes_75kplus_train_003069 | 1,922 | permissive | [
{
"docstring": "Tests if F1 is computed correctly",
"name": "test_f1_high_recall",
"signature": "def test_f1_high_recall(self)"
},
{
"docstring": "Tests if F1 is computed correctly",
"name": "test_f1_high_precision",
"signature": "def test_f1_high_precision(self)"
},
{
"docstring... | 4 | stack_v2_sparse_classes_30k_train_013189 | Implement the Python class `TestF1` described below.
Class description:
Test f1() in utils.py
Method signatures and docstrings:
- def test_f1_high_recall(self): Tests if F1 is computed correctly
- def test_f1_high_precision(self): Tests if F1 is computed correctly
- def test_f1_zero(self): Tests if F1 is 0 if precisi... | Implement the Python class `TestF1` described below.
Class description:
Test f1() in utils.py
Method signatures and docstrings:
- def test_f1_high_recall(self): Tests if F1 is computed correctly
- def test_f1_high_precision(self): Tests if F1 is computed correctly
- def test_f1_zero(self): Tests if F1 is 0 if precisi... | ad9bf0b4e44c19f66c1597e857ef6cf70f56a646 | <|skeleton|>
class TestF1:
"""Test f1() in utils.py"""
def test_f1_high_recall(self):
"""Tests if F1 is computed correctly"""
<|body_0|>
def test_f1_high_precision(self):
"""Tests if F1 is computed correctly"""
<|body_1|>
def test_f1_zero(self):
"""Tests if F1 ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestF1:
"""Test f1() in utils.py"""
def test_f1_high_recall(self):
"""Tests if F1 is computed correctly"""
my_vars.conf_matrix = {my_vars.TP: {1, 2}, my_vars.TN: {7}, my_vars.FP: {3, 4, 5, 6}, my_vars.FN: {0}}
score = f1(my_vars.conf_matrix)
correct = 2 * 1 / 3 * 2 / 3
... | the_stack_v2_python_sparse | unit_tests/test_f1.py | fensta/bracid2019 | train | 0 |
4bf7aebc5baaa5224d030607aa79889a5b515035 | [
"directory_path = Path(directory_path)\noutput_path = Path(output_path)\narchive_file_extension = 'tar' if cls._MODE_STRING == '' else f'tar.{cls._MODE_STRING}'\narchive_path = output_path / f'{directory_path.stem}.{archive_file_extension}'\nwith tarfile.open(archive_path, f'w:{cls._MODE_STRING}') as tar_file:\n ... | <|body_start_0|>
directory_path = Path(directory_path)
output_path = Path(output_path)
archive_file_extension = 'tar' if cls._MODE_STRING == '' else f'tar.{cls._MODE_STRING}'
archive_path = output_path / f'{directory_path.stem}.{archive_file_extension}'
with tarfile.open(archive_... | A static class for managing tar archives. | _TarArchiver | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _TarArchiver:
"""A static class for managing tar archives."""
def create_archive(cls, directory_path: str, output_path: str) -> str:
"""Create an archive of all the contents in the given directory and save it to an archive file named as the directory in the provided output path. :par... | stack_v2_sparse_classes_75kplus_train_003070 | 7,567 | permissive | [
{
"docstring": "Create an archive of all the contents in the given directory and save it to an archive file named as the directory in the provided output path. :param directory_path: The directory with the files to archive. :param output_path: The output path to store the created archive file. :return: The crea... | 2 | stack_v2_sparse_classes_30k_train_029490 | Implement the Python class `_TarArchiver` described below.
Class description:
A static class for managing tar archives.
Method signatures and docstrings:
- def create_archive(cls, directory_path: str, output_path: str) -> str: Create an archive of all the contents in the given directory and save it to an archive file... | Implement the Python class `_TarArchiver` described below.
Class description:
A static class for managing tar archives.
Method signatures and docstrings:
- def create_archive(cls, directory_path: str, output_path: str) -> str: Create an archive of all the contents in the given directory and save it to an archive file... | b5fe0c05ae7f5818a4a5a5a40245c851ff9b2c77 | <|skeleton|>
class _TarArchiver:
"""A static class for managing tar archives."""
def create_archive(cls, directory_path: str, output_path: str) -> str:
"""Create an archive of all the contents in the given directory and save it to an archive file named as the directory in the provided output path. :par... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class _TarArchiver:
"""A static class for managing tar archives."""
def create_archive(cls, directory_path: str, output_path: str) -> str:
"""Create an archive of all the contents in the given directory and save it to an archive file named as the directory in the provided output path. :param directory_... | the_stack_v2_python_sparse | mlrun/package/utils/_archiver.py | mlrun/mlrun | train | 1,093 |
0f705680777286ba31d3702d748b8c6e29070faa | [
"self.Whf = np.random.randn(h + i, h)\nself.Whb = np.random.randn(h + i, h)\nself.Wy = np.random.randn(h + h, o)\nself.bhf = np.zeros((1, h))\nself.bhb = np.zeros((1, h))\nself.by = np.zeros((1, o))",
"m, i = x_t.shape\n_, h = h_prev.shape\nx_ht = np.hstack((h_prev, x_t))\nh_next = np.tanh(np.matmul(x_ht, self.Wh... | <|body_start_0|>
self.Whf = np.random.randn(h + i, h)
self.Whb = np.random.randn(h + i, h)
self.Wy = np.random.randn(h + h, o)
self.bhf = np.zeros((1, h))
self.bhb = np.zeros((1, h))
self.by = np.zeros((1, o))
<|end_body_0|>
<|body_start_1|>
m, i = x_t.shape
... | Class Bidirectional | BidirectionalCell | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BidirectionalCell:
"""Class Bidirectional"""
def __init__(self, i, h, o):
"""Constructor i is the dimensionality of the data h is the dimensionality of the hidden state o is the dimensionality of the outputs"""
<|body_0|>
def forward(self, h_prev, x_t):
"""Method... | stack_v2_sparse_classes_75kplus_train_003071 | 2,380 | permissive | [
{
"docstring": "Constructor i is the dimensionality of the data h is the dimensionality of the hidden state o is the dimensionality of the outputs",
"name": "__init__",
"signature": "def __init__(self, i, h, o)"
},
{
"docstring": "Method Forward calculates the hidden state in the forward directi... | 3 | stack_v2_sparse_classes_30k_train_029483 | Implement the Python class `BidirectionalCell` described below.
Class description:
Class Bidirectional
Method signatures and docstrings:
- def __init__(self, i, h, o): Constructor i is the dimensionality of the data h is the dimensionality of the hidden state o is the dimensionality of the outputs
- def forward(self,... | Implement the Python class `BidirectionalCell` described below.
Class description:
Class Bidirectional
Method signatures and docstrings:
- def __init__(self, i, h, o): Constructor i is the dimensionality of the data h is the dimensionality of the hidden state o is the dimensionality of the outputs
- def forward(self,... | eaf23423ec0f412f103f5931d6610fdd67bcc5be | <|skeleton|>
class BidirectionalCell:
"""Class Bidirectional"""
def __init__(self, i, h, o):
"""Constructor i is the dimensionality of the data h is the dimensionality of the hidden state o is the dimensionality of the outputs"""
<|body_0|>
def forward(self, h_prev, x_t):
"""Method... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class BidirectionalCell:
"""Class Bidirectional"""
def __init__(self, i, h, o):
"""Constructor i is the dimensionality of the data h is the dimensionality of the hidden state o is the dimensionality of the outputs"""
self.Whf = np.random.randn(h + i, h)
self.Whb = np.random.randn(h + i,... | the_stack_v2_python_sparse | supervised_learning/0x0D-RNN/6-bi_backward.py | ledbagholberton/holbertonschool-machine_learning | train | 1 |
33a6147eda76c39c68d5a92e718353d100d8c3a4 | [
"super(RawTextModule, self).__init__(*args, **kwargs)\nself._verse_record_format = '<IH'\nself._verse_record_size = 6",
"base_file_path = os.path.join(self._module_path, u'%s%s')\ntry:\n testament = Testament(testament_name, v2l_name=base_file_path % (testament_name, u'.vss'), text_name=base_file_path % (testa... | <|body_start_0|>
super(RawTextModule, self).__init__(*args, **kwargs)
self._verse_record_format = '<IH'
self._verse_record_size = 6
<|end_body_0|>
<|body_start_1|>
base_file_path = os.path.join(self._module_path, u'%s%s')
try:
testament = Testament(testament_name, v2... | :class:`RawTextModule` subclasses :class:`SwordBible` allowing the RawText version of SWORD bibles to be parsed. | RawTextModule | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RawTextModule:
""":class:`RawTextModule` subclasses :class:`SwordBible` allowing the RawText version of SWORD bibles to be parsed."""
def __init__(self, *args, **kwargs):
"""Initalise the instance, setting some specific instance variables for parsing raw text SWORD bibles. :param arg... | stack_v2_sparse_classes_75kplus_train_003072 | 20,672 | permissive | [
{
"docstring": "Initalise the instance, setting some specific instance variables for parsing raw text SWORD bibles. :param args: Positional arguments to pass on to the super class. :param kwargs: Keyword arguments to pass on to the super class.",
"name": "__init__",
"signature": "def __init__(self, *arg... | 3 | stack_v2_sparse_classes_30k_train_051816 | Implement the Python class `RawTextModule` described below.
Class description:
:class:`RawTextModule` subclasses :class:`SwordBible` allowing the RawText version of SWORD bibles to be parsed.
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): Initalise the instance, setting some specific instanc... | Implement the Python class `RawTextModule` described below.
Class description:
:class:`RawTextModule` subclasses :class:`SwordBible` allowing the RawText version of SWORD bibles to be parsed.
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): Initalise the instance, setting some specific instanc... | 4ec6529ab6682ab85dfaa11704bcd3f41873095a | <|skeleton|>
class RawTextModule:
""":class:`RawTextModule` subclasses :class:`SwordBible` allowing the RawText version of SWORD bibles to be parsed."""
def __init__(self, *args, **kwargs):
"""Initalise the instance, setting some specific instance variables for parsing raw text SWORD bibles. :param arg... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class RawTextModule:
""":class:`RawTextModule` subclasses :class:`SwordBible` allowing the RawText version of SWORD bibles to be parsed."""
def __init__(self, *args, **kwargs):
"""Initalise the instance, setting some specific instance variables for parsing raw text SWORD bibles. :param args: Positional... | the_stack_v2_python_sparse | util/reference/pysword/pysword/bible.py | michael2012z/BitBible | train | 0 |
29292aca8e95dd64070161a4303160ddf73326f2 | [
"super().__init__(config, is_training, num_shards, shard_index)\nif is_training:\n self.file_pattern = os.path.join(self.data_dir, 'train-*-of-*')\n self.batch_size = self.batch_size\nelse:\n self.file_pattern = os.path.join(self.data_dir, 'validation-*-of-*')\n self.batch_size = self.batch_size_val\nse... | <|body_start_0|>
super().__init__(config, is_training, num_shards, shard_index)
if is_training:
self.file_pattern = os.path.join(self.data_dir, 'train-*-of-*')
self.batch_size = self.batch_size
else:
self.file_pattern = os.path.join(self.data_dir, 'validation-... | Imagenet dataset. | ImagenetDataset | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ImagenetDataset:
"""Imagenet dataset."""
def __init__(self, config, is_training, num_shards=1, shard_index=0):
"""Constructor function. :param config: Config object :param is_training: whether to construct the training subset :return:"""
<|body_0|>
def parse_fn(self, exa... | stack_v2_sparse_classes_75kplus_train_003073 | 3,574 | no_license | [
{
"docstring": "Constructor function. :param config: Config object :param is_training: whether to construct the training subset :return:",
"name": "__init__",
"signature": "def __init__(self, config, is_training, num_shards=1, shard_index=0)"
},
{
"docstring": "Parse features from the serialized... | 3 | stack_v2_sparse_classes_30k_test_001798 | Implement the Python class `ImagenetDataset` described below.
Class description:
Imagenet dataset.
Method signatures and docstrings:
- def __init__(self, config, is_training, num_shards=1, shard_index=0): Constructor function. :param config: Config object :param is_training: whether to construct the training subset :... | Implement the Python class `ImagenetDataset` described below.
Class description:
Imagenet dataset.
Method signatures and docstrings:
- def __init__(self, config, is_training, num_shards=1, shard_index=0): Constructor function. :param config: Config object :param is_training: whether to construct the training subset :... | 385fcf2fe8dd4dc1c4d17423ad4f044353673ad4 | <|skeleton|>
class ImagenetDataset:
"""Imagenet dataset."""
def __init__(self, config, is_training, num_shards=1, shard_index=0):
"""Constructor function. :param config: Config object :param is_training: whether to construct the training subset :return:"""
<|body_0|>
def parse_fn(self, exa... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ImagenetDataset:
"""Imagenet dataset."""
def __init__(self, config, is_training, num_shards=1, shard_index=0):
"""Constructor function. :param config: Config object :param is_training: whether to construct the training subset :return:"""
super().__init__(config, is_training, num_shards, s... | the_stack_v2_python_sparse | src/model_optimizer/pruner/dataset/imagenet.py | xiebinbb/model_optimizer | train | 0 |
68f9d96a05873787243d081f2baea52a71c59f78 | [
"self.logger = logging.getLogger(__name__)\nself.logger.addHandler(logging.NullHandler())\nself.logger.setLevel(logging_level)",
"filename = split(REGNSKABSDATA1000_URL)[-1]\nfull_filename = self.full_filename(filename)\nreturn full_filename",
"if sep in filename:\n return filename\nelse:\n return join(da... | <|body_start_0|>
self.logger = logging.getLogger(__name__)
self.logger.addHandler(logging.NullHandler())
self.logger.setLevel(logging_level)
<|end_body_0|>
<|body_start_1|>
filename = split(REGNSKABSDATA1000_URL)[-1]
full_filename = self.full_filename(filename)
return fu... | Interface to Regnskabsdata sample. References ---------- http://datahub.virk.dk/dataset/regnskabsdata-fra-selskaber-sample | Regnskabsdata1000 | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Regnskabsdata1000:
"""Interface to Regnskabsdata sample. References ---------- http://datahub.virk.dk/dataset/regnskabsdata-fra-selskaber-sample"""
def __init__(self, logging_level=logging.WARN):
"""Setup logger."""
<|body_0|>
def zip_filename(self):
"""Return fu... | stack_v2_sparse_classes_75kplus_train_003074 | 15,506 | permissive | [
{
"docstring": "Setup logger.",
"name": "__init__",
"signature": "def __init__(self, logging_level=logging.WARN)"
},
{
"docstring": "Return full filename of zip file with XBRL.",
"name": "zip_filename",
"signature": "def zip_filename(self)"
},
{
"docstring": "Return filename with... | 6 | stack_v2_sparse_classes_30k_train_053804 | Implement the Python class `Regnskabsdata1000` described below.
Class description:
Interface to Regnskabsdata sample. References ---------- http://datahub.virk.dk/dataset/regnskabsdata-fra-selskaber-sample
Method signatures and docstrings:
- def __init__(self, logging_level=logging.WARN): Setup logger.
- def zip_file... | Implement the Python class `Regnskabsdata1000` described below.
Class description:
Interface to Regnskabsdata sample. References ---------- http://datahub.virk.dk/dataset/regnskabsdata-fra-selskaber-sample
Method signatures and docstrings:
- def __init__(self, logging_level=logging.WARN): Setup logger.
- def zip_file... | b5ace62550e37b20b1ec9e2e5a24ae2cefbb1e18 | <|skeleton|>
class Regnskabsdata1000:
"""Interface to Regnskabsdata sample. References ---------- http://datahub.virk.dk/dataset/regnskabsdata-fra-selskaber-sample"""
def __init__(self, logging_level=logging.WARN):
"""Setup logger."""
<|body_0|>
def zip_filename(self):
"""Return fu... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Regnskabsdata1000:
"""Interface to Regnskabsdata sample. References ---------- http://datahub.virk.dk/dataset/regnskabsdata-fra-selskaber-sample"""
def __init__(self, logging_level=logging.WARN):
"""Setup logger."""
self.logger = logging.getLogger(__name__)
self.logger.addHandler(... | the_stack_v2_python_sparse | cvrminer/xbrler.py | fnielsen/cvrminer | train | 3 |
001bf81cde9181aa1b74bed3a427c1befdc133bc | [
"menu_item.MenuItem.__init__(self, main_menu, frame)\nself.create_menu_item_button('My History')\nself.menu_item_button['command'] = self.get_my_history_window",
"self.gui.active_window.hide()\nself.associated_window = my_history_window.MyHistoryWindow(self.gui)\nself.gui.active_window = self.associated_window\ns... | <|body_start_0|>
menu_item.MenuItem.__init__(self, main_menu, frame)
self.create_menu_item_button('My History')
self.menu_item_button['command'] = self.get_my_history_window
<|end_body_0|>
<|body_start_1|>
self.gui.active_window.hide()
self.associated_window = my_history_window.... | This class is used to create a button that will bring the user to the my history menu. | MyHistoryMenuItem | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MyHistoryMenuItem:
"""This class is used to create a button that will bring the user to the my history menu."""
def __init__(self, main_menu, frame):
"""Args: main_menu ([]): this class must know about the main menu because it knows about the GUI, and we need to alter the GUI's activ... | stack_v2_sparse_classes_75kplus_train_003075 | 1,046 | no_license | [
{
"docstring": "Args: main_menu ([]): this class must know about the main menu because it knows about the GUI, and we need to alter the GUI's active window",
"name": "__init__",
"signature": "def __init__(self, main_menu, frame)"
},
{
"docstring": "This function will hide everything on the activ... | 2 | stack_v2_sparse_classes_30k_train_029371 | Implement the Python class `MyHistoryMenuItem` described below.
Class description:
This class is used to create a button that will bring the user to the my history menu.
Method signatures and docstrings:
- def __init__(self, main_menu, frame): Args: main_menu ([]): this class must know about the main menu because it ... | Implement the Python class `MyHistoryMenuItem` described below.
Class description:
This class is used to create a button that will bring the user to the my history menu.
Method signatures and docstrings:
- def __init__(self, main_menu, frame): Args: main_menu ([]): this class must know about the main menu because it ... | e26d9450b98fa0f372bcdf6eaf251a2c9dcba44e | <|skeleton|>
class MyHistoryMenuItem:
"""This class is used to create a button that will bring the user to the my history menu."""
def __init__(self, main_menu, frame):
"""Args: main_menu ([]): this class must know about the main menu because it knows about the GUI, and we need to alter the GUI's activ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MyHistoryMenuItem:
"""This class is used to create a button that will bring the user to the my history menu."""
def __init__(self, main_menu, frame):
"""Args: main_menu ([]): this class must know about the main menu because it knows about the GUI, and we need to alter the GUI's active window"""
... | the_stack_v2_python_sparse | user_interface/menu_items/my_history_menu_item.py | pucheng-tan/WordFlow | train | 0 |
9243827fce05a901bda0b6d4c621682a628394b6 | [
"for param in self.params:\n group = self._create_group_given_minentities(self.gc_min_entities_alt)\n self.verify_group_state(group.id, group.groupConfiguration.minEntities)\n delete_group_response = self.autoscale_client.delete_scaling_group(group.id, param)\n self.assertEquals(delete_group_response.st... | <|body_start_0|>
for param in self.params:
group = self._create_group_given_minentities(self.gc_min_entities_alt)
self.verify_group_state(group.id, group.groupConfiguration.minEntities)
delete_group_response = self.autoscale_client.delete_scaling_group(group.id, param)
... | System tests to verify various force delete scaling group scenarios. self.gc_min_entities_alt is set to >0 in the config. | ForceDeleteGroupTest | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ForceDeleteGroupTest:
"""System tests to verify various force delete scaling group scenarios. self.gc_min_entities_alt is set to >0 in the config."""
def test_minentities_over_zero(self):
"""Force deleting a scaling group with active servers, updates the desired capacity to be 0, by ... | stack_v2_sparse_classes_75kplus_train_003076 | 4,553 | permissive | [
{
"docstring": "Force deleting a scaling group with active servers, updates the desired capacity to be 0, by deleting all the servers and then deletes the group.",
"name": "test_minentities_over_zero",
"signature": "def test_minentities_over_zero(self)"
},
{
"docstring": "Force deleting a scalin... | 5 | stack_v2_sparse_classes_30k_train_038703 | Implement the Python class `ForceDeleteGroupTest` described below.
Class description:
System tests to verify various force delete scaling group scenarios. self.gc_min_entities_alt is set to >0 in the config.
Method signatures and docstrings:
- def test_minentities_over_zero(self): Force deleting a scaling group with ... | Implement the Python class `ForceDeleteGroupTest` described below.
Class description:
System tests to verify various force delete scaling group scenarios. self.gc_min_entities_alt is set to >0 in the config.
Method signatures and docstrings:
- def test_minentities_over_zero(self): Force deleting a scaling group with ... | 7199cdd67255fe116dbcbedea660c13453671134 | <|skeleton|>
class ForceDeleteGroupTest:
"""System tests to verify various force delete scaling group scenarios. self.gc_min_entities_alt is set to >0 in the config."""
def test_minentities_over_zero(self):
"""Force deleting a scaling group with active servers, updates the desired capacity to be 0, by ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ForceDeleteGroupTest:
"""System tests to verify various force delete scaling group scenarios. self.gc_min_entities_alt is set to >0 in the config."""
def test_minentities_over_zero(self):
"""Force deleting a scaling group with active servers, updates the desired capacity to be 0, by deleting all ... | the_stack_v2_python_sparse | autoscale_cloudroast/test_repo/autoscale/system/group/test_force_delete_group.py | rackerlabs/otter | train | 20 |
215b74cafe6e62706a6365c119a6769207ae42ce | [
"super(FACHead, self).__init__(name=name)\nself.vid_to_hid = tf.keras.layers.Dense(vid_to_aud_txt_kwargs['d_model'], use_bias=False, name='vid_to_hid')\nself.hid_to_va = mlp_lib.ReluDenseBN(pre_bn=True, d_model=vid_to_aud_txt_kwargs['d_model'], bn_config=bn_config, use_xreplica_bn=use_xreplica_bn, name='hid_to_va')... | <|body_start_0|>
super(FACHead, self).__init__(name=name)
self.vid_to_hid = tf.keras.layers.Dense(vid_to_aud_txt_kwargs['d_model'], use_bias=False, name='vid_to_hid')
self.hid_to_va = mlp_lib.ReluDenseBN(pre_bn=True, d_model=vid_to_aud_txt_kwargs['d_model'], bn_config=bn_config, use_xreplica_bn=... | MLP-based Head to bridge audio, text and video with a FAC style. | FACHead | [
"Apache-2.0",
"CC-BY-4.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FACHead:
"""MLP-based Head to bridge audio, text and video with a FAC style."""
def __init__(self, bn_config, use_xreplica_bn, vid_to_aud_txt_kwargs, aud_to_vid_txt_kwargs, txt_to_vid_aud_kwargs, name='mlp_fac_head', **kwargs):
"""Initialize the Fine-to-Coarse head class. Args: bn_co... | stack_v2_sparse_classes_75kplus_train_003077 | 6,829 | permissive | [
{
"docstring": "Initialize the Fine-to-Coarse head class. Args: bn_config: batchnorm configuration args use_xreplica_bn: whether to use cross-replica bn stats or not vid_to_aud_txt_kwargs: vid2rest MLP args aud_to_vid_txt_kwargs: aud2rest MLP args txt_to_vid_aud_kwargs: txt2rest MLP args name: graph name. **kwa... | 2 | stack_v2_sparse_classes_30k_train_044945 | Implement the Python class `FACHead` described below.
Class description:
MLP-based Head to bridge audio, text and video with a FAC style.
Method signatures and docstrings:
- def __init__(self, bn_config, use_xreplica_bn, vid_to_aud_txt_kwargs, aud_to_vid_txt_kwargs, txt_to_vid_aud_kwargs, name='mlp_fac_head', **kwarg... | Implement the Python class `FACHead` described below.
Class description:
MLP-based Head to bridge audio, text and video with a FAC style.
Method signatures and docstrings:
- def __init__(self, bn_config, use_xreplica_bn, vid_to_aud_txt_kwargs, aud_to_vid_txt_kwargs, txt_to_vid_aud_kwargs, name='mlp_fac_head', **kwarg... | 5573d9c5822f4e866b6692769963ae819cb3f10d | <|skeleton|>
class FACHead:
"""MLP-based Head to bridge audio, text and video with a FAC style."""
def __init__(self, bn_config, use_xreplica_bn, vid_to_aud_txt_kwargs, aud_to_vid_txt_kwargs, txt_to_vid_aud_kwargs, name='mlp_fac_head', **kwargs):
"""Initialize the Fine-to-Coarse head class. Args: bn_co... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class FACHead:
"""MLP-based Head to bridge audio, text and video with a FAC style."""
def __init__(self, bn_config, use_xreplica_bn, vid_to_aud_txt_kwargs, aud_to_vid_txt_kwargs, txt_to_vid_aud_kwargs, name='mlp_fac_head', **kwargs):
"""Initialize the Fine-to-Coarse head class. Args: bn_config: batchno... | the_stack_v2_python_sparse | vatt/modeling/heads/bridge.py | Jimmy-INL/google-research | train | 1 |
38c8dfc840657c279b5b7f7bb2d99bdd57ae7f1b | [
"self.capacity = capacity\nself.map = dict()\nself.dll = DLList()\nself.size = 0",
"node = self.map.get(key)\nif not node:\n return -1\nself.dll.move_to_end(node)\nreturn node.v",
"node = self.map.get(key)\nif not node:\n node = Node(key, value)\n if self.size + 1 > self.capacity:\n delete_key =... | <|body_start_0|>
self.capacity = capacity
self.map = dict()
self.dll = DLList()
self.size = 0
<|end_body_0|>
<|body_start_1|>
node = self.map.get(key)
if not node:
return -1
self.dll.move_to_end(node)
return node.v
<|end_body_1|>
<|body_start... | LRUCache | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LRUCache:
def __init__(self, capacity):
""":type capacity: int"""
<|body_0|>
def get(self, key):
""":type key: int :rtype: int"""
<|body_1|>
def put(self, key, value):
""":type key: int :type value: int :rtype: void"""
<|body_2|>
<|end_s... | stack_v2_sparse_classes_75kplus_train_003078 | 2,004 | permissive | [
{
"docstring": ":type capacity: int",
"name": "__init__",
"signature": "def __init__(self, capacity)"
},
{
"docstring": ":type key: int :rtype: int",
"name": "get",
"signature": "def get(self, key)"
},
{
"docstring": ":type key: int :type value: int :rtype: void",
"name": "pu... | 3 | stack_v2_sparse_classes_30k_train_015681 | Implement the Python class `LRUCache` described below.
Class description:
Implement the LRUCache class.
Method signatures and docstrings:
- def __init__(self, capacity): :type capacity: int
- def get(self, key): :type key: int :rtype: int
- def put(self, key, value): :type key: int :type value: int :rtype: void | Implement the Python class `LRUCache` described below.
Class description:
Implement the LRUCache class.
Method signatures and docstrings:
- def __init__(self, capacity): :type capacity: int
- def get(self, key): :type key: int :rtype: int
- def put(self, key, value): :type key: int :type value: int :rtype: void
<|sk... | 78f6cf4e2da4106fd07f4bd86247026396075c69 | <|skeleton|>
class LRUCache:
def __init__(self, capacity):
""":type capacity: int"""
<|body_0|>
def get(self, key):
""":type key: int :rtype: int"""
<|body_1|>
def put(self, key, value):
""":type key: int :type value: int :rtype: void"""
<|body_2|>
<|end_s... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class LRUCache:
def __init__(self, capacity):
""":type capacity: int"""
self.capacity = capacity
self.map = dict()
self.dll = DLList()
self.size = 0
def get(self, key):
""":type key: int :rtype: int"""
node = self.map.get(key)
if not node:
... | the_stack_v2_python_sparse | System Design/LRU Cache/LRUCache.py | renowncoder/hello-interview | train | 0 | |
dd5ea1e1457d30cc3e18e27ed5f4e13a3f006d5a | [
"discipline = Discipline.query.get(discipline_id)\nif discipline is not None:\n discipline.name = api.payload['name']\n discipline.tag = api.payload['tag']\n discipline.dances = Dance.query.filter(Dance.dance_id.in_(api.payload['dances'])).all()\n db.session.commit()\n return dependencies(classes=Fal... | <|body_start_0|>
discipline = Discipline.query.get(discipline_id)
if discipline is not None:
discipline.name = api.payload['name']
discipline.tag = api.payload['tag']
discipline.dances = Dance.query.filter(Dance.dance_id.in_(api.payload['dances'])).all()
d... | DependenciesAPISpecificDiscipline | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DependenciesAPISpecificDiscipline:
def patch(self, discipline_id):
"""Update discipline"""
<|body_0|>
def delete(self, discipline_id):
"""Delete discipline"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
discipline = Discipline.query.get(discipline_... | stack_v2_sparse_classes_75kplus_train_003079 | 7,233 | no_license | [
{
"docstring": "Update discipline",
"name": "patch",
"signature": "def patch(self, discipline_id)"
},
{
"docstring": "Delete discipline",
"name": "delete",
"signature": "def delete(self, discipline_id)"
}
] | 2 | null | Implement the Python class `DependenciesAPISpecificDiscipline` described below.
Class description:
Implement the DependenciesAPISpecificDiscipline class.
Method signatures and docstrings:
- def patch(self, discipline_id): Update discipline
- def delete(self, discipline_id): Delete discipline | Implement the Python class `DependenciesAPISpecificDiscipline` described below.
Class description:
Implement the DependenciesAPISpecificDiscipline class.
Method signatures and docstrings:
- def patch(self, discipline_id): Update discipline
- def delete(self, discipline_id): Delete discipline
<|skeleton|>
class Depen... | 079b109fd13683a31d1d632faa5ab72cf0e78ddf | <|skeleton|>
class DependenciesAPISpecificDiscipline:
def patch(self, discipline_id):
"""Update discipline"""
<|body_0|>
def delete(self, discipline_id):
"""Delete discipline"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class DependenciesAPISpecificDiscipline:
def patch(self, discipline_id):
"""Update discipline"""
discipline = Discipline.query.get(discipline_id)
if discipline is not None:
discipline.name = api.payload['name']
discipline.tag = api.payload['tag']
disciplin... | the_stack_v2_python_sparse | backend/apis/dependencies/apis.py | AlenAlic/DANCE | train | 0 | |
b51f7708bd1603afdf042acc75b0a72046f647b6 | [
"super(MyButton, self).__init__(parent)\nself.setFixedSize(QSize(800, 120))\nself.setStyleSheet('background-color:red;')",
"if event.button() == Qt.LeftButton:\n self.clicked.emit(True)\n self.parent().mousePressEvent(event)"
] | <|body_start_0|>
super(MyButton, self).__init__(parent)
self.setFixedSize(QSize(800, 120))
self.setStyleSheet('background-color:red;')
<|end_body_0|>
<|body_start_1|>
if event.button() == Qt.LeftButton:
self.clicked.emit(True)
self.parent().mousePressEvent(event)... | 自定义按钮类 | MyButton | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MyButton:
"""自定义按钮类"""
def __init__(self, parent=None):
"""构造函数"""
<|body_0|>
def mousePressEvent(self, event):
"""鼠标按下事件"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
super(MyButton, self).__init__(parent)
self.setFixedSize(QSize(800,... | stack_v2_sparse_classes_75kplus_train_003080 | 2,557 | no_license | [
{
"docstring": "构造函数",
"name": "__init__",
"signature": "def __init__(self, parent=None)"
},
{
"docstring": "鼠标按下事件",
"name": "mousePressEvent",
"signature": "def mousePressEvent(self, event)"
}
] | 2 | null | Implement the Python class `MyButton` described below.
Class description:
自定义按钮类
Method signatures and docstrings:
- def __init__(self, parent=None): 构造函数
- def mousePressEvent(self, event): 鼠标按下事件 | Implement the Python class `MyButton` described below.
Class description:
自定义按钮类
Method signatures and docstrings:
- def __init__(self, parent=None): 构造函数
- def mousePressEvent(self, event): 鼠标按下事件
<|skeleton|>
class MyButton:
"""自定义按钮类"""
def __init__(self, parent=None):
"""构造函数"""
<|body_0... | 53efad8c1fd47cf7cb71188b170a1d0d92cc8515 | <|skeleton|>
class MyButton:
"""自定义按钮类"""
def __init__(self, parent=None):
"""构造函数"""
<|body_0|>
def mousePressEvent(self, event):
"""鼠标按下事件"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MyButton:
"""自定义按钮类"""
def __init__(self, parent=None):
"""构造函数"""
super(MyButton, self).__init__(parent)
self.setFixedSize(QSize(800, 120))
self.setStyleSheet('background-color:red;')
def mousePressEvent(self, event):
"""鼠标按下事件"""
if event.button() ==... | the_stack_v2_python_sparse | Chapter07/qt07_btnClick.py | huozhiwei/PyQt5_RapidDevolpment | train | 2 |
ae27651030ffafda2ce526a54c26b95238f148eb | [
"self.item_freq = fi\nself.item_values = pv\nself.target = Select(fi)\nself.impulse = np.argsort(np.random.random(len(fi)))[:3]\nwhile self.target in self.impulse:\n self.impulse = np.argsort(np.random.random(len(fi)))[:3]",
"spent = 0.0\nfor p in products:\n if p == self.target:\n spent += self.item... | <|body_start_0|>
self.item_freq = fi
self.item_values = pv
self.target = Select(fi)
self.impulse = np.argsort(np.random.random(len(fi)))[:3]
while self.target in self.impulse:
self.impulse = np.argsort(np.random.random(len(fi)))[:3]
<|end_body_0|>
<|body_start_1|>
... | Represent a single shopper | Shopper | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Shopper:
"""Represent a single shopper"""
def __init__(self, fi, pv):
"""Constructor"""
<|body_0|>
def GoShopping(self, products):
"""Go shopping and return the amount spent"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.item_freq = fi
... | stack_v2_sparse_classes_75kplus_train_003081 | 6,050 | permissive | [
{
"docstring": "Constructor",
"name": "__init__",
"signature": "def __init__(self, fi, pv)"
},
{
"docstring": "Go shopping and return the amount spent",
"name": "GoShopping",
"signature": "def GoShopping(self, products)"
}
] | 2 | stack_v2_sparse_classes_30k_train_025602 | Implement the Python class `Shopper` described below.
Class description:
Represent a single shopper
Method signatures and docstrings:
- def __init__(self, fi, pv): Constructor
- def GoShopping(self, products): Go shopping and return the amount spent | Implement the Python class `Shopper` described below.
Class description:
Represent a single shopper
Method signatures and docstrings:
- def __init__(self, fi, pv): Constructor
- def GoShopping(self, products): Go shopping and return the amount spent
<|skeleton|>
class Shopper:
"""Represent a single shopper"""
... | 5445b6f90ab49339ca0fdb71e98d44e6827c95a8 | <|skeleton|>
class Shopper:
"""Represent a single shopper"""
def __init__(self, fi, pv):
"""Constructor"""
<|body_0|>
def GoShopping(self, products):
"""Go shopping and return the amount spent"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Shopper:
"""Represent a single shopper"""
def __init__(self, fi, pv):
"""Constructor"""
self.item_freq = fi
self.item_values = pv
self.target = Select(fi)
self.impulse = np.argsort(np.random.random(len(fi)))[:3]
while self.target in self.impulse:
... | the_stack_v2_python_sparse | store/store.py | dayoladejo/SwarmOptimization | train | 0 |
2c0b573bef54e07444b9d2a19ef33f6860c54143 | [
"n_row = len(board)\nif n_row <= 2:\n return\nn_col = len(board[0])\nif n_col <= 2:\n return\nqueue = deque()\nfor i in [0, n_row - 1]:\n for j in range(n_col):\n if board[i][j] == 'O':\n queue.append((i, j))\nfor i in range(1, n_row - 1):\n for j in [0, n_col - 1]:\n if board[i... | <|body_start_0|>
n_row = len(board)
if n_row <= 2:
return
n_col = len(board[0])
if n_col <= 2:
return
queue = deque()
for i in [0, n_row - 1]:
for j in range(n_col):
if board[i][j] == 'O':
queue.appen... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def solve(self, board: List[List[str]]) -> None:
"""Do not return anything, modify board in-place instead."""
<|body_0|>
def solve2(self, board: List[List[str]]) -> None:
"""Do not return anything, modify board in-place instead."""
<|body_1|>
<|end... | stack_v2_sparse_classes_75kplus_train_003082 | 3,118 | no_license | [
{
"docstring": "Do not return anything, modify board in-place instead.",
"name": "solve",
"signature": "def solve(self, board: List[List[str]]) -> None"
},
{
"docstring": "Do not return anything, modify board in-place instead.",
"name": "solve2",
"signature": "def solve2(self, board: Lis... | 2 | stack_v2_sparse_classes_30k_train_044854 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def solve(self, board: List[List[str]]) -> None: Do not return anything, modify board in-place instead.
- def solve2(self, board: List[List[str]]) -> None: Do not return anything... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def solve(self, board: List[List[str]]) -> None: Do not return anything, modify board in-place instead.
- def solve2(self, board: List[List[str]]) -> None: Do not return anything... | e52d24990122e07a976612dd9cea42fa1d778f60 | <|skeleton|>
class Solution:
def solve(self, board: List[List[str]]) -> None:
"""Do not return anything, modify board in-place instead."""
<|body_0|>
def solve2(self, board: List[List[str]]) -> None:
"""Do not return anything, modify board in-place instead."""
<|body_1|>
<|end... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def solve(self, board: List[List[str]]) -> None:
"""Do not return anything, modify board in-place instead."""
n_row = len(board)
if n_row <= 2:
return
n_col = len(board[0])
if n_col <= 2:
return
queue = deque()
for i in ... | the_stack_v2_python_sparse | python/0130_surrounded_regions.py | forest-sky-sea/Leetcode-Problems | train | 1 | |
f0469d063f482b940d9c07b445e7a2a682bf6a8e | [
"super(NMTModelSampling, self).__init__()\nself.encoder = NMTEncoder(num_embeddings=source_vocab_size, embedding_size=source_embedding_size, rnn_hidden_size=encoding_size)\ndecoding_size = encoding_size * 2\nself.decoder = NMTDecoderSampling(num_embeddings=target_vocab_size, embedding_size=target_embedding_size, rn... | <|body_start_0|>
super(NMTModelSampling, self).__init__()
self.encoder = NMTEncoder(num_embeddings=source_vocab_size, embedding_size=source_embedding_size, rnn_hidden_size=encoding_size)
decoding_size = encoding_size * 2
self.decoder = NMTDecoderSampling(num_embeddings=target_vocab_size,... | The Neural Machine Translation Model | NMTModelSampling | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NMTModelSampling:
"""The Neural Machine Translation Model"""
def __init__(self, source_vocab_size, source_embedding_size, target_vocab_size, target_embedding_size, encoding_size, target_bos_index):
"""Args: source_vocab_size (int): number of unique words in source language source_emb... | stack_v2_sparse_classes_75kplus_train_003083 | 4,550 | permissive | [
{
"docstring": "Args: source_vocab_size (int): number of unique words in source language source_embedding_size (int): size of the source embedding vectors target_vocab_size (int): number of unique words in target language target_embedding_size (int): size of the target embedding vectors encoding_size (int): the... | 2 | stack_v2_sparse_classes_30k_train_003013 | Implement the Python class `NMTModelSampling` described below.
Class description:
The Neural Machine Translation Model
Method signatures and docstrings:
- def __init__(self, source_vocab_size, source_embedding_size, target_vocab_size, target_embedding_size, encoding_size, target_bos_index): Args: source_vocab_size (i... | Implement the Python class `NMTModelSampling` described below.
Class description:
The Neural Machine Translation Model
Method signatures and docstrings:
- def __init__(self, source_vocab_size, source_embedding_size, target_vocab_size, target_embedding_size, encoding_size, target_bos_index): Args: source_vocab_size (i... | 3ab532236ded14338b53683aa9adc75790bd8f0c | <|skeleton|>
class NMTModelSampling:
"""The Neural Machine Translation Model"""
def __init__(self, source_vocab_size, source_embedding_size, target_vocab_size, target_embedding_size, encoding_size, target_bos_index):
"""Args: source_vocab_size (int): number of unique words in source language source_emb... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class NMTModelSampling:
"""The Neural Machine Translation Model"""
def __init__(self, source_vocab_size, source_embedding_size, target_vocab_size, target_embedding_size, encoding_size, target_bos_index):
"""Args: source_vocab_size (int): number of unique words in source language source_embedding_size (... | the_stack_v2_python_sparse | chapters/chapter_8/8_5_NMT/src/model.py | RRisto/pytorchnlpbook | train | 3 |
9e2f90c7e0bfc9993f1dbe323d89ee77d822b67a | [
"assert isinstance(processors, dict), 'Invalid processors %s' % processors\nassert isinstance(content, Content), 'Invalid content %s' % content\nassert isinstance(content.source, IInputStream), 'Invalid content source %s' % content.source\nassert callable(content.doDecode), 'Invalid content decode %s' % content.doD... | <|body_start_0|>
assert isinstance(processors, dict), 'Invalid processors %s' % processors
assert isinstance(content, Content), 'Invalid content %s' % content
assert isinstance(content.source, IInputStream), 'Invalid content source %s' % content.source
assert callable(content.doDecode), ... | The modifier based on indexes. | ModifierByIndex | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ModifierByIndex:
"""The modifier based on indexes."""
def __init__(self, processors, content, first=(), last=()):
"""Construct the modifier based on indexes. @param content: Content The content to modify. @param processors: dictionary{string: callable} The dictionary of do perform pr... | stack_v2_sparse_classes_75kplus_train_003084 | 9,174 | no_license | [
{
"docstring": "Construct the modifier based on indexes. @param content: Content The content to modify. @param processors: dictionary{string: callable} The dictionary of do perform prepare processors calls indexed by verb name. @param first: tuple(string) The default actions to be executed first in the block. @... | 6 | null | Implement the Python class `ModifierByIndex` described below.
Class description:
The modifier based on indexes.
Method signatures and docstrings:
- def __init__(self, processors, content, first=(), last=()): Construct the modifier based on indexes. @param content: Content The content to modify. @param processors: dic... | Implement the Python class `ModifierByIndex` described below.
Class description:
The modifier based on indexes.
Method signatures and docstrings:
- def __init__(self, processors, content, first=(), last=()): Construct the modifier based on indexes. @param content: Content The content to modify. @param processors: dic... | e0b3466b34d31548996d57be4a9dac134d904380 | <|skeleton|>
class ModifierByIndex:
"""The modifier based on indexes."""
def __init__(self, processors, content, first=(), last=()):
"""Construct the modifier based on indexes. @param content: Content The content to modify. @param processors: dictionary{string: callable} The dictionary of do perform pr... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ModifierByIndex:
"""The modifier based on indexes."""
def __init__(self, processors, content, first=(), last=()):
"""Construct the modifier based on indexes. @param content: Content The content to modify. @param processors: dictionary{string: callable} The dictionary of do perform prepare process... | the_stack_v2_python_sparse | components/ally-indexing/ally/indexing/impl/modifier.py | cristidomsa/Ally-Py | train | 0 |
6420d70b7357a13f00e3f107df7832798e1d70a4 | [
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')",
"conte... | <|body_start_0|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
<|end_body_0|>
<|body_start_1|>
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not im... | Missing associated documentation comment in .proto file. | JoinOrderServicer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class JoinOrderServicer:
"""Missing associated documentation comment in .proto file."""
def TestJoinNode(self, request, context):
"""Missing associated documentation comment in .proto file."""
<|body_0|>
def GetAction(self, request, context):
"""Missing associated docu... | stack_v2_sparse_classes_75kplus_train_003085 | 9,709 | no_license | [
{
"docstring": "Missing associated documentation comment in .proto file.",
"name": "TestJoinNode",
"signature": "def TestJoinNode(self, request, context)"
},
{
"docstring": "Missing associated documentation comment in .proto file.",
"name": "GetAction",
"signature": "def GetAction(self, ... | 3 | stack_v2_sparse_classes_30k_train_011067 | Implement the Python class `JoinOrderServicer` described below.
Class description:
Missing associated documentation comment in .proto file.
Method signatures and docstrings:
- def TestJoinNode(self, request, context): Missing associated documentation comment in .proto file.
- def GetAction(self, request, context): Mi... | Implement the Python class `JoinOrderServicer` described below.
Class description:
Missing associated documentation comment in .proto file.
Method signatures and docstrings:
- def TestJoinNode(self, request, context): Missing associated documentation comment in .proto file.
- def GetAction(self, request, context): Mi... | af490823a1b016867d8119a7e0bb5e0c3e2a60a9 | <|skeleton|>
class JoinOrderServicer:
"""Missing associated documentation comment in .proto file."""
def TestJoinNode(self, request, context):
"""Missing associated documentation comment in .proto file."""
<|body_0|>
def GetAction(self, request, context):
"""Missing associated docu... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class JoinOrderServicer:
"""Missing associated documentation comment in .proto file."""
def TestJoinNode(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')... | the_stack_v2_python_sparse | joinorder_rpc/server/join_order_pb2_grpc.py | ehds/learned-tidb | train | 0 |
4eaf5b6a4d2363164e1d50c4036fe6f15d862df1 | [
"self.device = device\nself.affector = affector\nself.time_to_recovery = time_to_recovery\nself._setup = None\nreturn",
"if self._setup is None:\n self._setup = setupiteration.SetupIteration(device=self.device, time_to_recovery=self.time_to_recovery, affector=self.affector)\nreturn self._setup"
] | <|body_start_0|>
self.device = device
self.affector = affector
self.time_to_recovery = time_to_recovery
self._setup = None
return
<|end_body_0|>
<|body_start_1|>
if self._setup is None:
self._setup = setupiteration.SetupIteration(device=self.device, time_to_r... | A SetupIterationBuilder builds Setup Iteration runners | SetupIterationBuilder | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SetupIterationBuilder:
"""A SetupIterationBuilder builds Setup Iteration runners"""
def __init__(self, device, affector, time_to_recovery):
""":param: - `device`: A connection to the DUT - `affector`: An environmental affector - `time_to_recovery`: A time to recovery tester"""
... | stack_v2_sparse_classes_75kplus_train_003086 | 1,014 | permissive | [
{
"docstring": ":param: - `device`: A connection to the DUT - `affector`: An environmental affector - `time_to_recovery`: A time to recovery tester",
"name": "__init__",
"signature": "def __init__(self, device, affector, time_to_recovery)"
},
{
"docstring": ":return: A setup iteration runner",
... | 2 | stack_v2_sparse_classes_30k_train_037821 | Implement the Python class `SetupIterationBuilder` described below.
Class description:
A SetupIterationBuilder builds Setup Iteration runners
Method signatures and docstrings:
- def __init__(self, device, affector, time_to_recovery): :param: - `device`: A connection to the DUT - `affector`: An environmental affector ... | Implement the Python class `SetupIterationBuilder` described below.
Class description:
A SetupIterationBuilder builds Setup Iteration runners
Method signatures and docstrings:
- def __init__(self, device, affector, time_to_recovery): :param: - `device`: A connection to the DUT - `affector`: An environmental affector ... | b4d1c77e1d611fe2b30768b42bdc7493afb0ea95 | <|skeleton|>
class SetupIterationBuilder:
"""A SetupIterationBuilder builds Setup Iteration runners"""
def __init__(self, device, affector, time_to_recovery):
""":param: - `device`: A connection to the DUT - `affector`: An environmental affector - `time_to_recovery`: A time to recovery tester"""
... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class SetupIterationBuilder:
"""A SetupIterationBuilder builds Setup Iteration runners"""
def __init__(self, device, affector, time_to_recovery):
""":param: - `device`: A connection to the DUT - `affector`: An environmental affector - `time_to_recovery`: A time to recovery tester"""
self.device... | the_stack_v2_python_sparse | apetools/builders/subbuilders/setupiterationbuilder.py | russell-n/oldape | train | 0 |
dfd1646b1f2e5cfcd8cd66d20d86ee662b79d14f | [
"order_id = request.GET.get('order_id')\ntry:\n order = OrderInfo.objects.get(order_id=order_id)\nexcept:\n return render(request, '404.html')\ngoods_order = order.skus.filter(is_commented=False)\nskus = []\nfor good in goods_order:\n skus.append({'name': good.sku.name, 'price': str(good.price), 'count': g... | <|body_start_0|>
order_id = request.GET.get('order_id')
try:
order = OrderInfo.objects.get(order_id=order_id)
except:
return render(request, '404.html')
goods_order = order.skus.filter(is_commented=False)
skus = []
for good in goods_order:
... | OrderCommentView | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OrderCommentView:
def get(self, request):
"""订单评价页面 :param request: :return:"""
<|body_0|>
def post(self, request):
"""保存订单商品评价信息 :param request: :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
order_id = request.GET.get('order_id')
... | stack_v2_sparse_classes_75kplus_train_003087 | 11,319 | permissive | [
{
"docstring": "订单评价页面 :param request: :return:",
"name": "get",
"signature": "def get(self, request)"
},
{
"docstring": "保存订单商品评价信息 :param request: :return:",
"name": "post",
"signature": "def post(self, request)"
}
] | 2 | null | Implement the Python class `OrderCommentView` described below.
Class description:
Implement the OrderCommentView class.
Method signatures and docstrings:
- def get(self, request): 订单评价页面 :param request: :return:
- def post(self, request): 保存订单商品评价信息 :param request: :return: | Implement the Python class `OrderCommentView` described below.
Class description:
Implement the OrderCommentView class.
Method signatures and docstrings:
- def get(self, request): 订单评价页面 :param request: :return:
- def post(self, request): 保存订单商品评价信息 :param request: :return:
<|skeleton|>
class OrderCommentView:
... | a85846668e96fe33ad401af13b0e4c4868d17006 | <|skeleton|>
class OrderCommentView:
def get(self, request):
"""订单评价页面 :param request: :return:"""
<|body_0|>
def post(self, request):
"""保存订单商品评价信息 :param request: :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class OrderCommentView:
def get(self, request):
"""订单评价页面 :param request: :return:"""
order_id = request.GET.get('order_id')
try:
order = OrderInfo.objects.get(order_id=order_id)
except:
return render(request, '404.html')
goods_order = order.skus.filte... | the_stack_v2_python_sparse | meiduo_mall/meiduo_mall/apps/orders/views.py | sny1532034183/meiduo | train | 3 | |
d4cb17ff77d3eb9e2eb4d976f249ba4f9a0926de | [
"pygame.sprite.Sprite.__init__(self)\nself.row = row\nself.i = random.randint(30, 240)\nself.x = random.randint(960, 3000)\nself.sec = 0\nself.images = []\nself.images.append(pygame.image.load('assets/images/platforms/platform[0].png'))\nself.images.append(pygame.image.load('assets/images/platforms/platform[1].png'... | <|body_start_0|>
pygame.sprite.Sprite.__init__(self)
self.row = row
self.i = random.randint(30, 240)
self.x = random.randint(960, 3000)
self.sec = 0
self.images = []
self.images.append(pygame.image.load('assets/images/platforms/platform[0].png'))
self.imag... | PlatformClass | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PlatformClass:
def __init__(self, row, speed):
"""Initialize class and pass in a row value and the current game speed."""
<|body_0|>
def update(self, screen, speed):
"""Move the platform towards the left and resets its position and size whenever it exists the screen.... | stack_v2_sparse_classes_75kplus_train_003088 | 2,447 | no_license | [
{
"docstring": "Initialize class and pass in a row value and the current game speed.",
"name": "__init__",
"signature": "def __init__(self, row, speed)"
},
{
"docstring": "Move the platform towards the left and resets its position and size whenever it exists the screen.",
"name": "update",
... | 3 | null | Implement the Python class `PlatformClass` described below.
Class description:
Implement the PlatformClass class.
Method signatures and docstrings:
- def __init__(self, row, speed): Initialize class and pass in a row value and the current game speed.
- def update(self, screen, speed): Move the platform towards the le... | Implement the Python class `PlatformClass` described below.
Class description:
Implement the PlatformClass class.
Method signatures and docstrings:
- def __init__(self, row, speed): Initialize class and pass in a row value and the current game speed.
- def update(self, screen, speed): Move the platform towards the le... | d8ead79d4661489095b4738b5725bcc8a3b15f38 | <|skeleton|>
class PlatformClass:
def __init__(self, row, speed):
"""Initialize class and pass in a row value and the current game speed."""
<|body_0|>
def update(self, screen, speed):
"""Move the platform towards the left and resets its position and size whenever it exists the screen.... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PlatformClass:
def __init__(self, row, speed):
"""Initialize class and pass in a row value and the current game speed."""
pygame.sprite.Sprite.__init__(self)
self.row = row
self.i = random.randint(30, 240)
self.x = random.randint(960, 3000)
self.sec = 0
... | the_stack_v2_python_sparse | platformClass.py | DDSGrandjean/Python_aroundTheWorld_fall2016 | train | 0 | |
706fa5beb6acfd468e4bf0de32322572505468b9 | [
"root = self.get_root_element(data)\nself.xslt_filename = resource_filename('plainbox', 'data/report/checkbox.xsl')\ntemplate_substitutions = {'PLAINBOX_ASSETS': resource_filename('plainbox', 'data/')}\nwith open(self.xslt_filename, encoding='UTF-8') as xslt_file:\n xslt_template = Template(xslt_file.read())\nre... | <|body_start_0|>
root = self.get_root_element(data)
self.xslt_filename = resource_filename('plainbox', 'data/report/checkbox.xsl')
template_substitutions = {'PLAINBOX_ASSETS': resource_filename('plainbox', 'data/')}
with open(self.xslt_filename, encoding='UTF-8') as xslt_file:
... | Session state exporter creating HTML documents. It basically applies an xslt to the XMLSessionStateExporter output, and then inlines some resources to produce a monolithic report in a single file. | HTMLSessionStateExporter | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HTMLSessionStateExporter:
"""Session state exporter creating HTML documents. It basically applies an xslt to the XMLSessionStateExporter output, and then inlines some resources to produce a monolithic report in a single file."""
def dump(self, data, stream):
"""Public method to dump ... | stack_v2_sparse_classes_75kplus_train_003089 | 6,440 | no_license | [
{
"docstring": "Public method to dump the HTML report to a stream",
"name": "dump",
"signature": "def dump(self, data, stream)"
},
{
"docstring": "Dumps the given lxml root tree into the given stream, by applying the provided xslt. If template_substitutions is provided, the xslt will first be pr... | 2 | null | Implement the Python class `HTMLSessionStateExporter` described below.
Class description:
Session state exporter creating HTML documents. It basically applies an xslt to the XMLSessionStateExporter output, and then inlines some resources to produce a monolithic report in a single file.
Method signatures and docstring... | Implement the Python class `HTMLSessionStateExporter` described below.
Class description:
Session state exporter creating HTML documents. It basically applies an xslt to the XMLSessionStateExporter output, and then inlines some resources to produce a monolithic report in a single file.
Method signatures and docstring... | 78aa82cdb35808988214329b3b1aabcc2d1a5e01 | <|skeleton|>
class HTMLSessionStateExporter:
"""Session state exporter creating HTML documents. It basically applies an xslt to the XMLSessionStateExporter output, and then inlines some resources to produce a monolithic report in a single file."""
def dump(self, data, stream):
"""Public method to dump ... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class HTMLSessionStateExporter:
"""Session state exporter creating HTML documents. It basically applies an xslt to the XMLSessionStateExporter output, and then inlines some resources to produce a monolithic report in a single file."""
def dump(self, data, stream):
"""Public method to dump the HTML repo... | the_stack_v2_python_sparse | venv/lib/python3.6/site-packages/plainbox/impl/exporter/html.py | utkarshyadavin/CloudMarks | train | 0 |
c241e26d5c689973131bbbb194a40818fbbe3990 | [
"moduleLogger.debug('c2wChatClientProtocolFactory constructor called' + ' with protocol class: ' + str(protocolClass))\nself.protocolClass = protocolClass\nself.c2wClientProxy = c2wClientProxy",
"moduleLogger.debug('Building a new protocol instance')\np = self.protocolClass(self.c2wClientProxy, addr.host, addr.po... | <|body_start_0|>
moduleLogger.debug('c2wChatClientProtocolFactory constructor called' + ' with protocol class: ' + str(protocolClass))
self.protocolClass = protocolClass
self.c2wClientProxy = c2wClientProxy
<|end_body_0|>
<|body_start_1|>
moduleLogger.debug('Building a new protocol inst... | c2wChatClientProtocolFactory | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class c2wChatClientProtocolFactory:
def __init__(self, protocolClass, c2wClientProxy):
""":param protocol: The complete protocol class name (including the module name). :param chatClientProtocolController: A reference to the corresponding chatClientProtocolController The constructor for the cl... | stack_v2_sparse_classes_75kplus_train_003090 | 1,565 | no_license | [
{
"docstring": ":param protocol: The complete protocol class name (including the module name). :param chatClientProtocolController: A reference to the corresponding chatClientProtocolController The constructor for the class.",
"name": "__init__",
"signature": "def __init__(self, protocolClass, c2wClient... | 2 | stack_v2_sparse_classes_30k_train_028472 | Implement the Python class `c2wChatClientProtocolFactory` described below.
Class description:
Implement the c2wChatClientProtocolFactory class.
Method signatures and docstrings:
- def __init__(self, protocolClass, c2wClientProxy): :param protocol: The complete protocol class name (including the module name). :param c... | Implement the Python class `c2wChatClientProtocolFactory` described below.
Class description:
Implement the c2wChatClientProtocolFactory class.
Method signatures and docstrings:
- def __init__(self, protocolClass, c2wClientProxy): :param protocol: The complete protocol class name (including the module name). :param c... | a8d053a3de304afb43675d37173b0af791b2184d | <|skeleton|>
class c2wChatClientProtocolFactory:
def __init__(self, protocolClass, c2wClientProxy):
""":param protocol: The complete protocol class name (including the module name). :param chatClientProtocolController: A reference to the corresponding chatClientProtocolController The constructor for the cl... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class c2wChatClientProtocolFactory:
def __init__(self, protocolClass, c2wClientProxy):
""":param protocol: The complete protocol class name (including the module name). :param chatClientProtocolController: A reference to the corresponding chatClientProtocolController The constructor for the class."""
... | the_stack_v2_python_sparse | utils/.svn/pristine/c2/c241e26d5c689973131bbbb194a40818fbbe3990.svn-base | baptistegaut/chat-while-watching | train | 0 | |
768f03ce49c672fa423b0b8c3b1addf52edc06c5 | [
"pkgs = []\nfor modulo in MODULOS_PLUGINS:\n nombre = modulo.split(',')[0]\n from os import listdir\n from os.path import join, isdir\n path_plugin = join(PATH_MODULOS, modulo, 'plugins')\n try:\n dirs = []\n for file_ in listdir(path_plugin):\n if isdir(join(path_plugin, fil... | <|body_start_0|>
pkgs = []
for modulo in MODULOS_PLUGINS:
nombre = modulo.split(',')[0]
from os import listdir
from os.path import join, isdir
path_plugin = join(PATH_MODULOS, modulo, 'plugins')
try:
dirs = []
fo... | Clase para manejar la deteccion automatica de plugins. | PluginDetector | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PluginDetector:
"""Clase para manejar la deteccion automatica de plugins."""
def get_pkgs(self):
"""Devuelve los paquetes de los plugins de cada modulo."""
<|body_0|>
def get_clases(self):
"""Devuelve las clases de los plugins."""
<|body_1|>
def get_... | stack_v2_sparse_classes_75kplus_train_003091 | 6,293 | no_license | [
{
"docstring": "Devuelve los paquetes de los plugins de cada modulo.",
"name": "get_pkgs",
"signature": "def get_pkgs(self)"
},
{
"docstring": "Devuelve las clases de los plugins.",
"name": "get_clases",
"signature": "def get_clases(self)"
},
{
"docstring": "Devuelve los plugins ... | 3 | stack_v2_sparse_classes_30k_train_044416 | Implement the Python class `PluginDetector` described below.
Class description:
Clase para manejar la deteccion automatica de plugins.
Method signatures and docstrings:
- def get_pkgs(self): Devuelve los paquetes de los plugins de cada modulo.
- def get_clases(self): Devuelve las clases de los plugins.
- def get_plug... | Implement the Python class `PluginDetector` described below.
Class description:
Clase para manejar la deteccion automatica de plugins.
Method signatures and docstrings:
- def get_pkgs(self): Devuelve los paquetes de los plugins de cada modulo.
- def get_clases(self): Devuelve las clases de los plugins.
- def get_plug... | 72d8fa1ea08fe417b64340b98dff68df8364afdf | <|skeleton|>
class PluginDetector:
"""Clase para manejar la deteccion automatica de plugins."""
def get_pkgs(self):
"""Devuelve los paquetes de los plugins de cada modulo."""
<|body_0|>
def get_clases(self):
"""Devuelve las clases de los plugins."""
<|body_1|>
def get_... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class PluginDetector:
"""Clase para manejar la deteccion automatica de plugins."""
def get_pkgs(self):
"""Devuelve los paquetes de los plugins de cada modulo."""
pkgs = []
for modulo in MODULOS_PLUGINS:
nombre = modulo.split(',')[0]
from os import listdir
... | the_stack_v2_python_sparse | msa/modulos/base/plugins.py | prometheus-ar/vot.ar | train | 171 |
b2f95b6ef25783caa94625309358c670a063f39b | [
"self._file = io.BytesIO(data)\nself._max_offset = len(data)\nself.audio_format = audio_format\nself._duration = len(data) / float(audio_format.bytes_per_second)",
"offset = int(timestamp * self.audio_format.bytes_per_second)\nif self.audio_format.bytes_per_sample == 2:\n offset &= 4294967294\nelif self.audio_... | <|body_start_0|>
self._file = io.BytesIO(data)
self._max_offset = len(data)
self.audio_format = audio_format
self._duration = len(data) / float(audio_format.bytes_per_second)
<|end_body_0|>
<|body_start_1|>
offset = int(timestamp * self.audio_format.bytes_per_second)
if ... | Helper class for default implementation of :class:`.StaticSource`. Do not use directly. This class is used internally by pyglet. Args: data (AudioData): The audio data. audio_format (AudioFormat): The audio format. | StaticMemorySource | [
"BSD-3-Clause",
"LicenseRef-scancode-free-unknown"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StaticMemorySource:
"""Helper class for default implementation of :class:`.StaticSource`. Do not use directly. This class is used internally by pyglet. Args: data (AudioData): The audio data. audio_format (AudioFormat): The audio format."""
def __init__(self, data, audio_format):
"""... | stack_v2_sparse_classes_75kplus_train_003092 | 17,960 | permissive | [
{
"docstring": "Construct a memory source over the given data buffer.",
"name": "__init__",
"signature": "def __init__(self, data, audio_format)"
},
{
"docstring": "Seek to given timestamp. Args: timestamp (float): Time where to seek in the source.",
"name": "seek",
"signature": "def see... | 3 | stack_v2_sparse_classes_30k_train_000040 | Implement the Python class `StaticMemorySource` described below.
Class description:
Helper class for default implementation of :class:`.StaticSource`. Do not use directly. This class is used internally by pyglet. Args: data (AudioData): The audio data. audio_format (AudioFormat): The audio format.
Method signatures a... | Implement the Python class `StaticMemorySource` described below.
Class description:
Helper class for default implementation of :class:`.StaticSource`. Do not use directly. This class is used internally by pyglet. Args: data (AudioData): The audio data. audio_format (AudioFormat): The audio format.
Method signatures a... | 094c638f0529fecab4e74556487b92453a78753c | <|skeleton|>
class StaticMemorySource:
"""Helper class for default implementation of :class:`.StaticSource`. Do not use directly. This class is used internally by pyglet. Args: data (AudioData): The audio data. audio_format (AudioFormat): The audio format."""
def __init__(self, data, audio_format):
"""... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class StaticMemorySource:
"""Helper class for default implementation of :class:`.StaticSource`. Do not use directly. This class is used internally by pyglet. Args: data (AudioData): The audio data. audio_format (AudioFormat): The audio format."""
def __init__(self, data, audio_format):
"""Construct a m... | the_stack_v2_python_sparse | pyglet/media/codecs/base.py | pyglet/pyglet | train | 1,687 |
f03948bb5a60858763a850c7537f0ed3a0a23e25 | [
"vertex_combinations = list(map(lambda x: x[0] + '-' + x[1], combinations(self.N, 2)))\nfor a in self.A:\n v = self.A[a].getV1() + '-' + self.A[a].getV2()\n if v in vertex_combinations:\n vertex_combinations.remove(v)\n elif v[::-1] in vertex_combinations:\n vertex_combinations.remove(v[::-1]... | <|body_start_0|>
vertex_combinations = list(map(lambda x: x[0] + '-' + x[1], combinations(self.N, 2)))
for a in self.A:
v = self.A[a].getV1() + '-' + self.A[a].getV2()
if v in vertex_combinations:
vertex_combinations.remove(v)
elif v[::-1] in vertex_co... | MeuGrafo | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MeuGrafo:
def vertices_nao_adjacentes(self) -> List[int]:
"""Provê uma lista de vértices não adjacentes no grafo. A lista terá o seguinte formato: [X-Z, X-W, ...]. Onde X, Z e W são vértices no grafo que não tem uma aresta entre eles. Returns: list"""
<|body_0|>
def ha_laco(... | stack_v2_sparse_classes_75kplus_train_003093 | 3,466 | no_license | [
{
"docstring": "Provê uma lista de vértices não adjacentes no grafo. A lista terá o seguinte formato: [X-Z, X-W, ...]. Onde X, Z e W são vértices no grafo que não tem uma aresta entre eles. Returns: list",
"name": "vertices_nao_adjacentes",
"signature": "def vertices_nao_adjacentes(self) -> List[int]"
... | 6 | null | Implement the Python class `MeuGrafo` described below.
Class description:
Implement the MeuGrafo class.
Method signatures and docstrings:
- def vertices_nao_adjacentes(self) -> List[int]: Provê uma lista de vértices não adjacentes no grafo. A lista terá o seguinte formato: [X-Z, X-W, ...]. Onde X, Z e W são vértices ... | Implement the Python class `MeuGrafo` described below.
Class description:
Implement the MeuGrafo class.
Method signatures and docstrings:
- def vertices_nao_adjacentes(self) -> List[int]: Provê uma lista de vértices não adjacentes no grafo. A lista terá o seguinte formato: [X-Z, X-W, ...]. Onde X, Z e W são vértices ... | 99e41091c0723ff584903d48f356fddab4d1c923 | <|skeleton|>
class MeuGrafo:
def vertices_nao_adjacentes(self) -> List[int]:
"""Provê uma lista de vértices não adjacentes no grafo. A lista terá o seguinte formato: [X-Z, X-W, ...]. Onde X, Z e W são vértices no grafo que não tem uma aresta entre eles. Returns: list"""
<|body_0|>
def ha_laco(... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class MeuGrafo:
def vertices_nao_adjacentes(self) -> List[int]:
"""Provê uma lista de vértices não adjacentes no grafo. A lista terá o seguinte formato: [X-Z, X-W, ...]. Onde X, Z e W são vértices no grafo que não tem uma aresta entre eles. Returns: list"""
vertex_combinations = list(map(lambda x: x... | the_stack_v2_python_sparse | roteiro_1/meu_grafo.py | henrique-lh/Graph_theory | train | 0 | |
f1abbeeb3a3bd721b7244555e560f6f2e3da510e | [
"dp = [0 for i in range(n + 1)]\nif n == 2:\n return 1\ndp[1] = 1\ndp[2] = 1\nfor i in range(3, n + 1):\n for j in range(1, i // 2 + 1):\n dp[i] = max(dp[i], max(dp[j], j) * max(dp[i - j], i - j))\nreturn dp[-1]",
"res = 0\nfor i in range(2, n + 1):\n a1 = n // i\n if n % i == 0:\n res =... | <|body_start_0|>
dp = [0 for i in range(n + 1)]
if n == 2:
return 1
dp[1] = 1
dp[2] = 1
for i in range(3, n + 1):
for j in range(1, i // 2 + 1):
dp[i] = max(dp[i], max(dp[j], j) * max(dp[i - j], i - j))
return dp[-1]
<|end_body_0|>
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def integerBreak(self, n):
""":type n: int :rtype: int 32ms"""
<|body_0|>
def integerBreak(self, n):
""":type n: int :rtype: int 28ms"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
dp = [0 for i in range(n + 1)]
if n == 2:
... | stack_v2_sparse_classes_75kplus_train_003094 | 1,193 | no_license | [
{
"docstring": ":type n: int :rtype: int 32ms",
"name": "integerBreak",
"signature": "def integerBreak(self, n)"
},
{
"docstring": ":type n: int :rtype: int 28ms",
"name": "integerBreak",
"signature": "def integerBreak(self, n)"
}
] | 2 | stack_v2_sparse_classes_30k_train_018563 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def integerBreak(self, n): :type n: int :rtype: int 32ms
- def integerBreak(self, n): :type n: int :rtype: int 28ms | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def integerBreak(self, n): :type n: int :rtype: int 32ms
- def integerBreak(self, n): :type n: int :rtype: int 28ms
<|skeleton|>
class Solution:
def integerBreak(self, n):
... | 679a2b246b8b6bb7fc55ed1c8096d3047d6d4461 | <|skeleton|>
class Solution:
def integerBreak(self, n):
""":type n: int :rtype: int 32ms"""
<|body_0|>
def integerBreak(self, n):
""":type n: int :rtype: int 28ms"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def integerBreak(self, n):
""":type n: int :rtype: int 32ms"""
dp = [0 for i in range(n + 1)]
if n == 2:
return 1
dp[1] = 1
dp[2] = 1
for i in range(3, n + 1):
for j in range(1, i // 2 + 1):
dp[i] = max(dp[i], ma... | the_stack_v2_python_sparse | IntegerBreak_MID_343.py | 953250587/leetcode-python | train | 2 | |
4df837e9bb9fa5f51628b12efb87c19c7119c177 | [
"pokemon['Name'] = 'Richard'\npokemon['Class'] = 'Bulbasaur'\npokemon['Position'] = [0, 2]\npokemon['HP'] = 10",
"random.seed(6)\nexpected_output = 'You attacked Pikachu with a slap and he took 5 damage.\\nSuccess! Your opponent has fainted and you gained 20 prize dollars from your battle.\\n\\n'\nopponent = {'Na... | <|body_start_0|>
pokemon['Name'] = 'Richard'
pokemon['Class'] = 'Bulbasaur'
pokemon['Position'] = [0, 2]
pokemon['HP'] = 10
<|end_body_0|>
<|body_start_1|>
random.seed(6)
expected_output = 'You attacked Pikachu with a slap and he took 5 damage.\nSuccess! Your opponent ha... | TestCombatRound | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestCombatRound:
def setUp(self):
"""Assert global variable key-value pairs for unit testing."""
<|body_0|>
def test_combat_round_output(self, mock_stdout):
"""Assert expected print output of function after execution."""
<|body_1|>
def test_combat_round_... | stack_v2_sparse_classes_75kplus_train_003095 | 2,172 | no_license | [
{
"docstring": "Assert global variable key-value pairs for unit testing.",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "Assert expected print output of function after execution.",
"name": "test_combat_round_output",
"signature": "def test_combat_round_output(self, m... | 5 | stack_v2_sparse_classes_30k_train_043767 | Implement the Python class `TestCombatRound` described below.
Class description:
Implement the TestCombatRound class.
Method signatures and docstrings:
- def setUp(self): Assert global variable key-value pairs for unit testing.
- def test_combat_round_output(self, mock_stdout): Assert expected print output of functio... | Implement the Python class `TestCombatRound` described below.
Class description:
Implement the TestCombatRound class.
Method signatures and docstrings:
- def setUp(self): Assert global variable key-value pairs for unit testing.
- def test_combat_round_output(self, mock_stdout): Assert expected print output of functio... | 4053046fffb170104ea4209b156ee97185ef4f6f | <|skeleton|>
class TestCombatRound:
def setUp(self):
"""Assert global variable key-value pairs for unit testing."""
<|body_0|>
def test_combat_round_output(self, mock_stdout):
"""Assert expected print output of function after execution."""
<|body_1|>
def test_combat_round_... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class TestCombatRound:
def setUp(self):
"""Assert global variable key-value pairs for unit testing."""
pokemon['Name'] = 'Richard'
pokemon['Class'] = 'Bulbasaur'
pokemon['Position'] = [0, 2]
pokemon['HP'] = 10
def test_combat_round_output(self, mock_stdout):
"""A... | the_stack_v2_python_sparse | A3/test_combat_round.py | truongnguyenlinh/procedural_python | train | 0 | |
6c45bf8ab80c5c4a955e7bd9e9d7d4e6f8216ab5 | [
"self.num_in = num_in\nself.number_of_nodes = number_of_nodes\nself.weights = self.init_weights(activation)\nself.output = activation(T.dot(input, self.weights))\nself.params = [self.weights]",
"weights = np.asarray(np.random.uniform(low=-np.sqrt(6.0 / (self.num_in + self.number_of_nodes)), high=np.sqrt(6.0 / (se... | <|body_start_0|>
self.num_in = num_in
self.number_of_nodes = number_of_nodes
self.weights = self.init_weights(activation)
self.output = activation(T.dot(input, self.weights))
self.params = [self.weights]
<|end_body_0|>
<|body_start_1|>
weights = np.asarray(np.random.unif... | HiddenLayer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HiddenLayer:
def __init__(self, input, num_in, number_of_nodes, activation):
"""A hidden layer in an artifical neural network is defined by the output of the activation function of the previous layer, the number of incoming neurons connected to the layer, the amount of neurons in the lay... | stack_v2_sparse_classes_75kplus_train_003096 | 2,621 | permissive | [
{
"docstring": "A hidden layer in an artifical neural network is defined by the output of the activation function of the previous layer, the number of incoming neurons connected to the layer, the amount of neurons in the layer and an activation function. :param input: the output of the activation function in th... | 2 | stack_v2_sparse_classes_30k_train_000795 | Implement the Python class `HiddenLayer` described below.
Class description:
Implement the HiddenLayer class.
Method signatures and docstrings:
- def __init__(self, input, num_in, number_of_nodes, activation): A hidden layer in an artifical neural network is defined by the output of the activation function of the pre... | Implement the Python class `HiddenLayer` described below.
Class description:
Implement the HiddenLayer class.
Method signatures and docstrings:
- def __init__(self, input, num_in, number_of_nodes, activation): A hidden layer in an artifical neural network is defined by the output of the activation function of the pre... | 79f3b4a5f624d473b461548b263bcf7ecc0846dc | <|skeleton|>
class HiddenLayer:
def __init__(self, input, num_in, number_of_nodes, activation):
"""A hidden layer in an artifical neural network is defined by the output of the activation function of the previous layer, the number of incoming neurons connected to the layer, the amount of neurons in the lay... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class HiddenLayer:
def __init__(self, input, num_in, number_of_nodes, activation):
"""A hidden layer in an artifical neural network is defined by the output of the activation function of the previous layer, the number of incoming neurons connected to the layer, the amount of neurons in the layer and an acti... | the_stack_v2_python_sparse | project3/module5/deeplearning/layer.py | pmitche/it3105-aiprogramming | train | 3 | |
3d3769dfb66f03a6652f6e4821e07e02986e2c9c | [
"active_users_by_email = UserModel._default_manager.filter(**{'%s__iexact' % UserModel.get_email_field_name(): email, 'is_active': True})\nactive_users_by_username = UserModel._default_manager.filter(**{'username__iexact': username, 'is_active': True})\nusers = []\nfor u in active_users_by_email:\n if u.has_usab... | <|body_start_0|>
active_users_by_email = UserModel._default_manager.filter(**{'%s__iexact' % UserModel.get_email_field_name(): email, 'is_active': True})
active_users_by_username = UserModel._default_manager.filter(**{'username__iexact': username, 'is_active': True})
users = []
for u in ... | UsernameAwarePasswordResetForm | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UsernameAwarePasswordResetForm:
def get_users(self, email=None, username=None):
"""Given an email or username, return matching user(s) who should receive a reset. This allows subclasses to more easily customize the default policies that prevent inactive users and users with unusable pass... | stack_v2_sparse_classes_75kplus_train_003097 | 11,141 | no_license | [
{
"docstring": "Given an email or username, return matching user(s) who should receive a reset. This allows subclasses to more easily customize the default policies that prevent inactive users and users with unusable passwords from resetting their password.",
"name": "get_users",
"signature": "def get_u... | 2 | stack_v2_sparse_classes_30k_train_017836 | Implement the Python class `UsernameAwarePasswordResetForm` described below.
Class description:
Implement the UsernameAwarePasswordResetForm class.
Method signatures and docstrings:
- def get_users(self, email=None, username=None): Given an email or username, return matching user(s) who should receive a reset. This a... | Implement the Python class `UsernameAwarePasswordResetForm` described below.
Class description:
Implement the UsernameAwarePasswordResetForm class.
Method signatures and docstrings:
- def get_users(self, email=None, username=None): Given an email or username, return matching user(s) who should receive a reset. This a... | 0a90553a04a947175a74dd11fb2eb9dc72385a12 | <|skeleton|>
class UsernameAwarePasswordResetForm:
def get_users(self, email=None, username=None):
"""Given an email or username, return matching user(s) who should receive a reset. This allows subclasses to more easily customize the default policies that prevent inactive users and users with unusable pass... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class UsernameAwarePasswordResetForm:
def get_users(self, email=None, username=None):
"""Given an email or username, return matching user(s) who should receive a reset. This allows subclasses to more easily customize the default policies that prevent inactive users and users with unusable passwords from res... | the_stack_v2_python_sparse | fanart/forms.py | bctiemann/tlkfaa | train | 1 | |
1d693cf05eef86ecae5edd7bf928cec01f854473 | [
"try:\n resource, authorized, user = view_utils.authorize(request, pk, needed_permission=ACTION_TO_AUTHORIZE.VIEW_RESOURCE, raises_exception=False)\nexcept NotFound as ex:\n return Response(str(ex), status=status.HTTP_404_NOT_FOUND)\nif not authorized:\n return Response('Insufficient permission', status=st... | <|body_start_0|>
try:
resource, authorized, user = view_utils.authorize(request, pk, needed_permission=ACTION_TO_AUTHORIZE.VIEW_RESOURCE, raises_exception=False)
except NotFound as ex:
return Response(str(ex), status=status.HTTP_404_NOT_FOUND)
if not authorized:
... | Manipulate resource folders in REST REST URL: hsapi/resource/{pk}/folders/{path}/ HTTP methods: GET, PUT, DELETE Returns HTTP 400, 403, 404 | ResourceFolders | [
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ResourceFolders:
"""Manipulate resource folders in REST REST URL: hsapi/resource/{pk}/folders/{path}/ HTTP methods: GET, PUT, DELETE Returns HTTP 400, 403, 404"""
def get(self, request, pk, pathname):
"""list a given folder"""
<|body_0|>
def put(self, request, pk, pathna... | stack_v2_sparse_classes_75kplus_train_003098 | 4,699 | permissive | [
{
"docstring": "list a given folder",
"name": "get",
"signature": "def get(self, request, pk, pathname)"
},
{
"docstring": "create a given folder if not present and allowed",
"name": "put",
"signature": "def put(self, request, pk, pathname)"
},
{
"docstring": "Delete a folder.",
... | 3 | stack_v2_sparse_classes_30k_train_018805 | Implement the Python class `ResourceFolders` described below.
Class description:
Manipulate resource folders in REST REST URL: hsapi/resource/{pk}/folders/{path}/ HTTP methods: GET, PUT, DELETE Returns HTTP 400, 403, 404
Method signatures and docstrings:
- def get(self, request, pk, pathname): list a given folder
- d... | Implement the Python class `ResourceFolders` described below.
Class description:
Manipulate resource folders in REST REST URL: hsapi/resource/{pk}/folders/{path}/ HTTP methods: GET, PUT, DELETE Returns HTTP 400, 403, 404
Method signatures and docstrings:
- def get(self, request, pk, pathname): list a given folder
- d... | 69855813052243c702c9b0108d2eac3f4f1a768f | <|skeleton|>
class ResourceFolders:
"""Manipulate resource folders in REST REST URL: hsapi/resource/{pk}/folders/{path}/ HTTP methods: GET, PUT, DELETE Returns HTTP 400, 403, 404"""
def get(self, request, pk, pathname):
"""list a given folder"""
<|body_0|>
def put(self, request, pk, pathna... | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class ResourceFolders:
"""Manipulate resource folders in REST REST URL: hsapi/resource/{pk}/folders/{path}/ HTTP methods: GET, PUT, DELETE Returns HTTP 400, 403, 404"""
def get(self, request, pk, pathname):
"""list a given folder"""
try:
resource, authorized, user = view_utils.autho... | the_stack_v2_python_sparse | hs_core/views/resource_folder_rest_api.py | hydroshare/hydroshare | train | 207 |
19a9ad24cd4e1c9bbc5c92a5f9aebfc17d3bbc16 | [
"seen = set()\nwhile headA:\n seen.add(headA)\n headA = headA.next\nwhile headB:\n if headB in seen:\n return headB\n headB = headB.next\nreturn None",
"if not headA or not headB:\n return None\nhead1, head2 = (headA, headB)\nwhile head1 != head2:\n if head1:\n head1 = head1.next\n... | <|body_start_0|>
seen = set()
while headA:
seen.add(headA)
headA = headA.next
while headB:
if headB in seen:
return headB
headB = headB.next
return None
<|end_body_0|>
<|body_start_1|>
if not headA or not headB:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def getIntersectionNodeHash(self, headA: ListNode, headB: ListNode) -> ListNode:
"""哈希表"""
<|body_0|>
def getIntersectionNode(self, headA: ListNode, headB: ListNode) -> ListNode:
"""快慢指针"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
seen... | stack_v2_sparse_classes_75kplus_train_003099 | 1,456 | no_license | [
{
"docstring": "哈希表",
"name": "getIntersectionNodeHash",
"signature": "def getIntersectionNodeHash(self, headA: ListNode, headB: ListNode) -> ListNode"
},
{
"docstring": "快慢指针",
"name": "getIntersectionNode",
"signature": "def getIntersectionNode(self, headA: ListNode, headB: ListNode) -... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def getIntersectionNodeHash(self, headA: ListNode, headB: ListNode) -> ListNode: 哈希表
- def getIntersectionNode(self, headA: ListNode, headB: ListNode) -> ListNode: 快慢指针 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def getIntersectionNodeHash(self, headA: ListNode, headB: ListNode) -> ListNode: 哈希表
- def getIntersectionNode(self, headA: ListNode, headB: ListNode) -> ListNode: 快慢指针
<|skelet... | 52756b30e9d51794591aca030bc918e707f473f1 | <|skeleton|>
class Solution:
def getIntersectionNodeHash(self, headA: ListNode, headB: ListNode) -> ListNode:
"""哈希表"""
<|body_0|>
def getIntersectionNode(self, headA: ListNode, headB: ListNode) -> ListNode:
"""快慢指针"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_75kplus | data/stack_v2_sparse_classes_30k | 75,829 | class Solution:
def getIntersectionNodeHash(self, headA: ListNode, headB: ListNode) -> ListNode:
"""哈希表"""
seen = set()
while headA:
seen.add(headA)
headA = headA.next
while headB:
if headB in seen:
return headB
headB = ... | the_stack_v2_python_sparse | 160.相交链表/solution.py | QtTao/daily_leetcode | train | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.