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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
63fbd1b34b2ff4ce29eb2cd8ac26d2f9b9de7c35 | [
"try:\n forgot_password_request = ForgotPasswordRequest.objects.get(token=token)\n request_time = forgot_password_request.request_time\n expiry_time_min = forgot_password_request.expiry_time\n current_time = datetime.datetime.utcnow().replace(tzinfo=utc)\n expiry_time = request_time + datetime.timede... | <|body_start_0|>
try:
forgot_password_request = ForgotPasswordRequest.objects.get(token=token)
request_time = forgot_password_request.request_time
expiry_time_min = forgot_password_request.expiry_time
current_time = datetime.datetime.utcnow().replace(tzinfo=utc)
... | Forgot Password Handler | ForgotPassword | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ForgotPassword:
"""Forgot Password Handler"""
def get(self, request, token):
"""Forgot Password Token Validator"""
<|body_0|>
def post(self, request, token):
"""Forgot Password Password Change"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
try:... | stack_v2_sparse_classes_36k_train_018300 | 45,124 | no_license | [
{
"docstring": "Forgot Password Token Validator",
"name": "get",
"signature": "def get(self, request, token)"
},
{
"docstring": "Forgot Password Password Change",
"name": "post",
"signature": "def post(self, request, token)"
}
] | 2 | stack_v2_sparse_classes_30k_train_020725 | Implement the Python class `ForgotPassword` described below.
Class description:
Forgot Password Handler
Method signatures and docstrings:
- def get(self, request, token): Forgot Password Token Validator
- def post(self, request, token): Forgot Password Password Change | Implement the Python class `ForgotPassword` described below.
Class description:
Forgot Password Handler
Method signatures and docstrings:
- def get(self, request, token): Forgot Password Token Validator
- def post(self, request, token): Forgot Password Password Change
<|skeleton|>
class ForgotPassword:
"""Forgot... | dbcf886a7cf2d2fb12400a0f1b3e85e8da5cd56b | <|skeleton|>
class ForgotPassword:
"""Forgot Password Handler"""
def get(self, request, token):
"""Forgot Password Token Validator"""
<|body_0|>
def post(self, request, token):
"""Forgot Password Password Change"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ForgotPassword:
"""Forgot Password Handler"""
def get(self, request, token):
"""Forgot Password Token Validator"""
try:
forgot_password_request = ForgotPasswordRequest.objects.get(token=token)
request_time = forgot_password_request.request_time
expiry_t... | the_stack_v2_python_sparse | Python/ixcoin_backend/api/accounts/views.py | ionixx-tech/ix_code_samples | train | 0 |
f2dd899a236ac2731771204d5e28dae5652024f3 | [
"startTime = datetime.datetime.now()\nclient = dml.pymongo.MongoClient()\nrepo = client.repo\nrepo.authenticate('xcao19', 'xcao19')\nurl = 'https://data.boston.gov/dataset/6220d948-eae2-4e4b-8723-2dc8e67722a3/resource/12cb3883-56f5-47de-afa5-3b1cf61b257b/download/tmpwvgcmcba.csv'\ndf = pd.read_csv(url, encoding='IS... | <|body_start_0|>
startTime = datetime.datetime.now()
client = dml.pymongo.MongoClient()
repo = client.repo
repo.authenticate('xcao19', 'xcao19')
url = 'https://data.boston.gov/dataset/6220d948-eae2-4e4b-8723-2dc8e67722a3/resource/12cb3883-56f5-47de-afa5-3b1cf61b257b/download/tmpw... | crimes | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class crimes:
def execute(trial=False):
"""Retrieve some data sets (not using the API here for the sake of simplicity)."""
<|body_0|>
def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None):
"""Create the provenance document describing everything happen... | stack_v2_sparse_classes_36k_train_018301 | 3,364 | no_license | [
{
"docstring": "Retrieve some data sets (not using the API here for the sake of simplicity).",
"name": "execute",
"signature": "def execute(trial=False)"
},
{
"docstring": "Create the provenance document describing everything happening in this script. Each run of the script will generate a new d... | 2 | null | Implement the Python class `crimes` described below.
Class description:
Implement the crimes class.
Method signatures and docstrings:
- def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity).
- def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): ... | Implement the Python class `crimes` described below.
Class description:
Implement the crimes class.
Method signatures and docstrings:
- def execute(trial=False): Retrieve some data sets (not using the API here for the sake of simplicity).
- def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): ... | 90284cf3debbac36eead07b8d2339cdd191b86cf | <|skeleton|>
class crimes:
def execute(trial=False):
"""Retrieve some data sets (not using the API here for the sake of simplicity)."""
<|body_0|>
def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None):
"""Create the provenance document describing everything happen... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class crimes:
def execute(trial=False):
"""Retrieve some data sets (not using the API here for the sake of simplicity)."""
startTime = datetime.datetime.now()
client = dml.pymongo.MongoClient()
repo = client.repo
repo.authenticate('xcao19', 'xcao19')
url = 'https://da... | the_stack_v2_python_sparse | xcao19/crimes.py | maximega/course-2019-spr-proj | train | 2 | |
80e130debf343b1ea7769e77323115739ddc4391 | [
"if not graph.is_directed():\n raise ValueError('the graph is not directed')\nself.graph = graph\nself.T = dict()\nfor source in self.graph.iternodes():\n self.T[source] = dict()\n for target in self.graph.iternodes():\n self.T[source][target] = False\n self.T[source][source] = True\nfor edge in ... | <|body_start_0|>
if not graph.is_directed():
raise ValueError('the graph is not directed')
self.graph = graph
self.T = dict()
for source in self.graph.iternodes():
self.T[source] = dict()
for target in self.graph.iternodes():
self.T[sou... | Based on the Floyd-Warshall algorithm, O(V**3) time. | TransitiveClosure | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TransitiveClosure:
"""Based on the Floyd-Warshall algorithm, O(V**3) time."""
def __init__(self, graph):
"""The algorithm initialization."""
<|body_0|>
def run(self):
"""Executable pseudocode."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if n... | stack_v2_sparse_classes_36k_train_018302 | 3,816 | permissive | [
{
"docstring": "The algorithm initialization.",
"name": "__init__",
"signature": "def __init__(self, graph)"
},
{
"docstring": "Executable pseudocode.",
"name": "run",
"signature": "def run(self)"
}
] | 2 | stack_v2_sparse_classes_30k_val_000262 | Implement the Python class `TransitiveClosure` described below.
Class description:
Based on the Floyd-Warshall algorithm, O(V**3) time.
Method signatures and docstrings:
- def __init__(self, graph): The algorithm initialization.
- def run(self): Executable pseudocode. | Implement the Python class `TransitiveClosure` described below.
Class description:
Based on the Floyd-Warshall algorithm, O(V**3) time.
Method signatures and docstrings:
- def __init__(self, graph): The algorithm initialization.
- def run(self): Executable pseudocode.
<|skeleton|>
class TransitiveClosure:
"""Bas... | 0ff4ae303e8824e6bb8474d23b29a7b3e5ed8e60 | <|skeleton|>
class TransitiveClosure:
"""Based on the Floyd-Warshall algorithm, O(V**3) time."""
def __init__(self, graph):
"""The algorithm initialization."""
<|body_0|>
def run(self):
"""Executable pseudocode."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TransitiveClosure:
"""Based on the Floyd-Warshall algorithm, O(V**3) time."""
def __init__(self, graph):
"""The algorithm initialization."""
if not graph.is_directed():
raise ValueError('the graph is not directed')
self.graph = graph
self.T = dict()
for... | the_stack_v2_python_sparse | graphtheory/algorithms/closure.py | kgashok/graphs-dict | train | 0 |
0f9c22d0619771241895bda5077b516105d52d89 | [
"self.x = x\nself.y = y\nself.N = np.shape(x)[0]",
"prod = 0\nfor i in range(self.N):\n for j in range(self.N):\n prod = prod + self.x[i, j] * np.conj(self.y[i, j])\nreturn prod"
] | <|body_start_0|>
self.x = x
self.y = y
self.N = np.shape(x)[0]
<|end_body_0|>
<|body_start_1|>
prod = 0
for i in range(self.N):
for j in range(self.N):
prod = prod + self.x[i, j] * np.conj(self.y[i, j])
return prod
<|end_body_1|>
| 2—D inner-product | inner_prod_2D | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class inner_prod_2D:
"""2—D inner-product"""
def __init__(self, x, y):
"""x,y: two 2-D signals"""
<|body_0|>
def solve(self):
"""\\\\\\ METHOD: Compute the inner product"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.x = x
self.y = y
... | stack_v2_sparse_classes_36k_train_018303 | 4,947 | no_license | [
{
"docstring": "x,y: two 2-D signals",
"name": "__init__",
"signature": "def __init__(self, x, y)"
},
{
"docstring": "\\\\\\\\\\\\ METHOD: Compute the inner product",
"name": "solve",
"signature": "def solve(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_017040 | Implement the Python class `inner_prod_2D` described below.
Class description:
2—D inner-product
Method signatures and docstrings:
- def __init__(self, x, y): x,y: two 2-D signals
- def solve(self): \\\\\\ METHOD: Compute the inner product | Implement the Python class `inner_prod_2D` described below.
Class description:
2—D inner-product
Method signatures and docstrings:
- def __init__(self, x, y): x,y: two 2-D signals
- def solve(self): \\\\\\ METHOD: Compute the inner product
<|skeleton|>
class inner_prod_2D:
"""2—D inner-product"""
def __init... | b72322cfc6d81c996117cea2160ee312da62d3ed | <|skeleton|>
class inner_prod_2D:
"""2—D inner-product"""
def __init__(self, x, y):
"""x,y: two 2-D signals"""
<|body_0|>
def solve(self):
"""\\\\\\ METHOD: Compute the inner product"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class inner_prod_2D:
"""2—D inner-product"""
def __init__(self, x, y):
"""x,y: two 2-D signals"""
self.x = x
self.y = y
self.N = np.shape(x)[0]
def solve(self):
"""\\\\\\ METHOD: Compute the inner product"""
prod = 0
for i in range(self.N):
... | the_stack_v2_python_sparse | 2D Signal Processing and Image De-noising/discrete_signal.py | FG-14/Signals-and-Information-Processing-DSP- | train | 0 |
05cbeb00c30676f18d007c89255d8e39011280e3 | [
"self.request = None\nif isinstance(page, bytes):\n self.src = page\nelif _os.path.exists(page):\n with open(page, 'rb') as fp:\n self.src = fp.read()\nelse:\n better_headers = headers if headers else HEADERS.copy()\n self.request = _requests.get(page, headers=better_headers)\n if not self.req... | <|body_start_0|>
self.request = None
if isinstance(page, bytes):
self.src = page
elif _os.path.exists(page):
with open(page, 'rb') as fp:
self.src = fp.read()
else:
better_headers = headers if headers else HEADERS.copy()
sel... | Class TagFinder can be used to find and store elements from a given web page or markup | TagFinder | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TagFinder:
"""Class TagFinder can be used to find and store elements from a given web page or markup"""
def __init__(self, page, headers=None):
"""Initializes this tag finder"""
<|body_0|>
def find(self, tag, method='find_all'):
"""Returns a list of found tags fo... | stack_v2_sparse_classes_36k_train_018304 | 31,809 | permissive | [
{
"docstring": "Initializes this tag finder",
"name": "__init__",
"signature": "def __init__(self, page, headers=None)"
},
{
"docstring": "Returns a list of found tags for the given search method",
"name": "find",
"signature": "def find(self, tag, method='find_all')"
},
{
"docstr... | 5 | stack_v2_sparse_classes_30k_train_005098 | Implement the Python class `TagFinder` described below.
Class description:
Class TagFinder can be used to find and store elements from a given web page or markup
Method signatures and docstrings:
- def __init__(self, page, headers=None): Initializes this tag finder
- def find(self, tag, method='find_all'): Returns a ... | Implement the Python class `TagFinder` described below.
Class description:
Class TagFinder can be used to find and store elements from a given web page or markup
Method signatures and docstrings:
- def __init__(self, page, headers=None): Initializes this tag finder
- def find(self, tag, method='find_all'): Returns a ... | f8773b630cc1f81b85a7fd385e4b91c29573d84d | <|skeleton|>
class TagFinder:
"""Class TagFinder can be used to find and store elements from a given web page or markup"""
def __init__(self, page, headers=None):
"""Initializes this tag finder"""
<|body_0|>
def find(self, tag, method='find_all'):
"""Returns a list of found tags fo... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TagFinder:
"""Class TagFinder can be used to find and store elements from a given web page or markup"""
def __init__(self, page, headers=None):
"""Initializes this tag finder"""
self.request = None
if isinstance(page, bytes):
self.src = page
elif _os.path.exist... | the_stack_v2_python_sparse | net/core.py | claywahlstrom/clay | train | 2 |
204f82a9599ec110d50bb4c7cb36ef39c4489c3c | [
"self.input_data_description = input_data_description\nself.times_sigma = times_sigma\nself.name = 'outlier_clipping'",
"try:\n X_transf = []\n X = np.array(X)\n for kinput in range(self.input_data_description['NI']):\n if self.input_data_description['input_types'][kinput]['type'] == 'num':\n ... | <|body_start_0|>
self.input_data_description = input_data_description
self.times_sigma = times_sigma
self.name = 'outlier_clipping'
<|end_body_0|>
<|body_start_1|>
try:
X_transf = []
X = np.array(X)
for kinput in range(self.input_data_description['NI'... | outlier_clipping_model | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class outlier_clipping_model:
def __init__(self, input_data_description, times_sigma):
"""Parameters ---------- input_data_description: dict Description of the input features times_sigma: float Maximal allowed variation with respect to data standard deviation"""
<|body_0|>
def tra... | stack_v2_sparse_classes_36k_train_018305 | 2,648 | permissive | [
{
"docstring": "Parameters ---------- input_data_description: dict Description of the input features times_sigma: float Maximal allowed variation with respect to data standard deviation",
"name": "__init__",
"signature": "def __init__(self, input_data_description, times_sigma)"
},
{
"docstring":... | 2 | stack_v2_sparse_classes_30k_train_017259 | Implement the Python class `outlier_clipping_model` described below.
Class description:
Implement the outlier_clipping_model class.
Method signatures and docstrings:
- def __init__(self, input_data_description, times_sigma): Parameters ---------- input_data_description: dict Description of the input features times_si... | Implement the Python class `outlier_clipping_model` described below.
Class description:
Implement the outlier_clipping_model class.
Method signatures and docstrings:
- def __init__(self, input_data_description, times_sigma): Parameters ---------- input_data_description: dict Description of the input features times_si... | ccc0a7674a04ae0d00bedc38893b33184c5f68c6 | <|skeleton|>
class outlier_clipping_model:
def __init__(self, input_data_description, times_sigma):
"""Parameters ---------- input_data_description: dict Description of the input features times_sigma: float Maximal allowed variation with respect to data standard deviation"""
<|body_0|>
def tra... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class outlier_clipping_model:
def __init__(self, input_data_description, times_sigma):
"""Parameters ---------- input_data_description: dict Description of the input features times_sigma: float Maximal allowed variation with respect to data standard deviation"""
self.input_data_description = input_d... | the_stack_v2_python_sparse | MMLL/preprocessors/outlier_clipping.py | Musketeer-H2020/MMLL-Robust | train | 0 | |
cbc797eda527a1572a1e1df4f16a1de3b4372077 | [
"try:\n found_item = ItemModel.find_item_by_name(name)\nexcept:\n return ({'message': SERVER_ERROR}, 500)\nif found_item:\n return (item_schema.dump(found_item), 200)\nreturn ({'message': NOT_FOUND_ERROR.format(name)}, 404)",
"received_json = item_schema.load(request.get_json())\nreceived_json['name'] = ... | <|body_start_0|>
try:
found_item = ItemModel.find_item_by_name(name)
except:
return ({'message': SERVER_ERROR}, 500)
if found_item:
return (item_schema.dump(found_item), 200)
return ({'message': NOT_FOUND_ERROR.format(name)}, 404)
<|end_body_0|>
<|bod... | Resource for one particular item. | Item | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Item:
"""Resource for one particular item."""
def get(cls, name: str):
"""endpoint for getting one item by name"""
<|body_0|>
def post(cls, name: str):
"""endpoint for creating an item, it does not accept full json, but parses it and uses only {price: <float>}"""... | stack_v2_sparse_classes_36k_train_018306 | 2,925 | no_license | [
{
"docstring": "endpoint for getting one item by name",
"name": "get",
"signature": "def get(cls, name: str)"
},
{
"docstring": "endpoint for creating an item, it does not accept full json, but parses it and uses only {price: <float>}",
"name": "post",
"signature": "def post(cls, name: s... | 4 | stack_v2_sparse_classes_30k_train_020503 | Implement the Python class `Item` described below.
Class description:
Resource for one particular item.
Method signatures and docstrings:
- def get(cls, name: str): endpoint for getting one item by name
- def post(cls, name: str): endpoint for creating an item, it does not accept full json, but parses it and uses onl... | Implement the Python class `Item` described below.
Class description:
Resource for one particular item.
Method signatures and docstrings:
- def get(cls, name: str): endpoint for getting one item by name
- def post(cls, name: str): endpoint for creating an item, it does not accept full json, but parses it and uses onl... | 6f8dfbff5f06bead56b2c56122a533d1bd148c2b | <|skeleton|>
class Item:
"""Resource for one particular item."""
def get(cls, name: str):
"""endpoint for getting one item by name"""
<|body_0|>
def post(cls, name: str):
"""endpoint for creating an item, it does not accept full json, but parses it and uses only {price: <float>}"""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Item:
"""Resource for one particular item."""
def get(cls, name: str):
"""endpoint for getting one item by name"""
try:
found_item = ItemModel.find_item_by_name(name)
except:
return ({'message': SERVER_ERROR}, 500)
if found_item:
return ... | the_stack_v2_python_sparse | section13/resources/item.py | ExperimentalHypothesis/flask-restful-web-api | train | 0 |
76f68093fbb8927100b7ad2af0d984fc4c166a9e | [
"if self.codeable_concept:\n return 'Performer {0.reference_txt} {0.codeable_concept}'.format(self)\nreturn 'Performer {0.reference_txt}'.format(self)",
"if self.codeable_concept:\n return {'actor': self.reference_txt, 'role': self.codeable_concept.as_fhir()}\nreturn self.reference_txt",
"instance = cls()... | <|body_start_0|>
if self.codeable_concept:
return 'Performer {0.reference_txt} {0.codeable_concept}'.format(self)
return 'Performer {0.reference_txt}'.format(self)
<|end_body_0|>
<|body_start_1|>
if self.codeable_concept:
return {'actor': self.reference_txt, 'role': self... | ORM for FHIR Performer - performers table | Performer | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Performer:
"""ORM for FHIR Performer - performers table"""
def __str__(self):
"""Print friendly format for logging, etc."""
<|body_0|>
def as_fhir(self):
"""Return self in JSON FHIR formatted string FHIR is not currently consistant in performer inclusion. For exa... | stack_v2_sparse_classes_36k_train_018307 | 4,146 | permissive | [
{
"docstring": "Print friendly format for logging, etc.",
"name": "__str__",
"signature": "def __str__(self)"
},
{
"docstring": "Return self in JSON FHIR formatted string FHIR is not currently consistant in performer inclusion. For example, Observation.performer is simply a list of Reference res... | 4 | stack_v2_sparse_classes_30k_train_010833 | Implement the Python class `Performer` described below.
Class description:
ORM for FHIR Performer - performers table
Method signatures and docstrings:
- def __str__(self): Print friendly format for logging, etc.
- def as_fhir(self): Return self in JSON FHIR formatted string FHIR is not currently consistant in perform... | Implement the Python class `Performer` described below.
Class description:
ORM for FHIR Performer - performers table
Method signatures and docstrings:
- def __str__(self): Print friendly format for logging, etc.
- def as_fhir(self): Return self in JSON FHIR formatted string FHIR is not currently consistant in perform... | 622e90f54692c6fc9c84468f489ab6f297af0feb | <|skeleton|>
class Performer:
"""ORM for FHIR Performer - performers table"""
def __str__(self):
"""Print friendly format for logging, etc."""
<|body_0|>
def as_fhir(self):
"""Return self in JSON FHIR formatted string FHIR is not currently consistant in performer inclusion. For exa... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Performer:
"""ORM for FHIR Performer - performers table"""
def __str__(self):
"""Print friendly format for logging, etc."""
if self.codeable_concept:
return 'Performer {0.reference_txt} {0.codeable_concept}'.format(self)
return 'Performer {0.reference_txt}'.format(self... | the_stack_v2_python_sparse | portal/models/performer.py | pep8speaks/true_nth_usa_portal | train | 1 |
3389d70ba5f6e557d6f734d0c8fab25adf29953b | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn ShiftActivity()",
"from .schedule_entity_theme import ScheduleEntityTheme\nfrom .schedule_entity_theme import ScheduleEntityTheme\nfields: Dict[str, Callable[[Any], None]] = {'code': lambda n: setattr(self, 'code', n.get_str_value()), ... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return ShiftActivity()
<|end_body_0|>
<|body_start_1|>
from .schedule_entity_theme import ScheduleEntityTheme
from .schedule_entity_theme import ScheduleEntityTheme
fields: Dict[str, Ca... | ShiftActivity | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ShiftActivity:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ShiftActivity:
"""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... | stack_v2_sparse_classes_36k_train_018308 | 4,321 | 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: ShiftActivity",
"name": "create_from_discriminator_value",
"signature": "def create_from_discriminator_value... | 3 | null | Implement the Python class `ShiftActivity` described below.
Class description:
Implement the ShiftActivity class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ShiftActivity: Creates a new instance of the appropriate class based on discriminator value... | Implement the Python class `ShiftActivity` described below.
Class description:
Implement the ShiftActivity class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ShiftActivity: Creates a new instance of the appropriate class based on discriminator value... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class ShiftActivity:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ShiftActivity:
"""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... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ShiftActivity:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ShiftActivity:
"""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: ShiftActivit... | the_stack_v2_python_sparse | msgraph/generated/models/shift_activity.py | microsoftgraph/msgraph-sdk-python | train | 135 | |
8a5d39c88322e754dc29eebdcfab791e9aedbdae | [
"self.parser = RequestParser()\nself.parser.add_argument('location', type=str, required=True, help='location field is missing')\nself.parser.add_argument('images', type=str, required=True, help='Image field is missing')\nself.parser.add_argument('topic', type=str, required=True, help='Topic field is missing')\nself... | <|body_start_0|>
self.parser = RequestParser()
self.parser.add_argument('location', type=str, required=True, help='location field is missing')
self.parser.add_argument('images', type=str, required=True, help='Image field is missing')
self.parser.add_argument('topic', type=str, required=T... | Class for meetup endpoints | AllMeetups | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AllMeetups:
"""Class for meetup endpoints"""
def __init__(self):
"""Initialize the meetup class"""
<|body_0|>
def post(self, current_user):
"""Create meetup endpoint"""
<|body_1|>
def get(self, current_user):
"""Fetch all meetups"""
<... | stack_v2_sparse_classes_36k_train_018309 | 5,065 | no_license | [
{
"docstring": "Initialize the meetup class",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Create meetup endpoint",
"name": "post",
"signature": "def post(self, current_user)"
},
{
"docstring": "Fetch all meetups",
"name": "get",
"signature": "... | 3 | stack_v2_sparse_classes_30k_train_018303 | Implement the Python class `AllMeetups` described below.
Class description:
Class for meetup endpoints
Method signatures and docstrings:
- def __init__(self): Initialize the meetup class
- def post(self, current_user): Create meetup endpoint
- def get(self, current_user): Fetch all meetups | Implement the Python class `AllMeetups` described below.
Class description:
Class for meetup endpoints
Method signatures and docstrings:
- def __init__(self): Initialize the meetup class
- def post(self, current_user): Create meetup endpoint
- def get(self, current_user): Fetch all meetups
<|skeleton|>
class AllMeet... | 93c7aeb54c240b6312e6164859acd2c878e85825 | <|skeleton|>
class AllMeetups:
"""Class for meetup endpoints"""
def __init__(self):
"""Initialize the meetup class"""
<|body_0|>
def post(self, current_user):
"""Create meetup endpoint"""
<|body_1|>
def get(self, current_user):
"""Fetch all meetups"""
<... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AllMeetups:
"""Class for meetup endpoints"""
def __init__(self):
"""Initialize the meetup class"""
self.parser = RequestParser()
self.parser.add_argument('location', type=str, required=True, help='location field is missing')
self.parser.add_argument('images', type=str, req... | the_stack_v2_python_sparse | app/api/v2/views/meetup_views.py | matthenge/Questioner-api-v2 | train | 0 |
57bcafebe6727f773aa4c6b000aade8396f050e9 | [
"uri = AutomaticLookup.LOOKUP_URI_BASE.format(owner=owner, namespace=namespace)\nr, c = splunk.rest.simpleRequest(uri, getargs={'output_mode': 'json', 'count': 0}, sessionKey=session_key)\nreturn {v['name']: v for v in json.loads(c)['entry']}",
"if stanza_name and class_name and isinstance(stanza_name, basestring... | <|body_start_0|>
uri = AutomaticLookup.LOOKUP_URI_BASE.format(owner=owner, namespace=namespace)
r, c = splunk.rest.simpleRequest(uri, getargs={'output_mode': 'json', 'count': 0}, sessionKey=session_key)
return {v['name']: v for v in json.loads(c)['entry']}
<|end_body_0|>
<|body_start_1|>
... | Wrapper class for data/props/lookups, used in creation of automatic lookups. | AutomaticLookup | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AutomaticLookup:
"""Wrapper class for data/props/lookups, used in creation of automatic lookups."""
def list(owner, namespace, session_key):
"""List automatic lookups. :param owner: A Splunk user. :type owner: str :param namespace: A Splunk namespace. :type namespace: str :param sess... | stack_v2_sparse_classes_36k_train_018310 | 35,842 | no_license | [
{
"docstring": "List automatic lookups. :param owner: A Splunk user. :type owner: str :param namespace: A Splunk namespace. :type namespace: str :param session_key: A Splunk session key. :type session_key: str :return: A dictionary of automatic lookup definitions by their URL-decoded stanza names. :rtype dict",... | 4 | null | Implement the Python class `AutomaticLookup` described below.
Class description:
Wrapper class for data/props/lookups, used in creation of automatic lookups.
Method signatures and docstrings:
- def list(owner, namespace, session_key): List automatic lookups. :param owner: A Splunk user. :type owner: str :param namesp... | Implement the Python class `AutomaticLookup` described below.
Class description:
Wrapper class for data/props/lookups, used in creation of automatic lookups.
Method signatures and docstrings:
- def list(owner, namespace, session_key): List automatic lookups. :param owner: A Splunk user. :type owner: str :param namesp... | 70689c54d1a67e809bf134dd586b2ea05ff4c431 | <|skeleton|>
class AutomaticLookup:
"""Wrapper class for data/props/lookups, used in creation of automatic lookups."""
def list(owner, namespace, session_key):
"""List automatic lookups. :param owner: A Splunk user. :type owner: str :param namespace: A Splunk namespace. :type namespace: str :param sess... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AutomaticLookup:
"""Wrapper class for data/props/lookups, used in creation of automatic lookups."""
def list(owner, namespace, session_key):
"""List automatic lookups. :param owner: A Splunk user. :type owner: str :param namespace: A Splunk namespace. :type namespace: str :param session_key: A Sp... | the_stack_v2_python_sparse | SA-IdentityManagement/bin/identity_correlation_rest_handler.py | reza/es_eventgens | train | 0 |
ea4654e529200bec9d3f8e64c4f12474705d4d02 | [
"self.vec2d = vec2d\nself.i = 0\nself.j = 0",
"ret = None\nif self.hasNext():\n ret = self.vec2d[self.i][self.j]\n self.j += 1\nreturn ret",
"while self.i < len(self.vec2d) and self.j >= len(self.vec2d[self.i]):\n self.i += 1\n self.j = 0\nreturn self.i < len(self.vec2d) and self.j < len(self.vec2d[... | <|body_start_0|>
self.vec2d = vec2d
self.i = 0
self.j = 0
<|end_body_0|>
<|body_start_1|>
ret = None
if self.hasNext():
ret = self.vec2d[self.i][self.j]
self.j += 1
return ret
<|end_body_1|>
<|body_start_2|>
while self.i < len(self.vec2d)... | Vector2D | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Vector2D:
def __init__(self, vec2d):
"""Initialize your data structure here. :type vec2d: List[List[int]]"""
<|body_0|>
def next(self):
""":rtype: int"""
<|body_1|>
def hasNext(self):
""":rtype: bool"""
<|body_2|>
<|end_skeleton|>
<|bod... | stack_v2_sparse_classes_36k_train_018311 | 1,092 | no_license | [
{
"docstring": "Initialize your data structure here. :type vec2d: List[List[int]]",
"name": "__init__",
"signature": "def __init__(self, vec2d)"
},
{
"docstring": ":rtype: int",
"name": "next",
"signature": "def next(self)"
},
{
"docstring": ":rtype: bool",
"name": "hasNext",... | 3 | stack_v2_sparse_classes_30k_train_015365 | Implement the Python class `Vector2D` described below.
Class description:
Implement the Vector2D class.
Method signatures and docstrings:
- def __init__(self, vec2d): Initialize your data structure here. :type vec2d: List[List[int]]
- def next(self): :rtype: int
- def hasNext(self): :rtype: bool | Implement the Python class `Vector2D` described below.
Class description:
Implement the Vector2D class.
Method signatures and docstrings:
- def __init__(self, vec2d): Initialize your data structure here. :type vec2d: List[List[int]]
- def next(self): :rtype: int
- def hasNext(self): :rtype: bool
<|skeleton|>
class V... | 908b88d6318c2dae51137552c2958ba9429f00d1 | <|skeleton|>
class Vector2D:
def __init__(self, vec2d):
"""Initialize your data structure here. :type vec2d: List[List[int]]"""
<|body_0|>
def next(self):
""":rtype: int"""
<|body_1|>
def hasNext(self):
""":rtype: bool"""
<|body_2|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Vector2D:
def __init__(self, vec2d):
"""Initialize your data structure here. :type vec2d: List[List[int]]"""
self.vec2d = vec2d
self.i = 0
self.j = 0
def next(self):
""":rtype: int"""
ret = None
if self.hasNext():
ret = self.vec2d[self.i... | the_stack_v2_python_sparse | 251 Flatten 2D Vector.py | uncleyao/Leetcode | train | 2 | |
84d7cdb6fa84a379be1da943b21980834869f76a | [
"self.input = '1905'\nself.output = ['1w0j', '1w0k', '1w0l', '1x0j', '1x0k', '1x0l', '1y0j', '1y0k', '1y0l', '1z0j', '1z0k', '1z0l']\nreturn (self.input, self.output)",
"input_number, correct_output = self.SetUp()\noutput = phoneNumberMnemonics(input_number)\nself.assertEqual(output, correct_output)"
] | <|body_start_0|>
self.input = '1905'
self.output = ['1w0j', '1w0k', '1w0l', '1x0j', '1x0k', '1x0l', '1y0j', '1y0k', '1y0l', '1z0j', '1z0k', '1z0l']
return (self.input, self.output)
<|end_body_0|>
<|body_start_1|>
input_number, correct_output = self.SetUp()
output = phoneNumberMn... | Class with unittests for PhoneNumberMnemonics.py | test_PhoneNumberMnemonics | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class test_PhoneNumberMnemonics:
"""Class with unittests for PhoneNumberMnemonics.py"""
def SetUp(self):
"""Set Up input and output lists."""
<|body_0|>
def test_Iterative_method(self):
"""Checks if output is correct."""
<|body_1|>
<|end_skeleton|>
<|body_sta... | stack_v2_sparse_classes_36k_train_018312 | 1,328 | no_license | [
{
"docstring": "Set Up input and output lists.",
"name": "SetUp",
"signature": "def SetUp(self)"
},
{
"docstring": "Checks if output is correct.",
"name": "test_Iterative_method",
"signature": "def test_Iterative_method(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_019106 | Implement the Python class `test_PhoneNumberMnemonics` described below.
Class description:
Class with unittests for PhoneNumberMnemonics.py
Method signatures and docstrings:
- def SetUp(self): Set Up input and output lists.
- def test_Iterative_method(self): Checks if output is correct. | Implement the Python class `test_PhoneNumberMnemonics` described below.
Class description:
Class with unittests for PhoneNumberMnemonics.py
Method signatures and docstrings:
- def SetUp(self): Set Up input and output lists.
- def test_Iterative_method(self): Checks if output is correct.
<|skeleton|>
class test_Phone... | 3aa62ad36c3b06b2a3b05f1f8e2a9e21d68b371f | <|skeleton|>
class test_PhoneNumberMnemonics:
"""Class with unittests for PhoneNumberMnemonics.py"""
def SetUp(self):
"""Set Up input and output lists."""
<|body_0|>
def test_Iterative_method(self):
"""Checks if output is correct."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class test_PhoneNumberMnemonics:
"""Class with unittests for PhoneNumberMnemonics.py"""
def SetUp(self):
"""Set Up input and output lists."""
self.input = '1905'
self.output = ['1w0j', '1w0k', '1w0l', '1x0j', '1x0k', '1x0l', '1y0j', '1y0k', '1y0l', '1z0j', '1z0k', '1z0l']
return... | the_stack_v2_python_sparse | AlgoExpert_algorithms/Medium/PhoneNumberMnemonics/test_PhoneNumberMnemonics.py | JakubKazimierski/PythonPortfolio | train | 9 |
2ddecd9114f9d28791355050c36172b4f42fbdf5 | [
"self.info_urls = celebrity.get('Urls')\nself.name = celebrity.get('Name')\nself.id = celebrity.get('Id')\nself.face = RekognitionFace(celebrity.get('Face'))\nself.confidence = celebrity.get('MatchConfidence')\nself.bounding_box = celebrity.get('BoundingBox')\nself.timestamp = timestamp",
"rendering = self.face.t... | <|body_start_0|>
self.info_urls = celebrity.get('Urls')
self.name = celebrity.get('Name')
self.id = celebrity.get('Id')
self.face = RekognitionFace(celebrity.get('Face'))
self.confidence = celebrity.get('MatchConfidence')
self.bounding_box = celebrity.get('BoundingBox')
... | Encapsulates an Amazon Rekognition celebrity. | RekognitionCelebrity | [
"Apache-2.0",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RekognitionCelebrity:
"""Encapsulates an Amazon Rekognition celebrity."""
def __init__(self, celebrity, timestamp=None):
"""Initializes the celebrity object. :param celebrity: Celebrity data, in the format returned by Amazon Rekognition functions. :param timestamp: The time when the ... | stack_v2_sparse_classes_36k_train_018313 | 11,689 | permissive | [
{
"docstring": "Initializes the celebrity object. :param celebrity: Celebrity data, in the format returned by Amazon Rekognition functions. :param timestamp: The time when the celebrity was detected, if the celebrity was detected in a video.",
"name": "__init__",
"signature": "def __init__(self, celebri... | 2 | null | Implement the Python class `RekognitionCelebrity` described below.
Class description:
Encapsulates an Amazon Rekognition celebrity.
Method signatures and docstrings:
- def __init__(self, celebrity, timestamp=None): Initializes the celebrity object. :param celebrity: Celebrity data, in the format returned by Amazon Re... | Implement the Python class `RekognitionCelebrity` described below.
Class description:
Encapsulates an Amazon Rekognition celebrity.
Method signatures and docstrings:
- def __init__(self, celebrity, timestamp=None): Initializes the celebrity object. :param celebrity: Celebrity data, in the format returned by Amazon Re... | dec41fb589043ac9d8667aac36fb88a53c3abe50 | <|skeleton|>
class RekognitionCelebrity:
"""Encapsulates an Amazon Rekognition celebrity."""
def __init__(self, celebrity, timestamp=None):
"""Initializes the celebrity object. :param celebrity: Celebrity data, in the format returned by Amazon Rekognition functions. :param timestamp: The time when the ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RekognitionCelebrity:
"""Encapsulates an Amazon Rekognition celebrity."""
def __init__(self, celebrity, timestamp=None):
"""Initializes the celebrity object. :param celebrity: Celebrity data, in the format returned by Amazon Rekognition functions. :param timestamp: The time when the celebrity was... | the_stack_v2_python_sparse | python/example_code/rekognition/rekognition_objects.py | awsdocs/aws-doc-sdk-examples | train | 8,240 |
54d0d64ea7c4be8d13dc97b04635c1601bc892d7 | [
"try:\n payload = json.loads(req.stream.read().decode('utf-8'))\n private_key = base64.b64decode(payload['private_key'])\n cert = Certificate(user_id=kwargs.get('user_id'), private_key=private_key, active=payload['active'], body=payload['body'])\n self.session.add(cert)\n self.session.commit()\nexcep... | <|body_start_0|>
try:
payload = json.loads(req.stream.read().decode('utf-8'))
private_key = base64.b64decode(payload['private_key'])
cert = Certificate(user_id=kwargs.get('user_id'), private_key=private_key, active=payload['active'], body=payload['body'])
self.ses... | Resource for creating and retrieving certificates Endpoint: /users/{user_id}/certificates | CertificatesResource | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CertificatesResource:
"""Resource for creating and retrieving certificates Endpoint: /users/{user_id}/certificates"""
def on_post(self, req, resp, **kwargs):
"""Handles POST requests. Creates a certificate resource for a user."""
<|body_0|>
def on_get(self, req, resp, **... | stack_v2_sparse_classes_36k_train_018314 | 5,422 | no_license | [
{
"docstring": "Handles POST requests. Creates a certificate resource for a user.",
"name": "on_post",
"signature": "def on_post(self, req, resp, **kwargs)"
},
{
"docstring": "Handles GET requests. Lists certificate resources for a user.",
"name": "on_get",
"signature": "def on_get(self,... | 2 | stack_v2_sparse_classes_30k_train_015060 | Implement the Python class `CertificatesResource` described below.
Class description:
Resource for creating and retrieving certificates Endpoint: /users/{user_id}/certificates
Method signatures and docstrings:
- def on_post(self, req, resp, **kwargs): Handles POST requests. Creates a certificate resource for a user.
... | Implement the Python class `CertificatesResource` described below.
Class description:
Resource for creating and retrieving certificates Endpoint: /users/{user_id}/certificates
Method signatures and docstrings:
- def on_post(self, req, resp, **kwargs): Handles POST requests. Creates a certificate resource for a user.
... | 4f6108c3965941d818920cbc492cc9c0ad365bbd | <|skeleton|>
class CertificatesResource:
"""Resource for creating and retrieving certificates Endpoint: /users/{user_id}/certificates"""
def on_post(self, req, resp, **kwargs):
"""Handles POST requests. Creates a certificate resource for a user."""
<|body_0|>
def on_get(self, req, resp, **... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CertificatesResource:
"""Resource for creating and retrieving certificates Endpoint: /users/{user_id}/certificates"""
def on_post(self, req, resp, **kwargs):
"""Handles POST requests. Creates a certificate resource for a user."""
try:
payload = json.loads(req.stream.read().dec... | the_stack_v2_python_sparse | src/resources/certificate.py | aelawson/customer_certificates | train | 0 |
754207ec5b6b292ab57251247ad685c4e49cd38f | [
"max = 0\nlength = len(arr)\nfor index in range(1, length):\n if arr[index - 1] == 0 and index > arr[max] + max:\n return False\n if arr[max] - (index - max) < arr[index]:\n max = index\nreturn True",
"if len(nums) < 2:\n return True\nif nums == None or arr[0] == 0:\n return True\nfor i ... | <|body_start_0|>
max = 0
length = len(arr)
for index in range(1, length):
if arr[index - 1] == 0 and index > arr[max] + max:
return False
if arr[max] - (index - max) < arr[index]:
max = index
return True
<|end_body_0|>
<|body_start... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def jump_game_1(arr: List[int]) -> bool:
"""看是否能跳过数组 Args: arr: 输入数组 Returns: 布尔值"""
<|body_0|>
def jump_game_2(self, nums: List[int]) -> bool:
"""跳远数组 Args: nums: 数组 Returns: 是否能调到最后,布尔值"""
<|body_1|>
def jump_flag(self, nums: List[int], i: in... | stack_v2_sparse_classes_36k_train_018315 | 2,754 | permissive | [
{
"docstring": "看是否能跳过数组 Args: arr: 输入数组 Returns: 布尔值",
"name": "jump_game_1",
"signature": "def jump_game_1(arr: List[int]) -> bool"
},
{
"docstring": "跳远数组 Args: nums: 数组 Returns: 是否能调到最后,布尔值",
"name": "jump_game_2",
"signature": "def jump_game_2(self, nums: List[int]) -> bool"
},
... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def jump_game_1(arr: List[int]) -> bool: 看是否能跳过数组 Args: arr: 输入数组 Returns: 布尔值
- def jump_game_2(self, nums: List[int]) -> bool: 跳远数组 Args: nums: 数组 Returns: 是否能调到最后,布尔值
- def ju... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def jump_game_1(arr: List[int]) -> bool: 看是否能跳过数组 Args: arr: 输入数组 Returns: 布尔值
- def jump_game_2(self, nums: List[int]) -> bool: 跳远数组 Args: nums: 数组 Returns: 是否能调到最后,布尔值
- def ju... | 50f35eef6a0ad63173efed10df3c835b1dceaa3f | <|skeleton|>
class Solution:
def jump_game_1(arr: List[int]) -> bool:
"""看是否能跳过数组 Args: arr: 输入数组 Returns: 布尔值"""
<|body_0|>
def jump_game_2(self, nums: List[int]) -> bool:
"""跳远数组 Args: nums: 数组 Returns: 是否能调到最后,布尔值"""
<|body_1|>
def jump_flag(self, nums: List[int], i: in... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def jump_game_1(arr: List[int]) -> bool:
"""看是否能跳过数组 Args: arr: 输入数组 Returns: 布尔值"""
max = 0
length = len(arr)
for index in range(1, length):
if arr[index - 1] == 0 and index > arr[max] + max:
return False
if arr[max] - (index -... | the_stack_v2_python_sparse | src/leetcodepython/top100likedquestions/jump_game_55.py | zhangyu345293721/leetcode | train | 101 | |
7f748970ed3711576323d379bb14408f2d9c1013 | [
"self.desc = desc\nself.title = title\nself.cost = cost",
"index = str(desc).rindex(' ')\ntitle = desc[:index]\ncost = desc[index + 1:].replace('min', '').replace('lightning', '5')\nreturn cls(desc, title, int(cost))"
] | <|body_start_0|>
self.desc = desc
self.title = title
self.cost = cost
<|end_body_0|>
<|body_start_1|>
index = str(desc).rindex(' ')
title = desc[:index]
cost = desc[index + 1:].replace('min', '').replace('lightning', '5')
return cls(desc, title, int(cost))
<|end_... | Talk | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Talk:
def __init__(self, desc, title, cost):
"""表示一个议题的类 :param desc: 原描述文本 :param title: 议题标题 :param cost: 议题需要的时间,单位:min"""
<|body_0|>
def parse(cls, desc):
"""从文本解析内容,构造类实例"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.desc = desc
... | stack_v2_sparse_classes_36k_train_018316 | 5,618 | no_license | [
{
"docstring": "表示一个议题的类 :param desc: 原描述文本 :param title: 议题标题 :param cost: 议题需要的时间,单位:min",
"name": "__init__",
"signature": "def __init__(self, desc, title, cost)"
},
{
"docstring": "从文本解析内容,构造类实例",
"name": "parse",
"signature": "def parse(cls, desc)"
}
] | 2 | stack_v2_sparse_classes_30k_test_000107 | Implement the Python class `Talk` described below.
Class description:
Implement the Talk class.
Method signatures and docstrings:
- def __init__(self, desc, title, cost): 表示一个议题的类 :param desc: 原描述文本 :param title: 议题标题 :param cost: 议题需要的时间,单位:min
- def parse(cls, desc): 从文本解析内容,构造类实例 | Implement the Python class `Talk` described below.
Class description:
Implement the Talk class.
Method signatures and docstrings:
- def __init__(self, desc, title, cost): 表示一个议题的类 :param desc: 原描述文本 :param title: 议题标题 :param cost: 议题需要的时间,单位:min
- def parse(cls, desc): 从文本解析内容,构造类实例
<|skeleton|>
class Talk:
def... | 6475851d21ef5312727f93b9f4e85a3ca1e79bb8 | <|skeleton|>
class Talk:
def __init__(self, desc, title, cost):
"""表示一个议题的类 :param desc: 原描述文本 :param title: 议题标题 :param cost: 议题需要的时间,单位:min"""
<|body_0|>
def parse(cls, desc):
"""从文本解析内容,构造类实例"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Talk:
def __init__(self, desc, title, cost):
"""表示一个议题的类 :param desc: 原描述文本 :param title: 议题标题 :param cost: 议题需要的时间,单位:min"""
self.desc = desc
self.title = title
self.cost = cost
def parse(cls, desc):
"""从文本解析内容,构造类实例"""
index = str(desc).rindex(' ')
... | the_stack_v2_python_sparse | scratchs/conference_track_management/conference_track_management.py | chaneyzorn/LeetCode-Python | train | 0 | |
4e48d4e80617e852c91dce4edc15a43716e2b302 | [
"if not isinstance(dsl_evaluator, DSLEvaluator):\n raise ValueError(\"Argument 'dsl_evaluator' must be an instance of {0} class\".format(DSLEvaluator))\nself._dsl_evaluator = dsl_evaluator\nself._logger = logging.getLogger(__name__)",
"if not expression or not isinstance(expression, str):\n raise ValueError... | <|body_start_0|>
if not isinstance(dsl_evaluator, DSLEvaluator):
raise ValueError("Argument 'dsl_evaluator' must be an instance of {0} class".format(DSLEvaluator))
self._dsl_evaluator = dsl_evaluator
self._logger = logging.getLogger(__name__)
<|end_body_0|>
<|body_start_1|>
... | Executes filter expressions. | SAMLSubjectFilter | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SAMLSubjectFilter:
"""Executes filter expressions."""
def __init__(self, dsl_evaluator):
"""Initialize a new instance of SAMLSubjectFilter class. :param dsl_evaluator: DSL evaluator :type dsl_evaluator: core.python_expression_dsl.evaluator.DSLEvaluator"""
<|body_0|>
def ... | stack_v2_sparse_classes_36k_train_018317 | 3,576 | permissive | [
{
"docstring": "Initialize a new instance of SAMLSubjectFilter class. :param dsl_evaluator: DSL evaluator :type dsl_evaluator: core.python_expression_dsl.evaluator.DSLEvaluator",
"name": "__init__",
"signature": "def __init__(self, dsl_evaluator)"
},
{
"docstring": "Apply the expression to the s... | 3 | null | Implement the Python class `SAMLSubjectFilter` described below.
Class description:
Executes filter expressions.
Method signatures and docstrings:
- def __init__(self, dsl_evaluator): Initialize a new instance of SAMLSubjectFilter class. :param dsl_evaluator: DSL evaluator :type dsl_evaluator: core.python_expression_d... | Implement the Python class `SAMLSubjectFilter` described below.
Class description:
Executes filter expressions.
Method signatures and docstrings:
- def __init__(self, dsl_evaluator): Initialize a new instance of SAMLSubjectFilter class. :param dsl_evaluator: DSL evaluator :type dsl_evaluator: core.python_expression_d... | 662cc7e0721d0153857c8c17a37e2a6df86f8ce6 | <|skeleton|>
class SAMLSubjectFilter:
"""Executes filter expressions."""
def __init__(self, dsl_evaluator):
"""Initialize a new instance of SAMLSubjectFilter class. :param dsl_evaluator: DSL evaluator :type dsl_evaluator: core.python_expression_dsl.evaluator.DSLEvaluator"""
<|body_0|>
def ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SAMLSubjectFilter:
"""Executes filter expressions."""
def __init__(self, dsl_evaluator):
"""Initialize a new instance of SAMLSubjectFilter class. :param dsl_evaluator: DSL evaluator :type dsl_evaluator: core.python_expression_dsl.evaluator.DSLEvaluator"""
if not isinstance(dsl_evaluator, ... | the_stack_v2_python_sparse | api/saml/metadata/filter.py | NYPL-Simplified/circulation | train | 20 |
b8a828f8a4367ca2a8a5e2d6598123bbc8fa1606 | [
"if 'nan_option' in kwargs:\n assert kwargs['nan_option'] in [self.DEFAULT_NAN_OPTION], 'nan_option={} is not supported'.format(kwargs['nan_option'])\nelse:\n kwargs['nan_option'] = self.DEFAULT_NAN_OPTION\nsuper().__init__(**kwargs)\nassert factor_model in [self.FACTOR_MODEL_PCA, self.FACTOR_MODEL_FA], 'fact... | <|body_start_0|>
if 'nan_option' in kwargs:
assert kwargs['nan_option'] in [self.DEFAULT_NAN_OPTION], 'nan_option={} is not supported'.format(kwargs['nan_option'])
else:
kwargs['nan_option'] = self.DEFAULT_NAN_OPTION
super().__init__(**kwargs)
assert factor_model ... | Structured Covariance Estimator This estimator assumes observations can be predicted by multiple factors X = B @ F.T + U where `X` contains observations (row) of multiple variables (column), `F` contains factor exposures (column) for all variables (row), `B` is the regression coefficients matrix for all observations (r... | StructuredCovEstimator | [
"LicenseRef-scancode-generic-cla",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StructuredCovEstimator:
"""Structured Covariance Estimator This estimator assumes observations can be predicted by multiple factors X = B @ F.T + U where `X` contains observations (row) of multiple variables (column), `F` contains factor exposures (column) for all variables (row), `B` is the regr... | stack_v2_sparse_classes_36k_train_018318 | 3,801 | permissive | [
{
"docstring": "Args: factor_model (str): the latent factor models used to estimate the structured covariance (`pca`/`fa`). num_factors (int): number of components to keep. kwargs: see `RiskModel` for more information",
"name": "__init__",
"signature": "def __init__(self, factor_model: str='pca', num_fa... | 2 | stack_v2_sparse_classes_30k_val_000941 | Implement the Python class `StructuredCovEstimator` described below.
Class description:
Structured Covariance Estimator This estimator assumes observations can be predicted by multiple factors X = B @ F.T + U where `X` contains observations (row) of multiple variables (column), `F` contains factor exposures (column) f... | Implement the Python class `StructuredCovEstimator` described below.
Class description:
Structured Covariance Estimator This estimator assumes observations can be predicted by multiple factors X = B @ F.T + U where `X` contains observations (row) of multiple variables (column), `F` contains factor exposures (column) f... | 4c30e5827b74bcc45f14cf3ae0c1715459ed09ae | <|skeleton|>
class StructuredCovEstimator:
"""Structured Covariance Estimator This estimator assumes observations can be predicted by multiple factors X = B @ F.T + U where `X` contains observations (row) of multiple variables (column), `F` contains factor exposures (column) for all variables (row), `B` is the regr... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class StructuredCovEstimator:
"""Structured Covariance Estimator This estimator assumes observations can be predicted by multiple factors X = B @ F.T + U where `X` contains observations (row) of multiple variables (column), `F` contains factor exposures (column) for all variables (row), `B` is the regression coeffi... | the_stack_v2_python_sparse | qlib/model/riskmodel/structured.py | microsoft/qlib | train | 12,822 |
d6e28be5709edb396f5e4978f6502857e917fbf8 | [
"self.decisionModule = decisionModule\nself.camera = camera\nself.arm = arm",
"frame = self.camera.capture()\ndecision = self.decisionModule.process(frame)\nif decision == decisions.RECYCLE:\n self._run_path_to_bin(-12.5)\nelif decision == decisions.COMPOST:\n self._run_path_to_bin(1.5)\nelse:\n self._ru... | <|body_start_0|>
self.decisionModule = decisionModule
self.camera = camera
self.arm = arm
<|end_body_0|>
<|body_start_1|>
frame = self.camera.capture()
decision = self.decisionModule.process(frame)
if decision == decisions.RECYCLE:
self._run_path_to_bin(-12.5... | This class implements the high-level logic of the Smart Sorting Robot. It captures frames from the camera, delegates to the decision module to classify each piece of trash, and then directs the arm to put the trash into the correct trash bin. | Controller | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Controller:
"""This class implements the high-level logic of the Smart Sorting Robot. It captures frames from the camera, delegates to the decision module to classify each piece of trash, and then directs the arm to put the trash into the correct trash bin."""
def __init__(self, decisionModu... | stack_v2_sparse_classes_36k_train_018319 | 1,703 | no_license | [
{
"docstring": "This init method is very simple. It only stores references to the objects that we need. It's important that we only store references here and NOT create new objects here. Why? We'll see why when we test this class. :)",
"name": "__init__",
"signature": "def __init__(self, decisionModule,... | 3 | stack_v2_sparse_classes_30k_train_015345 | Implement the Python class `Controller` described below.
Class description:
This class implements the high-level logic of the Smart Sorting Robot. It captures frames from the camera, delegates to the decision module to classify each piece of trash, and then directs the arm to put the trash into the correct trash bin.
... | Implement the Python class `Controller` described below.
Class description:
This class implements the high-level logic of the Smart Sorting Robot. It captures frames from the camera, delegates to the decision module to classify each piece of trash, and then directs the arm to put the trash into the correct trash bin.
... | eb67298353f763da82ea6498e5c254e2b246faf8 | <|skeleton|>
class Controller:
"""This class implements the high-level logic of the Smart Sorting Robot. It captures frames from the camera, delegates to the decision module to classify each piece of trash, and then directs the arm to put the trash into the correct trash bin."""
def __init__(self, decisionModu... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Controller:
"""This class implements the high-level logic of the Smart Sorting Robot. It captures frames from the camera, delegates to the decision module to classify each piece of trash, and then directs the arm to put the trash into the correct trash bin."""
def __init__(self, decisionModule, camera, a... | the_stack_v2_python_sparse | OOP/natalie_hunt/demo2/controller.py | wmarshall484/DSI_LECTURES_2 | train | 1 |
64c2322890e53b8ab0505f70b417e0c434deda05 | [
"size = 0\nfor root, dirs, files in os.walk(dir):\n size += sum([getsize(join(root, name)) for name in files])\nreturn size",
"if not os.path.exists(input_path) or not os.path.isdir(input_path):\n print('Input_path Error!')\n return None\ndirector_queue = queue.Queue()\ndirector_queue.put(input_path)\ntr... | <|body_start_0|>
size = 0
for root, dirs, files in os.walk(dir):
size += sum([getsize(join(root, name)) for name in files])
return size
<|end_body_0|>
<|body_start_1|>
if not os.path.exists(input_path) or not os.path.isdir(input_path):
print('Input_path Error!')
... | 用networkx绘制目录结构图 | DirectorTreeNetworkx | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DirectorTreeNetworkx:
"""用networkx绘制目录结构图"""
def getdirsize(cls, dir):
"""获取文件夹大小 :param dir: :return: 返回尺寸"""
<|body_0|>
def draw_director_tree(cls, input_path):
"""深度遍历一个目录,绘制目录树形图 :param input_path: 目标目录 :return:"""
<|body_1|>
<|end_skeleton|>
<|body... | stack_v2_sparse_classes_36k_train_018320 | 5,184 | no_license | [
{
"docstring": "获取文件夹大小 :param dir: :return: 返回尺寸",
"name": "getdirsize",
"signature": "def getdirsize(cls, dir)"
},
{
"docstring": "深度遍历一个目录,绘制目录树形图 :param input_path: 目标目录 :return:",
"name": "draw_director_tree",
"signature": "def draw_director_tree(cls, input_path)"
}
] | 2 | stack_v2_sparse_classes_30k_train_007179 | Implement the Python class `DirectorTreeNetworkx` described below.
Class description:
用networkx绘制目录结构图
Method signatures and docstrings:
- def getdirsize(cls, dir): 获取文件夹大小 :param dir: :return: 返回尺寸
- def draw_director_tree(cls, input_path): 深度遍历一个目录,绘制目录树形图 :param input_path: 目标目录 :return: | Implement the Python class `DirectorTreeNetworkx` described below.
Class description:
用networkx绘制目录结构图
Method signatures and docstrings:
- def getdirsize(cls, dir): 获取文件夹大小 :param dir: :return: 返回尺寸
- def draw_director_tree(cls, input_path): 深度遍历一个目录,绘制目录树形图 :param input_path: 目标目录 :return:
<|skeleton|>
class Direct... | 32900324b7bc5d7c0b473aa68393bb84c9cd4790 | <|skeleton|>
class DirectorTreeNetworkx:
"""用networkx绘制目录结构图"""
def getdirsize(cls, dir):
"""获取文件夹大小 :param dir: :return: 返回尺寸"""
<|body_0|>
def draw_director_tree(cls, input_path):
"""深度遍历一个目录,绘制目录树形图 :param input_path: 目标目录 :return:"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DirectorTreeNetworkx:
"""用networkx绘制目录结构图"""
def getdirsize(cls, dir):
"""获取文件夹大小 :param dir: :return: 返回尺寸"""
size = 0
for root, dirs, files in os.walk(dir):
size += sum([getsize(join(root, name)) for name in files])
return size
def draw_director_tree(cls... | the_stack_v2_python_sparse | etlpy/DAG.py | xisafe/mypython | train | 0 |
89aff1c7f830d2af2833704660c9d395c210f07c | [
"super().__init__()\nself.yaml_file_path = yaml_file_path\nself.key = key\nself.expected = expected",
"base_message = self.base_message.format(filename=self.yaml_file_path)\nerror_message = ERROR_MESSAGE.format(key=self.key, expected=self.expected)\nreturn base_message + error_message"
] | <|body_start_0|>
super().__init__()
self.yaml_file_path = yaml_file_path
self.key = key
self.expected = expected
<|end_body_0|>
<|body_start_1|>
base_message = self.base_message.format(filename=self.yaml_file_path)
error_message = ERROR_MESSAGE.format(key=self.key, expec... | Custom error for invalid config file value. | InvalidYAMLValueError | [
"CC-BY-NC-SA-4.0",
"BSD-3-Clause",
"CC0-1.0",
"ISC",
"Unlicense",
"LicenseRef-scancode-secret-labs-2011",
"WTFPL",
"Apache-2.0",
"LGPL-3.0-only",
"MIT",
"CC-BY-SA-4.0",
"LicenseRef-scancode-public-domain",
"CC-BY-NC-2.5",
"LicenseRef-scancode-other-copyleft",
"LicenseRef-scancode-unknown... | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InvalidYAMLValueError:
"""Custom error for invalid config file value."""
def __init__(self, yaml_file_path, key, expected):
"""Create error for invalid config file value."""
<|body_0|>
def __str__(self):
"""Override default error string. Returns: Error message fo... | stack_v2_sparse_classes_36k_train_018321 | 859 | permissive | [
{
"docstring": "Create error for invalid config file value.",
"name": "__init__",
"signature": "def __init__(self, yaml_file_path, key, expected)"
},
{
"docstring": "Override default error string. Returns: Error message for invalid config file value.",
"name": "__str__",
"signature": "de... | 2 | stack_v2_sparse_classes_30k_train_002165 | Implement the Python class `InvalidYAMLValueError` described below.
Class description:
Custom error for invalid config file value.
Method signatures and docstrings:
- def __init__(self, yaml_file_path, key, expected): Create error for invalid config file value.
- def __str__(self): Override default error string. Retu... | Implement the Python class `InvalidYAMLValueError` described below.
Class description:
Custom error for invalid config file value.
Method signatures and docstrings:
- def __init__(self, yaml_file_path, key, expected): Create error for invalid config file value.
- def __str__(self): Override default error string. Retu... | ea3281ec6f4d17538f6d3cf6f88d74fa54581b34 | <|skeleton|>
class InvalidYAMLValueError:
"""Custom error for invalid config file value."""
def __init__(self, yaml_file_path, key, expected):
"""Create error for invalid config file value."""
<|body_0|>
def __str__(self):
"""Override default error string. Returns: Error message fo... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class InvalidYAMLValueError:
"""Custom error for invalid config file value."""
def __init__(self, yaml_file_path, key, expected):
"""Create error for invalid config file value."""
super().__init__()
self.yaml_file_path = yaml_file_path
self.key = key
self.expected = expe... | the_stack_v2_python_sparse | csfieldguide/utils/errors/InvalidYAMLValueError.py | uccser/cs-field-guide | train | 364 |
fd8226fcc10ec3b1d62a221ab02a6357c60784b6 | [
"if not root:\n return []\nself.order = []\nself.maxDepth = 0\ndepth = 0\n\ndef traverse(node, depth):\n if node:\n if node.left or node.right:\n self.order.append([])\n self.maxDepth = max(depth, self.maxDepth)\n if node.left:\n self.order[depth].append(node.left.va... | <|body_start_0|>
if not root:
return []
self.order = []
self.maxDepth = 0
depth = 0
def traverse(node, depth):
if node:
if node.left or node.right:
self.order.append([])
self.maxDepth = max(depth, self.m... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def levelOrder(self, root: TreeNode) -> List[List[int]]:
"""Purpose: Recursively appends once entire tree is traversed in depth-first search way."""
<|body_0|>
def levelOrder(self, root: TreeNode) -> List[List[int]]:
"""Purpose: Iteratively appends to order... | stack_v2_sparse_classes_36k_train_018322 | 1,804 | no_license | [
{
"docstring": "Purpose: Recursively appends once entire tree is traversed in depth-first search way.",
"name": "levelOrder",
"signature": "def levelOrder(self, root: TreeNode) -> List[List[int]]"
},
{
"docstring": "Purpose: Iteratively appends to order in a breadth-first search way.",
"name... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def levelOrder(self, root: TreeNode) -> List[List[int]]: Purpose: Recursively appends once entire tree is traversed in depth-first search way.
- def levelOrder(self, root: TreeNo... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def levelOrder(self, root: TreeNode) -> List[List[int]]: Purpose: Recursively appends once entire tree is traversed in depth-first search way.
- def levelOrder(self, root: TreeNo... | 95a86cbbca28d0c0f6d72d28a2f1cb5a86327934 | <|skeleton|>
class Solution:
def levelOrder(self, root: TreeNode) -> List[List[int]]:
"""Purpose: Recursively appends once entire tree is traversed in depth-first search way."""
<|body_0|>
def levelOrder(self, root: TreeNode) -> List[List[int]]:
"""Purpose: Iteratively appends to order... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def levelOrder(self, root: TreeNode) -> List[List[int]]:
"""Purpose: Recursively appends once entire tree is traversed in depth-first search way."""
if not root:
return []
self.order = []
self.maxDepth = 0
depth = 0
def traverse(node, dept... | the_stack_v2_python_sparse | level_order.py | tashakim/puzzles_python | train | 8 | |
d20c832b13b8556560575c4ff64d23a29a398626 | [
"self.to = to\nself.application_id = application_id\nself.scope = scope\nself.expiration_time_in_minutes = expiration_time_in_minutes\nself.code = code",
"if dictionary is None:\n return None\nto = dictionary.get('to')\napplication_id = dictionary.get('applicationId')\nexpiration_time_in_minutes = dictionary.g... | <|body_start_0|>
self.to = to
self.application_id = application_id
self.scope = scope
self.expiration_time_in_minutes = expiration_time_in_minutes
self.code = code
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
to = dictionary.get(... | Implementation of the 'TwoFactorVerifyRequestSchema' model. TODO: type model description here. Attributes: to (string): The phone number to send the 2fa code to. application_id (string): The application unique ID, obtained from Bandwidth. scope (string): An optional field to denote what scope or action the 2fa code is ... | TwoFactorVerifyRequestSchema | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TwoFactorVerifyRequestSchema:
"""Implementation of the 'TwoFactorVerifyRequestSchema' model. TODO: type model description here. Attributes: to (string): The phone number to send the 2fa code to. application_id (string): The application unique ID, obtained from Bandwidth. scope (string): An option... | stack_v2_sparse_classes_36k_train_018323 | 2,920 | permissive | [
{
"docstring": "Constructor for the TwoFactorVerifyRequestSchema class",
"name": "__init__",
"signature": "def __init__(self, to=None, application_id=None, expiration_time_in_minutes=None, code=None, scope=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dictio... | 2 | stack_v2_sparse_classes_30k_train_008700 | Implement the Python class `TwoFactorVerifyRequestSchema` described below.
Class description:
Implementation of the 'TwoFactorVerifyRequestSchema' model. TODO: type model description here. Attributes: to (string): The phone number to send the 2fa code to. application_id (string): The application unique ID, obtained fr... | Implement the Python class `TwoFactorVerifyRequestSchema` described below.
Class description:
Implementation of the 'TwoFactorVerifyRequestSchema' model. TODO: type model description here. Attributes: to (string): The phone number to send the 2fa code to. application_id (string): The application unique ID, obtained fr... | 447df3cc8cb7acaf3361d842630c432a9c31ce6e | <|skeleton|>
class TwoFactorVerifyRequestSchema:
"""Implementation of the 'TwoFactorVerifyRequestSchema' model. TODO: type model description here. Attributes: to (string): The phone number to send the 2fa code to. application_id (string): The application unique ID, obtained from Bandwidth. scope (string): An option... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TwoFactorVerifyRequestSchema:
"""Implementation of the 'TwoFactorVerifyRequestSchema' model. TODO: type model description here. Attributes: to (string): The phone number to send the 2fa code to. application_id (string): The application unique ID, obtained from Bandwidth. scope (string): An optional field to d... | the_stack_v2_python_sparse | bandwidth/multifactorauth/models/two_factor_verify_request_schema.py | Bandwidth/python-sdk | train | 10 |
c7f899d1edcc7485c608da1ad8e2a4f49a5a488a | [
"extension = imghdr.what(file_name, decoded_file)\nextension = 'jpg' if extension == 'jpeg' else extension\nreturn extension",
"if isinstance(data, six.string_types):\n if 'data:' in data and ';base64,' in data:\n header, data = data.split(';base64,')\n try:\n decoded_file = base64.b64... | <|body_start_0|>
extension = imghdr.what(file_name, decoded_file)
extension = 'jpg' if extension == 'jpeg' else extension
return extension
<|end_body_0|>
<|body_start_1|>
if isinstance(data, six.string_types):
if 'data:' in data and ';base64,' in data:
header... | Support data-url encoding in ImageField uploads. Source: https://stackoverflow.com/questions/31690991/uploading-base64- images-using-modelserializers-in-django-django-rest-framework | Base64ImageField | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Base64ImageField:
"""Support data-url encoding in ImageField uploads. Source: https://stackoverflow.com/questions/31690991/uploading-base64- images-using-modelserializers-in-django-django-rest-framework"""
def get_file_extension(self, file_name, decoded_file):
"""Guess file extension... | stack_v2_sparse_classes_36k_train_018324 | 10,253 | permissive | [
{
"docstring": "Guess file extension from the content.",
"name": "get_file_extension",
"signature": "def get_file_extension(self, file_name, decoded_file)"
},
{
"docstring": "Decode base64 into an image.",
"name": "to_internal_value",
"signature": "def to_internal_value(self, data)"
}
... | 2 | stack_v2_sparse_classes_30k_train_001227 | Implement the Python class `Base64ImageField` described below.
Class description:
Support data-url encoding in ImageField uploads. Source: https://stackoverflow.com/questions/31690991/uploading-base64- images-using-modelserializers-in-django-django-rest-framework
Method signatures and docstrings:
- def get_file_exten... | Implement the Python class `Base64ImageField` described below.
Class description:
Support data-url encoding in ImageField uploads. Source: https://stackoverflow.com/questions/31690991/uploading-base64- images-using-modelserializers-in-django-django-rest-framework
Method signatures and docstrings:
- def get_file_exten... | 0fde7587e91a42e5a2218f2ffb70d4fc8cff7f73 | <|skeleton|>
class Base64ImageField:
"""Support data-url encoding in ImageField uploads. Source: https://stackoverflow.com/questions/31690991/uploading-base64- images-using-modelserializers-in-django-django-rest-framework"""
def get_file_extension(self, file_name, decoded_file):
"""Guess file extension... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Base64ImageField:
"""Support data-url encoding in ImageField uploads. Source: https://stackoverflow.com/questions/31690991/uploading-base64- images-using-modelserializers-in-django-django-rest-framework"""
def get_file_extension(self, file_name, decoded_file):
"""Guess file extension from the con... | the_stack_v2_python_sparse | backend/backend/api_v2/helpers.py | TheDuckWhisperer/tournesol | train | 0 |
9ea1c2746cd676d8a16df87e9b920ae9f6c52dd6 | [
"num_classes = 2\nseq_length = 4\nxlnet_base = _get_xlnet_base()\nxlnet_trainer_model = xlnet.XLNetClassifier(network=xlnet_base, num_classes=num_classes, initializer=tf.keras.initializers.RandomNormal(stddev=0.1), summary_type='last', dropout_rate=0.1)\ninputs = dict(input_word_ids=tf.keras.layers.Input(shape=(seq... | <|body_start_0|>
num_classes = 2
seq_length = 4
xlnet_base = _get_xlnet_base()
xlnet_trainer_model = xlnet.XLNetClassifier(network=xlnet_base, num_classes=num_classes, initializer=tf.keras.initializers.RandomNormal(stddev=0.1), summary_type='last', dropout_rate=0.1)
inputs = dict... | XLNetClassifierTest | [
"Apache-2.0",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class XLNetClassifierTest:
def test_xlnet_trainer(self):
"""Validate that the Keras object can be created."""
<|body_0|>
def test_xlnet_tensor_call(self, num_classes):
"""Validates that the Keras object can be invoked."""
<|body_1|>
def test_serialize_deserial... | stack_v2_sparse_classes_36k_train_018325 | 13,124 | permissive | [
{
"docstring": "Validate that the Keras object can be created.",
"name": "test_xlnet_trainer",
"signature": "def test_xlnet_trainer(self)"
},
{
"docstring": "Validates that the Keras object can be invoked.",
"name": "test_xlnet_tensor_call",
"signature": "def test_xlnet_tensor_call(self,... | 3 | stack_v2_sparse_classes_30k_train_005354 | Implement the Python class `XLNetClassifierTest` described below.
Class description:
Implement the XLNetClassifierTest class.
Method signatures and docstrings:
- def test_xlnet_trainer(self): Validate that the Keras object can be created.
- def test_xlnet_tensor_call(self, num_classes): Validates that the Keras objec... | Implement the Python class `XLNetClassifierTest` described below.
Class description:
Implement the XLNetClassifierTest class.
Method signatures and docstrings:
- def test_xlnet_trainer(self): Validate that the Keras object can be created.
- def test_xlnet_tensor_call(self, num_classes): Validates that the Keras objec... | 6fc53292b1d3ce3c0340ce724c2c11c77e663d27 | <|skeleton|>
class XLNetClassifierTest:
def test_xlnet_trainer(self):
"""Validate that the Keras object can be created."""
<|body_0|>
def test_xlnet_tensor_call(self, num_classes):
"""Validates that the Keras object can be invoked."""
<|body_1|>
def test_serialize_deserial... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class XLNetClassifierTest:
def test_xlnet_trainer(self):
"""Validate that the Keras object can be created."""
num_classes = 2
seq_length = 4
xlnet_base = _get_xlnet_base()
xlnet_trainer_model = xlnet.XLNetClassifier(network=xlnet_base, num_classes=num_classes, initializer=tf.... | the_stack_v2_python_sparse | models/official/nlp/modeling/models/xlnet_test.py | aboerzel/German_License_Plate_Recognition | train | 34 | |
91c784c600d4cc4d5d4293f798e5a5830cc12c73 | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn DeviceManagementExportJob()",
"from .device_management_export_job_localization_type import DeviceManagementExportJobLocalizationType\nfrom .device_management_report_file_format import DeviceManagementReportFileFormat\nfrom .device_mana... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return DeviceManagementExportJob()
<|end_body_0|>
<|body_start_1|>
from .device_management_export_job_localization_type import DeviceManagementExportJobLocalizationType
from .device_management_... | Entity representing a job to export a report | DeviceManagementExportJob | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DeviceManagementExportJob:
"""Entity representing a job to export a report"""
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> DeviceManagementExportJob:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The ... | stack_v2_sparse_classes_36k_train_018326 | 5,612 | 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: DeviceManagementExportJob",
"name": "create_from_discriminator_value",
"signature": "def create_from_discrim... | 3 | stack_v2_sparse_classes_30k_test_001108 | Implement the Python class `DeviceManagementExportJob` described below.
Class description:
Entity representing a job to export a report
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> DeviceManagementExportJob: Creates a new instance of the appropriate ... | Implement the Python class `DeviceManagementExportJob` described below.
Class description:
Entity representing a job to export a report
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> DeviceManagementExportJob: Creates a new instance of the appropriate ... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class DeviceManagementExportJob:
"""Entity representing a job to export a report"""
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> DeviceManagementExportJob:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DeviceManagementExportJob:
"""Entity representing a job to export a report"""
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> DeviceManagementExportJob:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to... | the_stack_v2_python_sparse | msgraph/generated/models/device_management_export_job.py | microsoftgraph/msgraph-sdk-python | train | 135 |
e56b1cf13574e362df8cd5785b9816c1507793f6 | [
"log_as_info('\\nIncludeDirective.run')\nnode = IncludeNode('')\njinja2_value = self.arguments[0].replace('<', '{{ ').replace('>', ' }}')\nnode.markup = create_post_processing_markup('INCLUDE', jinja2_value)\nreturn [node]",
"for node in doctree.traverse(IncludeNode):\n replacement_node = docutils.nodes.raw(''... | <|body_start_0|>
log_as_info('\nIncludeDirective.run')
node = IncludeNode('')
jinja2_value = self.arguments[0].replace('<', '{{ ').replace('>', ' }}')
node.markup = create_post_processing_markup('INCLUDE', jinja2_value)
return [node]
<|end_body_0|>
<|body_start_1|>
for n... | Implements the .\\. astutus_dyn_include:: directive. This directive allows inserting functional Jinja2 templates into the styled template generated for dynamic pages. The one required argument specifies a relative filepath to locate the template within the template directory of the Flask application. This directive is ... | IncludeDirective | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IncludeDirective:
"""Implements the .\\. astutus_dyn_include:: directive. This directive allows inserting functional Jinja2 templates into the styled template generated for dynamic pages. The one required argument specifies a relative filepath to locate the template within the template directory ... | stack_v2_sparse_classes_36k_train_018327 | 16,710 | permissive | [
{
"docstring": "Replaces the directive in the \\\\*.rst file with a IncludeNode.",
"name": "run",
"signature": "def run(self) -> List[docutils.nodes.Node]"
},
{
"docstring": "Handle include modification by inserting post processing markup.",
"name": "handle_insert_markup",
"signature": "... | 2 | stack_v2_sparse_classes_30k_train_019916 | Implement the Python class `IncludeDirective` described below.
Class description:
Implements the .\\. astutus_dyn_include:: directive. This directive allows inserting functional Jinja2 templates into the styled template generated for dynamic pages. The one required argument specifies a relative filepath to locate the ... | Implement the Python class `IncludeDirective` described below.
Class description:
Implements the .\\. astutus_dyn_include:: directive. This directive allows inserting functional Jinja2 templates into the styled template generated for dynamic pages. The one required argument specifies a relative filepath to locate the ... | 46a11295394093de3a23cb8dec1e2e76eac752e8 | <|skeleton|>
class IncludeDirective:
"""Implements the .\\. astutus_dyn_include:: directive. This directive allows inserting functional Jinja2 templates into the styled template generated for dynamic pages. The one required argument specifies a relative filepath to locate the template within the template directory ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class IncludeDirective:
"""Implements the .\\. astutus_dyn_include:: directive. This directive allows inserting functional Jinja2 templates into the styled template generated for dynamic pages. The one required argument specifies a relative filepath to locate the template within the template directory of the Flask ... | the_stack_v2_python_sparse | src/astutus/sphinx/dyn_pages.py | rich-dobbs-13440/astutus | train | 0 |
5e088115c9463d09627074763e3b3931f5b28c67 | [
"matrix = 'default'\nif 'PIPELINE_MATRIX' in pipeline.data.env_list[0]:\n matrix = pipeline.data.env_list[0]['PIPELINE_MATRIX']\nself.event = Event.create(__name__, matrix=matrix, stage=title, report=pipeline.options.report)\nself.logger = Logger.get_logger(__name__)\nself.pipeline = pipeline\nself.title = title... | <|body_start_0|>
matrix = 'default'
if 'PIPELINE_MATRIX' in pipeline.data.env_list[0]:
matrix = pipeline.data.env_list[0]['PIPELINE_MATRIX']
self.event = Event.create(__name__, matrix=matrix, stage=title, report=pipeline.options.report)
self.logger = Logger.get_logger(__name_... | Class for representing a named group (title). | Stage | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Stage:
"""Class for representing a named group (title)."""
def __init__(self, pipeline, title):
"""Initializing with reference to pipeline main object."""
<|body_0|>
def process(self, stage):
"""Processing one stage."""
<|body_1|>
<|end_skeleton|>
<|bod... | stack_v2_sparse_classes_36k_train_018328 | 2,987 | permissive | [
{
"docstring": "Initializing with reference to pipeline main object.",
"name": "__init__",
"signature": "def __init__(self, pipeline, title)"
},
{
"docstring": "Processing one stage.",
"name": "process",
"signature": "def process(self, stage)"
}
] | 2 | stack_v2_sparse_classes_30k_val_000532 | Implement the Python class `Stage` described below.
Class description:
Class for representing a named group (title).
Method signatures and docstrings:
- def __init__(self, pipeline, title): Initializing with reference to pipeline main object.
- def process(self, stage): Processing one stage. | Implement the Python class `Stage` described below.
Class description:
Class for representing a named group (title).
Method signatures and docstrings:
- def __init__(self, pipeline, title): Initializing with reference to pipeline main object.
- def process(self, stage): Processing one stage.
<|skeleton|>
class Stage... | ee15d98f4d8f343d57dd5b84339ea41b4e2dc673 | <|skeleton|>
class Stage:
"""Class for representing a named group (title)."""
def __init__(self, pipeline, title):
"""Initializing with reference to pipeline main object."""
<|body_0|>
def process(self, stage):
"""Processing one stage."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Stage:
"""Class for representing a named group (title)."""
def __init__(self, pipeline, title):
"""Initializing with reference to pipeline main object."""
matrix = 'default'
if 'PIPELINE_MATRIX' in pipeline.data.env_list[0]:
matrix = pipeline.data.env_list[0]['PIPELINE... | the_stack_v2_python_sparse | spline/components/stage.py | Nachtfeuer/pipeline | train | 30 |
0c9f8071ca564e83b7c144dbb64727199dd413cf | [
"try:\n py_obj = XML_Objectify(fname, EXPAT).make_instance()\n if not py_obj:\n raise 'BadPaserError'\n py_obj = XML_Objectify(fname, DOM).make_instance()\n if self.quiet < 5:\n print('Indexing', fname)\nexcept IOError:\n return 0\nself.fname_prefix = fname\nself.recurse_nodes(py_ob... | <|body_start_0|>
try:
py_obj = XML_Objectify(fname, EXPAT).make_instance()
if not py_obj:
raise 'BadPaserError'
py_obj = XML_Objectify(fname, DOM).make_instance()
if self.quiet < 5:
print('Indexing', fname)
except IOErro... | Concrete Indexer for XML-as-hierarchical-filesystem | XML_Indexer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class XML_Indexer:
"""Concrete Indexer for XML-as-hierarchical-filesystem"""
def add_file(self, fname):
"""Index the nodes of an XML file"""
<|body_0|>
def recurse_nodes(self, currnode, xpath_suffix=''):
"""Recurse and process nodes in XML file"""
<|body_1|>
... | stack_v2_sparse_classes_36k_train_018329 | 5,657 | no_license | [
{
"docstring": "Index the nodes of an XML file",
"name": "add_file",
"signature": "def add_file(self, fname)"
},
{
"docstring": "Recurse and process nodes in XML file",
"name": "recurse_nodes",
"signature": "def recurse_nodes(self, currnode, xpath_suffix='')"
},
{
"docstring": "A... | 3 | stack_v2_sparse_classes_30k_train_018540 | Implement the Python class `XML_Indexer` described below.
Class description:
Concrete Indexer for XML-as-hierarchical-filesystem
Method signatures and docstrings:
- def add_file(self, fname): Index the nodes of an XML file
- def recurse_nodes(self, currnode, xpath_suffix=''): Recurse and process nodes in XML file
- d... | Implement the Python class `XML_Indexer` described below.
Class description:
Concrete Indexer for XML-as-hierarchical-filesystem
Method signatures and docstrings:
- def add_file(self, fname): Index the nodes of an XML file
- def recurse_nodes(self, currnode, xpath_suffix=''): Recurse and process nodes in XML file
- d... | 2c5338334c88f52fd0d609df77f317d8bcabfe1a | <|skeleton|>
class XML_Indexer:
"""Concrete Indexer for XML-as-hierarchical-filesystem"""
def add_file(self, fname):
"""Index the nodes of an XML file"""
<|body_0|>
def recurse_nodes(self, currnode, xpath_suffix=''):
"""Recurse and process nodes in XML file"""
<|body_1|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class XML_Indexer:
"""Concrete Indexer for XML-as-hierarchical-filesystem"""
def add_file(self, fname):
"""Index the nodes of an XML file"""
try:
py_obj = XML_Objectify(fname, EXPAT).make_instance()
if not py_obj:
raise 'BadPaserError'
py_... | the_stack_v2_python_sparse | gnosis/xml/indexer.py | firegod2018/GUI_For_CanFestival | train | 3 |
62be8f245d8af0114d8105897050406db2cb813e | [
"filtered_list = []\nroot_queryset = queryset.filter(pk=value)\nif not root_queryset.exists():\n return root_queryset\nqueue = [root_queryset[0]]\nwhile len(queue) > 0:\n visited = queue.pop()\n queue.extend(list(visited.next.all()))\n filtered_list.append(visited.id)\nreturn PluginInstance.objects.filt... | <|body_start_0|>
filtered_list = []
root_queryset = queryset.filter(pk=value)
if not root_queryset.exists():
return root_queryset
queue = [root_queryset[0]]
while len(queue) > 0:
visited = queue.pop()
queue.extend(list(visited.next.all()))
... | PluginInstanceFilter | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PluginInstanceFilter:
def filter_by_root_id(self, queryset, name, value):
"""Custom method to return the plugin instances in a queryset with a common root plugin instance."""
<|body_0|>
def filter_by_previous_id(self, queryset, name, value):
"""Custom method to retur... | stack_v2_sparse_classes_36k_train_018330 | 16,304 | permissive | [
{
"docstring": "Custom method to return the plugin instances in a queryset with a common root plugin instance.",
"name": "filter_by_root_id",
"signature": "def filter_by_root_id(self, queryset, name, value)"
},
{
"docstring": "Custom method to return the plugin instances in a queryset with a com... | 2 | null | Implement the Python class `PluginInstanceFilter` described below.
Class description:
Implement the PluginInstanceFilter class.
Method signatures and docstrings:
- def filter_by_root_id(self, queryset, name, value): Custom method to return the plugin instances in a queryset with a common root plugin instance.
- def f... | Implement the Python class `PluginInstanceFilter` described below.
Class description:
Implement the PluginInstanceFilter class.
Method signatures and docstrings:
- def filter_by_root_id(self, queryset, name, value): Custom method to return the plugin instances in a queryset with a common root plugin instance.
- def f... | 20d3eedf20610af9182f6cca8db8f0b3546b5336 | <|skeleton|>
class PluginInstanceFilter:
def filter_by_root_id(self, queryset, name, value):
"""Custom method to return the plugin instances in a queryset with a common root plugin instance."""
<|body_0|>
def filter_by_previous_id(self, queryset, name, value):
"""Custom method to retur... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PluginInstanceFilter:
def filter_by_root_id(self, queryset, name, value):
"""Custom method to return the plugin instances in a queryset with a common root plugin instance."""
filtered_list = []
root_queryset = queryset.filter(pk=value)
if not root_queryset.exists():
... | the_stack_v2_python_sparse | chris_backend/plugininstances/models.py | FNNDSC/ChRIS_ultron_backEnd | train | 36 | |
4ba3a0702ff1443ae24fcee69062d3a38329a628 | [
"if not head or not head.next:\n return head\ndummy = ListNode(0)\ndummy.next = head\nsize = 0\nwhile head:\n head = head.next\n size += 1\nstep = 1\nwhile step < size:\n curr, tail = (dummy.next, dummy)\n while curr:\n left = curr\n right = self.split(left, step)\n curr = self.s... | <|body_start_0|>
if not head or not head.next:
return head
dummy = ListNode(0)
dummy.next = head
size = 0
while head:
head = head.next
size += 1
step = 1
while step < size:
curr, tail = (dummy.next, dummy)
... | Node | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Node:
def sorted(self, head: 'ListNode') -> 'ListNode':
"""Sorts the given linked list Time Complexity: O(N log N) Space Complexity: O(1) :param head: :return:"""
<|body_0|>
def merge(self, left: 'ListNode', right: ListNode, head: 'ListNode') -> 'ListNode':
"""Merges... | stack_v2_sparse_classes_36k_train_018331 | 2,250 | no_license | [
{
"docstring": "Sorts the given linked list Time Complexity: O(N log N) Space Complexity: O(1) :param head: :return:",
"name": "sorted",
"signature": "def sorted(self, head: 'ListNode') -> 'ListNode'"
},
{
"docstring": "Merges the left and right after the comparision. :param left: :param right: ... | 3 | stack_v2_sparse_classes_30k_train_013989 | Implement the Python class `Node` described below.
Class description:
Implement the Node class.
Method signatures and docstrings:
- def sorted(self, head: 'ListNode') -> 'ListNode': Sorts the given linked list Time Complexity: O(N log N) Space Complexity: O(1) :param head: :return:
- def merge(self, left: 'ListNode',... | Implement the Python class `Node` described below.
Class description:
Implement the Node class.
Method signatures and docstrings:
- def sorted(self, head: 'ListNode') -> 'ListNode': Sorts the given linked list Time Complexity: O(N log N) Space Complexity: O(1) :param head: :return:
- def merge(self, left: 'ListNode',... | 65cc78b5afa0db064f9fe8f06597e3e120f7363d | <|skeleton|>
class Node:
def sorted(self, head: 'ListNode') -> 'ListNode':
"""Sorts the given linked list Time Complexity: O(N log N) Space Complexity: O(1) :param head: :return:"""
<|body_0|>
def merge(self, left: 'ListNode', right: ListNode, head: 'ListNode') -> 'ListNode':
"""Merges... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Node:
def sorted(self, head: 'ListNode') -> 'ListNode':
"""Sorts the given linked list Time Complexity: O(N log N) Space Complexity: O(1) :param head: :return:"""
if not head or not head.next:
return head
dummy = ListNode(0)
dummy.next = head
size = 0
... | the_stack_v2_python_sparse | revisited/linked_list/sort_list.py | Shiv2157k/leet_code | train | 1 | |
787a1b61ae0bc890ca0772ea5aed183e4cbe89aa | [
"self.folder = folder\nself.subset = subset\nself.is_latin_required = is_latin_required\nif root:\n self.folder = os.path.join(root, self.folder)\nassert self.subset in ['train', 'val']\nif self.subset == 'train':\n for i in range(1, 9):\n assert os.path.exists(os.path.join(self.folder, f'ch8_training_... | <|body_start_0|>
self.folder = folder
self.subset = subset
self.is_latin_required = is_latin_required
if root:
self.folder = os.path.join(root, self.folder)
assert self.subset in ['train', 'val']
if self.subset == 'train':
for i in range(1, 9):
... | Class for conversion of ICDAR2017 to TextOnlyCocoAnnotation. | ICDAR2017MLTDatasetConverter | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ICDAR2017MLTDatasetConverter:
"""Class for conversion of ICDAR2017 to TextOnlyCocoAnnotation."""
def __init__(self, folder, subset, is_latin_required, root=''):
"""Converts ICDAR2017 MLT to TextOnlyCocoAnnotation :param folder: Folder with extracted zip archives containing images and... | stack_v2_sparse_classes_36k_train_018332 | 25,441 | permissive | [
{
"docstring": "Converts ICDAR2017 MLT to TextOnlyCocoAnnotation :param folder: Folder with extracted zip archives containing images and annotation. :param subset: 'train' or 'val' :param is_latin_required: if it is True than images that do not contain latin text will be filtered out.",
"name": "__init__",
... | 5 | null | Implement the Python class `ICDAR2017MLTDatasetConverter` described below.
Class description:
Class for conversion of ICDAR2017 to TextOnlyCocoAnnotation.
Method signatures and docstrings:
- def __init__(self, folder, subset, is_latin_required, root=''): Converts ICDAR2017 MLT to TextOnlyCocoAnnotation :param folder:... | Implement the Python class `ICDAR2017MLTDatasetConverter` described below.
Class description:
Class for conversion of ICDAR2017 to TextOnlyCocoAnnotation.
Method signatures and docstrings:
- def __init__(self, folder, subset, is_latin_required, root=''): Converts ICDAR2017 MLT to TextOnlyCocoAnnotation :param folder:... | c553a56088f0055baba838b68c9299e19683227e | <|skeleton|>
class ICDAR2017MLTDatasetConverter:
"""Class for conversion of ICDAR2017 to TextOnlyCocoAnnotation."""
def __init__(self, folder, subset, is_latin_required, root=''):
"""Converts ICDAR2017 MLT to TextOnlyCocoAnnotation :param folder: Folder with extracted zip archives containing images and... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ICDAR2017MLTDatasetConverter:
"""Class for conversion of ICDAR2017 to TextOnlyCocoAnnotation."""
def __init__(self, folder, subset, is_latin_required, root=''):
"""Converts ICDAR2017 MLT to TextOnlyCocoAnnotation :param folder: Folder with extracted zip archives containing images and annotation. ... | the_stack_v2_python_sparse | pytorch_toolkit/text_spotting/text_spotting/datasets/datasets.py | DmitriySidnev/openvino_training_extensions | train | 0 |
cb374b64b7f436cbb15c31dfdd01ae7ee084fca7 | [
"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... | This service allows management of links between Google Ads accounts and other accounts. | AccountLinkServiceServicer | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AccountLinkServiceServicer:
"""This service allows management of links between Google Ads accounts and other accounts."""
def GetAccountLink(self, request, context):
"""Returns the account link in full detail."""
<|body_0|>
def CreateAccountLink(self, request, context):
... | stack_v2_sparse_classes_36k_train_018333 | 7,673 | permissive | [
{
"docstring": "Returns the account link in full detail.",
"name": "GetAccountLink",
"signature": "def GetAccountLink(self, request, context)"
},
{
"docstring": "Creates an account link.",
"name": "CreateAccountLink",
"signature": "def CreateAccountLink(self, request, context)"
},
{
... | 3 | null | Implement the Python class `AccountLinkServiceServicer` described below.
Class description:
This service allows management of links between Google Ads accounts and other accounts.
Method signatures and docstrings:
- def GetAccountLink(self, request, context): Returns the account link in full detail.
- def CreateAccou... | Implement the Python class `AccountLinkServiceServicer` described below.
Class description:
This service allows management of links between Google Ads accounts and other accounts.
Method signatures and docstrings:
- def GetAccountLink(self, request, context): Returns the account link in full detail.
- def CreateAccou... | a5b6cede64f4d9912ae6ad26927a54e40448c9fe | <|skeleton|>
class AccountLinkServiceServicer:
"""This service allows management of links between Google Ads accounts and other accounts."""
def GetAccountLink(self, request, context):
"""Returns the account link in full detail."""
<|body_0|>
def CreateAccountLink(self, request, context):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AccountLinkServiceServicer:
"""This service allows management of links between Google Ads accounts and other accounts."""
def GetAccountLink(self, request, context):
"""Returns the account link in full detail."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details(... | the_stack_v2_python_sparse | google/ads/google_ads/v5/proto/services/account_link_service_pb2_grpc.py | fiboknacky/google-ads-python | train | 0 |
7b5789d3208f144f041ca923f7ce08533546434c | [
"self.xLoc = (geneObj.start, geneObj.end)\nself.yLoc = self._get_y(1, 5, geneObj.transCnt)\nself.patches = []\ntsList = geneObj.transcript.keys()\nif geneObj.strand == '-':\n tsList.sort(key=lambda x: geneObj.transcript[x]['tsEnd'])\nelse:\n tsList.sort(key=lambda x: geneObj.transcript[x]['tsStart'])\nfor ind... | <|body_start_0|>
self.xLoc = (geneObj.start, geneObj.end)
self.yLoc = self._get_y(1, 5, geneObj.transCnt)
self.patches = []
tsList = geneObj.transcript.keys()
if geneObj.strand == '-':
tsList.sort(key=lambda x: geneObj.transcript[x]['tsEnd'])
else:
... | Class to construct a gene model | GeneModel | [
"MIT",
"GPL-3.0-only"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GeneModel:
"""Class to construct a gene model"""
def __init__(self, geneObj, height=2):
"""Arguments: geneObj (obj) = a gene object created from a subclass of _Gene in mclib.gff height (int) = the height of the exon model Attributes: xLoc (tuple) = Gene start and end coordinates. yLo... | stack_v2_sparse_classes_36k_train_018334 | 7,451 | permissive | [
{
"docstring": "Arguments: geneObj (obj) = a gene object created from a subclass of _Gene in mclib.gff height (int) = the height of the exon model Attributes: xLoc (tuple) = Gene start and end coordinates. yLoc (list) = List of y-coordinates for plotting each transcript on a different row patches (list) = List ... | 3 | stack_v2_sparse_classes_30k_test_000189 | Implement the Python class `GeneModel` described below.
Class description:
Class to construct a gene model
Method signatures and docstrings:
- def __init__(self, geneObj, height=2): Arguments: geneObj (obj) = a gene object created from a subclass of _Gene in mclib.gff height (int) = the height of the exon model Attri... | Implement the Python class `GeneModel` described below.
Class description:
Class to construct a gene model
Method signatures and docstrings:
- def __init__(self, geneObj, height=2): Arguments: geneObj (obj) = a gene object created from a subclass of _Gene in mclib.gff height (int) = the height of the exon model Attri... | edafc670880803433b7f2255058bf9696699b581 | <|skeleton|>
class GeneModel:
"""Class to construct a gene model"""
def __init__(self, geneObj, height=2):
"""Arguments: geneObj (obj) = a gene object created from a subclass of _Gene in mclib.gff height (int) = the height of the exon model Attributes: xLoc (tuple) = Gene start and end coordinates. yLo... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GeneModel:
"""Class to construct a gene model"""
def __init__(self, geneObj, height=2):
"""Arguments: geneObj (obj) = a gene object created from a subclass of _Gene in mclib.gff height (int) = the height of the exon model Attributes: xLoc (tuple) = Gene start and end coordinates. yLoc (list) = Li... | the_stack_v2_python_sparse | hpc/ase_scripts/mclib_Python/wiggle.py | jlboat/BayesASE | train | 0 |
4bbd75b185d33458557225779bb8f77f0faed11e | [
"print(f'Running test: {description}')\nnumber_of_qubits = len(valid_states[0])\nnumber_of_valid_states = len(valid_states)\nqubits = circuit.qregs[0]\nbits = ClassicalRegister(number_of_qubits)\ncircuit.add_register(bits)\ncircuit.barrier(qubits)\ncircuit.measure(qubits, bits)\nsimulator = Aer.get_backend('qasm_si... | <|body_start_0|>
print(f'Running test: {description}')
number_of_qubits = len(valid_states[0])
number_of_valid_states = len(valid_states)
qubits = circuit.qregs[0]
bits = ClassicalRegister(number_of_qubits)
circuit.add_register(bits)
circuit.barrier(qubits)
... | This class contains some basic tests to show how Qiskit deals with entanglement. | EntanglementTests | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EntanglementTests:
"""This class contains some basic tests to show how Qiskit deals with entanglement."""
def run_test(self, description, circuit, iterations, valid_states):
"""Runs a given circuit as a unit test, measuring the results and ensuring that the resulting state matches on... | stack_v2_sparse_classes_36k_train_018335 | 6,978 | permissive | [
{
"docstring": "Runs a given circuit as a unit test, measuring the results and ensuring that the resulting state matches one of the provided target states. Parameters: description (str): A human-readable description of the test, which will be printed to the log. circuit (QuantumCircuit): The circuit to run duri... | 5 | stack_v2_sparse_classes_30k_train_013709 | Implement the Python class `EntanglementTests` described below.
Class description:
This class contains some basic tests to show how Qiskit deals with entanglement.
Method signatures and docstrings:
- def run_test(self, description, circuit, iterations, valid_states): Runs a given circuit as a unit test, measuring the... | Implement the Python class `EntanglementTests` described below.
Class description:
This class contains some basic tests to show how Qiskit deals with entanglement.
Method signatures and docstrings:
- def run_test(self, description, circuit, iterations, valid_states): Runs a given circuit as a unit test, measuring the... | 941488f8f8a81a4b7d7fe28414ce14fa478a692a | <|skeleton|>
class EntanglementTests:
"""This class contains some basic tests to show how Qiskit deals with entanglement."""
def run_test(self, description, circuit, iterations, valid_states):
"""Runs a given circuit as a unit test, measuring the results and ensuring that the resulting state matches on... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class EntanglementTests:
"""This class contains some basic tests to show how Qiskit deals with entanglement."""
def run_test(self, description, circuit, iterations, valid_states):
"""Runs a given circuit as a unit test, measuring the results and ensuring that the resulting state matches one of the prov... | the_stack_v2_python_sparse | Qiskit/QiskitFundamentals/entanglement.py | taibah/qsfe | train | 0 |
312580ce0cb705a8af99843ddc4337e18b5ca6c6 | [
"self.print = print\nself.pcd = pcd.raw_pcd\nself.points = pcd.points\nself.pcd_kdtree = pcd.kdtree\nself.stats = {}\nself.floor_segmentation = FloorSegmentation(print)\nself.cell_segmentation = CellSegmentation(print)\nself.cell_classification = CellClassification(print)\nself.point_classification = PointClassific... | <|body_start_0|>
self.print = print
self.pcd = pcd.raw_pcd
self.points = pcd.points
self.pcd_kdtree = pcd.kdtree
self.stats = {}
self.floor_segmentation = FloorSegmentation(print)
self.cell_segmentation = CellSegmentation(print)
self.cell_classification = ... | A class for doing calculations for terrain assessment to find all ground points in a point cloud. | TerrainAssessment | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TerrainAssessment:
"""A class for doing calculations for terrain assessment to find all ground points in a point cloud."""
def __init__(self, print, pcd):
"""Args: print: Function for printing messages pcd: A PointCloud object with the point cloud that will be analysed."""
<|... | stack_v2_sparse_classes_36k_train_018336 | 15,765 | no_license | [
{
"docstring": "Args: print: Function for printing messages pcd: A PointCloud object with the point cloud that will be analysed.",
"name": "__init__",
"signature": "def __init__(self, print, pcd)"
},
{
"docstring": "Analyses point cloud to find all coverable and traversable points in 4 steps: 1.... | 2 | stack_v2_sparse_classes_30k_train_006373 | Implement the Python class `TerrainAssessment` described below.
Class description:
A class for doing calculations for terrain assessment to find all ground points in a point cloud.
Method signatures and docstrings:
- def __init__(self, print, pcd): Args: print: Function for printing messages pcd: A PointCloud object ... | Implement the Python class `TerrainAssessment` described below.
Class description:
A class for doing calculations for terrain assessment to find all ground points in a point cloud.
Method signatures and docstrings:
- def __init__(self, print, pcd): Args: print: Function for printing messages pcd: A PointCloud object ... | 3794c8a19839fa1452315c96f8b45e6b9845ca13 | <|skeleton|>
class TerrainAssessment:
"""A class for doing calculations for terrain assessment to find all ground points in a point cloud."""
def __init__(self, print, pcd):
"""Args: print: Function for printing messages pcd: A PointCloud object with the point cloud that will be analysed."""
<|... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TerrainAssessment:
"""A class for doing calculations for terrain assessment to find all ground points in a point cloud."""
def __init__(self, print, pcd):
"""Args: print: Function for printing messages pcd: A PointCloud object with the point cloud that will be analysed."""
self.print = pr... | the_stack_v2_python_sparse | src/exjobb/exjobb/TerrainAssessment.py | danneengelson/exjobb | train | 1 |
fdf52c53e8c01d13ae12d342deb658977903b435 | [
"self.host = host\nself.username = username\nself.password = password\nself.port = port\nself.phonebook_id = phonebook_id\nself.phonebook_dict = None\nself.number_dict = None\nself.prefixes = prefixes or []\nself.fph = FritzPhonebook(address=self.host, user=self.username, password=self.password)\nif self.phonebook_... | <|body_start_0|>
self.host = host
self.username = username
self.password = password
self.port = port
self.phonebook_id = phonebook_id
self.phonebook_dict = None
self.number_dict = None
self.prefixes = prefixes or []
self.fph = FritzPhonebook(addres... | This connects to a FritzBox router and downloads its phone book. | FritzBoxPhonebook | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FritzBoxPhonebook:
"""This connects to a FritzBox router and downloads its phone book."""
def __init__(self, host, port, username, password, phonebook_id=0, prefixes=None):
"""Initialize the class."""
<|body_0|>
def update_phonebook(self):
"""Update the phone boo... | stack_v2_sparse_classes_36k_train_018337 | 9,842 | permissive | [
{
"docstring": "Initialize the class.",
"name": "__init__",
"signature": "def __init__(self, host, port, username, password, phonebook_id=0, prefixes=None)"
},
{
"docstring": "Update the phone book dictionary.",
"name": "update_phonebook",
"signature": "def update_phonebook(self)"
},
... | 3 | stack_v2_sparse_classes_30k_train_004356 | Implement the Python class `FritzBoxPhonebook` described below.
Class description:
This connects to a FritzBox router and downloads its phone book.
Method signatures and docstrings:
- def __init__(self, host, port, username, password, phonebook_id=0, prefixes=None): Initialize the class.
- def update_phonebook(self):... | Implement the Python class `FritzBoxPhonebook` described below.
Class description:
This connects to a FritzBox router and downloads its phone book.
Method signatures and docstrings:
- def __init__(self, host, port, username, password, phonebook_id=0, prefixes=None): Initialize the class.
- def update_phonebook(self):... | ed4ab403deaed9e8c95e0db728477fcb012bf4fa | <|skeleton|>
class FritzBoxPhonebook:
"""This connects to a FritzBox router and downloads its phone book."""
def __init__(self, host, port, username, password, phonebook_id=0, prefixes=None):
"""Initialize the class."""
<|body_0|>
def update_phonebook(self):
"""Update the phone boo... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FritzBoxPhonebook:
"""This connects to a FritzBox router and downloads its phone book."""
def __init__(self, host, port, username, password, phonebook_id=0, prefixes=None):
"""Initialize the class."""
self.host = host
self.username = username
self.password = password
... | the_stack_v2_python_sparse | homeassistant/components/fritzbox_callmonitor/sensor.py | tchellomello/home-assistant | train | 8 |
05887a895e44078942e2495e3c1e38435ea68d7d | [
"try:\n value = MigrationStep.objects.get(id=value['id'])\nexcept Exception as e:\n logger.exception('Failed to get migration step')\n raise serializers.ValidationError(e)\nreturn value",
"migration = value['migration']\ninstance = value['instance']\ntry:\n value, _ = MigrationReport.objects.get_or_cr... | <|body_start_0|>
try:
value = MigrationStep.objects.get(id=value['id'])
except Exception as e:
logger.exception('Failed to get migration step')
raise serializers.ValidationError(e)
return value
<|end_body_0|>
<|body_start_1|>
migration = value['migrat... | Migration step report serializer. | MigrationStepReportSerializer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MigrationStepReportSerializer:
"""Migration step report serializer."""
def validate_step(self, value):
"""Validate step complex type."""
<|body_0|>
def validate_report(self, value):
"""Validate migration complex type."""
<|body_1|>
def create(self, v... | stack_v2_sparse_classes_36k_train_018338 | 15,874 | permissive | [
{
"docstring": "Validate step complex type.",
"name": "validate_step",
"signature": "def validate_step(self, value)"
},
{
"docstring": "Validate migration complex type.",
"name": "validate_report",
"signature": "def validate_report(self, value)"
},
{
"docstring": "Create or updat... | 3 | stack_v2_sparse_classes_30k_train_000396 | Implement the Python class `MigrationStepReportSerializer` described below.
Class description:
Migration step report serializer.
Method signatures and docstrings:
- def validate_step(self, value): Validate step complex type.
- def validate_report(self, value): Validate migration complex type.
- def create(self, valid... | Implement the Python class `MigrationStepReportSerializer` described below.
Class description:
Migration step report serializer.
Method signatures and docstrings:
- def validate_step(self, value): Validate step complex type.
- def validate_report(self, value): Validate migration complex type.
- def create(self, valid... | 5c32aab78e48b5249fd458d9c837596a75698968 | <|skeleton|>
class MigrationStepReportSerializer:
"""Migration step report serializer."""
def validate_step(self, value):
"""Validate step complex type."""
<|body_0|>
def validate_report(self, value):
"""Validate migration complex type."""
<|body_1|>
def create(self, v... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MigrationStepReportSerializer:
"""Migration step report serializer."""
def validate_step(self, value):
"""Validate step complex type."""
try:
value = MigrationStep.objects.get(id=value['id'])
except Exception as e:
logger.exception('Failed to get migration ... | the_stack_v2_python_sparse | pdt/api/serializers.py | AbdulRahmanAlHamali/pdt | train | 0 |
e8dc252f214e13e34c8cf03fddc2823244bd9d03 | [
"super().__init__()\nself.W = tf.keras.layers.Dense(units)\nself.U = tf.keras.layers.Dense(units)\nself.V = tf.keras.layers.Dense(1)",
"prev = tf.expand_dims(s_prev, axis=1)\nenco = self.V(tf.nn.tanh(self.W(prev) + self.U(hidden_states)))\nweights = tf.nn.softmax(enco, axis=1)\ncontext = weights * hidden_states\n... | <|body_start_0|>
super().__init__()
self.W = tf.keras.layers.Dense(units)
self.U = tf.keras.layers.Dense(units)
self.V = tf.keras.layers.Dense(1)
<|end_body_0|>
<|body_start_1|>
prev = tf.expand_dims(s_prev, axis=1)
enco = self.V(tf.nn.tanh(self.W(prev) + self.U(hidden_s... | Calculate the attention for machine translation | SelfAttention | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SelfAttention:
"""Calculate the attention for machine translation"""
def __init__(self, units):
"""Units is an integer representing the number of hidden units in the alignment model."""
<|body_0|>
def call(self, s_prev, hidden_states):
"""s_prev is a tensor of sh... | stack_v2_sparse_classes_36k_train_018339 | 1,085 | no_license | [
{
"docstring": "Units is an integer representing the number of hidden units in the alignment model.",
"name": "__init__",
"signature": "def __init__(self, units)"
},
{
"docstring": "s_prev is a tensor of shape (batch, units) containing the previous decoder hidden state. hidden_states is a tensor... | 2 | stack_v2_sparse_classes_30k_train_009925 | Implement the Python class `SelfAttention` described below.
Class description:
Calculate the attention for machine translation
Method signatures and docstrings:
- def __init__(self, units): Units is an integer representing the number of hidden units in the alignment model.
- def call(self, s_prev, hidden_states): s_p... | Implement the Python class `SelfAttention` described below.
Class description:
Calculate the attention for machine translation
Method signatures and docstrings:
- def __init__(self, units): Units is an integer representing the number of hidden units in the alignment model.
- def call(self, s_prev, hidden_states): s_p... | b0c18df889d8bd0c24d4bdbbd69be06bc5c0a918 | <|skeleton|>
class SelfAttention:
"""Calculate the attention for machine translation"""
def __init__(self, units):
"""Units is an integer representing the number of hidden units in the alignment model."""
<|body_0|>
def call(self, s_prev, hidden_states):
"""s_prev is a tensor of sh... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SelfAttention:
"""Calculate the attention for machine translation"""
def __init__(self, units):
"""Units is an integer representing the number of hidden units in the alignment model."""
super().__init__()
self.W = tf.keras.layers.Dense(units)
self.U = tf.keras.layers.Dense... | the_stack_v2_python_sparse | supervised_learning/0x11-attention/1-self_attention.py | Gaspela/holbertonschool-machine_learning | train | 0 |
2b7d07fd815a2f68717970b5b3b13df419c4eb21 | [
"self.content_type = CONTENT_TYPE\nself.root = ROOT\nself.headers_obj = HmcHeaders.HmcHeaders('uom')",
"log_object.log_debug('list of Lpar started')\nlisting_object = ListModule.ListModule()\nobject_list = listing_object.listing('uom', ip, self.root, self.content_type, 'LogicalPartition', session_id, uuid)\nlog_o... | <|body_start_0|>
self.content_type = CONTENT_TYPE
self.root = ROOT
self.headers_obj = HmcHeaders.HmcHeaders('uom')
<|end_body_0|>
<|body_start_1|>
log_object.log_debug('list of Lpar started')
listing_object = ListModule.ListModule()
object_list = listing_object.listing('... | ListLogicalPartition | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ListLogicalPartition:
def __init__(self):
"""initializes root and content-type"""
<|body_0|>
def list_LogicalPartition(self, ip, uuid, session_id):
"""returns the list of available logicalpartition objects Args: ip : ip address of HMC uuid : UUID of the Logical Parti... | stack_v2_sparse_classes_36k_train_018340 | 4,903 | permissive | [
{
"docstring": "initializes root and content-type",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "returns the list of available logicalpartition objects Args: ip : ip address of HMC uuid : UUID of the Logical Partition session_id : session to be used",
"name": "lis... | 3 | null | Implement the Python class `ListLogicalPartition` described below.
Class description:
Implement the ListLogicalPartition class.
Method signatures and docstrings:
- def __init__(self): initializes root and content-type
- def list_LogicalPartition(self, ip, uuid, session_id): returns the list of available logicalpartit... | Implement the Python class `ListLogicalPartition` described below.
Class description:
Implement the ListLogicalPartition class.
Method signatures and docstrings:
- def __init__(self): initializes root and content-type
- def list_LogicalPartition(self, ip, uuid, session_id): returns the list of available logicalpartit... | 8e46a5a25a57d07f0612404f4b978234d6d2cd4b | <|skeleton|>
class ListLogicalPartition:
def __init__(self):
"""initializes root and content-type"""
<|body_0|>
def list_LogicalPartition(self, ip, uuid, session_id):
"""returns the list of available logicalpartition objects Args: ip : ip address of HMC uuid : UUID of the Logical Parti... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ListLogicalPartition:
def __init__(self):
"""initializes root and content-type"""
self.content_type = CONTENT_TYPE
self.root = ROOT
self.headers_obj = HmcHeaders.HmcHeaders('uom')
def list_LogicalPartition(self, ip, uuid, session_id):
"""returns the list of availab... | the_stack_v2_python_sparse | src/logical_partition/ListLogicalPartition.py | Python3pkg/HmcRestClient | train | 0 | |
92c5314c081a1479a1db6a48458bcadd98c453af | [
"self.change_rate = change_rate\nself.cluster_id = cluster_id\nself.cluster_incarnation_id = cluster_incarnation_id\nself.cluster_name = cluster_name\nself.read_bandwidth = read_bandwidth\nself.stats_by_env = stats_by_env\nself.vault_group = vault_group\nself.vault_id = vault_id\nself.vault_type = vault_type\nself.... | <|body_start_0|>
self.change_rate = change_rate
self.cluster_id = cluster_id
self.cluster_incarnation_id = cluster_incarnation_id
self.cluster_name = cluster_name
self.read_bandwidth = read_bandwidth
self.stats_by_env = stats_by_env
self.vault_group = vault_group
... | Implementation of the 'VaultProviderStatsInfo' model. Specifies the stats for each vault. Attributes: change_rate (long|int): Specifies the relative change of size of entities on the vault. cluster_id (long|int): Specifies the cluster id. cluster_incarnation_id (long|int): Specifies the cluster incarnation id. cluster_... | VaultProviderStatsInfo | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VaultProviderStatsInfo:
"""Implementation of the 'VaultProviderStatsInfo' model. Specifies the stats for each vault. Attributes: change_rate (long|int): Specifies the relative change of size of entities on the vault. cluster_id (long|int): Specifies the cluster id. cluster_incarnation_id (long|in... | stack_v2_sparse_classes_36k_train_018341 | 4,509 | permissive | [
{
"docstring": "Constructor for the VaultProviderStatsInfo class",
"name": "__init__",
"signature": "def __init__(self, change_rate=None, cluster_id=None, cluster_incarnation_id=None, cluster_name=None, read_bandwidth=None, stats_by_env=None, vault_group=None, vault_id=None, vault_type=None, vaultname=N... | 2 | null | Implement the Python class `VaultProviderStatsInfo` described below.
Class description:
Implementation of the 'VaultProviderStatsInfo' model. Specifies the stats for each vault. Attributes: change_rate (long|int): Specifies the relative change of size of entities on the vault. cluster_id (long|int): Specifies the clus... | Implement the Python class `VaultProviderStatsInfo` described below.
Class description:
Implementation of the 'VaultProviderStatsInfo' model. Specifies the stats for each vault. Attributes: change_rate (long|int): Specifies the relative change of size of entities on the vault. cluster_id (long|int): Specifies the clus... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class VaultProviderStatsInfo:
"""Implementation of the 'VaultProviderStatsInfo' model. Specifies the stats for each vault. Attributes: change_rate (long|int): Specifies the relative change of size of entities on the vault. cluster_id (long|int): Specifies the cluster id. cluster_incarnation_id (long|in... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class VaultProviderStatsInfo:
"""Implementation of the 'VaultProviderStatsInfo' model. Specifies the stats for each vault. Attributes: change_rate (long|int): Specifies the relative change of size of entities on the vault. cluster_id (long|int): Specifies the cluster id. cluster_incarnation_id (long|int): Specifies... | the_stack_v2_python_sparse | cohesity_management_sdk/models/vault_provider_stats_info.py | cohesity/management-sdk-python | train | 24 |
c30b0e0d6a4fb3e9268d720211f6db7e8562a0aa | [
"pars = inspect.signature(AnGaFIS_OF_Estimator_Complete.__init__)\nfor par in pars.parameters.keys():\n if par != 'self':\n setattr(self, par, eval(par))\nself.segmentor = AnGaFIS_Seg_Estimator(enhanceOnly=True)\nself.lro_estimator = AnGaFIS_OF_Estimator()",
"pars = inspect.signature(AnGaFIS_OF_Estimato... | <|body_start_0|>
pars = inspect.signature(AnGaFIS_OF_Estimator_Complete.__init__)
for par in pars.parameters.keys():
if par != 'self':
setattr(self, par, eval(par))
self.segmentor = AnGaFIS_Seg_Estimator(enhanceOnly=True)
self.lro_estimator = AnGaFIS_OF_Estima... | AnGaFIS_OF_Estimator_Complete | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AnGaFIS_OF_Estimator_Complete:
def __init__(self, LRF_min_disk_size: int=10, LRF_rel_check_grid_step: int=10, LRF_rel_check_threshold: float=30, LRF_segment_n_points: int=15, LRF_segment_length: int=30, LRF_gaussian_smooth_std: float=0.05, LRO1_scale_factor: float=1.5, SM1_radius_factor: float=1... | stack_v2_sparse_classes_36k_train_018342 | 15,900 | permissive | [
{
"docstring": "Initializes and stores all the algorithm's parameters.",
"name": "__init__",
"signature": "def __init__(self, LRF_min_disk_size: int=10, LRF_rel_check_grid_step: int=10, LRF_rel_check_threshold: float=30, LRF_segment_n_points: int=15, LRF_segment_length: int=30, LRF_gaussian_smooth_std: ... | 2 | stack_v2_sparse_classes_30k_train_007216 | Implement the Python class `AnGaFIS_OF_Estimator_Complete` described below.
Class description:
Implement the AnGaFIS_OF_Estimator_Complete class.
Method signatures and docstrings:
- def __init__(self, LRF_min_disk_size: int=10, LRF_rel_check_grid_step: int=10, LRF_rel_check_threshold: float=30, LRF_segment_n_points: ... | Implement the Python class `AnGaFIS_OF_Estimator_Complete` described below.
Class description:
Implement the AnGaFIS_OF_Estimator_Complete class.
Method signatures and docstrings:
- def __init__(self, LRF_min_disk_size: int=10, LRF_rel_check_grid_step: int=10, LRF_rel_check_threshold: float=30, LRF_segment_n_points: ... | 9a24b43a2170234e5059a54ed20329e036260b0a | <|skeleton|>
class AnGaFIS_OF_Estimator_Complete:
def __init__(self, LRF_min_disk_size: int=10, LRF_rel_check_grid_step: int=10, LRF_rel_check_threshold: float=30, LRF_segment_n_points: int=15, LRF_segment_length: int=30, LRF_gaussian_smooth_std: float=0.05, LRO1_scale_factor: float=1.5, SM1_radius_factor: float=1... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AnGaFIS_OF_Estimator_Complete:
def __init__(self, LRF_min_disk_size: int=10, LRF_rel_check_grid_step: int=10, LRF_rel_check_threshold: float=30, LRF_segment_n_points: int=15, LRF_segment_length: int=30, LRF_gaussian_smooth_std: float=0.05, LRO1_scale_factor: float=1.5, SM1_radius_factor: float=1, SM1_sample_d... | the_stack_v2_python_sparse | pynger/fingerprint/tuning_lro.py | Manjushanair/pynger | train | 0 | |
ba6223784b7f878871b9e327aa1f0bae7ab18178 | [
"q = deque([root])\narr = ['#']\nwhile q:\n node = q.popleft()\n if node is not None:\n q.append(node.left)\n q.append(node.right)\n arr.append(str(node.val))\n if node is None:\n arr.append('#')\nreturn ' '.join(arr)",
"if data == '# #':\n return None\ndata = data.split()\... | <|body_start_0|>
q = deque([root])
arr = ['#']
while q:
node = q.popleft()
if node is not None:
q.append(node.left)
q.append(node.right)
arr.append(str(node.val))
if node is None:
arr.append('#')
... | 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_018343 | 1,631 | 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_012923 | 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:... | b3275ae2e82b940173e3df4e49ce8800efa4b96c | <|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"""
q = deque([root])
arr = ['#']
while q:
node = q.popleft()
if node is not None:
q.append(node.left)
q.append(node.r... | the_stack_v2_python_sparse | 14장 트리/297_serialize_and_deserialize_binary_tree.py | Geunbaek/python_algorithm_interview | train | 0 | |
6f0ad3ba79233cc5aed0334fdf46a352638cec28 | [
"indentation = []\nfor value in range(cpindex, len(force)):\n indentation.append(displacement[value] - displacement[cpindex] - (force[value] / k - force[cpindex] / k))\nprint(indentation)\nreturn indentation",
"contactforce = np.array(force[cpindex:]) - force[cpindex]\nprint(contactforce, 'contact force')\nind... | <|body_start_0|>
indentation = []
for value in range(cpindex, len(force)):
indentation.append(displacement[value] - displacement[cpindex] - (force[value] / k - force[cpindex] / k))
print(indentation)
return indentation
<|end_body_0|>
<|body_start_1|>
contactforce = n... | YoungsModulus | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class YoungsModulus:
def calculate_indentation(self, force, displacement, cpindex, k=0.032):
"""Returns the calculated contact point :type force: array :param force: force data from FD curve :type displacement: array :param displacement: displacement data from FD curve :type cpindex: int :para... | stack_v2_sparse_classes_36k_train_018344 | 4,833 | permissive | [
{
"docstring": "Returns the calculated contact point :type force: array :param force: force data from FD curve :type displacement: array :param displacement: displacement data from FD curve :type cpindex: int :param cpindex: the index of the contact point value :type k: int :param k: the elastic constant value ... | 2 | stack_v2_sparse_classes_30k_train_009036 | Implement the Python class `YoungsModulus` described below.
Class description:
Implement the YoungsModulus class.
Method signatures and docstrings:
- def calculate_indentation(self, force, displacement, cpindex, k=0.032): Returns the calculated contact point :type force: array :param force: force data from FD curve :... | Implement the Python class `YoungsModulus` described below.
Class description:
Implement the YoungsModulus class.
Method signatures and docstrings:
- def calculate_indentation(self, force, displacement, cpindex, k=0.032): Returns the calculated contact point :type force: array :param force: force data from FD curve :... | 02822901edda2d3e27e9d79052437c8a6fddc249 | <|skeleton|>
class YoungsModulus:
def calculate_indentation(self, force, displacement, cpindex, k=0.032):
"""Returns the calculated contact point :type force: array :param force: force data from FD curve :type displacement: array :param displacement: displacement data from FD curve :type cpindex: int :para... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class YoungsModulus:
def calculate_indentation(self, force, displacement, cpindex, k=0.032):
"""Returns the calculated contact point :type force: array :param force: force data from FD curve :type displacement: array :param displacement: displacement data from FD curve :type cpindex: int :param cpindex: the... | the_stack_v2_python_sparse | apps/anlysisfunctions.py | Andrew-Ritchie/Web-Based-Dashboard-for-Nanoindentation-Experiments | train | 1 | |
cdfce19b89fc14abe38e70671d1d31803105c42f | [
"self.time = time\nself.status = status\nself.headers = headers\nself.body = body\nself.ip_address = ip_address\nself.transfer_encoding = transfer_encoding\nself.names = {'time': 'time', 'status': 'status', 'headers': 'headers', 'body': 'body', 'ip_address': 'ip_address', 'transfer_encoding': 'transfer_encoding'}",... | <|body_start_0|>
self.time = time
self.status = status
self.headers = headers
self.body = body
self.ip_address = ip_address
self.transfer_encoding = transfer_encoding
self.names = {'time': 'time', 'status': 'status', 'headers': 'headers', 'body': 'body', 'ip_addre... | Implementation of the 'models.EventResponse' model. API Response Attributes: time (DateTime): Time when response received status (int): HTTP Status code such as 200 headers (object): Key/Value map of response headers body (object): Response body ip_address (string): IP Address from the response, such as the server IP A... | EventResponseModel | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EventResponseModel:
"""Implementation of the 'models.EventResponse' model. API Response Attributes: time (DateTime): Time when response received status (int): HTTP Status code such as 200 headers (object): Key/Value map of response headers body (object): Response body ip_address (string): IP Addr... | stack_v2_sparse_classes_36k_train_018345 | 2,638 | permissive | [
{
"docstring": "Constructor for the EventResponseModel class",
"name": "__init__",
"signature": "def __init__(self, time=None, status=None, headers=None, body=None, ip_address=None, transfer_encoding=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dictionary (... | 2 | stack_v2_sparse_classes_30k_train_012579 | Implement the Python class `EventResponseModel` described below.
Class description:
Implementation of the 'models.EventResponse' model. API Response Attributes: time (DateTime): Time when response received status (int): HTTP Status code such as 200 headers (object): Key/Value map of response headers body (object): Res... | Implement the Python class `EventResponseModel` described below.
Class description:
Implementation of the 'models.EventResponse' model. API Response Attributes: time (DateTime): Time when response received status (int): HTTP Status code such as 200 headers (object): Key/Value map of response headers body (object): Res... | e65347f1c4fe6ef014648db4e3b25d0392f820d0 | <|skeleton|>
class EventResponseModel:
"""Implementation of the 'models.EventResponse' model. API Response Attributes: time (DateTime): Time when response received status (int): HTTP Status code such as 200 headers (object): Key/Value map of response headers body (object): Response body ip_address (string): IP Addr... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class EventResponseModel:
"""Implementation of the 'models.EventResponse' model. API Response Attributes: time (DateTime): Time when response received status (int): HTTP Status code such as 200 headers (object): Key/Value map of response headers body (object): Response body ip_address (string): IP Address from the ... | the_stack_v2_python_sparse | moesifapi/models/event_response_model.py | Moesif/moesifapi-python | train | 5 |
f62224fabb990042d95d91a58703eb28241dda20 | [
"prehead = ListNode(-1)\ncur = prehead\nwhile l1 and l2:\n if l1.val <= l2.val:\n cur.next = l1\n l1 = l1.next\n else:\n cur.next = l2\n l2 = l2.next\n cur = cur.next\ncur.next = l1 or l2\nreturn prehead.next",
"if l1 is None:\n return l2\nelif l2 is None:\n return l1\ni... | <|body_start_0|>
prehead = ListNode(-1)
cur = prehead
while l1 and l2:
if l1.val <= l2.val:
cur.next = l1
l1 = l1.next
else:
cur.next = l2
l2 = l2.next
cur = cur.next
cur.next = l1 or l2
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode:
"""使用遍历的方式进行沟通 :param l1: :param l2: :return:"""
<|body_0|>
def mergeTwoListsrRcursive(self, l1: ListNode, l2: ListNode) -> ListNode:
"""使用递归的方式同步相关的方法 :param l1: :param l2: :return:"""
... | stack_v2_sparse_classes_36k_train_018346 | 1,376 | no_license | [
{
"docstring": "使用遍历的方式进行沟通 :param l1: :param l2: :return:",
"name": "mergeTwoLists",
"signature": "def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode"
},
{
"docstring": "使用递归的方式同步相关的方法 :param l1: :param l2: :return:",
"name": "mergeTwoListsrRcursive",
"signature": "def merg... | 2 | stack_v2_sparse_classes_30k_train_003053 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode: 使用遍历的方式进行沟通 :param l1: :param l2: :return:
- def mergeTwoListsrRcursive(self, l1: ListNode, l2: ListNode) -> List... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode: 使用遍历的方式进行沟通 :param l1: :param l2: :return:
- def mergeTwoListsrRcursive(self, l1: ListNode, l2: ListNode) -> List... | af13162360a28a0bcd71918fd8bff77c41ddcc2a | <|skeleton|>
class Solution:
def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode:
"""使用遍历的方式进行沟通 :param l1: :param l2: :return:"""
<|body_0|>
def mergeTwoListsrRcursive(self, l1: ListNode, l2: ListNode) -> ListNode:
"""使用递归的方式同步相关的方法 :param l1: :param l2: :return:"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode:
"""使用遍历的方式进行沟通 :param l1: :param l2: :return:"""
prehead = ListNode(-1)
cur = prehead
while l1 and l2:
if l1.val <= l2.val:
cur.next = l1
l1 = l1.next
... | the_stack_v2_python_sparse | 算法分析和归类/链表/合并两个有序链表.py | Carmenliukang/leetcode | train | 4 | |
20ab69270629dec20ae4e19647e20faa844f53e3 | [
"self.name = 'resample'\nself.procname = 'RESMP'\nself.log = logging.getLogger('pipe.step.%s' % self.name)\nself.paramlist = []\nself.paramlist.append(['samplefac', 2, 'Downsample factor - integer'])\nself.paramlist.append(['method', 'median', 'Combine method: median (default), sum or average'])\nself.paramlist.app... | <|body_start_0|>
self.name = 'resample'
self.procname = 'RESMP'
self.log = logging.getLogger('pipe.step.%s' % self.name)
self.paramlist = []
self.paramlist.append(['samplefac', 2, 'Downsample factor - integer'])
self.paramlist.append(['method', 'median', 'Combine method: ... | DarePype Step ReSample Object The object is callable. It requires a valid configuration input (file or object) when it runs. | StepReSample | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StepReSample:
"""DarePype Step ReSample Object The object is callable. It requires a valid configuration input (file or object) when it runs."""
def setup(self):
"""### Names and Parameters need to be Set Here ### Sets the internal names for the function and for saved files. Defines ... | stack_v2_sparse_classes_36k_train_018347 | 5,465 | no_license | [
{
"docstring": "### Names and Parameters need to be Set Here ### Sets the internal names for the function and for saved files. Defines the input parameters for the current pipe step. Setup() is called at the end of __init__ The parameters are stored in a list containing the following information: - name: The na... | 2 | stack_v2_sparse_classes_30k_train_006433 | Implement the Python class `StepReSample` described below.
Class description:
DarePype Step ReSample Object The object is callable. It requires a valid configuration input (file or object) when it runs.
Method signatures and docstrings:
- def setup(self): ### Names and Parameters need to be Set Here ### Sets the inte... | Implement the Python class `StepReSample` described below.
Class description:
DarePype Step ReSample Object The object is callable. It requires a valid configuration input (file or object) when it runs.
Method signatures and docstrings:
- def setup(self): ### Names and Parameters need to be Set Here ### Sets the inte... | dd41da709e2bd55f072b37f5a9b16f1a61dcfc8c | <|skeleton|>
class StepReSample:
"""DarePype Step ReSample Object The object is callable. It requires a valid configuration input (file or object) when it runs."""
def setup(self):
"""### Names and Parameters need to be Set Here ### Sets the internal names for the function and for saved files. Defines ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class StepReSample:
"""DarePype Step ReSample Object The object is callable. It requires a valid configuration input (file or object) when it runs."""
def setup(self):
"""### Names and Parameters need to be Set Here ### Sets the internal names for the function and for saved files. Defines the input par... | the_stack_v2_python_sparse | source/stonesteps/stepresample.py | yerkesobservatory/pipeline | train | 6 |
4bc4453d2fe97b44145676ea5811d538a6d710a2 | [
"if not value:\n return None\nreturn value.isoformat()",
"if not value:\n return None\nreturn parse(value)"
] | <|body_start_0|>
if not value:
return None
return value.isoformat()
<|end_body_0|>
<|body_start_1|>
if not value:
return None
return parse(value)
<|end_body_1|>
| FuzzyDate | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FuzzyDate:
def _serialize(self, value, attr, obj):
"""Convert a Python object into an outside-world object"""
<|body_0|>
def _deserialize(self, value, attr, obj):
"""Convert a outside-world value into a Python object"""
<|body_1|>
<|end_skeleton|>
<|body_st... | stack_v2_sparse_classes_36k_train_018348 | 2,881 | permissive | [
{
"docstring": "Convert a Python object into an outside-world object",
"name": "_serialize",
"signature": "def _serialize(self, value, attr, obj)"
},
{
"docstring": "Convert a outside-world value into a Python object",
"name": "_deserialize",
"signature": "def _deserialize(self, value, a... | 2 | stack_v2_sparse_classes_30k_train_004659 | Implement the Python class `FuzzyDate` described below.
Class description:
Implement the FuzzyDate class.
Method signatures and docstrings:
- def _serialize(self, value, attr, obj): Convert a Python object into an outside-world object
- def _deserialize(self, value, attr, obj): Convert a outside-world value into a Py... | Implement the Python class `FuzzyDate` described below.
Class description:
Implement the FuzzyDate class.
Method signatures and docstrings:
- def _serialize(self, value, attr, obj): Convert a Python object into an outside-world object
- def _deserialize(self, value, attr, obj): Convert a outside-world value into a Py... | 87c211fa6cf9708bdf3fc4b736f3cca450c0a290 | <|skeleton|>
class FuzzyDate:
def _serialize(self, value, attr, obj):
"""Convert a Python object into an outside-world object"""
<|body_0|>
def _deserialize(self, value, attr, obj):
"""Convert a outside-world value into a Python object"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FuzzyDate:
def _serialize(self, value, attr, obj):
"""Convert a Python object into an outside-world object"""
if not value:
return None
return value.isoformat()
def _deserialize(self, value, attr, obj):
"""Convert a outside-world value into a Python object"""
... | the_stack_v2_python_sparse | powonline/schema.py | exhuma/powonline | train | 0 | |
8cc613d20a4318925f581691bfbb726d592de766 | [
"super().__init__(master)\nself.master = master\nself['width'] = 1120\nself['height'] = 200\nself['bg'] = '#e1e1e1'\nself.font = font.Font(family='pixelmix', size=12, weight='normal')\nself.text_box = tk.Label(self, bg=self['bg'], justify='center', font=self.font)\nself.text_box.place(anchor='center', relx=0.5, rel... | <|body_start_0|>
super().__init__(master)
self.master = master
self['width'] = 1120
self['height'] = 200
self['bg'] = '#e1e1e1'
self.font = font.Font(family='pixelmix', size=12, weight='normal')
self.text_box = tk.Label(self, bg=self['bg'], justify='center', font=... | Textbox for displaying dialogue. | Dialogue | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Dialogue:
"""Textbox for displaying dialogue."""
def __init__(self, master):
"""Call super init and create default values for textbox."""
<|body_0|>
def start(self, assets: list):
"""Start system and import assets."""
<|body_1|>
def click(self, event... | stack_v2_sparse_classes_36k_train_018349 | 3,857 | no_license | [
{
"docstring": "Call super init and create default values for textbox.",
"name": "__init__",
"signature": "def __init__(self, master)"
},
{
"docstring": "Start system and import assets.",
"name": "start",
"signature": "def start(self, assets: list)"
},
{
"docstring": "Handle clic... | 6 | stack_v2_sparse_classes_30k_train_004717 | Implement the Python class `Dialogue` described below.
Class description:
Textbox for displaying dialogue.
Method signatures and docstrings:
- def __init__(self, master): Call super init and create default values for textbox.
- def start(self, assets: list): Start system and import assets.
- def click(self, event): H... | Implement the Python class `Dialogue` described below.
Class description:
Textbox for displaying dialogue.
Method signatures and docstrings:
- def __init__(self, master): Call super init and create default values for textbox.
- def start(self, assets: list): Start system and import assets.
- def click(self, event): H... | e452817429195593e9c7cd89fe052bd8ed89943a | <|skeleton|>
class Dialogue:
"""Textbox for displaying dialogue."""
def __init__(self, master):
"""Call super init and create default values for textbox."""
<|body_0|>
def start(self, assets: list):
"""Start system and import assets."""
<|body_1|>
def click(self, event... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Dialogue:
"""Textbox for displaying dialogue."""
def __init__(self, master):
"""Call super init and create default values for textbox."""
super().__init__(master)
self.master = master
self['width'] = 1120
self['height'] = 200
self['bg'] = '#e1e1e1'
... | the_stack_v2_python_sparse | Dialogue/alpha_1/main.py | Keiyrti/python_projects | train | 0 |
2b3a2315d2e725cc090c15d11f5da6a2af57fb67 | [
"try:\n success_log = info.getLogger(module)\n success_log.info(log)\nexcept Exception as e:\n print(e)",
"try:\n error_log = info.getLogger(module)\n error_log.error(log)\nexcept Exception as e:\n print(e)",
"try:\n warning_log = info.getLogger(module)\n warning_log.warning(log)\nexcept... | <|body_start_0|>
try:
success_log = info.getLogger(module)
success_log.info(log)
except Exception as e:
print(e)
<|end_body_0|>
<|body_start_1|>
try:
error_log = info.getLogger(module)
error_log.error(log)
except Exception as e... | Logger | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Logger:
def create_success_log(module: str, log: str) -> None:
"""create success log from this method"""
<|body_0|>
def create_error_log(module: str, log: str):
"""create error log from this method"""
<|body_1|>
def create_warning_log(module: str, log: s... | stack_v2_sparse_classes_36k_train_018350 | 2,056 | no_license | [
{
"docstring": "create success log from this method",
"name": "create_success_log",
"signature": "def create_success_log(module: str, log: str) -> None"
},
{
"docstring": "create error log from this method",
"name": "create_error_log",
"signature": "def create_error_log(module: str, log:... | 4 | stack_v2_sparse_classes_30k_train_008752 | Implement the Python class `Logger` described below.
Class description:
Implement the Logger class.
Method signatures and docstrings:
- def create_success_log(module: str, log: str) -> None: create success log from this method
- def create_error_log(module: str, log: str): create error log from this method
- def crea... | Implement the Python class `Logger` described below.
Class description:
Implement the Logger class.
Method signatures and docstrings:
- def create_success_log(module: str, log: str) -> None: create success log from this method
- def create_error_log(module: str, log: str): create error log from this method
- def crea... | c267cb76c5eacf30d893c4d3d1dcbaa717080471 | <|skeleton|>
class Logger:
def create_success_log(module: str, log: str) -> None:
"""create success log from this method"""
<|body_0|>
def create_error_log(module: str, log: str):
"""create error log from this method"""
<|body_1|>
def create_warning_log(module: str, log: s... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Logger:
def create_success_log(module: str, log: str) -> None:
"""create success log from this method"""
try:
success_log = info.getLogger(module)
success_log.info(log)
except Exception as e:
print(e)
def create_error_log(module: str, log: str):... | the_stack_v2_python_sparse | config/logger.py | ganeshsingamaneni/Flask-ordermanagement | train | 0 | |
807643a44e05889ff02ebbb55f715e5d08806eb6 | [
"if not wav_noise_config:\n self.wav_noise_config = {'./noises/keyboard-mono': {'prob': 0.4, 'mul': 1.0}, './noises/coughing-mono': {'prob': 0.1, 'mul': 0.2}, './noises/clock-tick-mono': {'prob': 0.1, 'mul': 0.6}, './noises/click-mono': {'prob': 0.2, 'mul': 0.8}, './noises/wind-mono': {'prob': 0.2, 'mul': 0.4}}\... | <|body_start_0|>
if not wav_noise_config:
self.wav_noise_config = {'./noises/keyboard-mono': {'prob': 0.4, 'mul': 1.0}, './noises/coughing-mono': {'prob': 0.1, 'mul': 0.2}, './noises/clock-tick-mono': {'prob': 0.1, 'mul': 0.6}, './noises/click-mono': {'prob': 0.2, 'mul': 0.8}, './noises/wind-mono': ... | Noiser | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Noiser:
def __init__(self, wav_noise_config=None, additional_noise_config=None):
"""add noise to signal, where noise is randomly selected wav from noise_dir. noise_lvl = ratio of noise to signal (additive)"""
<|body_0|>
def add_noise(self, sig):
"""sig is expected to... | stack_v2_sparse_classes_36k_train_018351 | 7,912 | no_license | [
{
"docstring": "add noise to signal, where noise is randomly selected wav from noise_dir. noise_lvl = ratio of noise to signal (additive)",
"name": "__init__",
"signature": "def __init__(self, wav_noise_config=None, additional_noise_config=None)"
},
{
"docstring": "sig is expected to be one-dime... | 2 | stack_v2_sparse_classes_30k_train_021163 | Implement the Python class `Noiser` described below.
Class description:
Implement the Noiser class.
Method signatures and docstrings:
- def __init__(self, wav_noise_config=None, additional_noise_config=None): add noise to signal, where noise is randomly selected wav from noise_dir. noise_lvl = ratio of noise to signa... | Implement the Python class `Noiser` described below.
Class description:
Implement the Noiser class.
Method signatures and docstrings:
- def __init__(self, wav_noise_config=None, additional_noise_config=None): add noise to signal, where noise is randomly selected wav from noise_dir. noise_lvl = ratio of noise to signa... | 6b4567c0bc1325a36b0d08fdf0f4fdcf8d803909 | <|skeleton|>
class Noiser:
def __init__(self, wav_noise_config=None, additional_noise_config=None):
"""add noise to signal, where noise is randomly selected wav from noise_dir. noise_lvl = ratio of noise to signal (additive)"""
<|body_0|>
def add_noise(self, sig):
"""sig is expected to... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Noiser:
def __init__(self, wav_noise_config=None, additional_noise_config=None):
"""add noise to signal, where noise is randomly selected wav from noise_dir. noise_lvl = ratio of noise to signal (additive)"""
if not wav_noise_config:
self.wav_noise_config = {'./noises/keyboard-mono... | the_stack_v2_python_sparse | chvoice/audio_utils.py | ashwinahuja/chvoice | train | 1 | |
9985abc960788d175174727dd8eeff505caab325 | [
"self.Triton = TritonContext()\nself.Triton.setArchitecture(ARCH.X86_64)\nself.astCtxt = self.Triton.getAstContext()",
"node = self.Triton.getImmediateAst(Immediate(16, CPUSIZE.BYTE))\nself.assertEqual(node.evaluate(), 16)\nself.assertEqual(node.getBitvectorSize(), CPUSIZE.BYTE_BIT)",
"expr1 = self.Triton.newSy... | <|body_start_0|>
self.Triton = TritonContext()
self.Triton.setArchitecture(ARCH.X86_64)
self.astCtxt = self.Triton.getAstContext()
<|end_body_0|>
<|body_start_1|>
node = self.Triton.getImmediateAst(Immediate(16, CPUSIZE.BYTE))
self.assertEqual(node.evaluate(), 16)
self.a... | Testing symbolic building. | TestSymbolicBuilding | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestSymbolicBuilding:
"""Testing symbolic building."""
def setUp(self):
"""Define the arch."""
<|body_0|>
def test_build_immediate(self):
"""Check symbolic immediate has correct size and evaluation."""
<|body_1|>
def test_build_register(self):
... | stack_v2_sparse_classes_36k_train_018352 | 4,357 | permissive | [
{
"docstring": "Define the arch.",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "Check symbolic immediate has correct size and evaluation.",
"name": "test_build_immediate",
"signature": "def test_build_immediate(self)"
},
{
"docstring": "Check symbolic regist... | 3 | null | Implement the Python class `TestSymbolicBuilding` described below.
Class description:
Testing symbolic building.
Method signatures and docstrings:
- def setUp(self): Define the arch.
- def test_build_immediate(self): Check symbolic immediate has correct size and evaluation.
- def test_build_register(self): Check symb... | Implement the Python class `TestSymbolicBuilding` described below.
Class description:
Testing symbolic building.
Method signatures and docstrings:
- def setUp(self): Define the arch.
- def test_build_immediate(self): Check symbolic immediate has correct size and evaluation.
- def test_build_register(self): Check symb... | a61651ce331ac53ec09e1d8fef5eab744e98c9de | <|skeleton|>
class TestSymbolicBuilding:
"""Testing symbolic building."""
def setUp(self):
"""Define the arch."""
<|body_0|>
def test_build_immediate(self):
"""Check symbolic immediate has correct size and evaluation."""
<|body_1|>
def test_build_register(self):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestSymbolicBuilding:
"""Testing symbolic building."""
def setUp(self):
"""Define the arch."""
self.Triton = TritonContext()
self.Triton.setArchitecture(ARCH.X86_64)
self.astCtxt = self.Triton.getAstContext()
def test_build_immediate(self):
"""Check symbolic i... | the_stack_v2_python_sparse | src/testers/unittests/test_symbolic.py | JonathanSalwan/Triton | train | 3,163 |
cb034273665a1108df861505dc81106c26297a90 | [
"if pic_xyz is not None and pic_data is not None:\n self._minmax = (pic_data.min(), pic_data.max())\n clim = pic_clim if pic_clim is not None else self._minmax\n self.mesh = PicMesh(pic_data, pic_xyz, width=pic_width, height=pic_height, dxyz=pic_dxyz, select=pic_select, name='Pictures', clim=clim, cmap=pic... | <|body_start_0|>
if pic_xyz is not None and pic_data is not None:
self._minmax = (pic_data.min(), pic_data.max())
clim = pic_clim if pic_clim is not None else self._minmax
self.mesh = PicMesh(pic_data, pic_xyz, width=pic_width, height=pic_height, dxyz=pic_dxyz, select=pic_sel... | docstring for PicBase. | PicBase | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PicBase:
"""docstring for PicBase."""
def __init__(self, pic_xyz=None, pic_data=None, pic_dxyz=(0.0, 0.0, 1.0), pic_width=7.0, pic_height=7.0, pic_select=None, pic_cmap='viridis', pic_clim=None, pic_vmin=None, pic_vmax=None, pic_under='gray', pic_over='red', **kwargs):
"""Init."""
... | stack_v2_sparse_classes_36k_train_018353 | 1,750 | permissive | [
{
"docstring": "Init.",
"name": "__init__",
"signature": "def __init__(self, pic_xyz=None, pic_data=None, pic_dxyz=(0.0, 0.0, 1.0), pic_width=7.0, pic_height=7.0, pic_select=None, pic_cmap='viridis', pic_clim=None, pic_vmin=None, pic_vmax=None, pic_under='gray', pic_over='red', **kwargs)"
},
{
"... | 2 | stack_v2_sparse_classes_30k_val_000201 | Implement the Python class `PicBase` described below.
Class description:
docstring for PicBase.
Method signatures and docstrings:
- def __init__(self, pic_xyz=None, pic_data=None, pic_dxyz=(0.0, 0.0, 1.0), pic_width=7.0, pic_height=7.0, pic_select=None, pic_cmap='viridis', pic_clim=None, pic_vmin=None, pic_vmax=None,... | Implement the Python class `PicBase` described below.
Class description:
docstring for PicBase.
Method signatures and docstrings:
- def __init__(self, pic_xyz=None, pic_data=None, pic_dxyz=(0.0, 0.0, 1.0), pic_width=7.0, pic_height=7.0, pic_select=None, pic_cmap='viridis', pic_clim=None, pic_vmin=None, pic_vmax=None,... | 8d85426a3fc28463ee2ecfc6559db37301a6d8b4 | <|skeleton|>
class PicBase:
"""docstring for PicBase."""
def __init__(self, pic_xyz=None, pic_data=None, pic_dxyz=(0.0, 0.0, 1.0), pic_width=7.0, pic_height=7.0, pic_select=None, pic_cmap='viridis', pic_clim=None, pic_vmin=None, pic_vmax=None, pic_under='gray', pic_over='red', **kwargs):
"""Init."""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PicBase:
"""docstring for PicBase."""
def __init__(self, pic_xyz=None, pic_data=None, pic_dxyz=(0.0, 0.0, 1.0), pic_width=7.0, pic_height=7.0, pic_select=None, pic_cmap='viridis', pic_clim=None, pic_vmin=None, pic_vmax=None, pic_under='gray', pic_over='red', **kwargs):
"""Init."""
if pic_... | the_stack_v2_python_sparse | visbrain/brain/base/PicBase.py | MunsuDC/visbrain | train | 0 |
f168839eeabc277e5920dd9e2f0e72d6306efd6c | [
"logger.debug('Start validator_email.')\nemail_from_database = User.objects.filter(email=email)\nif email_from_database.exists():\n raise ValidationError({'email': [_(constants.EMAIL_EXISTS)]})\nelif email is None:\n raise forms.ValidationError({'email': [_(constants.EMAIL_NONE)]})\nelif len(email) > constant... | <|body_start_0|>
logger.debug('Start validator_email.')
email_from_database = User.objects.filter(email=email)
if email_from_database.exists():
raise ValidationError({'email': [_(constants.EMAIL_EXISTS)]})
elif email is None:
raise forms.ValidationError({'email': ... | Validating user fields. | UserValidator | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserValidator:
"""Validating user fields."""
def validator_email(self, email):
"""Validating email."""
<|body_0|>
def validator_email_in_reset_password(self, email):
"""Validating email."""
<|body_1|>
def validator_password(self, password, password_c... | stack_v2_sparse_classes_36k_train_018354 | 4,003 | permissive | [
{
"docstring": "Validating email.",
"name": "validator_email",
"signature": "def validator_email(self, email)"
},
{
"docstring": "Validating email.",
"name": "validator_email_in_reset_password",
"signature": "def validator_email_in_reset_password(self, email)"
},
{
"docstring": "... | 6 | stack_v2_sparse_classes_30k_train_005024 | Implement the Python class `UserValidator` described below.
Class description:
Validating user fields.
Method signatures and docstrings:
- def validator_email(self, email): Validating email.
- def validator_email_in_reset_password(self, email): Validating email.
- def validator_password(self, password, password_confi... | Implement the Python class `UserValidator` described below.
Class description:
Validating user fields.
Method signatures and docstrings:
- def validator_email(self, email): Validating email.
- def validator_email_in_reset_password(self, email): Validating email.
- def validator_password(self, password, password_confi... | 5387eb80dfb354e948abe64f7d8bbe087fc4f136 | <|skeleton|>
class UserValidator:
"""Validating user fields."""
def validator_email(self, email):
"""Validating email."""
<|body_0|>
def validator_email_in_reset_password(self, email):
"""Validating email."""
<|body_1|>
def validator_password(self, password, password_c... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UserValidator:
"""Validating user fields."""
def validator_email(self, email):
"""Validating email."""
logger.debug('Start validator_email.')
email_from_database = User.objects.filter(email=email)
if email_from_database.exists():
raise ValidationError({'email':... | the_stack_v2_python_sparse | medical_prescription/user/validators/uservalidator.py | ristovao/2017.2-Receituario-Medico | train | 0 |
07d2561068ee20c057b10c258d3bfb19d08fb391 | [
"try:\n xml_tree = ET.fromstring(xmltext)\n encrypt = xml_tree.find('Encrypt')\n touser_name = xml_tree.find('ToUserName')\n return (ierror.WXBizMsgCrypt_OK, encrypt.text, touser_name.text)\nexcept Exception:\n return (ierror.WXBizMsgCrypt_ParseXml_Error, None, None)",
"resp_dict = {'msg_encrypt': ... | <|body_start_0|>
try:
xml_tree = ET.fromstring(xmltext)
encrypt = xml_tree.find('Encrypt')
touser_name = xml_tree.find('ToUserName')
return (ierror.WXBizMsgCrypt_OK, encrypt.text, touser_name.text)
except Exception:
return (ierror.WXBizMsgCrypt... | get encrypt and generate a reply message | XMLParse | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class XMLParse:
"""get encrypt and generate a reply message"""
def extract(self, xmltext):
"""unpack encrypted message @param xmltext: xml text @return: encrypted message"""
<|body_0|>
def generate(self, encrypt, signature, timestamp, nonce):
"""Generate xml message @p... | stack_v2_sparse_classes_36k_train_018355 | 8,425 | permissive | [
{
"docstring": "unpack encrypted message @param xmltext: xml text @return: encrypted message",
"name": "extract",
"signature": "def extract(self, xmltext)"
},
{
"docstring": "Generate xml message @param encrypt: encrypted message text @param signature: signature @param timestamp: timestamp @para... | 2 | null | Implement the Python class `XMLParse` described below.
Class description:
get encrypt and generate a reply message
Method signatures and docstrings:
- def extract(self, xmltext): unpack encrypted message @param xmltext: xml text @return: encrypted message
- def generate(self, encrypt, signature, timestamp, nonce): Ge... | Implement the Python class `XMLParse` described below.
Class description:
get encrypt and generate a reply message
Method signatures and docstrings:
- def extract(self, xmltext): unpack encrypted message @param xmltext: xml text @return: encrypted message
- def generate(self, encrypt, signature, timestamp, nonce): Ge... | 6be1af50496340ded9879a6450c8208ac9f97e72 | <|skeleton|>
class XMLParse:
"""get encrypt and generate a reply message"""
def extract(self, xmltext):
"""unpack encrypted message @param xmltext: xml text @return: encrypted message"""
<|body_0|>
def generate(self, encrypt, signature, timestamp, nonce):
"""Generate xml message @p... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class XMLParse:
"""get encrypt and generate a reply message"""
def extract(self, xmltext):
"""unpack encrypted message @param xmltext: xml text @return: encrypted message"""
try:
xml_tree = ET.fromstring(xmltext)
encrypt = xml_tree.find('Encrypt')
touser_name... | the_stack_v2_python_sparse | server/services/wechat/assembly/WXBizMsgCrypt.py | Soopro/totoro | train | 0 |
039035d2519f9bcdaa4446db60afa43609252538 | [
"remove_columns = ['containing_subdossier', 'checked_out', 'reference']\ncolumns = []\nfor col in super(InboxDocuments, self).columns:\n if isinstance(col, dict) and col.get('column') in remove_columns:\n pass\n elif isinstance(col, tuple) and col[1] == external_edit_link:\n pass\n else:\n ... | <|body_start_0|>
remove_columns = ['containing_subdossier', 'checked_out', 'reference']
columns = []
for col in super(InboxDocuments, self).columns:
if isinstance(col, dict) and col.get('column') in remove_columns:
pass
elif isinstance(col, tuple) and col[... | Lists documents directly inside the inbox, which are marked with the current org unit. | InboxDocuments | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InboxDocuments:
"""Lists documents directly inside the inbox, which are marked with the current org unit."""
def columns(self):
"""Remove default columns `containing_subdossier`, `checked_out` and `external_edit`."""
<|body_0|>
def enabled_actions(self):
"""Defin... | stack_v2_sparse_classes_36k_train_018356 | 4,616 | no_license | [
{
"docstring": "Remove default columns `containing_subdossier`, `checked_out` and `external_edit`.",
"name": "columns",
"signature": "def columns(self)"
},
{
"docstring": "Defines the enabled Actions",
"name": "enabled_actions",
"signature": "def enabled_actions(self)"
},
{
"docs... | 3 | null | Implement the Python class `InboxDocuments` described below.
Class description:
Lists documents directly inside the inbox, which are marked with the current org unit.
Method signatures and docstrings:
- def columns(self): Remove default columns `containing_subdossier`, `checked_out` and `external_edit`.
- def enabled... | Implement the Python class `InboxDocuments` described below.
Class description:
Lists documents directly inside the inbox, which are marked with the current org unit.
Method signatures and docstrings:
- def columns(self): Remove default columns `containing_subdossier`, `checked_out` and `external_edit`.
- def enabled... | a01bec6c00d203c21a1b0449f8d489d0033c02b7 | <|skeleton|>
class InboxDocuments:
"""Lists documents directly inside the inbox, which are marked with the current org unit."""
def columns(self):
"""Remove default columns `containing_subdossier`, `checked_out` and `external_edit`."""
<|body_0|>
def enabled_actions(self):
"""Defin... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class InboxDocuments:
"""Lists documents directly inside the inbox, which are marked with the current org unit."""
def columns(self):
"""Remove default columns `containing_subdossier`, `checked_out` and `external_edit`."""
remove_columns = ['containing_subdossier', 'checked_out', 'reference']
... | the_stack_v2_python_sparse | opengever/inbox/browser/tabs.py | 4teamwork/opengever.core | train | 19 |
2405531b069d61e144cf4ee3be1f9ee962d37590 | [
"self.dest = dest\nself.completed = 0\nself.processStatus = 'success'\nself.total = total\nself.output_callback = output_callback\nself.steps: List[Optional[JobsGeneratorType]] = []",
"for key, val in jobout.items():\n self.dest[key][index] = val\nif self.steps:\n self.steps[index] = None\nif processStatus ... | <|body_start_0|>
self.dest = dest
self.completed = 0
self.processStatus = 'success'
self.total = total
self.output_callback = output_callback
self.steps: List[Optional[JobsGeneratorType]] = []
<|end_body_0|>
<|body_start_1|>
for key, val in jobout.items():
... | Produced by the scatter generators. | ReceiveScatterOutput | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ReceiveScatterOutput:
"""Produced by the scatter generators."""
def __init__(self, output_callback: ScatterOutputCallbackType, dest: ScatterDestinationsType, total: int) -> None:
"""Initialize."""
<|body_0|>
def receive_scatter_output(self, index: int, jobout: CWLObjectT... | stack_v2_sparse_classes_36k_train_018357 | 41,287 | permissive | [
{
"docstring": "Initialize.",
"name": "__init__",
"signature": "def __init__(self, output_callback: ScatterOutputCallbackType, dest: ScatterDestinationsType, total: int) -> None"
},
{
"docstring": "Record the results of a scatter operation.",
"name": "receive_scatter_output",
"signature"... | 3 | null | Implement the Python class `ReceiveScatterOutput` described below.
Class description:
Produced by the scatter generators.
Method signatures and docstrings:
- def __init__(self, output_callback: ScatterOutputCallbackType, dest: ScatterDestinationsType, total: int) -> None: Initialize.
- def receive_scatter_output(self... | Implement the Python class `ReceiveScatterOutput` described below.
Class description:
Produced by the scatter generators.
Method signatures and docstrings:
- def __init__(self, output_callback: ScatterOutputCallbackType, dest: ScatterDestinationsType, total: int) -> None: Initialize.
- def receive_scatter_output(self... | bd89c5694685bff46bf56fb32316c8f6fe0d799d | <|skeleton|>
class ReceiveScatterOutput:
"""Produced by the scatter generators."""
def __init__(self, output_callback: ScatterOutputCallbackType, dest: ScatterDestinationsType, total: int) -> None:
"""Initialize."""
<|body_0|>
def receive_scatter_output(self, index: int, jobout: CWLObjectT... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ReceiveScatterOutput:
"""Produced by the scatter generators."""
def __init__(self, output_callback: ScatterOutputCallbackType, dest: ScatterDestinationsType, total: int) -> None:
"""Initialize."""
self.dest = dest
self.completed = 0
self.processStatus = 'success'
s... | the_stack_v2_python_sparse | cwltool/workflow_job.py | common-workflow-language/cwltool | train | 336 |
dd584c29018a307d97ca63296363dc6abde6933b | [
"D = {}\n\ndef backtrack(s):\n if s in D:\n return D[s]\n for i in xrange(len(s) - 1):\n if s[i] == s[i + 1] == '+':\n if not backtrack(s[:i] + '--' + s[i + 2:]):\n D[s] = 1\n return 1\n D[s] = 0\n return 0\nreturn backtrack(s)",
"lenth = map(lamb... | <|body_start_0|>
D = {}
def backtrack(s):
if s in D:
return D[s]
for i in xrange(len(s) - 1):
if s[i] == s[i + 1] == '+':
if not backtrack(s[:i] + '--' + s[i + 2:]):
D[s] = 1
retu... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def canWinBacktracking(self, s):
""":type s: str :rtype: bool"""
<|body_0|>
def canWinSpragueGrundy(self, s):
""":type s: str :rtype: bool"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
D = {}
def backtrack(s):
if s i... | stack_v2_sparse_classes_36k_train_018358 | 1,722 | no_license | [
{
"docstring": ":type s: str :rtype: bool",
"name": "canWinBacktracking",
"signature": "def canWinBacktracking(self, s)"
},
{
"docstring": ":type s: str :rtype: bool",
"name": "canWinSpragueGrundy",
"signature": "def canWinSpragueGrundy(self, s)"
}
] | 2 | stack_v2_sparse_classes_30k_train_001184 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def canWinBacktracking(self, s): :type s: str :rtype: bool
- def canWinSpragueGrundy(self, s): :type s: str :rtype: bool | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def canWinBacktracking(self, s): :type s: str :rtype: bool
- def canWinSpragueGrundy(self, s): :type s: str :rtype: bool
<|skeleton|>
class Solution:
def canWinBacktracking... | 3a7f20f79281fcaedb10696723dcb39c816ce258 | <|skeleton|>
class Solution:
def canWinBacktracking(self, s):
""":type s: str :rtype: bool"""
<|body_0|>
def canWinSpragueGrundy(self, s):
""":type s: str :rtype: bool"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def canWinBacktracking(self, s):
""":type s: str :rtype: bool"""
D = {}
def backtrack(s):
if s in D:
return D[s]
for i in xrange(len(s) - 1):
if s[i] == s[i + 1] == '+':
if not backtrack(s[:i] + '--'... | the_stack_v2_python_sparse | 294_flip_game_sprague_grundy_theorem.py | haohanz/Leetcode-Solution | train | 1 | |
5cca21ac0a9d05358377f9d01ffcf0737cce1996 | [
"self.interpolator = interpolator\nself.absorption = absorption\nself.background = background",
"if data is None:\n data = []\nassert 'p' in data or p is not None\nassert 'T' in data or T is not None\nassert 'lnq' in data or lnq is not None\np = np.array(data['p']) if 'p' in data else np.array(p)\nT = np.array... | <|body_start_0|>
self.interpolator = interpolator
self.absorption = absorption
self.background = background
<|end_body_0|>
<|body_start_1|>
if data is None:
data = []
assert 'p' in data or p is not None
assert 'T' in data or T is not None
assert 'lnq'... | Microwave radiative transfer model for ground based applications. Default mode of model (using __call__) uses full forward differentiation, providing Jacobians for temperature and humidity (input as the natural logarithm of specific water content, i.e vapor + liquid). The .forward method only calculates the brightness ... | MWRTM | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MWRTM:
"""Microwave radiative transfer model for ground based applications. Default mode of model (using __call__) uses full forward differentiation, providing Jacobians for temperature and humidity (input as the natural logarithm of specific water content, i.e vapor + liquid). The .forward metho... | stack_v2_sparse_classes_36k_train_018359 | 7,810 | permissive | [
{
"docstring": "Initialize a radiative transfer model. The interpolator is used to transform quantities from the input to the model grid. The absorption model is used to calculate absorption coefficients from pressure, temperature and total water content. The background temperature is used for the value of brig... | 5 | stack_v2_sparse_classes_30k_train_016841 | Implement the Python class `MWRTM` described below.
Class description:
Microwave radiative transfer model for ground based applications. Default mode of model (using __call__) uses full forward differentiation, providing Jacobians for temperature and humidity (input as the natural logarithm of specific water content, ... | Implement the Python class `MWRTM` described below.
Class description:
Microwave radiative transfer model for ground based applications. Default mode of model (using __call__) uses full forward differentiation, providing Jacobians for temperature and humidity (input as the natural logarithm of specific water content, ... | 52918f8452b6459cf19fc43a3103f2e37215fdae | <|skeleton|>
class MWRTM:
"""Microwave radiative transfer model for ground based applications. Default mode of model (using __call__) uses full forward differentiation, providing Jacobians for temperature and humidity (input as the natural logarithm of specific water content, i.e vapor + liquid). The .forward metho... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MWRTM:
"""Microwave radiative transfer model for ground based applications. Default mode of model (using __call__) uses full forward differentiation, providing Jacobians for temperature and humidity (input as the natural logarithm of specific water content, i.e vapor + liquid). The .forward method only calcul... | the_stack_v2_python_sparse | software/mwrt/model.py | chpolste/MScAtmosphericSciences | train | 3 |
a86b02581f06d22d5907fefdb2ff7bb64f911b59 | [
"self._pol1, self._pol2 = (pol1, pol2)\nself.deg = self._pol1.deg * self._pol2.deg\n_pol1, _pol2 = (self._pol1.pol[::-1], self._pol2.pol[::-1])\nself.pol = np.zeros((1,))\nfor i in range(pol1.deg + 1):\n self.pol = polyadd(self.pol, _pol1[i] * polypow(_pol2, i))\nself.pol = self.pol[::-1]",
"y = self._pol1.eva... | <|body_start_0|>
self._pol1, self._pol2 = (pol1, pol2)
self.deg = self._pol1.deg * self._pol2.deg
_pol1, _pol2 = (self._pol1.pol[::-1], self._pol2.pol[::-1])
self.pol = np.zeros((1,))
for i in range(pol1.deg + 1):
self.pol = polyadd(self.pol, _pol1[i] * polypow(_pol2,... | Create polynomial from composition of two others. | CompPol | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CompPol:
"""Create polynomial from composition of two others."""
def __init__(self, pol1, pol2):
"""Composes two polynomials (i.e., `pol1'(`pol2')) with distinct covariance matrices. Considering we have polynomials f(x) = \\sum_i a_i x^i, g(x) = \\sum_j b_j x^j, with variances \\sigm... | stack_v2_sparse_classes_36k_train_018360 | 35,535 | permissive | [
{
"docstring": "Composes two polynomials (i.e., `pol1'(`pol2')) with distinct covariance matrices. Considering we have polynomials f(x) = \\\\sum_i a_i x^i, g(x) = \\\\sum_j b_j x^j, with variances \\\\sigma_f and \\\\sigma_g when evaluated (see active_work.maths.Polynomial), we compute \\\\sigma_fg(x) = \\\\si... | 2 | stack_v2_sparse_classes_30k_train_018400 | Implement the Python class `CompPol` described below.
Class description:
Create polynomial from composition of two others.
Method signatures and docstrings:
- def __init__(self, pol1, pol2): Composes two polynomials (i.e., `pol1'(`pol2')) with distinct covariance matrices. Considering we have polynomials f(x) = \\sum... | Implement the Python class `CompPol` described below.
Class description:
Create polynomial from composition of two others.
Method signatures and docstrings:
- def __init__(self, pol1, pol2): Composes two polynomials (i.e., `pol1'(`pol2')) with distinct covariance matrices. Considering we have polynomials f(x) = \\sum... | 99107a0d4935296b673f67469c1e2bd258954b9b | <|skeleton|>
class CompPol:
"""Create polynomial from composition of two others."""
def __init__(self, pol1, pol2):
"""Composes two polynomials (i.e., `pol1'(`pol2')) with distinct covariance matrices. Considering we have polynomials f(x) = \\sum_i a_i x^i, g(x) = \\sum_j b_j x^j, with variances \\sigm... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CompPol:
"""Create polynomial from composition of two others."""
def __init__(self, pol1, pol2):
"""Composes two polynomials (i.e., `pol1'(`pol2')) with distinct covariance matrices. Considering we have polynomials f(x) = \\sum_i a_i x^i, g(x) = \\sum_j b_j x^j, with variances \\sigma_f and \\sig... | the_stack_v2_python_sparse | maths.py | yketa/active_work | train | 1 |
84059e77611c3279dd00145891df7a9045b3a054 | [
"f = self.dtype_f(self.init)\nv = u.flatten()\nf.impl[:] = self.A.dot(v).reshape(self.nvars)\nf.expl[:] = (1.0 / self.eps ** 2 * v * (1.0 - v ** self.nu)).reshape(self.nvars)\nreturn f",
"class context:\n num_iter = 0\n\ndef callback(xk):\n context.num_iter += 1\n return context.num_iter\nme = self.dtype... | <|body_start_0|>
f = self.dtype_f(self.init)
v = u.flatten()
f.impl[:] = self.A.dot(v).reshape(self.nvars)
f.expl[:] = (1.0 / self.eps ** 2 * v * (1.0 - v ** self.nu)).reshape(self.nvars)
return f
<|end_body_0|>
<|body_start_1|>
class context:
num_iter = 0
... | Example implementing the Allen-Cahn equation in 2D with finite differences, SDC standard splitting | allencahn_semiimplicit | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class allencahn_semiimplicit:
"""Example implementing the Allen-Cahn equation in 2D with finite differences, SDC standard splitting"""
def eval_f(self, u, t):
"""Routine to evaluate the right-hand side of the problem. Parameters ---------- u : dtype_u Current values of the numerical soluti... | stack_v2_sparse_classes_36k_train_018361 | 19,427 | permissive | [
{
"docstring": "Routine to evaluate the right-hand side of the problem. Parameters ---------- u : dtype_u Current values of the numerical solution. t : float Current time of the numerical solution is computed (not used here). Returns ------- f : dtype_f The right-hand side of the problem.",
"name": "eval_f"... | 2 | null | Implement the Python class `allencahn_semiimplicit` described below.
Class description:
Example implementing the Allen-Cahn equation in 2D with finite differences, SDC standard splitting
Method signatures and docstrings:
- def eval_f(self, u, t): Routine to evaluate the right-hand side of the problem. Parameters ----... | Implement the Python class `allencahn_semiimplicit` described below.
Class description:
Example implementing the Allen-Cahn equation in 2D with finite differences, SDC standard splitting
Method signatures and docstrings:
- def eval_f(self, u, t): Routine to evaluate the right-hand side of the problem. Parameters ----... | 1a51834bedffd4472e344bed28f4d766614b1537 | <|skeleton|>
class allencahn_semiimplicit:
"""Example implementing the Allen-Cahn equation in 2D with finite differences, SDC standard splitting"""
def eval_f(self, u, t):
"""Routine to evaluate the right-hand side of the problem. Parameters ---------- u : dtype_u Current values of the numerical soluti... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class allencahn_semiimplicit:
"""Example implementing the Allen-Cahn equation in 2D with finite differences, SDC standard splitting"""
def eval_f(self, u, t):
"""Routine to evaluate the right-hand side of the problem. Parameters ---------- u : dtype_u Current values of the numerical solution. t : float... | the_stack_v2_python_sparse | pySDC/implementations/problem_classes/AllenCahn_2D_FD.py | Parallel-in-Time/pySDC | train | 30 |
b878a6872a2a33ef3c2c7d92a1e2981db7a79952 | [
"self._timer_start = perf_counter()\nself._timer_last = self._timer_start\nself.aoc_year = aoc_year\nuser_profile = Path(os.environ['USERPROFILE'])\nself._aoc_path = user_profile / 'aoc'\nbase_path = Path().cwd()\nwhile base_path.parts[-1].casefold() != 'AdventOfCode'.casefold():\n base_path = base_path.parent\n... | <|body_start_0|>
self._timer_start = perf_counter()
self._timer_last = self._timer_start
self.aoc_year = aoc_year
user_profile = Path(os.environ['USERPROFILE'])
self._aoc_path = user_profile / 'aoc'
base_path = Path().cwd()
while base_path.parts[-1].casefold() != ... | Advent of Code loader library. Attributes: aoc_year (int): The year of Advent of Code to work with. Methods: print_solution get_puzzle_input cache_data retrieve_data | LoaderLib | [
"Unlicense"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LoaderLib:
"""Advent of Code loader library. Attributes: aoc_year (int): The year of Advent of Code to work with. Methods: print_solution get_puzzle_input cache_data retrieve_data"""
def __init__(self, aoc_year):
"""Initialise helper library. Parameters: aoc_year (int): The year of A... | stack_v2_sparse_classes_36k_train_018362 | 4,883 | permissive | [
{
"docstring": "Initialise helper library. Parameters: aoc_year (int): The year of Advent of Code to work with.",
"name": "__init__",
"signature": "def __init__(self, aoc_year)"
},
{
"docstring": "Get puzzle input from the AOC website. Apply an optional transform function to it before returning.... | 5 | stack_v2_sparse_classes_30k_train_014365 | Implement the Python class `LoaderLib` described below.
Class description:
Advent of Code loader library. Attributes: aoc_year (int): The year of Advent of Code to work with. Methods: print_solution get_puzzle_input cache_data retrieve_data
Method signatures and docstrings:
- def __init__(self, aoc_year): Initialise ... | Implement the Python class `LoaderLib` described below.
Class description:
Advent of Code loader library. Attributes: aoc_year (int): The year of Advent of Code to work with. Methods: print_solution get_puzzle_input cache_data retrieve_data
Method signatures and docstrings:
- def __init__(self, aoc_year): Initialise ... | 567df9cb5645bc6cf4c22063a84a621039069311 | <|skeleton|>
class LoaderLib:
"""Advent of Code loader library. Attributes: aoc_year (int): The year of Advent of Code to work with. Methods: print_solution get_puzzle_input cache_data retrieve_data"""
def __init__(self, aoc_year):
"""Initialise helper library. Parameters: aoc_year (int): The year of A... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LoaderLib:
"""Advent of Code loader library. Attributes: aoc_year (int): The year of Advent of Code to work with. Methods: print_solution get_puzzle_input cache_data retrieve_data"""
def __init__(self, aoc_year):
"""Initialise helper library. Parameters: aoc_year (int): The year of Advent of Code... | the_stack_v2_python_sparse | aoc/loader.py | GeoffRiley/AdventOfCode | train | 3 |
fdfd7dc52761826c35d4c8da97ca1ea76aed43aa | [
"query = self.table.query(g.db_session)\nadditional_modifiers = None\nif id is not None:\n additional_modifiers = {'filter': [RPMComparison.id == id]}\nmodifiers = self.modifiers(additional=additional_modifiers)\nquery = modify_query(query, modifiers)\nreturn list(iter_query_result(query, self.table))",
"try:\... | <|body_start_0|>
query = self.table.query(g.db_session)
additional_modifiers = None
if id is not None:
additional_modifiers = {'filter': [RPMComparison.id == id]}
modifiers = self.modifiers(additional=additional_modifiers)
query = modify_query(query, modifiers)
... | List of rpm differences. | RPMDifferencesList | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RPMDifferencesList:
"""List of rpm differences."""
def get(self, id=None):
"""Get list. :param int id: RPMComparison id :return list: list of the resulting query"""
<|body_0|>
def put(self, id):
"""Waive/unwaive a difference."""
<|body_1|>
<|end_skeleton... | stack_v2_sparse_classes_36k_train_018363 | 22,524 | permissive | [
{
"docstring": "Get list. :param int id: RPMComparison id :return list: list of the resulting query",
"name": "get",
"signature": "def get(self, id=None)"
},
{
"docstring": "Waive/unwaive a difference.",
"name": "put",
"signature": "def put(self, id)"
}
] | 2 | stack_v2_sparse_classes_30k_train_004040 | Implement the Python class `RPMDifferencesList` described below.
Class description:
List of rpm differences.
Method signatures and docstrings:
- def get(self, id=None): Get list. :param int id: RPMComparison id :return list: list of the resulting query
- def put(self, id): Waive/unwaive a difference. | Implement the Python class `RPMDifferencesList` described below.
Class description:
List of rpm differences.
Method signatures and docstrings:
- def get(self, id=None): Get list. :param int id: RPMComparison id :return list: list of the resulting query
- def put(self, id): Waive/unwaive a difference.
<|skeleton|>
cl... | 06f2ef0bb232b1ffe46e9d50575c4b79b1cff191 | <|skeleton|>
class RPMDifferencesList:
"""List of rpm differences."""
def get(self, id=None):
"""Get list. :param int id: RPMComparison id :return list: list of the resulting query"""
<|body_0|>
def put(self, id):
"""Waive/unwaive a difference."""
<|body_1|>
<|end_skeleton... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RPMDifferencesList:
"""List of rpm differences."""
def get(self, id=None):
"""Get list. :param int id: RPMComparison id :return list: list of the resulting query"""
query = self.table.query(g.db_session)
additional_modifiers = None
if id is not None:
additional... | the_stack_v2_python_sparse | archdiffer/plugins/rpmdiff/flask_frontend/bp.py | pkratoch/archdiffer | train | 0 |
a8d2b35618c7e8af528a5d027f5298704b583431 | [
"input_file = XSDataInputControlDozor()\ninput_file.setTemplate(XSDataString(self.params_dict['template']))\ninput_file.setFirst_image_number(XSDataInteger(self.params_dict['first_image_num']))\ninput_file.setLast_image_number(XSDataInteger(self.params_dict['images_num']))\ninput_file.setFirst_run_number(XSDataInte... | <|body_start_0|>
input_file = XSDataInputControlDozor()
input_file.setTemplate(XSDataString(self.params_dict['template']))
input_file.setFirst_image_number(XSDataInteger(self.params_dict['first_image_num']))
input_file.setLast_image_number(XSDataInteger(self.params_dict['images_num']))
... | DozorParallelProcessing | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DozorParallelProcessing:
def create_processing_input_file(self, processing_input_filename):
"""Creates dozor input file base on data collection parameters :param processing_input_filename :type : str"""
<|body_0|>
def batch_processed(self, batch):
"""Method called fr... | stack_v2_sparse_classes_36k_train_018364 | 3,473 | no_license | [
{
"docstring": "Creates dozor input file base on data collection parameters :param processing_input_filename :type : str",
"name": "create_processing_input_file",
"signature": "def create_processing_input_file(self, processing_input_filename)"
},
{
"docstring": "Method called from EDNA via xmlrp... | 2 | stack_v2_sparse_classes_30k_train_018769 | Implement the Python class `DozorParallelProcessing` described below.
Class description:
Implement the DozorParallelProcessing class.
Method signatures and docstrings:
- def create_processing_input_file(self, processing_input_filename): Creates dozor input file base on data collection parameters :param processing_inp... | Implement the Python class `DozorParallelProcessing` described below.
Class description:
Implement the DozorParallelProcessing class.
Method signatures and docstrings:
- def create_processing_input_file(self, processing_input_filename): Creates dozor input file base on data collection parameters :param processing_inp... | 8ab972c42b89d953b897b9745edec7156b156103 | <|skeleton|>
class DozorParallelProcessing:
def create_processing_input_file(self, processing_input_filename):
"""Creates dozor input file base on data collection parameters :param processing_input_filename :type : str"""
<|body_0|>
def batch_processed(self, batch):
"""Method called fr... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DozorParallelProcessing:
def create_processing_input_file(self, processing_input_filename):
"""Creates dozor input file base on data collection parameters :param processing_input_filename :type : str"""
input_file = XSDataInputControlDozor()
input_file.setTemplate(XSDataString(self.par... | the_stack_v2_python_sparse | HardwareObjects/DozorParallelProcessing.py | schurmann/HardwareRepository | train | 0 | |
d3a431c151d605c82207c6d0c44b1be4ae25cd0d | [
"super(CreateAdcPoolObjects, self).__init__(*args, **kwargs)\nself.pool_count = pool_count\nself.pool_member_count = pool_member_count\nself.bigip = bigip\nself.object_counter = 0\nself.context = ContextHelper(__name__)\nself.cfgifc = self.context.get_config()\nself.node_names = node_names\nself.node_addresses = no... | <|body_start_0|>
super(CreateAdcPoolObjects, self).__init__(*args, **kwargs)
self.pool_count = pool_count
self.pool_member_count = pool_member_count
self.bigip = bigip
self.object_counter = 0
self.context = ContextHelper(__name__)
self.cfgifc = self.context.get_co... | Create the specified number of ADC Pool objects on the BIG-IQ for the specified BIG-IP. Works for BIG-IQ 4.6.0 and later. You must deploy the ADC objects from the BIG-IQ to the BIG-IP(s) with a separate call. | CreateAdcPoolObjects | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CreateAdcPoolObjects:
"""Create the specified number of ADC Pool objects on the BIG-IQ for the specified BIG-IP. Works for BIG-IQ 4.6.0 and later. You must deploy the ADC objects from the BIG-IQ to the BIG-IP(s) with a separate call."""
def __init__(self, pool_count, pool_member_count, bigip... | stack_v2_sparse_classes_36k_train_018365 | 15,401 | permissive | [
{
"docstring": "Object initialization. @param pool_count: The number of ADC pools to create. @param pool_member_count: The number of members per ADC pool to create. @param bigip: BIG-IP device, as returned by MachineIdResolver. @param node_names: List of Node Names to use to link up with the pool members. @para... | 2 | null | Implement the Python class `CreateAdcPoolObjects` described below.
Class description:
Create the specified number of ADC Pool objects on the BIG-IQ for the specified BIG-IP. Works for BIG-IQ 4.6.0 and later. You must deploy the ADC objects from the BIG-IQ to the BIG-IP(s) with a separate call.
Method signatures and d... | Implement the Python class `CreateAdcPoolObjects` described below.
Class description:
Create the specified number of ADC Pool objects on the BIG-IQ for the specified BIG-IP. Works for BIG-IQ 4.6.0 and later. You must deploy the ADC objects from the BIG-IQ to the BIG-IP(s) with a separate call.
Method signatures and d... | 40264ac83b3f1d2a30ebc1107927044f42c86f8a | <|skeleton|>
class CreateAdcPoolObjects:
"""Create the specified number of ADC Pool objects on the BIG-IQ for the specified BIG-IP. Works for BIG-IQ 4.6.0 and later. You must deploy the ADC objects from the BIG-IQ to the BIG-IP(s) with a separate call."""
def __init__(self, pool_count, pool_member_count, bigip... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CreateAdcPoolObjects:
"""Create the specified number of ADC Pool objects on the BIG-IQ for the specified BIG-IP. Works for BIG-IQ 4.6.0 and later. You must deploy the ADC objects from the BIG-IQ to the BIG-IP(s) with a separate call."""
def __init__(self, pool_count, pool_member_count, bigip, node_names,... | the_stack_v2_python_sparse | f5test/commands/rest/adc.py | jonozzz/nosest | train | 1 |
f3068639bc83c5ede84c28d0f3c5b1ddb7e1ee8d | [
"super().__init__()\nif path:\n use_pretrained = False\nelse:\n use_pretrained = True\nresnet = models.resnet50(pretrained=use_pretrained)\nself.pretrained = nn.Module()\nself.scratch = nn.Module()\nself.pretrained.layer1 = nn.Sequential(resnet.conv1, resnet.bn1, resnet.relu, resnet.maxpool, resnet.layer1)\ns... | <|body_start_0|>
super().__init__()
if path:
use_pretrained = False
else:
use_pretrained = True
resnet = models.resnet50(pretrained=use_pretrained)
self.pretrained = nn.Module()
self.scratch = nn.Module()
self.pretrained.layer1 = nn.Sequent... | Network for monocular depth estimation. | RetrievalNet | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RetrievalNet:
"""Network for monocular depth estimation."""
def __init__(self, path=None, features=256):
"""Init. Args: path (str, optional): Path to saved model. Defaults to None. features (int, optional): Number of features. Defaults to 256."""
<|body_0|>
def forward(s... | stack_v2_sparse_classes_36k_train_018366 | 4,484 | permissive | [
{
"docstring": "Init. Args: path (str, optional): Path to saved model. Defaults to None. features (int, optional): Number of features. Defaults to 256.",
"name": "__init__",
"signature": "def __init__(self, path=None, features=256)"
},
{
"docstring": "Forward pass. Argsn: x (tensor): input data ... | 3 | stack_v2_sparse_classes_30k_train_012057 | Implement the Python class `RetrievalNet` described below.
Class description:
Network for monocular depth estimation.
Method signatures and docstrings:
- def __init__(self, path=None, features=256): Init. Args: path (str, optional): Path to saved model. Defaults to None. features (int, optional): Number of features. ... | Implement the Python class `RetrievalNet` described below.
Class description:
Network for monocular depth estimation.
Method signatures and docstrings:
- def __init__(self, path=None, features=256): Init. Args: path (str, optional): Path to saved model. Defaults to None. features (int, optional): Number of features. ... | a00c3619bf4042e446e1919087f0b09fe9fa3a65 | <|skeleton|>
class RetrievalNet:
"""Network for monocular depth estimation."""
def __init__(self, path=None, features=256):
"""Init. Args: path (str, optional): Path to saved model. Defaults to None. features (int, optional): Number of features. Defaults to 256."""
<|body_0|>
def forward(s... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RetrievalNet:
"""Network for monocular depth estimation."""
def __init__(self, path=None, features=256):
"""Init. Args: path (str, optional): Path to saved model. Defaults to None. features (int, optional): Number of features. Defaults to 256."""
super().__init__()
if path:
... | the_stack_v2_python_sparse | nasws/cnn/search_space/monodepth/models/retrieval_net.py | kcyu2014/nas-landmarkreg | train | 10 |
e68cb3b03f588d8382194b9e944e3e1a7361de7c | [
"stack = []\ni = 0\nvalue = 0\noperator = '+'\ns = ''.join(s.split(' '))\nwhile i < len(s):\n while i < len(s) and s[i].isdigit():\n value = value * 10 + int(s[i])\n i += 1\n if operator == '+':\n stack.append(value)\n elif operator == '-':\n stack.append(-value)\n elif opera... | <|body_start_0|>
stack = []
i = 0
value = 0
operator = '+'
s = ''.join(s.split(' '))
while i < len(s):
while i < len(s) and s[i].isdigit():
value = value * 10 + int(s[i])
i += 1
if operator == '+':
st... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def calculate(self, s):
""":type s: str :rtype: int"""
<|body_0|>
def calculate(self, s):
""":type s: str :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
stack = []
i = 0
value = 0
operator = '+'
... | stack_v2_sparse_classes_36k_train_018367 | 4,399 | no_license | [
{
"docstring": ":type s: str :rtype: int",
"name": "calculate",
"signature": "def calculate(self, s)"
},
{
"docstring": ":type s: str :rtype: int",
"name": "calculate",
"signature": "def calculate(self, s)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def calculate(self, s): :type s: str :rtype: int
- def calculate(self, s): :type s: str :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def calculate(self, s): :type s: str :rtype: int
- def calculate(self, s): :type s: str :rtype: int
<|skeleton|>
class Solution:
def calculate(self, s):
""":type s:... | d953abe2c9680f636563e76287d2f907e90ced63 | <|skeleton|>
class Solution:
def calculate(self, s):
""":type s: str :rtype: int"""
<|body_0|>
def calculate(self, s):
""":type s: str :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def calculate(self, s):
""":type s: str :rtype: int"""
stack = []
i = 0
value = 0
operator = '+'
s = ''.join(s.split(' '))
while i < len(s):
while i < len(s) and s[i].isdigit():
value = value * 10 + int(s[i])
... | the_stack_v2_python_sparse | python_leetcode_2020/Python_Leetcode_2020/227_basic_calculator_ii.py | xiangcao/Leetcode | train | 0 | |
41f8c7ff6393be932c3033fddd821c8b11a77842 | [
"payload = {'x': 'y', 'abc': 'def', 'key': 'value', 'signed_field_names': 'abc,x'}\nsignature = generate_cybersource_sa_signature(payload)\nmessage = ','.join(('{}={}'.format(key, payload[key]) for key in ['abc', 'x']))\ndigest = hmac.new(CYBERSOURCE_SECURITY_KEY.encode('utf-8'), msg=message.encode('utf-8'), digest... | <|body_start_0|>
payload = {'x': 'y', 'abc': 'def', 'key': 'value', 'signed_field_names': 'abc,x'}
signature = generate_cybersource_sa_signature(payload)
message = ','.join(('{}={}'.format(key, payload[key]) for key in ['abc', 'x']))
digest = hmac.new(CYBERSOURCE_SECURITY_KEY.encode('utf... | Tests for generate_cybersource_sa_payload and generate_cybersource_sa_signature | CybersourceTests | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CybersourceTests:
"""Tests for generate_cybersource_sa_payload and generate_cybersource_sa_signature"""
def test_valid_signature(self):
"""Signature is made up of a ordered key value list signed using HMAC 256 with a security key"""
<|body_0|>
def test_signed_payload(sel... | stack_v2_sparse_classes_36k_train_018368 | 41,111 | permissive | [
{
"docstring": "Signature is made up of a ordered key value list signed using HMAC 256 with a security key",
"name": "test_valid_signature",
"signature": "def test_valid_signature(self)"
},
{
"docstring": "A valid payload should be signed appropriately",
"name": "test_signed_payload",
"s... | 2 | null | Implement the Python class `CybersourceTests` described below.
Class description:
Tests for generate_cybersource_sa_payload and generate_cybersource_sa_signature
Method signatures and docstrings:
- def test_valid_signature(self): Signature is made up of a ordered key value list signed using HMAC 256 with a security k... | Implement the Python class `CybersourceTests` described below.
Class description:
Tests for generate_cybersource_sa_payload and generate_cybersource_sa_signature
Method signatures and docstrings:
- def test_valid_signature(self): Signature is made up of a ordered key value list signed using HMAC 256 with a security k... | d6564caca0b7bbfd31e67a751564107fd17d6eb0 | <|skeleton|>
class CybersourceTests:
"""Tests for generate_cybersource_sa_payload and generate_cybersource_sa_signature"""
def test_valid_signature(self):
"""Signature is made up of a ordered key value list signed using HMAC 256 with a security key"""
<|body_0|>
def test_signed_payload(sel... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CybersourceTests:
"""Tests for generate_cybersource_sa_payload and generate_cybersource_sa_signature"""
def test_valid_signature(self):
"""Signature is made up of a ordered key value list signed using HMAC 256 with a security key"""
payload = {'x': 'y', 'abc': 'def', 'key': 'value', 'sign... | the_stack_v2_python_sparse | ecommerce/api_test.py | mitodl/micromasters | train | 35 |
c934d4dab89d877b173c1f1e222ddf0aaccaa7c9 | [
"if len(validated_data['supervisor']) == 0:\n course = validated_data['course']\n validated_data['supervisor'] = course.supervisor.all()\nspecific_date = super(SpecificDateSerializer, self).create(validated_data)\nreturn specific_date",
"attendance_set = obj.get_attendees()\nserializer = AttendanceSerialize... | <|body_start_0|>
if len(validated_data['supervisor']) == 0:
course = validated_data['course']
validated_data['supervisor'] = course.supervisor.all()
specific_date = super(SpecificDateSerializer, self).create(validated_data)
return specific_date
<|end_body_0|>
<|body_star... | SpecificDateSerializer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SpecificDateSerializer:
def create(self, validated_data):
"""Overwrites create() to ensure the course supervisors are used if not explicitly stated. Note: This cannot be done in the models save() method because changes to many-to-many fields are not valid in a specific models save proced... | stack_v2_sparse_classes_36k_train_018369 | 18,716 | no_license | [
{
"docstring": "Overwrites create() to ensure the course supervisors are used if not explicitly stated. Note: This cannot be done in the models save() method because changes to many-to-many fields are not valid in a specific models save procedure Also note how the validated_data already contains full fledged ob... | 3 | stack_v2_sparse_classes_30k_train_011368 | Implement the Python class `SpecificDateSerializer` described below.
Class description:
Implement the SpecificDateSerializer class.
Method signatures and docstrings:
- def create(self, validated_data): Overwrites create() to ensure the course supervisors are used if not explicitly stated. Note: This cannot be done in... | Implement the Python class `SpecificDateSerializer` described below.
Class description:
Implement the SpecificDateSerializer class.
Method signatures and docstrings:
- def create(self, validated_data): Overwrites create() to ensure the course supervisors are used if not explicitly stated. Note: This cannot be done in... | 88c51e6216fadcb8369170dca4450563333e4b31 | <|skeleton|>
class SpecificDateSerializer:
def create(self, validated_data):
"""Overwrites create() to ensure the course supervisors are used if not explicitly stated. Note: This cannot be done in the models save() method because changes to many-to-many fields are not valid in a specific models save proced... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SpecificDateSerializer:
def create(self, validated_data):
"""Overwrites create() to ensure the course supervisors are used if not explicitly stated. Note: This cannot be done in the models save() method because changes to many-to-many fields are not valid in a specific models save procedure Also note ... | the_stack_v2_python_sparse | restapi/serializer.py | MaximilianFranz/temas-db | train | 0 | |
3d396c81132282bb427182bb192caea662acb65d | [
"A.sort(reverse=True)\nC = sorted([i for i in range(len(B))], key=lambda x: B[x], reverse=True)\nret = [None] * len(A)\nleft, right = (0, len(A) - 1)\nfor c in C:\n if A[left] > B[c]:\n ret[c] = A[left]\n left += 1\n else:\n ret[c] = A[right]\n right -= 1\nreturn ret",
"A.sort(re... | <|body_start_0|>
A.sort(reverse=True)
C = sorted([i for i in range(len(B))], key=lambda x: B[x], reverse=True)
ret = [None] * len(A)
left, right = (0, len(A) - 1)
for c in C:
if A[left] > B[c]:
ret[c] = A[left]
left += 1
els... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def advantageCount(self, A, B):
""":type A: List[int] :type B: List[int] :rtype: List[int] 這邊有 greedy 的想法,簡單來說就是 對於 B 的每個元素排序, 從大到小來比較 只要目前A最大值 > B最大值, 那就把這個值放在這個 B 的位子 若否,則表示這個目前 B 中最大值比 A 中最大值還大,那就給他最小的避免浪費"""
<|body_0|>
def advantageCountMe(self, A, B):
... | stack_v2_sparse_classes_36k_train_018370 | 1,816 | no_license | [
{
"docstring": ":type A: List[int] :type B: List[int] :rtype: List[int] 這邊有 greedy 的想法,簡單來說就是 對於 B 的每個元素排序, 從大到小來比較 只要目前A最大值 > B最大值, 那就把這個值放在這個 B 的位子 若否,則表示這個目前 B 中最大值比 A 中最大值還大,那就給他最小的避免浪費",
"name": "advantageCount",
"signature": "def advantageCount(self, A, B)"
},
{
"docstring": ":type A: List... | 2 | stack_v2_sparse_classes_30k_train_015082 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def advantageCount(self, A, B): :type A: List[int] :type B: List[int] :rtype: List[int] 這邊有 greedy 的想法,簡單來說就是 對於 B 的每個元素排序, 從大到小來比較 只要目前A最大值 > B最大值, 那就把這個值放在這個 B 的位子 若否,則表示這個目前 B... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def advantageCount(self, A, B): :type A: List[int] :type B: List[int] :rtype: List[int] 這邊有 greedy 的想法,簡單來說就是 對於 B 的每個元素排序, 從大到小來比較 只要目前A最大值 > B最大值, 那就把這個值放在這個 B 的位子 若否,則表示這個目前 B... | ac53dd9bf2c4c9d17c9dc5f7fdda32e386658fdd | <|skeleton|>
class Solution:
def advantageCount(self, A, B):
""":type A: List[int] :type B: List[int] :rtype: List[int] 這邊有 greedy 的想法,簡單來說就是 對於 B 的每個元素排序, 從大到小來比較 只要目前A最大值 > B最大值, 那就把這個值放在這個 B 的位子 若否,則表示這個目前 B 中最大值比 A 中最大值還大,那就給他最小的避免浪費"""
<|body_0|>
def advantageCountMe(self, A, B):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def advantageCount(self, A, B):
""":type A: List[int] :type B: List[int] :rtype: List[int] 這邊有 greedy 的想法,簡單來說就是 對於 B 的每個元素排序, 從大到小來比較 只要目前A最大值 > B最大值, 那就把這個值放在這個 B 的位子 若否,則表示這個目前 B 中最大值比 A 中最大值還大,那就給他最小的避免浪費"""
A.sort(reverse=True)
C = sorted([i for i in range(len(B))], key=... | the_stack_v2_python_sparse | cs_notes/arrays/advantage_shuffle.py | hwc1824/LeetCodeSolution | train | 0 | |
7fa977f7f9b29a202334f7eae88dbf350f4ddb2d | [
"header = utils.Struct(header)\nif 'suffix' not in header:\n raise exceptions.CrdsTypeSpecError(\"Missing 'suffix' field in type spec.\")\nif 'filetype' not in header:\n raise exceptions.CrdsTypeSpecError(\"Missing 'filetype' field in type spec.\")\nif 'text_descr' not in header and header.filetype != 'all':\... | <|body_start_0|>
header = utils.Struct(header)
if 'suffix' not in header:
raise exceptions.CrdsTypeSpecError("Missing 'suffix' field in type spec.")
if 'filetype' not in header:
raise exceptions.CrdsTypeSpecError("Missing 'filetype' field in type spec.")
if 'text_... | This class captures type definition parameters for a single type | TypeSpec | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TypeSpec:
"""This class captures type definition parameters for a single type"""
def __init__(self, header):
"""Initialize this TypeSpec from dict `header`, enforcing requirments and creating suitable defaults for missing fields."""
<|body_0|>
def from_file(cls, filename... | stack_v2_sparse_classes_36k_train_018371 | 17,916 | permissive | [
{
"docstring": "Initialize this TypeSpec from dict `header`, enforcing requirments and creating suitable defaults for missing fields.",
"name": "__init__",
"signature": "def __init__(self, header)"
},
{
"docstring": "For historical HST types, build type info from a spec file derived from CDBS sp... | 2 | null | Implement the Python class `TypeSpec` described below.
Class description:
This class captures type definition parameters for a single type
Method signatures and docstrings:
- def __init__(self, header): Initialize this TypeSpec from dict `header`, enforcing requirments and creating suitable defaults for missing field... | Implement the Python class `TypeSpec` described below.
Class description:
This class captures type definition parameters for a single type
Method signatures and docstrings:
- def __init__(self, header): Initialize this TypeSpec from dict `header`, enforcing requirments and creating suitable defaults for missing field... | 08da10721c0e979877dc9579b4092c79f4ceee27 | <|skeleton|>
class TypeSpec:
"""This class captures type definition parameters for a single type"""
def __init__(self, header):
"""Initialize this TypeSpec from dict `header`, enforcing requirments and creating suitable defaults for missing fields."""
<|body_0|>
def from_file(cls, filename... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TypeSpec:
"""This class captures type definition parameters for a single type"""
def __init__(self, header):
"""Initialize this TypeSpec from dict `header`, enforcing requirments and creating suitable defaults for missing fields."""
header = utils.Struct(header)
if 'suffix' not in... | the_stack_v2_python_sparse | crds/core/reftypes.py | spacetelescope/crds | train | 9 |
59ae0be6aee066b244be3a1273993f1d3771d220 | [
"results = []\nn = len(nums)\n\ndef backtrack(start=0):\n if start == n:\n if nums not in results:\n results.append(nums[:])\n for i in range(start, n):\n nums[start], nums[i] = (nums[i], nums[start])\n backtrack(start + 1)\n nums[start], nums[i] = (nums[i], nums[start])... | <|body_start_0|>
results = []
n = len(nums)
def backtrack(start=0):
if start == n:
if nums not in results:
results.append(nums[:])
for i in range(start, n):
nums[start], nums[i] = (nums[i], nums[start])
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def permuteUnique(self, nums):
""":type nums: List[int] :rtype: List[List[int]]"""
<|body_0|>
def permuteUnique2(self, nums):
""":type nums: List[int] :rtype: List[List[int]]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
results = []
... | stack_v2_sparse_classes_36k_train_018372 | 1,314 | no_license | [
{
"docstring": ":type nums: List[int] :rtype: List[List[int]]",
"name": "permuteUnique",
"signature": "def permuteUnique(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: List[List[int]]",
"name": "permuteUnique2",
"signature": "def permuteUnique2(self, nums)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def permuteUnique(self, nums): :type nums: List[int] :rtype: List[List[int]]
- def permuteUnique2(self, nums): :type nums: List[int] :rtype: List[List[int]] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def permuteUnique(self, nums): :type nums: List[int] :rtype: List[List[int]]
- def permuteUnique2(self, nums): :type nums: List[int] :rtype: List[List[int]]
<|skeleton|>
class S... | 3b13b36f37eb364410b3b5b4f10a1808d8b1111e | <|skeleton|>
class Solution:
def permuteUnique(self, nums):
""":type nums: List[int] :rtype: List[List[int]]"""
<|body_0|>
def permuteUnique2(self, nums):
""":type nums: List[int] :rtype: List[List[int]]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def permuteUnique(self, nums):
""":type nums: List[int] :rtype: List[List[int]]"""
results = []
n = len(nums)
def backtrack(start=0):
if start == n:
if nums not in results:
results.append(nums[:])
for i in r... | the_stack_v2_python_sparse | leetcode/47.py | yanggelinux/algorithm-data-structure | train | 0 | |
986b05d437abe965c336a7ca1882dd1778678695 | [
"board = boards_api.get(id)\nuser_id = request.current_user_id\nif boards_api.visible(board, user_id):\n board_model = wmodels.Board.from_db_model(board)\n board_model.resolve_lanes(board)\n board_model.resolve_due_dates(board)\n board_model.resolve_permissions(board)\n return board_model\nelse:\n ... | <|body_start_0|>
board = boards_api.get(id)
user_id = request.current_user_id
if boards_api.visible(board, user_id):
board_model = wmodels.Board.from_db_model(board)
board_model.resolve_lanes(board)
board_model.resolve_due_dates(board)
board_model.... | Manages operations on boards. | BoardsController | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BoardsController:
"""Manages operations on boards."""
def get_one(self, id):
"""Retrieve details about one board. :param id: The ID of the board."""
<|body_0|>
def get_all(self, title=None, creator_id=None, project_id=None, archived=False, user_id=None, story_id=None, ta... | stack_v2_sparse_classes_36k_train_018373 | 11,356 | permissive | [
{
"docstring": "Retrieve details about one board. :param id: The ID of the board.",
"name": "get_one",
"signature": "def get_one(self, id)"
},
{
"docstring": "Retrieve definitions of all of the boards. :param title: A string to filter the title by. :param creator_id: Filter boards by their creat... | 5 | stack_v2_sparse_classes_30k_train_014691 | Implement the Python class `BoardsController` described below.
Class description:
Manages operations on boards.
Method signatures and docstrings:
- def get_one(self, id): Retrieve details about one board. :param id: The ID of the board.
- def get_all(self, title=None, creator_id=None, project_id=None, archived=False,... | Implement the Python class `BoardsController` described below.
Class description:
Manages operations on boards.
Method signatures and docstrings:
- def get_one(self, id): Retrieve details about one board. :param id: The ID of the board.
- def get_all(self, title=None, creator_id=None, project_id=None, archived=False,... | 2445e3dc904c7c83305a4a6274e6ae35dacb0cfa | <|skeleton|>
class BoardsController:
"""Manages operations on boards."""
def get_one(self, id):
"""Retrieve details about one board. :param id: The ID of the board."""
<|body_0|>
def get_all(self, title=None, creator_id=None, project_id=None, archived=False, user_id=None, story_id=None, ta... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BoardsController:
"""Manages operations on boards."""
def get_one(self, id):
"""Retrieve details about one board. :param id: The ID of the board."""
board = boards_api.get(id)
user_id = request.current_user_id
if boards_api.visible(board, user_id):
board_model ... | the_stack_v2_python_sparse | storyboard/api/v1/boards.py | yeweiasia/storyboard | train | 0 |
cfb6f615097ca851c2d08b06acc6f8d9b1df136e | [
"super().__init__()\nself.init_size = img_size // 4\nself.l1 = torch.nn.Linear(latent_dim, 128 * self.init_size ** 2)\nself.conv_blocks = torch.nn.Sequential(torch.nn.BatchNorm2d(128), torch.nn.Upsample(scale_factor=2), torch.nn.Conv2d(128, 128, 3, stride=1, padding=1), torch.nn.BatchNorm2d(128, 0.8), torch.nn.Leak... | <|body_start_0|>
super().__init__()
self.init_size = img_size // 4
self.l1 = torch.nn.Linear(latent_dim, 128 * self.init_size ** 2)
self.conv_blocks = torch.nn.Sequential(torch.nn.BatchNorm2d(128), torch.nn.Upsample(scale_factor=2), torch.nn.Conv2d(128, 128, 3, stride=1, padding=1), torc... | Simple Convolutional Generator Network | Generator | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Generator:
"""Simple Convolutional Generator Network"""
def __init__(self, img_size, latent_dim, num_channels):
"""Parameters ---------- img_size : int size of generated images (per side) latent_dim : int size of latent dimension num_channels : int number of output channels"""
... | stack_v2_sparse_classes_36k_train_018374 | 3,368 | permissive | [
{
"docstring": "Parameters ---------- img_size : int size of generated images (per side) latent_dim : int size of latent dimension num_channels : int number of output channels",
"name": "__init__",
"signature": "def __init__(self, img_size, latent_dim, num_channels)"
},
{
"docstring": "Forwards ... | 2 | stack_v2_sparse_classes_30k_train_020464 | Implement the Python class `Generator` described below.
Class description:
Simple Convolutional Generator Network
Method signatures and docstrings:
- def __init__(self, img_size, latent_dim, num_channels): Parameters ---------- img_size : int size of generated images (per side) latent_dim : int size of latent dimensi... | Implement the Python class `Generator` described below.
Class description:
Simple Convolutional Generator Network
Method signatures and docstrings:
- def __init__(self, img_size, latent_dim, num_channels): Parameters ---------- img_size : int size of generated images (per side) latent_dim : int size of latent dimensi... | 1078f5030b8aac2bf022daf5fa14d66f74c3c893 | <|skeleton|>
class Generator:
"""Simple Convolutional Generator Network"""
def __init__(self, img_size, latent_dim, num_channels):
"""Parameters ---------- img_size : int size of generated images (per side) latent_dim : int size of latent dimension num_channels : int number of output channels"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Generator:
"""Simple Convolutional Generator Network"""
def __init__(self, img_size, latent_dim, num_channels):
"""Parameters ---------- img_size : int size of generated images (per side) latent_dim : int size of latent dimension num_channels : int number of output channels"""
super().__i... | the_stack_v2_python_sparse | dlutils/models/gans/dragan/models.py | justusschock/dl-utils | train | 15 |
3e2daa4c183aa4180ed4627896369b9ac0cca60b | [
"if root is None:\n return 0\nreturn max(self._maxPathSum(root))",
"if root is None:\n return (0, float('-INF'))\nlcan, lcannot = self._maxPathSum(root.left)\nrcan, rcannot = self._maxPathSum(root.right)\ncanConcat = root.val + max(lcan, rcan, 0)\ncannotConcat = max(lcannot, rcannot, root.val + lcan + rcan,... | <|body_start_0|>
if root is None:
return 0
return max(self._maxPathSum(root))
<|end_body_0|>
<|body_start_1|>
if root is None:
return (0, float('-INF'))
lcan, lcannot = self._maxPathSum(root.left)
rcan, rcannot = self._maxPathSum(root.right)
canCo... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxPathSum(self, root):
""":type root: TreeNode :rtype: int"""
<|body_0|>
def _maxPathSum(self, root):
""":rtype: (int, int) <= (canConcat, cannotConcat)"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if root is None:
retu... | stack_v2_sparse_classes_36k_train_018375 | 921 | no_license | [
{
"docstring": ":type root: TreeNode :rtype: int",
"name": "maxPathSum",
"signature": "def maxPathSum(self, root)"
},
{
"docstring": ":rtype: (int, int) <= (canConcat, cannotConcat)",
"name": "_maxPathSum",
"signature": "def _maxPathSum(self, root)"
}
] | 2 | stack_v2_sparse_classes_30k_train_019116 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxPathSum(self, root): :type root: TreeNode :rtype: int
- def _maxPathSum(self, root): :rtype: (int, int) <= (canConcat, cannotConcat) | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxPathSum(self, root): :type root: TreeNode :rtype: int
- def _maxPathSum(self, root): :rtype: (int, int) <= (canConcat, cannotConcat)
<|skeleton|>
class Solution:
def... | 821bd3792d98b05320e472ca49c0eec9f3366a95 | <|skeleton|>
class Solution:
def maxPathSum(self, root):
""":type root: TreeNode :rtype: int"""
<|body_0|>
def _maxPathSum(self, root):
""":rtype: (int, int) <= (canConcat, cannotConcat)"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def maxPathSum(self, root):
""":type root: TreeNode :rtype: int"""
if root is None:
return 0
return max(self._maxPathSum(root))
def _maxPathSum(self, root):
""":rtype: (int, int) <= (canConcat, cannotConcat)"""
if root is None:
ret... | the_stack_v2_python_sparse | 124.py | sycLin/LeetCode-Solutions | train | 0 | |
f7438088a05c367827876095eefac71f75b3e724 | [
"simple = self.get_argument('simple', default='false')\nsimple = simple == 'true'\nself.set_header('content-type', 'application/json')\ntry:\n result = EventModelDefaultDao().get_model_by_app_name(app, name)\n if result:\n if simple:\n self.finish(json_dumps({'status': 0, 'msg': 'ok', 'value... | <|body_start_0|>
simple = self.get_argument('simple', default='false')
simple = simple == 'true'
self.set_header('content-type', 'application/json')
try:
result = EventModelDefaultDao().get_model_by_app_name(app, name)
if result:
if simple:
... | 对某个特定的event进行操作 | EventQueryHandler | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EventQueryHandler:
"""对某个特定的event进行操作"""
def get(self, app, name):
"""获取一个特定的event @API summary: 获取一个特定的event notes: 根据app和name准确的定位一个event tags: - default parameters: - name: app in: path required: true type: string description: event的app - name: name in: path required: true type: s... | stack_v2_sparse_classes_36k_train_018376 | 8,714 | permissive | [
{
"docstring": "获取一个特定的event @API summary: 获取一个特定的event notes: 根据app和name准确的定位一个event tags: - default parameters: - name: app in: path required: true type: string description: event的app - name: name in: path required: true type: string description: event的名称 - name: simple in: query required: false type: boolean... | 3 | stack_v2_sparse_classes_30k_train_017075 | Implement the Python class `EventQueryHandler` described below.
Class description:
对某个特定的event进行操作
Method signatures and docstrings:
- def get(self, app, name): 获取一个特定的event @API summary: 获取一个特定的event notes: 根据app和name准确的定位一个event tags: - default parameters: - name: app in: path required: true type: string descriptio... | Implement the Python class `EventQueryHandler` described below.
Class description:
对某个特定的event进行操作
Method signatures and docstrings:
- def get(self, app, name): 获取一个特定的event @API summary: 获取一个特定的event notes: 根据app和name准确的定位一个event tags: - default parameters: - name: app in: path required: true type: string descriptio... | 2e32e6e7b225e0bd87ee8c847c22862f12c51bb1 | <|skeleton|>
class EventQueryHandler:
"""对某个特定的event进行操作"""
def get(self, app, name):
"""获取一个特定的event @API summary: 获取一个特定的event notes: 根据app和name准确的定位一个event tags: - default parameters: - name: app in: path required: true type: string description: event的app - name: name in: path required: true type: s... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class EventQueryHandler:
"""对某个特定的event进行操作"""
def get(self, app, name):
"""获取一个特定的event @API summary: 获取一个特定的event notes: 根据app和name准确的定位一个event tags: - default parameters: - name: app in: path required: true type: string description: event的app - name: name in: path required: true type: string descrip... | the_stack_v2_python_sparse | nebula/views/event_model_default.py | threathunterX/nebula_web | train | 2 |
192104c1630bf16a017743a7269bf8f5888ac02d | [
"if instance.channel:\n return instance.channel.name\nelse:\n return None",
"if instance.channel:\n return instance.channel.title\nelse:\n return None"
] | <|body_start_0|>
if instance.channel:
return instance.channel.name
else:
return None
<|end_body_0|>
<|body_start_1|>
if instance.channel:
return instance.channel.title
else:
return None
<|end_body_1|>
| Serializer for NotificationSettings | NotificationSettingsSerializer | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NotificationSettingsSerializer:
"""Serializer for NotificationSettings"""
def get_channel_name(self, instance):
"""get the channel name"""
<|body_0|>
def get_channel_title(self, instance):
"""get the channel title"""
<|body_1|>
<|end_skeleton|>
<|body_s... | stack_v2_sparse_classes_36k_train_018377 | 1,015 | permissive | [
{
"docstring": "get the channel name",
"name": "get_channel_name",
"signature": "def get_channel_name(self, instance)"
},
{
"docstring": "get the channel title",
"name": "get_channel_title",
"signature": "def get_channel_title(self, instance)"
}
] | 2 | stack_v2_sparse_classes_30k_train_007166 | Implement the Python class `NotificationSettingsSerializer` described below.
Class description:
Serializer for NotificationSettings
Method signatures and docstrings:
- def get_channel_name(self, instance): get the channel name
- def get_channel_title(self, instance): get the channel title | Implement the Python class `NotificationSettingsSerializer` described below.
Class description:
Serializer for NotificationSettings
Method signatures and docstrings:
- def get_channel_name(self, instance): get the channel name
- def get_channel_title(self, instance): get the channel title
<|skeleton|>
class Notifica... | ba7442482da97d463302658c0aac989567ee1241 | <|skeleton|>
class NotificationSettingsSerializer:
"""Serializer for NotificationSettings"""
def get_channel_name(self, instance):
"""get the channel name"""
<|body_0|>
def get_channel_title(self, instance):
"""get the channel title"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NotificationSettingsSerializer:
"""Serializer for NotificationSettings"""
def get_channel_name(self, instance):
"""get the channel name"""
if instance.channel:
return instance.channel.name
else:
return None
def get_channel_title(self, instance):
... | the_stack_v2_python_sparse | notifications/serializers.py | mitodl/open-discussions | train | 13 |
2fd2b11610593a620835f61e1e2020d9d1452da1 | [
"self.visitor = visitor\nself.send_notification_func = send_notification_func\nself.telemetry_enabled = telemetry_enabled\nself.request = request\nself.request_id = request.request_id\nself.prev_event_keys = set()\nself.notifications = []\nself.telemetry_entries = []\nself.logger = get_logger()",
"display_tokens ... | <|body_start_0|>
self.visitor = visitor
self.send_notification_func = send_notification_func
self.telemetry_enabled = telemetry_enabled
self.request = request
self.request_id = request.request_id
self.prev_event_keys = set()
self.notifications = []
self.te... | NotificationProvider | NotificationProvider | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NotificationProvider:
"""NotificationProvider"""
def __init__(self, request, visitor, send_notification_func=noop, telemetry_enabled=True):
""":param request: (delivery_api_client.Model.delivery_request.DeliveryRequest) request :param visitor: (delivery_api_client.Model.visitor_id.Vi... | stack_v2_sparse_classes_36k_train_018378 | 4,940 | permissive | [
{
"docstring": ":param request: (delivery_api_client.Model.delivery_request.DeliveryRequest) request :param visitor: (delivery_api_client.Model.visitor_id.VisitorId) VisitorId instance :param send_notification_func: (callable) function used to send the notification :param telemetry_enabled: (bool) is telemetry ... | 4 | stack_v2_sparse_classes_30k_train_016695 | Implement the Python class `NotificationProvider` described below.
Class description:
NotificationProvider
Method signatures and docstrings:
- def __init__(self, request, visitor, send_notification_func=noop, telemetry_enabled=True): :param request: (delivery_api_client.Model.delivery_request.DeliveryRequest) request... | Implement the Python class `NotificationProvider` described below.
Class description:
NotificationProvider
Method signatures and docstrings:
- def __init__(self, request, visitor, send_notification_func=noop, telemetry_enabled=True): :param request: (delivery_api_client.Model.delivery_request.DeliveryRequest) request... | f3e9b1bb6c8e1984e3d758ab1fe1a71225ade13e | <|skeleton|>
class NotificationProvider:
"""NotificationProvider"""
def __init__(self, request, visitor, send_notification_func=noop, telemetry_enabled=True):
""":param request: (delivery_api_client.Model.delivery_request.DeliveryRequest) request :param visitor: (delivery_api_client.Model.visitor_id.Vi... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NotificationProvider:
"""NotificationProvider"""
def __init__(self, request, visitor, send_notification_func=noop, telemetry_enabled=True):
""":param request: (delivery_api_client.Model.delivery_request.DeliveryRequest) request :param visitor: (delivery_api_client.Model.visitor_id.VisitorId) Visi... | the_stack_v2_python_sparse | target_decisioning_engine/notification_provider.py | 5amfung/target-python-sdk | train | 0 |
6e6f8ebedb95047e4185c9151a8164037576e6e3 | [
"if which_challenge not in ('singlecoil', 'multicoil'):\n raise ValueError(f'Challenge should either be \"singlecoil\" or \"multicoil\"')\nself.mask_func = mask_func\nself.resolution = resolution\nself.which_challenge = which_challenge\nself.use_seed = use_seed",
"kspace = T.to_tensor(kspace)\nif self.mask_fun... | <|body_start_0|>
if which_challenge not in ('singlecoil', 'multicoil'):
raise ValueError(f'Challenge should either be "singlecoil" or "multicoil"')
self.mask_func = mask_func
self.resolution = resolution
self.which_challenge = which_challenge
self.use_seed = use_seed
... | Data Transformer for training U-Net models. | DataTransform | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DataTransform:
"""Data Transformer for training U-Net models."""
def __init__(self, resolution, which_challenge, mask_func=None, use_seed=True):
"""Args: mask_func (common.subsample.MaskFunc): A function that can create a mask of appropriate shape. resolution (int): Resolution of the... | stack_v2_sparse_classes_36k_train_018379 | 8,049 | no_license | [
{
"docstring": "Args: mask_func (common.subsample.MaskFunc): A function that can create a mask of appropriate shape. resolution (int): Resolution of the image. which_challenge (str): Either \"singlecoil\" or \"multicoil\" denoting the dataset. use_seed (bool): If true, this class computes a pseudo random number... | 2 | null | Implement the Python class `DataTransform` described below.
Class description:
Data Transformer for training U-Net models.
Method signatures and docstrings:
- def __init__(self, resolution, which_challenge, mask_func=None, use_seed=True): Args: mask_func (common.subsample.MaskFunc): A function that can create a mask ... | Implement the Python class `DataTransform` described below.
Class description:
Data Transformer for training U-Net models.
Method signatures and docstrings:
- def __init__(self, resolution, which_challenge, mask_func=None, use_seed=True): Args: mask_func (common.subsample.MaskFunc): A function that can create a mask ... | 219652c8a08c4f2f682acd9f95a4e1b3fd36b70b | <|skeleton|>
class DataTransform:
"""Data Transformer for training U-Net models."""
def __init__(self, resolution, which_challenge, mask_func=None, use_seed=True):
"""Args: mask_func (common.subsample.MaskFunc): A function that can create a mask of appropriate shape. resolution (int): Resolution of the... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DataTransform:
"""Data Transformer for training U-Net models."""
def __init__(self, resolution, which_challenge, mask_func=None, use_seed=True):
"""Args: mask_func (common.subsample.MaskFunc): A function that can create a mask of appropriate shape. resolution (int): Resolution of the image. which... | the_stack_v2_python_sparse | dc_rsn_fastmri/valid.py | Bala93/Holistic-MRI-Reconstruction | train | 1 |
f82947bc023f4aae3bcad3d53d8bf056b0f8ecbb | [
"self.max_window_size = self.countdown = None\nself.read_batch_num = self.hist_len = 0\nself.g = self.G_CLASS()\nself.window_record = list()",
"self.max_window_size = max_window_size\nself.countdown = Countdown(full_interval)\nself.g.set_hyperparams(alpha, beta)",
"window_record = self.window_record\ncur_tw_num... | <|body_start_0|>
self.max_window_size = self.countdown = None
self.read_batch_num = self.hist_len = 0
self.g = self.G_CLASS()
self.window_record = list()
<|end_body_0|>
<|body_start_1|>
self.max_window_size = max_window_size
self.countdown = Countdown(full_interval)
... | BackCluster | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BackCluster:
def __init__(self):
"""聚类器包装对象,负责记录窗口、根据记录值调用不同聚类过程、返回聚类结果"""
<|body_0|>
def set_parameters(self, max_window_size, full_interval, alpha, beta):
"""设置参数,部分参数用于调整窗口大小以及batch大小,另一部分则用于调整概率表达式的先验参数 :param max_window_size: int,记录窗的窗口大小;相邻记录点之间的时间间隔由外部调用者确定 :p... | stack_v2_sparse_classes_36k_train_018380 | 17,085 | no_license | [
{
"docstring": "聚类器包装对象,负责记录窗口、根据记录值调用不同聚类过程、返回聚类结果",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "设置参数,部分参数用于调整窗口大小以及batch大小,另一部分则用于调整概率表达式的先验参数 :param max_window_size: int,记录窗的窗口大小;相邻记录点之间的时间间隔由外部调用者确定 :param full_interval: int,进行完全聚类的记录点间隔数 :param alpha: float,概率参数... | 6 | stack_v2_sparse_classes_30k_train_018671 | Implement the Python class `BackCluster` described below.
Class description:
Implement the BackCluster class.
Method signatures and docstrings:
- def __init__(self): 聚类器包装对象,负责记录窗口、根据记录值调用不同聚类过程、返回聚类结果
- def set_parameters(self, max_window_size, full_interval, alpha, beta): 设置参数,部分参数用于调整窗口大小以及batch大小,另一部分则用于调整概率表达式的先... | Implement the Python class `BackCluster` described below.
Class description:
Implement the BackCluster class.
Method signatures and docstrings:
- def __init__(self): 聚类器包装对象,负责记录窗口、根据记录值调用不同聚类过程、返回聚类结果
- def set_parameters(self, max_window_size, full_interval, alpha, beta): 设置参数,部分参数用于调整窗口大小以及batch大小,另一部分则用于调整概率表达式的先... | 8a9725fc9f3f2e28f52dfd02bb1fb68601612519 | <|skeleton|>
class BackCluster:
def __init__(self):
"""聚类器包装对象,负责记录窗口、根据记录值调用不同聚类过程、返回聚类结果"""
<|body_0|>
def set_parameters(self, max_window_size, full_interval, alpha, beta):
"""设置参数,部分参数用于调整窗口大小以及batch大小,另一部分则用于调整概率表达式的先验参数 :param max_window_size: int,记录窗的窗口大小;相邻记录点之间的时间间隔由外部调用者确定 :p... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BackCluster:
def __init__(self):
"""聚类器包装对象,负责记录窗口、根据记录值调用不同聚类过程、返回聚类结果"""
self.max_window_size = self.countdown = None
self.read_batch_num = self.hist_len = 0
self.g = self.G_CLASS()
self.window_record = list()
def set_parameters(self, max_window_size, full_interv... | the_stack_v2_python_sparse | calling/back_cluster.py | leeyanghaha/my_merge | train | 0 | |
2961fdc7a2391ad590457dfa8068c0f763d96bec | [
"if gain_factor != 1 and gain_factor != 2:\n raise ValueError('DAC __init__: Invalid gain factor. Must be 1 or 2')\nelse:\n self.gain = gain_factor\n self.maxdacvoltage = self.__dacMaxOutput__[self.gain]",
"if channel > 2 or channel < 1:\n raise ValueError('read_adc_voltage... | <|body_start_0|>
if gain_factor != 1 and gain_factor != 2:
raise ValueError('DAC __init__: Invalid gain factor. Must be 1 or 2')
else:
self.gain = gain_factor
self.maxdacvoltage = self.__dacMaxOutput__[self.gain]
<|end_body_0|>
<|body_star... | Based on the Microchip MCP3202 and MCP4822 | ADCDACPi | [
"Apache-2.0",
"GPL-2.0-only"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ADCDACPi:
"""Based on the Microchip MCP3202 and MCP4822"""
def __init__(self, gain_factor=1):
"""Class Constructor gain_factor -- Set the DAC's gain factor. The value should be 1 or 2. Gain factor is used to determine output voltage from the formula: Vout = G * Vref * D/4096 Where G ... | stack_v2_sparse_classes_36k_train_018381 | 5,074 | permissive | [
{
"docstring": "Class Constructor gain_factor -- Set the DAC's gain factor. The value should be 1 or 2. Gain factor is used to determine output voltage from the formula: Vout = G * Vref * D/4096 Where G is gain factor, Vref (for this chip) is 2.048 and D is the 12-bit digital value",
"name": "__init__",
... | 6 | stack_v2_sparse_classes_30k_train_008834 | Implement the Python class `ADCDACPi` described below.
Class description:
Based on the Microchip MCP3202 and MCP4822
Method signatures and docstrings:
- def __init__(self, gain_factor=1): Class Constructor gain_factor -- Set the DAC's gain factor. The value should be 1 or 2. Gain factor is used to determine output vo... | Implement the Python class `ADCDACPi` described below.
Class description:
Based on the Microchip MCP3202 and MCP4822
Method signatures and docstrings:
- def __init__(self, gain_factor=1): Class Constructor gain_factor -- Set the DAC's gain factor. The value should be 1 or 2. Gain factor is used to determine output vo... | 2529ca149d7f584ede780de1cb695a2f55b7031f | <|skeleton|>
class ADCDACPi:
"""Based on the Microchip MCP3202 and MCP4822"""
def __init__(self, gain_factor=1):
"""Class Constructor gain_factor -- Set the DAC's gain factor. The value should be 1 or 2. Gain factor is used to determine output voltage from the formula: Vout = G * Vref * D/4096 Where G ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ADCDACPi:
"""Based on the Microchip MCP3202 and MCP4822"""
def __init__(self, gain_factor=1):
"""Class Constructor gain_factor -- Set the DAC's gain factor. The value should be 1 or 2. Gain factor is used to determine output voltage from the formula: Vout = G * Vref * D/4096 Where G is gain facto... | the_stack_v2_python_sparse | reinvent-2020/RhythmCloud/lib/ABElectronics_Python_Libraries/ADCDACPi/ADCDACPi.py | aws-samples/aws-builders-fair-projects | train | 89 |
ee6475f54db8beec0ada304b22068b11ad606c88 | [
"if ui_test_result_id == '':\n return response_failed({'status': 10102, 'message': 'ui_test_task_id不能为空'})\nui_result = UITestResultAssociated.objects.filter(ui_result_id=ui_test_result_id)\nsingle_case_results = []\nfor single_case in ui_result:\n single_case_dict = {'id': single_case.id, 'ui_test_case_name'... | <|body_start_0|>
if ui_test_result_id == '':
return response_failed({'status': 10102, 'message': 'ui_test_task_id不能为空'})
ui_result = UITestResultAssociated.objects.filter(ui_result_id=ui_test_result_id)
single_case_results = []
for single_case in ui_result:
single... | CheckResult | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CheckResult:
def post(self, request, ui_test_result_id, *args, **kwargs):
"""查看测试报告 :param request: :param ui_test_result_id: :param args: :param kwargs: :return:"""
<|body_0|>
def get(self, request, ui_test_abnormal_result_id, *args, **kwargs):
"""获取异常测试报告 :param re... | stack_v2_sparse_classes_36k_train_018382 | 13,627 | no_license | [
{
"docstring": "查看测试报告 :param request: :param ui_test_result_id: :param args: :param kwargs: :return:",
"name": "post",
"signature": "def post(self, request, ui_test_result_id, *args, **kwargs)"
},
{
"docstring": "获取异常测试报告 :param request: :param ui_test_abnormal_result_id: :param args: :param kw... | 2 | null | Implement the Python class `CheckResult` described below.
Class description:
Implement the CheckResult class.
Method signatures and docstrings:
- def post(self, request, ui_test_result_id, *args, **kwargs): 查看测试报告 :param request: :param ui_test_result_id: :param args: :param kwargs: :return:
- def get(self, request, ... | Implement the Python class `CheckResult` described below.
Class description:
Implement the CheckResult class.
Method signatures and docstrings:
- def post(self, request, ui_test_result_id, *args, **kwargs): 查看测试报告 :param request: :param ui_test_result_id: :param args: :param kwargs: :return:
- def get(self, request, ... | 730bbb7a048e0f41a2fb61c8cdf554bcc2bd042c | <|skeleton|>
class CheckResult:
def post(self, request, ui_test_result_id, *args, **kwargs):
"""查看测试报告 :param request: :param ui_test_result_id: :param args: :param kwargs: :return:"""
<|body_0|>
def get(self, request, ui_test_abnormal_result_id, *args, **kwargs):
"""获取异常测试报告 :param re... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CheckResult:
def post(self, request, ui_test_result_id, *args, **kwargs):
"""查看测试报告 :param request: :param ui_test_result_id: :param args: :param kwargs: :return:"""
if ui_test_result_id == '':
return response_failed({'status': 10102, 'message': 'ui_test_task_id不能为空'})
ui_r... | the_stack_v2_python_sparse | automated_main/view/ui_automation/ui_test_task/ui_test_task_view.py | a877429929/TestPlatformDjango | train | 0 | |
0dc533026f970809324c25b56f47106fedf6ec41 | [
"self.max_parallel_io_full_percentage = max_parallel_io_full_percentage\nself.max_parallel_io_incremental_percentage = max_parallel_io_incremental_percentage\nself.max_parallel_metadata_fetch_full_percentage = max_parallel_metadata_fetch_full_percentage\nself.max_parallel_metadata_fetch_incremental_percentage = max... | <|body_start_0|>
self.max_parallel_io_full_percentage = max_parallel_io_full_percentage
self.max_parallel_io_incremental_percentage = max_parallel_io_incremental_percentage
self.max_parallel_metadata_fetch_full_percentage = max_parallel_metadata_fetch_full_percentage
self.max_parallel_me... | Implementation of the 'NasThrottlingParams' model. Message to capture throttling params for a NAS source. Attributes: max_parallel_io_full_percentage (int): This parameter indicates the maximum number of parallel read and write operations per volume for full backup as a percentage of gflag magneto_slave_nas_max_active_... | NasThrottlingParams | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NasThrottlingParams:
"""Implementation of the 'NasThrottlingParams' model. Message to capture throttling params for a NAS source. Attributes: max_parallel_io_full_percentage (int): This parameter indicates the maximum number of parallel read and write operations per volume for full backup as a pe... | stack_v2_sparse_classes_36k_train_018383 | 3,864 | permissive | [
{
"docstring": "Constructor for the NasThrottlingParams class",
"name": "__init__",
"signature": "def __init__(self, max_parallel_io_full_percentage=None, max_parallel_io_incremental_percentage=None, max_parallel_metadata_fetch_full_percentage=None, max_parallel_metadata_fetch_incremental_percentage=Non... | 2 | null | Implement the Python class `NasThrottlingParams` described below.
Class description:
Implementation of the 'NasThrottlingParams' model. Message to capture throttling params for a NAS source. Attributes: max_parallel_io_full_percentage (int): This parameter indicates the maximum number of parallel read and write operat... | Implement the Python class `NasThrottlingParams` described below.
Class description:
Implementation of the 'NasThrottlingParams' model. Message to capture throttling params for a NAS source. Attributes: max_parallel_io_full_percentage (int): This parameter indicates the maximum number of parallel read and write operat... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class NasThrottlingParams:
"""Implementation of the 'NasThrottlingParams' model. Message to capture throttling params for a NAS source. Attributes: max_parallel_io_full_percentage (int): This parameter indicates the maximum number of parallel read and write operations per volume for full backup as a pe... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NasThrottlingParams:
"""Implementation of the 'NasThrottlingParams' model. Message to capture throttling params for a NAS source. Attributes: max_parallel_io_full_percentage (int): This parameter indicates the maximum number of parallel read and write operations per volume for full backup as a percentage of g... | the_stack_v2_python_sparse | cohesity_management_sdk/models/nas_throttling_params.py | cohesity/management-sdk-python | train | 24 |
fb876e9557fbaf65f78c669c841a09b0fb61fed3 | [
"self.priority_queue = {}\nif isinstance(values, list):\n try:\n for value, priority in values:\n self.insert(value, priority)\n except ValueError:\n raise TypeError('You need to tuplize your priorities')\nelse:\n raise TypeError('Put your items in a list')",
"if not isinstance(p... | <|body_start_0|>
self.priority_queue = {}
if isinstance(values, list):
try:
for value, priority in values:
self.insert(value, priority)
except ValueError:
raise TypeError('You need to tuplize your priorities')
else:
... | Defines a priority queue. | Priority | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Priority:
"""Defines a priority queue."""
def __init__(self, values=[]):
"""Initalize the queue chain."""
<|body_0|>
def insert(self, value, priority=2):
"""Insert value into Priority Queue based on Priority."""
<|body_1|>
def pop(self):
"""T... | stack_v2_sparse_classes_36k_train_018384 | 1,801 | no_license | [
{
"docstring": "Initalize the queue chain.",
"name": "__init__",
"signature": "def __init__(self, values=[])"
},
{
"docstring": "Insert value into Priority Queue based on Priority.",
"name": "insert",
"signature": "def insert(self, value, priority=2)"
},
{
"docstring": "The the n... | 4 | stack_v2_sparse_classes_30k_train_000362 | Implement the Python class `Priority` described below.
Class description:
Defines a priority queue.
Method signatures and docstrings:
- def __init__(self, values=[]): Initalize the queue chain.
- def insert(self, value, priority=2): Insert value into Priority Queue based on Priority.
- def pop(self): The the next ite... | Implement the Python class `Priority` described below.
Class description:
Defines a priority queue.
Method signatures and docstrings:
- def __init__(self, values=[]): Initalize the queue chain.
- def insert(self, value, priority=2): Insert value into Priority Queue based on Priority.
- def pop(self): The the next ite... | f407fcd0d8cfcd5c7685616137377b3050932b5b | <|skeleton|>
class Priority:
"""Defines a priority queue."""
def __init__(self, values=[]):
"""Initalize the queue chain."""
<|body_0|>
def insert(self, value, priority=2):
"""Insert value into Priority Queue based on Priority."""
<|body_1|>
def pop(self):
"""T... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Priority:
"""Defines a priority queue."""
def __init__(self, values=[]):
"""Initalize the queue chain."""
self.priority_queue = {}
if isinstance(values, list):
try:
for value, priority in values:
self.insert(value, priority)
... | the_stack_v2_python_sparse | src/priority.py | scotist/data-structures | train | 1 |
6c25e85abf04416315bcf1aa38a3fa3dbcfb562c | [
"message_dictionary = copy.deepcopy(message_dictionary)\nmessage_dictionary[ebxml_envelope.ACTION] = 'Acknowledgment'\nsuper().__init__(EBXML_TEMPLATE, message_dictionary)",
"message_dictionary = super().parse_message(ElementTree.fromstring(message))\nmessage_dictionary[common_ack_envelope.RECEIVED_MESSAGE_TIMEST... | <|body_start_0|>
message_dictionary = copy.deepcopy(message_dictionary)
message_dictionary[ebxml_envelope.ACTION] = 'Acknowledgment'
super().__init__(EBXML_TEMPLATE, message_dictionary)
<|end_body_0|>
<|body_start_1|>
message_dictionary = super().parse_message(ElementTree.fromstring(mes... | An envelope that contains an acknowledgement of an asynchronous request from a remote MHS. | EbxmlAckEnvelope | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EbxmlAckEnvelope:
"""An envelope that contains an acknowledgement of an asynchronous request from a remote MHS."""
def __init__(self, message_dictionary: Dict[str, str]):
"""Create a new EbxmlAckEnvelope that populates the message with the provided dictionary. :param message_dictiona... | stack_v2_sparse_classes_36k_train_018385 | 1,741 | permissive | [
{
"docstring": "Create a new EbxmlAckEnvelope that populates the message with the provided dictionary. :param message_dictionary: The dictionary of values to use when populating the template.",
"name": "__init__",
"signature": "def __init__(self, message_dictionary: Dict[str, str])"
},
{
"docstr... | 2 | null | Implement the Python class `EbxmlAckEnvelope` described below.
Class description:
An envelope that contains an acknowledgement of an asynchronous request from a remote MHS.
Method signatures and docstrings:
- def __init__(self, message_dictionary: Dict[str, str]): Create a new EbxmlAckEnvelope that populates the mess... | Implement the Python class `EbxmlAckEnvelope` described below.
Class description:
An envelope that contains an acknowledgement of an asynchronous request from a remote MHS.
Method signatures and docstrings:
- def __init__(self, message_dictionary: Dict[str, str]): Create a new EbxmlAckEnvelope that populates the mess... | 8420d9d4b800223bff6a648015679684f5aba38c | <|skeleton|>
class EbxmlAckEnvelope:
"""An envelope that contains an acknowledgement of an asynchronous request from a remote MHS."""
def __init__(self, message_dictionary: Dict[str, str]):
"""Create a new EbxmlAckEnvelope that populates the message with the provided dictionary. :param message_dictiona... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class EbxmlAckEnvelope:
"""An envelope that contains an acknowledgement of an asynchronous request from a remote MHS."""
def __init__(self, message_dictionary: Dict[str, str]):
"""Create a new EbxmlAckEnvelope that populates the message with the provided dictionary. :param message_dictionary: The dicti... | the_stack_v2_python_sparse | mhs/common/mhs_common/messages/ebxml_ack_envelope.py | nhsconnect/integration-adaptors | train | 15 |
825fbe1cc14966b7c0aa70dede42bbe64a5980bd | [
"def attrs_str(attrs):\n return ', '.join([f'{k}: {v!r}' for k, v in attrs.items()])\n\ndef enum_val(obj, attr):\n value = getattr(obj, attr, None)\n return value.value if hasattr(value, 'value') else value\nname = field['name_qual']\nftype = field['type']\nfformat = field.get('format')\nitems = field.get(... | <|body_start_0|>
def attrs_str(attrs):
return ', '.join([f'{k}: {v!r}' for k, v in attrs.items()])
def enum_val(obj, attr):
value = getattr(obj, attr, None)
return value.value if hasattr(value, 'value') else value
name = field['name_qual']
ftype = fie... | Operator type map that maps operators to a specific field schemas. | OperatorTypeMaps | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OperatorTypeMaps:
"""Operator type map that maps operators to a specific field schemas."""
def get_type_map(cls, field: dict) -> OperatorTypeMap:
"""Get the type mapping for a field."""
<|body_0|>
def get_operator(cls, field: dict, operator: str, err: t.Optional[str]=Non... | stack_v2_sparse_classes_36k_train_018386 | 38,018 | permissive | [
{
"docstring": "Get the type mapping for a field.",
"name": "get_type_map",
"signature": "def get_type_map(cls, field: dict) -> OperatorTypeMap"
},
{
"docstring": "Get an operator for a specific field.",
"name": "get_operator",
"signature": "def get_operator(cls, field: dict, operator: s... | 2 | null | Implement the Python class `OperatorTypeMaps` described below.
Class description:
Operator type map that maps operators to a specific field schemas.
Method signatures and docstrings:
- def get_type_map(cls, field: dict) -> OperatorTypeMap: Get the type mapping for a field.
- def get_operator(cls, field: dict, operato... | Implement the Python class `OperatorTypeMaps` described below.
Class description:
Operator type map that maps operators to a specific field schemas.
Method signatures and docstrings:
- def get_type_map(cls, field: dict) -> OperatorTypeMap: Get the type mapping for a field.
- def get_operator(cls, field: dict, operato... | be49566e590834df1b46494c8588651fa029b8c5 | <|skeleton|>
class OperatorTypeMaps:
"""Operator type map that maps operators to a specific field schemas."""
def get_type_map(cls, field: dict) -> OperatorTypeMap:
"""Get the type mapping for a field."""
<|body_0|>
def get_operator(cls, field: dict, operator: str, err: t.Optional[str]=Non... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class OperatorTypeMaps:
"""Operator type map that maps operators to a specific field schemas."""
def get_type_map(cls, field: dict) -> OperatorTypeMap:
"""Get the type mapping for a field."""
def attrs_str(attrs):
return ', '.join([f'{k}: {v!r}' for k, v in attrs.items()])
... | the_stack_v2_python_sparse | axonius_api_client/constants/fields.py | Axonius/axonius_api_client | train | 17 |
bd85a80921796904379257ce4941bb8f71f2e795 | [
"artifact_s3_url = upload_local_artifacts(self.RESOURCE_TYPE, resource_id, resource_dict, self.PROPERTY_NAME, parent_dir, self.uploader)\nparsed_url = parse_s3_url(artifact_s3_url, bucket_name_property=self.BUCKET_NAME_PROPERTY, object_key_property=self.OBJECT_KEY_PROPERTY, version_property=self.VERSION_PROPERTY)\n... | <|body_start_0|>
artifact_s3_url = upload_local_artifacts(self.RESOURCE_TYPE, resource_id, resource_dict, self.PROPERTY_NAME, parent_dir, self.uploader)
parsed_url = parse_s3_url(artifact_s3_url, bucket_name_property=self.BUCKET_NAME_PROPERTY, object_key_property=self.OBJECT_KEY_PROPERTY, version_proper... | Represents CloudFormation resources that need the S3 URL to be specified as an dict like {Bucket: "", Key: "", Version: ""} | ResourceWithS3UrlDict | [
"Apache-2.0",
"BSD-3-Clause",
"MIT",
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ResourceWithS3UrlDict:
"""Represents CloudFormation resources that need the S3 URL to be specified as an dict like {Bucket: "", Key: "", Version: ""}"""
def do_export(self, resource_id, resource_dict, parent_dir):
"""Upload to S3 and set property to an dict representing the S3 url of... | stack_v2_sparse_classes_36k_train_018387 | 27,114 | permissive | [
{
"docstring": "Upload to S3 and set property to an dict representing the S3 url of the uploaded object",
"name": "do_export",
"signature": "def do_export(self, resource_id, resource_dict, parent_dir)"
},
{
"docstring": "Delete the S3 artifact using S3 url in the dict PROPERTY_NAME using the buc... | 3 | null | Implement the Python class `ResourceWithS3UrlDict` described below.
Class description:
Represents CloudFormation resources that need the S3 URL to be specified as an dict like {Bucket: "", Key: "", Version: ""}
Method signatures and docstrings:
- def do_export(self, resource_id, resource_dict, parent_dir): Upload to ... | Implement the Python class `ResourceWithS3UrlDict` described below.
Class description:
Represents CloudFormation resources that need the S3 URL to be specified as an dict like {Bucket: "", Key: "", Version: ""}
Method signatures and docstrings:
- def do_export(self, resource_id, resource_dict, parent_dir): Upload to ... | b297ff015f2b69d7c74059c2d42ece1c29ea73ee | <|skeleton|>
class ResourceWithS3UrlDict:
"""Represents CloudFormation resources that need the S3 URL to be specified as an dict like {Bucket: "", Key: "", Version: ""}"""
def do_export(self, resource_id, resource_dict, parent_dir):
"""Upload to S3 and set property to an dict representing the S3 url of... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ResourceWithS3UrlDict:
"""Represents CloudFormation resources that need the S3 URL to be specified as an dict like {Bucket: "", Key: "", Version: ""}"""
def do_export(self, resource_id, resource_dict, parent_dir):
"""Upload to S3 and set property to an dict representing the S3 url of the uploaded... | the_stack_v2_python_sparse | samcli/lib/package/packageable_resources.py | aws/aws-sam-cli | train | 1,402 |
9792d99b734927d3d3597c5682b97653fe389210 | [
"if len(s) == 0:\n return 0\ni, j, ans, length, pre_set = (0, 0, 0, len(s), set(s[0]))\nfor i in range(length):\n while j + 1 < length and s[j + 1] not in pre_set:\n pre_set.add(s[j + 1])\n j += 1\n ans = max(ans, len(pre_set))\n pre_set.remove(s[i])\n if j == length:\n break\nre... | <|body_start_0|>
if len(s) == 0:
return 0
i, j, ans, length, pre_set = (0, 0, 0, len(s), set(s[0]))
for i in range(length):
while j + 1 < length and s[j + 1] not in pre_set:
pre_set.add(s[j + 1])
j += 1
ans = max(ans, len(pre_se... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def lengthOfLongestSubstring(self, s):
""":type s: str :rtype: int"""
<|body_0|>
def lengthOfLongestSubstring(self, s):
""":type s: str :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if len(s) == 0:
return 0
... | stack_v2_sparse_classes_36k_train_018388 | 1,123 | no_license | [
{
"docstring": ":type s: str :rtype: int",
"name": "lengthOfLongestSubstring",
"signature": "def lengthOfLongestSubstring(self, s)"
},
{
"docstring": ":type s: str :rtype: int",
"name": "lengthOfLongestSubstring",
"signature": "def lengthOfLongestSubstring(self, s)"
}
] | 2 | stack_v2_sparse_classes_30k_train_006339 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lengthOfLongestSubstring(self, s): :type s: str :rtype: int
- def lengthOfLongestSubstring(self, s): :type s: str :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lengthOfLongestSubstring(self, s): :type s: str :rtype: int
- def lengthOfLongestSubstring(self, s): :type s: str :rtype: int
<|skeleton|>
class Solution:
def lengthOfL... | c162817f717b78997197649c084c27af48c3fd6f | <|skeleton|>
class Solution:
def lengthOfLongestSubstring(self, s):
""":type s: str :rtype: int"""
<|body_0|>
def lengthOfLongestSubstring(self, s):
""":type s: str :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def lengthOfLongestSubstring(self, s):
""":type s: str :rtype: int"""
if len(s) == 0:
return 0
i, j, ans, length, pre_set = (0, 0, 0, len(s), set(s[0]))
for i in range(length):
while j + 1 < length and s[j + 1] not in pre_set:
p... | the_stack_v2_python_sparse | Week_09/3.无重复字符的最长子串.py | dream201188/algorithm017 | train | 1 | |
9cfe8492b1abf394a3216da1b77530ed63430c06 | [
"if cap <= 0:\n raise Exception('cap should be greater than zero')\nself.buf = [(None, None)] * cap\nself.size = 0",
"i = 0\navailable_idx = None\nwhile True:\n item = self.buf[(key + i) % len(self.buf)]\n if item[0] == key:\n self.buf[(key + i) % len(self.buf)] = (key, value)\n return\n ... | <|body_start_0|>
if cap <= 0:
raise Exception('cap should be greater than zero')
self.buf = [(None, None)] * cap
self.size = 0
<|end_body_0|>
<|body_start_1|>
i = 0
available_idx = None
while True:
item = self.buf[(key + i) % len(self.buf)]
... | Hash Map implementation by open addressing Only accept key value pair of int | HashMap | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HashMap:
"""Hash Map implementation by open addressing Only accept key value pair of int"""
def __init__(self, cap=10000):
"""Init a HashMap with buf - a list of pairs Possible pair in the buf: (None, None) -- empty (key, None) -- deleted, can be occupied by keys in the same cluster ... | stack_v2_sparse_classes_36k_train_018389 | 2,576 | no_license | [
{
"docstring": "Init a HashMap with buf - a list of pairs Possible pair in the buf: (None, None) -- empty (key, None) -- deleted, can be occupied by keys in the same cluster the deleted key was in (key, num value) -- existing key-value pair cap: int",
"name": "__init__",
"signature": "def __init__(self,... | 5 | stack_v2_sparse_classes_30k_train_010861 | Implement the Python class `HashMap` described below.
Class description:
Hash Map implementation by open addressing Only accept key value pair of int
Method signatures and docstrings:
- def __init__(self, cap=10000): Init a HashMap with buf - a list of pairs Possible pair in the buf: (None, None) -- empty (key, None)... | Implement the Python class `HashMap` described below.
Class description:
Hash Map implementation by open addressing Only accept key value pair of int
Method signatures and docstrings:
- def __init__(self, cap=10000): Init a HashMap with buf - a list of pairs Possible pair in the buf: (None, None) -- empty (key, None)... | bfd16678f179bbfc7564bfc079d2fa4b3e554be6 | <|skeleton|>
class HashMap:
"""Hash Map implementation by open addressing Only accept key value pair of int"""
def __init__(self, cap=10000):
"""Init a HashMap with buf - a list of pairs Possible pair in the buf: (None, None) -- empty (key, None) -- deleted, can be occupied by keys in the same cluster ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class HashMap:
"""Hash Map implementation by open addressing Only accept key value pair of int"""
def __init__(self, cap=10000):
"""Init a HashMap with buf - a list of pairs Possible pair in the buf: (None, None) -- empty (key, None) -- deleted, can be occupied by keys in the same cluster the deleted k... | the_stack_v2_python_sparse | Design/design-hashmap.py | HeliWang/upstream | train | 0 |
78739785ad20232f55c146a0882c8bc824e65caf | [
"try:\n con, meta = self.connect('postgres', 'tunnel', 'scraper')\n spider.log(u'Successfully connected sqlalchemy to postgres.')\nexcept:\n spider.log(u\"Couldn't connect sqlalchemy to postgres.\")\n return item\nqueries = meta.tables['finder_query']\nquery = queries.select().where(queries.c.query == i... | <|body_start_0|>
try:
con, meta = self.connect('postgres', 'tunnel', 'scraper')
spider.log(u'Successfully connected sqlalchemy to postgres.')
except:
spider.log(u"Couldn't connect sqlalchemy to postgres.")
return item
queries = meta.tables['finder_... | LinksFinderPipeline | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LinksFinderPipeline:
def process_item(self, item, spider):
"""Provides an connection to sqlite DB and writing information-parse. :param: item: dicts of Item objects after parsing; spider: object of spider which is writing now; :return: an iterable of Item objects dicts."""
<|body... | stack_v2_sparse_classes_36k_train_018390 | 3,207 | no_license | [
{
"docstring": "Provides an connection to sqlite DB and writing information-parse. :param: item: dicts of Item objects after parsing; spider: object of spider which is writing now; :return: an iterable of Item objects dicts.",
"name": "process_item",
"signature": "def process_item(self, item, spider)"
... | 3 | stack_v2_sparse_classes_30k_train_011550 | Implement the Python class `LinksFinderPipeline` described below.
Class description:
Implement the LinksFinderPipeline class.
Method signatures and docstrings:
- def process_item(self, item, spider): Provides an connection to sqlite DB and writing information-parse. :param: item: dicts of Item objects after parsing; ... | Implement the Python class `LinksFinderPipeline` described below.
Class description:
Implement the LinksFinderPipeline class.
Method signatures and docstrings:
- def process_item(self, item, spider): Provides an connection to sqlite DB and writing information-parse. :param: item: dicts of Item objects after parsing; ... | 9752262f16a1ad2a21b7bac164ec4a3d01f5eba4 | <|skeleton|>
class LinksFinderPipeline:
def process_item(self, item, spider):
"""Provides an connection to sqlite DB and writing information-parse. :param: item: dicts of Item objects after parsing; spider: object of spider which is writing now; :return: an iterable of Item objects dicts."""
<|body... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LinksFinderPipeline:
def process_item(self, item, spider):
"""Provides an connection to sqlite DB and writing information-parse. :param: item: dicts of Item objects after parsing; spider: object of spider which is writing now; :return: an iterable of Item objects dicts."""
try:
con... | the_stack_v2_python_sparse | scrapy_part/links_finder/pipelines.py | DimaBooka/LittleBetter | train | 0 | |
e7876d85ebcfed1498b3bb600e2db130b381b820 | [
"super(ExpandModule, self).__init__()\nself.conv_1x1 = torch.nn.Sequential(torch.nn.Conv2d(in_channels=in_channels, out_channels=out_channels, kernel_size=1, stride=1), torch.nn.ELU(inplace=True))\nself.conv_3x3 = torch.nn.Sequential(torch.nn.Conv2d(in_channels=in_channels, out_channels=out_channels, kernel_size=3,... | <|body_start_0|>
super(ExpandModule, self).__init__()
self.conv_1x1 = torch.nn.Sequential(torch.nn.Conv2d(in_channels=in_channels, out_channels=out_channels, kernel_size=1, stride=1), torch.nn.ELU(inplace=True))
self.conv_3x3 = torch.nn.Sequential(torch.nn.Conv2d(in_channels=in_channels, out_cha... | This class defines the ExpandModule where the 1x1 and 3x3 convolution is implemented. | ExpandModule | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ExpandModule:
"""This class defines the ExpandModule where the 1x1 and 3x3 convolution is implemented."""
def __init__(self, in_channels, out_channels):
"""This constructor is responsible for defining the layers in the ExpandModule."""
<|body_0|>
def forward(self, x):
... | stack_v2_sparse_classes_36k_train_018391 | 4,969 | no_license | [
{
"docstring": "This constructor is responsible for defining the layers in the ExpandModule.",
"name": "__init__",
"signature": "def __init__(self, in_channels, out_channels)"
},
{
"docstring": "The forward function for the ExpandModule :param x: input data",
"name": "forward",
"signatur... | 2 | stack_v2_sparse_classes_30k_train_002220 | Implement the Python class `ExpandModule` described below.
Class description:
This class defines the ExpandModule where the 1x1 and 3x3 convolution is implemented.
Method signatures and docstrings:
- def __init__(self, in_channels, out_channels): This constructor is responsible for defining the layers in the ExpandMo... | Implement the Python class `ExpandModule` described below.
Class description:
This class defines the ExpandModule where the 1x1 and 3x3 convolution is implemented.
Method signatures and docstrings:
- def __init__(self, in_channels, out_channels): This constructor is responsible for defining the layers in the ExpandMo... | e5560febfbf0f6e2d275f1147576d43411b1f182 | <|skeleton|>
class ExpandModule:
"""This class defines the ExpandModule where the 1x1 and 3x3 convolution is implemented."""
def __init__(self, in_channels, out_channels):
"""This constructor is responsible for defining the layers in the ExpandModule."""
<|body_0|>
def forward(self, x):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ExpandModule:
"""This class defines the ExpandModule where the 1x1 and 3x3 convolution is implemented."""
def __init__(self, in_channels, out_channels):
"""This constructor is responsible for defining the layers in the ExpandModule."""
super(ExpandModule, self).__init__()
self.con... | the_stack_v2_python_sparse | DenseNet/model.py | ldmichel/DeepLearning_MiniProjects | train | 0 |
b7f7f071bafefc7971d4a9146190b6a84d9f2e85 | [
"startTime = datetime.datetime.now()\nclient = dml.pymongo.MongoClient()\nrepo = client.repo\nrepo.authenticate('agoncharova_lmckone', 'agoncharova_lmckone')\nrepo.dropCollection('boston_permits')\nrepo.createCollection('boston_permits')\nurl = 'https://data.boston.gov/api/3/action/datastore_search?resource_id=6ddc... | <|body_start_0|>
startTime = datetime.datetime.now()
client = dml.pymongo.MongoClient()
repo = client.repo
repo.authenticate('agoncharova_lmckone', 'agoncharova_lmckone')
repo.dropCollection('boston_permits')
repo.createCollection('boston_permits')
url = 'https://... | boston_permits | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class boston_permits:
def execute(trial=False):
"""Retrieve Boston Approved Building Permits dataset"""
<|body_0|>
def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None):
"""Create the provenance document describing everything happening in this script.... | stack_v2_sparse_classes_36k_train_018392 | 3,570 | no_license | [
{
"docstring": "Retrieve Boston Approved Building Permits dataset",
"name": "execute",
"signature": "def execute(trial=False)"
},
{
"docstring": "Create the provenance document describing everything happening in this script. Each run of the script will generate a new document describing that inv... | 2 | stack_v2_sparse_classes_30k_train_015710 | Implement the Python class `boston_permits` described below.
Class description:
Implement the boston_permits class.
Method signatures and docstrings:
- def execute(trial=False): Retrieve Boston Approved Building Permits dataset
- def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): Create the ... | Implement the Python class `boston_permits` described below.
Class description:
Implement the boston_permits class.
Method signatures and docstrings:
- def execute(trial=False): Retrieve Boston Approved Building Permits dataset
- def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None): Create the ... | b5ccaad97f6e35f9580e645ca764f36eb3406f43 | <|skeleton|>
class boston_permits:
def execute(trial=False):
"""Retrieve Boston Approved Building Permits dataset"""
<|body_0|>
def provenance(doc=prov.model.ProvDocument(), startTime=None, endTime=None):
"""Create the provenance document describing everything happening in this script.... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class boston_permits:
def execute(trial=False):
"""Retrieve Boston Approved Building Permits dataset"""
startTime = datetime.datetime.now()
client = dml.pymongo.MongoClient()
repo = client.repo
repo.authenticate('agoncharova_lmckone', 'agoncharova_lmckone')
repo.dropC... | the_stack_v2_python_sparse | agoncharova_lmckone/boston_permits.py | dwang1995/course-2018-spr-proj | train | 1 | |
4e839ba3808743ba8c8785079521bbfa02a0e34f | [
"data = {}\nid = request.GET.get('id', None)\ndetailed_requirement_id = request.GET.get('detailed_requirement_id', None)\noffering_course_id = request.GET.get('offering_course_id', None)\nfield_of_study_id = request.GET.get('field_of_study_id', None)\nif id is not None:\n data['id'] = id\nif detailed_requirement... | <|body_start_0|>
data = {}
id = request.GET.get('id', None)
detailed_requirement_id = request.GET.get('detailed_requirement_id', None)
offering_course_id = request.GET.get('offering_course_id', None)
field_of_study_id = request.GET.get('field_of_study_id', None)
if id is ... | 支撑课程view | IndicatorFactors | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class IndicatorFactors:
"""支撑课程view"""
def get(self, request):
"""查询支撑课程"""
<|body_0|>
def put(self, request):
"""修改支撑课程"""
<|body_1|>
def post(self, request):
"""增加支撑课程"""
<|body_2|>
def delete(self, request):
"""删除支撑课程"""
... | stack_v2_sparse_classes_36k_train_018393 | 15,061 | permissive | [
{
"docstring": "查询支撑课程",
"name": "get",
"signature": "def get(self, request)"
},
{
"docstring": "修改支撑课程",
"name": "put",
"signature": "def put(self, request)"
},
{
"docstring": "增加支撑课程",
"name": "post",
"signature": "def post(self, request)"
},
{
"docstring": "删除支... | 4 | stack_v2_sparse_classes_30k_train_001327 | Implement the Python class `IndicatorFactors` described below.
Class description:
支撑课程view
Method signatures and docstrings:
- def get(self, request): 查询支撑课程
- def put(self, request): 修改支撑课程
- def post(self, request): 增加支撑课程
- def delete(self, request): 删除支撑课程 | Implement the Python class `IndicatorFactors` described below.
Class description:
支撑课程view
Method signatures and docstrings:
- def get(self, request): 查询支撑课程
- def put(self, request): 修改支撑课程
- def post(self, request): 增加支撑课程
- def delete(self, request): 删除支撑课程
<|skeleton|>
class IndicatorFactors:
"""支撑课程view"""
... | 7aaa1be773718de1beb3ce0080edca7c4114b7ad | <|skeleton|>
class IndicatorFactors:
"""支撑课程view"""
def get(self, request):
"""查询支撑课程"""
<|body_0|>
def put(self, request):
"""修改支撑课程"""
<|body_1|>
def post(self, request):
"""增加支撑课程"""
<|body_2|>
def delete(self, request):
"""删除支撑课程"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class IndicatorFactors:
"""支撑课程view"""
def get(self, request):
"""查询支撑课程"""
data = {}
id = request.GET.get('id', None)
detailed_requirement_id = request.GET.get('detailed_requirement_id', None)
offering_course_id = request.GET.get('offering_course_id', None)
fiel... | the_stack_v2_python_sparse | plan/views.py | MIXISAMA/MIS-backend | train | 0 |
86027eb0ff5726bd6a2d7953e0790215b32c43bf | [
"super(Authorizer, self).__init__(authenticator)\nself._post_access_callback = post_access_callback\nself._pre_access_callback = pre_access_callback\nself.access_token = access_token",
"if self._authenticator.redirect_uri is None:\n raise InvalidInvocation('redirect URI not provided')\nself._request_token(gran... | <|body_start_0|>
super(Authorizer, self).__init__(authenticator)
self._post_access_callback = post_access_callback
self._pre_access_callback = pre_access_callback
self.access_token = access_token
<|end_body_0|>
<|body_start_1|>
if self._authenticator.redirect_uri is None:
... | Manages OAuth2 authorization tokens and scopes. | Authorizer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Authorizer:
"""Manages OAuth2 authorization tokens and scopes."""
def __init__(self, authenticator, post_access_callback=None, pre_access_callback=None, access_token=None):
"""Authorize access to Linkedin's API."""
<|body_0|>
def authorize(self, code: str):
"""Ob... | stack_v2_sparse_classes_36k_train_018394 | 6,438 | permissive | [
{
"docstring": "Authorize access to Linkedin's API.",
"name": "__init__",
"signature": "def __init__(self, authenticator, post_access_callback=None, pre_access_callback=None, access_token=None)"
},
{
"docstring": "Obtain and set authorization tokens based on ``code``. :param code: The code obtai... | 3 | stack_v2_sparse_classes_30k_train_019366 | Implement the Python class `Authorizer` described below.
Class description:
Manages OAuth2 authorization tokens and scopes.
Method signatures and docstrings:
- def __init__(self, authenticator, post_access_callback=None, pre_access_callback=None, access_token=None): Authorize access to Linkedin's API.
- def authorize... | Implement the Python class `Authorizer` described below.
Class description:
Manages OAuth2 authorization tokens and scopes.
Method signatures and docstrings:
- def __init__(self, authenticator, post_access_callback=None, pre_access_callback=None, access_token=None): Authorize access to Linkedin's API.
- def authorize... | fd28b43e28ac762e197cfc4a687a74e24a23e786 | <|skeleton|>
class Authorizer:
"""Manages OAuth2 authorization tokens and scopes."""
def __init__(self, authenticator, post_access_callback=None, pre_access_callback=None, access_token=None):
"""Authorize access to Linkedin's API."""
<|body_0|>
def authorize(self, code: str):
"""Ob... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Authorizer:
"""Manages OAuth2 authorization tokens and scopes."""
def __init__(self, authenticator, post_access_callback=None, pre_access_callback=None, access_token=None):
"""Authorize access to Linkedin's API."""
super(Authorizer, self).__init__(authenticator)
self._post_access_... | the_stack_v2_python_sparse | pawl/core/auth.py | kylejb/PAWL | train | 2 |
4c459053ad599fb7460f0b35a83edd9c5448513c | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn ServiceHealthIssue()",
"from .service_announcement_base import ServiceAnnouncementBase\nfrom .service_health_classification_type import ServiceHealthClassificationType\nfrom .service_health_issue_post import ServiceHealthIssuePost\nfro... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return ServiceHealthIssue()
<|end_body_0|>
<|body_start_1|>
from .service_announcement_base import ServiceAnnouncementBase
from .service_health_classification_type import ServiceHealthClassific... | ServiceHealthIssue | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ServiceHealthIssue:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ServiceHealthIssue:
"""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_018395 | 5,034 | 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: ServiceHealthIssue",
"name": "create_from_discriminator_value",
"signature": "def create_from_discriminator_... | 3 | null | Implement the Python class `ServiceHealthIssue` described below.
Class description:
Implement the ServiceHealthIssue class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ServiceHealthIssue: Creates a new instance of the appropriate class based on disc... | Implement the Python class `ServiceHealthIssue` described below.
Class description:
Implement the ServiceHealthIssue class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ServiceHealthIssue: Creates a new instance of the appropriate class based on disc... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class ServiceHealthIssue:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ServiceHealthIssue:
"""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 ServiceHealthIssue:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ServiceHealthIssue:
"""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: Se... | the_stack_v2_python_sparse | msgraph/generated/models/service_health_issue.py | microsoftgraph/msgraph-sdk-python | train | 135 | |
aa63b3a4ad186a963b6cbe9bf49ced210d36f3bc | [
"Utils.validate_uuid(id_person)\nif not Person.objects.filter(id=id_person).exists():\n raise ValidationError('The person is not valid!')",
"address = AddressService.check_address(address_data['street'], address_data['zip_code'], address_data['city'])\nif address is None:\n address = AddressService.add_addr... | <|body_start_0|>
Utils.validate_uuid(id_person)
if not Person.objects.filter(id=id_person).exists():
raise ValidationError('The person is not valid!')
<|end_body_0|>
<|body_start_1|>
address = AddressService.check_address(address_data['street'], address_data['zip_code'], address_dat... | Service class for person related operations | PersonService | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PersonService:
"""Service class for person related operations"""
def is_valid_person(id_person):
"""Checks if the specified person exists :param id_person: ID of person to be checked"""
<|body_0|>
def add_person(address_data, person_data):
"""Creates a new person... | stack_v2_sparse_classes_36k_train_018396 | 2,392 | no_license | [
{
"docstring": "Checks if the specified person exists :param id_person: ID of person to be checked",
"name": "is_valid_person",
"signature": "def is_valid_person(id_person)"
},
{
"docstring": "Creates a new person :param address_data: list with street, zip_code and city, respectivly :param perso... | 2 | stack_v2_sparse_classes_30k_train_016795 | Implement the Python class `PersonService` described below.
Class description:
Service class for person related operations
Method signatures and docstrings:
- def is_valid_person(id_person): Checks if the specified person exists :param id_person: ID of person to be checked
- def add_person(address_data, person_data):... | Implement the Python class `PersonService` described below.
Class description:
Service class for person related operations
Method signatures and docstrings:
- def is_valid_person(id_person): Checks if the specified person exists :param id_person: ID of person to be checked
- def add_person(address_data, person_data):... | 941e8b2870f8724db3d5103dda5157fd597cfcc7 | <|skeleton|>
class PersonService:
"""Service class for person related operations"""
def is_valid_person(id_person):
"""Checks if the specified person exists :param id_person: ID of person to be checked"""
<|body_0|>
def add_person(address_data, person_data):
"""Creates a new person... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PersonService:
"""Service class for person related operations"""
def is_valid_person(id_person):
"""Checks if the specified person exists :param id_person: ID of person to be checked"""
Utils.validate_uuid(id_person)
if not Person.objects.filter(id=id_person).exists():
... | the_stack_v2_python_sparse | backend/martin_helder/services/person_service.py | JoaoAlvaroFerreira/FEUP-LGP | train | 1 |
a02aae8b0ad9829c94253ecbd7d633c80ff9b73a | [
"super().__init__(config)\nself.in_proj_weight = nn.Parameter(torch.cat([bert_layer.attention.self.query.weight, bert_layer.attention.self.key.weight, bert_layer.attention.self.value.weight]))\nself.in_proj_bias = nn.Parameter(torch.cat([bert_layer.attention.self.query.bias, bert_layer.attention.self.key.bias, bert... | <|body_start_0|>
super().__init__(config)
self.in_proj_weight = nn.Parameter(torch.cat([bert_layer.attention.self.query.weight, bert_layer.attention.self.key.weight, bert_layer.attention.self.value.weight]))
self.in_proj_bias = nn.Parameter(torch.cat([bert_layer.attention.self.query.bias, bert_l... | BertLayerBetterTransformer | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BertLayerBetterTransformer:
def __init__(self, bert_layer, config):
"""A simple conversion of the BERT layer to its `BetterTransformer` implementation. Args: bert_layer (`torch.nn.Module`): The original BERT Layer where the weights needs to be retrieved."""
<|body_0|>
def fo... | stack_v2_sparse_classes_36k_train_018397 | 43,670 | no_license | [
{
"docstring": "A simple conversion of the BERT layer to its `BetterTransformer` implementation. Args: bert_layer (`torch.nn.Module`): The original BERT Layer where the weights needs to be retrieved.",
"name": "__init__",
"signature": "def __init__(self, bert_layer, config)"
},
{
"docstring": "T... | 2 | stack_v2_sparse_classes_30k_train_011625 | Implement the Python class `BertLayerBetterTransformer` described below.
Class description:
Implement the BertLayerBetterTransformer class.
Method signatures and docstrings:
- def __init__(self, bert_layer, config): A simple conversion of the BERT layer to its `BetterTransformer` implementation. Args: bert_layer (`to... | Implement the Python class `BertLayerBetterTransformer` described below.
Class description:
Implement the BertLayerBetterTransformer class.
Method signatures and docstrings:
- def __init__(self, bert_layer, config): A simple conversion of the BERT layer to its `BetterTransformer` implementation. Args: bert_layer (`to... | 7e55a422588c1d1e00f35a3d3a3ff896cce59e18 | <|skeleton|>
class BertLayerBetterTransformer:
def __init__(self, bert_layer, config):
"""A simple conversion of the BERT layer to its `BetterTransformer` implementation. Args: bert_layer (`torch.nn.Module`): The original BERT Layer where the weights needs to be retrieved."""
<|body_0|>
def fo... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BertLayerBetterTransformer:
def __init__(self, bert_layer, config):
"""A simple conversion of the BERT layer to its `BetterTransformer` implementation. Args: bert_layer (`torch.nn.Module`): The original BERT Layer where the weights needs to be retrieved."""
super().__init__(config)
sel... | the_stack_v2_python_sparse | generated/test_huggingface_optimum.py | jansel/pytorch-jit-paritybench | train | 35 | |
88d0ca4fb2475fb581a566e325db865bb16b7928 | [
"conn = Connection()\ndb = conn[mongodb]\nself.programs = db.programs\nself.maxResult = maxResult\nself.overwrite = overwrite\nself.maxPrograms = maxPrograms\nlogging.basicConfig(level=logging.DEBUG)\nlogger = logging.getLogger(__name__)\nlogging.info('Mongodb initialized in %s db' % mongodb)",
"spider = ImdbSpid... | <|body_start_0|>
conn = Connection()
db = conn[mongodb]
self.programs = db.programs
self.maxResult = maxResult
self.overwrite = overwrite
self.maxPrograms = maxPrograms
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger(__name__)
l... | ImdbSearch | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ImdbSearch:
def __init__(self, mongodb='ml', maxResult=10, overwrite=False, maxPrograms=0):
"""Init method, mongodb : mongodb database, default ml maxResult : amount of result that search for each program, default 10 overwrite : boolean parameter that overwrite if program have already im... | stack_v2_sparse_classes_36k_train_018398 | 3,730 | no_license | [
{
"docstring": "Init method, mongodb : mongodb database, default ml maxResult : amount of result that search for each program, default 10 overwrite : boolean parameter that overwrite if program have already imdb results, default False maxPrograms : how many program will process to imdb result search, dafault 0 ... | 3 | stack_v2_sparse_classes_30k_train_009632 | Implement the Python class `ImdbSearch` described below.
Class description:
Implement the ImdbSearch class.
Method signatures and docstrings:
- def __init__(self, mongodb='ml', maxResult=10, overwrite=False, maxPrograms=0): Init method, mongodb : mongodb database, default ml maxResult : amount of result that search f... | Implement the Python class `ImdbSearch` described below.
Class description:
Implement the ImdbSearch class.
Method signatures and docstrings:
- def __init__(self, mongodb='ml', maxResult=10, overwrite=False, maxPrograms=0): Init method, mongodb : mongodb database, default ml maxResult : amount of result that search f... | 6f4f1dc9304cf12bd1c424e62034eecf639d0305 | <|skeleton|>
class ImdbSearch:
def __init__(self, mongodb='ml', maxResult=10, overwrite=False, maxPrograms=0):
"""Init method, mongodb : mongodb database, default ml maxResult : amount of result that search for each program, default 10 overwrite : boolean parameter that overwrite if program have already im... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ImdbSearch:
def __init__(self, mongodb='ml', maxResult=10, overwrite=False, maxPrograms=0):
"""Init method, mongodb : mongodb database, default ml maxResult : amount of result that search for each program, default 10 overwrite : boolean parameter that overwrite if program have already imdb results, de... | the_stack_v2_python_sparse | imdb/imdbSearch.py | maliq/vtrScrapy | train | 0 | |
9d0b40f1de553fc7e30ad1059dc13feb2c2384c2 | [
"self.manifest_dataset = manifest_dataset\nself.field_name = field_name\nself.engine_type = engine_type",
"if isinstance(self.manifest_dataset, ayeaye.Connect):\n manifest_dataset = self.manifest_dataset.clone()\nelse:\n manifest_dataset = self.manifest_dataset\ne_url = ayeaye.connector_resolver.resolve(man... | <|body_start_0|>
self.manifest_dataset = manifest_dataset
self.field_name = field_name
self.engine_type = engine_type
<|end_body_0|>
<|body_start_1|>
if isinstance(self.manifest_dataset, ayeaye.Connect):
manifest_dataset = self.manifest_dataset.clone()
else:
... | Make engine_urls stored in a manifest file available to :class:`ayeaye.Connector`s in an :class:`ayeaye.Model`. Each engine_url represents a specific version of a source dataset so this pattern can be used to create versioned ETL builds by storing versioning information in a manifest file. A manifest file is a dataset ... | EngineFromManifest | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EngineFromManifest:
"""Make engine_urls stored in a manifest file available to :class:`ayeaye.Connector`s in an :class:`ayeaye.Model`. Each engine_url represents a specific version of a source dataset so this pattern can be used to create versioned ETL builds by storing versioning information in ... | stack_v2_sparse_classes_36k_train_018399 | 12,776 | permissive | [
{
"docstring": ":param manifest_dataset (subclass :class:`DataConnector` object): with .data and dictionary access to .data. :param field_name (str): field within manifest_dataset.data[field_name] :param engine_type (str): prefix to engine_url. e.g. 'json' would give 'json://'",
"name": "__init__",
"sig... | 2 | stack_v2_sparse_classes_30k_train_002559 | Implement the Python class `EngineFromManifest` described below.
Class description:
Make engine_urls stored in a manifest file available to :class:`ayeaye.Connector`s in an :class:`ayeaye.Model`. Each engine_url represents a specific version of a source dataset so this pattern can be used to create versioned ETL build... | Implement the Python class `EngineFromManifest` described below.
Class description:
Make engine_urls stored in a manifest file available to :class:`ayeaye.Connector`s in an :class:`ayeaye.Model`. Each engine_url represents a specific version of a source dataset so this pattern can be used to create versioned ETL build... | 048888b4dc393a882e56802c836d61316c477387 | <|skeleton|>
class EngineFromManifest:
"""Make engine_urls stored in a manifest file available to :class:`ayeaye.Connector`s in an :class:`ayeaye.Model`. Each engine_url represents a specific version of a source dataset so this pattern can be used to create versioned ETL builds by storing versioning information in ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class EngineFromManifest:
"""Make engine_urls stored in a manifest file available to :class:`ayeaye.Connector`s in an :class:`ayeaye.Model`. Each engine_url represents a specific version of a source dataset so this pattern can be used to create versioned ETL builds by storing versioning information in a manifest fi... | the_stack_v2_python_sparse | lib/ayeaye/common_pattern/manifest.py | Aye-Aye-Dev/AyeAye | train | 9 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.