blob_id stringlengths 40 40 | bodies listlengths 2 6 | bodies_text stringlengths 196 6.73k | class_docstring stringlengths 0 700 | class_name stringlengths 1 86 | detected_licenses listlengths 0 45 | format_version stringclasses 1
value | full_text stringlengths 438 7.52k | id stringlengths 40 40 | length_bytes int64 506 50k | license_type stringclasses 2
values | methods listlengths 2 6 | n_methods int64 2 6 | original_id stringlengths 38 40 ⌀ | prompt stringlengths 153 4.25k | prompted_full_text stringlengths 645 10.7k | revision_id stringlengths 40 40 | skeleton stringlengths 162 4.34k | snapshot_name stringclasses 1
value | snapshot_source_dir stringclasses 1
value | solution stringlengths 302 7.33k | source stringclasses 1
value | source_path stringlengths 4 177 | source_repo stringlengths 6 110 | split stringclasses 1
value | star_events_count int64 0 209k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
37f368d98ff82e94405dfde7d7b1ca48b32d4c2d | [
"if not isinstance(gate, Gate):\n raise TypeError(f'Expected gate, got {type(gate)}')\nself.gate = gate",
"gate_count = circuit.count(self.gate)\nif self.key not in data:\n _logger.debug(f'Could not find {self.key} key.')\n data[self.key] = gate_count\n return True\nif data[self.key] == gate_count:\n ... | <|body_start_0|>
if not isinstance(gate, Gate):
raise TypeError(f'Expected gate, got {type(gate)}')
self.gate = gate
<|end_body_0|>
<|body_start_1|>
gate_count = circuit.count(self.gate)
if self.key not in data:
_logger.debug(f'Could not find {self.key} key.')
... | The GateCountPredicate class. The GateCountPredicate returns true if the number of one type of gate has changed in the circuit. | GateCountPredicate | [
"LicenseRef-scancode-unknown-license-reference",
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GateCountPredicate:
"""The GateCountPredicate class. The GateCountPredicate returns true if the number of one type of gate has changed in the circuit."""
def __init__(self, gate: Gate) -> None:
"""Construct a GateCountPredicate."""
<|body_0|>
def get_truth_value(self, ci... | stack_v2_sparse_classes_36k_train_010500 | 1,496 | permissive | [
{
"docstring": "Construct a GateCountPredicate.",
"name": "__init__",
"signature": "def __init__(self, gate: Gate) -> None"
},
{
"docstring": "Call this predicate, see PassPredicate for more info.",
"name": "get_truth_value",
"signature": "def get_truth_value(self, circuit: Circuit, data... | 2 | null | Implement the Python class `GateCountPredicate` described below.
Class description:
The GateCountPredicate class. The GateCountPredicate returns true if the number of one type of gate has changed in the circuit.
Method signatures and docstrings:
- def __init__(self, gate: Gate) -> None: Construct a GateCountPredicate... | Implement the Python class `GateCountPredicate` described below.
Class description:
The GateCountPredicate class. The GateCountPredicate returns true if the number of one type of gate has changed in the circuit.
Method signatures and docstrings:
- def __init__(self, gate: Gate) -> None: Construct a GateCountPredicate... | 3083218c2f4e3c3ce4ba027d12caa30c384d7665 | <|skeleton|>
class GateCountPredicate:
"""The GateCountPredicate class. The GateCountPredicate returns true if the number of one type of gate has changed in the circuit."""
def __init__(self, gate: Gate) -> None:
"""Construct a GateCountPredicate."""
<|body_0|>
def get_truth_value(self, ci... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GateCountPredicate:
"""The GateCountPredicate class. The GateCountPredicate returns true if the number of one type of gate has changed in the circuit."""
def __init__(self, gate: Gate) -> None:
"""Construct a GateCountPredicate."""
if not isinstance(gate, Gate):
raise TypeErro... | the_stack_v2_python_sparse | bqskit/compiler/passes/control/predicates/count.py | mtreinish/bqskit | train | 0 |
e79e742a4cf7222f06affed8bf5ab8e09118d7f2 | [
"self.orig_block_key = block.scope_ids.usage_id\nself.static_files = []\nself.def_id = blockstore_def_key_from_modulestore_usage_key(self.orig_block_key)\nif self.orig_block_key.block_type == 'html':\n self.serialize_html_block(block)\nelse:\n self.serialize_normal_block(block)\ncourse_key = self.orig_block_k... | <|body_start_0|>
self.orig_block_key = block.scope_ids.usage_id
self.static_files = []
self.def_id = blockstore_def_key_from_modulestore_usage_key(self.orig_block_key)
if self.orig_block_key.block_type == 'html':
self.serialize_html_block(block)
else:
self... | This class will serialize an XBlock, producing: (1) A new definition ID for use in Blockstore (2) an XML string defining the XBlock and referencing the IDs of its children (but not containing the actual XML of its children) (3) a list of any static files required by the XBlock and their URL | XBlockSerializer | [
"AGPL-3.0-only",
"AGPL-3.0-or-later",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class XBlockSerializer:
"""This class will serialize an XBlock, producing: (1) A new definition ID for use in Blockstore (2) an XML string defining the XBlock and referencing the IDs of its children (but not containing the actual XML of its children) (3) a list of any static files required by the XBloc... | stack_v2_sparse_classes_36k_train_010501 | 7,637 | permissive | [
{
"docstring": "Serialize an XBlock to an OLX string + supporting files, and store the resulting data in this object.",
"name": "__init__",
"signature": "def __init__(self, block)"
},
{
"docstring": "Serialize an XBlock to XML. This method is used for every block type except HTML, which uses ser... | 4 | null | Implement the Python class `XBlockSerializer` described below.
Class description:
This class will serialize an XBlock, producing: (1) A new definition ID for use in Blockstore (2) an XML string defining the XBlock and referencing the IDs of its children (but not containing the actual XML of its children) (3) a list of... | Implement the Python class `XBlockSerializer` described below.
Class description:
This class will serialize an XBlock, producing: (1) A new definition ID for use in Blockstore (2) an XML string defining the XBlock and referencing the IDs of its children (but not containing the actual XML of its children) (3) a list of... | 5809eaca7079a15ee56b0b7fcfea425337046c97 | <|skeleton|>
class XBlockSerializer:
"""This class will serialize an XBlock, producing: (1) A new definition ID for use in Blockstore (2) an XML string defining the XBlock and referencing the IDs of its children (but not containing the actual XML of its children) (3) a list of any static files required by the XBloc... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class XBlockSerializer:
"""This class will serialize an XBlock, producing: (1) A new definition ID for use in Blockstore (2) an XML string defining the XBlock and referencing the IDs of its children (but not containing the actual XML of its children) (3) a list of any static files required by the XBlock and their U... | the_stack_v2_python_sparse | Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/openedx/core/djangoapps/olx_rest_api/block_serializer.py | luque/better-ways-of-thinking-about-software | train | 3 |
b5343630cc6fab3f7710a3209f3f9736ea9892e0 | [
"super(XLSXWriter, self).__init__(filename)\nif not xlwt:\n print('**********************************************************')\n print('You need to install \"xlsxwriter\" first to export xlsx files!')\n print('You can use \"pip install xlsxwriter\" to install it! ')\n print('*******************... | <|body_start_0|>
super(XLSXWriter, self).__init__(filename)
if not xlwt:
print('**********************************************************')
print('You need to install "xlsxwriter" first to export xlsx files!')
print('You can use "pip install xlsxwriter" to install it... | XLSX file's writer. IT HAS PROBLEMS ON WINDOWS! | XLSXWriter | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class XLSXWriter:
"""XLSX file's writer. IT HAS PROBLEMS ON WINDOWS!"""
def __init__(self, filename=None):
"""Args: filename: (String) data file's name. Returns: None"""
<|body_0|>
def writeln(self, line):
"""Write data line. Args: line: (List) Line data. Returns: bool... | stack_v2_sparse_classes_36k_train_010502 | 6,679 | permissive | [
{
"docstring": "Args: filename: (String) data file's name. Returns: None",
"name": "__init__",
"signature": "def __init__(self, filename=None)"
},
{
"docstring": "Write data line. Args: line: (List) Line data. Returns: boolean: Write success.",
"name": "writeln",
"signature": "def writel... | 3 | null | Implement the Python class `XLSXWriter` described below.
Class description:
XLSX file's writer. IT HAS PROBLEMS ON WINDOWS!
Method signatures and docstrings:
- def __init__(self, filename=None): Args: filename: (String) data file's name. Returns: None
- def writeln(self, line): Write data line. Args: line: (List) Lin... | Implement the Python class `XLSXWriter` described below.
Class description:
XLSX file's writer. IT HAS PROBLEMS ON WINDOWS!
Method signatures and docstrings:
- def __init__(self, filename=None): Args: filename: (String) data file's name. Returns: None
- def writeln(self, line): Write data line. Args: line: (List) Lin... | 5fa06b29bf800646dc4da5851fdf7a1f299f15a7 | <|skeleton|>
class XLSXWriter:
"""XLSX file's writer. IT HAS PROBLEMS ON WINDOWS!"""
def __init__(self, filename=None):
"""Args: filename: (String) data file's name. Returns: None"""
<|body_0|>
def writeln(self, line):
"""Write data line. Args: line: (List) Line data. Returns: bool... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class XLSXWriter:
"""XLSX file's writer. IT HAS PROBLEMS ON WINDOWS!"""
def __init__(self, filename=None):
"""Args: filename: (String) data file's name. Returns: None"""
super(XLSXWriter, self).__init__(filename)
if not xlwt:
print('******************************************... | the_stack_v2_python_sparse | muddery/common/utils/writers.py | muddery/muddery | train | 139 |
6bbafd267f6b7c7465c6aef4ae5df9ab2384b9ea | [
"n = len(s)\nresult = []\n\ndef dfs(i, path):\n if i == n:\n result.append(path)\n return\n for j in range(i + 1, n + 1):\n if s[i:j] == s[i:j][::-1]:\n dfs(j, path + [s[i:j]])\ndfs(0, [])\nreturn result",
"n = len(s)\nresult = []\n\n@lru_cache(None)\ndef is_palindrone(i, j):... | <|body_start_0|>
n = len(s)
result = []
def dfs(i, path):
if i == n:
result.append(path)
return
for j in range(i + 1, n + 1):
if s[i:j] == s[i:j][::-1]:
dfs(j, path + [s[i:j]])
dfs(0, [])
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def partition(self, s: str) -> List[List[str]]:
"""Backtracking, Time: O(n*2^n), Space: O(n)"""
<|body_0|>
def partition(self, s: str) -> List[List[str]]:
"""Backtracking + Top-Down DP on is_palindrone, Time: O(n*2^n), Space: O(n)"""
<|body_1|>
<|e... | stack_v2_sparse_classes_36k_train_010503 | 1,269 | no_license | [
{
"docstring": "Backtracking, Time: O(n*2^n), Space: O(n)",
"name": "partition",
"signature": "def partition(self, s: str) -> List[List[str]]"
},
{
"docstring": "Backtracking + Top-Down DP on is_palindrone, Time: O(n*2^n), Space: O(n)",
"name": "partition",
"signature": "def partition(se... | 2 | stack_v2_sparse_classes_30k_train_018924 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def partition(self, s: str) -> List[List[str]]: Backtracking, Time: O(n*2^n), Space: O(n)
- def partition(self, s: str) -> List[List[str]]: Backtracking + Top-Down DP on is_palin... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def partition(self, s: str) -> List[List[str]]: Backtracking, Time: O(n*2^n), Space: O(n)
- def partition(self, s: str) -> List[List[str]]: Backtracking + Top-Down DP on is_palin... | 72136e3487d239f5b37e2d6393e034262a6bf599 | <|skeleton|>
class Solution:
def partition(self, s: str) -> List[List[str]]:
"""Backtracking, Time: O(n*2^n), Space: O(n)"""
<|body_0|>
def partition(self, s: str) -> List[List[str]]:
"""Backtracking + Top-Down DP on is_palindrone, Time: O(n*2^n), Space: O(n)"""
<|body_1|>
<|e... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def partition(self, s: str) -> List[List[str]]:
"""Backtracking, Time: O(n*2^n), Space: O(n)"""
n = len(s)
result = []
def dfs(i, path):
if i == n:
result.append(path)
return
for j in range(i + 1, n + 1):
... | the_stack_v2_python_sparse | python/131-Palindrome Partitioning.py | cwza/leetcode | train | 0 | |
b5b4c870b669b0160d6676104e26ee9309051fca | [
"input_json, output_json = (request.data['APIParams'], {})\noutput_json['AuthenticationDetails'] = request.data['AuthenticationDetails']\nfetch_all_state = self.fetch_states(input_json)\nif fetch_all_state.data['Status'] == 'Success':\n payload_details = {'state_details': fetch_all_state.data['States']}\n out... | <|body_start_0|>
input_json, output_json = (request.data['APIParams'], {})
output_json['AuthenticationDetails'] = request.data['AuthenticationDetails']
fetch_all_state = self.fetch_states(input_json)
if fetch_all_state.data['Status'] == 'Success':
payload_details = {'state_de... | This API cover for fetch state. | GetStateAPI | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GetStateAPI:
"""This API cover for fetch state."""
def post(self, request):
"""This API cover for fetch state."""
<|body_0|>
def fetch_states(self, request):
"""Function to fetch states into database."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_36k_train_010504 | 1,952 | no_license | [
{
"docstring": "This API cover for fetch state.",
"name": "post",
"signature": "def post(self, request)"
},
{
"docstring": "Function to fetch states into database.",
"name": "fetch_states",
"signature": "def fetch_states(self, request)"
}
] | 2 | stack_v2_sparse_classes_30k_train_016799 | Implement the Python class `GetStateAPI` described below.
Class description:
This API cover for fetch state.
Method signatures and docstrings:
- def post(self, request): This API cover for fetch state.
- def fetch_states(self, request): Function to fetch states into database. | Implement the Python class `GetStateAPI` described below.
Class description:
This API cover for fetch state.
Method signatures and docstrings:
- def post(self, request): This API cover for fetch state.
- def fetch_states(self, request): Function to fetch states into database.
<|skeleton|>
class GetStateAPI:
"""T... | 36eb9931f330e64902354c6fc471be2adf4b7049 | <|skeleton|>
class GetStateAPI:
"""This API cover for fetch state."""
def post(self, request):
"""This API cover for fetch state."""
<|body_0|>
def fetch_states(self, request):
"""Function to fetch states into database."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GetStateAPI:
"""This API cover for fetch state."""
def post(self, request):
"""This API cover for fetch state."""
input_json, output_json = (request.data['APIParams'], {})
output_json['AuthenticationDetails'] = request.data['AuthenticationDetails']
fetch_all_state = self.f... | the_stack_v2_python_sparse | Generic/common/location/api/getstate/views_getstate.py | archiemb303/common_backend_django | train | 0 |
0ec55325f7db2767b60d5153f52dc14aed436528 | [
"self._array = Array(HashDict.DEFAULT_CAPACITY)\nself._foundNode = self._priorNode = None\nself._index = -1\nAbstractDict.__init__(self, sourceDictionary)",
"self._index = abs(hash(key)) % len(self._array)\nself._priorNode = None\nself._foundNode = self._array[self._index]\nwhile self._foundNode != None:\n if ... | <|body_start_0|>
self._array = Array(HashDict.DEFAULT_CAPACITY)
self._foundNode = self._priorNode = None
self._index = -1
AbstractDict.__init__(self, sourceDictionary)
<|end_body_0|>
<|body_start_1|>
self._index = abs(hash(key)) % len(self._array)
self._priorNode = None
... | Represents a hash-based dictionary. | HashDict | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HashDict:
"""Represents a hash-based dictionary."""
def __init__(self, sourceDictionary=None):
"""Will copy items to the collection from sourceDictionary if it's present."""
<|body_0|>
def __contains__(self, key):
"""Returns True if key is in self or False otherw... | stack_v2_sparse_classes_36k_train_010505 | 2,550 | no_license | [
{
"docstring": "Will copy items to the collection from sourceDictionary if it's present.",
"name": "__init__",
"signature": "def __init__(self, sourceDictionary=None)"
},
{
"docstring": "Returns True if key is in self or False otherwise.",
"name": "__contains__",
"signature": "def __cont... | 6 | stack_v2_sparse_classes_30k_train_015583 | Implement the Python class `HashDict` described below.
Class description:
Represents a hash-based dictionary.
Method signatures and docstrings:
- def __init__(self, sourceDictionary=None): Will copy items to the collection from sourceDictionary if it's present.
- def __contains__(self, key): Returns True if key is in... | Implement the Python class `HashDict` described below.
Class description:
Represents a hash-based dictionary.
Method signatures and docstrings:
- def __init__(self, sourceDictionary=None): Will copy items to the collection from sourceDictionary if it's present.
- def __contains__(self, key): Returns True if key is in... | 5a562d76830faf78feec81bc11190b71eae3a799 | <|skeleton|>
class HashDict:
"""Represents a hash-based dictionary."""
def __init__(self, sourceDictionary=None):
"""Will copy items to the collection from sourceDictionary if it's present."""
<|body_0|>
def __contains__(self, key):
"""Returns True if key is in self or False otherw... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class HashDict:
"""Represents a hash-based dictionary."""
def __init__(self, sourceDictionary=None):
"""Will copy items to the collection from sourceDictionary if it's present."""
self._array = Array(HashDict.DEFAULT_CAPACITY)
self._foundNode = self._priorNode = None
self._index... | the_stack_v2_python_sparse | FundamentalsOfPythonDataStructures/ExampleCode/chapter11/hashdict.py | xjr7670/book_practice | train | 3 |
7465753fae16b56ab035b684148b8ea3ac5a56e8 | [
"from __builtin__ import xrange\ns1_len, s2_len = (len(s1), len(s2))\nif s1_len > s2_len:\n return False\na1 = [ord(c) - ord('a') for c in s1]\na2 = [ord(c) - ord('a') for c in s2]\ntarget, window = ([0] * 26, [0] * 26)\nfor c in a1:\n target[c] += 1\nfor idx in xrange(s1_len):\n window[a2[idx]] += 1\nfor ... | <|body_start_0|>
from __builtin__ import xrange
s1_len, s2_len = (len(s1), len(s2))
if s1_len > s2_len:
return False
a1 = [ord(c) - ord('a') for c in s1]
a2 = [ord(c) - ord('a') for c in s2]
target, window = ([0] * 26, [0] * 26)
for c in a1:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def checkInclusion(self, s1, s2):
""":type s1: str :type s2: str :rtype: bool"""
<|body_0|>
def rewrite(self, s1, s2):
""":type s1: str :type s2: str :rtype: bool"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
from __builtin__ import xran... | stack_v2_sparse_classes_36k_train_010506 | 2,732 | no_license | [
{
"docstring": ":type s1: str :type s2: str :rtype: bool",
"name": "checkInclusion",
"signature": "def checkInclusion(self, s1, s2)"
},
{
"docstring": ":type s1: str :type s2: str :rtype: bool",
"name": "rewrite",
"signature": "def rewrite(self, s1, s2)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def checkInclusion(self, s1, s2): :type s1: str :type s2: str :rtype: bool
- def rewrite(self, s1, s2): :type s1: str :type s2: str :rtype: bool | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def checkInclusion(self, s1, s2): :type s1: str :type s2: str :rtype: bool
- def rewrite(self, s1, s2): :type s1: str :type s2: str :rtype: bool
<|skeleton|>
class Solution:
... | 6350568d16b0f8c49a020f055bb6d72e2705ea56 | <|skeleton|>
class Solution:
def checkInclusion(self, s1, s2):
""":type s1: str :type s2: str :rtype: bool"""
<|body_0|>
def rewrite(self, s1, s2):
""":type s1: str :type s2: str :rtype: bool"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def checkInclusion(self, s1, s2):
""":type s1: str :type s2: str :rtype: bool"""
from __builtin__ import xrange
s1_len, s2_len = (len(s1), len(s2))
if s1_len > s2_len:
return False
a1 = [ord(c) - ord('a') for c in s1]
a2 = [ord(c) - ord('a'... | the_stack_v2_python_sparse | co_fb/567_Permutation_in_String.py | vsdrun/lc_public | train | 6 | |
a705a582f832ac65921c7402b72d49882c852c9d | [
"super().__init__()\nself.agg_type = args['agg_type']\nself.num_modes = args['num_modes']\nself.op_len = args['op_len']\nself.use_variance = args['use_variance']\nself.op_dim = 5 if self.use_variance else 2\nself.hidden = nn.Linear(args['encoding_size'], args['hidden_size'])\nself.traj_op = nn.Linear(args['hidden_s... | <|body_start_0|>
super().__init__()
self.agg_type = args['agg_type']
self.num_modes = args['num_modes']
self.op_len = args['op_len']
self.use_variance = args['use_variance']
self.op_dim = 5 if self.use_variance else 2
self.hidden = nn.Linear(args['encoding_size'],... | MTP | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MTP:
def __init__(self, args):
"""Prediction decoder for MTP args to include: num_modes: int number of modes K op_len: int prediction horizon hidden_size: int hidden layer size encoding_size: int size of context encoding use_variance: Whether to output variance params along with mean pre... | stack_v2_sparse_classes_36k_train_010507 | 1,940 | permissive | [
{
"docstring": "Prediction decoder for MTP args to include: num_modes: int number of modes K op_len: int prediction horizon hidden_size: int hidden layer size encoding_size: int size of context encoding use_variance: Whether to output variance params along with mean predicted locations",
"name": "__init__",... | 2 | stack_v2_sparse_classes_30k_train_012119 | Implement the Python class `MTP` described below.
Class description:
Implement the MTP class.
Method signatures and docstrings:
- def __init__(self, args): Prediction decoder for MTP args to include: num_modes: int number of modes K op_len: int prediction horizon hidden_size: int hidden layer size encoding_size: int ... | Implement the Python class `MTP` described below.
Class description:
Implement the MTP class.
Method signatures and docstrings:
- def __init__(self, args): Prediction decoder for MTP args to include: num_modes: int number of modes K op_len: int prediction horizon hidden_size: int hidden layer size encoding_size: int ... | 6419894aa040adb9570b14493952a98c0a52f803 | <|skeleton|>
class MTP:
def __init__(self, args):
"""Prediction decoder for MTP args to include: num_modes: int number of modes K op_len: int prediction horizon hidden_size: int hidden layer size encoding_size: int size of context encoding use_variance: Whether to output variance params along with mean pre... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MTP:
def __init__(self, args):
"""Prediction decoder for MTP args to include: num_modes: int number of modes K op_len: int prediction horizon hidden_size: int hidden layer size encoding_size: int size of context encoding use_variance: Whether to output variance params along with mean predicted locatio... | the_stack_v2_python_sparse | models/decoders/mtp.py | sancarlim/Explainable-MP | train | 17 | |
942714f4b8023e452e056b7ea12d72b2d5563c29 | [
"super(PlacementShiftNet, self).__init__()\nself.num_out_dims = num_out_dims\nself.drop_prob = drop_prob\nself.layer1 = nn.Sequential(nn.Conv2d(in_channels, 32, kernel_size=5, stride=1, padding=1), nn.ReLU(), nn.Conv2d(32, 32, kernel_size=5, stride=1, padding=1), nn.ReLU(), nn.MaxPool2d(kernel_size=2, stride=2, dil... | <|body_start_0|>
super(PlacementShiftNet, self).__init__()
self.num_out_dims = num_out_dims
self.drop_prob = drop_prob
self.layer1 = nn.Sequential(nn.Conv2d(in_channels, 32, kernel_size=5, stride=1, padding=1), nn.ReLU(), nn.Conv2d(32, 32, kernel_size=5, stride=1, padding=1), nn.ReLU(), ... | PlacementShiftNet | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PlacementShiftNet:
def __init__(self, in_channels=2, num_out_dims=2, fc1_size=1024, fc1_input2_size=64, fc2_size=512, input2_size=1, drop_prob=0.5):
"""Same as PlacementShiftDistNet, but the vanilla version (i.e. outputs scalars). Acitvation of final layer is linear. So other activations... | stack_v2_sparse_classes_36k_train_010508 | 13,489 | no_license | [
{
"docstring": "Same as PlacementShiftDistNet, but the vanilla version (i.e. outputs scalars). Acitvation of final layer is linear. So other activations can be applied outside of this class's forward",
"name": "__init__",
"signature": "def __init__(self, in_channels=2, num_out_dims=2, fc1_size=1024, fc1... | 2 | stack_v2_sparse_classes_30k_train_010689 | Implement the Python class `PlacementShiftNet` described below.
Class description:
Implement the PlacementShiftNet class.
Method signatures and docstrings:
- def __init__(self, in_channels=2, num_out_dims=2, fc1_size=1024, fc1_input2_size=64, fc2_size=512, input2_size=1, drop_prob=0.5): Same as PlacementShiftDistNet,... | Implement the Python class `PlacementShiftNet` described below.
Class description:
Implement the PlacementShiftNet class.
Method signatures and docstrings:
- def __init__(self, in_channels=2, num_out_dims=2, fc1_size=1024, fc1_input2_size=64, fc2_size=512, input2_size=1, drop_prob=0.5): Same as PlacementShiftDistNet,... | ad713e4eb15a2d9573622bace528fc86e19a6545 | <|skeleton|>
class PlacementShiftNet:
def __init__(self, in_channels=2, num_out_dims=2, fc1_size=1024, fc1_input2_size=64, fc2_size=512, input2_size=1, drop_prob=0.5):
"""Same as PlacementShiftDistNet, but the vanilla version (i.e. outputs scalars). Acitvation of final layer is linear. So other activations... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PlacementShiftNet:
def __init__(self, in_channels=2, num_out_dims=2, fc1_size=1024, fc1_input2_size=64, fc2_size=512, input2_size=1, drop_prob=0.5):
"""Same as PlacementShiftDistNet, but the vanilla version (i.e. outputs scalars). Acitvation of final layer is linear. So other activations can be applie... | the_stack_v2_python_sparse | manipulation/plating/RNNs/rnns/networks.py | HARPLab/gastronomy | train | 6 | |
7bf832aae6d6b3039d304b66c1bde3ad6cc71ca2 | [
"super().__init__(component_type=PrimitiveType.PROCEDURAL)\nself._gen_strategy = gen_strategy\nself._fig_subgraph_view = fig_subgraph_view\nself._netlist: Optional[MINTDevice] = None",
"self._netlist = self._gen_strategy.generate_flow_network(self._fig_subgraph_view)\nself._inputs = self._gen_strategy.generate_in... | <|body_start_0|>
super().__init__(component_type=PrimitiveType.PROCEDURAL)
self._gen_strategy = gen_strategy
self._fig_subgraph_view = fig_subgraph_view
self._netlist: Optional[MINTDevice] = None
<|end_body_0|>
<|body_start_1|>
self._netlist = self._gen_strategy.generate_flow_ne... | NetworkPrimitive | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NetworkPrimitive:
def __init__(self, fig_subgraph_view, gen_strategy: GenStrategy) -> None:
"""A Procedural type primtive that can be used only for representing a network, this is usually used when we want the Generation Strategy needs to be used. Args: fig_subgraph_view (networkx.Graph.... | stack_v2_sparse_classes_36k_train_010509 | 11,620 | permissive | [
{
"docstring": "A Procedural type primtive that can be used only for representing a network, this is usually used when we want the Generation Strategy needs to be used. Args: fig_subgraph_view (networkx.Graph.subgraph): Subgraph for which we need to generate the network for gen_strategy (GenStrategy): This is u... | 3 | stack_v2_sparse_classes_30k_train_006613 | Implement the Python class `NetworkPrimitive` described below.
Class description:
Implement the NetworkPrimitive class.
Method signatures and docstrings:
- def __init__(self, fig_subgraph_view, gen_strategy: GenStrategy) -> None: A Procedural type primtive that can be used only for representing a network, this is usu... | Implement the Python class `NetworkPrimitive` described below.
Class description:
Implement the NetworkPrimitive class.
Method signatures and docstrings:
- def __init__(self, fig_subgraph_view, gen_strategy: GenStrategy) -> None: A Procedural type primtive that can be used only for representing a network, this is usu... | 9eb8a9a5fa5ae4f9fec1b41cf8624eccb4d270db | <|skeleton|>
class NetworkPrimitive:
def __init__(self, fig_subgraph_view, gen_strategy: GenStrategy) -> None:
"""A Procedural type primtive that can be used only for representing a network, this is usually used when we want the Generation Strategy needs to be used. Args: fig_subgraph_view (networkx.Graph.... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NetworkPrimitive:
def __init__(self, fig_subgraph_view, gen_strategy: GenStrategy) -> None:
"""A Procedural type primtive that can be used only for representing a network, this is usually used when we want the Generation Strategy needs to be used. Args: fig_subgraph_view (networkx.Graph.subgraph): Sub... | the_stack_v2_python_sparse | lfr/netlistgenerator/primitive.py | 0x174/pyLFR | train | 0 | |
6d7e1f8a1a096364cc493ba82661ee7184ab62a9 | [
"super().__init__()\nif out_channels is None:\n out_channels = in_channels\nself.in_channels, self.out_channels = (in_channels, out_channels)\nself.map = nn.Conv1d(in_channels, out_channels, kernel_size=kernel_size, stride=stride, padding=padding, dilation=dilation)",
"x = self.map(input)\nx_gate = torch.sigmo... | <|body_start_0|>
super().__init__()
if out_channels is None:
out_channels = in_channels
self.in_channels, self.out_channels = (in_channels, out_channels)
self.map = nn.Conv1d(in_channels, out_channels, kernel_size=kernel_size, stride=stride, padding=padding, dilation=dilation... | Sigmoid Linear Units for 1D inputs | SiLU1d | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SiLU1d:
"""Sigmoid Linear Units for 1D inputs"""
def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1):
"""Args: in_channels <int> out_channels <int>"""
<|body_0|>
def forward(self, input):
"""Args: input (batch_size, in_chan... | stack_v2_sparse_classes_36k_train_010510 | 2,967 | no_license | [
{
"docstring": "Args: in_channels <int> out_channels <int>",
"name": "__init__",
"signature": "def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1)"
},
{
"docstring": "Args: input (batch_size, in_channels, T) Returns: output (batch_size, out_channels, T)",
... | 2 | stack_v2_sparse_classes_30k_train_021282 | Implement the Python class `SiLU1d` described below.
Class description:
Sigmoid Linear Units for 1D inputs
Method signatures and docstrings:
- def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1): Args: in_channels <int> out_channels <int>
- def forward(self, input): Args: input... | Implement the Python class `SiLU1d` described below.
Class description:
Sigmoid Linear Units for 1D inputs
Method signatures and docstrings:
- def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1): Args: in_channels <int> out_channels <int>
- def forward(self, input): Args: input... | 4f7f77406cf580785ebf932d78069e7d6e35b765 | <|skeleton|>
class SiLU1d:
"""Sigmoid Linear Units for 1D inputs"""
def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1):
"""Args: in_channels <int> out_channels <int>"""
<|body_0|>
def forward(self, input):
"""Args: input (batch_size, in_chan... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SiLU1d:
"""Sigmoid Linear Units for 1D inputs"""
def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1):
"""Args: in_channels <int> out_channels <int>"""
super().__init__()
if out_channels is None:
out_channels = in_channels
... | the_stack_v2_python_sparse | src/models/silu.py | shelly-tang/DNN-based_source_separation | train | 0 |
d33edd728ef755279ae2896f936fc5bcb1816961 | [
"super().verify_tools()\nif self.host_os != 'Linux':\n raise BriefcaseCommandError('AppImages can only be executed on Linux.')",
"print()\nprint('[{app.app_name}] Starting app...'.format(app=app))\ntry:\n print()\n self.subprocess.run([str(self.binary_path(app))], check=True)\nexcept subprocess.CalledPro... | <|body_start_0|>
super().verify_tools()
if self.host_os != 'Linux':
raise BriefcaseCommandError('AppImages can only be executed on Linux.')
<|end_body_0|>
<|body_start_1|>
print()
print('[{app.app_name}] Starting app...'.format(app=app))
try:
print()
... | LinuxAppImageRunCommand | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LinuxAppImageRunCommand:
def verify_tools(self):
"""Verify that we're on Linux."""
<|body_0|>
def run_app(self, app: BaseConfig, **kwargs):
"""Start the application. :param app: The config object for the app :param base_path: The path to the project directory."""
... | stack_v2_sparse_classes_36k_train_010511 | 8,867 | permissive | [
{
"docstring": "Verify that we're on Linux.",
"name": "verify_tools",
"signature": "def verify_tools(self)"
},
{
"docstring": "Start the application. :param app: The config object for the app :param base_path: The path to the project directory.",
"name": "run_app",
"signature": "def run_... | 2 | stack_v2_sparse_classes_30k_train_018180 | Implement the Python class `LinuxAppImageRunCommand` described below.
Class description:
Implement the LinuxAppImageRunCommand class.
Method signatures and docstrings:
- def verify_tools(self): Verify that we're on Linux.
- def run_app(self, app: BaseConfig, **kwargs): Start the application. :param app: The config ob... | Implement the Python class `LinuxAppImageRunCommand` described below.
Class description:
Implement the LinuxAppImageRunCommand class.
Method signatures and docstrings:
- def verify_tools(self): Verify that we're on Linux.
- def run_app(self, app: BaseConfig, **kwargs): Start the application. :param app: The config ob... | 358ae06eef418fde35f424909d4f13049ca9ec7b | <|skeleton|>
class LinuxAppImageRunCommand:
def verify_tools(self):
"""Verify that we're on Linux."""
<|body_0|>
def run_app(self, app: BaseConfig, **kwargs):
"""Start the application. :param app: The config object for the app :param base_path: The path to the project directory."""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LinuxAppImageRunCommand:
def verify_tools(self):
"""Verify that we're on Linux."""
super().verify_tools()
if self.host_os != 'Linux':
raise BriefcaseCommandError('AppImages can only be executed on Linux.')
def run_app(self, app: BaseConfig, **kwargs):
"""Start ... | the_stack_v2_python_sparse | 077.Test_BeeWare_windows/beeware-tutorial/beeware-venv/Lib/site-packages/briefcase/platforms/linux/appimage.py | IvanaXu/PyTools | train | 60 | |
26a9d6bc23e34b42bc90e47cf5577c48a60dbc30 | [
"self.enable_audit_logging = enable_audit_logging\nself.file_select_policy = file_select_policy\nself.file_size = file_size\nself.file_size_policy = file_size_policy\nself.hot_file_window = hot_file_window\nself.nfs_mount_path = nfs_mount_path\nself.num_file_access = num_file_access\nself.source_view_map = source_v... | <|body_start_0|>
self.enable_audit_logging = enable_audit_logging
self.file_select_policy = file_select_policy
self.file_size = file_size
self.file_size_policy = file_size_policy
self.hot_file_window = hot_file_window
self.nfs_mount_path = nfs_mount_path
self.num_... | Implementation of the 'FileUptieringParams' model. TODO: type description here. Attributes: enable_audit_logging (bool): If enabled, audit log the files which are uptiered. file_select_policy (int): File uptier policy based on file access/modify time. file_size (long|int): Gives the size criteria to be used for selecti... | FileUptieringParams | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FileUptieringParams:
"""Implementation of the 'FileUptieringParams' model. TODO: type description here. Attributes: enable_audit_logging (bool): If enabled, audit log the files which are uptiered. file_select_policy (int): File uptier policy based on file access/modify time. file_size (long|int):... | stack_v2_sparse_classes_36k_train_010512 | 5,284 | permissive | [
{
"docstring": "Constructor for the FileUptieringParams class",
"name": "__init__",
"signature": "def __init__(self, enable_audit_logging=None, file_select_policy=None, file_size=None, file_size_policy=None, hot_file_window=None, nfs_mount_path=None, num_file_access=None, source_view_map=None, source_vi... | 2 | stack_v2_sparse_classes_30k_train_018723 | Implement the Python class `FileUptieringParams` described below.
Class description:
Implementation of the 'FileUptieringParams' model. TODO: type description here. Attributes: enable_audit_logging (bool): If enabled, audit log the files which are uptiered. file_select_policy (int): File uptier policy based on file ac... | Implement the Python class `FileUptieringParams` described below.
Class description:
Implementation of the 'FileUptieringParams' model. TODO: type description here. Attributes: enable_audit_logging (bool): If enabled, audit log the files which are uptiered. file_select_policy (int): File uptier policy based on file ac... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class FileUptieringParams:
"""Implementation of the 'FileUptieringParams' model. TODO: type description here. Attributes: enable_audit_logging (bool): If enabled, audit log the files which are uptiered. file_select_policy (int): File uptier policy based on file access/modify time. file_size (long|int):... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FileUptieringParams:
"""Implementation of the 'FileUptieringParams' model. TODO: type description here. Attributes: enable_audit_logging (bool): If enabled, audit log the files which are uptiered. file_select_policy (int): File uptier policy based on file access/modify time. file_size (long|int): Gives the si... | the_stack_v2_python_sparse | cohesity_management_sdk/models/file_uptiering_params.py | cohesity/management-sdk-python | train | 24 |
affe4fac9f067f9ba644256185dbb850bfd8ddf6 | [
"self._cluster_name = parsed_args.cluster_name\nself._namespace = parsed_args.namespace\nself._role_name = parsed_args.role_name\nself._region = get_region(self._session, parsed_globals)\nself._endpoint_url = parsed_args.iam_endpoint\nself._dry_run = parsed_args.dry_run\nresult = self._update_role_trust_policy(pars... | <|body_start_0|>
self._cluster_name = parsed_args.cluster_name
self._namespace = parsed_args.namespace
self._role_name = parsed_args.role_name
self._region = get_region(self._session, parsed_globals)
self._endpoint_url = parsed_args.iam_endpoint
self._dry_run = parsed_arg... | UpdateRoleTrustPolicyCommand | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UpdateRoleTrustPolicyCommand:
def _run_main(self, parsed_args, parsed_globals):
"""Call to run the commands"""
<|body_0|>
def _update_role_trust_policy(self, parsed_globals):
"""Method to update trust policy if not done already"""
<|body_1|>
<|end_skeleton|>... | stack_v2_sparse_classes_36k_train_010513 | 6,884 | permissive | [
{
"docstring": "Call to run the commands",
"name": "_run_main",
"signature": "def _run_main(self, parsed_args, parsed_globals)"
},
{
"docstring": "Method to update trust policy if not done already",
"name": "_update_role_trust_policy",
"signature": "def _update_role_trust_policy(self, pa... | 2 | null | Implement the Python class `UpdateRoleTrustPolicyCommand` described below.
Class description:
Implement the UpdateRoleTrustPolicyCommand class.
Method signatures and docstrings:
- def _run_main(self, parsed_args, parsed_globals): Call to run the commands
- def _update_role_trust_policy(self, parsed_globals): Method t... | Implement the Python class `UpdateRoleTrustPolicyCommand` described below.
Class description:
Implement the UpdateRoleTrustPolicyCommand class.
Method signatures and docstrings:
- def _run_main(self, parsed_args, parsed_globals): Call to run the commands
- def _update_role_trust_policy(self, parsed_globals): Method t... | 147d16dfdb72dc9cf362b676a57e46a49375afbd | <|skeleton|>
class UpdateRoleTrustPolicyCommand:
def _run_main(self, parsed_args, parsed_globals):
"""Call to run the commands"""
<|body_0|>
def _update_role_trust_policy(self, parsed_globals):
"""Method to update trust policy if not done already"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UpdateRoleTrustPolicyCommand:
def _run_main(self, parsed_args, parsed_globals):
"""Call to run the commands"""
self._cluster_name = parsed_args.cluster_name
self._namespace = parsed_args.namespace
self._role_name = parsed_args.role_name
self._region = get_region(self._s... | the_stack_v2_python_sparse | awscli/customizations/emrcontainers/update_role_trust_policy.py | aws/aws-cli | train | 13,038 | |
3206706f2940b7954780b39e562687db186a8120 | [
"def postorder(root):\n return postorder(root.left) + postorder(root.right) + [root.val] if root else []\nreturn ' '.join(map(str, postorder(root)))",
"def helper(lower, upper):\n if not data or data[-1] < lower or data[-1] > upper:\n return None\n cur = data.pop()\n root = TreeNode(cur)\n r... | <|body_start_0|>
def postorder(root):
return postorder(root.left) + postorder(root.right) + [root.val] if root else []
return ' '.join(map(str, postorder(root)))
<|end_body_0|>
<|body_start_1|>
def helper(lower, upper):
if not data or data[-1] < lower or data[-1] > upper... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root: TreeNode) -> str:
"""Encodes a tree to a single string."""
<|body_0|>
def deserialize(self, data: str) -> TreeNode:
"""Decodes your encoded data to tree."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
def postorder(... | stack_v2_sparse_classes_36k_train_010514 | 1,111 | no_license | [
{
"docstring": "Encodes a tree to a single string.",
"name": "serialize",
"signature": "def serialize(self, root: TreeNode) -> str"
},
{
"docstring": "Decodes your encoded data to tree.",
"name": "deserialize",
"signature": "def deserialize(self, data: str) -> TreeNode"
}
] | 2 | stack_v2_sparse_classes_30k_val_000305 | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string.
- def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree. | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string.
- def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree.
<|skeleton|>
class Co... | 034efcefe9940267abcf4c9cab655b2344e3e901 | <|skeleton|>
class Codec:
def serialize(self, root: TreeNode) -> str:
"""Encodes a tree to a single string."""
<|body_0|>
def deserialize(self, data: str) -> TreeNode:
"""Decodes your encoded data to tree."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Codec:
def serialize(self, root: TreeNode) -> str:
"""Encodes a tree to a single string."""
def postorder(root):
return postorder(root.left) + postorder(root.right) + [root.val] if root else []
return ' '.join(map(str, postorder(root)))
def deserialize(self, data: str)... | the_stack_v2_python_sparse | 449_serialize_and_deserialize_bst.py | HongsenHe/algo2018 | train | 0 | |
f04380d5bf05644f99ad2093e3cfd33eed75a80d | [
"if scenario:\n scenario_text = ' When ' + ' and '.join(['condition \"%s\" is %s' % (k, v) for k, v in scenario.items()])\n return message + scenario_text\nreturn message",
"matches = []\nif len(stages) < 2:\n message = 'CodePipeline has {} stages. There must be at least two stages.'.format(len(stages))\... | <|body_start_0|>
if scenario:
scenario_text = ' When ' + ' and '.join(['condition "%s" is %s' % (k, v) for k, v in scenario.items()])
return message + scenario_text
return message
<|end_body_0|>
<|body_start_1|>
matches = []
if len(stages) < 2:
messag... | Check if CodePipeline Stages are set up properly. | CodepipelineStages | [
"MIT-0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CodepipelineStages:
"""Check if CodePipeline Stages are set up properly."""
def _format_error_message(self, message, scenario):
"""Format error message with scenario text"""
<|body_0|>
def check_stage_count(self, stages, path, scenario):
"""Check that there is mi... | stack_v2_sparse_classes_36k_train_010515 | 6,607 | permissive | [
{
"docstring": "Format error message with scenario text",
"name": "_format_error_message",
"signature": "def _format_error_message(self, message, scenario)"
},
{
"docstring": "Check that there is minimum 2 stages.",
"name": "check_stage_count",
"signature": "def check_stage_count(self, s... | 6 | null | Implement the Python class `CodepipelineStages` described below.
Class description:
Check if CodePipeline Stages are set up properly.
Method signatures and docstrings:
- def _format_error_message(self, message, scenario): Format error message with scenario text
- def check_stage_count(self, stages, path, scenario): C... | Implement the Python class `CodepipelineStages` described below.
Class description:
Check if CodePipeline Stages are set up properly.
Method signatures and docstrings:
- def _format_error_message(self, message, scenario): Format error message with scenario text
- def check_stage_count(self, stages, path, scenario): C... | 3f5324cfd000e14d9324a242bb7fad528b22a7df | <|skeleton|>
class CodepipelineStages:
"""Check if CodePipeline Stages are set up properly."""
def _format_error_message(self, message, scenario):
"""Format error message with scenario text"""
<|body_0|>
def check_stage_count(self, stages, path, scenario):
"""Check that there is mi... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CodepipelineStages:
"""Check if CodePipeline Stages are set up properly."""
def _format_error_message(self, message, scenario):
"""Format error message with scenario text"""
if scenario:
scenario_text = ' When ' + ' and '.join(['condition "%s" is %s' % (k, v) for k, v in scena... | the_stack_v2_python_sparse | src/cfnlint/rules/resources/codepipeline/CodepipelineStages.py | jlongtine/cfn-python-lint | train | 1 |
9820091eacaee4c3b0142ef5fd4ab9bb1f467b8e | [
"if not uuid:\n genres = db.session.query(Genre).all()\n return (self.genre_schema.dump(genres, many=True), 200)\ngenre = db.session.query(Genre).filter_by(id=uuid).first()\nif not genre:\n return ({'Error': 'Object was not found'}, 404)\nreturn (self.genre_schema.dump(genre), 200)",
"try:\n genre = s... | <|body_start_0|>
if not uuid:
genres = db.session.query(Genre).all()
return (self.genre_schema.dump(genres, many=True), 200)
genre = db.session.query(Genre).filter_by(id=uuid).first()
if not genre:
return ({'Error': 'Object was not found'}, 404)
return... | Genre List Api | GenreListApi | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GenreListApi:
"""Genre List Api"""
def get(self, uuid=None):
"""Output a list, or a single genre"""
<|body_0|>
def post(self):
"""Adding a genre"""
<|body_1|>
def put(self, uuid: int):
"""Changing a genre"""
<|body_2|>
def delete... | stack_v2_sparse_classes_36k_train_010516 | 1,909 | no_license | [
{
"docstring": "Output a list, or a single genre",
"name": "get",
"signature": "def get(self, uuid=None)"
},
{
"docstring": "Adding a genre",
"name": "post",
"signature": "def post(self)"
},
{
"docstring": "Changing a genre",
"name": "put",
"signature": "def put(self, uui... | 4 | stack_v2_sparse_classes_30k_train_012059 | Implement the Python class `GenreListApi` described below.
Class description:
Genre List Api
Method signatures and docstrings:
- def get(self, uuid=None): Output a list, or a single genre
- def post(self): Adding a genre
- def put(self, uuid: int): Changing a genre
- def delete(uuid: int): Delete a genre | Implement the Python class `GenreListApi` described below.
Class description:
Genre List Api
Method signatures and docstrings:
- def get(self, uuid=None): Output a list, or a single genre
- def post(self): Adding a genre
- def put(self, uuid: int): Changing a genre
- def delete(uuid: int): Delete a genre
<|skeleton|... | b3a021bff8112a3eb81f553b3eb0df751a488adb | <|skeleton|>
class GenreListApi:
"""Genre List Api"""
def get(self, uuid=None):
"""Output a list, or a single genre"""
<|body_0|>
def post(self):
"""Adding a genre"""
<|body_1|>
def put(self, uuid: int):
"""Changing a genre"""
<|body_2|>
def delete... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GenreListApi:
"""Genre List Api"""
def get(self, uuid=None):
"""Output a list, or a single genre"""
if not uuid:
genres = db.session.query(Genre).all()
return (self.genre_schema.dump(genres, many=True), 200)
genre = db.session.query(Genre).filter_by(id=uuid... | the_stack_v2_python_sparse | app/resources/genres.py | cyr1z/api-movie-library- | train | 1 |
530401e131941f75c3b56d95fe57b246761f270d | [
"super().__init__()\nself.name = 'session-' + secrets.token_hex(16)\nself.port = random.randint(1024, 65535)\nself.api_instance.create_namespaced_pod(body={'apiVersion': 'v1', 'kind': 'Pod', 'metadata': {'name': self.name}, 'spec': {'containers': [{'name': 'executa', 'image': 'stencila/executa', 'args': ['executa',... | <|body_start_0|>
super().__init__()
self.name = 'session-' + secrets.token_hex(16)
self.port = random.randint(1024, 65535)
self.api_instance.create_namespaced_pod(body={'apiVersion': 'v1', 'kind': 'Pod', 'metadata': {'name': self.name}, 'spec': {'containers': [{'name': 'executa', 'image'... | Runs a session as a pod in a Kubernetes cluster. This class in intended for scalably provisioning untrusted sessions. It uses the K8s API to create a new pod inside a cluster, possible the same cluster this process is in. | KubernetesSession | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class KubernetesSession:
"""Runs a session as a pod in a Kubernetes cluster. This class in intended for scalably provisioning untrusted sessions. It uses the K8s API to create a new pod inside a cluster, possible the same cluster this process is in."""
def __init__(self):
"""Create a sessi... | stack_v2_sparse_classes_36k_train_010517 | 3,424 | permissive | [
{
"docstring": "Create a session.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Start the session.",
"name": "start",
"signature": "def start(self)"
},
{
"docstring": "Stop the session.",
"name": "stop",
"signature": "def stop(self)"
}
] | 3 | stack_v2_sparse_classes_30k_train_010153 | Implement the Python class `KubernetesSession` described below.
Class description:
Runs a session as a pod in a Kubernetes cluster. This class in intended for scalably provisioning untrusted sessions. It uses the K8s API to create a new pod inside a cluster, possible the same cluster this process is in.
Method signat... | Implement the Python class `KubernetesSession` described below.
Class description:
Runs a session as a pod in a Kubernetes cluster. This class in intended for scalably provisioning untrusted sessions. It uses the K8s API to create a new pod inside a cluster, possible the same cluster this process is in.
Method signat... | 47c6377ccbfe8576b35854053d726537e533e78c | <|skeleton|>
class KubernetesSession:
"""Runs a session as a pod in a Kubernetes cluster. This class in intended for scalably provisioning untrusted sessions. It uses the K8s API to create a new pod inside a cluster, possible the same cluster this process is in."""
def __init__(self):
"""Create a sessi... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class KubernetesSession:
"""Runs a session as a pod in a Kubernetes cluster. This class in intended for scalably provisioning untrusted sessions. It uses the K8s API to create a new pod inside a cluster, possible the same cluster this process is in."""
def __init__(self):
"""Create a session."""
... | the_stack_v2_python_sparse | worker/jobs/session/kubernetes_session.py | gxf1986/hub | train | 0 |
6464a7edf66de13c179c81755ae48950d77441e0 | [
"self.wb = openpyxl.load_workbook(file_name)\nself.sheet = self.wb[sheet_name]\nself.list = list1",
"rows_data = list(self.sheet.rows)\ntitles = []\nfor title in rows_data[0]:\n titles.append(title.value)"
] | <|body_start_0|>
self.wb = openpyxl.load_workbook(file_name)
self.sheet = self.wb[sheet_name]
self.list = list1
<|end_body_0|>
<|body_start_1|>
rows_data = list(self.sheet.rows)
titles = []
for title in rows_data[0]:
titles.append(title.value)
<|end_body_1|>
| 读取excel数据 | ReadExcel_obj | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ReadExcel_obj:
"""读取excel数据"""
def __init__(self, file_name, sheet_name, list1):
"""这个是用例初始化读取对象的 :param file_name: 文件名字 --> str :param sheet_name: 表单名字 --> str"""
<|body_0|>
def read_data_obj(self):
"""按行读取数据,表单所有数据 每个用例存储在一个对象中 :return: 返回一个列表,列表中每个元素为一个用例对象"""... | stack_v2_sparse_classes_36k_train_010518 | 3,739 | no_license | [
{
"docstring": "这个是用例初始化读取对象的 :param file_name: 文件名字 --> str :param sheet_name: 表单名字 --> str",
"name": "__init__",
"signature": "def __init__(self, file_name, sheet_name, list1)"
},
{
"docstring": "按行读取数据,表单所有数据 每个用例存储在一个对象中 :return: 返回一个列表,列表中每个元素为一个用例对象",
"name": "read_data_obj",
"sign... | 2 | stack_v2_sparse_classes_30k_train_019276 | Implement the Python class `ReadExcel_obj` described below.
Class description:
读取excel数据
Method signatures and docstrings:
- def __init__(self, file_name, sheet_name, list1): 这个是用例初始化读取对象的 :param file_name: 文件名字 --> str :param sheet_name: 表单名字 --> str
- def read_data_obj(self): 按行读取数据,表单所有数据 每个用例存储在一个对象中 :return: 返回一... | Implement the Python class `ReadExcel_obj` described below.
Class description:
读取excel数据
Method signatures and docstrings:
- def __init__(self, file_name, sheet_name, list1): 这个是用例初始化读取对象的 :param file_name: 文件名字 --> str :param sheet_name: 表单名字 --> str
- def read_data_obj(self): 按行读取数据,表单所有数据 每个用例存储在一个对象中 :return: 返回一... | f8a98389fa09f95e72914afa4935afc5c68eaccd | <|skeleton|>
class ReadExcel_obj:
"""读取excel数据"""
def __init__(self, file_name, sheet_name, list1):
"""这个是用例初始化读取对象的 :param file_name: 文件名字 --> str :param sheet_name: 表单名字 --> str"""
<|body_0|>
def read_data_obj(self):
"""按行读取数据,表单所有数据 每个用例存储在一个对象中 :return: 返回一个列表,列表中每个元素为一个用例对象"""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ReadExcel_obj:
"""读取excel数据"""
def __init__(self, file_name, sheet_name, list1):
"""这个是用例初始化读取对象的 :param file_name: 文件名字 --> str :param sheet_name: 表单名字 --> str"""
self.wb = openpyxl.load_workbook(file_name)
self.sheet = self.wb[sheet_name]
self.list = list1
def read_... | the_stack_v2_python_sparse | py_1816_ExcelClass/cankao.py | 2020668/python2019 | train | 0 |
0e103175b0aa04e41769df1903e096d4ac2d6596 | [
"print()\nprint('-+- ' * 40)\nlog.debug('ROUTE class : %s', self.__class__.__name__)\nlog.debug('payload : \\n{}'.format(pformat(ns.payload)))\nclaims = get_jwt_claims()\nlog.debug('claims : \\n %s', pformat(claims))\nupdated_doc, response_code = Query_db_update(ns, models, document_type, doc_id, claims, roles_for_... | <|body_start_0|>
print()
print('-+- ' * 40)
log.debug('ROUTE class : %s', self.__class__.__name__)
log.debug('payload : \n{}'.format(pformat(ns.payload)))
claims = get_jwt_claims()
log.debug('claims : \n %s', pformat(claims))
updated_doc, response_code = Query_db_... | rec edition : PUT - Updates document's infos DELETE - Let you delete document | Rec_edit | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Rec_edit:
"""rec edition : PUT - Updates document's infos DELETE - Let you delete document"""
def put(self, doc_id):
"""Update a dmf in db > --- needs : a valid access_token in the header, field_to_update, field_value >>> returns : msg, doc data"""
<|body_0|>
def delete(... | stack_v2_sparse_classes_36k_train_010519 | 3,280 | permissive | [
{
"docstring": "Update a dmf in db > --- needs : a valid access_token in the header, field_to_update, field_value >>> returns : msg, doc data",
"name": "put",
"signature": "def put(self, doc_id)"
},
{
"docstring": "delete a rec in db > --- needs : a valid access_token (as admin or current user) ... | 2 | stack_v2_sparse_classes_30k_train_020367 | Implement the Python class `Rec_edit` described below.
Class description:
rec edition : PUT - Updates document's infos DELETE - Let you delete document
Method signatures and docstrings:
- def put(self, doc_id): Update a dmf in db > --- needs : a valid access_token in the header, field_to_update, field_value >>> retur... | Implement the Python class `Rec_edit` described below.
Class description:
rec edition : PUT - Updates document's infos DELETE - Let you delete document
Method signatures and docstrings:
- def put(self, doc_id): Update a dmf in db > --- needs : a valid access_token in the header, field_to_update, field_value >>> retur... | 08ba9151069f2f633461f5166b1954fdeac7854a | <|skeleton|>
class Rec_edit:
"""rec edition : PUT - Updates document's infos DELETE - Let you delete document"""
def put(self, doc_id):
"""Update a dmf in db > --- needs : a valid access_token in the header, field_to_update, field_value >>> returns : msg, doc data"""
<|body_0|>
def delete(... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Rec_edit:
"""rec edition : PUT - Updates document's infos DELETE - Let you delete document"""
def put(self, doc_id):
"""Update a dmf in db > --- needs : a valid access_token in the header, field_to_update, field_value >>> returns : msg, doc data"""
print()
print('-+- ' * 40)
... | the_stack_v2_python_sparse | solidata_api/api/api_recipes/endpoint_rec_edit.py | entrepreneur-interet-general/solidata_backend | train | 9 |
7887650a927c340bf2f34d82e5a5e951833c92fa | [
"ret = [[]]\nfor i in nums:\n ret = ret + [[i] + j for j in ret]\nreturn ret",
"dic = {}\nfor num in nums:\n dic[num] = dic.get(num, 0) + 1\nres = [[]]\nfor num, count in dic.items():\n res = [arr + [num] * i for arr in res for i in range(count + 1)]\nreturn res"
] | <|body_start_0|>
ret = [[]]
for i in nums:
ret = ret + [[i] + j for j in ret]
return ret
<|end_body_0|>
<|body_start_1|>
dic = {}
for num in nums:
dic[num] = dic.get(num, 0) + 1
res = [[]]
for num, count in dic.items():
res = [... | 子集 给定一组不含重复元素的整数数组 nums,返回该数组所有可能的子集(幂集)。 说明:解集不能包含重复的子集。 示例: 输入: nums = [1,2,3] 输出: [ [3], [1], [2], [1,2,3], [1,3], [2,3], [1,2], [] ] 链接:https://leetcode-cn.com/problems/subsets | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
"""子集 给定一组不含重复元素的整数数组 nums,返回该数组所有可能的子集(幂集)。 说明:解集不能包含重复的子集。 示例: 输入: nums = [1,2,3] 输出: [ [3], [1], [2], [1,2,3], [1,3], [2,3], [1,2], [] ] 链接:https://leetcode-cn.com/problems/subsets"""
def subsets(self, nums: list) -> list:
"""动态规划,例:nums = [1,2,3] 每迭代一次ret元素: [[]] [[], [... | stack_v2_sparse_classes_36k_train_010520 | 1,847 | no_license | [
{
"docstring": "动态规划,例:nums = [1,2,3] 每迭代一次ret元素: [[]] [[], [1]] [[], [1], [2], [2, 1]] [[], [1], [2], [2, 1], [3], [3, 1], [3, 2], [3, 2, 1]]",
"name": "subsets",
"signature": "def subsets(self, nums: list) -> list"
},
{
"docstring": "解法1:动态规划,通过字典统计nums各数字出现的次数,然后动态构造子集,该解法也适用于第1题, 例:[1,2,2],答... | 2 | stack_v2_sparse_classes_30k_train_000532 | Implement the Python class `Solution` described below.
Class description:
子集 给定一组不含重复元素的整数数组 nums,返回该数组所有可能的子集(幂集)。 说明:解集不能包含重复的子集。 示例: 输入: nums = [1,2,3] 输出: [ [3], [1], [2], [1,2,3], [1,3], [2,3], [1,2], [] ] 链接:https://leetcode-cn.com/problems/subsets
Method signatures and docstrings:
- def subsets(self, nums: lis... | Implement the Python class `Solution` described below.
Class description:
子集 给定一组不含重复元素的整数数组 nums,返回该数组所有可能的子集(幂集)。 说明:解集不能包含重复的子集。 示例: 输入: nums = [1,2,3] 输出: [ [3], [1], [2], [1,2,3], [1,3], [2,3], [1,2], [] ] 链接:https://leetcode-cn.com/problems/subsets
Method signatures and docstrings:
- def subsets(self, nums: lis... | ad25281be49dfb9de211ba324b398e946e49025d | <|skeleton|>
class Solution:
"""子集 给定一组不含重复元素的整数数组 nums,返回该数组所有可能的子集(幂集)。 说明:解集不能包含重复的子集。 示例: 输入: nums = [1,2,3] 输出: [ [3], [1], [2], [1,2,3], [1,3], [2,3], [1,2], [] ] 链接:https://leetcode-cn.com/problems/subsets"""
def subsets(self, nums: list) -> list:
"""动态规划,例:nums = [1,2,3] 每迭代一次ret元素: [[]] [[], [... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
"""子集 给定一组不含重复元素的整数数组 nums,返回该数组所有可能的子集(幂集)。 说明:解集不能包含重复的子集。 示例: 输入: nums = [1,2,3] 输出: [ [3], [1], [2], [1,2,3], [1,3], [2,3], [1,2], [] ] 链接:https://leetcode-cn.com/problems/subsets"""
def subsets(self, nums: list) -> list:
"""动态规划,例:nums = [1,2,3] 每迭代一次ret元素: [[]] [[], [1]] [[], [1],... | the_stack_v2_python_sparse | 人生苦短/子集(1-2).py | Jsonlmy/leetcode | train | 0 |
afc8662e463589d8b3ea54ef732b55468fe5de7d | [
"self.identifier = ''\nself.contents = None\nif xcworkspace_path.endswith('.xcworkspace'):\n self.path = path_helper(xcworkspace_path, 'contents.xcworkspacedata')\n self.identifier = os.path.basename(self.path.obj_path)\n if os.path.exists(self.path.root_path) == True:\n try:\n self.conte... | <|body_start_0|>
self.identifier = ''
self.contents = None
if xcworkspace_path.endswith('.xcworkspace'):
self.path = path_helper(xcworkspace_path, 'contents.xcworkspacedata')
self.identifier = os.path.basename(self.path.obj_path)
if os.path.exists(self.path.ro... | xcworkspace | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class xcworkspace:
def __init__(self, xcworkspace_path):
"""Pass the path to a 'xcworkspace' file to initialize the xcworkspace object."""
<|body_0|>
def __resolvePathFromXMLItem(self, node, path):
"""This is a private method used to resolve the path location into a real f... | stack_v2_sparse_classes_36k_train_010521 | 2,947 | permissive | [
{
"docstring": "Pass the path to a 'xcworkspace' file to initialize the xcworkspace object.",
"name": "__init__",
"signature": "def __init__(self, xcworkspace_path)"
},
{
"docstring": "This is a private method used to resolve the path location into a real filesystem path.",
"name": "__resolv... | 4 | stack_v2_sparse_classes_30k_train_017924 | Implement the Python class `xcworkspace` described below.
Class description:
Implement the xcworkspace class.
Method signatures and docstrings:
- def __init__(self, xcworkspace_path): Pass the path to a 'xcworkspace' file to initialize the xcworkspace object.
- def __resolvePathFromXMLItem(self, node, path): This is ... | Implement the Python class `xcworkspace` described below.
Class description:
Implement the xcworkspace class.
Method signatures and docstrings:
- def __init__(self, xcworkspace_path): Pass the path to a 'xcworkspace' file to initialize the xcworkspace object.
- def __resolvePathFromXMLItem(self, node, path): This is ... | 4f78af149127325e60e3785b6e09d6dbfeedc799 | <|skeleton|>
class xcworkspace:
def __init__(self, xcworkspace_path):
"""Pass the path to a 'xcworkspace' file to initialize the xcworkspace object."""
<|body_0|>
def __resolvePathFromXMLItem(self, node, path):
"""This is a private method used to resolve the path location into a real f... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class xcworkspace:
def __init__(self, xcworkspace_path):
"""Pass the path to a 'xcworkspace' file to initialize the xcworkspace object."""
self.identifier = ''
self.contents = None
if xcworkspace_path.endswith('.xcworkspace'):
self.path = path_helper(xcworkspace_path, 'co... | the_stack_v2_python_sparse | xcparse/Xcode/xcworkspace.py | samdmarshall/xcparse | train | 60 | |
e707d66d98c713abda5d642d1686f9acdc37d67d | [
"if key is None or item is None:\n return\nself.cache_data[key] = item",
"if key is None:\n return\nreturn self.cache_data.get(key, None)"
] | <|body_start_0|>
if key is None or item is None:
return
self.cache_data[key] = item
<|end_body_0|>
<|body_start_1|>
if key is None:
return
return self.cache_data.get(key, None)
<|end_body_1|>
| Inherits from BaseCaching and is a caching system | BasicCache | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BasicCache:
"""Inherits from BaseCaching and is a caching system"""
def put(self, key, item):
"""Assign item for key of cache_data"""
<|body_0|>
def get(self, key):
"""Return value of cache_data linked to key"""
<|body_1|>
<|end_skeleton|>
<|body_start_... | stack_v2_sparse_classes_36k_train_010522 | 576 | no_license | [
{
"docstring": "Assign item for key of cache_data",
"name": "put",
"signature": "def put(self, key, item)"
},
{
"docstring": "Return value of cache_data linked to key",
"name": "get",
"signature": "def get(self, key)"
}
] | 2 | stack_v2_sparse_classes_30k_train_017072 | Implement the Python class `BasicCache` described below.
Class description:
Inherits from BaseCaching and is a caching system
Method signatures and docstrings:
- def put(self, key, item): Assign item for key of cache_data
- def get(self, key): Return value of cache_data linked to key | Implement the Python class `BasicCache` described below.
Class description:
Inherits from BaseCaching and is a caching system
Method signatures and docstrings:
- def put(self, key, item): Assign item for key of cache_data
- def get(self, key): Return value of cache_data linked to key
<|skeleton|>
class BasicCache:
... | 151c5c063b15c8474c1fa4ab5ce27f94f36c42b5 | <|skeleton|>
class BasicCache:
"""Inherits from BaseCaching and is a caching system"""
def put(self, key, item):
"""Assign item for key of cache_data"""
<|body_0|>
def get(self, key):
"""Return value of cache_data linked to key"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BasicCache:
"""Inherits from BaseCaching and is a caching system"""
def put(self, key, item):
"""Assign item for key of cache_data"""
if key is None or item is None:
return
self.cache_data[key] = item
def get(self, key):
"""Return value of cache_data linke... | the_stack_v2_python_sparse | 0x03-caching/0-basic_cache.py | Gzoref/holbertonschool-web_back_end | train | 0 |
c5e7c2e682644379de79760d907d782e3f97e654 | [
"decoded_group_id = trans.security.decode_id(group_id)\ntry:\n group = trans.sa_session.query(trans.app.model.Group).get(decoded_group_id)\nexcept:\n group = None\nif not group:\n trans.response.status = 400\n return 'Invalid group id ( %s ) specified.' % str(group_id)\nrval = []\ntry:\n for gra in g... | <|body_start_0|>
decoded_group_id = trans.security.decode_id(group_id)
try:
group = trans.sa_session.query(trans.app.model.Group).get(decoded_group_id)
except:
group = None
if not group:
trans.response.status = 400
return 'Invalid group id ... | GroupRolesAPIController | [
"CC-BY-2.5",
"AFL-2.1",
"AFL-3.0",
"CC-BY-3.0",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GroupRolesAPIController:
def index(self, trans, group_id, **kwd):
"""GET /api/groups/{encoded_group_id}/roles Displays a collection (list) of groups."""
<|body_0|>
def show(self, trans, id, group_id, **kwd):
"""GET /api/groups/{encoded_group_id}/roles/{encoded_role_i... | stack_v2_sparse_classes_36k_train_010523 | 5,172 | permissive | [
{
"docstring": "GET /api/groups/{encoded_group_id}/roles Displays a collection (list) of groups.",
"name": "index",
"signature": "def index(self, trans, group_id, **kwd)"
},
{
"docstring": "GET /api/groups/{encoded_group_id}/roles/{encoded_role_id} Displays information about a group role.",
... | 4 | null | Implement the Python class `GroupRolesAPIController` described below.
Class description:
Implement the GroupRolesAPIController class.
Method signatures and docstrings:
- def index(self, trans, group_id, **kwd): GET /api/groups/{encoded_group_id}/roles Displays a collection (list) of groups.
- def show(self, trans, id... | Implement the Python class `GroupRolesAPIController` described below.
Class description:
Implement the GroupRolesAPIController class.
Method signatures and docstrings:
- def index(self, trans, group_id, **kwd): GET /api/groups/{encoded_group_id}/roles Displays a collection (list) of groups.
- def show(self, trans, id... | 1ad89511540e6800cd2d0da5d878c1c77d8ccfe9 | <|skeleton|>
class GroupRolesAPIController:
def index(self, trans, group_id, **kwd):
"""GET /api/groups/{encoded_group_id}/roles Displays a collection (list) of groups."""
<|body_0|>
def show(self, trans, id, group_id, **kwd):
"""GET /api/groups/{encoded_group_id}/roles/{encoded_role_i... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GroupRolesAPIController:
def index(self, trans, group_id, **kwd):
"""GET /api/groups/{encoded_group_id}/roles Displays a collection (list) of groups."""
decoded_group_id = trans.security.decode_id(group_id)
try:
group = trans.sa_session.query(trans.app.model.Group).get(deco... | the_stack_v2_python_sparse | lib/galaxy/webapps/galaxy/api/group_roles.py | abretaud/galaxy | train | 0 | |
799da106b6879624bb9b3203814a10f4b270d932 | [
"if not prices:\n return 0\nn = len(prices)\n\n@lru_cache(None)\ndef dfs(index, status, k):\n if index == n or k == 0:\n return 0\n a, b, c = (0, 0, 0)\n a = dfs(index + 1, status, k)\n if status:\n b = dfs(index + 1, 0, k - 1) + prices[index]\n else:\n c = dfs(index + 1, 1, k... | <|body_start_0|>
if not prices:
return 0
n = len(prices)
@lru_cache(None)
def dfs(index, status, k):
if index == n or k == 0:
return 0
a, b, c = (0, 0, 0)
a = dfs(index + 1, status, k)
if status:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxProfit1(self, prices: List[int]) -> int:
"""思路:记忆化递归 @param prices: @return:"""
<|body_0|>
def maxProfit2(self, prices: List[int]) -> int:
"""思路:动态规划法 @param prices: @return:"""
<|body_1|>
def maxProfit3(self, prices: List[int]) -> int:
... | stack_v2_sparse_classes_36k_train_010524 | 3,529 | no_license | [
{
"docstring": "思路:记忆化递归 @param prices: @return:",
"name": "maxProfit1",
"signature": "def maxProfit1(self, prices: List[int]) -> int"
},
{
"docstring": "思路:动态规划法 @param prices: @return:",
"name": "maxProfit2",
"signature": "def maxProfit2(self, prices: List[int]) -> int"
},
{
"d... | 3 | stack_v2_sparse_classes_30k_train_001451 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxProfit1(self, prices: List[int]) -> int: 思路:记忆化递归 @param prices: @return:
- def maxProfit2(self, prices: List[int]) -> int: 思路:动态规划法 @param prices: @return:
- def maxProfi... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxProfit1(self, prices: List[int]) -> int: 思路:记忆化递归 @param prices: @return:
- def maxProfit2(self, prices: List[int]) -> int: 思路:动态规划法 @param prices: @return:
- def maxProfi... | e43ee86c5a8cdb808da09b4b6138e10275abadb5 | <|skeleton|>
class Solution:
def maxProfit1(self, prices: List[int]) -> int:
"""思路:记忆化递归 @param prices: @return:"""
<|body_0|>
def maxProfit2(self, prices: List[int]) -> int:
"""思路:动态规划法 @param prices: @return:"""
<|body_1|>
def maxProfit3(self, prices: List[int]) -> int:
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def maxProfit1(self, prices: List[int]) -> int:
"""思路:记忆化递归 @param prices: @return:"""
if not prices:
return 0
n = len(prices)
@lru_cache(None)
def dfs(index, status, k):
if index == n or k == 0:
return 0
a,... | the_stack_v2_python_sparse | LeetCode/股票购买专题/123. 买卖股票的最佳时机 III.py | yiming1012/MyLeetCode | train | 2 | |
3904da217494701fd03b44ab7764fa2560da7f64 | [
"super(TextClassificationEngine, self).__init__(config, *args, **kwargs)\nif self.config.type != 'text_classification':\n raise ValueError(f\"{self.config.model_path} isn't a Text Classification model (type '{self.config.type}'\")\ndynamic_shapes = {'max': (1, self.config['dataset']['max_seq_length'])}\nif nlp_d... | <|body_start_0|>
super(TextClassificationEngine, self).__init__(config, *args, **kwargs)
if self.config.type != 'text_classification':
raise ValueError(f"{self.config.model_path} isn't a Text Classification model (type '{self.config.type}'")
dynamic_shapes = {'max': (1, self.config['... | Text classification model in TensorRT / onnxruntime. | TextClassificationEngine | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TextClassificationEngine:
"""Text classification model in TensorRT / onnxruntime."""
def __init__(self, config, *args, **kwargs):
"""Load an text classification model from ONNX"""
<|body_0|>
def __call__(self, query):
"""Perform text classification on the input q... | stack_v2_sparse_classes_36k_train_010525 | 3,173 | no_license | [
{
"docstring": "Load an text classification model from ONNX",
"name": "__init__",
"signature": "def __init__(self, config, *args, **kwargs)"
},
{
"docstring": "Perform text classification on the input query. Parameters: query (string) -- The text query, for example: 'Today was warm, sunny and be... | 2 | stack_v2_sparse_classes_30k_val_000499 | Implement the Python class `TextClassificationEngine` described below.
Class description:
Text classification model in TensorRT / onnxruntime.
Method signatures and docstrings:
- def __init__(self, config, *args, **kwargs): Load an text classification model from ONNX
- def __call__(self, query): Perform text classifi... | Implement the Python class `TextClassificationEngine` described below.
Class description:
Text classification model in TensorRT / onnxruntime.
Method signatures and docstrings:
- def __init__(self, config, *args, **kwargs): Load an text classification model from ONNX
- def __call__(self, query): Perform text classifi... | 1938da6661e33b2e56846d8df9cce83c9353b233 | <|skeleton|>
class TextClassificationEngine:
"""Text classification model in TensorRT / onnxruntime."""
def __init__(self, config, *args, **kwargs):
"""Load an text classification model from ONNX"""
<|body_0|>
def __call__(self, query):
"""Perform text classification on the input q... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TextClassificationEngine:
"""Text classification model in TensorRT / onnxruntime."""
def __init__(self, config, *args, **kwargs):
"""Load an text classification model from ONNX"""
super(TextClassificationEngine, self).__init__(config, *args, **kwargs)
if self.config.type != 'text_... | the_stack_v2_python_sparse | jetson_voice/models/nlp/text_classification.py | Barleysack/jetson-voice | train | 0 |
fc70f7dc34cbe37fba5b3385e8f662113ac0c637 | [
"call_command('populate_db')\ndb_customers_count = Customer.objects.all().count()\ndb_locations_count = Location.objects.all().count()\nself.assertEqual(db_customers_count, 1000)\nself.assertEqual(db_locations_count, 1000)",
"with patch('django.db.utils.ConnectionHandler.__getitem__') as gi:\n gi.return_value ... | <|body_start_0|>
call_command('populate_db')
db_customers_count = Customer.objects.all().count()
db_locations_count = Location.objects.all().count()
self.assertEqual(db_customers_count, 1000)
self.assertEqual(db_locations_count, 1000)
<|end_body_0|>
<|body_start_1|>
with... | Tests custom django commands | CommandTests | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CommandTests:
"""Tests custom django commands"""
def test_populate_customers(self):
"""Tests if the populate_customers command is populating the Customers table"""
<|body_0|>
def test_wait_for_db(self, ts):
"""Tests if the api is waiting for the db to be ready"""... | stack_v2_sparse_classes_36k_train_010526 | 1,041 | permissive | [
{
"docstring": "Tests if the populate_customers command is populating the Customers table",
"name": "test_populate_customers",
"signature": "def test_populate_customers(self)"
},
{
"docstring": "Tests if the api is waiting for the db to be ready",
"name": "test_wait_for_db",
"signature":... | 2 | stack_v2_sparse_classes_30k_train_007181 | Implement the Python class `CommandTests` described below.
Class description:
Tests custom django commands
Method signatures and docstrings:
- def test_populate_customers(self): Tests if the populate_customers command is populating the Customers table
- def test_wait_for_db(self, ts): Tests if the api is waiting for ... | Implement the Python class `CommandTests` described below.
Class description:
Tests custom django commands
Method signatures and docstrings:
- def test_populate_customers(self): Tests if the populate_customers command is populating the Customers table
- def test_wait_for_db(self, ts): Tests if the api is waiting for ... | 7e15b707bc7f1ae1fd7a091e64c41a6f7c8092c3 | <|skeleton|>
class CommandTests:
"""Tests custom django commands"""
def test_populate_customers(self):
"""Tests if the populate_customers command is populating the Customers table"""
<|body_0|>
def test_wait_for_db(self, ts):
"""Tests if the api is waiting for the db to be ready"""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CommandTests:
"""Tests custom django commands"""
def test_populate_customers(self):
"""Tests if the populate_customers command is populating the Customers table"""
call_command('populate_db')
db_customers_count = Customer.objects.all().count()
db_locations_count = Location... | the_stack_v2_python_sparse | api/core/tests.py | mf-tech-solutions/cusgeo | train | 0 |
bca5312e2d829af609e673de5447a2eee714d989 | [
"d = {}\nfor i in nums:\n if i in d:\n d[i] += 1\n else:\n d[i] = 1\nx = d.get(0, 0)\ny = d.get(1, 0)\nz = d.get(2, 0)\nnums[:x] = [0] * x\nnums[x:x + y] = [1] * y\nnums[x + y:] = [2] * z",
"start = 0\nend = len(nums) - 1\ni = 0\nwhile i <= end:\n if nums[i] == 0:\n nums[start], nums... | <|body_start_0|>
d = {}
for i in nums:
if i in d:
d[i] += 1
else:
d[i] = 1
x = d.get(0, 0)
y = d.get(1, 0)
z = d.get(2, 0)
nums[:x] = [0] * x
nums[x:x + y] = [1] * y
nums[x + y:] = [2] * z
<|end_body_... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def sortColors(self, nums):
""":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead. 普通"""
<|body_0|>
def sortColors2(self, nums):
""":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.... | stack_v2_sparse_classes_36k_train_010527 | 1,037 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead. 普通",
"name": "sortColors",
"signature": "def sortColors(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead. 进阶",
"name... | 2 | stack_v2_sparse_classes_30k_train_003780 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def sortColors(self, nums): :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead. 普通
- def sortColors2(self, nums): :type nums: List[int] :rtyp... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def sortColors(self, nums): :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead. 普通
- def sortColors2(self, nums): :type nums: List[int] :rtyp... | 624975f767f6efa1d7361cc077eaebc344d57210 | <|skeleton|>
class Solution:
def sortColors(self, nums):
""":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead. 普通"""
<|body_0|>
def sortColors2(self, nums):
""":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def sortColors(self, nums):
""":type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead. 普通"""
d = {}
for i in nums:
if i in d:
d[i] += 1
else:
d[i] = 1
x = d.get(0, 0)
y = ... | the_stack_v2_python_sparse | 75. 分类颜色.py | dx19910707/LeetCode | train | 0 | |
f5a1bf7403a1b01e4b5e7f8b1a6d0700442e1fed | [
"self._autojoin = autojoin_\nself._path = path\ntry:\n self._party = zk.Party(path, id_)\nexcept (ConnectionLoss, SessionExpiredError):\n raise ZkNoConnection from None\nself.autojoin()",
"try:\n self._party.join()\nexcept (ConnectionLoss, SessionExpiredError):\n raise ZkNoConnection from None",
"if... | <|body_start_0|>
self._autojoin = autojoin_
self._path = path
try:
self._party = zk.Party(path, id_)
except (ConnectionLoss, SessionExpiredError):
raise ZkNoConnection from None
self.autojoin()
<|end_body_0|>
<|body_start_1|>
try:
self... | A wrapper for a `Kazoo Party <https://kazoo.readthedocs.org/en/latest/api/recipe/party.html>`_. | ZkParty | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ZkParty:
"""A wrapper for a `Kazoo Party <https://kazoo.readthedocs.org/en/latest/api/recipe/party.html>`_."""
def __init__(self, zk, path, id_, autojoin_):
""":param zk: A kazoo instance :param str path: The absolute path of the party :param str id_: The service id value to use in t... | stack_v2_sparse_classes_36k_train_010528 | 2,514 | permissive | [
{
"docstring": ":param zk: A kazoo instance :param str path: The absolute path of the party :param str id_: The service id value to use in the party :param bool autojoin_: Join the party automatically :raises: ZkNoConnection: if there's no connection to ZK.",
"name": "__init__",
"signature": "def __init... | 4 | null | Implement the Python class `ZkParty` described below.
Class description:
A wrapper for a `Kazoo Party <https://kazoo.readthedocs.org/en/latest/api/recipe/party.html>`_.
Method signatures and docstrings:
- def __init__(self, zk, path, id_, autojoin_): :param zk: A kazoo instance :param str path: The absolute path of t... | Implement the Python class `ZkParty` described below.
Class description:
A wrapper for a `Kazoo Party <https://kazoo.readthedocs.org/en/latest/api/recipe/party.html>`_.
Method signatures and docstrings:
- def __init__(self, zk, path, id_, autojoin_): :param zk: A kazoo instance :param str path: The absolute path of t... | 06f3f0b82dc8a535ce8b0a128282af00a8425a06 | <|skeleton|>
class ZkParty:
"""A wrapper for a `Kazoo Party <https://kazoo.readthedocs.org/en/latest/api/recipe/party.html>`_."""
def __init__(self, zk, path, id_, autojoin_):
""":param zk: A kazoo instance :param str path: The absolute path of the party :param str id_: The service id value to use in t... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ZkParty:
"""A wrapper for a `Kazoo Party <https://kazoo.readthedocs.org/en/latest/api/recipe/party.html>`_."""
def __init__(self, zk, path, id_, autojoin_):
""":param zk: A kazoo instance :param str path: The absolute path of the party :param str id_: The service id value to use in the party :par... | the_stack_v2_python_sparse | lib/zk/party.py | marcoeilers/scion | train | 1 |
ce57c721a447d9418f44287e25bbeffc9d087c60 | [
"super().__init__()\nself._connection_socket = connection_socket\nself._xml_logger = xml_logger\nself._command_executor = command_executor\nself._buffer_size = buffer_size",
"while True:\n try:\n command_requests = self._read_request_commands()\n responses = self._command_executor.execute_command... | <|body_start_0|>
super().__init__()
self._connection_socket = connection_socket
self._xml_logger = xml_logger
self._command_executor = command_executor
self._buffer_size = buffer_size
<|end_body_0|>
<|body_start_1|>
while True:
try:
command_re... | Handle connections. | ConnectionHandler | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ConnectionHandler:
"""Handle connections."""
def __init__(self, connection_socket: socket.socket, command_executor: CommandExecutor, xml_logger: logging.Logger, buffer_size: int=2048):
"""Initialize class."""
<|body_0|>
def run(self):
"""Start handling new connec... | stack_v2_sparse_classes_36k_train_010529 | 3,559 | no_license | [
{
"docstring": "Initialize class.",
"name": "__init__",
"signature": "def __init__(self, connection_socket: socket.socket, command_executor: CommandExecutor, xml_logger: logging.Logger, buffer_size: int=2048)"
},
{
"docstring": "Start handling new connection.",
"name": "run",
"signature"... | 5 | stack_v2_sparse_classes_30k_train_000387 | Implement the Python class `ConnectionHandler` described below.
Class description:
Handle connections.
Method signatures and docstrings:
- def __init__(self, connection_socket: socket.socket, command_executor: CommandExecutor, xml_logger: logging.Logger, buffer_size: int=2048): Initialize class.
- def run(self): Star... | Implement the Python class `ConnectionHandler` described below.
Class description:
Handle connections.
Method signatures and docstrings:
- def __init__(self, connection_socket: socket.socket, command_executor: CommandExecutor, xml_logger: logging.Logger, buffer_size: int=2048): Initialize class.
- def run(self): Star... | 82562665834908294136bbe8e7bc46da1a21b8e2 | <|skeleton|>
class ConnectionHandler:
"""Handle connections."""
def __init__(self, connection_socket: socket.socket, command_executor: CommandExecutor, xml_logger: logging.Logger, buffer_size: int=2048):
"""Initialize class."""
<|body_0|>
def run(self):
"""Start handling new connec... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ConnectionHandler:
"""Handle connections."""
def __init__(self, connection_socket: socket.socket, command_executor: CommandExecutor, xml_logger: logging.Logger, buffer_size: int=2048):
"""Initialize class."""
super().__init__()
self._connection_socket = connection_socket
s... | the_stack_v2_python_sparse | cloudshell/layer_one/core/connection_handler.py | QualiSystems/cloudshell-L1-networking-core | train | 1 |
f861e716f42a0cfd05fbdb5d98087e8c0766eaa9 | [
"from core.mixins import PKBase\nif isinstance(obj, datetime):\n return int(obj.timestamp())\nif isinstance(obj, set):\n return list(obj)\nif isinstance(obj, PKBase):\n data = obj.serialize()\n return self._objects_to_dict(data) if data else None\nreturn super().default(obj)",
"from core.mixins import... | <|body_start_0|>
from core.mixins import PKBase
if isinstance(obj, datetime):
return int(obj.timestamp())
if isinstance(obj, set):
return list(obj)
if isinstance(obj, PKBase):
data = obj.serialize()
return self._objects_to_dict(data) if dat... | Custom JSON Encoder class to apply the _to_dict() function to all PKBase subclasses and turn timestamps into unixtime. This encoder allows ``flask.jsonify`` to receive a ``PKBase`` subclass as an argument, which will then be turned into a dictionary automatically. | NewJSONEncoder | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NewJSONEncoder:
"""Custom JSON Encoder class to apply the _to_dict() function to all PKBase subclasses and turn timestamps into unixtime. This encoder allows ``flask.jsonify`` to receive a ``PKBase`` subclass as an argument, which will then be turned into a dictionary automatically."""
def d... | stack_v2_sparse_classes_36k_train_010530 | 2,639 | permissive | [
{
"docstring": "Overridden default method for the JSONEncoder. The JSON encoder will now serialize all timestamps to POSIX time and turn PKBase into dictionaries.",
"name": "default",
"signature": "def default(self, obj)"
},
{
"docstring": "Iterate through all values inside a dictionary and \"fi... | 2 | stack_v2_sparse_classes_30k_test_000400 | Implement the Python class `NewJSONEncoder` described below.
Class description:
Custom JSON Encoder class to apply the _to_dict() function to all PKBase subclasses and turn timestamps into unixtime. This encoder allows ``flask.jsonify`` to receive a ``PKBase`` subclass as an argument, which will then be turned into a ... | Implement the Python class `NewJSONEncoder` described below.
Class description:
Custom JSON Encoder class to apply the _to_dict() function to all PKBase subclasses and turn timestamps into unixtime. This encoder allows ``flask.jsonify`` to receive a ``PKBase`` subclass as an argument, which will then be turned into a ... | 430e879c7a4c4a758641af56da552355e6c76a45 | <|skeleton|>
class NewJSONEncoder:
"""Custom JSON Encoder class to apply the _to_dict() function to all PKBase subclasses and turn timestamps into unixtime. This encoder allows ``flask.jsonify`` to receive a ``PKBase`` subclass as an argument, which will then be turned into a dictionary automatically."""
def d... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NewJSONEncoder:
"""Custom JSON Encoder class to apply the _to_dict() function to all PKBase subclasses and turn timestamps into unixtime. This encoder allows ``flask.jsonify`` to receive a ``PKBase`` subclass as an argument, which will then be turned into a dictionary automatically."""
def default(self, ... | the_stack_v2_python_sparse | core/serializer.py | sharebears/pulsar-core | train | 0 |
d6d36d1ee16d553609b90b99763656edd0ec7250 | [
"index = {c: i for i, c in enumerate(S)}\nresult = []\nfor c in T:\n if c in index:\n result.append((index[c], c))\n else:\n result.append((float('inf'), c))\nreturn ''.join([v for _, v in sorted(result, key=lambda v: v[0])])",
"dmap = {c: i for i, c in enumerate(S)}\nresult = []\nfor t in T:\... | <|body_start_0|>
index = {c: i for i, c in enumerate(S)}
result = []
for c in T:
if c in index:
result.append((index[c], c))
else:
result.append((float('inf'), c))
return ''.join([v for _, v in sorted(result, key=lambda v: v[0])])
<... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def customSortString(self, S, T):
""":type S: str :type T: str :rtype: str"""
<|body_0|>
def rewrite(self, S, T):
""":type S: str :type T: str :rtype: str"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
index = {c: i for i, c in enumerate(... | stack_v2_sparse_classes_36k_train_010531 | 1,847 | no_license | [
{
"docstring": ":type S: str :type T: str :rtype: str",
"name": "customSortString",
"signature": "def customSortString(self, S, T)"
},
{
"docstring": ":type S: str :type T: str :rtype: str",
"name": "rewrite",
"signature": "def rewrite(self, S, T)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def customSortString(self, S, T): :type S: str :type T: str :rtype: str
- def rewrite(self, S, T): :type S: str :type T: str :rtype: str | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def customSortString(self, S, T): :type S: str :type T: str :rtype: str
- def rewrite(self, S, T): :type S: str :type T: str :rtype: str
<|skeleton|>
class Solution:
def cu... | 6350568d16b0f8c49a020f055bb6d72e2705ea56 | <|skeleton|>
class Solution:
def customSortString(self, S, T):
""":type S: str :type T: str :rtype: str"""
<|body_0|>
def rewrite(self, S, T):
""":type S: str :type T: str :rtype: str"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def customSortString(self, S, T):
""":type S: str :type T: str :rtype: str"""
index = {c: i for i, c in enumerate(S)}
result = []
for c in T:
if c in index:
result.append((index[c], c))
else:
result.append((float... | the_stack_v2_python_sparse | co_amazon/791_Custom_Sort_String.py | vsdrun/lc_public | train | 6 | |
779b848f20ae8870d56f19c96f83f2297c7dfbd9 | [
"super(DropBar, self).__init__(title, parent)\nself.parent = parent\nself.toolBox = QtGui.QToolBox()\nself.setWidget(self.toolBox)\nself.commonDropArea = DropArea(commonTypes)\nself.hostDropArea = DropArea(hostTypes.keys())\nself.netDropArea = DropArea(netTypes.keys())\nself.toolBox.addItem(self.commonDropArea, sel... | <|body_start_0|>
super(DropBar, self).__init__(title, parent)
self.parent = parent
self.toolBox = QtGui.QToolBox()
self.setWidget(self.toolBox)
self.commonDropArea = DropArea(commonTypes)
self.hostDropArea = DropArea(hostTypes.keys())
self.netDropArea = DropArea(n... | DropBar | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DropBar:
def __init__(self, title, parent):
"""Create a drag and drop toolbar."""
<|body_0|>
def toolChanged(self, index):
"""Handle the page change."""
<|body_1|>
def locationChanged(self, location):
"""Handle the dock location change."""
... | stack_v2_sparse_classes_36k_train_010532 | 3,523 | permissive | [
{
"docstring": "Create a drag and drop toolbar.",
"name": "__init__",
"signature": "def __init__(self, title, parent)"
},
{
"docstring": "Handle the page change.",
"name": "toolChanged",
"signature": "def toolChanged(self, index)"
},
{
"docstring": "Handle the dock location chang... | 3 | null | Implement the Python class `DropBar` described below.
Class description:
Implement the DropBar class.
Method signatures and docstrings:
- def __init__(self, title, parent): Create a drag and drop toolbar.
- def toolChanged(self, index): Handle the page change.
- def locationChanged(self, location): Handle the dock lo... | Implement the Python class `DropBar` described below.
Class description:
Implement the DropBar class.
Method signatures and docstrings:
- def __init__(self, title, parent): Create a drag and drop toolbar.
- def toolChanged(self, index): Handle the page change.
- def locationChanged(self, location): Handle the dock lo... | d095076113c1e84c33f52ef46a3df1f8bc8ffa43 | <|skeleton|>
class DropBar:
def __init__(self, title, parent):
"""Create a drag and drop toolbar."""
<|body_0|>
def toolChanged(self, index):
"""Handle the page change."""
<|body_1|>
def locationChanged(self, location):
"""Handle the dock location change."""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DropBar:
def __init__(self, title, parent):
"""Create a drag and drop toolbar."""
super(DropBar, self).__init__(title, parent)
self.parent = parent
self.toolBox = QtGui.QToolBox()
self.setWidget(self.toolBox)
self.commonDropArea = DropArea(commonTypes)
s... | the_stack_v2_python_sparse | frontend/src/gbuilder/UI/DropBar.py | citelab/gini5 | train | 12 | |
f55dec0168aa7a35578ca5c8d1a728393c662fe0 | [
"super(dns, self).__init__(fpath, threadlock)\nself.tag = 'dns'\nself.default = default\nself.main_syntax = {'hostname': {'T': str, 'D': '', 'M': True, 'S': None}, 'domain-name': {'T': str, 'D': '', 'M': True, 'S': None}, 'dns-server-1': {'T': str, 'D': '', 'M': True, 'S': None}, 'dns-server-2': {'T': str, 'D': '',... | <|body_start_0|>
super(dns, self).__init__(fpath, threadlock)
self.tag = 'dns'
self.default = default
self.main_syntax = {'hostname': {'T': str, 'D': '', 'M': True, 'S': None}, 'domain-name': {'T': str, 'D': '', 'M': True, 'S': None}, 'dns-server-1': {'T': str, 'D': '', 'M': True, 'S': N... | DNS | dns | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class dns:
"""DNS"""
def __init__(self, fpath=os.path.join(ml_system.CFG_PATH, 'dns.txt'), threadlock=None):
"""init config"""
<|body_0|>
def do_set(self):
"""real task"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
super(dns, self).__init__(fpath, t... | stack_v2_sparse_classes_36k_train_010533 | 2,610 | no_license | [
{
"docstring": "init config",
"name": "__init__",
"signature": "def __init__(self, fpath=os.path.join(ml_system.CFG_PATH, 'dns.txt'), threadlock=None)"
},
{
"docstring": "real task",
"name": "do_set",
"signature": "def do_set(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_017315 | Implement the Python class `dns` described below.
Class description:
DNS
Method signatures and docstrings:
- def __init__(self, fpath=os.path.join(ml_system.CFG_PATH, 'dns.txt'), threadlock=None): init config
- def do_set(self): real task | Implement the Python class `dns` described below.
Class description:
DNS
Method signatures and docstrings:
- def __init__(self, fpath=os.path.join(ml_system.CFG_PATH, 'dns.txt'), threadlock=None): init config
- def do_set(self): real task
<|skeleton|>
class dns:
"""DNS"""
def __init__(self, fpath=os.path.jo... | 12a25d06c8ea7971267aca43a63aafb71b29a3f1 | <|skeleton|>
class dns:
"""DNS"""
def __init__(self, fpath=os.path.join(ml_system.CFG_PATH, 'dns.txt'), threadlock=None):
"""init config"""
<|body_0|>
def do_set(self):
"""real task"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class dns:
"""DNS"""
def __init__(self, fpath=os.path.join(ml_system.CFG_PATH, 'dns.txt'), threadlock=None):
"""init config"""
super(dns, self).__init__(fpath, threadlock)
self.tag = 'dns'
self.default = default
self.main_syntax = {'hostname': {'T': str, 'D': '', 'M': Tr... | the_stack_v2_python_sparse | ml_w_dns.py | poyhsiao/betapyweb-middleware | train | 0 |
f1f1617b69267399b90f989cb1ffaf1e7f911d32 | [
"BaseMailingProcess.__init__(self)\nself.user = None\nself.unit_problem = None\nself.stripe_session = None\nself.future_pro_user = None",
"self.user = user\nself.unit_problem = problem\nself.stripe_session = stripe_session\nself.future_pro_user = future_pro_user\ngateway_token = generate_gateway_token()\nbackslas... | <|body_start_0|>
BaseMailingProcess.__init__(self)
self.user = None
self.unit_problem = None
self.stripe_session = None
self.future_pro_user = None
<|end_body_0|>
<|body_start_1|>
self.user = user
self.unit_problem = problem
self.stripe_session = stripe_s... | UnitMailingProcess | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UnitMailingProcess:
def __init__(self):
"""The UnitMailingProcess handle the core logic for sending one mail given a problem. It's when a user decide to go for the PRO offer (a unit mail with the solution is directly sent)"""
<|body_0|>
def run(self, user, problem, stripe_se... | stack_v2_sparse_classes_36k_train_010534 | 24,237 | no_license | [
{
"docstring": "The UnitMailingProcess handle the core logic for sending one mail given a problem. It's when a user decide to go for the PRO offer (a unit mail with the solution is directly sent)",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Run the unit mailing proc... | 2 | stack_v2_sparse_classes_30k_train_018895 | Implement the Python class `UnitMailingProcess` described below.
Class description:
Implement the UnitMailingProcess class.
Method signatures and docstrings:
- def __init__(self): The UnitMailingProcess handle the core logic for sending one mail given a problem. It's when a user decide to go for the PRO offer (a unit... | Implement the Python class `UnitMailingProcess` described below.
Class description:
Implement the UnitMailingProcess class.
Method signatures and docstrings:
- def __init__(self): The UnitMailingProcess handle the core logic for sending one mail given a problem. It's when a user decide to go for the PRO offer (a unit... | 048e349a413b075da9cc0e0b497c40ab6620e245 | <|skeleton|>
class UnitMailingProcess:
def __init__(self):
"""The UnitMailingProcess handle the core logic for sending one mail given a problem. It's when a user decide to go for the PRO offer (a unit mail with the solution is directly sent)"""
<|body_0|>
def run(self, user, problem, stripe_se... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UnitMailingProcess:
def __init__(self):
"""The UnitMailingProcess handle the core logic for sending one mail given a problem. It's when a user decide to go for the PRO offer (a unit mail with the solution is directly sent)"""
BaseMailingProcess.__init__(self)
self.user = None
s... | the_stack_v2_python_sparse | 1interviewparjour/oneinterviewparjour/mail_scheduler/engine.py | gabrielmougard/1interviewparjour | train | 1 | |
7850ba75abfa70693a632c0942a43797badc48bb | [
"act = solve(4, 3, [1, 7, 2, 4])\nexp = 3\nself.assertEqual(exp, act)",
"act = solve(4, 3, [7])\nexp = 1\nself.assertEqual(exp, act)",
"act = solve(4, 5, [0, 0, 1, 1, 1, 3, 3, 4, 4])\nexp = 1 + 3 + 2\nself.assertEqual(exp, act)",
"act = solve(4, 6, [0, 0, 1, 1, 1, 3, 3, 4, 4, 5, 5])\nexp = 1 + 3 + 2 + 1\nself... | <|body_start_0|>
act = solve(4, 3, [1, 7, 2, 4])
exp = 3
self.assertEqual(exp, act)
<|end_body_0|>
<|body_start_1|>
act = solve(4, 3, [7])
exp = 1
self.assertEqual(exp, act)
<|end_body_1|>
<|body_start_2|>
act = solve(4, 5, [0, 0, 1, 1, 1, 3, 3, 4, 4])
e... | Test class for solve function. | TestNonDivisibleSubset | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestNonDivisibleSubset:
"""Test class for solve function."""
def test_sample(self):
"""Test with sample provided"""
<|body_0|>
def test_one_element(self):
"""Test with just one element provided"""
<|body_1|>
def test_odd_k(self):
"""Test with... | stack_v2_sparse_classes_36k_train_010535 | 1,889 | no_license | [
{
"docstring": "Test with sample provided",
"name": "test_sample",
"signature": "def test_sample(self)"
},
{
"docstring": "Test with just one element provided",
"name": "test_one_element",
"signature": "def test_one_element(self)"
},
{
"docstring": "Test with odd k",
"name": ... | 4 | stack_v2_sparse_classes_30k_test_001181 | Implement the Python class `TestNonDivisibleSubset` described below.
Class description:
Test class for solve function.
Method signatures and docstrings:
- def test_sample(self): Test with sample provided
- def test_one_element(self): Test with just one element provided
- def test_odd_k(self): Test with odd k
- def te... | Implement the Python class `TestNonDivisibleSubset` described below.
Class description:
Test class for solve function.
Method signatures and docstrings:
- def test_sample(self): Test with sample provided
- def test_one_element(self): Test with just one element provided
- def test_odd_k(self): Test with odd k
- def te... | 8323476f5665f9495350092ec77ebca8698993ab | <|skeleton|>
class TestNonDivisibleSubset:
"""Test class for solve function."""
def test_sample(self):
"""Test with sample provided"""
<|body_0|>
def test_one_element(self):
"""Test with just one element provided"""
<|body_1|>
def test_odd_k(self):
"""Test with... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestNonDivisibleSubset:
"""Test class for solve function."""
def test_sample(self):
"""Test with sample provided"""
act = solve(4, 3, [1, 7, 2, 4])
exp = 3
self.assertEqual(exp, act)
def test_one_element(self):
"""Test with just one element provided"""
... | the_stack_v2_python_sparse | xinweic/HackerRank/Non-Divisible-Subset.py | nikeethr/rflexstudygroup | train | 0 |
d2878069fa2180777c162e70954e176bf5f25852 | [
"super(ResNet, self).__init__()\nself.inplanes = 32\nself.d_model = d_model\nself.conv1 = nn.Conv2d(3, 32, kernel_size=3, stride=1, padding=1, bias=False)\nself.bn1 = nn.BatchNorm2d(32)\nself.relu = nn.ReLU(inplace=True)\nself.block1 = self._make_layer(block, 32, layers[0], stride=(2, 2))\nself.block2 = self._make_... | <|body_start_0|>
super(ResNet, self).__init__()
self.inplanes = 32
self.d_model = d_model
self.conv1 = nn.Conv2d(3, 32, kernel_size=3, stride=1, padding=1, bias=False)
self.bn1 = nn.BatchNorm2d(32)
self.relu = nn.ReLU(inplace=True)
self.block1 = self._make_layer(b... | https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=8395027&tag=1 https://github.com/pytorch/vision/blob/master/torchvision/models/resnet.py ResNet Feature extractor | ResNet | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ResNet:
"""https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=8395027&tag=1 https://github.com/pytorch/vision/blob/master/torchvision/models/resnet.py ResNet Feature extractor"""
def __init__(self, block, layers, d_model):
""":param block: ResNet Block :param layers: array with... | stack_v2_sparse_classes_36k_train_010536 | 3,300 | no_license | [
{
"docstring": ":param block: ResNet Block :param layers: array with number of conv layers per ResNet layer :param d_model: model dimensionality",
"name": "__init__",
"signature": "def __init__(self, block, layers, d_model)"
},
{
"docstring": ":param block: :param planes: :param blocks: :param s... | 3 | stack_v2_sparse_classes_30k_train_000158 | Implement the Python class `ResNet` described below.
Class description:
https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=8395027&tag=1 https://github.com/pytorch/vision/blob/master/torchvision/models/resnet.py ResNet Feature extractor
Method signatures and docstrings:
- def __init__(self, block, layers, d_mod... | Implement the Python class `ResNet` described below.
Class description:
https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=8395027&tag=1 https://github.com/pytorch/vision/blob/master/torchvision/models/resnet.py ResNet Feature extractor
Method signatures and docstrings:
- def __init__(self, block, layers, d_mod... | ab83a47ef2e107dd7160ea0ca1832fa0531926b7 | <|skeleton|>
class ResNet:
"""https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=8395027&tag=1 https://github.com/pytorch/vision/blob/master/torchvision/models/resnet.py ResNet Feature extractor"""
def __init__(self, block, layers, d_model):
""":param block: ResNet Block :param layers: array with... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ResNet:
"""https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=8395027&tag=1 https://github.com/pytorch/vision/blob/master/torchvision/models/resnet.py ResNet Feature extractor"""
def __init__(self, block, layers, d_model):
""":param block: ResNet Block :param layers: array with number of co... | the_stack_v2_python_sparse | src/ResNet.py | MauritsBleeker/Bi-STET | train | 72 |
aeb3ab99d75b26bd66743ad4a6bee3666807a4ab | [
"from part.models import Part\nfrom stock.models import StockItem, StockLocation\nself.assertEqual(Part.barcode_model_type(), 'part')\nself.assertEqual(StockItem.barcode_model_type(), 'stockitem')\nself.assertEqual(StockLocation.barcode_model_type(), 'stocklocation')",
"hashing_tests = {'abcdefg': '7ac66c0f148de9... | <|body_start_0|>
from part.models import Part
from stock.models import StockItem, StockLocation
self.assertEqual(Part.barcode_model_type(), 'part')
self.assertEqual(StockItem.barcode_model_type(), 'stockitem')
self.assertEqual(StockLocation.barcode_model_type(), 'stocklocation')
... | Tests for the InvenTreeBarcodeMixin mixin class | BarcodeMixinTest | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BarcodeMixinTest:
"""Tests for the InvenTreeBarcodeMixin mixin class"""
def test_barcode_model_type(self):
"""Test that the barcode_model_type property works for each class"""
<|body_0|>
def test_bacode_hash(self):
"""Test that the barcode hashing function provid... | stack_v2_sparse_classes_36k_train_010537 | 41,191 | permissive | [
{
"docstring": "Test that the barcode_model_type property works for each class",
"name": "test_barcode_model_type",
"signature": "def test_barcode_model_type(self)"
},
{
"docstring": "Test that the barcode hashing function provides correct results",
"name": "test_bacode_hash",
"signature... | 2 | null | Implement the Python class `BarcodeMixinTest` described below.
Class description:
Tests for the InvenTreeBarcodeMixin mixin class
Method signatures and docstrings:
- def test_barcode_model_type(self): Test that the barcode_model_type property works for each class
- def test_bacode_hash(self): Test that the barcode ha... | Implement the Python class `BarcodeMixinTest` described below.
Class description:
Tests for the InvenTreeBarcodeMixin mixin class
Method signatures and docstrings:
- def test_barcode_model_type(self): Test that the barcode_model_type property works for each class
- def test_bacode_hash(self): Test that the barcode ha... | e88a8e99a5f0b201c67a95cba097c729f090d5e2 | <|skeleton|>
class BarcodeMixinTest:
"""Tests for the InvenTreeBarcodeMixin mixin class"""
def test_barcode_model_type(self):
"""Test that the barcode_model_type property works for each class"""
<|body_0|>
def test_bacode_hash(self):
"""Test that the barcode hashing function provid... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BarcodeMixinTest:
"""Tests for the InvenTreeBarcodeMixin mixin class"""
def test_barcode_model_type(self):
"""Test that the barcode_model_type property works for each class"""
from part.models import Part
from stock.models import StockItem, StockLocation
self.assertEqual(P... | the_stack_v2_python_sparse | InvenTree/InvenTree/tests.py | inventree/InvenTree | train | 3,077 |
41260ab0c532afd2e66d4571497b7eb70ddc7018 | [
"if config.word_vector == 'word2vec':\n logger.info('Loading word2vec from disk ...')\n self.model = Word2Vec.load_word2vec_format(config.word_vector_path, binary=True)\nprint('Loading done...')\nself.full_alphabet = Alphabet('full_lookup')",
"embeddings = []\nif Alphabet.default_index == 0:\n embeddings... | <|body_start_0|>
if config.word_vector == 'word2vec':
logger.info('Loading word2vec from disk ...')
self.model = Word2Vec.load_word2vec_format(config.word_vector_path, binary=True)
print('Loading done...')
self.full_alphabet = Alphabet('full_lookup')
<|end_body_0|>
<|bod... | Lookup | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Lookup:
def __init__(self, config):
""":return:"""
<|body_0|>
def initail_lookup(self, alphabet):
"""Initialize the lookup table of the word vectors. This will create a full lookup table that contains all the vocabulary, and a table that contains only the given alpha... | stack_v2_sparse_classes_36k_train_010538 | 3,295 | no_license | [
{
"docstring": ":return:",
"name": "__init__",
"signature": "def __init__(self, config)"
},
{
"docstring": "Initialize the lookup table of the word vectors. This will create a full lookup table that contains all the vocabulary, and a table that contains only the given alphabet. :param alphabet: ... | 3 | stack_v2_sparse_classes_30k_train_006215 | Implement the Python class `Lookup` described below.
Class description:
Implement the Lookup class.
Method signatures and docstrings:
- def __init__(self, config): :return:
- def initail_lookup(self, alphabet): Initialize the lookup table of the word vectors. This will create a full lookup table that contains all the... | Implement the Python class `Lookup` described below.
Class description:
Implement the Lookup class.
Method signatures and docstrings:
- def __init__(self, config): :return:
- def initail_lookup(self, alphabet): Initialize the lookup table of the word vectors. This will create a full lookup table that contains all the... | 1f9e42ed44124493abebeea78612901781230427 | <|skeleton|>
class Lookup:
def __init__(self, config):
""":return:"""
<|body_0|>
def initail_lookup(self, alphabet):
"""Initialize the lookup table of the word vectors. This will create a full lookup table that contains all the vocabulary, and a table that contains only the given alpha... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Lookup:
def __init__(self, config):
""":return:"""
if config.word_vector == 'word2vec':
logger.info('Loading word2vec from disk ...')
self.model = Word2Vec.load_word2vec_format(config.word_vector_path, binary=True)
print('Loading done...')
self.full_alph... | the_stack_v2_python_sparse | finest/utils/lookup.py | curiousTauseef/FinestTune | train | 0 | |
b36181fb5c8c4145f63760858127ba9ddcd60fe9 | [
"super(ProtocolWrapper, self).__init__(env)\nself.protocol = protocol\nself.env.add_wrapper_info({'evaluation_environment': self.protocol.get_name()})\nself._elapsed_episodes = 0\nself._elapsed_timesteps = 0\nreturn",
"observation, reward, done, info = self.env.step(action)\nself._elapsed_timesteps += 1\ninvalid_... | <|body_start_0|>
super(ProtocolWrapper, self).__init__(env)
self.protocol = protocol
self.env.add_wrapper_info({'evaluation_environment': self.protocol.get_name()})
self._elapsed_episodes = 0
self._elapsed_timesteps = 0
return
<|end_body_0|>
<|body_start_1|>
obse... | ProtocolWrapper | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProtocolWrapper:
def __init__(self, env, protocol):
""":param env: :param protocol:"""
<|body_0|>
def step(self, action):
""":param action: :return:"""
<|body_1|>
def reset(self):
""":return:"""
<|body_2|>
<|end_skeleton|>
<|body_start_... | stack_v2_sparse_classes_36k_train_010539 | 2,531 | permissive | [
{
"docstring": ":param env: :param protocol:",
"name": "__init__",
"signature": "def __init__(self, env, protocol)"
},
{
"docstring": ":param action: :return:",
"name": "step",
"signature": "def step(self, action)"
},
{
"docstring": ":return:",
"name": "reset",
"signature... | 3 | stack_v2_sparse_classes_30k_train_017516 | Implement the Python class `ProtocolWrapper` described below.
Class description:
Implement the ProtocolWrapper class.
Method signatures and docstrings:
- def __init__(self, env, protocol): :param env: :param protocol:
- def step(self, action): :param action: :return:
- def reset(self): :return: | Implement the Python class `ProtocolWrapper` described below.
Class description:
Implement the ProtocolWrapper class.
Method signatures and docstrings:
- def __init__(self, env, protocol): :param env: :param protocol:
- def step(self, action): :param action: :return:
- def reset(self): :return:
<|skeleton|>
class Pr... | 4c0ac37e559daa0dd89668e5bff5eec82a4158c5 | <|skeleton|>
class ProtocolWrapper:
def __init__(self, env, protocol):
""":param env: :param protocol:"""
<|body_0|>
def step(self, action):
""":param action: :return:"""
<|body_1|>
def reset(self):
""":return:"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ProtocolWrapper:
def __init__(self, env, protocol):
""":param env: :param protocol:"""
super(ProtocolWrapper, self).__init__(env)
self.protocol = protocol
self.env.add_wrapper_info({'evaluation_environment': self.protocol.get_name()})
self._elapsed_episodes = 0
... | the_stack_v2_python_sparse | Trifinger/causal_world/wrappers/protocol_wrapper.py | emigmo/BenTDM | train | 0 | |
ecba5c38c66455dd7838633236418d51a7e374a2 | [
"self.p = p\nself.a = a\nself.b = b",
"y2 = point.y * point.y\nx3 = point.x * point.x * point.x\nreturn (y2 - (x3 + self.a * point.x + self.b)) % self.p == 0"
] | <|body_start_0|>
self.p = p
self.a = a
self.b = b
<|end_body_0|>
<|body_start_1|>
y2 = point.y * point.y
x3 = point.x * point.x * point.x
return (y2 - (x3 + self.a * point.x + self.b)) % self.p == 0
<|end_body_1|>
| Elliptic curve over a prime field. Characteristic two field curves are not supported. | PrimeCurve | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PrimeCurve:
"""Elliptic curve over a prime field. Characteristic two field curves are not supported."""
def __init__(self, p, a, b):
"""The curve of points satisfying y^2 = x^3 + a*x + b (mod p) :param p: The prime number as an integer :param a: The component a as an integer :param b... | stack_v2_sparse_classes_36k_train_010540 | 22,818 | permissive | [
{
"docstring": "The curve of points satisfying y^2 = x^3 + a*x + b (mod p) :param p: The prime number as an integer :param a: The component a as an integer :param b: The component b as an integer",
"name": "__init__",
"signature": "def __init__(self, p, a, b)"
},
{
"docstring": ":param point: A ... | 2 | stack_v2_sparse_classes_30k_train_017782 | Implement the Python class `PrimeCurve` described below.
Class description:
Elliptic curve over a prime field. Characteristic two field curves are not supported.
Method signatures and docstrings:
- def __init__(self, p, a, b): The curve of points satisfying y^2 = x^3 + a*x + b (mod p) :param p: The prime number as an... | Implement the Python class `PrimeCurve` described below.
Class description:
Elliptic curve over a prime field. Characteristic two field curves are not supported.
Method signatures and docstrings:
- def __init__(self, p, a, b): The curve of points satisfying y^2 = x^3 + a*x + b (mod p) :param p: The prime number as an... | 1547f535001ba568b239b8797465536759c742a3 | <|skeleton|>
class PrimeCurve:
"""Elliptic curve over a prime field. Characteristic two field curves are not supported."""
def __init__(self, p, a, b):
"""The curve of points satisfying y^2 = x^3 + a*x + b (mod p) :param p: The prime number as an integer :param a: The component a as an integer :param b... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PrimeCurve:
"""Elliptic curve over a prime field. Characteristic two field curves are not supported."""
def __init__(self, p, a, b):
"""The curve of points satisfying y^2 = x^3 + a*x + b (mod p) :param p: The prime number as an integer :param a: The component a as an integer :param b: The compone... | the_stack_v2_python_sparse | oscrypto/_ecdsa.py | wbond/oscrypto | train | 331 |
5f0ad5bf9f797ad65e7de45d3304e476aca461fd | [
"self.is_disposed = False\nself.action: Action = action or noop\nself.lock = RLock()\nsuper().__init__()",
"dispose = False\nwith self.lock:\n if not self.is_disposed:\n dispose = True\n self.is_disposed = True\nif dispose:\n self.action()"
] | <|body_start_0|>
self.is_disposed = False
self.action: Action = action or noop
self.lock = RLock()
super().__init__()
<|end_body_0|>
<|body_start_1|>
dispose = False
with self.lock:
if not self.is_disposed:
dispose = True
self.... | Main disposable class | Disposable | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Disposable:
"""Main disposable class"""
def __init__(self, action: Optional[typing.Action]=None) -> None:
"""Creates a disposable object that invokes the specified action when disposed. Args: action: Action to run during the first call to dispose. The action is guaranteed to be run a... | stack_v2_sparse_classes_36k_train_010541 | 1,132 | permissive | [
{
"docstring": "Creates a disposable object that invokes the specified action when disposed. Args: action: Action to run during the first call to dispose. The action is guaranteed to be run at most once. Returns: The disposable object that runs the given action upon disposal.",
"name": "__init__",
"sign... | 2 | null | Implement the Python class `Disposable` described below.
Class description:
Main disposable class
Method signatures and docstrings:
- def __init__(self, action: Optional[typing.Action]=None) -> None: Creates a disposable object that invokes the specified action when disposed. Args: action: Action to run during the fi... | Implement the Python class `Disposable` described below.
Class description:
Main disposable class
Method signatures and docstrings:
- def __init__(self, action: Optional[typing.Action]=None) -> None: Creates a disposable object that invokes the specified action when disposed. Args: action: Action to run during the fi... | af1663d35810fdcd4c25a3ed2e8f0d71b55c341d | <|skeleton|>
class Disposable:
"""Main disposable class"""
def __init__(self, action: Optional[typing.Action]=None) -> None:
"""Creates a disposable object that invokes the specified action when disposed. Args: action: Action to run during the first call to dispose. The action is guaranteed to be run a... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Disposable:
"""Main disposable class"""
def __init__(self, action: Optional[typing.Action]=None) -> None:
"""Creates a disposable object that invokes the specified action when disposed. Args: action: Action to run during the first call to dispose. The action is guaranteed to be run at most once. ... | the_stack_v2_python_sparse | reactivex/disposable/disposable.py | ReactiveX/RxPY | train | 4,764 |
b0365562044230e00688eba00b57c61fe59ae858 | [
"super().__init__()\nself._stderr = stderr\nself._stdout = stdout",
"message = self.format(record)\ntry:\n app = active_app.get()\nexcept LookupError:\n if self._stderr:\n print(message, file=sys.stderr)\n elif self._stdout:\n print(message, file=sys.stdout)\nelse:\n app.log.logging(mess... | <|body_start_0|>
super().__init__()
self._stderr = stderr
self._stdout = stdout
<|end_body_0|>
<|body_start_1|>
message = self.format(record)
try:
app = active_app.get()
except LookupError:
if self._stderr:
print(message, file=sys.... | A Logging handler for Textual apps. | TextualHandler | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TextualHandler:
"""A Logging handler for Textual apps."""
def __init__(self, stderr: bool=True, stdout: bool=False) -> None:
"""Initialize a Textual logging handler. Args: stderr: Log to stderr when there is no active app. stdout: Log to stdout when there is not active app."""
... | stack_v2_sparse_classes_36k_train_010542 | 1,182 | permissive | [
{
"docstring": "Initialize a Textual logging handler. Args: stderr: Log to stderr when there is no active app. stdout: Log to stdout when there is not active app.",
"name": "__init__",
"signature": "def __init__(self, stderr: bool=True, stdout: bool=False) -> None"
},
{
"docstring": "Invoked by ... | 2 | stack_v2_sparse_classes_30k_train_021383 | Implement the Python class `TextualHandler` described below.
Class description:
A Logging handler for Textual apps.
Method signatures and docstrings:
- def __init__(self, stderr: bool=True, stdout: bool=False) -> None: Initialize a Textual logging handler. Args: stderr: Log to stderr when there is no active app. stdo... | Implement the Python class `TextualHandler` described below.
Class description:
A Logging handler for Textual apps.
Method signatures and docstrings:
- def __init__(self, stderr: bool=True, stdout: bool=False) -> None: Initialize a Textual logging handler. Args: stderr: Log to stderr when there is no active app. stdo... | b74ac1e47fdd16133ca567390c99ea19de278c5a | <|skeleton|>
class TextualHandler:
"""A Logging handler for Textual apps."""
def __init__(self, stderr: bool=True, stdout: bool=False) -> None:
"""Initialize a Textual logging handler. Args: stderr: Log to stderr when there is no active app. stdout: Log to stdout when there is not active app."""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TextualHandler:
"""A Logging handler for Textual apps."""
def __init__(self, stderr: bool=True, stdout: bool=False) -> None:
"""Initialize a Textual logging handler. Args: stderr: Log to stderr when there is no active app. stdout: Log to stdout when there is not active app."""
super().__i... | the_stack_v2_python_sparse | src/textual/logging.py | Textualize/textual | train | 14,818 |
04eda83ed513435b93dd238a9a6bccae1736f72b | [
"super().__init__('/proc/sys/fs/inode-nr')\nself.allocated_inodes = 0\nself.free_inodes = 0\nself.read()",
"tokens = self.content.split()\nif tokens[0]:\n self.allocated_inodes = int(tokens[0])\ntry:\n if tokens[1]:\n self.free_inodes = int(tokens[1])\nexcept:\n pass",
"super().dump()\nprint('Al... | <|body_start_0|>
super().__init__('/proc/sys/fs/inode-nr')
self.allocated_inodes = 0
self.free_inodes = 0
self.read()
<|end_body_0|>
<|body_start_1|>
tokens = self.content.split()
if tokens[0]:
self.allocated_inodes = int(tokens[0])
try:
i... | Object represents the /proc/sys/fs/inode-nr file. | ProcInodeNR | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProcInodeNR:
"""Object represents the /proc/sys/fs/inode-nr file."""
def __init__(self):
"""Read file by calling base class constructor then parse the contents."""
<|body_0|>
def read(self):
"""Parses contents of /proc/sys/fs/inode-nr"""
<|body_1|>
d... | stack_v2_sparse_classes_36k_train_010543 | 947 | permissive | [
{
"docstring": "Read file by calling base class constructor then parse the contents.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Parses contents of /proc/sys/fs/inode-nr",
"name": "read",
"signature": "def read(self)"
},
{
"docstring": "Print inform... | 3 | stack_v2_sparse_classes_30k_train_011916 | Implement the Python class `ProcInodeNR` described below.
Class description:
Object represents the /proc/sys/fs/inode-nr file.
Method signatures and docstrings:
- def __init__(self): Read file by calling base class constructor then parse the contents.
- def read(self): Parses contents of /proc/sys/fs/inode-nr
- def d... | Implement the Python class `ProcInodeNR` described below.
Class description:
Object represents the /proc/sys/fs/inode-nr file.
Method signatures and docstrings:
- def __init__(self): Read file by calling base class constructor then parse the contents.
- def read(self): Parses contents of /proc/sys/fs/inode-nr
- def d... | 5fc781852dcdf55c3a807e97692224a28c0913f6 | <|skeleton|>
class ProcInodeNR:
"""Object represents the /proc/sys/fs/inode-nr file."""
def __init__(self):
"""Read file by calling base class constructor then parse the contents."""
<|body_0|>
def read(self):
"""Parses contents of /proc/sys/fs/inode-nr"""
<|body_1|>
d... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ProcInodeNR:
"""Object represents the /proc/sys/fs/inode-nr file."""
def __init__(self):
"""Read file by calling base class constructor then parse the contents."""
super().__init__('/proc/sys/fs/inode-nr')
self.allocated_inodes = 0
self.free_inodes = 0
self.read()
... | the_stack_v2_python_sparse | proc_scraper/proc_inodenr.py | EwanC/pyProc | train | 0 |
d0420057a3ba4d6101ba95cfe36cd86f27440ef1 | [
"if len(args) == 2:\n self.type = 'closed'\n self.nodes = args[0]\n self.wts = args[1]\n self.l = self.nodes[0]\n self.u = self.nodes[-1]\nelif len(args) == 4:\n self.l = args[0]\n self.u = args[1]\n self.nodes = args[2]\n self.wts = args[3]\n if self.l == self.nodes[0] and self.u == s... | <|body_start_0|>
if len(args) == 2:
self.type = 'closed'
self.nodes = args[0]
self.wts = args[1]
self.l = self.nodes[0]
self.u = self.nodes[-1]
elif len(args) == 4:
self.l = args[0]
self.u = args[1]
self.node... | A simple quadrature rule | Quad | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Quad:
"""A simple quadrature rule"""
def __init__(self, *args):
"""Define a quadrature rule from its nodes and weights. For closed rules (where the nodes include the boundaries), the signature may be: QuadRule(nodes, wts) where `nodes` and `wts` are arrays containing the (ordered) no... | stack_v2_sparse_classes_36k_train_010544 | 17,785 | permissive | [
{
"docstring": "Define a quadrature rule from its nodes and weights. For closed rules (where the nodes include the boundaries), the signature may be: QuadRule(nodes, wts) where `nodes` and `wts` are arrays containing the (ordered) nodes and weights for the rule. For open rules (and optionally for closed rules),... | 2 | stack_v2_sparse_classes_30k_train_007011 | Implement the Python class `Quad` described below.
Class description:
A simple quadrature rule
Method signatures and docstrings:
- def __init__(self, *args): Define a quadrature rule from its nodes and weights. For closed rules (where the nodes include the boundaries), the signature may be: QuadRule(nodes, wts) where... | Implement the Python class `Quad` described below.
Class description:
A simple quadrature rule
Method signatures and docstrings:
- def __init__(self, *args): Define a quadrature rule from its nodes and weights. For closed rules (where the nodes include the boundaries), the signature may be: QuadRule(nodes, wts) where... | c039a8e5394da4764881cdee1e17c6b1c0ecc088 | <|skeleton|>
class Quad:
"""A simple quadrature rule"""
def __init__(self, *args):
"""Define a quadrature rule from its nodes and weights. For closed rules (where the nodes include the boundaries), the signature may be: QuadRule(nodes, wts) where `nodes` and `wts` are arrays containing the (ordered) no... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Quad:
"""A simple quadrature rule"""
def __init__(self, *args):
"""Define a quadrature rule from its nodes and weights. For closed rules (where the nodes include the boundaries), the signature may be: QuadRule(nodes, wts) where `nodes` and `wts` are arrays containing the (ordered) nodes and weigh... | the_stack_v2_python_sparse | batse5bp/quad.py | tloredo/batse5bp | train | 1 |
2d06ce1adacc8916efcb3081f462477a628f4e06 | [
"super().__init__(api=api, url=url, request_data=request_data, errors_mapping=errors_mapping, required_sid=required_sid, return_constructor=return_constructor)\nself._paginated_field = paginated_field\nself._rows_in_page = DEFAULT_ROWS_IN_PAGINATION_PAGE",
"rows_in_page = int(rows_in_page)\nif rows_in_page > 5000... | <|body_start_0|>
super().__init__(api=api, url=url, request_data=request_data, errors_mapping=errors_mapping, required_sid=required_sid, return_constructor=return_constructor)
self._paginated_field = paginated_field
self._rows_in_page = DEFAULT_ROWS_IN_PAGINATION_PAGE
<|end_body_0|>
<|body_star... | Base query with pagination. | BaseQueryP | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BaseQueryP:
"""Base query with pagination."""
def __init__(self, api, url: str, request_data: Dict[str, Any], errors_mapping: ERROR_MAPPING, paginated_field: str, required_sid: bool=False, return_constructor: Callable[..., JSON_RETURN_TYPE]=Box):
"""Query initialization. :param api: ... | stack_v2_sparse_classes_36k_train_010545 | 3,627 | permissive | [
{
"docstring": "Query initialization. :param api: Api instance :param url: query url :param request_data: data for request :param errors_mapping: map of error name and exception :param required_sid: is sid requred for this query :param paginated_field: field for pagination :param return_constructor: constructor... | 2 | stack_v2_sparse_classes_30k_train_014566 | Implement the Python class `BaseQueryP` described below.
Class description:
Base query with pagination.
Method signatures and docstrings:
- def __init__(self, api, url: str, request_data: Dict[str, Any], errors_mapping: ERROR_MAPPING, paginated_field: str, required_sid: bool=False, return_constructor: Callable[..., J... | Implement the Python class `BaseQueryP` described below.
Class description:
Base query with pagination.
Method signatures and docstrings:
- def __init__(self, api, url: str, request_data: Dict[str, Any], errors_mapping: ERROR_MAPPING, paginated_field: str, required_sid: bool=False, return_constructor: Callable[..., J... | 2618e682d38339439340d86080e8bc6ee6cf21b5 | <|skeleton|>
class BaseQueryP:
"""Base query with pagination."""
def __init__(self, api, url: str, request_data: Dict[str, Any], errors_mapping: ERROR_MAPPING, paginated_field: str, required_sid: bool=False, return_constructor: Callable[..., JSON_RETURN_TYPE]=Box):
"""Query initialization. :param api: ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BaseQueryP:
"""Base query with pagination."""
def __init__(self, api, url: str, request_data: Dict[str, Any], errors_mapping: ERROR_MAPPING, paginated_field: str, required_sid: bool=False, return_constructor: Callable[..., JSON_RETURN_TYPE]=Box):
"""Query initialization. :param api: Api instance ... | the_stack_v2_python_sparse | ambra_sdk/service/query/base_query.py | dicomgrid/sdk-python | train | 11 |
caa1a732ffd449f5d248732e2735d78b5537b34f | [
"if root:\n s = str(root.val) + ' ' + self.serialize(root.left) + ' ' + self.serialize(root.right)\nelse:\n s = '#'\nreturn s",
"lst = s.split()\nif lst[0] == '#':\n return None\nroot = TreeNode(lst[0])\nprev = root\nnextRight = [root]\ngoRight = False\nfor index in range(1, len(lst)):\n if lst[index]... | <|body_start_0|>
if root:
s = str(root.val) + ' ' + self.serialize(root.left) + ' ' + self.serialize(root.right)
else:
s = '#'
return s
<|end_body_0|>
<|body_start_1|>
lst = s.split()
if lst[0] == '#':
return None
root = TreeNode(lst[0... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def serialize(self, root):
""":type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, s):
""":type s: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if root:
s = str(root.val) + ' ' + self.ser... | stack_v2_sparse_classes_36k_train_010546 | 1,997 | no_license | [
{
"docstring": ":type root: TreeNode :rtype: str",
"name": "serialize",
"signature": "def serialize(self, root)"
},
{
"docstring": ":type s: str :rtype: TreeNode",
"name": "deserialize",
"signature": "def deserialize(self, s)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def serialize(self, root): :type root: TreeNode :rtype: str
- def deserialize(self, s): :type s: str :rtype: TreeNode | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def serialize(self, root): :type root: TreeNode :rtype: str
- def deserialize(self, s): :type s: str :rtype: TreeNode
<|skeleton|>
class Solution:
def serialize(self, root)... | fa624b702129fa3efd6997791e4cd37c420e114e | <|skeleton|>
class Solution:
def serialize(self, root):
""":type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, s):
""":type s: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def serialize(self, root):
""":type root: TreeNode :rtype: str"""
if root:
s = str(root.val) + ' ' + self.serialize(root.left) + ' ' + self.serialize(root.right)
else:
s = '#'
return s
def deserialize(self, s):
""":type s: str :rty... | the_stack_v2_python_sparse | p65/p65.py | zois-tasoulas/DailyInterviewPro | train | 0 | |
6d5ed1d2eb359dbfbee3cac333e9e97acd6e0ad6 | [
"if 'colored' in kwargs:\n self.colored = kwargs['colored']\n del kwargs['colored']\nelse:\n self.colored = False\nkwargs['availheight'] = self.LABELHEIGHT - self.BLOCKHEIGHT\nBaseLTOLabel.__init__(self, *args, **kwargs)",
"BaseLTOLabel.drawOn(self, canvas, x, y)\ncanvas.saveState()\ncanvas.setLineWidth(... | <|body_start_0|>
if 'colored' in kwargs:
self.colored = kwargs['colored']
del kwargs['colored']
else:
self.colored = False
kwargs['availheight'] = self.LABELHEIGHT - self.BLOCKHEIGHT
BaseLTOLabel.__init__(self, *args, **kwargs)
<|end_body_0|>
<|body_s... | A class for LTO labels with rectangular blocks around the tape identifier. | VerticalLTOLabel | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VerticalLTOLabel:
"""A class for LTO labels with rectangular blocks around the tape identifier."""
def __init__(self, *args, **kwargs):
"""Initializes the label. colored : boolean to determine if blocks have to be colorized."""
<|body_0|>
def drawOn(self, canvas, x, y):
... | stack_v2_sparse_classes_36k_train_010547 | 7,377 | permissive | [
{
"docstring": "Initializes the label. colored : boolean to determine if blocks have to be colorized.",
"name": "__init__",
"signature": "def __init__(self, *args, **kwargs)"
},
{
"docstring": "Draws some blocks around the identifier's characters.",
"name": "drawOn",
"signature": "def dr... | 2 | stack_v2_sparse_classes_30k_train_004182 | Implement the Python class `VerticalLTOLabel` described below.
Class description:
A class for LTO labels with rectangular blocks around the tape identifier.
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): Initializes the label. colored : boolean to determine if blocks have to be colorized.
- ... | Implement the Python class `VerticalLTOLabel` described below.
Class description:
A class for LTO labels with rectangular blocks around the tape identifier.
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): Initializes the label. colored : boolean to determine if blocks have to be colorized.
- ... | c28aa50e2d6d3451b47e114094a86c03c87d4c50 | <|skeleton|>
class VerticalLTOLabel:
"""A class for LTO labels with rectangular blocks around the tape identifier."""
def __init__(self, *args, **kwargs):
"""Initializes the label. colored : boolean to determine if blocks have to be colorized."""
<|body_0|>
def drawOn(self, canvas, x, y):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class VerticalLTOLabel:
"""A class for LTO labels with rectangular blocks around the tape identifier."""
def __init__(self, *args, **kwargs):
"""Initializes the label. colored : boolean to determine if blocks have to be colorized."""
if 'colored' in kwargs:
self.colored = kwargs['co... | the_stack_v2_python_sparse | src/reportlab/graphics/barcode/lto.py | MrBitBucket/reportlab-mirror | train | 64 |
471cbf7f1618d2a7e2f826c9a04ade084700425c | [
"chararray = []\nq = deque([])\nif root:\n q.append(root)\nelse:\n chararray.append('#')\n return ''.join(chararray)\nwhile len(q) > 0:\n node = q.popleft()\n if node:\n chararray.append(str(node.val))\n chararray.append(',')\n q.append(node.left)\n q.append(node.right)\n ... | <|body_start_0|>
chararray = []
q = deque([])
if root:
q.append(root)
else:
chararray.append('#')
return ''.join(chararray)
while len(q) > 0:
node = q.popleft()
if node:
chararray.append(str(node.val))
... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|>
<|body_... | stack_v2_sparse_classes_36k_train_010548 | 2,449 | no_license | [
{
"docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str",
"name": "serialize",
"signature": "def serialize(self, root)"
},
{
"docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode",
"name": "deserialize",
"signature": "def deserializ... | 2 | stack_v2_sparse_classes_30k_train_020187 | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:... | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:... | 8e116c21f91c87a9dc8526d8be93c443e79469bf | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
chararray = []
q = deque([])
if root:
q.append(root)
else:
chararray.append('#')
return ''.join(chararray)
while len(q... | the_stack_v2_python_sparse | Hard/297_Hard_SerializeDeserializeBinaryTree.py | sarahgonsalves223/DSA_Python | train | 2 | |
d49cab0ad1cf33bf40b9e6933322ef1296923d04 | [
"self.poll_object = models.PollQuestion.objects.create(question=self.question)\nfor i in range(3):\n models.PollAnswer.objects.create(answer='%s %i' % (self.answer, i), poll=self.poll_object)",
"poll_object = models.PollQuestion.objects.get(question=self.question)\nself.assertEqual(poll_object.question, self.q... | <|body_start_0|>
self.poll_object = models.PollQuestion.objects.create(question=self.question)
for i in range(3):
models.PollAnswer.objects.create(answer='%s %i' % (self.answer, i), poll=self.poll_object)
<|end_body_0|>
<|body_start_1|>
poll_object = models.PollQuestion.objects.get(... | Set up the poll model test cases. | PollModelTestCase | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PollModelTestCase:
"""Set up the poll model test cases."""
def setUp(self):
"""Create a Poll Model and 3 Answers."""
<|body_0|>
def test_poll_model(self):
"""Test that the Poll Model was created with the right question, state and has at least 3 Answers"""
... | stack_v2_sparse_classes_36k_train_010549 | 1,610 | no_license | [
{
"docstring": "Create a Poll Model and 3 Answers.",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "Test that the Poll Model was created with the right question, state and has at least 3 Answers",
"name": "test_poll_model",
"signature": "def test_poll_model(self)"
}... | 3 | null | Implement the Python class `PollModelTestCase` described below.
Class description:
Set up the poll model test cases.
Method signatures and docstrings:
- def setUp(self): Create a Poll Model and 3 Answers.
- def test_poll_model(self): Test that the Poll Model was created with the right question, state and has at least... | Implement the Python class `PollModelTestCase` described below.
Class description:
Set up the poll model test cases.
Method signatures and docstrings:
- def setUp(self): Create a Poll Model and 3 Answers.
- def test_poll_model(self): Test that the Poll Model was created with the right question, state and has at least... | 9219e6c5a49eecd1c66dd1b518640c5d678acab6 | <|skeleton|>
class PollModelTestCase:
"""Set up the poll model test cases."""
def setUp(self):
"""Create a Poll Model and 3 Answers."""
<|body_0|>
def test_poll_model(self):
"""Test that the Poll Model was created with the right question, state and has at least 3 Answers"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PollModelTestCase:
"""Set up the poll model test cases."""
def setUp(self):
"""Create a Poll Model and 3 Answers."""
self.poll_object = models.PollQuestion.objects.create(question=self.question)
for i in range(3):
models.PollAnswer.objects.create(answer='%s %i' % (self... | the_stack_v2_python_sparse | tunobase/poll/tests.py | unomena/tunobase | train | 0 |
90fd34ebfe894eeea4cc242176999a0416d41da3 | [
"if hasattr(self, 'set_model_params'):\n set_model_param_method = getattr(self, 'set_model_params')\n args, varargs, kw, default = getargspec_no_self(set_model_param_method)\n if varargs is not None:\n raise RuntimeError(\"Models should always specify their parameters in the signature of their set_m... | <|body_start_0|>
if hasattr(self, 'set_model_params'):
set_model_param_method = getattr(self, 'set_model_params')
args, varargs, kw, default = getargspec_no_self(set_model_param_method)
if varargs is not None:
raise RuntimeError("Models should always specify t... | Base class for Chainsaws models This class is inspired by sklearn's BaseEstimator class. However, we define parameter names not by the current class' __init__ but have to announce them. This allows us to also remember the parameters of model superclasses. This class can be mixed with Chainsaw and sklearn Estimators. | Model | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Model:
"""Base class for Chainsaws models This class is inspired by sklearn's BaseEstimator class. However, we define parameter names not by the current class' __init__ but have to announce them. This allows us to also remember the parameters of model superclasses. This class can be mixed with Ch... | stack_v2_sparse_classes_36k_train_010550 | 4,319 | no_license | [
{
"docstring": "Get parameter names for the model",
"name": "_get_model_param_names",
"signature": "def _get_model_param_names(self)"
},
{
"docstring": "Update given model parameter if they are set to specific values",
"name": "update_model_params",
"signature": "def update_model_params(... | 3 | stack_v2_sparse_classes_30k_test_000276 | Implement the Python class `Model` described below.
Class description:
Base class for Chainsaws models This class is inspired by sklearn's BaseEstimator class. However, we define parameter names not by the current class' __init__ but have to announce them. This allows us to also remember the parameters of model superc... | Implement the Python class `Model` described below.
Class description:
Base class for Chainsaws models This class is inspired by sklearn's BaseEstimator class. However, we define parameter names not by the current class' __init__ but have to announce them. This allows us to also remember the parameters of model superc... | 3c67aeb9a4ea26b8304585a70761a2983db19332 | <|skeleton|>
class Model:
"""Base class for Chainsaws models This class is inspired by sklearn's BaseEstimator class. However, we define parameter names not by the current class' __init__ but have to announce them. This allows us to also remember the parameters of model superclasses. This class can be mixed with Ch... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Model:
"""Base class for Chainsaws models This class is inspired by sklearn's BaseEstimator class. However, we define parameter names not by the current class' __init__ but have to announce them. This allows us to also remember the parameters of model superclasses. This class can be mixed with Chainsaw and sk... | the_stack_v2_python_sparse | chainsaw/base/model.py | markovmodel/coordinates | train | 0 |
66e21280e0c4f380b487859aa5fd35a5b0b31e63 | [
"super(FileIndexParser, self).__init__(*args, **kwargs)\nself.parsed = list()\nself.reset()",
"if tag == 'a':\n for attr in attrs:\n if attr[0] == 'href':\n self.parsed.append(attr[1])"
] | <|body_start_0|>
super(FileIndexParser, self).__init__(*args, **kwargs)
self.parsed = list()
self.reset()
<|end_body_0|>
<|body_start_1|>
if tag == 'a':
for attr in attrs:
if attr[0] == 'href':
self.parsed.append(attr[1])
<|end_body_1|>
| Subclass of HTMLParser, for finding tags with an href and adding them to an internal 'parsed' list attribute. | FileIndexParser | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FileIndexParser:
"""Subclass of HTMLParser, for finding tags with an href and adding them to an internal 'parsed' list attribute."""
def __init__(self, *args, **kwargs):
"""Initialize and reset this instance."""
<|body_0|>
def handle_starttag(self, tag, attrs):
"... | stack_v2_sparse_classes_36k_train_010551 | 26,107 | permissive | [
{
"docstring": "Initialize and reset this instance.",
"name": "__init__",
"signature": "def __init__(self, *args, **kwargs)"
},
{
"docstring": "Process a starttag and look for 'a' tags",
"name": "handle_starttag",
"signature": "def handle_starttag(self, tag, attrs)"
}
] | 2 | stack_v2_sparse_classes_30k_train_013285 | Implement the Python class `FileIndexParser` described below.
Class description:
Subclass of HTMLParser, for finding tags with an href and adding them to an internal 'parsed' list attribute.
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): Initialize and reset this instance.
- def handle_start... | Implement the Python class `FileIndexParser` described below.
Class description:
Subclass of HTMLParser, for finding tags with an href and adding them to an internal 'parsed' list attribute.
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): Initialize and reset this instance.
- def handle_start... | e436eba86683eb5d3b995a93733e0d680612bbc5 | <|skeleton|>
class FileIndexParser:
"""Subclass of HTMLParser, for finding tags with an href and adding them to an internal 'parsed' list attribute."""
def __init__(self, *args, **kwargs):
"""Initialize and reset this instance."""
<|body_0|>
def handle_starttag(self, tag, attrs):
"... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FileIndexParser:
"""Subclass of HTMLParser, for finding tags with an href and adding them to an internal 'parsed' list attribute."""
def __init__(self, *args, **kwargs):
"""Initialize and reset this instance."""
super(FileIndexParser, self).__init__(*args, **kwargs)
self.parsed = ... | the_stack_v2_python_sparse | installer.py | evernym/devlab | train | 2 |
8b0074549b34fe7b32e3a21e158ee12884e28f66 | [
"m, n = (len(value), target)\ndp = [[0] * (n + 1) for _ in range(m + 1)]\nfor i in range(1, m + 1):\n for j in range(1, target + 1):\n dp[i][j] = dp[i - 1][j]\n if j >= weight[i - 1]:\n dp[i][j] = max(dp[i][j], dp[i - 1][j - weight[i - 1]] + value[i - 1])\nreturn dp[-1][-1]",
"m, n = (... | <|body_start_0|>
m, n = (len(value), target)
dp = [[0] * (n + 1) for _ in range(m + 1)]
for i in range(1, m + 1):
for j in range(1, target + 1):
dp[i][j] = dp[i - 1][j]
if j >= weight[i - 1]:
dp[i][j] = max(dp[i][j], dp[i - 1][j - w... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def knapsack1(self, value, weight, target):
"""1. 每个物品可以选择放或不放 2. dp[i][j]:装入第i个物品,背包容量为j时,获得的最大价值 不放:dp[i][j]=dp[i-1][j] 放:dp[i][j] = max(dp[i][j], dp[i - 1][j - weight[i - 1]] + value[i - 1])"""
<|body_0|>
def knapsack2(self, value, weight, target):
"""状态... | stack_v2_sparse_classes_36k_train_010552 | 1,814 | no_license | [
{
"docstring": "1. 每个物品可以选择放或不放 2. dp[i][j]:装入第i个物品,背包容量为j时,获得的最大价值 不放:dp[i][j]=dp[i-1][j] 放:dp[i][j] = max(dp[i][j], dp[i - 1][j - weight[i - 1]] + value[i - 1])",
"name": "knapsack1",
"signature": "def knapsack1(self, value, weight, target)"
},
{
"docstring": "状态压缩:一维dp 1. 由于dp[i-1][j]用的是上一层的数... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def knapsack1(self, value, weight, target): 1. 每个物品可以选择放或不放 2. dp[i][j]:装入第i个物品,背包容量为j时,获得的最大价值 不放:dp[i][j]=dp[i-1][j] 放:dp[i][j] = max(dp[i][j], dp[i - 1][j - weight[i - 1]] + v... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def knapsack1(self, value, weight, target): 1. 每个物品可以选择放或不放 2. dp[i][j]:装入第i个物品,背包容量为j时,获得的最大价值 不放:dp[i][j]=dp[i-1][j] 放:dp[i][j] = max(dp[i][j], dp[i - 1][j - weight[i - 1]] + v... | e43ee86c5a8cdb808da09b4b6138e10275abadb5 | <|skeleton|>
class Solution:
def knapsack1(self, value, weight, target):
"""1. 每个物品可以选择放或不放 2. dp[i][j]:装入第i个物品,背包容量为j时,获得的最大价值 不放:dp[i][j]=dp[i-1][j] 放:dp[i][j] = max(dp[i][j], dp[i - 1][j - weight[i - 1]] + value[i - 1])"""
<|body_0|>
def knapsack2(self, value, weight, target):
"""状态... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def knapsack1(self, value, weight, target):
"""1. 每个物品可以选择放或不放 2. dp[i][j]:装入第i个物品,背包容量为j时,获得的最大价值 不放:dp[i][j]=dp[i-1][j] 放:dp[i][j] = max(dp[i][j], dp[i - 1][j - weight[i - 1]] + value[i - 1])"""
m, n = (len(value), target)
dp = [[0] * (n + 1) for _ in range(m + 1)]
... | the_stack_v2_python_sparse | LeetCode/动态规划法(dp)/背包问题/01背包问题.py | yiming1012/MyLeetCode | train | 2 | |
ec00fcb23fb5256e3e6515256887cb5e3be9d869 | [
"self.device_id = device_id\nself.ipp = IPP(host=host, port=port, base_path=base_path, tls=tls, verify_ssl=verify_ssl, session=async_get_clientsession(hass, verify_ssl))\nsuper().__init__(hass, _LOGGER, name=DOMAIN, update_interval=SCAN_INTERVAL)",
"try:\n return await self.ipp.printer()\nexcept IPPError as er... | <|body_start_0|>
self.device_id = device_id
self.ipp = IPP(host=host, port=port, base_path=base_path, tls=tls, verify_ssl=verify_ssl, session=async_get_clientsession(hass, verify_ssl))
super().__init__(hass, _LOGGER, name=DOMAIN, update_interval=SCAN_INTERVAL)
<|end_body_0|>
<|body_start_1|>
... | Class to manage fetching IPP data from single endpoint. | IPPDataUpdateCoordinator | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IPPDataUpdateCoordinator:
"""Class to manage fetching IPP data from single endpoint."""
def __init__(self, hass: HomeAssistant, *, host: str, port: int, base_path: str, tls: bool, verify_ssl: bool, device_id: str) -> None:
"""Initialize global IPP data updater."""
<|body_0|>
... | stack_v2_sparse_classes_36k_train_010553 | 1,600 | permissive | [
{
"docstring": "Initialize global IPP data updater.",
"name": "__init__",
"signature": "def __init__(self, hass: HomeAssistant, *, host: str, port: int, base_path: str, tls: bool, verify_ssl: bool, device_id: str) -> None"
},
{
"docstring": "Fetch data from IPP.",
"name": "_async_update_data... | 2 | stack_v2_sparse_classes_30k_train_008855 | Implement the Python class `IPPDataUpdateCoordinator` described below.
Class description:
Class to manage fetching IPP data from single endpoint.
Method signatures and docstrings:
- def __init__(self, hass: HomeAssistant, *, host: str, port: int, base_path: str, tls: bool, verify_ssl: bool, device_id: str) -> None: I... | Implement the Python class `IPPDataUpdateCoordinator` described below.
Class description:
Class to manage fetching IPP data from single endpoint.
Method signatures and docstrings:
- def __init__(self, hass: HomeAssistant, *, host: str, port: int, base_path: str, tls: bool, verify_ssl: bool, device_id: str) -> None: I... | 80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743 | <|skeleton|>
class IPPDataUpdateCoordinator:
"""Class to manage fetching IPP data from single endpoint."""
def __init__(self, hass: HomeAssistant, *, host: str, port: int, base_path: str, tls: bool, verify_ssl: bool, device_id: str) -> None:
"""Initialize global IPP data updater."""
<|body_0|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class IPPDataUpdateCoordinator:
"""Class to manage fetching IPP data from single endpoint."""
def __init__(self, hass: HomeAssistant, *, host: str, port: int, base_path: str, tls: bool, verify_ssl: bool, device_id: str) -> None:
"""Initialize global IPP data updater."""
self.device_id = device_... | the_stack_v2_python_sparse | homeassistant/components/ipp/coordinator.py | home-assistant/core | train | 35,501 |
9e65f8910f94f4dcb10e2093c2e8540cfe6c7b90 | [
"if not hasattr(aq_base(self), 'creators'):\n if hasattr(aq_base(self), 'creator') and self.creator != 'unknown':\n self.creators = (self.creator,)\n else:\n self.creators = ()\nreturn self.creators",
"tool = getUtility(IDiscussionTool)\ntalkback = tool.getDiscussionFor(self)\nreturn talkback.... | <|body_start_0|>
if not hasattr(aq_base(self), 'creators'):
if hasattr(aq_base(self), 'creator') and self.creator != 'unknown':
self.creators = (self.creator,)
else:
self.creators = ()
return self.creators
<|end_body_0|>
<|body_start_1|>
t... | Class for content which is a response to other content. | DiscussionItem | [
"ZPL-2.1"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DiscussionItem:
"""Class for content which is a response to other content."""
def listCreators(self):
"""List Dublin Core Creator elements - resource authors."""
<|body_0|>
def inReplyTo(self, REQUEST=None):
"""Return the IDiscussable object to which we are a rep... | stack_v2_sparse_classes_36k_train_010554 | 12,355 | permissive | [
{
"docstring": "List Dublin Core Creator elements - resource authors.",
"name": "listCreators",
"signature": "def listCreators(self)"
},
{
"docstring": "Return the IDiscussable object to which we are a reply. Two cases obtain: - We are a \"top-level\" reply to a non-DiscussionItem piece of conte... | 4 | stack_v2_sparse_classes_30k_train_007042 | Implement the Python class `DiscussionItem` described below.
Class description:
Class for content which is a response to other content.
Method signatures and docstrings:
- def listCreators(self): List Dublin Core Creator elements - resource authors.
- def inReplyTo(self, REQUEST=None): Return the IDiscussable object ... | Implement the Python class `DiscussionItem` described below.
Class description:
Class for content which is a response to other content.
Method signatures and docstrings:
- def listCreators(self): List Dublin Core Creator elements - resource authors.
- def inReplyTo(self, REQUEST=None): Return the IDiscussable object ... | eabf7529eefe13a53ed088250d179a92218af1ed | <|skeleton|>
class DiscussionItem:
"""Class for content which is a response to other content."""
def listCreators(self):
"""List Dublin Core Creator elements - resource authors."""
<|body_0|>
def inReplyTo(self, REQUEST=None):
"""Return the IDiscussable object to which we are a rep... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DiscussionItem:
"""Class for content which is a response to other content."""
def listCreators(self):
"""List Dublin Core Creator elements - resource authors."""
if not hasattr(aq_base(self), 'creators'):
if hasattr(aq_base(self), 'creator') and self.creator != 'unknown':
... | the_stack_v2_python_sparse | branches/Products.CMFDefault/Products/CMFDefault/DiscussionItem.py | openlegis-br/sagl | train | 17 |
2800df3d6b982fecf79333bf85c3d479d711e493 | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn Synchronization()",
"from .entity import Entity\nfrom .synchronization_job import SynchronizationJob\nfrom .synchronization_secret_key_string_value_pair import SynchronizationSecretKeyStringValuePair\nfrom .synchronization_template imp... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return Synchronization()
<|end_body_0|>
<|body_start_1|>
from .entity import Entity
from .synchronization_job import SynchronizationJob
from .synchronization_secret_key_string_value_pai... | Synchronization | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Synchronization:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Synchronization:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Ret... | stack_v2_sparse_classes_36k_train_010555 | 3,534 | permissive | [
{
"docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: Synchronization",
"name": "create_from_discriminator_value",
"signature": "def create_from_discriminator_val... | 3 | null | Implement the Python class `Synchronization` described below.
Class description:
Implement the Synchronization class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Synchronization: Creates a new instance of the appropriate class based on discriminator... | Implement the Python class `Synchronization` described below.
Class description:
Implement the Synchronization class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Synchronization: Creates a new instance of the appropriate class based on discriminator... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class Synchronization:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Synchronization:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Ret... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Synchronization:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Synchronization:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: Synchron... | the_stack_v2_python_sparse | msgraph/generated/models/synchronization.py | microsoftgraph/msgraph-sdk-python | train | 135 | |
a6762622db2b160476f1601c208a8db490db4e91 | [
"def verifyPostorderByRange(i, j):\n if i >= j:\n return True\n p = i\n while postorder[p] < postorder[j]:\n p += 1\n m = p\n while postorder[p] > postorder[j]:\n p += 1\n return p == j and verifyPostorderByRange(i, m - 1) and verifyPostorderByRange(m, j - 1)\nreturn verifyPos... | <|body_start_0|>
def verifyPostorderByRange(i, j):
if i >= j:
return True
p = i
while postorder[p] < postorder[j]:
p += 1
m = p
while postorder[p] > postorder[j]:
p += 1
return p == j and veri... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def verifyPostorder(self, postorder: List[int]) -> bool:
"""根据数组判定是否满足某个二叉树的后序遍历 方法一:递归分治 :param postorder: 后序遍历数组 :return: 复杂度分析:时间复杂度O(N2),每次调用 recur(i,j)减去一个根节点,因此递归占用 O(N) ;最差情况下(即当树退化为链表),每轮递归都需遍历树所有节点,占用 O(N)。 空间复杂度O(N);,最差退化为链表"""
<|body_0|>
def verifyPostor... | stack_v2_sparse_classes_36k_train_010556 | 2,965 | no_license | [
{
"docstring": "根据数组判定是否满足某个二叉树的后序遍历 方法一:递归分治 :param postorder: 后序遍历数组 :return: 复杂度分析:时间复杂度O(N2),每次调用 recur(i,j)减去一个根节点,因此递归占用 O(N) ;最差情况下(即当树退化为链表),每轮递归都需遍历树所有节点,占用 O(N)。 空间复杂度O(N);,最差退化为链表",
"name": "verifyPostorder",
"signature": "def verifyPostorder(self, postorder: List[int]) -> bool"
},
{
... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def verifyPostorder(self, postorder: List[int]) -> bool: 根据数组判定是否满足某个二叉树的后序遍历 方法一:递归分治 :param postorder: 后序遍历数组 :return: 复杂度分析:时间复杂度O(N2),每次调用 recur(i,j)减去一个根节点,因此递归占用 O(N) ;最差情况... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def verifyPostorder(self, postorder: List[int]) -> bool: 根据数组判定是否满足某个二叉树的后序遍历 方法一:递归分治 :param postorder: 后序遍历数组 :return: 复杂度分析:时间复杂度O(N2),每次调用 recur(i,j)减去一个根节点,因此递归占用 O(N) ;最差情况... | 32941ee052d0985a9569441d314378700ff4d225 | <|skeleton|>
class Solution:
def verifyPostorder(self, postorder: List[int]) -> bool:
"""根据数组判定是否满足某个二叉树的后序遍历 方法一:递归分治 :param postorder: 后序遍历数组 :return: 复杂度分析:时间复杂度O(N2),每次调用 recur(i,j)减去一个根节点,因此递归占用 O(N) ;最差情况下(即当树退化为链表),每轮递归都需遍历树所有节点,占用 O(N)。 空间复杂度O(N);,最差退化为链表"""
<|body_0|>
def verifyPostor... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def verifyPostorder(self, postorder: List[int]) -> bool:
"""根据数组判定是否满足某个二叉树的后序遍历 方法一:递归分治 :param postorder: 后序遍历数组 :return: 复杂度分析:时间复杂度O(N2),每次调用 recur(i,j)减去一个根节点,因此递归占用 O(N) ;最差情况下(即当树退化为链表),每轮递归都需遍历树所有节点,占用 O(N)。 空间复杂度O(N);,最差退化为链表"""
def verifyPostorderByRange(i, j):
... | the_stack_v2_python_sparse | cecilia-python/剑指offer/chapter-4/VerifyPostorder.py | Cecilia520/algorithmic-learning-leetcode | train | 7 | |
48df80d22e15ffcf2fb30a6ae88ab75842e759fe | [
"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... | Invite API The Invite API is meant to invite users and groups belonging to other sync'n'share systems, so that collaboration of resources can be enabled. The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interprete... | InviteAPIServicer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InviteAPIServicer:
"""Invite API The Invite API is meant to invite users and groups belonging to other sync'n'share systems, so that collaboration of resources can be enabled. The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OP... | stack_v2_sparse_classes_36k_train_010557 | 4,794 | no_license | [
{
"docstring": "Generates a new token for the user with a validity of 24 hours.",
"name": "GenerateInviteToken",
"signature": "def GenerateInviteToken(self, request, context)"
},
{
"docstring": "Forwards a received invite to the sync'n'share system provider.",
"name": "ForwardInvite",
"s... | 3 | stack_v2_sparse_classes_30k_train_009526 | Implement the Python class `InviteAPIServicer` described below.
Class description:
Invite API The Invite API is meant to invite users and groups belonging to other sync'n'share systems, so that collaboration of resources can be enabled. The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHO... | Implement the Python class `InviteAPIServicer` described below.
Class description:
Invite API The Invite API is meant to invite users and groups belonging to other sync'n'share systems, so that collaboration of resources can be enabled. The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHO... | dad1a042b38db5f8bedcac3b6af25066f4d6eef9 | <|skeleton|>
class InviteAPIServicer:
"""Invite API The Invite API is meant to invite users and groups belonging to other sync'n'share systems, so that collaboration of resources can be enabled. The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OP... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class InviteAPIServicer:
"""Invite API The Invite API is meant to invite users and groups belonging to other sync'n'share systems, so that collaboration of resources can be enabled. The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in th... | the_stack_v2_python_sparse | cs3/invite/v1beta1/invite_api_pb2_grpc.py | SamuAlfageme/python-cs3apis | train | 0 |
243f3ea2c07fa52e090941717b5923167bde9de1 | [
"try:\n html2pdf_data = kwargs.get('html2pdf_data')\n html2pdf_data_type = kwargs.get('html2pdf_data_type')\n html2pdf_stylesheet = self.get_select_param(kwargs.get('html2pdf_stylesheet'))\n log = logging.getLogger(__name__)\n log.info('html2pdf_data: %s', html2pdf_data)\n log.info('html2pdf_data_... | <|body_start_0|>
try:
html2pdf_data = kwargs.get('html2pdf_data')
html2pdf_data_type = kwargs.get('html2pdf_data_type')
html2pdf_stylesheet = self.get_select_param(kwargs.get('html2pdf_stylesheet'))
log = logging.getLogger(__name__)
log.info('html2pdf_... | Component that implements Resilient function 'utilities_html2pdf' This function takes html, either complete "<html> ... </html>" or a fragment "<table> ... </table>" and converts it to a pdf image. That image is converted to base64 and returned. | FunctionComponent | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FunctionComponent:
"""Component that implements Resilient function 'utilities_html2pdf' This function takes html, either complete "<html> ... </html>" or a fragment "<table> ... </table>" and converts it to a pdf image. That image is converted to base64 and returned."""
def _fn_html2pdf_func... | stack_v2_sparse_classes_36k_train_010558 | 3,058 | permissive | [
{
"docstring": "Function: function accessible from Resilient to render html to binary pdf format",
"name": "_fn_html2pdf_function",
"signature": "def _fn_html2pdf_function(self, event, *args, **kwargs)"
},
{
"docstring": "convert html data to pdf :param input_data: url to read html or html alrea... | 2 | null | Implement the Python class `FunctionComponent` described below.
Class description:
Component that implements Resilient function 'utilities_html2pdf' This function takes html, either complete "<html> ... </html>" or a fragment "<table> ... </table>" and converts it to a pdf image. That image is converted to base64 and ... | Implement the Python class `FunctionComponent` described below.
Class description:
Component that implements Resilient function 'utilities_html2pdf' This function takes html, either complete "<html> ... </html>" or a fragment "<table> ... </table>" and converts it to a pdf image. That image is converted to base64 and ... | 6878c78b94eeca407998a41ce8db2cc00f2b6758 | <|skeleton|>
class FunctionComponent:
"""Component that implements Resilient function 'utilities_html2pdf' This function takes html, either complete "<html> ... </html>" or a fragment "<table> ... </table>" and converts it to a pdf image. That image is converted to base64 and returned."""
def _fn_html2pdf_func... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FunctionComponent:
"""Component that implements Resilient function 'utilities_html2pdf' This function takes html, either complete "<html> ... </html>" or a fragment "<table> ... </table>" and converts it to a pdf image. That image is converted to base64 and returned."""
def _fn_html2pdf_function(self, ev... | the_stack_v2_python_sparse | fn_html2pdf/fn_html2pdf/components/html2pdf.py | ibmresilient/resilient-community-apps | train | 81 |
b864bdebbd1b5da5684a8cdce57640e5fecbda88 | [
"counter = Counter(deck)\ngcd = None\nfor v in counter.values():\n if gcd is None:\n gcd = v\n gcd = self.gcd(gcd, v)\n if gcd == 1:\n return False\nreturn True",
"while b:\n a, b = (b, a % b)\nreturn a"
] | <|body_start_0|>
counter = Counter(deck)
gcd = None
for v in counter.values():
if gcd is None:
gcd = v
gcd = self.gcd(gcd, v)
if gcd == 1:
return False
return True
<|end_body_0|>
<|body_start_1|>
while b:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def hasGroupsSizeX(self, deck: List[int]) -> bool:
"""gcd of all > 2"""
<|body_0|>
def gcd(self, a, b):
"""a = k * b + r gcd(a, b) = gcd(b, r)"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
counter = Counter(deck)
gcd = None
... | stack_v2_sparse_classes_36k_train_010559 | 1,394 | no_license | [
{
"docstring": "gcd of all > 2",
"name": "hasGroupsSizeX",
"signature": "def hasGroupsSizeX(self, deck: List[int]) -> bool"
},
{
"docstring": "a = k * b + r gcd(a, b) = gcd(b, r)",
"name": "gcd",
"signature": "def gcd(self, a, b)"
}
] | 2 | stack_v2_sparse_classes_30k_train_019506 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def hasGroupsSizeX(self, deck: List[int]) -> bool: gcd of all > 2
- def gcd(self, a, b): a = k * b + r gcd(a, b) = gcd(b, r) | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def hasGroupsSizeX(self, deck: List[int]) -> bool: gcd of all > 2
- def gcd(self, a, b): a = k * b + r gcd(a, b) = gcd(b, r)
<|skeleton|>
class Solution:
def hasGroupsSizeX... | 929dde1723fb2f54870c8a9badc80fc23e8400d3 | <|skeleton|>
class Solution:
def hasGroupsSizeX(self, deck: List[int]) -> bool:
"""gcd of all > 2"""
<|body_0|>
def gcd(self, a, b):
"""a = k * b + r gcd(a, b) = gcd(b, r)"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def hasGroupsSizeX(self, deck: List[int]) -> bool:
"""gcd of all > 2"""
counter = Counter(deck)
gcd = None
for v in counter.values():
if gcd is None:
gcd = v
gcd = self.gcd(gcd, v)
if gcd == 1:
return... | the_stack_v2_python_sparse | _algorithms_challenges/leetcode/LeetCode/914 X of a Kind in a Deck of Cards.py | syurskyi/Algorithms_and_Data_Structure | train | 4 | |
ec67b2d467221d14944dfcf25831faf75adae755 | [
"payload = {'layers': 'heat_tot_curr_density_ha', 'year': '2012', 'areas': [{'points': [{'lat': 48.25759852914997, 'lng': 16.351432800292972}, {'lat': 48.267426453675895, 'lng': 16.351432800292972}, {'lat': 48.267426453675895, 'lng': 16.369628906250004}, {'lat': 48.25759852914997, 'lng': 16.369628906250004}]}]}\nex... | <|body_start_0|>
payload = {'layers': 'heat_tot_curr_density_ha', 'year': '2012', 'areas': [{'points': [{'lat': 48.25759852914997, 'lng': 16.351432800292972}, {'lat': 48.267426453675895, 'lng': 16.351432800292972}, {'lat': 48.267426453675895, 'lng': 16.369628906250004}, {'lat': 48.25759852914997, 'lng': 16.3696... | TestExportRasterHectare | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestExportRasterHectare:
def test_post(self):
"""this test will pass the upload/export/raster/hectare method"""
<|body_0|>
def test_port_wrong_parameters(self):
"""this test will fail because the wrong parameters are given"""
<|body_1|>
def test_post_wro... | stack_v2_sparse_classes_36k_train_010560 | 2,494 | permissive | [
{
"docstring": "this test will pass the upload/export/raster/hectare method",
"name": "test_post",
"signature": "def test_post(self)"
},
{
"docstring": "this test will fail because the wrong parameters are given",
"name": "test_port_wrong_parameters",
"signature": "def test_port_wrong_pa... | 3 | stack_v2_sparse_classes_30k_train_001809 | Implement the Python class `TestExportRasterHectare` described below.
Class description:
Implement the TestExportRasterHectare class.
Method signatures and docstrings:
- def test_post(self): this test will pass the upload/export/raster/hectare method
- def test_port_wrong_parameters(self): this test will fail because... | Implement the Python class `TestExportRasterHectare` described below.
Class description:
Implement the TestExportRasterHectare class.
Method signatures and docstrings:
- def test_post(self): this test will pass the upload/export/raster/hectare method
- def test_port_wrong_parameters(self): this test will fail because... | ba1e287dbc63e34bf9feb80b65b02c1db93ce91c | <|skeleton|>
class TestExportRasterHectare:
def test_post(self):
"""this test will pass the upload/export/raster/hectare method"""
<|body_0|>
def test_port_wrong_parameters(self):
"""this test will fail because the wrong parameters are given"""
<|body_1|>
def test_post_wro... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestExportRasterHectare:
def test_post(self):
"""this test will pass the upload/export/raster/hectare method"""
payload = {'layers': 'heat_tot_curr_density_ha', 'year': '2012', 'areas': [{'points': [{'lat': 48.25759852914997, 'lng': 16.351432800292972}, {'lat': 48.267426453675895, 'lng': 16.35... | the_stack_v2_python_sparse | pytest_suit/routes/uploads/test_exportRasterHectare.py | HotMaps/Hotmaps-toolbox-service | train | 4 | |
6e01af137eb0f7bc8a1434ede6bdcea3e4524331 | [
"self.content_type = CONTENT_TYPE\nself.root = partition_type\nself.headers_obj = HmcHeaders.HmcHeaders('web')\ndirectory_path = os.path.dirname(__file__)\nself.input = open(directory_path + '\\\\data\\\\poweroff_lpar.xml', 'r').read()\nself.input = self.input.format(partition_type)",
"super().__init__(ip, self.r... | <|body_start_0|>
self.content_type = CONTENT_TYPE
self.root = partition_type
self.headers_obj = HmcHeaders.HmcHeaders('web')
directory_path = os.path.dirname(__file__)
self.input = open(directory_path + '\\data\\poweroff_lpar.xml', 'r').read()
self.input = self.input.form... | PowerOffPartition | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PowerOffPartition:
def __init__(self, partition_type):
"""initializes root and content_type Args: partition_type : type of object Logical Partition or VirtualIOServer"""
<|body_0|>
def poweroff_Partition(self, ip, logicalpartition_object, session_id):
"""performs the... | stack_v2_sparse_classes_36k_train_010561 | 2,534 | permissive | [
{
"docstring": "initializes root and content_type Args: partition_type : type of object Logical Partition or VirtualIOServer",
"name": "__init__",
"signature": "def __init__(self, partition_type)"
},
{
"docstring": "performs the poweroff operation for the provided LogicalPartition object Args: i... | 2 | stack_v2_sparse_classes_30k_train_009420 | Implement the Python class `PowerOffPartition` described below.
Class description:
Implement the PowerOffPartition class.
Method signatures and docstrings:
- def __init__(self, partition_type): initializes root and content_type Args: partition_type : type of object Logical Partition or VirtualIOServer
- def poweroff_... | Implement the Python class `PowerOffPartition` described below.
Class description:
Implement the PowerOffPartition class.
Method signatures and docstrings:
- def __init__(self, partition_type): initializes root and content_type Args: partition_type : type of object Logical Partition or VirtualIOServer
- def poweroff_... | 8e46a5a25a57d07f0612404f4b978234d6d2cd4b | <|skeleton|>
class PowerOffPartition:
def __init__(self, partition_type):
"""initializes root and content_type Args: partition_type : type of object Logical Partition or VirtualIOServer"""
<|body_0|>
def poweroff_Partition(self, ip, logicalpartition_object, session_id):
"""performs the... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PowerOffPartition:
def __init__(self, partition_type):
"""initializes root and content_type Args: partition_type : type of object Logical Partition or VirtualIOServer"""
self.content_type = CONTENT_TYPE
self.root = partition_type
self.headers_obj = HmcHeaders.HmcHeaders('web')
... | the_stack_v2_python_sparse | src/partition_operation_util/PowerOffPartition.py | Python3pkg/HmcRestClient | train | 0 | |
20166f62bae4e167f07b62580060bd4c0c425bfc | [
"try:\n return self.BookSource()\nexcept AttributeError:\n url = self.getPublication_url()\n source = 'Webpublished'\n if url:\n source += ', %s' % url\n if source and source[-1] not in '.!?':\n source += '.'\n return source",
"coinsData = BaseEntry.getCoinsDict(self)\ncoinsData['r... | <|body_start_0|>
try:
return self.BookSource()
except AttributeError:
url = self.getPublication_url()
source = 'Webpublished'
if url:
source += ', %s' % url
if source and source[-1] not in '.!?':
source += '.'
... | Content type to make reference to a webpublished (only) document. | WebpublishedReference | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WebpublishedReference:
"""Content type to make reference to a webpublished (only) document."""
def Source(self):
"""the default webpublished source format"""
<|body_0|>
def getCoinsDict(self):
"""Select which values to display in the COinS tag for this item"""
... | stack_v2_sparse_classes_36k_train_010562 | 2,612 | no_license | [
{
"docstring": "the default webpublished source format",
"name": "Source",
"signature": "def Source(self)"
},
{
"docstring": "Select which values to display in the COinS tag for this item",
"name": "getCoinsDict",
"signature": "def getCoinsDict(self)"
}
] | 2 | stack_v2_sparse_classes_30k_test_000854 | Implement the Python class `WebpublishedReference` described below.
Class description:
Content type to make reference to a webpublished (only) document.
Method signatures and docstrings:
- def Source(self): the default webpublished source format
- def getCoinsDict(self): Select which values to display in the COinS ta... | Implement the Python class `WebpublishedReference` described below.
Class description:
Content type to make reference to a webpublished (only) document.
Method signatures and docstrings:
- def Source(self): the default webpublished source format
- def getCoinsDict(self): Select which values to display in the COinS ta... | f9e9f973765ae2bbfd02baee0bcfb2927b48b4f5 | <|skeleton|>
class WebpublishedReference:
"""Content type to make reference to a webpublished (only) document."""
def Source(self):
"""the default webpublished source format"""
<|body_0|>
def getCoinsDict(self):
"""Select which values to display in the COinS tag for this item"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class WebpublishedReference:
"""Content type to make reference to a webpublished (only) document."""
def Source(self):
"""the default webpublished source format"""
try:
return self.BookSource()
except AttributeError:
url = self.getPublication_url()
so... | the_stack_v2_python_sparse | Products/CMFBibliographyAT/content/webpublished.py | collective/Products.CMFBibliographyAT | train | 1 |
a9623e1b5a5ebcd30c456bf3fc2a3b9032dbf5f6 | [
"create_listener_flow = linear_flow.Flow(constants.CREATE_LISTENER_FLOW)\ncreate_listener_flow.add(lifecycle_tasks.ListenersToErrorOnRevertTask(requires=[constants.LOADBALANCER, constants.LISTENERS]))\ncreate_listener_flow.add(a10_database_tasks.GetVThunderByLoadBalancer(requires=constants.LOADBALANCER, provides=a1... | <|body_start_0|>
create_listener_flow = linear_flow.Flow(constants.CREATE_LISTENER_FLOW)
create_listener_flow.add(lifecycle_tasks.ListenersToErrorOnRevertTask(requires=[constants.LOADBALANCER, constants.LISTENERS]))
create_listener_flow.add(a10_database_tasks.GetVThunderByLoadBalancer(requires=c... | ListenerFlows | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ListenerFlows:
def get_create_listener_flow(self):
"""Create a flow to create a listener :returns: The flow for creating a listener"""
<|body_0|>
def get_create_all_listeners_flow(self):
"""Create a flow to create all listeners :returns: The flow for creating all lis... | stack_v2_sparse_classes_36k_train_010563 | 7,537 | permissive | [
{
"docstring": "Create a flow to create a listener :returns: The flow for creating a listener",
"name": "get_create_listener_flow",
"signature": "def get_create_listener_flow(self)"
},
{
"docstring": "Create a flow to create all listeners :returns: The flow for creating all listeners",
"name... | 5 | stack_v2_sparse_classes_30k_train_017006 | Implement the Python class `ListenerFlows` described below.
Class description:
Implement the ListenerFlows class.
Method signatures and docstrings:
- def get_create_listener_flow(self): Create a flow to create a listener :returns: The flow for creating a listener
- def get_create_all_listeners_flow(self): Create a fl... | Implement the Python class `ListenerFlows` described below.
Class description:
Implement the ListenerFlows class.
Method signatures and docstrings:
- def get_create_listener_flow(self): Create a flow to create a listener :returns: The flow for creating a listener
- def get_create_all_listeners_flow(self): Create a fl... | dddb3e4695c38cbb72ecf7f99a8e746869590ae2 | <|skeleton|>
class ListenerFlows:
def get_create_listener_flow(self):
"""Create a flow to create a listener :returns: The flow for creating a listener"""
<|body_0|>
def get_create_all_listeners_flow(self):
"""Create a flow to create all listeners :returns: The flow for creating all lis... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ListenerFlows:
def get_create_listener_flow(self):
"""Create a flow to create a listener :returns: The flow for creating a listener"""
create_listener_flow = linear_flow.Flow(constants.CREATE_LISTENER_FLOW)
create_listener_flow.add(lifecycle_tasks.ListenersToErrorOnRevertTask(requires=... | the_stack_v2_python_sparse | a10_octavia/controller/worker/flows/a10_listener_flows.py | richuc/a10-octavia | train | 0 | |
2f56b5d453a7277b18d9e7c191ffde76cb0e7d56 | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn ExternalConnection()",
"from ..entity import Entity\nfrom .activity_settings import ActivitySettings\nfrom .configuration import Configuration\nfrom .connection_operation import ConnectionOperation\nfrom .connection_state import Connec... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return ExternalConnection()
<|end_body_0|>
<|body_start_1|>
from ..entity import Entity
from .activity_settings import ActivitySettings
from .configuration import Configuration
... | ExternalConnection | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ExternalConnection:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ExternalConnection:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the obje... | stack_v2_sparse_classes_36k_train_010564 | 5,859 | permissive | [
{
"docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: ExternalConnection",
"name": "create_from_discriminator_value",
"signature": "def create_from_discriminator_... | 3 | stack_v2_sparse_classes_30k_train_002153 | Implement the Python class `ExternalConnection` described below.
Class description:
Implement the ExternalConnection class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ExternalConnection: Creates a new instance of the appropriate class based on disc... | Implement the Python class `ExternalConnection` described below.
Class description:
Implement the ExternalConnection class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ExternalConnection: Creates a new instance of the appropriate class based on disc... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class ExternalConnection:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ExternalConnection:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the obje... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ExternalConnection:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ExternalConnection:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: Ex... | the_stack_v2_python_sparse | msgraph/generated/models/external_connectors/external_connection.py | microsoftgraph/msgraph-sdk-python | train | 135 | |
48ddb09e23834421ba94c31e6db4564721a752dc | [
"if not root:\n return 0\nelse:\n left_len = self.maxDepth(root.left)\n right_len = self.maxDepth(root.right)\n return max(left_len, right_len) + 1",
"if not root:\n return 0\nqueue = list()\nqueue.append(root)\nresult = 0\nwhile queue:\n result += 1\n length = len(queue)\n for i in range(... | <|body_start_0|>
if not root:
return 0
else:
left_len = self.maxDepth(root.left)
right_len = self.maxDepth(root.right)
return max(left_len, right_len) + 1
<|end_body_0|>
<|body_start_1|>
if not root:
return 0
queue = list()
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxDepth(self, root):
""":type root: TreeNode :rtype: int 深度优先搜索 具体而言,在计算当前二叉树的最大深度时,可以先递归计算出其左子树和右子树的最大深度,然后在 O(1) 时间内计算出当前二叉树的最大深度。 递归在访问到空节点时退出。 时间击败57.07%,内存击败70.85%"""
<|body_0|>
def maxDepth(self, root):
""":type root: TreeNode :rtype: int 广度优先搜索 ... | stack_v2_sparse_classes_36k_train_010565 | 2,414 | no_license | [
{
"docstring": ":type root: TreeNode :rtype: int 深度优先搜索 具体而言,在计算当前二叉树的最大深度时,可以先递归计算出其左子树和右子树的最大深度,然后在 O(1) 时间内计算出当前二叉树的最大深度。 递归在访问到空节点时退出。 时间击败57.07%,内存击败70.85%",
"name": "maxDepth",
"signature": "def maxDepth(self, root)"
},
{
"docstring": ":type root: TreeNode :rtype: int 广度优先搜索 我们也可以用「广度优先搜索」... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxDepth(self, root): :type root: TreeNode :rtype: int 深度优先搜索 具体而言,在计算当前二叉树的最大深度时,可以先递归计算出其左子树和右子树的最大深度,然后在 O(1) 时间内计算出当前二叉树的最大深度。 递归在访问到空节点时退出。 时间击败57.07%,内存击败70.85%
- def m... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxDepth(self, root): :type root: TreeNode :rtype: int 深度优先搜索 具体而言,在计算当前二叉树的最大深度时,可以先递归计算出其左子树和右子树的最大深度,然后在 O(1) 时间内计算出当前二叉树的最大深度。 递归在访问到空节点时退出。 时间击败57.07%,内存击败70.85%
- def m... | 2dc982e690b153c33bc7e27a63604f754a0df90c | <|skeleton|>
class Solution:
def maxDepth(self, root):
""":type root: TreeNode :rtype: int 深度优先搜索 具体而言,在计算当前二叉树的最大深度时,可以先递归计算出其左子树和右子树的最大深度,然后在 O(1) 时间内计算出当前二叉树的最大深度。 递归在访问到空节点时退出。 时间击败57.07%,内存击败70.85%"""
<|body_0|>
def maxDepth(self, root):
""":type root: TreeNode :rtype: int 广度优先搜索 ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def maxDepth(self, root):
""":type root: TreeNode :rtype: int 深度优先搜索 具体而言,在计算当前二叉树的最大深度时,可以先递归计算出其左子树和右子树的最大深度,然后在 O(1) 时间内计算出当前二叉树的最大深度。 递归在访问到空节点时退出。 时间击败57.07%,内存击败70.85%"""
if not root:
return 0
else:
left_len = self.maxDepth(root.left)
... | the_stack_v2_python_sparse | 104_maximum-depth-of-binary-tree.py | 95275059/Algorithm | train | 0 | |
c65d8c7e6ba7f26487463a7342908e3393254262 | [
"parser.add_argument('--delete', action='store_true', default=False, help='Delete inactive accounts (default is to disable)')\nparser.add_argument('--dry-run', action='store_true', default=False, help='Only look for inactive accounts, no action')\nparser.add_argument('--silent', action='store_true', default=False, ... | <|body_start_0|>
parser.add_argument('--delete', action='store_true', default=False, help='Delete inactive accounts (default is to disable)')
parser.add_argument('--dry-run', action='store_true', default=False, help='Only look for inactive accounts, no action')
parser.add_argument('--silent', ac... | Management command to clean inactive accounts. | Command | [
"ISC"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Command:
"""Management command to clean inactive accounts."""
def add_arguments(self, parser):
"""Add extra arguments to command line."""
<|body_0|>
def _log_inactive_accounts(self, qset):
"""Log inactive accounts found."""
<|body_1|>
def handle(self... | stack_v2_sparse_classes_36k_train_010566 | 2,706 | permissive | [
{
"docstring": "Add extra arguments to command line.",
"name": "add_arguments",
"signature": "def add_arguments(self, parser)"
},
{
"docstring": "Log inactive accounts found.",
"name": "_log_inactive_accounts",
"signature": "def _log_inactive_accounts(self, qset)"
},
{
"docstring... | 3 | null | Implement the Python class `Command` described below.
Class description:
Management command to clean inactive accounts.
Method signatures and docstrings:
- def add_arguments(self, parser): Add extra arguments to command line.
- def _log_inactive_accounts(self, qset): Log inactive accounts found.
- def handle(self, *a... | Implement the Python class `Command` described below.
Class description:
Management command to clean inactive accounts.
Method signatures and docstrings:
- def add_arguments(self, parser): Add extra arguments to command line.
- def _log_inactive_accounts(self, qset): Log inactive accounts found.
- def handle(self, *a... | df699aab0799ec1725b6b89be38e56285821c889 | <|skeleton|>
class Command:
"""Management command to clean inactive accounts."""
def add_arguments(self, parser):
"""Add extra arguments to command line."""
<|body_0|>
def _log_inactive_accounts(self, qset):
"""Log inactive accounts found."""
<|body_1|>
def handle(self... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Command:
"""Management command to clean inactive accounts."""
def add_arguments(self, parser):
"""Add extra arguments to command line."""
parser.add_argument('--delete', action='store_true', default=False, help='Delete inactive accounts (default is to disable)')
parser.add_argumen... | the_stack_v2_python_sparse | modoboa/core/management/commands/clean_inactive_accounts.py | modoboa/modoboa | train | 2,201 |
f105f222d58f033bddb76f730e75dd63895e1fea | [
"if not email:\n raise ValueError('Users must have an email address')\nuser = self.model(email=MyUserManager.normalize_email(email), date_of_birth=date_of_birth, type_of=t)\nuser.set_password(password)\nuser.save(using=self._db)\nreturn user",
"u = self.create_user(username, password=password, date_of_birth=da... | <|body_start_0|>
if not email:
raise ValueError('Users must have an email address')
user = self.model(email=MyUserManager.normalize_email(email), date_of_birth=date_of_birth, type_of=t)
user.set_password(password)
user.save(using=self._db)
return user
<|end_body_0|>
... | MyUserManager | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MyUserManager:
def create_user(self, email, date_of_birth, t, password=None):
"""Creates and saves a User with the given email, date of birth and password."""
<|body_0|>
def create_superuser(self, t, username, date_of_birth, password):
"""Creates and saves a superuse... | stack_v2_sparse_classes_36k_train_010567 | 13,331 | no_license | [
{
"docstring": "Creates and saves a User with the given email, date of birth and password.",
"name": "create_user",
"signature": "def create_user(self, email, date_of_birth, t, password=None)"
},
{
"docstring": "Creates and saves a superuser with the given email, date of birth and password.",
... | 2 | stack_v2_sparse_classes_30k_train_018394 | Implement the Python class `MyUserManager` described below.
Class description:
Implement the MyUserManager class.
Method signatures and docstrings:
- def create_user(self, email, date_of_birth, t, password=None): Creates and saves a User with the given email, date of birth and password.
- def create_superuser(self, t... | Implement the Python class `MyUserManager` described below.
Class description:
Implement the MyUserManager class.
Method signatures and docstrings:
- def create_user(self, email, date_of_birth, t, password=None): Creates and saves a User with the given email, date of birth and password.
- def create_superuser(self, t... | e6d052ef8998b3e495a64e41b191c124a0a53d6b | <|skeleton|>
class MyUserManager:
def create_user(self, email, date_of_birth, t, password=None):
"""Creates and saves a User with the given email, date of birth and password."""
<|body_0|>
def create_superuser(self, t, username, date_of_birth, password):
"""Creates and saves a superuse... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MyUserManager:
def create_user(self, email, date_of_birth, t, password=None):
"""Creates and saves a User with the given email, date of birth and password."""
if not email:
raise ValueError('Users must have an email address')
user = self.model(email=MyUserManager.normalize_... | the_stack_v2_python_sparse | agritrade/models.py | Django-Nawaz/hello_world | train | 0 | |
c7d548efec7c7d0da7efabd95c1442f97613a1c9 | [
"filters = defaultdict(int)\nlen_words = len(words)\nfor i in range(len_words):\n curr = words[i]\n len_curr = len(curr)\n for j in range(len_curr + 1):\n for k in range(len_curr + 1):\n pre = ''\n suf = ''\n if j > 0:\n pre = curr[:j]\n if ... | <|body_start_0|>
filters = defaultdict(int)
len_words = len(words)
for i in range(len_words):
curr = words[i]
len_curr = len(curr)
for j in range(len_curr + 1):
for k in range(len_curr + 1):
pre = ''
suf ... | WordFilter | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WordFilter:
def __init__(self, words):
""":type words: List[str]"""
<|body_0|>
def f(self, prefix, suffix):
""":type prefix: str :type suffix: str :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
filters = defaultdict(int)
len_wor... | stack_v2_sparse_classes_36k_train_010568 | 1,650 | no_license | [
{
"docstring": ":type words: List[str]",
"name": "__init__",
"signature": "def __init__(self, words)"
},
{
"docstring": ":type prefix: str :type suffix: str :rtype: int",
"name": "f",
"signature": "def f(self, prefix, suffix)"
}
] | 2 | null | Implement the Python class `WordFilter` described below.
Class description:
Implement the WordFilter class.
Method signatures and docstrings:
- def __init__(self, words): :type words: List[str]
- def f(self, prefix, suffix): :type prefix: str :type suffix: str :rtype: int | Implement the Python class `WordFilter` described below.
Class description:
Implement the WordFilter class.
Method signatures and docstrings:
- def __init__(self, words): :type words: List[str]
- def f(self, prefix, suffix): :type prefix: str :type suffix: str :rtype: int
<|skeleton|>
class WordFilter:
def __in... | d4bcee3df2f501349feed7a26ef9828573aff873 | <|skeleton|>
class WordFilter:
def __init__(self, words):
""":type words: List[str]"""
<|body_0|>
def f(self, prefix, suffix):
""":type prefix: str :type suffix: str :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class WordFilter:
def __init__(self, words):
""":type words: List[str]"""
filters = defaultdict(int)
len_words = len(words)
for i in range(len_words):
curr = words[i]
len_curr = len(curr)
for j in range(len_curr + 1):
for k in range... | the_stack_v2_python_sparse | LeetCodeContests/62/745_Prefix_and_Suffix_Search.py | rajlath/rkl_codes | train | 0 | |
12d57f7857a965ec58b8e908110bffc0715ad335 | [
"self._args = args\nself._kwargs = kwargs\nself._func = func\nself.p = p if 0 <= p <= 1 else 1\nself.img_transformed = None",
"if not img is None:\n img_transformed = self._func(img, *self._args, **self._kwargs)\n if isinstance(img_transformed, _np.ndarray):\n self.img_transformed = img_transformed\n... | <|body_start_0|>
self._args = args
self._kwargs = kwargs
self._func = func
self.p = p if 0 <= p <= 1 else 1
self.img_transformed = None
<|end_body_0|>
<|body_start_1|>
if not img is None:
img_transformed = self._func(img, *self._args, **self._kwargs)
... | class to hold and execute a transform Transforms should all take img as the first argument, hence we should be able to also store cv2 or other functions directly. Where we cant store 3rd party lib transforms directly we will wrap them in transforms.py func: the function *args, **kwargs: func arguments p: probability of... | Transform | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Transform:
"""class to hold and execute a transform Transforms should all take img as the first argument, hence we should be able to also store cv2 or other functions directly. Where we cant store 3rd party lib transforms directly we will wrap them in transforms.py func: the function *args, **kwa... | stack_v2_sparse_classes_36k_train_010569 | 32,511 | no_license | [
{
"docstring": "the function and the arguments to be applied p is the probability it will be applied",
"name": "__init__",
"signature": "def __init__(self, func, *args, p=1, **kwargs)"
},
{
"docstring": "(str|ndarray, bool)->ndarray Perform the transform on passed image. Returns the transformed ... | 2 | null | Implement the Python class `Transform` described below.
Class description:
class to hold and execute a transform Transforms should all take img as the first argument, hence we should be able to also store cv2 or other functions directly. Where we cant store 3rd party lib transforms directly we will wrap them in transf... | Implement the Python class `Transform` described below.
Class description:
class to hold and execute a transform Transforms should all take img as the first argument, hence we should be able to also store cv2 or other functions directly. Where we cant store 3rd party lib transforms directly we will wrap them in transf... | 9123aa6baf538b662143b9098d963d55165e8409 | <|skeleton|>
class Transform:
"""class to hold and execute a transform Transforms should all take img as the first argument, hence we should be able to also store cv2 or other functions directly. Where we cant store 3rd party lib transforms directly we will wrap them in transforms.py func: the function *args, **kwa... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Transform:
"""class to hold and execute a transform Transforms should all take img as the first argument, hence we should be able to also store cv2 or other functions directly. Where we cant store 3rd party lib transforms directly we will wrap them in transforms.py func: the function *args, **kwargs: func arg... | the_stack_v2_python_sparse | opencvlib/transforms.py | gmonkman/python | train | 0 |
fc1d5e2c171ac560e2f0d5529f42fd8d7e1f7a69 | [
"data = super(CFIrQWeb, self)._get_field(record, field_name, expression, tagName, field_options, options, values)\nattributes = data[0]\ncontent = data[1]\nif 'data_type' in field_options:\n if type(field_options['data_type']) == str and field_options['data_type'].lower() == 'raw':\n content = HTMLHelper.... | <|body_start_0|>
data = super(CFIrQWeb, self)._get_field(record, field_name, expression, tagName, field_options, options, values)
attributes = data[0]
content = data[1]
if 'data_type' in field_options:
if type(field_options['data_type']) == str and field_options['data_type'].... | 继承IrQWeb对象,以实现删除字段值中的HTML标签和前后空格 | CFIrQWeb | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CFIrQWeb:
"""继承IrQWeb对象,以实现删除字段值中的HTML标签和前后空格"""
def _get_field(self, record, field_name, expression, tagName, field_options, options, values):
"""判断是否指定了data_type=raw,如果已经指定则移除字段值中的HTML标签、换行和前后空格"""
<|body_0|>
def __is_show_html(self, el, options):
"""根据data_typ... | stack_v2_sparse_classes_36k_train_010570 | 7,553 | no_license | [
{
"docstring": "判断是否指定了data_type=raw,如果已经指定则移除字段值中的HTML标签、换行和前后空格",
"name": "_get_field",
"signature": "def _get_field(self, record, field_name, expression, tagName, field_options, options, values)"
},
{
"docstring": "根据data_type判断是否要显示HTML",
"name": "__is_show_html",
"signature": "def _... | 5 | stack_v2_sparse_classes_30k_train_009573 | Implement the Python class `CFIrQWeb` described below.
Class description:
继承IrQWeb对象,以实现删除字段值中的HTML标签和前后空格
Method signatures and docstrings:
- def _get_field(self, record, field_name, expression, tagName, field_options, options, values): 判断是否指定了data_type=raw,如果已经指定则移除字段值中的HTML标签、换行和前后空格
- def __is_show_html(self, el,... | Implement the Python class `CFIrQWeb` described below.
Class description:
继承IrQWeb对象,以实现删除字段值中的HTML标签和前后空格
Method signatures and docstrings:
- def _get_field(self, record, field_name, expression, tagName, field_options, options, values): 判断是否指定了data_type=raw,如果已经指定则移除字段值中的HTML标签、换行和前后空格
- def __is_show_html(self, el,... | a6f950a4c05c90ac5f53c1602ac2cda33faf41ee | <|skeleton|>
class CFIrQWeb:
"""继承IrQWeb对象,以实现删除字段值中的HTML标签和前后空格"""
def _get_field(self, record, field_name, expression, tagName, field_options, options, values):
"""判断是否指定了data_type=raw,如果已经指定则移除字段值中的HTML标签、换行和前后空格"""
<|body_0|>
def __is_show_html(self, el, options):
"""根据data_typ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CFIrQWeb:
"""继承IrQWeb对象,以实现删除字段值中的HTML标签和前后空格"""
def _get_field(self, record, field_name, expression, tagName, field_options, options, values):
"""判断是否指定了data_type=raw,如果已经指定则移除字段值中的HTML标签、换行和前后空格"""
data = super(CFIrQWeb, self)._get_field(record, field_name, expression, tagName, field_op... | the_stack_v2_python_sparse | uw_custom/cfprint/ir/ir_qweb/ir_qweb.py | kulius/odoo11_uw | train | 1 |
affc00dd8b696a7d024e7e99b84976502d6f943a | [
"if isinstance(key, int):\n return Cipher(key)\nif key not in Cipher._member_map_:\n extend_enum(Cipher, key, default)\nreturn Cipher[key]",
"if not (isinstance(value, int) and 0 <= value <= 65535):\n raise ValueError('%r is not a valid %s' % (value, cls.__name__))\nif 5 <= value <= 65535:\n extend_en... | <|body_start_0|>
if isinstance(key, int):
return Cipher(key)
if key not in Cipher._member_map_:
extend_enum(Cipher, key, default)
return Cipher[key]
<|end_body_0|>
<|body_start_1|>
if not (isinstance(value, int) and 0 <= value <= 65535):
raise ValueEr... | [Cipher] Cipher IDs | Cipher | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Cipher:
"""[Cipher] Cipher IDs"""
def get(key, default=-1):
"""Backport support for original codes."""
<|body_0|>
def _missing_(cls, value):
"""Lookup function used when value is not found."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if isin... | stack_v2_sparse_classes_36k_train_010571 | 1,203 | permissive | [
{
"docstring": "Backport support for original codes.",
"name": "get",
"signature": "def get(key, default=-1)"
},
{
"docstring": "Lookup function used when value is not found.",
"name": "_missing_",
"signature": "def _missing_(cls, value)"
}
] | 2 | null | Implement the Python class `Cipher` described below.
Class description:
[Cipher] Cipher IDs
Method signatures and docstrings:
- def get(key, default=-1): Backport support for original codes.
- def _missing_(cls, value): Lookup function used when value is not found. | Implement the Python class `Cipher` described below.
Class description:
[Cipher] Cipher IDs
Method signatures and docstrings:
- def get(key, default=-1): Backport support for original codes.
- def _missing_(cls, value): Lookup function used when value is not found.
<|skeleton|>
class Cipher:
"""[Cipher] Cipher I... | 90cd07d67df28d5c5ab0585bc60f467a78d9db33 | <|skeleton|>
class Cipher:
"""[Cipher] Cipher IDs"""
def get(key, default=-1):
"""Backport support for original codes."""
<|body_0|>
def _missing_(cls, value):
"""Lookup function used when value is not found."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Cipher:
"""[Cipher] Cipher IDs"""
def get(key, default=-1):
"""Backport support for original codes."""
if isinstance(key, int):
return Cipher(key)
if key not in Cipher._member_map_:
extend_enum(Cipher, key, default)
return Cipher[key]
def _miss... | the_stack_v2_python_sparse | pcapkit/const/hip/cipher.py | stjordanis/PyPCAPKit | train | 0 |
7452dc58b3c7e74971d3e42b8cc42295beefec10 | [
"self.app_env = app_env\nself.error = error\nself.finished = finished\nself.target_entity = target_entity\nself.target_entity_credentials = target_entity_credentials",
"if dictionary is None:\n return None\napp_env = dictionary.get('appEnv')\nerror = cohesity_management_sdk.models.error_proto.ErrorProto.from_d... | <|body_start_0|>
self.app_env = app_env
self.error = error
self.finished = finished
self.target_entity = target_entity
self.target_entity_credentials = target_entity_credentials
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
app_en... | Implementation of the 'DestroyCloneAppTaskInfoProto' model. Each available extension is listed below along with the location of the proto file (relative to magneto/connectors) where it is defined. DestroyCloneAppTaskInfoProto extension Location Extension =================================================================... | DestroyCloneAppTaskInfoProto | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DestroyCloneAppTaskInfoProto:
"""Implementation of the 'DestroyCloneAppTaskInfoProto' model. Each available extension is listed below along with the location of the proto file (relative to magneto/connectors) where it is defined. DestroyCloneAppTaskInfoProto extension Location Extension =========... | stack_v2_sparse_classes_36k_train_010572 | 3,721 | permissive | [
{
"docstring": "Constructor for the DestroyCloneAppTaskInfoProto class",
"name": "__init__",
"signature": "def __init__(self, app_env=None, error=None, finished=None, target_entity=None, target_entity_credentials=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args:... | 2 | stack_v2_sparse_classes_30k_train_020435 | Implement the Python class `DestroyCloneAppTaskInfoProto` described below.
Class description:
Implementation of the 'DestroyCloneAppTaskInfoProto' model. Each available extension is listed below along with the location of the proto file (relative to magneto/connectors) where it is defined. DestroyCloneAppTaskInfoProto... | Implement the Python class `DestroyCloneAppTaskInfoProto` described below.
Class description:
Implementation of the 'DestroyCloneAppTaskInfoProto' model. Each available extension is listed below along with the location of the proto file (relative to magneto/connectors) where it is defined. DestroyCloneAppTaskInfoProto... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class DestroyCloneAppTaskInfoProto:
"""Implementation of the 'DestroyCloneAppTaskInfoProto' model. Each available extension is listed below along with the location of the proto file (relative to magneto/connectors) where it is defined. DestroyCloneAppTaskInfoProto extension Location Extension =========... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DestroyCloneAppTaskInfoProto:
"""Implementation of the 'DestroyCloneAppTaskInfoProto' model. Each available extension is listed below along with the location of the proto file (relative to magneto/connectors) where it is defined. DestroyCloneAppTaskInfoProto extension Location Extension ======================... | the_stack_v2_python_sparse | cohesity_management_sdk/models/destroy_clone_app_task_info_proto.py | cohesity/management-sdk-python | train | 24 |
debb9729a7b4c1d5c8836b55546794931979aaaf | [
"if n == 0:\n return 1\nelif n > 0:\n return self.pow_pos(x, n)\nelse:\n return 1.0 / self.pow_pos(x, abs(n))",
"num = x\nresult = 1\nwhile n > 0:\n if n & 1 == 1:\n result *= num\n num = num * num\n n = n >> 1\nreturn result"
] | <|body_start_0|>
if n == 0:
return 1
elif n > 0:
return self.pow_pos(x, n)
else:
return 1.0 / self.pow_pos(x, abs(n))
<|end_body_0|>
<|body_start_1|>
num = x
result = 1
while n > 0:
if n & 1 == 1:
result *= ... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def my_pow(self, x, n):
""":type x: float :type n: int :rtype: float"""
<|body_0|>
def pow_pos(self, x, n):
"""n: 是正整数"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if n == 0:
return 1
elif n > 0:
return s... | stack_v2_sparse_classes_36k_train_010573 | 1,687 | no_license | [
{
"docstring": ":type x: float :type n: int :rtype: float",
"name": "my_pow",
"signature": "def my_pow(self, x, n)"
},
{
"docstring": "n: 是正整数",
"name": "pow_pos",
"signature": "def pow_pos(self, x, n)"
}
] | 2 | stack_v2_sparse_classes_30k_train_004429 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def my_pow(self, x, n): :type x: float :type n: int :rtype: float
- def pow_pos(self, x, n): n: 是正整数 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def my_pow(self, x, n): :type x: float :type n: int :rtype: float
- def pow_pos(self, x, n): n: 是正整数
<|skeleton|>
class Solution:
def my_pow(self, x, n):
""":type x... | dd917b6eba48eef42f1086a54880bab6cd1fbf07 | <|skeleton|>
class Solution:
def my_pow(self, x, n):
""":type x: float :type n: int :rtype: float"""
<|body_0|>
def pow_pos(self, x, n):
"""n: 是正整数"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def my_pow(self, x, n):
""":type x: float :type n: int :rtype: float"""
if n == 0:
return 1
elif n > 0:
return self.pow_pos(x, n)
else:
return 1.0 / self.pow_pos(x, abs(n))
def pow_pos(self, x, n):
"""n: 是正整数"""
... | the_stack_v2_python_sparse | algorithms/BAT-algorithms/Math/pow(x,n).py | williamsyb/mycookbook | train | 2 | |
71901504373f6dd77c6a393c384d59d3c93e7544 | [
"self.skip_module = MyConfig('skip_module').config\nif current_module is None:\n self.current_module = _current_module()\nelse:\n self.current_module = module",
"if isinstance(self.skip_module, dict):\n for module, reason in self.skip_module.items():\n if module == self.current_module:\n ... | <|body_start_0|>
self.skip_module = MyConfig('skip_module').config
if current_module is None:
self.current_module = _current_module()
else:
self.current_module = module
<|end_body_0|>
<|body_start_1|>
if isinstance(self.skip_module, dict):
for module,... | Skip | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Skip:
def __init__(self, module=None):
"""初始化"""
<|body_0|>
def _is_skip(self):
"""通过.ya中的数据对比当前模块名称是否相等"""
<|body_1|>
def is_skip(self):
"""用例执行"""
<|body_2|>
def is_reason(self):
"""跳过原因"""
<|body_3|>
<|end_skeleto... | stack_v2_sparse_classes_36k_train_010574 | 1,187 | no_license | [
{
"docstring": "初始化",
"name": "__init__",
"signature": "def __init__(self, module=None)"
},
{
"docstring": "通过.ya中的数据对比当前模块名称是否相等",
"name": "_is_skip",
"signature": "def _is_skip(self)"
},
{
"docstring": "用例执行",
"name": "is_skip",
"signature": "def is_skip(self)"
},
{... | 4 | stack_v2_sparse_classes_30k_train_013375 | Implement the Python class `Skip` described below.
Class description:
Implement the Skip class.
Method signatures and docstrings:
- def __init__(self, module=None): 初始化
- def _is_skip(self): 通过.ya中的数据对比当前模块名称是否相等
- def is_skip(self): 用例执行
- def is_reason(self): 跳过原因 | Implement the Python class `Skip` described below.
Class description:
Implement the Skip class.
Method signatures and docstrings:
- def __init__(self, module=None): 初始化
- def _is_skip(self): 通过.ya中的数据对比当前模块名称是否相等
- def is_skip(self): 用例执行
- def is_reason(self): 跳过原因
<|skeleton|>
class Skip:
def __init__(self, m... | 86bb051e62abdf2ed5bbdbea4c9008a6c1f49060 | <|skeleton|>
class Skip:
def __init__(self, module=None):
"""初始化"""
<|body_0|>
def _is_skip(self):
"""通过.ya中的数据对比当前模块名称是否相等"""
<|body_1|>
def is_skip(self):
"""用例执行"""
<|body_2|>
def is_reason(self):
"""跳过原因"""
<|body_3|>
<|end_skeleto... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Skip:
def __init__(self, module=None):
"""初始化"""
self.skip_module = MyConfig('skip_module').config
if current_module is None:
self.current_module = _current_module()
else:
self.current_module = module
def _is_skip(self):
"""通过.ya中的数据对比当前模块名称... | the_stack_v2_python_sparse | model/SkipModule.py | yushu1987/UI | train | 0 | |
5a5ff720a108a133d79aa99effe1b31fa067193a | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn SchemaExtension()",
"from .entity import Entity\nfrom .extension_schema_property import ExtensionSchemaProperty\nfrom .entity import Entity\nfrom .extension_schema_property import ExtensionSchemaProperty\nfields: Dict[str, Callable[[An... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return SchemaExtension()
<|end_body_0|>
<|body_start_1|>
from .entity import Entity
from .extension_schema_property import ExtensionSchemaProperty
from .entity import Entity
fro... | SchemaExtension | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SchemaExtension:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> SchemaExtension:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Ret... | stack_v2_sparse_classes_36k_train_010575 | 4,560 | permissive | [
{
"docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: SchemaExtension",
"name": "create_from_discriminator_value",
"signature": "def create_from_discriminator_val... | 3 | stack_v2_sparse_classes_30k_train_000394 | Implement the Python class `SchemaExtension` described below.
Class description:
Implement the SchemaExtension class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> SchemaExtension: Creates a new instance of the appropriate class based on discriminator... | Implement the Python class `SchemaExtension` described below.
Class description:
Implement the SchemaExtension class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> SchemaExtension: Creates a new instance of the appropriate class based on discriminator... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class SchemaExtension:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> SchemaExtension:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Ret... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SchemaExtension:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> SchemaExtension:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: SchemaEx... | the_stack_v2_python_sparse | msgraph/generated/models/schema_extension.py | microsoftgraph/msgraph-sdk-python | train | 135 | |
7dc602b5f98ff2eb74207f5c637ee40fc5787616 | [
"super(BiW2VCharLSTM, self).__init__()\nself.word_hidden_dim = word_hidden_dim\nself.char_hidden_dim = char_hidden_dim\nself.char_embedding_dim = char_embedding_dim\nself.w2v_model = ner_data_obj.w2v_model\nself.char_embeddings = nn.Embedding(len(ner_data_obj.char_set), char_embedding_dim)\nself.word_lstm = nn.LSTM... | <|body_start_0|>
super(BiW2VCharLSTM, self).__init__()
self.word_hidden_dim = word_hidden_dim
self.char_hidden_dim = char_hidden_dim
self.char_embedding_dim = char_embedding_dim
self.w2v_model = ner_data_obj.w2v_model
self.char_embeddings = nn.Embedding(len(ner_data_obj.c... | BiW2VCharLSTM | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BiW2VCharLSTM:
def __init__(self, word_hidden_dim, char_hidden_dim, char_embedding_dim, ner_data_obj):
"""Create a unidirectional, character+word level LSTM. Parameters: word_hidden_dim (int, required): Dimensionality of hidden layer in the word-level lstm. Also the input dimenstionality... | stack_v2_sparse_classes_36k_train_010576 | 15,011 | permissive | [
{
"docstring": "Create a unidirectional, character+word level LSTM. Parameters: word_hidden_dim (int, required): Dimensionality of hidden layer in the word-level lstm. Also the input dimenstionality of the hidden2tag linear layer. char_hidden_dim (int, required): Dimensionality of the hidden layer in the char L... | 4 | stack_v2_sparse_classes_30k_train_009129 | Implement the Python class `BiW2VCharLSTM` described below.
Class description:
Implement the BiW2VCharLSTM class.
Method signatures and docstrings:
- def __init__(self, word_hidden_dim, char_hidden_dim, char_embedding_dim, ner_data_obj): Create a unidirectional, character+word level LSTM. Parameters: word_hidden_dim ... | Implement the Python class `BiW2VCharLSTM` described below.
Class description:
Implement the BiW2VCharLSTM class.
Method signatures and docstrings:
- def __init__(self, word_hidden_dim, char_hidden_dim, char_embedding_dim, ner_data_obj): Create a unidirectional, character+word level LSTM. Parameters: word_hidden_dim ... | 55b5b329395da79047e9083232101d15af9f2c49 | <|skeleton|>
class BiW2VCharLSTM:
def __init__(self, word_hidden_dim, char_hidden_dim, char_embedding_dim, ner_data_obj):
"""Create a unidirectional, character+word level LSTM. Parameters: word_hidden_dim (int, required): Dimensionality of hidden layer in the word-level lstm. Also the input dimenstionality... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BiW2VCharLSTM:
def __init__(self, word_hidden_dim, char_hidden_dim, char_embedding_dim, ner_data_obj):
"""Create a unidirectional, character+word level LSTM. Parameters: word_hidden_dim (int, required): Dimensionality of hidden layer in the word-level lstm. Also the input dimenstionality of the hidden... | the_stack_v2_python_sparse | NER/arch_blocks.py | rnaimehaom/UW-Molecular-Data-Mining | train | 0 | |
0da0fd4ad585d8d23651c6e9766495015eeeb266 | [
"order = Order.objects.get(id=order_id)\norder_serializer = OrderSerializer(order)\nuser = order.user\npayment = {}\ntry:\n user_dict = UserSerializer(user).data\n user_details = UserDetails.objects.get(user=user)\n user_dict['name'] = user_details.name\n gateway_endpoint = settings.API_GATEWAY_URL + '/... | <|body_start_0|>
order = Order.objects.get(id=order_id)
order_serializer = OrderSerializer(order)
user = order.user
payment = {}
try:
user_dict = UserSerializer(user).data
user_details = UserDetails.objects.get(user=user)
user_dict['name'] = us... | Order Controller View | OrderControlView | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OrderControlView:
"""Order Controller View"""
def get(self, request, order_id=None, user=None):
"""order view for fetching a particular order :param request: http request for the view method allowed: GET http request should be authorised by the jwt token of the user :param order_id: ... | stack_v2_sparse_classes_36k_train_010577 | 14,511 | permissive | [
{
"docstring": "order view for fetching a particular order :param request: http request for the view method allowed: GET http request should be authorised by the jwt token of the user :param order_id: order_id of the order referring to :param user: User object of the requesting user :returns Response object wit... | 3 | stack_v2_sparse_classes_30k_train_018232 | Implement the Python class `OrderControlView` described below.
Class description:
Order Controller View
Method signatures and docstrings:
- def get(self, request, order_id=None, user=None): order view for fetching a particular order :param request: http request for the view method allowed: GET http request should be ... | Implement the Python class `OrderControlView` described below.
Class description:
Order Controller View
Method signatures and docstrings:
- def get(self, request, order_id=None, user=None): order view for fetching a particular order :param request: http request for the view method allowed: GET http request should be ... | 45e98d77b2fef6004dd36c640bd95b25395d0948 | <|skeleton|>
class OrderControlView:
"""Order Controller View"""
def get(self, request, order_id=None, user=None):
"""order view for fetching a particular order :param request: http request for the view method allowed: GET http request should be authorised by the jwt token of the user :param order_id: ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class OrderControlView:
"""Order Controller View"""
def get(self, request, order_id=None, user=None):
"""order view for fetching a particular order :param request: http request for the view method allowed: GET http request should be authorised by the jwt token of the user :param order_id: order_id of t... | the_stack_v2_python_sparse | services/workshop/crapi/shop/views.py | OWASP/crAPI | train | 772 |
01dc4a280863b2de85e16f8ddc4e8b49ab72b38e | [
"self._key_file = key_file\nself._timeout = timeout\nself._known_hosts = known_hosts\nsuper(SSHConnectionPool, self).__init__(user_name, password, host, port, min_pool_size, max_pool_size, wait_if_busy, wait_interval)",
"if self.ssh_pool is None:\n self.ssh_pool = SSHConnectionPool(host, port, user_name, passw... | <|body_start_0|>
self._key_file = key_file
self._timeout = timeout
self._known_hosts = known_hosts
super(SSHConnectionPool, self).__init__(user_name, password, host, port, min_pool_size, max_pool_size, wait_if_busy, wait_interval)
<|end_body_0|>
<|body_start_1|>
if self.ssh_pool... | SSHConnection Pool to hold the pool of SSH connections | SSHConnectionPool | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SSHConnectionPool:
"""SSHConnection Pool to hold the pool of SSH connections"""
def __init__(self, host, port, user_name, password, known_hosts, min_pool_size=5, max_pool_size=10, wait_if_busy=True, wait_interval=-1, key_file=None, timeout=60):
"""Constructor to initialize the ssh co... | stack_v2_sparse_classes_36k_train_010578 | 28,982 | permissive | [
{
"docstring": "Constructor to initialize the ssh connection pool",
"name": "__init__",
"signature": "def __init__(self, host, port, user_name, password, known_hosts, min_pool_size=5, max_pool_size=10, wait_if_busy=True, wait_interval=-1, key_file=None, timeout=60)"
},
{
"docstring": "Method to ... | 3 | null | Implement the Python class `SSHConnectionPool` described below.
Class description:
SSHConnection Pool to hold the pool of SSH connections
Method signatures and docstrings:
- def __init__(self, host, port, user_name, password, known_hosts, min_pool_size=5, max_pool_size=10, wait_if_busy=True, wait_interval=-1, key_fil... | Implement the Python class `SSHConnectionPool` described below.
Class description:
SSHConnection Pool to hold the pool of SSH connections
Method signatures and docstrings:
- def __init__(self, host, port, user_name, password, known_hosts, min_pool_size=5, max_pool_size=10, wait_if_busy=True, wait_interval=-1, key_fil... | 63579dbfcfcda5def5b588a6728bfff85ad4564e | <|skeleton|>
class SSHConnectionPool:
"""SSHConnection Pool to hold the pool of SSH connections"""
def __init__(self, host, port, user_name, password, known_hosts, min_pool_size=5, max_pool_size=10, wait_if_busy=True, wait_interval=-1, key_file=None, timeout=60):
"""Constructor to initialize the ssh co... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SSHConnectionPool:
"""SSHConnection Pool to hold the pool of SSH connections"""
def __init__(self, host, port, user_name, password, known_hosts, min_pool_size=5, max_pool_size=10, wait_if_busy=True, wait_interval=-1, key_file=None, timeout=60):
"""Constructor to initialize the ssh connection pool... | the_stack_v2_python_sparse | paxes_nova/virt/ibmpowervm/common/pool.py | windskyer/k_nova | train | 0 |
6c502cd130cb43bc7936102eac919ef9acd6903a | [
"div_list = response.xpath('//div[@class=\"el\"]')[4:]\nfor div in div_list:\n item = JobItem()\n item['name'] = div.xpath('./p/span/a/text()').extract_first().strip()\n item['job_url'] = div.xpath('./p/span/a/@href').extract_first()\n item['company_name'] = div.xpath('./span[1]/a/text()').extract_first... | <|body_start_0|>
div_list = response.xpath('//div[@class="el"]')[4:]
for div in div_list:
item = JobItem()
item['name'] = div.xpath('./p/span/a/text()').extract_first().strip()
item['job_url'] = div.xpath('./p/span/a/@href').extract_first()
item['company_n... | A51jobSpider | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class A51jobSpider:
def parse(self, response):
"""处理列表页数据 :param response: 下载器response对象==>中央引擎==>spider :return:"""
<|body_0|>
def parse_detail(self, response):
"""处理详情页信息 :param response: parse请求==>中央引擎==>下载器==>response对象 :return: item对象"""
<|body_1|>
<|end_skel... | stack_v2_sparse_classes_36k_train_010579 | 2,876 | no_license | [
{
"docstring": "处理列表页数据 :param response: 下载器response对象==>中央引擎==>spider :return:",
"name": "parse",
"signature": "def parse(self, response)"
},
{
"docstring": "处理详情页信息 :param response: parse请求==>中央引擎==>下载器==>response对象 :return: item对象",
"name": "parse_detail",
"signature": "def parse_deta... | 2 | stack_v2_sparse_classes_30k_val_000397 | Implement the Python class `A51jobSpider` described below.
Class description:
Implement the A51jobSpider class.
Method signatures and docstrings:
- def parse(self, response): 处理列表页数据 :param response: 下载器response对象==>中央引擎==>spider :return:
- def parse_detail(self, response): 处理详情页信息 :param response: parse请求==>中央引擎==>下... | Implement the Python class `A51jobSpider` described below.
Class description:
Implement the A51jobSpider class.
Method signatures and docstrings:
- def parse(self, response): 处理列表页数据 :param response: 下载器response对象==>中央引擎==>spider :return:
- def parse_detail(self, response): 处理详情页信息 :param response: parse请求==>中央引擎==>下... | 2028638f43172ff2902aa571ad80a30f4cd9737f | <|skeleton|>
class A51jobSpider:
def parse(self, response):
"""处理列表页数据 :param response: 下载器response对象==>中央引擎==>spider :return:"""
<|body_0|>
def parse_detail(self, response):
"""处理详情页信息 :param response: parse请求==>中央引擎==>下载器==>response对象 :return: item对象"""
<|body_1|>
<|end_skel... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class A51jobSpider:
def parse(self, response):
"""处理列表页数据 :param response: 下载器response对象==>中央引擎==>spider :return:"""
div_list = response.xpath('//div[@class="el"]')[4:]
for div in div_list:
item = JobItem()
item['name'] = div.xpath('./p/span/a/text()').extract_first()... | the_stack_v2_python_sparse | job/job/spiders/a51job.py | Pysuper/ScrapyProject | train | 0 | |
4f4874928b6577a830d552dc4adebfaab0ca441c | [
"QtWidgets.QWidget.__init__(self, *args, **kargs)\nif constraints_dict == None:\n constraints_dict = {}\nself.constants_manager = constants_manager\nself.constraints_dict = self.constants_manager.constrains\nself.widget_dict = {}\nlayout = QtWidgets.QFormLayout()\nfor k in list(self.constants_manager.keys()):\n ... | <|body_start_0|>
QtWidgets.QWidget.__init__(self, *args, **kargs)
if constraints_dict == None:
constraints_dict = {}
self.constants_manager = constants_manager
self.constraints_dict = self.constants_manager.constrains
self.widget_dict = {}
layout = QtWidgets.Q... | CMWidget | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CMWidget:
def __init__(self, constants_manager, constraints_dict=None, key_list=None, *args, **kargs):
"""This class will manage the constants with a gui interface. Each value is caracterized by its name (called key), its type, its initial value and its description. These information are... | stack_v2_sparse_classes_36k_train_010580 | 5,116 | no_license | [
{
"docstring": "This class will manage the constants with a gui interface. Each value is caracterized by its name (called key), its type, its initial value and its description. These information are given in values_dict. - constants_manager : the constant manager instance to represent",
"name": "__init__",
... | 4 | stack_v2_sparse_classes_30k_train_019954 | Implement the Python class `CMWidget` described below.
Class description:
Implement the CMWidget class.
Method signatures and docstrings:
- def __init__(self, constants_manager, constraints_dict=None, key_list=None, *args, **kargs): This class will manage the constants with a gui interface. Each value is caracterized... | Implement the Python class `CMWidget` described below.
Class description:
Implement the CMWidget class.
Method signatures and docstrings:
- def __init__(self, constants_manager, constraints_dict=None, key_list=None, *args, **kargs): This class will manage the constants with a gui interface. Each value is caracterized... | 14c9e51fa31fd3ff4113f33e26619d07c9f1dc7c | <|skeleton|>
class CMWidget:
def __init__(self, constants_manager, constraints_dict=None, key_list=None, *args, **kargs):
"""This class will manage the constants with a gui interface. Each value is caracterized by its name (called key), its type, its initial value and its description. These information are... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CMWidget:
def __init__(self, constants_manager, constraints_dict=None, key_list=None, *args, **kargs):
"""This class will manage the constants with a gui interface. Each value is caracterized by its name (called key), its type, its initial value and its description. These information are given in valu... | the_stack_v2_python_sparse | ConstantsManager/ConstantsManagerWidget.py | grumpfou/AthenaWriter | train | 0 | |
2776919d1b94bb50461ab04ab0e0acb7770f836e | [
"super(self.__class__, self).__init__(graph, seed)\nself.available_statuses = {'Susceptible': 0, 'Infected': 1}\nself.parameters = {'model': {'q': {'descr': 'Number of neighbours that affect the opinion of an agent', 'range': [0, len(self.graph.nodes)], 'optional': False}}, 'nodes': {}, 'edges': {}}\nself.name = 'Q... | <|body_start_0|>
super(self.__class__, self).__init__(graph, seed)
self.available_statuses = {'Susceptible': 0, 'Infected': 1}
self.parameters = {'model': {'q': {'descr': 'Number of neighbours that affect the opinion of an agent', 'range': [0, len(self.graph.nodes)], 'optional': False}}, 'nodes'... | Node Parameters to be specified via ModelConfig :param q: the number of neighbors that affect the opinion of a node | QVoterModel | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class QVoterModel:
"""Node Parameters to be specified via ModelConfig :param q: the number of neighbors that affect the opinion of a node"""
def __init__(self, graph, seed=None):
"""Model Constructor :param graph: A networkx graph object"""
<|body_0|>
def iteration(self, node_... | stack_v2_sparse_classes_36k_train_010581 | 4,214 | permissive | [
{
"docstring": "Model Constructor :param graph: A networkx graph object",
"name": "__init__",
"signature": "def __init__(self, graph, seed=None)"
},
{
"docstring": "Execute a single model iteration :return: Iteration_id, Incremental node status (dictionary node->status)",
"name": "iteration"... | 2 | stack_v2_sparse_classes_30k_train_006700 | Implement the Python class `QVoterModel` described below.
Class description:
Node Parameters to be specified via ModelConfig :param q: the number of neighbors that affect the opinion of a node
Method signatures and docstrings:
- def __init__(self, graph, seed=None): Model Constructor :param graph: A networkx graph ob... | Implement the Python class `QVoterModel` described below.
Class description:
Node Parameters to be specified via ModelConfig :param q: the number of neighbors that affect the opinion of a node
Method signatures and docstrings:
- def __init__(self, graph, seed=None): Model Constructor :param graph: A networkx graph ob... | 900cb3727795c97a73e59fdb736aa736c4d17157 | <|skeleton|>
class QVoterModel:
"""Node Parameters to be specified via ModelConfig :param q: the number of neighbors that affect the opinion of a node"""
def __init__(self, graph, seed=None):
"""Model Constructor :param graph: A networkx graph object"""
<|body_0|>
def iteration(self, node_... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class QVoterModel:
"""Node Parameters to be specified via ModelConfig :param q: the number of neighbors that affect the opinion of a node"""
def __init__(self, graph, seed=None):
"""Model Constructor :param graph: A networkx graph object"""
super(self.__class__, self).__init__(graph, seed)
... | the_stack_v2_python_sparse | ndlib/models/opinions/QVoterModel.py | GiulioRossetti/ndlib | train | 265 |
3b224f15f5d503da4a100c50c481d2ad867f6611 | [
"bpe_data = None\njson_path = ''\nvocab_path = ''\nif self.opt.get('dict_loaded'):\n dfname = self.opt['dict_file']\n if PathManager.exists(f'{dfname}-merges.txt'):\n vocab_path = f'{dfname}-merges.txt'\n if PathManager.exists(f'{dfname}-vocab.json'):\n json_path = f'{dfname}-vocab.json'\nif ... | <|body_start_0|>
bpe_data = None
json_path = ''
vocab_path = ''
if self.opt.get('dict_loaded'):
dfname = self.opt['dict_file']
if PathManager.exists(f'{dfname}-merges.txt'):
vocab_path = f'{dfname}-merges.txt'
if PathManager.exists(f'{d... | Stand-in for HuggingFace if we do not have access to tokenizers. Only EVER used for a model used in interactive mode that was previously trained with HF BPE. | SlowBytelevelBPE | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SlowBytelevelBPE:
"""Stand-in for HuggingFace if we do not have access to tokenizers. Only EVER used for a model used in interactive mode that was previously trained with HF BPE."""
def _build_data(self) -> Tuple[str, str]:
"""Override to load dicts if they exist. :return (bpe_data, ... | stack_v2_sparse_classes_36k_train_010582 | 31,618 | permissive | [
{
"docstring": "Override to load dicts if they exist. :return (bpe_data, json_path): bpe_data and path to encoder json",
"name": "_build_data",
"signature": "def _build_data(self) -> Tuple[str, str]"
},
{
"docstring": "Basically a combination of syncing HF dict with the GPT2 standard. It's kinda... | 2 | null | Implement the Python class `SlowBytelevelBPE` described below.
Class description:
Stand-in for HuggingFace if we do not have access to tokenizers. Only EVER used for a model used in interactive mode that was previously trained with HF BPE.
Method signatures and docstrings:
- def _build_data(self) -> Tuple[str, str]: ... | Implement the Python class `SlowBytelevelBPE` described below.
Class description:
Stand-in for HuggingFace if we do not have access to tokenizers. Only EVER used for a model used in interactive mode that was previously trained with HF BPE.
Method signatures and docstrings:
- def _build_data(self) -> Tuple[str, str]: ... | e1d899edfb92471552bae153f59ad30aa7fca468 | <|skeleton|>
class SlowBytelevelBPE:
"""Stand-in for HuggingFace if we do not have access to tokenizers. Only EVER used for a model used in interactive mode that was previously trained with HF BPE."""
def _build_data(self) -> Tuple[str, str]:
"""Override to load dicts if they exist. :return (bpe_data, ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SlowBytelevelBPE:
"""Stand-in for HuggingFace if we do not have access to tokenizers. Only EVER used for a model used in interactive mode that was previously trained with HF BPE."""
def _build_data(self) -> Tuple[str, str]:
"""Override to load dicts if they exist. :return (bpe_data, json_path): b... | the_stack_v2_python_sparse | parlai/utils/bpe.py | facebookresearch/ParlAI | train | 10,943 |
7f3a0ca70b1fb5927cc4bdf3e35c98b19524a42b | [
"if not root:\n return [None for _ in range(k)]\nn, cur = (0, root)\nwhile cur:\n n += 1\n cur = cur.next\nnums = [n // k] * k\nfor i in range(n % k):\n nums[i] += 1\ncur, res, i = (root, [], 0)\nwhile i < k:\n j, prev = (0, cur)\n res.append(cur)\n while j < nums[i]:\n prev, cur = (cur,... | <|body_start_0|>
if not root:
return [None for _ in range(k)]
n, cur = (0, root)
while cur:
n += 1
cur = cur.next
nums = [n // k] * k
for i in range(n % k):
nums[i] += 1
cur, res, i = (root, [], 0)
while i < k:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def splitListToParts(self, root, k):
""":type root: ListNode :type k: int :rtype: List[ListNode]"""
<|body_0|>
def splitListToPartsCleanCode(self, root, k):
""":type root: ListNode :type k: int :rtype: List[ListNode]"""
<|body_1|>
<|end_skeleton|>
... | stack_v2_sparse_classes_36k_train_010583 | 3,965 | no_license | [
{
"docstring": ":type root: ListNode :type k: int :rtype: List[ListNode]",
"name": "splitListToParts",
"signature": "def splitListToParts(self, root, k)"
},
{
"docstring": ":type root: ListNode :type k: int :rtype: List[ListNode]",
"name": "splitListToPartsCleanCode",
"signature": "def s... | 2 | stack_v2_sparse_classes_30k_train_002138 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def splitListToParts(self, root, k): :type root: ListNode :type k: int :rtype: List[ListNode]
- def splitListToPartsCleanCode(self, root, k): :type root: ListNode :type k: int :r... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def splitListToParts(self, root, k): :type root: ListNode :type k: int :rtype: List[ListNode]
- def splitListToPartsCleanCode(self, root, k): :type root: ListNode :type k: int :r... | 810575368ecffa97677bdb51744d1f716140bbb1 | <|skeleton|>
class Solution:
def splitListToParts(self, root, k):
""":type root: ListNode :type k: int :rtype: List[ListNode]"""
<|body_0|>
def splitListToPartsCleanCode(self, root, k):
""":type root: ListNode :type k: int :rtype: List[ListNode]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def splitListToParts(self, root, k):
""":type root: ListNode :type k: int :rtype: List[ListNode]"""
if not root:
return [None for _ in range(k)]
n, cur = (0, root)
while cur:
n += 1
cur = cur.next
nums = [n // k] * k
... | the_stack_v2_python_sparse | S/SplitLinkedListinParts.py | bssrdf/pyleet | train | 2 | |
534837d0f7bf9977c629f194c52f99eb17ae3824 | [
"C = self.COEFFS[imt]\nmagML = ghasemi_bl_mw2ml(rup.mag)\nc0 = 0.0\nR = np.sqrt(dists.rhypo ** 2 + c0 ** 2)\nmean = C['a'] * np.exp(C['b'] * magML) * R ** (-1 * C['c'])\n'\\n # convert from mm/s to ln g using approximate ATC (1984) conversions\\n # as assumed in: \\n \\n McCue, K. (1993)... | <|body_start_0|>
C = self.COEFFS[imt]
magML = ghasemi_bl_mw2ml(rup.mag)
c0 = 0.0
R = np.sqrt(dists.rhypo ** 2 + c0 ** 2)
mean = C['a'] * np.exp(C['b'] * magML) * R ** (-1 * C['c'])
'\n # convert from mm/s to ln g using approximate ATC (1984) conversions\n # ... | Implement equation used to underpin the Structural design actions, part 4: Earthquake actions in Australia, Standards Australia AS 1170.4–2007. Equation coefficients as per Gaull, B. A., M. O. Michael-Leiba, and J. M. W. Rynn (1990). Probabilistic earthquake risk maps of Australia, Aust. J. Earth. Sci. 37, 169-187, doi... | GaullEtAL1990PGAfromPGV | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GaullEtAL1990PGAfromPGV:
"""Implement equation used to underpin the Structural design actions, part 4: Earthquake actions in Australia, Standards Australia AS 1170.4–2007. Equation coefficients as per Gaull, B. A., M. O. Michael-Leiba, and J. M. W. Rynn (1990). Probabilistic earthquake risk maps ... | stack_v2_sparse_classes_36k_train_010584 | 14,553 | no_license | [
{
"docstring": "See :meth:`superclass method <.base.GroundShakingIntensityModel.get_mean_and_stddevs>` for spec of input and result values.",
"name": "get_mean_and_stddevs",
"signature": "def get_mean_and_stddevs(self, sites, rup, dists, imt, stddev_types)"
},
{
"docstring": "Return total standa... | 2 | null | Implement the Python class `GaullEtAL1990PGAfromPGV` described below.
Class description:
Implement equation used to underpin the Structural design actions, part 4: Earthquake actions in Australia, Standards Australia AS 1170.4–2007. Equation coefficients as per Gaull, B. A., M. O. Michael-Leiba, and J. M. W. Rynn (199... | Implement the Python class `GaullEtAL1990PGAfromPGV` described below.
Class description:
Implement equation used to underpin the Structural design actions, part 4: Earthquake actions in Australia, Standards Australia AS 1170.4–2007. Equation coefficients as per Gaull, B. A., M. O. Michael-Leiba, and J. M. W. Rynn (199... | 86a3af0b52fe51470754291700f9a985b5177e2a | <|skeleton|>
class GaullEtAL1990PGAfromPGV:
"""Implement equation used to underpin the Structural design actions, part 4: Earthquake actions in Australia, Standards Australia AS 1170.4–2007. Equation coefficients as per Gaull, B. A., M. O. Michael-Leiba, and J. M. W. Rynn (1990). Probabilistic earthquake risk maps ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GaullEtAL1990PGAfromPGV:
"""Implement equation used to underpin the Structural design actions, part 4: Earthquake actions in Australia, Standards Australia AS 1170.4–2007. Equation coefficients as per Gaull, B. A., M. O. Michael-Leiba, and J. M. W. Rynn (1990). Probabilistic earthquake risk maps of Australia,... | the_stack_v2_python_sparse | ground_motion/gaull_1990.py | GeoscienceAustralia/NSHA2018 | train | 7 |
795ac7798c13b63e5d4303a88cfd81d96bf671f7 | [
"self.ws('fault_handler.enabled', True)\nself.ws('attitude_estimator.fault.suppress', False)\nself.ws_psim('sensors.leader.gyroscope.disabled', True)",
"self.cycle()\nself.cycle()\nif self.rs('attitude_estimator.valid'):\n raise TestCaseFailure(\"The attitude estimator shouldn't be valid after disabling the gy... | <|body_start_0|>
self.ws('fault_handler.enabled', True)
self.ws('attitude_estimator.fault.suppress', False)
self.ws_psim('sensors.leader.gyroscope.disabled', True)
<|end_body_0|>
<|body_start_1|>
self.cycle()
self.cycle()
if self.rs('attitude_estimator.valid'):
... | Test the basic functionality of the attitude estimator fault handler. | AttitudeFaultHandlerCase | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AttitudeFaultHandlerCase:
"""Test the basic functionality of the attitude estimator fault handler."""
def post_boot(self):
"""We need to enable the attitude estimator fault again and disable the gyroscope to simulate a sensor failure."""
<|body_0|>
def run(self):
... | stack_v2_sparse_classes_36k_train_010585 | 4,125 | permissive | [
{
"docstring": "We need to enable the attitude estimator fault again and disable the gyroscope to simulate a sensor failure.",
"name": "post_boot",
"signature": "def post_boot(self)"
},
{
"docstring": "Essentially we're going to disable the gyroscope, ensure that the attitude estimator becomes i... | 2 | stack_v2_sparse_classes_30k_test_000718 | Implement the Python class `AttitudeFaultHandlerCase` described below.
Class description:
Test the basic functionality of the attitude estimator fault handler.
Method signatures and docstrings:
- def post_boot(self): We need to enable the attitude estimator fault again and disable the gyroscope to simulate a sensor f... | Implement the Python class `AttitudeFaultHandlerCase` described below.
Class description:
Test the basic functionality of the attitude estimator fault handler.
Method signatures and docstrings:
- def post_boot(self): We need to enable the attitude estimator fault again and disable the gyroscope to simulate a sensor f... | 7256f52f7c5887af7fc8679b163629d1235fa1bb | <|skeleton|>
class AttitudeFaultHandlerCase:
"""Test the basic functionality of the attitude estimator fault handler."""
def post_boot(self):
"""We need to enable the attitude estimator fault again and disable the gyroscope to simulate a sensor failure."""
<|body_0|>
def run(self):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AttitudeFaultHandlerCase:
"""Test the basic functionality of the attitude estimator fault handler."""
def post_boot(self):
"""We need to enable the attitude estimator fault again and disable the gyroscope to simulate a sensor failure."""
self.ws('fault_handler.enabled', True)
self... | the_stack_v2_python_sparse | ptest/cases/attitude_estimator.py | pathfinder-for-autonomous-navigation/FlightSoftware | train | 8 |
fb2c366aab6b9d6868e732fd43933c904be0037d | [
"BaseType.__init__(self, cle)\nself.gorgees_max_contenu = 50\nself.etendre_editeur('go', 'nombre de gorgées au maximum', Entier, self, 'gorgees_max_contenu')\nself._attributs = {'gorgees_contenu': Attribut(lambda: self.gorgees_max_contenu)}",
"contenu = enveloppes['go']\ncontenu.apercu = '{objet.gorgees_max_conte... | <|body_start_0|>
BaseType.__init__(self, cle)
self.gorgees_max_contenu = 50
self.etendre_editeur('go', 'nombre de gorgées au maximum', Entier, self, 'gorgees_max_contenu')
self._attributs = {'gorgees_contenu': Attribut(lambda: self.gorgees_max_contenu)}
<|end_body_0|>
<|body_start_1|>
... | Type d'objet: tonneau d'eau. | TonneauEau | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TonneauEau:
"""Type d'objet: tonneau d'eau."""
def __init__(self, cle=''):
"""Constructeur de l'objet"""
<|body_0|>
def travailler_enveloppes(self, enveloppes):
"""Travail sur les enveloppes"""
<|body_1|>
def get_nom(self, nombre=1, pluriels=True):
... | stack_v2_sparse_classes_36k_train_010586 | 4,830 | permissive | [
{
"docstring": "Constructeur de l'objet",
"name": "__init__",
"signature": "def __init__(self, cle='')"
},
{
"docstring": "Travail sur les enveloppes",
"name": "travailler_enveloppes",
"signature": "def travailler_enveloppes(self, enveloppes)"
},
{
"docstring": "Retourne le nom c... | 4 | null | Implement the Python class `TonneauEau` described below.
Class description:
Type d'objet: tonneau d'eau.
Method signatures and docstrings:
- def __init__(self, cle=''): Constructeur de l'objet
- def travailler_enveloppes(self, enveloppes): Travail sur les enveloppes
- def get_nom(self, nombre=1, pluriels=True): Retou... | Implement the Python class `TonneauEau` described below.
Class description:
Type d'objet: tonneau d'eau.
Method signatures and docstrings:
- def __init__(self, cle=''): Constructeur de l'objet
- def travailler_enveloppes(self, enveloppes): Travail sur les enveloppes
- def get_nom(self, nombre=1, pluriels=True): Retou... | 7e93bff08cdf891352efba587e89c40f3b4a2301 | <|skeleton|>
class TonneauEau:
"""Type d'objet: tonneau d'eau."""
def __init__(self, cle=''):
"""Constructeur de l'objet"""
<|body_0|>
def travailler_enveloppes(self, enveloppes):
"""Travail sur les enveloppes"""
<|body_1|>
def get_nom(self, nombre=1, pluriels=True):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TonneauEau:
"""Type d'objet: tonneau d'eau."""
def __init__(self, cle=''):
"""Constructeur de l'objet"""
BaseType.__init__(self, cle)
self.gorgees_max_contenu = 50
self.etendre_editeur('go', 'nombre de gorgées au maximum', Entier, self, 'gorgees_max_contenu')
self.... | the_stack_v2_python_sparse | src/secondaires/navigation/types/tonneau_eau.py | vincent-lg/tsunami | train | 5 |
a119e3072d4c53a267a94ca999c4f2c51ab457a1 | [
"name = operation['name']\nif name in self.operations:\n raise ValueError('operation name already registered: {}'.format(name))\nself.operations[name] = _Operation({**operation, 'resource': self})",
"super().__init__()\nself.name = name or getattr(self, 'name', type(self).__name__.lower())\nself.description = ... | <|body_start_0|>
name = operation['name']
if name in self.operations:
raise ValueError('operation name already registered: {}'.format(name))
self.operations[name] = _Operation({**operation, 'resource': self})
<|end_body_0|>
<|body_start_1|>
super().__init__()
self.na... | Base class for a resource. | Resource | [
"Python-2.0",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Resource:
"""Base class for a resource."""
def _register_operation(self, **operation):
"""Register a resource operation."""
<|body_0|>
def __init__(self, name=None, description=None):
"""Initialize resource. Arguments can be alternatively declared as class or ins... | stack_v2_sparse_classes_36k_train_010587 | 10,795 | permissive | [
{
"docstring": "Register a resource operation.",
"name": "_register_operation",
"signature": "def _register_operation(self, **operation)"
},
{
"docstring": "Initialize resource. Arguments can be alternatively declared as class or instance variables. :param name: Short name of the resource. [clas... | 2 | stack_v2_sparse_classes_30k_train_005785 | Implement the Python class `Resource` described below.
Class description:
Base class for a resource.
Method signatures and docstrings:
- def _register_operation(self, **operation): Register a resource operation.
- def __init__(self, name=None, description=None): Initialize resource. Arguments can be alternatively dec... | Implement the Python class `Resource` described below.
Class description:
Base class for a resource.
Method signatures and docstrings:
- def _register_operation(self, **operation): Register a resource operation.
- def __init__(self, name=None, description=None): Initialize resource. Arguments can be alternatively dec... | 19e8d396aa9f3b6df28f773d06846d2bb58d1674 | <|skeleton|>
class Resource:
"""Base class for a resource."""
def _register_operation(self, **operation):
"""Register a resource operation."""
<|body_0|>
def __init__(self, name=None, description=None):
"""Initialize resource. Arguments can be alternatively declared as class or ins... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Resource:
"""Base class for a resource."""
def _register_operation(self, **operation):
"""Register a resource operation."""
name = operation['name']
if name in self.operations:
raise ValueError('operation name already registered: {}'.format(name))
self.operatio... | the_stack_v2_python_sparse | src/roax/resource.py | lliu8080/roax | train | 0 |
514627b3b78dbf4a626cea05caaa58a984ea2601 | [
"super().__init__(coordinates)\nself.animationFrames = self.spriteSheet.getStripImages(0, 520, 96, 120, 6)\nself.demoNumber = demoNumber\nself.animated = False\nself.image = self.animationFrames[0]",
"self.frameCount += 1\nself.rect = pg.Rect(self.coordinates[0] + 20, self.coordinates[1], 50, 120)\nif self.animat... | <|body_start_0|>
super().__init__(coordinates)
self.animationFrames = self.spriteSheet.getStripImages(0, 520, 96, 120, 6)
self.demoNumber = demoNumber
self.animated = False
self.image = self.animationFrames[0]
<|end_body_0|>
<|body_start_1|>
self.frameCount += 1
... | Create an instance of a rubber trap sprite for the demo. Attributes: demoNumber: An integer determining whether this sprite belongs to the first, second, third, or fourth demo animation. coordinates: A tuple location to blit the sprite on the screen. | DemoRubberTrapSprite | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DemoRubberTrapSprite:
"""Create an instance of a rubber trap sprite for the demo. Attributes: demoNumber: An integer determining whether this sprite belongs to the first, second, third, or fourth demo animation. coordinates: A tuple location to blit the sprite on the screen."""
def __init__(... | stack_v2_sparse_classes_36k_train_010588 | 38,283 | permissive | [
{
"docstring": "Init DemoRubberTrapSprite using the integer demoNumber and the tuple coordinates. Instance variables: animationFrames: A list of 11 Surface objects from the SpriteSheet object. animated: A boolean indicating whether or not the sprite is currently going through an animation. image: The current im... | 3 | stack_v2_sparse_classes_30k_train_010248 | Implement the Python class `DemoRubberTrapSprite` described below.
Class description:
Create an instance of a rubber trap sprite for the demo. Attributes: demoNumber: An integer determining whether this sprite belongs to the first, second, third, or fourth demo animation. coordinates: A tuple location to blit the spri... | Implement the Python class `DemoRubberTrapSprite` described below.
Class description:
Create an instance of a rubber trap sprite for the demo. Attributes: demoNumber: An integer determining whether this sprite belongs to the first, second, third, or fourth demo animation. coordinates: A tuple location to blit the spri... | 090f3749e102c5331136298356d543c8b4e8a9a5 | <|skeleton|>
class DemoRubberTrapSprite:
"""Create an instance of a rubber trap sprite for the demo. Attributes: demoNumber: An integer determining whether this sprite belongs to the first, second, third, or fourth demo animation. coordinates: A tuple location to blit the sprite on the screen."""
def __init__(... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DemoRubberTrapSprite:
"""Create an instance of a rubber trap sprite for the demo. Attributes: demoNumber: An integer determining whether this sprite belongs to the first, second, third, or fourth demo animation. coordinates: A tuple location to blit the sprite on the screen."""
def __init__(self, demoNum... | the_stack_v2_python_sparse | game/demo/demo_sprites.py | leoua7/clu-clu-game | train | 0 |
b0605ac1bad575d3900e5dfecf08e0c98688be03 | [
"for k, v in kwargs.items():\n setattr(self, k, v)\nself.save_dir = Path(self.save_dir)\nself.ckpt_path = self.save_dir.joinpath(f'epoch-{self.epoch}.pkl')\nself.video_path = Path(self.dataset_dir).joinpath('{}.h5'.format(self.dataset_name))\nif self.split_path != '':\n self.split_path = Path(self.split_path)... | <|body_start_0|>
for k, v in kwargs.items():
setattr(self, k, v)
self.save_dir = Path(self.save_dir)
self.ckpt_path = self.save_dir.joinpath(f'epoch-{self.epoch}.pkl')
self.video_path = Path(self.dataset_dir).joinpath('{}.h5'.format(self.dataset_name))
if self.split_p... | Config | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Config:
def __init__(self, **kwargs):
"""Configuration Class: set kwargs as class attributes with setattr"""
<|body_0|>
def __repr__(self):
"""Pretty-print configurations in alphabetical order"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
for k, v... | stack_v2_sparse_classes_36k_train_010589 | 7,105 | no_license | [
{
"docstring": "Configuration Class: set kwargs as class attributes with setattr",
"name": "__init__",
"signature": "def __init__(self, **kwargs)"
},
{
"docstring": "Pretty-print configurations in alphabetical order",
"name": "__repr__",
"signature": "def __repr__(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_010511 | Implement the Python class `Config` described below.
Class description:
Implement the Config class.
Method signatures and docstrings:
- def __init__(self, **kwargs): Configuration Class: set kwargs as class attributes with setattr
- def __repr__(self): Pretty-print configurations in alphabetical order | Implement the Python class `Config` described below.
Class description:
Implement the Config class.
Method signatures and docstrings:
- def __init__(self, **kwargs): Configuration Class: set kwargs as class attributes with setattr
- def __repr__(self): Pretty-print configurations in alphabetical order
<|skeleton|>
c... | f54b73ff1235b4a4808211ad12fb14f55d4e22e0 | <|skeleton|>
class Config:
def __init__(self, **kwargs):
"""Configuration Class: set kwargs as class attributes with setattr"""
<|body_0|>
def __repr__(self):
"""Pretty-print configurations in alphabetical order"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Config:
def __init__(self, **kwargs):
"""Configuration Class: set kwargs as class attributes with setattr"""
for k, v in kwargs.items():
setattr(self, k, v)
self.save_dir = Path(self.save_dir)
self.ckpt_path = self.save_dir.joinpath(f'epoch-{self.epoch}.pkl')
... | the_stack_v2_python_sparse | configs.py | jnzs1836/ERA-VSum | train | 6 | |
9e87621a742cc27090abe201cb9d9ce1d4ee1b53 | [
"li = values[0].strip().split()\nif len(li) == 1:\n li.append('')\nbefore, after = (li[0], li[1])\nsim1 = self.similiarity(key, before)\nsim2 = self.similiarity(key, after)\nif sim1 >= sim2:\n self.outputcollector.collect(key, before)\nelse:\n self.outputcollector.collect(key, after)",
"n = min(len(name1... | <|body_start_0|>
li = values[0].strip().split()
if len(li) == 1:
li.append('')
before, after = (li[0], li[1])
sim1 = self.similiarity(key, before)
sim2 = self.similiarity(key, after)
if sim1 >= sim2:
self.outputcollector.collect(key, before)
... | find the most simliar name for the given name, from the name before and after it e.g. (Adam, Ada Adams) -> (Adam, Ada) | Name2SimiliarName | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Name2SimiliarName:
"""find the most simliar name for the given name, from the name before and after it e.g. (Adam, Ada Adams) -> (Adam, Ada)"""
def reduce(self, key, values):
"""find the most simliar name for the given name @param key: the given name @param values: the name before an... | stack_v2_sparse_classes_36k_train_010590 | 1,271 | permissive | [
{
"docstring": "find the most simliar name for the given name @param key: the given name @param values: the name before and after the given name",
"name": "reduce",
"signature": "def reduce(self, key, values)"
},
{
"docstring": "compute the similarity between name1 and name2 e.g. similiarity(\"A... | 2 | stack_v2_sparse_classes_30k_test_000926 | Implement the Python class `Name2SimiliarName` described below.
Class description:
find the most simliar name for the given name, from the name before and after it e.g. (Adam, Ada Adams) -> (Adam, Ada)
Method signatures and docstrings:
- def reduce(self, key, values): find the most simliar name for the given name @pa... | Implement the Python class `Name2SimiliarName` described below.
Class description:
find the most simliar name for the given name, from the name before and after it e.g. (Adam, Ada Adams) -> (Adam, Ada)
Method signatures and docstrings:
- def reduce(self, key, values): find the most simliar name for the given name @pa... | 95d1806e2f4e89e960b76a685b1fba2eaa7d5142 | <|skeleton|>
class Name2SimiliarName:
"""find the most simliar name for the given name, from the name before and after it e.g. (Adam, Ada Adams) -> (Adam, Ada)"""
def reduce(self, key, values):
"""find the most simliar name for the given name @param key: the given name @param values: the name before an... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Name2SimiliarName:
"""find the most simliar name for the given name, from the name before and after it e.g. (Adam, Ada Adams) -> (Adam, Ada)"""
def reduce(self, key, values):
"""find the most simliar name for the given name @param key: the given name @param values: the name before and after the g... | the_stack_v2_python_sparse | nltk_contrib/hadoop/name_similarity/similiar_name_reducer.py | nltk/nltk_contrib | train | 145 |
4440f03ca27920ae1716f6c9a2e8bbc542da735b | [
"base.Action.__init__(self, self.__showDialog)\nself.__frame = frame\nself.__overlayList = overlayList\nself.__displayCtx = displayCtx",
"import fsleyes.about as aboutdlg\ndlg = aboutdlg.AboutDialog(self.__frame)\ndlg.Show()\nif not fslplatform.inSSHSession:\n dlg.CentreOnParent()"
] | <|body_start_0|>
base.Action.__init__(self, self.__showDialog)
self.__frame = frame
self.__overlayList = overlayList
self.__displayCtx = displayCtx
<|end_body_0|>
<|body_start_1|>
import fsleyes.about as aboutdlg
dlg = aboutdlg.AboutDialog(self.__frame)
dlg.Show(... | The ``AboutAction`` class is an action which displays an :class:`.AboutDialog`, containing information about *FSLeyes*. | AboutAction | [
"BSD-3-Clause",
"CC-BY-3.0",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AboutAction:
"""The ``AboutAction`` class is an action which displays an :class:`.AboutDialog`, containing information about *FSLeyes*."""
def __init__(self, overlayList, displayCtx, frame):
"""Create an ``AboutAction``. :arg overlayList: The :class:`.OverlayList`. :arg displayCtx: T... | stack_v2_sparse_classes_36k_train_010591 | 1,307 | permissive | [
{
"docstring": "Create an ``AboutAction``. :arg overlayList: The :class:`.OverlayList`. :arg displayCtx: The master :class:`.DisplayContext`. :arg frame: The :class:`.FSLeyesFrame`.",
"name": "__init__",
"signature": "def __init__(self, overlayList, displayCtx, frame)"
},
{
"docstring": "Creates... | 2 | null | Implement the Python class `AboutAction` described below.
Class description:
The ``AboutAction`` class is an action which displays an :class:`.AboutDialog`, containing information about *FSLeyes*.
Method signatures and docstrings:
- def __init__(self, overlayList, displayCtx, frame): Create an ``AboutAction``. :arg o... | Implement the Python class `AboutAction` described below.
Class description:
The ``AboutAction`` class is an action which displays an :class:`.AboutDialog`, containing information about *FSLeyes*.
Method signatures and docstrings:
- def __init__(self, overlayList, displayCtx, frame): Create an ``AboutAction``. :arg o... | 46ccb4fe2b2346eb57576247f49714032b61307a | <|skeleton|>
class AboutAction:
"""The ``AboutAction`` class is an action which displays an :class:`.AboutDialog`, containing information about *FSLeyes*."""
def __init__(self, overlayList, displayCtx, frame):
"""Create an ``AboutAction``. :arg overlayList: The :class:`.OverlayList`. :arg displayCtx: T... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AboutAction:
"""The ``AboutAction`` class is an action which displays an :class:`.AboutDialog`, containing information about *FSLeyes*."""
def __init__(self, overlayList, displayCtx, frame):
"""Create an ``AboutAction``. :arg overlayList: The :class:`.OverlayList`. :arg displayCtx: The master :cl... | the_stack_v2_python_sparse | fsleyes/actions/about.py | sanjayankur31/fsleyes | train | 1 |
c046327833a99c1f31663639e071facc92067f92 | [
"authenticated_user_id = token_auth.current_user()\nif UserService.is_user_blocked(authenticated_user_id):\n return ({'Error': 'User is on read only mode', 'SubCode': 'ReadOnly'}, 403)\ntry:\n chat_dto = ChatMessageDTO(request.get_json())\n chat_dto.user_id = authenticated_user_id\n chat_dto.project_id ... | <|body_start_0|>
authenticated_user_id = token_auth.current_user()
if UserService.is_user_blocked(authenticated_user_id):
return ({'Error': 'User is on read only mode', 'SubCode': 'ReadOnly'}, 403)
try:
chat_dto = ChatMessageDTO(request.get_json())
chat_dto.us... | CommentsProjectsAllAPI | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CommentsProjectsAllAPI:
def post(self, project_id):
"""Add a message to project chat --- tags: - comments produces: - application/json parameters: - in: header name: Authorization description: Base64 encoded session token required: true type: string default: Token sessionTokenHere== - na... | stack_v2_sparse_classes_36k_train_010592 | 10,563 | permissive | [
{
"docstring": "Add a message to project chat --- tags: - comments produces: - application/json parameters: - in: header name: Authorization description: Base64 encoded session token required: true type: string default: Token sessionTokenHere== - name: project_id in: path description: Project ID to attach the c... | 2 | null | Implement the Python class `CommentsProjectsAllAPI` described below.
Class description:
Implement the CommentsProjectsAllAPI class.
Method signatures and docstrings:
- def post(self, project_id): Add a message to project chat --- tags: - comments produces: - application/json parameters: - in: header name: Authorizati... | Implement the Python class `CommentsProjectsAllAPI` described below.
Class description:
Implement the CommentsProjectsAllAPI class.
Method signatures and docstrings:
- def post(self, project_id): Add a message to project chat --- tags: - comments produces: - application/json parameters: - in: header name: Authorizati... | 45bf3937c74902226096aee5b49e7abea62df524 | <|skeleton|>
class CommentsProjectsAllAPI:
def post(self, project_id):
"""Add a message to project chat --- tags: - comments produces: - application/json parameters: - in: header name: Authorization description: Base64 encoded session token required: true type: string default: Token sessionTokenHere== - na... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CommentsProjectsAllAPI:
def post(self, project_id):
"""Add a message to project chat --- tags: - comments produces: - application/json parameters: - in: header name: Authorization description: Base64 encoded session token required: true type: string default: Token sessionTokenHere== - name: project_id... | the_stack_v2_python_sparse | backend/api/comments/resources.py | hotosm/tasking-manager | train | 526 | |
8489e330dceade6f5b84f4af2d31409da85f9eef | [
"if not root1 and (not root2):\n return True\nif not root1 or not root2:\n return False\nq1 = [root1]\nq2 = [root2]\nwhile q1 and q2:\n v1 = self.helper(q1)\n v2 = self.helper(q2)\n if v1 != v2:\n return False\nreturn not q1 and (not q2)",
"while True:\n node = stack.pop()\n if node.le... | <|body_start_0|>
if not root1 and (not root2):
return True
if not root1 or not root2:
return False
q1 = [root1]
q2 = [root2]
while q1 and q2:
v1 = self.helper(q1)
v2 = self.helper(q2)
if v1 != v2:
return ... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def leafSimilar(self, root1, root2):
""":type root1: TreeNode :type root2: TreeNode :rtype: bool"""
<|body_0|>
def helper(self, stack):
""":param stack:List :return:"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not root1 and (not roo... | stack_v2_sparse_classes_36k_train_010593 | 1,551 | no_license | [
{
"docstring": ":type root1: TreeNode :type root2: TreeNode :rtype: bool",
"name": "leafSimilar",
"signature": "def leafSimilar(self, root1, root2)"
},
{
"docstring": ":param stack:List :return:",
"name": "helper",
"signature": "def helper(self, stack)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def leafSimilar(self, root1, root2): :type root1: TreeNode :type root2: TreeNode :rtype: bool
- def helper(self, stack): :param stack:List :return: | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def leafSimilar(self, root1, root2): :type root1: TreeNode :type root2: TreeNode :rtype: bool
- def helper(self, stack): :param stack:List :return:
<|skeleton|>
class Solution:
... | 807ba32ed7802b756e93dfe44264dac5bb9317a0 | <|skeleton|>
class Solution:
def leafSimilar(self, root1, root2):
""":type root1: TreeNode :type root2: TreeNode :rtype: bool"""
<|body_0|>
def helper(self, stack):
""":param stack:List :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def leafSimilar(self, root1, root2):
""":type root1: TreeNode :type root2: TreeNode :rtype: bool"""
if not root1 and (not root2):
return True
if not root1 or not root2:
return False
q1 = [root1]
q2 = [root2]
while q1 and q2:
... | the_stack_v2_python_sparse | num801_900/num871_880/num872.py | guozhaoxin/leetcode | train | 0 | |
fe699ee0cbe2831fdfd71707a98ae51fba00b641 | [
"logging.info('## SETUP METHOD ##')\nlogging.info('# Initializing the webdriver.')\nself.ffprofile = self.create_ffprofile()\nself.driver = webdriver.Firefox(self.ffprofile)\nself.driver.maximize_window()\nself.driver.implicitly_wait(5)\nself.driver.get('http://the-internet.herokuapp.com/')",
"logging.info('## TE... | <|body_start_0|>
logging.info('## SETUP METHOD ##')
logging.info('# Initializing the webdriver.')
self.ffprofile = self.create_ffprofile()
self.driver = webdriver.Firefox(self.ffprofile)
self.driver.maximize_window()
self.driver.implicitly_wait(5)
self.driver.get(... | This class is for instantiating web driver instances. | DriverManagerFirefox | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DriverManagerFirefox:
"""This class is for instantiating web driver instances."""
def setUp(self):
"""This method is to instantiate the web driver instance."""
<|body_0|>
def tearDown(self):
"""This is teardown method. It is to capture the screenshots for failed ... | stack_v2_sparse_classes_36k_train_010594 | 3,946 | permissive | [
{
"docstring": "This method is to instantiate the web driver instance.",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "This is teardown method. It is to capture the screenshots for failed test cases, & to remove web driver object.",
"name": "tearDown",
"signature": "... | 4 | stack_v2_sparse_classes_30k_val_000757 | Implement the Python class `DriverManagerFirefox` described below.
Class description:
This class is for instantiating web driver instances.
Method signatures and docstrings:
- def setUp(self): This method is to instantiate the web driver instance.
- def tearDown(self): This is teardown method. It is to capture the sc... | Implement the Python class `DriverManagerFirefox` described below.
Class description:
This class is for instantiating web driver instances.
Method signatures and docstrings:
- def setUp(self): This method is to instantiate the web driver instance.
- def tearDown(self): This is teardown method. It is to capture the sc... | 65513cb85eccb1ae3fae4ac3625d0e6878720ec8 | <|skeleton|>
class DriverManagerFirefox:
"""This class is for instantiating web driver instances."""
def setUp(self):
"""This method is to instantiate the web driver instance."""
<|body_0|>
def tearDown(self):
"""This is teardown method. It is to capture the screenshots for failed ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DriverManagerFirefox:
"""This class is for instantiating web driver instances."""
def setUp(self):
"""This method is to instantiate the web driver instance."""
logging.info('## SETUP METHOD ##')
logging.info('# Initializing the webdriver.')
self.ffprofile = self.create_ffp... | the_stack_v2_python_sparse | attic/2019/contributions-2019/open/mudaliar-yptu/PWAF/utility/drivermanager.py | Agriad/devops-course | train | 0 |
2fe58994e52c2caac72556dcdc9977e842393e6c | [
"l = len(A)\nif l < 3:\n return False\nflag = l - 1\nfor i in range(1, l):\n if A[i - 1] < A[i]:\n continue\n elif A[i - 1] == A[i]:\n return False\n else:\n flag = i - 1\n break\nif flag == l - 1 or flag == 0:\n return False\nreturn all([A[i] > A[i + 1] for i in range(fla... | <|body_start_0|>
l = len(A)
if l < 3:
return False
flag = l - 1
for i in range(1, l):
if A[i - 1] < A[i]:
continue
elif A[i - 1] == A[i]:
return False
else:
flag = i - 1
break
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def validMountainArray(self, A):
""":type A: List[int] :rtype: bool 36 ms"""
<|body_0|>
def validMountainArray_1(self, A):
""":type A: List[int] :rtype: bool 36ms"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
l = len(A)
if l < 3:... | stack_v2_sparse_classes_36k_train_010595 | 2,021 | no_license | [
{
"docstring": ":type A: List[int] :rtype: bool 36 ms",
"name": "validMountainArray",
"signature": "def validMountainArray(self, A)"
},
{
"docstring": ":type A: List[int] :rtype: bool 36ms",
"name": "validMountainArray_1",
"signature": "def validMountainArray_1(self, A)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def validMountainArray(self, A): :type A: List[int] :rtype: bool 36 ms
- def validMountainArray_1(self, A): :type A: List[int] :rtype: bool 36ms | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def validMountainArray(self, A): :type A: List[int] :rtype: bool 36 ms
- def validMountainArray_1(self, A): :type A: List[int] :rtype: bool 36ms
<|skeleton|>
class Solution:
... | 679a2b246b8b6bb7fc55ed1c8096d3047d6d4461 | <|skeleton|>
class Solution:
def validMountainArray(self, A):
""":type A: List[int] :rtype: bool 36 ms"""
<|body_0|>
def validMountainArray_1(self, A):
""":type A: List[int] :rtype: bool 36ms"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def validMountainArray(self, A):
""":type A: List[int] :rtype: bool 36 ms"""
l = len(A)
if l < 3:
return False
flag = l - 1
for i in range(1, l):
if A[i - 1] < A[i]:
continue
elif A[i - 1] == A[i]:
... | the_stack_v2_python_sparse | ValidMountainArray_941.py | 953250587/leetcode-python | train | 2 | |
7329cbc75d49e312ae2aee2459f7932de250be7d | [
"self.callbacks = callbacks\nself.queue = queue\nself.fast = fast",
"for name in self.callbacks:\n Module = _loader.load_module(name, _models.Callback)\n if Module:\n module = Module()\n module.__name__ = name\n with _magic.Invocator(module):\n module.run(data)",
"for _, bu... | <|body_start_0|>
self.callbacks = callbacks
self.queue = queue
self.fast = fast
<|end_body_0|>
<|body_start_1|>
for name in self.callbacks:
Module = _loader.load_module(name, _models.Callback)
if Module:
module = Module()
module.__... | Core multiprocessed class that processes the process-based evidence(s) asynchronously. | Process | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Process:
"""Core multiprocessed class that processes the process-based evidence(s) asynchronously."""
def __init__(self, callbacks, queue, fast=False):
""".. py:function:: __init__(self, callbacks, queue) Initialization method for the class. :param self: current class instance :type ... | stack_v2_sparse_classes_36k_train_010596 | 10,116 | permissive | [
{
"docstring": ".. py:function:: __init__(self, callbacks, queue) Initialization method for the class. :param self: current class instance :type self: class :param callbacks: list containing the name of the :code:`models.Callback` modules to invoke :type callbacks: list :param fast: flag specifying wether YARA ... | 4 | stack_v2_sparse_classes_30k_train_011911 | Implement the Python class `Process` described below.
Class description:
Core multiprocessed class that processes the process-based evidence(s) asynchronously.
Method signatures and docstrings:
- def __init__(self, callbacks, queue, fast=False): .. py:function:: __init__(self, callbacks, queue) Initialization method ... | Implement the Python class `Process` described below.
Class description:
Core multiprocessed class that processes the process-based evidence(s) asynchronously.
Method signatures and docstrings:
- def __init__(self, callbacks, queue, fast=False): .. py:function:: __init__(self, callbacks, queue) Initialization method ... | d485071065174b2fb4ed0c33d31e45243ff2ce20 | <|skeleton|>
class Process:
"""Core multiprocessed class that processes the process-based evidence(s) asynchronously."""
def __init__(self, callbacks, queue, fast=False):
""".. py:function:: __init__(self, callbacks, queue) Initialization method for the class. :param self: current class instance :type ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Process:
"""Core multiprocessed class that processes the process-based evidence(s) asynchronously."""
def __init__(self, callbacks, queue, fast=False):
""".. py:function:: __init__(self, callbacks, queue) Initialization method for the class. :param self: current class instance :type self: class :... | the_stack_v2_python_sparse | plast/framework/core/processors.py | Grukz/plast | train | 0 |
dcaf7f5b15aa6b7a8631fab79d2ff601b3d56c9a | [
"auth_token = helpers.get_auth_token_for_testing()\nbatch = {'user_id': 'erik', 'auth_token': auth_token, 'annotations': [dict(account='r123', key='owner', value='erik'), dict(account='r124', key='owner', value='erik')]}\nresponse = self.client.post('/add', data=json.dumps(batch), content_type='application/json')\n... | <|body_start_0|>
auth_token = helpers.get_auth_token_for_testing()
batch = {'user_id': 'erik', 'auth_token': auth_token, 'annotations': [dict(account='r123', key='owner', value='erik'), dict(account='r124', key='owner', value='erik')]}
response = self.client.post('/add', data=json.dumps(batch), ... | Unit tests for the "/add" API endpoint. | AddTestCase | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AddTestCase:
"""Unit tests for the "/add" API endpoint."""
def test_add_in_body(self):
"""Test the "/add" endpoint with a batch in the body of the request."""
<|body_0|>
def test_add_query_params(self):
"""Test the "/add" endpoint with a batch in a query paramete... | stack_v2_sparse_classes_36k_train_010597 | 25,230 | no_license | [
{
"docstring": "Test the \"/add\" endpoint with a batch in the body of the request.",
"name": "test_add_in_body",
"signature": "def test_add_in_body(self)"
},
{
"docstring": "Test the \"/add\" endpoint with a batch in a query parameter.",
"name": "test_add_query_params",
"signature": "de... | 3 | stack_v2_sparse_classes_30k_train_011282 | Implement the Python class `AddTestCase` described below.
Class description:
Unit tests for the "/add" API endpoint.
Method signatures and docstrings:
- def test_add_in_body(self): Test the "/add" endpoint with a batch in the body of the request.
- def test_add_query_params(self): Test the "/add" endpoint with a batc... | Implement the Python class `AddTestCase` described below.
Class description:
Unit tests for the "/add" API endpoint.
Method signatures and docstrings:
- def test_add_in_body(self): Test the "/add" endpoint with a batch in the body of the request.
- def test_add_query_params(self): Test the "/add" endpoint with a batc... | a7d49d463ea97900333885dd29cb2e70c1a0fdb9 | <|skeleton|>
class AddTestCase:
"""Unit tests for the "/add" API endpoint."""
def test_add_in_body(self):
"""Test the "/add" endpoint with a batch in the body of the request."""
<|body_0|>
def test_add_query_params(self):
"""Test the "/add" endpoint with a batch in a query paramete... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AddTestCase:
"""Unit tests for the "/add" API endpoint."""
def test_add_in_body(self):
"""Test the "/add" endpoint with a batch in the body of the request."""
auth_token = helpers.get_auth_token_for_testing()
batch = {'user_id': 'erik', 'auth_token': auth_token, 'annotations': [di... | the_stack_v2_python_sparse | annotationDatabase/api/tests.py | erikwestra/ripple-annotation-database | train | 0 |
68f426523efe3faa1262c0459a2b05294d258f7c | [
"kwargs = {}\ncurrent_key = None\nargs = deque(argv)\nwhile args:\n arg = args.popleft()\n if arg == '--':\n ArgumentHelper.set_kwargs_flag(kwargs, current_key)\n elif arg.startswith('--'):\n ArgumentHelper.set_kwargs_flag(kwargs, current_key)\n current_key = arg[2:]\n if '=' in... | <|body_start_0|>
kwargs = {}
current_key = None
args = deque(argv)
while args:
arg = args.popleft()
if arg == '--':
ArgumentHelper.set_kwargs_flag(kwargs, current_key)
elif arg.startswith('--'):
ArgumentHelper.set_kwargs... | Helper for handling command line arguments. | ArgumentHelper | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ArgumentHelper:
"""Helper for handling command line arguments."""
def argv_to_dict(argv):
"""Given a list of keyword arguments, parse into a kwargs dictionary. Each argument should either start with '--' indicating a key, or not, indicating a value. Also supports "--key=value" syntax... | stack_v2_sparse_classes_36k_train_010598 | 2,740 | no_license | [
{
"docstring": "Given a list of keyword arguments, parse into a kwargs dictionary. Each argument should either start with '--' indicating a key, or not, indicating a value. Also supports \"--key=value\" syntax. True will be used for the value of a key that does not have a given value. Multiple values will be jo... | 3 | stack_v2_sparse_classes_30k_train_019901 | Implement the Python class `ArgumentHelper` described below.
Class description:
Helper for handling command line arguments.
Method signatures and docstrings:
- def argv_to_dict(argv): Given a list of keyword arguments, parse into a kwargs dictionary. Each argument should either start with '--' indicating a key, or no... | Implement the Python class `ArgumentHelper` described below.
Class description:
Helper for handling command line arguments.
Method signatures and docstrings:
- def argv_to_dict(argv): Given a list of keyword arguments, parse into a kwargs dictionary. Each argument should either start with '--' indicating a key, or no... | 48a539bee8a58a007b20e6c034eb2145ec4e2a88 | <|skeleton|>
class ArgumentHelper:
"""Helper for handling command line arguments."""
def argv_to_dict(argv):
"""Given a list of keyword arguments, parse into a kwargs dictionary. Each argument should either start with '--' indicating a key, or not, indicating a value. Also supports "--key=value" syntax... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ArgumentHelper:
"""Helper for handling command line arguments."""
def argv_to_dict(argv):
"""Given a list of keyword arguments, parse into a kwargs dictionary. Each argument should either start with '--' indicating a key, or not, indicating a value. Also supports "--key=value" syntax. True will b... | the_stack_v2_python_sparse | herring/argument_helper.py | royw/Herring | train | 0 |
ade94480820a1946ab366bf0bd35ab9677c6ec5d | [
"self.film_max_miller = film_max_miller\nself.substrate_max_miller = substrate_max_miller\nself.kwargs = kwargs\nsuper().__init__(**kwargs)",
"vector_sets = []\nfor f in film_millers:\n film_slab = SlabGenerator(self.film, f, 20, 15, primitive=False).get_slab()\n film_vectors = reduce_vectors(film_slab.latt... | <|body_start_0|>
self.film_max_miller = film_max_miller
self.substrate_max_miller = substrate_max_miller
self.kwargs = kwargs
super().__init__(**kwargs)
<|end_body_0|>
<|body_start_1|>
vector_sets = []
for f in film_millers:
film_slab = SlabGenerator(self.fil... | This class applies a set of search criteria to identify suitable substrates for film growth. It first uses a topoplogical search by Zur and McGill to identify matching super-lattices on various faces of the two materials. Additional criteria can then be used to identify the most suitable substrate. Currently, the only ... | SubstrateAnalyzer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SubstrateAnalyzer:
"""This class applies a set of search criteria to identify suitable substrates for film growth. It first uses a topoplogical search by Zur and McGill to identify matching super-lattices on various faces of the two materials. Additional criteria can then be used to identify the ... | stack_v2_sparse_classes_36k_train_010599 | 7,376 | permissive | [
{
"docstring": "Initializes the substrate analyzer Args: zslgen(ZSLGenerator): Defaults to a ZSLGenerator with standard tolerances, but can be fed one with custom tolerances film_max_miller(int): maximum miller index to generate for film surfaces substrate_max_miller(int): maximum miller index to generate for s... | 3 | stack_v2_sparse_classes_30k_train_020058 | Implement the Python class `SubstrateAnalyzer` described below.
Class description:
This class applies a set of search criteria to identify suitable substrates for film growth. It first uses a topoplogical search by Zur and McGill to identify matching super-lattices on various faces of the two materials. Additional cri... | Implement the Python class `SubstrateAnalyzer` described below.
Class description:
This class applies a set of search criteria to identify suitable substrates for film growth. It first uses a topoplogical search by Zur and McGill to identify matching super-lattices on various faces of the two materials. Additional cri... | 6dd3b42f569397fa1a86a16fcfaaa29534abb8ca | <|skeleton|>
class SubstrateAnalyzer:
"""This class applies a set of search criteria to identify suitable substrates for film growth. It first uses a topoplogical search by Zur and McGill to identify matching super-lattices on various faces of the two materials. Additional criteria can then be used to identify the ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SubstrateAnalyzer:
"""This class applies a set of search criteria to identify suitable substrates for film growth. It first uses a topoplogical search by Zur and McGill to identify matching super-lattices on various faces of the two materials. Additional criteria can then be used to identify the most suitable... | the_stack_v2_python_sparse | pymatgen/analysis/interfaces/substrate_analyzer.py | Zhuoying/pymatgen | train | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.