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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
76d61f95b2f041bdddabff067593ee2c7547499a | [
"from torch.nn import AvgPool2d, LeakyReLU\nfrom torch.nn import Conv2d\nsuper().__init__()\nself.conv_1 = Conv2d(in_channels, in_channels, (3, 3), dilation=dilation, padding=dilation, bias=True)\nself.conv_2 = Conv2d(in_channels, out_channels, (3, 3), dilation=dilation, padding=dilation, bias=True)\nself.downSampl... | <|body_start_0|>
from torch.nn import AvgPool2d, LeakyReLU
from torch.nn import Conv2d
super().__init__()
self.conv_1 = Conv2d(in_channels, in_channels, (3, 3), dilation=dilation, padding=dilation, bias=True)
self.conv_2 = Conv2d(in_channels, out_channels, (3, 3), dilation=dilati... | General block in the discriminator | DisGeneralConvBlock | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DisGeneralConvBlock:
"""General block in the discriminator"""
def __init__(self, in_channels, out_channels, dilation=1):
"""constructor of the class :param in_channels: number of input channels :param out_channels: number of output channels"""
<|body_0|>
def forward(self... | stack_v2_sparse_classes_36k_train_034900 | 14,685 | no_license | [
{
"docstring": "constructor of the class :param in_channels: number of input channels :param out_channels: number of output channels",
"name": "__init__",
"signature": "def __init__(self, in_channels, out_channels, dilation=1)"
},
{
"docstring": "forward pass of the module :param x: input :retur... | 2 | stack_v2_sparse_classes_30k_train_005997 | Implement the Python class `DisGeneralConvBlock` described below.
Class description:
General block in the discriminator
Method signatures and docstrings:
- def __init__(self, in_channels, out_channels, dilation=1): constructor of the class :param in_channels: number of input channels :param out_channels: number of ou... | Implement the Python class `DisGeneralConvBlock` described below.
Class description:
General block in the discriminator
Method signatures and docstrings:
- def __init__(self, in_channels, out_channels, dilation=1): constructor of the class :param in_channels: number of input channels :param out_channels: number of ou... | 428abe1fefe5ea4ef00290155e7e59657bc83444 | <|skeleton|>
class DisGeneralConvBlock:
"""General block in the discriminator"""
def __init__(self, in_channels, out_channels, dilation=1):
"""constructor of the class :param in_channels: number of input channels :param out_channels: number of output channels"""
<|body_0|>
def forward(self... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DisGeneralConvBlock:
"""General block in the discriminator"""
def __init__(self, in_channels, out_channels, dilation=1):
"""constructor of the class :param in_channels: number of input channels :param out_channels: number of output channels"""
from torch.nn import AvgPool2d, LeakyReLU
... | the_stack_v2_python_sparse | src/msg_stylegan2.py | blakecheng/lafin | train | 0 |
dcaf7f5b15aa6b7a8631fab79d2ff601b3d56c9a | [
"auth_token = helpers.get_auth_token_for_testing()\ntemplate = {'auth_token': auth_token, 'template': [{'annotation': 'name', 'label': 'Name', 'type': 'field', 'field_required': True, 'field_min_length': 3, 'field_max_length': 100}, {'annotation': 'gender', 'label': 'Gender', 'type': 'choice', 'choices': [['M', 'Ma... | <|body_start_0|>
auth_token = helpers.get_auth_token_for_testing()
template = {'auth_token': auth_token, 'template': [{'annotation': 'name', 'label': 'Name', 'type': 'field', 'field_required': True, 'field_min_length': 3, 'field_max_length': 100}, {'annotation': 'gender', 'label': 'Gender', 'type': 'cho... | Unit tests for the "/set_template" endpoint. | SetTemplateTestCase | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SetTemplateTestCase:
"""Unit tests for the "/set_template" endpoint."""
def test_set_template_in_body(self):
"""Test the "/set_template" endpoint. This version of the test stores the template in the body of the HTTP request."""
<|body_0|>
def test_set_template_query_para... | stack_v2_sparse_classes_36k_train_034901 | 25,230 | no_license | [
{
"docstring": "Test the \"/set_template\" endpoint. This version of the test stores the template in the body of the HTTP request.",
"name": "test_set_template_in_body",
"signature": "def test_set_template_in_body(self)"
},
{
"docstring": "Test the \"/set_template\" endpoint. This version of the... | 2 | stack_v2_sparse_classes_30k_train_006982 | Implement the Python class `SetTemplateTestCase` described below.
Class description:
Unit tests for the "/set_template" endpoint.
Method signatures and docstrings:
- def test_set_template_in_body(self): Test the "/set_template" endpoint. This version of the test stores the template in the body of the HTTP request.
- ... | Implement the Python class `SetTemplateTestCase` described below.
Class description:
Unit tests for the "/set_template" endpoint.
Method signatures and docstrings:
- def test_set_template_in_body(self): Test the "/set_template" endpoint. This version of the test stores the template in the body of the HTTP request.
- ... | a7d49d463ea97900333885dd29cb2e70c1a0fdb9 | <|skeleton|>
class SetTemplateTestCase:
"""Unit tests for the "/set_template" endpoint."""
def test_set_template_in_body(self):
"""Test the "/set_template" endpoint. This version of the test stores the template in the body of the HTTP request."""
<|body_0|>
def test_set_template_query_para... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SetTemplateTestCase:
"""Unit tests for the "/set_template" endpoint."""
def test_set_template_in_body(self):
"""Test the "/set_template" endpoint. This version of the test stores the template in the body of the HTTP request."""
auth_token = helpers.get_auth_token_for_testing()
tem... | the_stack_v2_python_sparse | annotationDatabase/api/tests.py | erikwestra/ripple-annotation-database | train | 0 |
58a1eee26b1629fa98bb5a4e1dd27b7c950cd057 | [
"bound_1 = np.prod(self._shape[:-1])\ncombos = combinations(self._shape[:-1], len(self._shape[:-1]) - 1)\nbound_2 = 2 ** min((np.prod(combo) for combo in combos)) - 1\nreturn min([bound_1, bound_2])",
"entropy = self._entropy(self._W, self._crvs)\n\ndef objective(self, x):\n \"\"\"\n Compute H[W | c... | <|body_start_0|>
bound_1 = np.prod(self._shape[:-1])
combos = combinations(self._shape[:-1], len(self._shape[:-1]) - 1)
bound_2 = 2 ** min((np.prod(combo) for combo in combos)) - 1
return min([bound_1, bound_2])
<|end_body_0|>
<|body_start_1|>
entropy = self._entropy(self._W, se... | Compute the Exact common information, min H[V], taken over all V which render the X_i conditionally independent. | ExactCommonInformation | [
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ExactCommonInformation:
"""Compute the Exact common information, min H[V], taken over all V which render the X_i conditionally independent."""
def compute_bound(self):
"""Compute the upper bound on the cardinality of the auxiliary random variable. The bound is the minimum of one from... | stack_v2_sparse_classes_36k_train_034902 | 1,889 | permissive | [
{
"docstring": "Compute the upper bound on the cardinality of the auxiliary random variable. The bound is the minimum of one from the Caratheodory-Fenchel theorem, and the other from a pidgenhole argument. Returns ------- bound : int The bound.",
"name": "compute_bound",
"signature": "def compute_bound(... | 2 | stack_v2_sparse_classes_30k_test_000744 | Implement the Python class `ExactCommonInformation` described below.
Class description:
Compute the Exact common information, min H[V], taken over all V which render the X_i conditionally independent.
Method signatures and docstrings:
- def compute_bound(self): Compute the upper bound on the cardinality of the auxili... | Implement the Python class `ExactCommonInformation` described below.
Class description:
Compute the Exact common information, min H[V], taken over all V which render the X_i conditionally independent.
Method signatures and docstrings:
- def compute_bound(self): Compute the upper bound on the cardinality of the auxili... | b13c5020a2b8524527a4a0db5a81d8549142228c | <|skeleton|>
class ExactCommonInformation:
"""Compute the Exact common information, min H[V], taken over all V which render the X_i conditionally independent."""
def compute_bound(self):
"""Compute the upper bound on the cardinality of the auxiliary random variable. The bound is the minimum of one from... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ExactCommonInformation:
"""Compute the Exact common information, min H[V], taken over all V which render the X_i conditionally independent."""
def compute_bound(self):
"""Compute the upper bound on the cardinality of the auxiliary random variable. The bound is the minimum of one from the Caratheo... | the_stack_v2_python_sparse | dit/multivariate/common_informations/exact_common_information.py | dit/dit | train | 468 |
392e13a14c9614d39a6ae478afd18406c5ce23eb | [
"print('Received GET on resource /books/<book_id>/copies')\nif book_id.isdigit():\n list_of_copies = BookCopyChecker.get_copies(book_id)\n print(list_of_copies)\n return (list_of_copies, 200)\nelse:\n abort(400, 'Invalid input for book_id')",
"print('Received POST on resource /books/<book_id>/copies')... | <|body_start_0|>
print('Received GET on resource /books/<book_id>/copies')
if book_id.isdigit():
list_of_copies = BookCopyChecker.get_copies(book_id)
print(list_of_copies)
return (list_of_copies, 200)
else:
abort(400, 'Invalid input for book_id')
<... | BookCopies | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BookCopies:
def get(self, book_id):
"""Gets the copies of a given book. :param book_id: Record of a book. :return: JSON of a list of book copies according to list_copies_marshaller model."""
<|body_0|>
def post(self, book_id):
"""Create a new copy for an existing boo... | stack_v2_sparse_classes_36k_train_034903 | 14,158 | no_license | [
{
"docstring": "Gets the copies of a given book. :param book_id: Record of a book. :return: JSON of a list of book copies according to list_copies_marshaller model.",
"name": "get",
"signature": "def get(self, book_id)"
},
{
"docstring": "Create a new copy for an existing book. :param book_id: R... | 2 | stack_v2_sparse_classes_30k_train_020753 | Implement the Python class `BookCopies` described below.
Class description:
Implement the BookCopies class.
Method signatures and docstrings:
- def get(self, book_id): Gets the copies of a given book. :param book_id: Record of a book. :return: JSON of a list of book copies according to list_copies_marshaller model.
-... | Implement the Python class `BookCopies` described below.
Class description:
Implement the BookCopies class.
Method signatures and docstrings:
- def get(self, book_id): Gets the copies of a given book. :param book_id: Record of a book. :return: JSON of a list of book copies according to list_copies_marshaller model.
-... | 4c3fdf41a43a56c253faecacac5f9d977d9c99be | <|skeleton|>
class BookCopies:
def get(self, book_id):
"""Gets the copies of a given book. :param book_id: Record of a book. :return: JSON of a list of book copies according to list_copies_marshaller model."""
<|body_0|>
def post(self, book_id):
"""Create a new copy for an existing boo... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BookCopies:
def get(self, book_id):
"""Gets the copies of a given book. :param book_id: Record of a book. :return: JSON of a list of book copies according to list_copies_marshaller model."""
print('Received GET on resource /books/<book_id>/copies')
if book_id.isdigit():
lis... | the_stack_v2_python_sparse | apis/books_api.py | neu-seattle-cs5500-fall18/book-library-web-service-scrumptious | train | 0 | |
4f1ab0e1ac804b637a9f37371466c2ecc63f0610 | [
"super().__init__()\nassert n_feat % n_head == 0\nself.n_feat = n_feat\nself.d_k = n_feat // n_head\nself.h = n_head\nself.linear_q = Linear(n_feat, n_feat)\nself.linear_k = Linear(n_feat, n_feat)\nself.linear_v = Linear(n_feat, n_feat)\nself.linear_out = Linear(n_feat, n_feat)\nself.dropout = nn.Dropout(p=dropout_... | <|body_start_0|>
super().__init__()
assert n_feat % n_head == 0
self.n_feat = n_feat
self.d_k = n_feat // n_head
self.h = n_head
self.linear_q = Linear(n_feat, n_feat)
self.linear_k = Linear(n_feat, n_feat)
self.linear_v = Linear(n_feat, n_feat)
se... | Multi-Head Attention layer. | MultiHeadedAttention | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MultiHeadedAttention:
"""Multi-Head Attention layer."""
def __init__(self, n_head: int, n_feat: int, dropout_rate: float):
"""Construct an MultiHeadedAttention object. Args: n_head (int): The number of heads. n_feat (int): The number of features. dropout_rate (float): Dropout rate.""... | stack_v2_sparse_classes_36k_train_034904 | 23,811 | permissive | [
{
"docstring": "Construct an MultiHeadedAttention object. Args: n_head (int): The number of heads. n_feat (int): The number of features. dropout_rate (float): Dropout rate.",
"name": "__init__",
"signature": "def __init__(self, n_head: int, n_feat: int, dropout_rate: float)"
},
{
"docstring": "T... | 4 | null | Implement the Python class `MultiHeadedAttention` described below.
Class description:
Multi-Head Attention layer.
Method signatures and docstrings:
- def __init__(self, n_head: int, n_feat: int, dropout_rate: float): Construct an MultiHeadedAttention object. Args: n_head (int): The number of heads. n_feat (int): The ... | Implement the Python class `MultiHeadedAttention` described below.
Class description:
Multi-Head Attention layer.
Method signatures and docstrings:
- def __init__(self, n_head: int, n_feat: int, dropout_rate: float): Construct an MultiHeadedAttention object. Args: n_head (int): The number of heads. n_feat (int): The ... | 17854a04d43c231eff66bfed9d6aa55e94a29e79 | <|skeleton|>
class MultiHeadedAttention:
"""Multi-Head Attention layer."""
def __init__(self, n_head: int, n_feat: int, dropout_rate: float):
"""Construct an MultiHeadedAttention object. Args: n_head (int): The number of heads. n_feat (int): The number of features. dropout_rate (float): Dropout rate.""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MultiHeadedAttention:
"""Multi-Head Attention layer."""
def __init__(self, n_head: int, n_feat: int, dropout_rate: float):
"""Construct an MultiHeadedAttention object. Args: n_head (int): The number of heads. n_feat (int): The number of features. dropout_rate (float): Dropout rate."""
sup... | the_stack_v2_python_sparse | paddlespeech/s2t/modules/attention.py | anniyanvr/DeepSpeech-1 | train | 0 |
f7b2e445f98636bca40b55c83849724d8c0cac0c | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn Win32LobApp()",
"from .mobile_lob_app import MobileLobApp\nfrom .win32_lob_app_install_experience import Win32LobAppInstallExperience\nfrom .win32_lob_app_msi_information import Win32LobAppMsiInformation\nfrom .win32_lob_app_return_cod... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
return Win32LobApp()
<|end_body_0|>
<|body_start_1|>
from .mobile_lob_app import MobileLobApp
from .win32_lob_app_install_experience import Win32LobAppInstallExperience
from .win32_lob_... | Contains properties and inherited properties for Win32 apps. | Win32LobApp | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Win32LobApp:
"""Contains properties and inherited properties for Win32 apps."""
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Win32LobApp:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node t... | stack_v2_sparse_classes_36k_train_034905 | 7,073 | 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: Win32LobApp",
"name": "create_from_discriminator_value",
"signature": "def create_from_discriminator_value(p... | 3 | stack_v2_sparse_classes_30k_train_010110 | Implement the Python class `Win32LobApp` described below.
Class description:
Contains properties and inherited properties for Win32 apps.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Win32LobApp: Creates a new instance of the appropriate class based ... | Implement the Python class `Win32LobApp` described below.
Class description:
Contains properties and inherited properties for Win32 apps.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Win32LobApp: Creates a new instance of the appropriate class based ... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class Win32LobApp:
"""Contains properties and inherited properties for Win32 apps."""
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Win32LobApp:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node t... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Win32LobApp:
"""Contains properties and inherited properties for Win32 apps."""
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Win32LobApp:
"""Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read... | the_stack_v2_python_sparse | msgraph/generated/models/win32_lob_app.py | microsoftgraph/msgraph-sdk-python | train | 135 |
136a23190970b144c9672a4dd7c25e05ba4efb6d | [
"if len(results) == 0:\n return False\nelse:\n return results[0].fetchall()[0]",
"binds = {}\nbinds['location'] = location\nbinds['subscription'] = subscription\nbinds['state'] = state\nreturn binds",
"binds = self.buildBinds(location, subscription, state)\nresult = self.dbi.processData(self.sql, binds, c... | <|body_start_0|>
if len(results) == 0:
return False
else:
return results[0].fetchall()[0]
<|end_body_0|>
<|body_start_1|>
binds = {}
binds['location'] = location
binds['subscription'] = subscription
binds['state'] = state
return binds
<|en... | _GetLocation_ Retrieve all files that are associated with the given job from the database. | GetNumberOfJobsPerSite | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GetNumberOfJobsPerSite:
"""_GetLocation_ Retrieve all files that are associated with the given job from the database."""
def format(self, results):
"""_format_"""
<|body_0|>
def buildBinds(self, location, subscription, state):
"""_buildBinds_ Build a list of bind... | stack_v2_sparse_classes_36k_train_034906 | 1,598 | permissive | [
{
"docstring": "_format_",
"name": "format",
"signature": "def format(self, results)"
},
{
"docstring": "_buildBinds_ Build a list of binds",
"name": "buildBinds",
"signature": "def buildBinds(self, location, subscription, state)"
},
{
"docstring": "_execute_ Execute the SQL for ... | 3 | null | Implement the Python class `GetNumberOfJobsPerSite` described below.
Class description:
_GetLocation_ Retrieve all files that are associated with the given job from the database.
Method signatures and docstrings:
- def format(self, results): _format_
- def buildBinds(self, location, subscription, state): _buildBinds_... | Implement the Python class `GetNumberOfJobsPerSite` described below.
Class description:
_GetLocation_ Retrieve all files that are associated with the given job from the database.
Method signatures and docstrings:
- def format(self, results): _format_
- def buildBinds(self, location, subscription, state): _buildBinds_... | de110ccf6fc63ef5589b4e871ef4d51d5bce7a25 | <|skeleton|>
class GetNumberOfJobsPerSite:
"""_GetLocation_ Retrieve all files that are associated with the given job from the database."""
def format(self, results):
"""_format_"""
<|body_0|>
def buildBinds(self, location, subscription, state):
"""_buildBinds_ Build a list of bind... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GetNumberOfJobsPerSite:
"""_GetLocation_ Retrieve all files that are associated with the given job from the database."""
def format(self, results):
"""_format_"""
if len(results) == 0:
return False
else:
return results[0].fetchall()[0]
def buildBinds(s... | the_stack_v2_python_sparse | src/python/WMCore/WMBS/MySQL/Subscriptions/GetNumberOfJobsPerSite.py | vkuznet/WMCore | train | 0 |
507a01d9702a9803a8505889b8854a12345e8ea2 | [
"self.children_count = children_count\nself.dc_list = dc_list\nself.replication_strategy = replication_strategy",
"if dictionary is None:\n return None\nchildren_count = dictionary.get('childrenCount')\ndc_list = dictionary.get('dcList')\nreplication_strategy = dictionary.get('replicationStrategy')\nreturn cls... | <|body_start_0|>
self.children_count = children_count
self.dc_list = dc_list
self.replication_strategy = replication_strategy
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
children_count = dictionary.get('childrenCount')
dc_list = diction... | Implementation of the 'CassandraKeyspace' model. Specifies an Object containing information about a Cassandra Keyspace. Attributes: children_count (int): Number of documents in this bucket. dc_list (list of string): If the replication strategy is set as kNetwork, then dc_list will have a list of data centers to which t... | CassandraKeyspace | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CassandraKeyspace:
"""Implementation of the 'CassandraKeyspace' model. Specifies an Object containing information about a Cassandra Keyspace. Attributes: children_count (int): Number of documents in this bucket. dc_list (list of string): If the replication strategy is set as kNetwork, then dc_lis... | stack_v2_sparse_classes_36k_train_034907 | 2,167 | permissive | [
{
"docstring": "Constructor for the CassandraKeyspace class",
"name": "__init__",
"signature": "def __init__(self, children_count=None, dc_list=None, replication_strategy=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary rep... | 2 | stack_v2_sparse_classes_30k_train_010107 | Implement the Python class `CassandraKeyspace` described below.
Class description:
Implementation of the 'CassandraKeyspace' model. Specifies an Object containing information about a Cassandra Keyspace. Attributes: children_count (int): Number of documents in this bucket. dc_list (list of string): If the replication s... | Implement the Python class `CassandraKeyspace` described below.
Class description:
Implementation of the 'CassandraKeyspace' model. Specifies an Object containing information about a Cassandra Keyspace. Attributes: children_count (int): Number of documents in this bucket. dc_list (list of string): If the replication s... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class CassandraKeyspace:
"""Implementation of the 'CassandraKeyspace' model. Specifies an Object containing information about a Cassandra Keyspace. Attributes: children_count (int): Number of documents in this bucket. dc_list (list of string): If the replication strategy is set as kNetwork, then dc_lis... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CassandraKeyspace:
"""Implementation of the 'CassandraKeyspace' model. Specifies an Object containing information about a Cassandra Keyspace. Attributes: children_count (int): Number of documents in this bucket. dc_list (list of string): If the replication strategy is set as kNetwork, then dc_list will have a... | the_stack_v2_python_sparse | cohesity_management_sdk/models/cassandra_keyspace.py | cohesity/management-sdk-python | train | 24 |
669ba5d3ddcb833f1e01465ccec198b7daee4b80 | [
"super(SupportingOutputLayer, self).__init__()\nself.linear_1 = Linear(linear_weight_shape=linear_1_weight_shape, linear_bias_shape=linear_1_bias_shape)\nself.bert_layer_norm = BertLayerNorm(bert_layer_norm_weight_shape=bert_layer_norm_weight_shape, bert_layer_norm_bias_shape=bert_layer_norm_bias_shape)\nself.matmu... | <|body_start_0|>
super(SupportingOutputLayer, self).__init__()
self.linear_1 = Linear(linear_weight_shape=linear_1_weight_shape, linear_bias_shape=linear_1_bias_shape)
self.bert_layer_norm = BertLayerNorm(bert_layer_norm_weight_shape=bert_layer_norm_weight_shape, bert_layer_norm_bias_shape=bert_... | module of reader downstream | SupportingOutputLayer | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-proprietary-license"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SupportingOutputLayer:
"""module of reader downstream"""
def __init__(self, linear_1_weight_shape, linear_1_bias_shape, bert_layer_norm_weight_shape, bert_layer_norm_bias_shape):
"""init function"""
<|body_0|>
def construct(self, x):
"""construct function"""
... | stack_v2_sparse_classes_36k_train_034908 | 9,011 | permissive | [
{
"docstring": "init function",
"name": "__init__",
"signature": "def __init__(self, linear_1_weight_shape, linear_1_bias_shape, bert_layer_norm_weight_shape, bert_layer_norm_bias_shape)"
},
{
"docstring": "construct function",
"name": "construct",
"signature": "def construct(self, x)"
... | 2 | stack_v2_sparse_classes_30k_train_017561 | Implement the Python class `SupportingOutputLayer` described below.
Class description:
module of reader downstream
Method signatures and docstrings:
- def __init__(self, linear_1_weight_shape, linear_1_bias_shape, bert_layer_norm_weight_shape, bert_layer_norm_bias_shape): init function
- def construct(self, x): const... | Implement the Python class `SupportingOutputLayer` described below.
Class description:
module of reader downstream
Method signatures and docstrings:
- def __init__(self, linear_1_weight_shape, linear_1_bias_shape, bert_layer_norm_weight_shape, bert_layer_norm_bias_shape): init function
- def construct(self, x): const... | eab643f51336dbf7d711f02d27e6516e5affee59 | <|skeleton|>
class SupportingOutputLayer:
"""module of reader downstream"""
def __init__(self, linear_1_weight_shape, linear_1_bias_shape, bert_layer_norm_weight_shape, bert_layer_norm_bias_shape):
"""init function"""
<|body_0|>
def construct(self, x):
"""construct function"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SupportingOutputLayer:
"""module of reader downstream"""
def __init__(self, linear_1_weight_shape, linear_1_bias_shape, bert_layer_norm_weight_shape, bert_layer_norm_bias_shape):
"""init function"""
super(SupportingOutputLayer, self).__init__()
self.linear_1 = Linear(linear_weight... | the_stack_v2_python_sparse | research/nlp/tprr/src/reader_downstream.py | mindspore-ai/models | train | 301 |
9d709fd7c9cccc88055e0040de85edc9e82cc2fe | [
"infoFrame = Frame(main_game_frame, bg='black', borderwidth=3, relief=RIDGE)\ninfoFrame.grid(row=1, column=7, columnspan=1, rowspan=7, sticky=N + S + E + W)\ninfoFrame.grid_propagate(False)\nroot = infoFrame\nroot.columnconfigure(0, weight=1)\ni = 0\nwhile i < 4:\n root.rowconfigure(i, weight=1)\n i = i + 1\n... | <|body_start_0|>
infoFrame = Frame(main_game_frame, bg='black', borderwidth=3, relief=RIDGE)
infoFrame.grid(row=1, column=7, columnspan=1, rowspan=7, sticky=N + S + E + W)
infoFrame.grid_propagate(False)
root = infoFrame
root.columnconfigure(0, weight=1)
i = 0
whi... | InfoFrame class. This class contains the initialization and configuration of the info frame in the gameplay consisting of the pause, help, menu and exit options. It is of the tkinter library and inherits an instance of Frame. | InfoFrame | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InfoFrame:
"""InfoFrame class. This class contains the initialization and configuration of the info frame in the gameplay consisting of the pause, help, menu and exit options. It is of the tkinter library and inherits an instance of Frame."""
def __init__(self, main_game_frame):
"""I... | stack_v2_sparse_classes_36k_train_034909 | 22,054 | no_license | [
{
"docstring": "Initialization. Initializes the info frame, configures its size and defines its components. @param main_game_frame: Instance of the MGameFrame.",
"name": "__init__",
"signature": "def __init__(self, main_game_frame)"
},
{
"docstring": "This method changes the color of the main me... | 5 | stack_v2_sparse_classes_30k_train_005376 | Implement the Python class `InfoFrame` described below.
Class description:
InfoFrame class. This class contains the initialization and configuration of the info frame in the gameplay consisting of the pause, help, menu and exit options. It is of the tkinter library and inherits an instance of Frame.
Method signatures... | Implement the Python class `InfoFrame` described below.
Class description:
InfoFrame class. This class contains the initialization and configuration of the info frame in the gameplay consisting of the pause, help, menu and exit options. It is of the tkinter library and inherits an instance of Frame.
Method signatures... | 4cb86bb4bc6fc0aaac5037cf076145781dc532b7 | <|skeleton|>
class InfoFrame:
"""InfoFrame class. This class contains the initialization and configuration of the info frame in the gameplay consisting of the pause, help, menu and exit options. It is of the tkinter library and inherits an instance of Frame."""
def __init__(self, main_game_frame):
"""I... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class InfoFrame:
"""InfoFrame class. This class contains the initialization and configuration of the info frame in the gameplay consisting of the pause, help, menu and exit options. It is of the tkinter library and inherits an instance of Frame."""
def __init__(self, main_game_frame):
"""Initialization... | the_stack_v2_python_sparse | src/org/display/GameFrame.py | sasithra/ISE-Pacman-Final-Submission | train | 0 |
276f79755970fd1a48badb52d1b1a9cb0d8d62c6 | [
"self.week = None\nself.day_of_week = None\nself.backup_start_time = None\nself.workflow_id = None\nself.file_name = None\nself.size_of_backup = None\nself.backup_time = None",
"dataset = pd.read_csv(filename)\nself.week = dataset['Week #'].tolist()\nself.day_of_week = dataset['Day of Week'].tolist()\nself.backup... | <|body_start_0|>
self.week = None
self.day_of_week = None
self.backup_start_time = None
self.workflow_id = None
self.file_name = None
self.size_of_backup = None
self.backup_time = None
<|end_body_0|>
<|body_start_1|>
dataset = pd.read_csv(filename)
... | Data | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Data:
def __init__(self):
"""Data_ratings class. Attributes -------------------- week -- list of shape (n,) day_of_week -- list of shape (n,) backup_start_time -- list of shape (n,) workflow_id -- list of shape (n,) file_name -- list of shape (n,) size_of_backup -- list of shape (n,) bac... | stack_v2_sparse_classes_36k_train_034910 | 1,675 | no_license | [
{
"docstring": "Data_ratings class. Attributes -------------------- week -- list of shape (n,) day_of_week -- list of shape (n,) backup_start_time -- list of shape (n,) workflow_id -- list of shape (n,) file_name -- list of shape (n,) size_of_backup -- list of shape (n,) backup_time -- list of shape (n,)",
... | 2 | stack_v2_sparse_classes_30k_train_004817 | Implement the Python class `Data` described below.
Class description:
Implement the Data class.
Method signatures and docstrings:
- def __init__(self): Data_ratings class. Attributes -------------------- week -- list of shape (n,) day_of_week -- list of shape (n,) backup_start_time -- list of shape (n,) workflow_id -... | Implement the Python class `Data` described below.
Class description:
Implement the Data class.
Method signatures and docstrings:
- def __init__(self): Data_ratings class. Attributes -------------------- week -- list of shape (n,) day_of_week -- list of shape (n,) backup_start_time -- list of shape (n,) workflow_id -... | a657c68ae4382c1ae105c695bbe354c452716dad | <|skeleton|>
class Data:
def __init__(self):
"""Data_ratings class. Attributes -------------------- week -- list of shape (n,) day_of_week -- list of shape (n,) backup_start_time -- list of shape (n,) workflow_id -- list of shape (n,) file_name -- list of shape (n,) size_of_backup -- list of shape (n,) bac... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Data:
def __init__(self):
"""Data_ratings class. Attributes -------------------- week -- list of shape (n,) day_of_week -- list of shape (n,) backup_start_time -- list of shape (n,) workflow_id -- list of shape (n,) file_name -- list of shape (n,) size_of_backup -- list of shape (n,) backup_time -- li... | the_stack_v2_python_sparse | Large Scale Data Mining/Regression Analysis/util.py | FunyaoLeo/MyGitRep | train | 0 | |
8cb9fa8023c373eadb89bc8f9d8b7fec170b7a42 | [
"results = []\ndbUtil = MsqlTools()\npageNo = (page - 1) * limit\nif itemsName == '':\n sql = string.Template('select * from t_items order by create_time $sortOrder limit $pageNo,$limit;')\n sql = sql.substitute(pageNo=pageNo, limit=limit, sortOrder=sortOrder)\n items = MsqlTools.get_all(dbUtil, sql)\n ... | <|body_start_0|>
results = []
dbUtil = MsqlTools()
pageNo = (page - 1) * limit
if itemsName == '':
sql = string.Template('select * from t_items order by create_time $sortOrder limit $pageNo,$limit;')
sql = sql.substitute(pageNo=pageNo, limit=limit, sortOrder=sortO... | db_items_list | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class db_items_list:
def show_items_list(self, page, limit, sortOrder, itemsName):
"""查询t_user表所有数据"""
<|body_0|>
def add_items(self, items_name, create_user, describes):
"""添加项目 :return:"""
<|body_1|>
def edit_items(self, id, items_name, describes):
"... | stack_v2_sparse_classes_36k_train_034911 | 3,343 | no_license | [
{
"docstring": "查询t_user表所有数据",
"name": "show_items_list",
"signature": "def show_items_list(self, page, limit, sortOrder, itemsName)"
},
{
"docstring": "添加项目 :return:",
"name": "add_items",
"signature": "def add_items(self, items_name, create_user, describes)"
},
{
"docstring": ... | 5 | stack_v2_sparse_classes_30k_train_016151 | Implement the Python class `db_items_list` described below.
Class description:
Implement the db_items_list class.
Method signatures and docstrings:
- def show_items_list(self, page, limit, sortOrder, itemsName): 查询t_user表所有数据
- def add_items(self, items_name, create_user, describes): 添加项目 :return:
- def edit_items(se... | Implement the Python class `db_items_list` described below.
Class description:
Implement the db_items_list class.
Method signatures and docstrings:
- def show_items_list(self, page, limit, sortOrder, itemsName): 查询t_user表所有数据
- def add_items(self, items_name, create_user, describes): 添加项目 :return:
- def edit_items(se... | 64ced2b9bd1fe9503521024ea2ddc05efc21f969 | <|skeleton|>
class db_items_list:
def show_items_list(self, page, limit, sortOrder, itemsName):
"""查询t_user表所有数据"""
<|body_0|>
def add_items(self, items_name, create_user, describes):
"""添加项目 :return:"""
<|body_1|>
def edit_items(self, id, items_name, describes):
"... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class db_items_list:
def show_items_list(self, page, limit, sortOrder, itemsName):
"""查询t_user表所有数据"""
results = []
dbUtil = MsqlTools()
pageNo = (page - 1) * limit
if itemsName == '':
sql = string.Template('select * from t_items order by create_time $sortOrder li... | the_stack_v2_python_sparse | app/db/db_items_list.py | fzj123/auto_test_platform-master | train | 0 | |
fa391f15f8db68587f6bf3de3973629c64c26180 | [
"id = kwargs.get('id', -1)\nct.CustomTreeCtrl.__init__(self, parent, size=kwargs.get('size', wx.Size(200, 150)), id=id, agwStyle=wx.TR_DEFAULT_STYLE)\nself.controller = TreeController(controller, self)\nself.il = wx.ImageList(16, 16)\nself.fldridx = self.il.Add(wx.ArtProvider_GetBitmap(wx.ART_FOLDER, wx.ART_OTHER, ... | <|body_start_0|>
id = kwargs.get('id', -1)
ct.CustomTreeCtrl.__init__(self, parent, size=kwargs.get('size', wx.Size(200, 150)), id=id, agwStyle=wx.TR_DEFAULT_STYLE)
self.controller = TreeController(controller, self)
self.il = wx.ImageList(16, 16)
self.fldridx = self.il.Add(wx.Art... | Project Tree Structure | ProjectTree | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProjectTree:
"""Project Tree Structure"""
def __init__(self, parent, controller, project=None, **kwargs):
""":param parent: :param controller: :param project: :param kwargs: :return:"""
<|body_0|>
def add_root(self, directory):
""":param directory: :return:"""
... | stack_v2_sparse_classes_36k_train_034912 | 2,308 | no_license | [
{
"docstring": ":param parent: :param controller: :param project: :param kwargs: :return:",
"name": "__init__",
"signature": "def __init__(self, parent, controller, project=None, **kwargs)"
},
{
"docstring": ":param directory: :return:",
"name": "add_root",
"signature": "def add_root(sel... | 3 | stack_v2_sparse_classes_30k_train_019357 | Implement the Python class `ProjectTree` described below.
Class description:
Project Tree Structure
Method signatures and docstrings:
- def __init__(self, parent, controller, project=None, **kwargs): :param parent: :param controller: :param project: :param kwargs: :return:
- def add_root(self, directory): :param dire... | Implement the Python class `ProjectTree` described below.
Class description:
Project Tree Structure
Method signatures and docstrings:
- def __init__(self, parent, controller, project=None, **kwargs): :param parent: :param controller: :param project: :param kwargs: :return:
- def add_root(self, directory): :param dire... | e78511f30935b006385b571472487bb081aa36d8 | <|skeleton|>
class ProjectTree:
"""Project Tree Structure"""
def __init__(self, parent, controller, project=None, **kwargs):
""":param parent: :param controller: :param project: :param kwargs: :return:"""
<|body_0|>
def add_root(self, directory):
""":param directory: :return:"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ProjectTree:
"""Project Tree Structure"""
def __init__(self, parent, controller, project=None, **kwargs):
""":param parent: :param controller: :param project: :param kwargs: :return:"""
id = kwargs.get('id', -1)
ct.CustomTreeCtrl.__init__(self, parent, size=kwargs.get('size', wx.S... | the_stack_v2_python_sparse | boaui/tree/project.py | JoenyBui/boa-gui | train | 0 |
97c48ebc01c91ca0db786bc0fd5d132d3b63ecc4 | [
"Search.__init__(self)\nself.token = token\nif HAS_SOUNDCLOUD:\n self.client = soundcloud.Client(client_id=token)\nelse:\n self.client = None\nself.serviceName = 'SoundCloud'",
"if not HAS_SOUNDCLOUD:\n return {'Library unavailable': \"This search engine cannot function properly, because the soundcloud p... | <|body_start_0|>
Search.__init__(self)
self.token = token
if HAS_SOUNDCLOUD:
self.client = soundcloud.Client(client_id=token)
else:
self.client = None
self.serviceName = 'SoundCloud'
<|end_body_0|>
<|body_start_1|>
if not HAS_SOUNDCLOUD:
... | SoundCloudSearch | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SoundCloudSearch:
def __init__(self, token):
"""Create a new SoundCloudSearch instance. token should be a valid SoundCloud Client ID."""
<|body_0|>
def search(self, query, maxresults=10, lang='en', **opt):
"""Searches SoundCloud for tracks using the given query. Retu... | stack_v2_sparse_classes_36k_train_034913 | 5,488 | no_license | [
{
"docstring": "Create a new SoundCloudSearch instance. token should be a valid SoundCloud Client ID.",
"name": "__init__",
"signature": "def __init__(self, token)"
},
{
"docstring": "Searches SoundCloud for tracks using the given query. Returns a dict of url: title pairs pointing to tracks. If ... | 2 | stack_v2_sparse_classes_30k_train_005616 | Implement the Python class `SoundCloudSearch` described below.
Class description:
Implement the SoundCloudSearch class.
Method signatures and docstrings:
- def __init__(self, token): Create a new SoundCloudSearch instance. token should be a valid SoundCloud Client ID.
- def search(self, query, maxresults=10, lang='en... | Implement the Python class `SoundCloudSearch` described below.
Class description:
Implement the SoundCloudSearch class.
Method signatures and docstrings:
- def __init__(self, token): Create a new SoundCloudSearch instance. token should be a valid SoundCloud Client ID.
- def search(self, query, maxresults=10, lang='en... | 5fbff4606d50a114613edbb1f360aca070be9226 | <|skeleton|>
class SoundCloudSearch:
def __init__(self, token):
"""Create a new SoundCloudSearch instance. token should be a valid SoundCloud Client ID."""
<|body_0|>
def search(self, query, maxresults=10, lang='en', **opt):
"""Searches SoundCloud for tracks using the given query. Retu... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SoundCloudSearch:
def __init__(self, token):
"""Create a new SoundCloudSearch instance. token should be a valid SoundCloud Client ID."""
Search.__init__(self)
self.token = token
if HAS_SOUNDCLOUD:
self.client = soundcloud.Client(client_id=token)
else:
... | the_stack_v2_python_sparse | ytsearch.py | fredi-68/Ram | train | 0 | |
442d47f6534be61d6159a4833395dccce010f7c1 | [
"KratosMultiphysics.Process.__init__(self)\ndefault_settings = KratosMultiphysics.Parameters('\\n {\\n \"help\" : \"This process allows to do a simple mapping using the SimpleMortarMapperProcess\",\\n \"origin_model_part_name\" : \"please_specify_mo... | <|body_start_0|>
KratosMultiphysics.Process.__init__(self)
default_settings = KratosMultiphysics.Parameters('\n {\n "help" : "This process allows to do a simple mapping using the SimpleMortarMapperProcess",\n "origin_model_part_name" : "... | This process allows to do a simple mapping using the SimpleMortarMapperProcess Only the member variables listed below should be accessed directly. Public member variables: Model -- the container of the different model parts. settings -- Kratos parameters containing solver settings. | BasicMappingProcess | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BasicMappingProcess:
"""This process allows to do a simple mapping using the SimpleMortarMapperProcess Only the member variables listed below should be accessed directly. Public member variables: Model -- the container of the different model parts. settings -- Kratos parameters containing solver ... | stack_v2_sparse_classes_36k_train_034914 | 4,664 | permissive | [
{
"docstring": "The default constructor of the class Keyword arguments: self -- It signifies an instance of a class. Model -- the container of the different model parts. settings -- Kratos parameters containing solver settings.",
"name": "__init__",
"signature": "def __init__(self, Model, settings)"
}... | 2 | null | Implement the Python class `BasicMappingProcess` described below.
Class description:
This process allows to do a simple mapping using the SimpleMortarMapperProcess Only the member variables listed below should be accessed directly. Public member variables: Model -- the container of the different model parts. settings ... | Implement the Python class `BasicMappingProcess` described below.
Class description:
This process allows to do a simple mapping using the SimpleMortarMapperProcess Only the member variables listed below should be accessed directly. Public member variables: Model -- the container of the different model parts. settings ... | 366949ec4e3651702edc6ac3061d2988f10dd271 | <|skeleton|>
class BasicMappingProcess:
"""This process allows to do a simple mapping using the SimpleMortarMapperProcess Only the member variables listed below should be accessed directly. Public member variables: Model -- the container of the different model parts. settings -- Kratos parameters containing solver ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BasicMappingProcess:
"""This process allows to do a simple mapping using the SimpleMortarMapperProcess Only the member variables listed below should be accessed directly. Public member variables: Model -- the container of the different model parts. settings -- Kratos parameters containing solver settings."""
... | the_stack_v2_python_sparse | applications/ContactStructuralMechanicsApplication/python_scripts/basic_mapping_process.py | KratosMultiphysics/Kratos | train | 994 |
2cdf298354f63ff53b747717e968993477397f1b | [
"self._f = func\nself._callstyle = callstyle\nself._args = args\nself._kwargs = kwargs",
"if self._callstyle == 'plain':\n return self._f(args, *self._args, **self._kwargs)\nif self._callstyle == 'list':\n return self._f(*args, *self._args, **self._kwargs)\nreturn self._f(*self._args, **args, **self._kwargs... | <|body_start_0|>
self._f = func
self._callstyle = callstyle
self._args = args
self._kwargs = kwargs
<|end_body_0|>
<|body_start_1|>
if self._callstyle == 'plain':
return self._f(args, *self._args, **self._kwargs)
if self._callstyle == 'list':
retu... | Helper class to interpret arguments and call a function. | _FuncWrap | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _FuncWrap:
"""Helper class to interpret arguments and call a function."""
def __init__(self, func, callstyle, args, kwargs):
"""Create a function wrapper. @param func Function to use. @param callstyle Callstyle for invoking `func` (see parallel_compute()). @param args Positional argu... | stack_v2_sparse_classes_36k_train_034915 | 23,829 | permissive | [
{
"docstring": "Create a function wrapper. @param func Function to use. @param callstyle Callstyle for invoking `func` (see parallel_compute()). @param args Positional arguments for `func` (see parallel_compute()). @param kwargs Keyword arguments for `func` (see parallel_compute()).",
"name": "__init__",
... | 2 | stack_v2_sparse_classes_30k_train_012172 | Implement the Python class `_FuncWrap` described below.
Class description:
Helper class to interpret arguments and call a function.
Method signatures and docstrings:
- def __init__(self, func, callstyle, args, kwargs): Create a function wrapper. @param func Function to use. @param callstyle Callstyle for invoking `fu... | Implement the Python class `_FuncWrap` described below.
Class description:
Helper class to interpret arguments and call a function.
Method signatures and docstrings:
- def __init__(self, func, callstyle, args, kwargs): Create a function wrapper. @param func Function to use. @param callstyle Callstyle for invoking `fu... | 8c2eec174c755c55b26b568243e58c2956a35257 | <|skeleton|>
class _FuncWrap:
"""Helper class to interpret arguments and call a function."""
def __init__(self, func, callstyle, args, kwargs):
"""Create a function wrapper. @param func Function to use. @param callstyle Callstyle for invoking `func` (see parallel_compute()). @param args Positional argu... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class _FuncWrap:
"""Helper class to interpret arguments and call a function."""
def __init__(self, func, callstyle, args, kwargs):
"""Create a function wrapper. @param func Function to use. @param callstyle Callstyle for invoking `func` (see parallel_compute()). @param args Positional arguments for `fu... | the_stack_v2_python_sparse | motsfinder/utils.py | daniel-dpk/distorted-motsfinder-public | train | 4 |
02c384edbe10f3eb243f3ef56c90f36b17d24a08 | [
"self.buffer_queue = collections.deque()\nself.buffer_condition = threading.Condition()\nself.shutdown_event = threading.Event()\nself.writable_stream = _WritableStream(self.buffer_queue, self.buffer_condition, self.shutdown_event)\nself.readable_stream = _ReadableStream(self.buffer_queue, self.buffer_condition, se... | <|body_start_0|>
self.buffer_queue = collections.deque()
self.buffer_condition = threading.Condition()
self.shutdown_event = threading.Event()
self.writable_stream = _WritableStream(self.buffer_queue, self.buffer_condition, self.shutdown_event)
self.readable_stream = _ReadableStr... | Interface to a bidirectional buffer to read and write simultaneously. Attributes: buffer_queue (collections.deque): The underlying queue that acts like a buffer for the streams buffer_condition (threading.Condition): The condition object used for waiting based on the underlying buffer_queue state. All threads waiting o... | QueuingStream | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class QueuingStream:
"""Interface to a bidirectional buffer to read and write simultaneously. Attributes: buffer_queue (collections.deque): The underlying queue that acts like a buffer for the streams buffer_condition (threading.Condition): The condition object used for waiting based on the underlying ... | stack_v2_sparse_classes_36k_train_034916 | 17,228 | permissive | [
{
"docstring": "Intializes QueuingStream. Args: object_size (int): The size of the source object. progress_callback (progress_callbacks.FilesAndBytesProgressCallback): Accepts processed bytes and submits progress info for aggregation.",
"name": "__init__",
"signature": "def __init__(self, object_size=No... | 2 | null | Implement the Python class `QueuingStream` described below.
Class description:
Interface to a bidirectional buffer to read and write simultaneously. Attributes: buffer_queue (collections.deque): The underlying queue that acts like a buffer for the streams buffer_condition (threading.Condition): The condition object us... | Implement the Python class `QueuingStream` described below.
Class description:
Interface to a bidirectional buffer to read and write simultaneously. Attributes: buffer_queue (collections.deque): The underlying queue that acts like a buffer for the streams buffer_condition (threading.Condition): The condition object us... | 060174026ac068b6442b6c58bedf5adc7bc549cb | <|skeleton|>
class QueuingStream:
"""Interface to a bidirectional buffer to read and write simultaneously. Attributes: buffer_queue (collections.deque): The underlying queue that acts like a buffer for the streams buffer_condition (threading.Condition): The condition object used for waiting based on the underlying ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class QueuingStream:
"""Interface to a bidirectional buffer to read and write simultaneously. Attributes: buffer_queue (collections.deque): The underlying queue that acts like a buffer for the streams buffer_condition (threading.Condition): The condition object used for waiting based on the underlying buffer_queue ... | the_stack_v2_python_sparse | google-cloud-sdk/lib/googlecloudsdk/command_lib/storage/tasks/cp/daisy_chain_copy_task.py | salewski/google-cloud-sdk | train | 0 |
427971096bf304d0b6ebded2d4ced6eba2a2c625 | [
"self.post_script_status = post_script_status\nself.pre_script_status = pre_script_status\nself.restore_entity_vec = restore_entity_vec\nself.target_type = target_type\nself.mtype = mtype",
"if dictionary is None:\n return None\npost_script_status = cohesity_management_sdk.models.script_execution_status.Script... | <|body_start_0|>
self.post_script_status = post_script_status
self.pre_script_status = pre_script_status
self.restore_entity_vec = restore_entity_vec
self.target_type = target_type
self.mtype = mtype
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
retu... | Implementation of the 'RestoreInfoProto' model. Each available extension is listed below along with the location of the proto file (relative to magneto/connectors) where it is defined. The extension applies to both RestoreInfoProto as well as RestoreEntity. RestoreInfoProto extension Location Extension ================... | RestoreInfoProto | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RestoreInfoProto:
"""Implementation of the 'RestoreInfoProto' model. Each available extension is listed below along with the location of the proto file (relative to magneto/connectors) where it is defined. The extension applies to both RestoreInfoProto as well as RestoreEntity. RestoreInfoProto e... | stack_v2_sparse_classes_36k_train_034917 | 7,492 | permissive | [
{
"docstring": "Constructor for the RestoreInfoProto class",
"name": "__init__",
"signature": "def __init__(self, post_script_status=None, pre_script_status=None, restore_entity_vec=None, target_type=None, mtype=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: ... | 2 | null | Implement the Python class `RestoreInfoProto` described below.
Class description:
Implementation of the 'RestoreInfoProto' model. Each available extension is listed below along with the location of the proto file (relative to magneto/connectors) where it is defined. The extension applies to both RestoreInfoProto as we... | Implement the Python class `RestoreInfoProto` described below.
Class description:
Implementation of the 'RestoreInfoProto' model. Each available extension is listed below along with the location of the proto file (relative to magneto/connectors) where it is defined. The extension applies to both RestoreInfoProto as we... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class RestoreInfoProto:
"""Implementation of the 'RestoreInfoProto' model. Each available extension is listed below along with the location of the proto file (relative to magneto/connectors) where it is defined. The extension applies to both RestoreInfoProto as well as RestoreEntity. RestoreInfoProto e... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RestoreInfoProto:
"""Implementation of the 'RestoreInfoProto' model. Each available extension is listed below along with the location of the proto file (relative to magneto/connectors) where it is defined. The extension applies to both RestoreInfoProto as well as RestoreEntity. RestoreInfoProto extension Loca... | the_stack_v2_python_sparse | cohesity_management_sdk/models/restore_info_proto.py | cohesity/management-sdk-python | train | 24 |
95f286976c20dd29916355605479bf281a48d96b | [
"super().__init__()\nself.message = message\nself.error_code = error_code\nself.status_code = status_code\nself.return_msg = return_msg",
"response = {'error_code': self.error_code}\nif self.return_msg:\n response['msg'] = self.message\nreturn wrap_envelope(response)"
] | <|body_start_0|>
super().__init__()
self.message = message
self.error_code = error_code
self.status_code = status_code
self.return_msg = return_msg
<|end_body_0|>
<|body_start_1|>
response = {'error_code': self.error_code}
if self.return_msg:
response... | Error class intended to return flask response with error code. | ServiceError | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ServiceError:
"""Error class intended to return flask response with error code."""
def __init__(self, message, error_code, status_code=400, return_msg=False):
"""Constructor class."""
<|body_0|>
def to_dict(self):
"""Return data placed inside dictionary."""
... | stack_v2_sparse_classes_36k_train_034918 | 706 | no_license | [
{
"docstring": "Constructor class.",
"name": "__init__",
"signature": "def __init__(self, message, error_code, status_code=400, return_msg=False)"
},
{
"docstring": "Return data placed inside dictionary.",
"name": "to_dict",
"signature": "def to_dict(self)"
}
] | 2 | stack_v2_sparse_classes_30k_test_000424 | Implement the Python class `ServiceError` described below.
Class description:
Error class intended to return flask response with error code.
Method signatures and docstrings:
- def __init__(self, message, error_code, status_code=400, return_msg=False): Constructor class.
- def to_dict(self): Return data placed inside... | Implement the Python class `ServiceError` described below.
Class description:
Error class intended to return flask response with error code.
Method signatures and docstrings:
- def __init__(self, message, error_code, status_code=400, return_msg=False): Constructor class.
- def to_dict(self): Return data placed inside... | 83ff72c47b406ce7e5c5314109c90221a09e6a8c | <|skeleton|>
class ServiceError:
"""Error class intended to return flask response with error code."""
def __init__(self, message, error_code, status_code=400, return_msg=False):
"""Constructor class."""
<|body_0|>
def to_dict(self):
"""Return data placed inside dictionary."""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ServiceError:
"""Error class intended to return flask response with error code."""
def __init__(self, message, error_code, status_code=400, return_msg=False):
"""Constructor class."""
super().__init__()
self.message = message
self.error_code = error_code
self.statu... | the_stack_v2_python_sparse | microblog/commons/exceptions.py | artem-artiukhov/bym | train | 0 |
1a1f93f5eaf5336fd21f3d4f0efe3789cab1eed0 | [
"super().__init__(data, files, auto_id, prefix, initial, error_class, label_suffix, empty_permitted, instance, use_required_attribute, renderer)\nif instance is not None:\n self.fields['IsAHJOfficialOf'].initial = AHJUserMaintains.objects.filter(UserID=instance, MaintainerStatus=True).values_list('AHJPK', flat=T... | <|body_start_0|>
super().__init__(data, files, auto_id, prefix, initial, error_class, label_suffix, empty_permitted, instance, use_required_attribute, renderer)
if instance is not None:
self.fields['IsAHJOfficialOf'].initial = AHJUserMaintains.objects.filter(UserID=instance, MaintainerStatus... | Django User model admin change form with the 'IsAHJOfficialOf' field added. | UserChangeForm | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UserChangeForm:
"""Django User model admin change form with the 'IsAHJOfficialOf' field added."""
def __init__(self, data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=ErrorList, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None,... | stack_v2_sparse_classes_36k_train_034919 | 5,760 | permissive | [
{
"docstring": "Overridden to populate the 'IsAHJOfficialOf' field values.",
"name": "__init__",
"signature": "def __init__(self, data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=ErrorList, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None... | 2 | stack_v2_sparse_classes_30k_train_014951 | Implement the Python class `UserChangeForm` described below.
Class description:
Django User model admin change form with the 'IsAHJOfficialOf' field added.
Method signatures and docstrings:
- def __init__(self, data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=ErrorList, label_suffix=None... | Implement the Python class `UserChangeForm` described below.
Class description:
Django User model admin change form with the 'IsAHJOfficialOf' field added.
Method signatures and docstrings:
- def __init__(self, data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=ErrorList, label_suffix=None... | d4498bccfe114b19acca4f931d29f30fbc65a803 | <|skeleton|>
class UserChangeForm:
"""Django User model admin change form with the 'IsAHJOfficialOf' field added."""
def __init__(self, data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=ErrorList, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None,... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UserChangeForm:
"""Django User model admin change form with the 'IsAHJOfficialOf' field added."""
def __init__(self, data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=ErrorList, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None, renderer=Non... | the_stack_v2_python_sparse | server/ahj_app/admin/form.py | reepoi/ahj-registry | train | 0 |
3bc2609f8be36d772950982b3e4e7cd55da07a79 | [
"sTitle = 'Failure Category'\nif sMode == WuiFormContentBase.ksMode_Add:\n sTitle = 'Add ' + sTitle\nelif sMode == WuiFormContentBase.ksMode_Edit:\n sTitle = 'Edit ' + sTitle\nelse:\n assert sMode == WuiFormContentBase.ksMode_Show\nWuiFormContentBase.__init__(self, oData, sMode, 'FailureCategory', oDisp, s... | <|body_start_0|>
sTitle = 'Failure Category'
if sMode == WuiFormContentBase.ksMode_Add:
sTitle = 'Add ' + sTitle
elif sMode == WuiFormContentBase.ksMode_Edit:
sTitle = 'Edit ' + sTitle
else:
assert sMode == WuiFormContentBase.ksMode_Show
WuiFor... | WUI Failure Category HTML content generator. | WuiFailureCategory | [
"GPL-2.0-only",
"LicenseRef-scancode-unknown-license-reference",
"CDDL-1.0",
"LicenseRef-scancode-warranty-disclaimer",
"GPL-1.0-or-later",
"LGPL-2.1-or-later",
"GPL-2.0-or-later",
"MPL-1.0",
"LicenseRef-scancode-generic-exception",
"Apache-2.0",
"OpenSSL",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WuiFailureCategory:
"""WUI Failure Category HTML content generator."""
def __init__(self, oData, sMode, oDisp):
"""Prepare & initialize parent"""
<|body_0|>
def _populateForm(self, oForm, oData):
"""Construct an HTML form"""
<|body_1|>
def _generateP... | stack_v2_sparse_classes_36k_train_034920 | 6,511 | permissive | [
{
"docstring": "Prepare & initialize parent",
"name": "__init__",
"signature": "def __init__(self, oData, sMode, oDisp)"
},
{
"docstring": "Construct an HTML form",
"name": "_populateForm",
"signature": "def _populateForm(self, oForm, oData)"
},
{
"docstring": "Adds a table with ... | 3 | null | Implement the Python class `WuiFailureCategory` described below.
Class description:
WUI Failure Category HTML content generator.
Method signatures and docstrings:
- def __init__(self, oData, sMode, oDisp): Prepare & initialize parent
- def _populateForm(self, oForm, oData): Construct an HTML form
- def _generatePostF... | Implement the Python class `WuiFailureCategory` described below.
Class description:
WUI Failure Category HTML content generator.
Method signatures and docstrings:
- def __init__(self, oData, sMode, oDisp): Prepare & initialize parent
- def _populateForm(self, oForm, oData): Construct an HTML form
- def _generatePostF... | 6f78952d58da52ea4f0e55b2ab297f28e80c1160 | <|skeleton|>
class WuiFailureCategory:
"""WUI Failure Category HTML content generator."""
def __init__(self, oData, sMode, oDisp):
"""Prepare & initialize parent"""
<|body_0|>
def _populateForm(self, oForm, oData):
"""Construct an HTML form"""
<|body_1|>
def _generateP... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class WuiFailureCategory:
"""WUI Failure Category HTML content generator."""
def __init__(self, oData, sMode, oDisp):
"""Prepare & initialize parent"""
sTitle = 'Failure Category'
if sMode == WuiFormContentBase.ksMode_Add:
sTitle = 'Add ' + sTitle
elif sMode == WuiFo... | the_stack_v2_python_sparse | third_party/virtualbox/src/VBox/ValidationKit/testmanager/webui/wuiadminfailurecategory.py | thalium/icebox | train | 585 |
df5e449e66f4fbba5b53a337328cd36c35d5ca3b | [
"self.drive_id = drive_id\nself.drive_item_list = drive_item_list\nself.drive_name = drive_name\nself.restore_entire_drive = restore_entire_drive",
"if dictionary is None:\n return None\ndrive_id = dictionary.get('driveId')\ndrive_item_list = None\nif dictionary.get('driveItemList') != None:\n drive_item_li... | <|body_start_0|>
self.drive_id = drive_id
self.drive_item_list = drive_item_list
self.drive_name = drive_name
self.restore_entire_drive = restore_entire_drive
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
drive_id = dictionary.get('driveI... | Implementation of the 'SiteDriveInfo' model. Specifies the Site's Document Library drive info. Attributes: drive_id (string): Specifies the Id of the Drive. drive_item_list (list of SiteDriveItem): Specifies the Drive items such as files/folders. drive_name (string): Specifies the drive name for the document repsitory.... | SiteDriveInfo | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SiteDriveInfo:
"""Implementation of the 'SiteDriveInfo' model. Specifies the Site's Document Library drive info. Attributes: drive_id (string): Specifies the Id of the Drive. drive_item_list (list of SiteDriveItem): Specifies the Drive items such as files/folders. drive_name (string): Specifies t... | stack_v2_sparse_classes_36k_train_034921 | 2,772 | permissive | [
{
"docstring": "Constructor for the SiteDriveInfo class",
"name": "__init__",
"signature": "def __init__(self, drive_id=None, drive_item_list=None, drive_name=None, restore_entire_drive=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A... | 2 | null | Implement the Python class `SiteDriveInfo` described below.
Class description:
Implementation of the 'SiteDriveInfo' model. Specifies the Site's Document Library drive info. Attributes: drive_id (string): Specifies the Id of the Drive. drive_item_list (list of SiteDriveItem): Specifies the Drive items such as files/fo... | Implement the Python class `SiteDriveInfo` described below.
Class description:
Implementation of the 'SiteDriveInfo' model. Specifies the Site's Document Library drive info. Attributes: drive_id (string): Specifies the Id of the Drive. drive_item_list (list of SiteDriveItem): Specifies the Drive items such as files/fo... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class SiteDriveInfo:
"""Implementation of the 'SiteDriveInfo' model. Specifies the Site's Document Library drive info. Attributes: drive_id (string): Specifies the Id of the Drive. drive_item_list (list of SiteDriveItem): Specifies the Drive items such as files/folders. drive_name (string): Specifies t... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SiteDriveInfo:
"""Implementation of the 'SiteDriveInfo' model. Specifies the Site's Document Library drive info. Attributes: drive_id (string): Specifies the Id of the Drive. drive_item_list (list of SiteDriveItem): Specifies the Drive items such as files/folders. drive_name (string): Specifies the drive name... | the_stack_v2_python_sparse | cohesity_management_sdk/models/site_drive_info.py | cohesity/management-sdk-python | train | 24 |
d4a60558ff49afc1764f736a8bae9faf956303f9 | [
"if not nums:\n return False\nlow, high = (0, len(nums) - 1)\nwhile low <= high:\n mid = low + (high - low) // 2\n if nums[mid] == target:\n return True\n elif nums[mid] > target:\n high = mid - 1\n else:\n low = mid + 1\nreturn False",
"nums = []\nfor mat in matrix:\n nums.... | <|body_start_0|>
if not nums:
return False
low, high = (0, len(nums) - 1)
while low <= high:
mid = low + (high - low) // 2
if nums[mid] == target:
return True
elif nums[mid] > target:
high = mid - 1
else:... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def binary_search(self, nums, target):
"""二分查找 :param nums: :param target: :return:"""
<|body_0|>
def searchMatrix(self, matrix, target):
""":type matrix: List[List[int]] :type target: int :rtype: bool"""
<|body_1|>
<|end_skeleton|>
<|body_start_0... | stack_v2_sparse_classes_36k_train_034922 | 1,548 | no_license | [
{
"docstring": "二分查找 :param nums: :param target: :return:",
"name": "binary_search",
"signature": "def binary_search(self, nums, target)"
},
{
"docstring": ":type matrix: List[List[int]] :type target: int :rtype: bool",
"name": "searchMatrix",
"signature": "def searchMatrix(self, matrix,... | 2 | stack_v2_sparse_classes_30k_train_017912 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def binary_search(self, nums, target): 二分查找 :param nums: :param target: :return:
- def searchMatrix(self, matrix, target): :type matrix: List[List[int]] :type target: int :rtype:... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def binary_search(self, nums, target): 二分查找 :param nums: :param target: :return:
- def searchMatrix(self, matrix, target): :type matrix: List[List[int]] :type target: int :rtype:... | 3b13b36f37eb364410b3b5b4f10a1808d8b1111e | <|skeleton|>
class Solution:
def binary_search(self, nums, target):
"""二分查找 :param nums: :param target: :return:"""
<|body_0|>
def searchMatrix(self, matrix, target):
""":type matrix: List[List[int]] :type target: int :rtype: bool"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def binary_search(self, nums, target):
"""二分查找 :param nums: :param target: :return:"""
if not nums:
return False
low, high = (0, len(nums) - 1)
while low <= high:
mid = low + (high - low) // 2
if nums[mid] == target:
... | the_stack_v2_python_sparse | leetcode/74.py | yanggelinux/algorithm-data-structure | train | 0 | |
228823ebe3953dc99bfbd9e354247bfcc483f7fe | [
"self.center = 'median'\nself.scale = 'mad'\nself.trimming = 0",
"X = _check_input(X)\n_check_trimming(self.trimming)\nif type(self.center) is str:\n center = eval(self.center)\nelse:\n center = self.center\nif type(self.scale) is str:\n scale = eval(self.scale)\nelse:\n scale = self.scale\nn = X.shap... | <|body_start_0|>
self.center = 'median'
self.scale = 'mad'
self.trimming = 0
<|end_body_0|>
<|body_start_1|>
X = _check_input(X)
_check_trimming(self.trimming)
if type(self.center) is str:
center = eval(self.center)
else:
center = self.cen... | Wrapper Perform robustness inducing 'wrapping' transformation using optimal plugins and parameters from the literature Parameters ---------- Attributes ---------- Arguments for methods: - `X`: array-like, n x p, the data. Reference --------- Jakob Raymaekers & Peter J. Rousseeuw (2021), Fast Robust Correlation for High... | Wrapper | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Wrapper:
"""Wrapper Perform robustness inducing 'wrapping' transformation using optimal plugins and parameters from the literature Parameters ---------- Attributes ---------- Arguments for methods: - `X`: array-like, n x p, the data. Reference --------- Jakob Raymaekers & Peter J. Rousseeuw (2021... | stack_v2_sparse_classes_36k_train_034923 | 9,199 | permissive | [
{
"docstring": "Initialize values. Check if correct options provided.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Estimate location and scale, store these in the class object. Trimming fraction can be provided as keyword argument.",
"name": "fit",
"signatur... | 5 | stack_v2_sparse_classes_30k_train_001941 | Implement the Python class `Wrapper` described below.
Class description:
Wrapper Perform robustness inducing 'wrapping' transformation using optimal plugins and parameters from the literature Parameters ---------- Attributes ---------- Arguments for methods: - `X`: array-like, n x p, the data. Reference --------- Jako... | Implement the Python class `Wrapper` described below.
Class description:
Wrapper Perform robustness inducing 'wrapping' transformation using optimal plugins and parameters from the literature Parameters ---------- Attributes ---------- Arguments for methods: - `X`: array-like, n x p, the data. Reference --------- Jako... | 8b11800f11b9ccd852b24a449d4a82762e7dc811 | <|skeleton|>
class Wrapper:
"""Wrapper Perform robustness inducing 'wrapping' transformation using optimal plugins and parameters from the literature Parameters ---------- Attributes ---------- Arguments for methods: - `X`: array-like, n x p, the data. Reference --------- Jakob Raymaekers & Peter J. Rousseeuw (2021... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Wrapper:
"""Wrapper Perform robustness inducing 'wrapping' transformation using optimal plugins and parameters from the literature Parameters ---------- Attributes ---------- Arguments for methods: - `X`: array-like, n x p, the data. Reference --------- Jakob Raymaekers & Peter J. Rousseeuw (2021), Fast Robus... | the_stack_v2_python_sparse | src/direpack/preprocessing/robcent.py | SvenSerneels/direpack | train | 37 |
cf6dacbd65c8153924f5f096da51f6580d9f5b42 | [
"Graph.__init__(self, name)\nself.res_block_count = res_block_count\nself.res_block_relu = res_block_relu\nself.channel_count = channel_count\nself.instance_norm_affine = instance_norm_affine\nself.filter_counts = [intial_filter_count, intial_filter_count * 2, intial_filter_count * 4]",
"conv1 = ops.conv2d(input,... | <|body_start_0|>
Graph.__init__(self, name)
self.res_block_count = res_block_count
self.res_block_relu = res_block_relu
self.channel_count = channel_count
self.instance_norm_affine = instance_norm_affine
self.filter_counts = [intial_filter_count, intial_filter_count * 2, ... | Mapping base class for CycleGAN architecture. | Mapping | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Mapping:
"""Mapping base class for CycleGAN architecture."""
def __init__(self, name, res_block_count, res_block_relu, channel_count, intial_filter_count, instance_norm_affine):
"""Setter constructor. Arguments: name -- The name of the variable scope of the mapping's graph. res_block... | stack_v2_sparse_classes_36k_train_034924 | 20,875 | permissive | [
{
"docstring": "Setter constructor. Arguments: name -- The name of the variable scope of the mapping's graph. res_block_count -- The number of residual blocks to use. res_block_relu -- Whether residual blocks shall use ReLU activation on their output. channel_count -- The channel count of the target domain. ini... | 2 | stack_v2_sparse_classes_30k_train_021389 | Implement the Python class `Mapping` described below.
Class description:
Mapping base class for CycleGAN architecture.
Method signatures and docstrings:
- def __init__(self, name, res_block_count, res_block_relu, channel_count, intial_filter_count, instance_norm_affine): Setter constructor. Arguments: name -- The nam... | Implement the Python class `Mapping` described below.
Class description:
Mapping base class for CycleGAN architecture.
Method signatures and docstrings:
- def __init__(self, name, res_block_count, res_block_relu, channel_count, intial_filter_count, instance_norm_affine): Setter constructor. Arguments: name -- The nam... | 181f794a7c31311ab4cb9b76df5f1ab3bc6ef64d | <|skeleton|>
class Mapping:
"""Mapping base class for CycleGAN architecture."""
def __init__(self, name, res_block_count, res_block_relu, channel_count, intial_filter_count, instance_norm_affine):
"""Setter constructor. Arguments: name -- The name of the variable scope of the mapping's graph. res_block... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Mapping:
"""Mapping base class for CycleGAN architecture."""
def __init__(self, name, res_block_count, res_block_relu, channel_count, intial_filter_count, instance_norm_affine):
"""Setter constructor. Arguments: name -- The name of the variable scope of the mapping's graph. res_block_count -- The... | the_stack_v2_python_sparse | code/cyclegan/model/architecture.py | Sirius291/trafficsign-cyclegan | train | 0 |
17f58f5126e58400182a529f0e660be98b5b6968 | [
"filetime_map = self._GetDataTypeMap('filetime')\ntry:\n filetime = self._ReadStructureFromByteStream(byte_stream, 0, filetime_map)\nexcept (ValueError, errors.ParseError) as exception:\n raise errors.ParseError('Unable to parse FILETIME value with error: {0!s}'.format(exception))\nif filetime == 0:\n retu... | <|body_start_0|>
filetime_map = self._GetDataTypeMap('filetime')
try:
filetime = self._ReadStructureFromByteStream(byte_stream, 0, filetime_map)
except (ValueError, errors.ParseError) as exception:
raise errors.ParseError('Unable to parse FILETIME value with error: {0!s}'... | Windows Registry plugin for parsing the last shutdown time of a system. | ShutdownWindowsRegistryPlugin | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ShutdownWindowsRegistryPlugin:
"""Windows Registry plugin for parsing the last shutdown time of a system."""
def _ParseFiletime(self, byte_stream):
"""Parses a FILETIME date and time value from a byte stream. Args: byte_stream (bytes): byte stream. Returns: dfdatetime.DateTimeValues:... | stack_v2_sparse_classes_36k_train_034925 | 3,695 | permissive | [
{
"docstring": "Parses a FILETIME date and time value from a byte stream. Args: byte_stream (bytes): byte stream. Returns: dfdatetime.DateTimeValues: a FILETIME date and time values or a semantic date and time values if the FILETIME date and time value is not set. Raises: ParseError: if the FILETIME could not b... | 2 | null | Implement the Python class `ShutdownWindowsRegistryPlugin` described below.
Class description:
Windows Registry plugin for parsing the last shutdown time of a system.
Method signatures and docstrings:
- def _ParseFiletime(self, byte_stream): Parses a FILETIME date and time value from a byte stream. Args: byte_stream ... | Implement the Python class `ShutdownWindowsRegistryPlugin` described below.
Class description:
Windows Registry plugin for parsing the last shutdown time of a system.
Method signatures and docstrings:
- def _ParseFiletime(self, byte_stream): Parses a FILETIME date and time value from a byte stream. Args: byte_stream ... | d6022f8cfebfddf2d08ab2d300a41b61f3349933 | <|skeleton|>
class ShutdownWindowsRegistryPlugin:
"""Windows Registry plugin for parsing the last shutdown time of a system."""
def _ParseFiletime(self, byte_stream):
"""Parses a FILETIME date and time value from a byte stream. Args: byte_stream (bytes): byte stream. Returns: dfdatetime.DateTimeValues:... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ShutdownWindowsRegistryPlugin:
"""Windows Registry plugin for parsing the last shutdown time of a system."""
def _ParseFiletime(self, byte_stream):
"""Parses a FILETIME date and time value from a byte stream. Args: byte_stream (bytes): byte stream. Returns: dfdatetime.DateTimeValues: a FILETIME d... | the_stack_v2_python_sparse | plaso/parsers/winreg_plugins/shutdown.py | log2timeline/plaso | train | 1,506 |
4853ea95bc81ee4cc1203e9336bad8b5e990d1c3 | [
"if bool(data) is True:\n self._nodes = data['data']['allAgentXlate']['edges']\nelse:\n self._nodes = []",
"result = []\nfor item in self._nodes:\n result.append(AgentXlate(item))\nreturn result"
] | <|body_start_0|>
if bool(data) is True:
self._nodes = data['data']['allAgentXlate']['edges']
else:
self._nodes = []
<|end_body_0|>
<|body_start_1|>
result = []
for item in self._nodes:
result.append(AgentXlate(item))
return result
<|end_body_1... | Class to process the results of the GraphQL query below. { allAgentXlate { edges { node { id agentProgram translation language { code } } } } } | AgentXlates | [
"GPL-3.0-only"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AgentXlates:
"""Class to process the results of the GraphQL query below. { allAgentXlate { edges { node { id agentProgram translation language { code } } } } }"""
def __init__(self, data):
"""Initialize the class. Args: data: Dict of results from the GraphQL query Returns: None"""
... | stack_v2_sparse_classes_36k_train_034926 | 3,992 | permissive | [
{
"docstring": "Initialize the class. Args: data: Dict of results from the GraphQL query Returns: None",
"name": "__init__",
"signature": "def __init__(self, data)"
},
{
"docstring": "Return a list of AgentXlate objects. Args: None Returns: result: List of AgentXlate objects",
"name": "agent... | 2 | stack_v2_sparse_classes_30k_val_000632 | Implement the Python class `AgentXlates` described below.
Class description:
Class to process the results of the GraphQL query below. { allAgentXlate { edges { node { id agentProgram translation language { code } } } } }
Method signatures and docstrings:
- def __init__(self, data): Initialize the class. Args: data: D... | Implement the Python class `AgentXlates` described below.
Class description:
Class to process the results of the GraphQL query below. { allAgentXlate { edges { node { id agentProgram translation language { code } } } } }
Method signatures and docstrings:
- def __init__(self, data): Initialize the class. Args: data: D... | 390c7cb687ba46aee1bbb5764cce01fec0d662fb | <|skeleton|>
class AgentXlates:
"""Class to process the results of the GraphQL query below. { allAgentXlate { edges { node { id agentProgram translation language { code } } } } }"""
def __init__(self, data):
"""Initialize the class. Args: data: Dict of results from the GraphQL query Returns: None"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AgentXlates:
"""Class to process the results of the GraphQL query below. { allAgentXlate { edges { node { id agentProgram translation language { code } } } } }"""
def __init__(self, data):
"""Initialize the class. Args: data: Dict of results from the GraphQL query Returns: None"""
if bool... | the_stack_v2_python_sparse | pattoo_web/web/query/agent_xlate.py | palisadoes/pattoo-web | train | 0 |
c8df972ee3f6167ef4a1a3ca7633505f33ae8580 | [
"AbstractInitializer.__init__(self, n_in=0, n_out=None, problem=problem)\nself.terminal_list = self._get_terminal_list()\nPopulationOperator.__init__(self, 0, len(self.terminal_list))",
"def make_node(func_id):\n new_node = node.Node()\n node.set_id(new_node, func_id)\n return new_node\npopulation = [sol... | <|body_start_0|>
AbstractInitializer.__init__(self, n_in=0, n_out=None, problem=problem)
self.terminal_list = self._get_terminal_list()
PopulationOperator.__init__(self, 0, len(self.terminal_list))
<|end_body_0|>
<|body_start_1|>
def make_node(func_id):
new_node = node.Node(... | Generate all solutions which have an only terminal node. | PopulationTerminalInitializer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PopulationTerminalInitializer:
"""Generate all solutions which have an only terminal node."""
def __init__(self, problem):
""":param k: int. the number of solutions to generate :param problem: problem object. problem to solve"""
<|body_0|>
def __call__(self):
"""... | stack_v2_sparse_classes_36k_train_034927 | 5,247 | permissive | [
{
"docstring": ":param k: int. the number of solutions to generate :param problem: problem object. problem to solve",
"name": "__init__",
"signature": "def __init__(self, problem)"
},
{
"docstring": "Generate all solutions which have an only terminal node. :return: list of solution object. list ... | 2 | stack_v2_sparse_classes_30k_train_004981 | Implement the Python class `PopulationTerminalInitializer` described below.
Class description:
Generate all solutions which have an only terminal node.
Method signatures and docstrings:
- def __init__(self, problem): :param k: int. the number of solutions to generate :param problem: problem object. problem to solve
-... | Implement the Python class `PopulationTerminalInitializer` described below.
Class description:
Generate all solutions which have an only terminal node.
Method signatures and docstrings:
- def __init__(self, problem): :param k: int. the number of solutions to generate :param problem: problem object. problem to solve
-... | 33a2b83bebc61f28449bffa28c87c9013e764ec7 | <|skeleton|>
class PopulationTerminalInitializer:
"""Generate all solutions which have an only terminal node."""
def __init__(self, problem):
""":param k: int. the number of solutions to generate :param problem: problem object. problem to solve"""
<|body_0|>
def __call__(self):
"""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PopulationTerminalInitializer:
"""Generate all solutions which have an only terminal node."""
def __init__(self, problem):
""":param k: int. the number of solutions to generate :param problem: problem object. problem to solve"""
AbstractInitializer.__init__(self, n_in=0, n_out=None, probl... | the_stack_v2_python_sparse | onegpy/operators/initializer.py | hiro-o918/onegpy | train | 0 |
6806e0d3dcfae4849b8586447c1c77d7c28763f6 | [
"exp_value = 42\nicpw_obj = Int64(exp_value)\nself.assertEqual(exp_value, icpw_obj.icpw_value)",
"exp_value = 84\nobj0 = Int64(exp_value)\nobj1 = Int64(exp_value)\nself.assertEqual(obj0, obj1)",
"exp_value = 84\nobj0 = Int64(exp_value)\nobj1 = Int64(2 * exp_value + 1)\nself.assertNotEqual(obj0, obj1)",
"exp_v... | <|body_start_0|>
exp_value = 42
icpw_obj = Int64(exp_value)
self.assertEqual(exp_value, icpw_obj.icpw_value)
<|end_body_0|>
<|body_start_1|>
exp_value = 84
obj0 = Int64(exp_value)
obj1 = Int64(exp_value)
self.assertEqual(obj0, obj1)
<|end_body_1|>
<|body_start_2... | Int64Tester | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Int64Tester:
def test_value(self):
"""Test retrieving the value of an Int64."""
<|body_0|>
def test_eq(self):
"""Test that two Int64's with the same value compare equal."""
<|body_1|>
def test_ne(self):
"""Test that two Int64's with different val... | stack_v2_sparse_classes_36k_train_034928 | 42,194 | permissive | [
{
"docstring": "Test retrieving the value of an Int64.",
"name": "test_value",
"signature": "def test_value(self)"
},
{
"docstring": "Test that two Int64's with the same value compare equal.",
"name": "test_eq",
"signature": "def test_eq(self)"
},
{
"docstring": "Test that two In... | 5 | stack_v2_sparse_classes_30k_train_015213 | Implement the Python class `Int64Tester` described below.
Class description:
Implement the Int64Tester class.
Method signatures and docstrings:
- def test_value(self): Test retrieving the value of an Int64.
- def test_eq(self): Test that two Int64's with the same value compare equal.
- def test_ne(self): Test that tw... | Implement the Python class `Int64Tester` described below.
Class description:
Implement the Int64Tester class.
Method signatures and docstrings:
- def test_value(self): Test retrieving the value of an Int64.
- def test_eq(self): Test that two Int64's with the same value compare equal.
- def test_ne(self): Test that tw... | a626f881d55c307bd857d0ff980cc526f2b18de2 | <|skeleton|>
class Int64Tester:
def test_value(self):
"""Test retrieving the value of an Int64."""
<|body_0|>
def test_eq(self):
"""Test that two Int64's with the same value compare equal."""
<|body_1|>
def test_ne(self):
"""Test that two Int64's with different val... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Int64Tester:
def test_value(self):
"""Test retrieving the value of an Int64."""
exp_value = 42
icpw_obj = Int64(exp_value)
self.assertEqual(exp_value, icpw_obj.icpw_value)
def test_eq(self):
"""Test that two Int64's with the same value compare equal."""
exp... | the_stack_v2_python_sparse | icypaw/test_types.py | sandialabs/IcyPaw | train | 0 | |
ee6475f54db8beec0ada304b22068b11ad606c88 | [
"if ui_test_task_id == '':\n return response_failed({'status': 10102, 'message': 'ui_test_task_id不能为空'})\nr = UITestResult.objects.filter(ui_task_id=ui_test_task_id)\ndata = []\nfor i in r:\n result = {'id': i.id, 'ui_test_result_name': i.ui_test_result_name, 'ui_error_total_number': i.ui_error_total_number, ... | <|body_start_0|>
if ui_test_task_id == '':
return response_failed({'status': 10102, 'message': 'ui_test_task_id不能为空'})
r = UITestResult.objects.filter(ui_task_id=ui_test_task_id)
data = []
for i in r:
result = {'id': i.id, 'ui_test_result_name': i.ui_test_result_n... | CheckResultList | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CheckResultList:
def get(self, request, ui_test_task_id, *args, **kwargs):
"""查看测试报告列表 :param request: :param ui_test_task_id: :param args: :param kwargs: :return:"""
<|body_0|>
def delete(self, request, ui_test_task_id, ui_test_result_id, *args, **kwargs):
"""删除单独测试... | stack_v2_sparse_classes_36k_train_034929 | 13,627 | no_license | [
{
"docstring": "查看测试报告列表 :param request: :param ui_test_task_id: :param args: :param kwargs: :return:",
"name": "get",
"signature": "def get(self, request, ui_test_task_id, *args, **kwargs)"
},
{
"docstring": "删除单独测试报告列表 :param ui_test_result_id: :param request: :param ui_test_task_id: :param ar... | 2 | null | Implement the Python class `CheckResultList` described below.
Class description:
Implement the CheckResultList class.
Method signatures and docstrings:
- def get(self, request, ui_test_task_id, *args, **kwargs): 查看测试报告列表 :param request: :param ui_test_task_id: :param args: :param kwargs: :return:
- def delete(self, r... | Implement the Python class `CheckResultList` described below.
Class description:
Implement the CheckResultList class.
Method signatures and docstrings:
- def get(self, request, ui_test_task_id, *args, **kwargs): 查看测试报告列表 :param request: :param ui_test_task_id: :param args: :param kwargs: :return:
- def delete(self, r... | 730bbb7a048e0f41a2fb61c8cdf554bcc2bd042c | <|skeleton|>
class CheckResultList:
def get(self, request, ui_test_task_id, *args, **kwargs):
"""查看测试报告列表 :param request: :param ui_test_task_id: :param args: :param kwargs: :return:"""
<|body_0|>
def delete(self, request, ui_test_task_id, ui_test_result_id, *args, **kwargs):
"""删除单独测试... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CheckResultList:
def get(self, request, ui_test_task_id, *args, **kwargs):
"""查看测试报告列表 :param request: :param ui_test_task_id: :param args: :param kwargs: :return:"""
if ui_test_task_id == '':
return response_failed({'status': 10102, 'message': 'ui_test_task_id不能为空'})
r = U... | the_stack_v2_python_sparse | automated_main/view/ui_automation/ui_test_task/ui_test_task_view.py | a877429929/TestPlatformDjango | train | 0 | |
c2c14fbf479e1fd26b13d01f6dbcdb700dcadcc1 | [
"self.dataset = dataset\nself.seen_images = seen_images\nself.n = DatasetConfigManager.n(dataset)\nself.outstanding_suggs = []",
"suggs_confidences = [None for i in range(n_suggs)]\nsuggs_conf_colors = [None for i in range(n_suggs)]\nif refresh:\n suggs_images = []\n n_new_rand_exp = n_suggs\nelse:\n sug... | <|body_start_0|>
self.dataset = dataset
self.seen_images = seen_images
self.n = DatasetConfigManager.n(dataset)
self.outstanding_suggs = []
<|end_body_0|>
<|body_start_1|>
suggs_confidences = [None for i in range(n_suggs)]
suggs_conf_colors = [None for i in range(n_suggs... | Randomized explorer covers the exploration side of the exploration-search axis. It utilizes the collection index to find images that are furthest from what was seen by the model previously, such that the user does not linger in any one semantic region of the collection for too long. Keeps state, i.e., will keep returni... | RandomizedExplorer | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RandomizedExplorer:
"""Randomized explorer covers the exploration side of the exploration-search axis. It utilizes the collection index to find images that are furthest from what was seen by the model previously, such that the user does not linger in any one semantic region of the collection for ... | stack_v2_sparse_classes_36k_train_034930 | 4,564 | permissive | [
{
"docstring": "Constructor. Parameters ---------- dataset : str The name of the dataset. seen_images : aimodel.SeenImages The images seen by the model during the analytic session.",
"name": "__init__",
"signature": "def __init__(self, dataset, seen_images)"
},
{
"docstring": "Suggest random ima... | 2 | stack_v2_sparse_classes_30k_train_006401 | Implement the Python class `RandomizedExplorer` described below.
Class description:
Randomized explorer covers the exploration side of the exploration-search axis. It utilizes the collection index to find images that are furthest from what was seen by the model previously, such that the user does not linger in any one... | Implement the Python class `RandomizedExplorer` described below.
Class description:
Randomized explorer covers the exploration side of the exploration-search axis. It utilizes the collection index to find images that are furthest from what was seen by the model previously, such that the user does not linger in any one... | 606e685aff7097ff0e24272263d0b1fabc79bb1d | <|skeleton|>
class RandomizedExplorer:
"""Randomized explorer covers the exploration side of the exploration-search axis. It utilizes the collection index to find images that are furthest from what was seen by the model previously, such that the user does not linger in any one semantic region of the collection for ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RandomizedExplorer:
"""Randomized explorer covers the exploration side of the exploration-search axis. It utilizes the collection index to find images that are furthest from what was seen by the model previously, such that the user does not linger in any one semantic region of the collection for too long. Kee... | the_stack_v2_python_sparse | ii20/aimodel/RandomizedExplorer.py | JanZahalka/ii20 | train | 1 |
8f437a8cd3fc1c47e4d774db61c78cfb4699055d | [
"req = '/api/streams/status'\ndata, _ = self._get_json(req, timeout)\nout = {int(s_id): {key: bf_codecs.ZoneStatus.from_dict(val) for key, val in statuses.items()} for s_id, statuses in data.items()}\nreturn out",
"req = '/api/streams/statuses'\n\ndef zone_status_iterator():\n resp = self._get(req, timeout=tim... | <|body_start_0|>
req = '/api/streams/status'
data, _ = self._get_json(req, timeout)
out = {int(s_id): {key: bf_codecs.ZoneStatus.from_dict(val) for key, val in statuses.items()} for s_id, statuses in data.items()}
return out
<|end_body_0|>
<|body_start_1|>
req = '/api/streams/st... | Provides stubs for calling APIs to get zone statuses. | ZoneStatusStubMixin | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ZoneStatusStubMixin:
"""Provides stubs for calling APIs to get zone statuses."""
def get_latest_zone_statuses(self, timeout=DEFAULT_TIMEOUT) -> ZONE_STATUS_TYPE:
"""This method gets all of the latest processed zone statuses for every zone and for every stream. All active streams will... | stack_v2_sparse_classes_36k_train_034931 | 3,275 | permissive | [
{
"docstring": "This method gets all of the latest processed zone statuses for every zone and for every stream. All active streams will have a key in the output dict. :param timeout: The timeout to use for this request :return: A dict whose keys are stream IDs and whose value is another dict. This nested dict's... | 2 | stack_v2_sparse_classes_30k_train_003519 | Implement the Python class `ZoneStatusStubMixin` described below.
Class description:
Provides stubs for calling APIs to get zone statuses.
Method signatures and docstrings:
- def get_latest_zone_statuses(self, timeout=DEFAULT_TIMEOUT) -> ZONE_STATUS_TYPE: This method gets all of the latest processed zone statuses for... | Implement the Python class `ZoneStatusStubMixin` described below.
Class description:
Provides stubs for calling APIs to get zone statuses.
Method signatures and docstrings:
- def get_latest_zone_statuses(self, timeout=DEFAULT_TIMEOUT) -> ZONE_STATUS_TYPE: This method gets all of the latest processed zone statuses for... | 7f8d36d39a4c6c052c7d0915ba266d5168d81b8d | <|skeleton|>
class ZoneStatusStubMixin:
"""Provides stubs for calling APIs to get zone statuses."""
def get_latest_zone_statuses(self, timeout=DEFAULT_TIMEOUT) -> ZONE_STATUS_TYPE:
"""This method gets all of the latest processed zone statuses for every zone and for every stream. All active streams will... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ZoneStatusStubMixin:
"""Provides stubs for calling APIs to get zone statuses."""
def get_latest_zone_statuses(self, timeout=DEFAULT_TIMEOUT) -> ZONE_STATUS_TYPE:
"""This method gets all of the latest processed zone statuses for every zone and for every stream. All active streams will have a key i... | the_stack_v2_python_sparse | brainframe/api/stubs/zone_statuses.py | corner4world/brainframe-python | train | 0 |
f0fdc703bec438b7888bd3eda6197aa328da1791 | [
"props = registry.properties()\nserializer = PropertySerializer(props)\nreturn Response(serializer.data)",
"props = registry.properties(model=pk)\nif not props:\n raise Http404\nserializer = PropertySerializer(props)\nreturn Response(serializer.data)"
] | <|body_start_0|>
props = registry.properties()
serializer = PropertySerializer(props)
return Response(serializer.data)
<|end_body_0|>
<|body_start_1|>
props = registry.properties(model=pk)
if not props:
raise Http404
serializer = PropertySerializer(props)
... | Viewset around model properties. | PropertyViewSet | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PropertyViewSet:
"""Viewset around model properties."""
def list(self, request, model=None):
"""List all properties models."""
<|body_0|>
def retrieve(self, request, pk=None):
"""List all properties for a specific model."""
<|body_1|>
<|end_skeleton|>
<... | stack_v2_sparse_classes_36k_train_034932 | 9,625 | permissive | [
{
"docstring": "List all properties models.",
"name": "list",
"signature": "def list(self, request, model=None)"
},
{
"docstring": "List all properties for a specific model.",
"name": "retrieve",
"signature": "def retrieve(self, request, pk=None)"
}
] | 2 | stack_v2_sparse_classes_30k_val_000977 | Implement the Python class `PropertyViewSet` described below.
Class description:
Viewset around model properties.
Method signatures and docstrings:
- def list(self, request, model=None): List all properties models.
- def retrieve(self, request, pk=None): List all properties for a specific model. | Implement the Python class `PropertyViewSet` described below.
Class description:
Viewset around model properties.
Method signatures and docstrings:
- def list(self, request, model=None): List all properties models.
- def retrieve(self, request, pk=None): List all properties for a specific model.
<|skeleton|>
class P... | aaab76706c8268d3ff3e87c275baee9dd4714314 | <|skeleton|>
class PropertyViewSet:
"""Viewset around model properties."""
def list(self, request, model=None):
"""List all properties models."""
<|body_0|>
def retrieve(self, request, pk=None):
"""List all properties for a specific model."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PropertyViewSet:
"""Viewset around model properties."""
def list(self, request, model=None):
"""List all properties models."""
props = registry.properties()
serializer = PropertySerializer(props)
return Response(serializer.data)
def retrieve(self, request, pk=None):
... | the_stack_v2_python_sparse | web/api/views.py | rcbops/FleetDeploymentReporting | train | 1 |
6127bb0e1cb8fb0b227e8c6ed23e6b16dfeaa9bd | [
"res = []\nfor val in findNums:\n index = nums.index(val)\n flag = 1\n for i in range(index + 1, len(nums)):\n if nums[i] > val:\n res.append(nums[i])\n flag = 0\n break\n if flag:\n res.append(-1)\nreturn res",
"dict = {}\nstack = []\nfor i in range(len(... | <|body_start_0|>
res = []
for val in findNums:
index = nums.index(val)
flag = 1
for i in range(index + 1, len(nums)):
if nums[i] > val:
res.append(nums[i])
flag = 0
break
if flag:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def nextGreaterElement(self, findNums, nums):
""":type findNums: List[int] :type nums: List[int] :rtype: List[int]"""
<|body_0|>
def nextGreaterElement2(self, findNums, nums):
""":type findNums: List[int] :type nums: List[int] :rtype: List[int]"""
<... | stack_v2_sparse_classes_36k_train_034933 | 1,343 | no_license | [
{
"docstring": ":type findNums: List[int] :type nums: List[int] :rtype: List[int]",
"name": "nextGreaterElement",
"signature": "def nextGreaterElement(self, findNums, nums)"
},
{
"docstring": ":type findNums: List[int] :type nums: List[int] :rtype: List[int]",
"name": "nextGreaterElement2",
... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def nextGreaterElement(self, findNums, nums): :type findNums: List[int] :type nums: List[int] :rtype: List[int]
- def nextGreaterElement2(self, findNums, nums): :type findNums: L... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def nextGreaterElement(self, findNums, nums): :type findNums: List[int] :type nums: List[int] :rtype: List[int]
- def nextGreaterElement2(self, findNums, nums): :type findNums: L... | 0fc4c7af59246e3064db41989a45d9db413a624b | <|skeleton|>
class Solution:
def nextGreaterElement(self, findNums, nums):
""":type findNums: List[int] :type nums: List[int] :rtype: List[int]"""
<|body_0|>
def nextGreaterElement2(self, findNums, nums):
""":type findNums: List[int] :type nums: List[int] :rtype: List[int]"""
<... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def nextGreaterElement(self, findNums, nums):
""":type findNums: List[int] :type nums: List[int] :rtype: List[int]"""
res = []
for val in findNums:
index = nums.index(val)
flag = 1
for i in range(index + 1, len(nums)):
if nu... | the_stack_v2_python_sparse | 496. Next Greater Element I/greater.py | Macielyoung/LeetCode | train | 1 | |
7fd786262736908d252864d31fe99c865f46d97b | [
"try:\n t = u'本地'\n self.assertEqual(t, self.app.back_app())\n print('退出app正确')\nexcept Exception as e:\n print('退出app失败')",
"try:\n t = u'QQ音乐'\n self.assertEqual(t, self.app.OpenAPP())\n print('进入app正确')\nexcept Exception as e:\n print('进入app失败')"
] | <|body_start_0|>
try:
t = u'本地'
self.assertEqual(t, self.app.back_app())
print('退出app正确')
except Exception as e:
print('退出app失败')
<|end_body_0|>
<|body_start_1|>
try:
t = u'QQ音乐'
self.assertEqual(t, self.app.OpenAPP())
... | Test_open_close_app | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Test_open_close_app:
def test_close_app(self):
"""关闭app"""
<|body_0|>
def test_open_app(self):
"""打开app"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
try:
t = u'本地'
self.assertEqual(t, self.app.back_app())
print... | stack_v2_sparse_classes_36k_train_034934 | 997 | no_license | [
{
"docstring": "关闭app",
"name": "test_close_app",
"signature": "def test_close_app(self)"
},
{
"docstring": "打开app",
"name": "test_open_app",
"signature": "def test_open_app(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_005139 | Implement the Python class `Test_open_close_app` described below.
Class description:
Implement the Test_open_close_app class.
Method signatures and docstrings:
- def test_close_app(self): 关闭app
- def test_open_app(self): 打开app | Implement the Python class `Test_open_close_app` described below.
Class description:
Implement the Test_open_close_app class.
Method signatures and docstrings:
- def test_close_app(self): 关闭app
- def test_open_app(self): 打开app
<|skeleton|>
class Test_open_close_app:
def test_close_app(self):
"""关闭app"""... | 2c8b1cfa3c0ead8995578ba5eee2e496bba01be1 | <|skeleton|>
class Test_open_close_app:
def test_close_app(self):
"""关闭app"""
<|body_0|>
def test_open_app(self):
"""打开app"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Test_open_close_app:
def test_close_app(self):
"""关闭app"""
try:
t = u'本地'
self.assertEqual(t, self.app.back_app())
print('退出app正确')
except Exception as e:
print('退出app失败')
def test_open_app(self):
"""打开app"""
try:
... | the_stack_v2_python_sparse | CarNavigation_Test/Project/Music_CarNavigation/Test_Case/test_RunAPP.py | zhangyuanzhou900408/Test | train | 2 | |
fe0d5bdea9e7abdf781783893fd99c1acef4ac1d | [
"super(StochFCDecoder, self).__init__()\nself.num_layers = len(dec_layer_size)\nself.dec_layer_size = dec_layer_size\nself.pixel_max = pixel_max\nself.pixel_min = pixel_min\nfor layer in range(self.num_layers - 1):\n self.__setattr__('linear' + str(layer + 1), nn.Linear(self.dec_layer_size[layer], self.dec_layer... | <|body_start_0|>
super(StochFCDecoder, self).__init__()
self.num_layers = len(dec_layer_size)
self.dec_layer_size = dec_layer_size
self.pixel_max = pixel_max
self.pixel_min = pixel_min
for layer in range(self.num_layers - 1):
self.__setattr__('linear' + str(la... | StochFCDecoder | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StochFCDecoder:
def __init__(self, dec_layer_size, pixel_min, pixel_max):
"""Input Args: dec_size: Number of units in each layer of the decoder"""
<|body_0|>
def forward(self, input, noise, target_size):
"""target_size will have dim 0 as batch_size output should be s... | stack_v2_sparse_classes_36k_train_034935 | 10,873 | no_license | [
{
"docstring": "Input Args: dec_size: Number of units in each layer of the decoder",
"name": "__init__",
"signature": "def __init__(self, dec_layer_size, pixel_min, pixel_max)"
},
{
"docstring": "target_size will have dim 0 as batch_size output should be such that dim 1 is num_samples and all ot... | 2 | stack_v2_sparse_classes_30k_train_009171 | Implement the Python class `StochFCDecoder` described below.
Class description:
Implement the StochFCDecoder class.
Method signatures and docstrings:
- def __init__(self, dec_layer_size, pixel_min, pixel_max): Input Args: dec_size: Number of units in each layer of the decoder
- def forward(self, input, noise, target_... | Implement the Python class `StochFCDecoder` described below.
Class description:
Implement the StochFCDecoder class.
Method signatures and docstrings:
- def __init__(self, dec_layer_size, pixel_min, pixel_max): Input Args: dec_size: Number of units in each layer of the decoder
- def forward(self, input, noise, target_... | ca6f291761d7559b957575c030f06ca6ae0017d2 | <|skeleton|>
class StochFCDecoder:
def __init__(self, dec_layer_size, pixel_min, pixel_max):
"""Input Args: dec_size: Number of units in each layer of the decoder"""
<|body_0|>
def forward(self, input, noise, target_size):
"""target_size will have dim 0 as batch_size output should be s... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class StochFCDecoder:
def __init__(self, dec_layer_size, pixel_min, pixel_max):
"""Input Args: dec_size: Number of units in each layer of the decoder"""
super(StochFCDecoder, self).__init__()
self.num_layers = len(dec_layer_size)
self.dec_layer_size = dec_layer_size
self.pixe... | the_stack_v2_python_sparse | prednet/stochastic/models/models.py | yaminibansal/pytorchprednet | train | 0 | |
06d866435b74e5dfea0aca96fcfae7a71920d3cb | [
"self.dic = dict()\nfor s, t in zip(sentences, times):\n node = self.dic\n for ch in s:\n if ch not in node:\n node[ch] = dict()\n node = node[ch]\n node['time'] = t\n node = self.dic\n for ch in s:\n node = node[ch]\n if 'links' not in node:\n node['... | <|body_start_0|>
self.dic = dict()
for s, t in zip(sentences, times):
node = self.dic
for ch in s:
if ch not in node:
node[ch] = dict()
node = node[ch]
node['time'] = t
node = self.dic
for ch ... | AutocompleteSystem | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AutocompleteSystem:
def __init__(self, sentences, times):
""":type sentences: List[str] :type times: List[int]"""
<|body_0|>
def input(self, c):
""":type c: str :rtype: List[str]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.dic = dict()
... | stack_v2_sparse_classes_36k_train_034936 | 2,136 | no_license | [
{
"docstring": ":type sentences: List[str] :type times: List[int]",
"name": "__init__",
"signature": "def __init__(self, sentences, times)"
},
{
"docstring": ":type c: str :rtype: List[str]",
"name": "input",
"signature": "def input(self, c)"
}
] | 2 | null | Implement the Python class `AutocompleteSystem` described below.
Class description:
Implement the AutocompleteSystem class.
Method signatures and docstrings:
- def __init__(self, sentences, times): :type sentences: List[str] :type times: List[int]
- def input(self, c): :type c: str :rtype: List[str] | Implement the Python class `AutocompleteSystem` described below.
Class description:
Implement the AutocompleteSystem class.
Method signatures and docstrings:
- def __init__(self, sentences, times): :type sentences: List[str] :type times: List[int]
- def input(self, c): :type c: str :rtype: List[str]
<|skeleton|>
cla... | db64a67869aae4f0e55e78b65a7e04f5bc2e671c | <|skeleton|>
class AutocompleteSystem:
def __init__(self, sentences, times):
""":type sentences: List[str] :type times: List[int]"""
<|body_0|>
def input(self, c):
""":type c: str :rtype: List[str]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AutocompleteSystem:
def __init__(self, sentences, times):
""":type sentences: List[str] :type times: List[int]"""
self.dic = dict()
for s, t in zip(sentences, times):
node = self.dic
for ch in s:
if ch not in node:
node[ch] = ... | the_stack_v2_python_sparse | Questiondir/642.design-search-autocomplete-system/642.design-search-autocomplete-system_109800209.py | cczhong11/Leetcode-contest-code-downloader | train | 0 | |
92a66a63fb969d2634a19c1304ed7875489d9e6e | [
"super().__init__()\nself._inputs = inputs\nself._model = model",
"inputs = self._inputs(inputs)\noutputs = self._model(**inputs)\nreturn outputs"
] | <|body_start_0|>
super().__init__()
self._inputs = inputs
self._model = model
<|end_body_0|>
<|body_start_1|>
inputs = self._inputs(inputs)
outputs = self._model(**inputs)
return outputs
<|end_body_1|>
| Sequential container, where the model of embeddings and model will be stacked in the order they are passed to the constructor | Sequential | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Sequential:
"""Sequential container, where the model of embeddings and model will be stacked in the order they are passed to the constructor"""
def __init__(self, inputs: BaseInput, model: nn.Module):
"""Initialize Sequential container Args: inputs (BaseInput): inputs where the retur... | stack_v2_sparse_classes_36k_train_034937 | 1,268 | permissive | [
{
"docstring": "Initialize Sequential container Args: inputs (BaseInput): inputs where the return is a dictionary of inputs' tensors which are passed to the model directly model (nn.Module): model class to be trained and used in prediction",
"name": "__init__",
"signature": "def __init__(self, inputs: B... | 2 | stack_v2_sparse_classes_30k_val_000051 | Implement the Python class `Sequential` described below.
Class description:
Sequential container, where the model of embeddings and model will be stacked in the order they are passed to the constructor
Method signatures and docstrings:
- def __init__(self, inputs: BaseInput, model: nn.Module): Initialize Sequential c... | Implement the Python class `Sequential` described below.
Class description:
Sequential container, where the model of embeddings and model will be stacked in the order they are passed to the constructor
Method signatures and docstrings:
- def __init__(self, inputs: BaseInput, model: nn.Module): Initialize Sequential c... | 751a43b9cd35e951d81c0d9cf46507b1777bb7ff | <|skeleton|>
class Sequential:
"""Sequential container, where the model of embeddings and model will be stacked in the order they are passed to the constructor"""
def __init__(self, inputs: BaseInput, model: nn.Module):
"""Initialize Sequential container Args: inputs (BaseInput): inputs where the retur... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Sequential:
"""Sequential container, where the model of embeddings and model will be stacked in the order they are passed to the constructor"""
def __init__(self, inputs: BaseInput, model: nn.Module):
"""Initialize Sequential container Args: inputs (BaseInput): inputs where the return is a dictio... | the_stack_v2_python_sparse | torecsys/models/sequential.py | p768lwy3/torecsys | train | 98 |
cf676da0205f0049970cb10cd853f4f446d1d5ba | [
"result = []\n\ndef dfs(node):\n if not node:\n return\n if node.left:\n dfs(node.left)\n if node.right:\n dfs(node.right)\n result.append(node.val)\ndfs(root)\nreturn result",
"def post(node):\n if not node:\n return\n if node.left:\n for n in post(node.left):... | <|body_start_0|>
result = []
def dfs(node):
if not node:
return
if node.left:
dfs(node.left)
if node.right:
dfs(node.right)
result.append(node.val)
dfs(root)
return result
<|end_body_0|>
<|b... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def postorderTraversal(self, root):
""":type root: TreeNode :rtype: List[int]"""
<|body_0|>
def rewrite(self, root):
""":type root: TreeNode :rtype: List[int]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
result = []
def dfs(nod... | stack_v2_sparse_classes_36k_train_034938 | 1,699 | no_license | [
{
"docstring": ":type root: TreeNode :rtype: List[int]",
"name": "postorderTraversal",
"signature": "def postorderTraversal(self, root)"
},
{
"docstring": ":type root: TreeNode :rtype: List[int]",
"name": "rewrite",
"signature": "def rewrite(self, root)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def postorderTraversal(self, root): :type root: TreeNode :rtype: List[int]
- def rewrite(self, root): :type root: TreeNode :rtype: List[int] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def postorderTraversal(self, root): :type root: TreeNode :rtype: List[int]
- def rewrite(self, root): :type root: TreeNode :rtype: List[int]
<|skeleton|>
class Solution:
de... | 6350568d16b0f8c49a020f055bb6d72e2705ea56 | <|skeleton|>
class Solution:
def postorderTraversal(self, root):
""":type root: TreeNode :rtype: List[int]"""
<|body_0|>
def rewrite(self, root):
""":type root: TreeNode :rtype: List[int]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def postorderTraversal(self, root):
""":type root: TreeNode :rtype: List[int]"""
result = []
def dfs(node):
if not node:
return
if node.left:
dfs(node.left)
if node.right:
dfs(node.right)
... | the_stack_v2_python_sparse | co_fb/145_Binary_Tree_Postorder_Traversal.py | vsdrun/lc_public | train | 6 | |
10a029408b9ce3952dfa6ab1e83b0da90e769915 | [
"kw = super(ProjectTaskView, self).get_form_kwargs()\nif self.object.entity_owner:\n kw.update({'entity_owner': self.object.entity_owner})\nif self.object.participant_owner == self.request.user:\n kw.update({'participant_owner': self.request.user})\nreturn kw",
"context = super(ProjectTaskView, self).get_co... | <|body_start_0|>
kw = super(ProjectTaskView, self).get_form_kwargs()
if self.object.entity_owner:
kw.update({'entity_owner': self.object.entity_owner})
if self.object.participant_owner == self.request.user:
kw.update({'participant_owner': self.request.user})
retur... | Display and manage project tasks. | ProjectTaskView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ProjectTaskView:
"""Display and manage project tasks."""
def get_form_kwargs(self):
"""Pass organization to form."""
<|body_0|>
def get_context_data(self, **kwargs):
"""Return tasks belonging to the story."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>... | stack_v2_sparse_classes_36k_train_034939 | 17,162 | no_license | [
{
"docstring": "Pass organization to form.",
"name": "get_form_kwargs",
"signature": "def get_form_kwargs(self)"
},
{
"docstring": "Return tasks belonging to the story.",
"name": "get_context_data",
"signature": "def get_context_data(self, **kwargs)"
}
] | 2 | stack_v2_sparse_classes_30k_train_015759 | Implement the Python class `ProjectTaskView` described below.
Class description:
Display and manage project tasks.
Method signatures and docstrings:
- def get_form_kwargs(self): Pass organization to form.
- def get_context_data(self, **kwargs): Return tasks belonging to the story. | Implement the Python class `ProjectTaskView` described below.
Class description:
Display and manage project tasks.
Method signatures and docstrings:
- def get_form_kwargs(self): Pass organization to form.
- def get_context_data(self, **kwargs): Return tasks belonging to the story.
<|skeleton|>
class ProjectTaskView:... | d748e6f85907fa50d1d88ee003999c3d875b812b | <|skeleton|>
class ProjectTaskView:
"""Display and manage project tasks."""
def get_form_kwargs(self):
"""Pass organization to form."""
<|body_0|>
def get_context_data(self, **kwargs):
"""Return tasks belonging to the story."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ProjectTaskView:
"""Display and manage project tasks."""
def get_form_kwargs(self):
"""Pass organization to form."""
kw = super(ProjectTaskView, self).get_form_kwargs()
if self.object.entity_owner:
kw.update({'entity_owner': self.object.entity_owner})
if self.o... | the_stack_v2_python_sparse | facet/editorial/views/project.py | ProjectFacet/multifacet | train | 3 |
dc1953fb33de6def82e95d1d577a7e825c2bbb24 | [
"cls.extension = resolve_tuples(cls.extension, lambda value: (Plugin.Priority.Medium, value))\ncls.content_type = resolve_tuples(cls.content_type, lambda value: (Plugin.Priority.Medium, value))\ncls.scheme = resolve_tuples(cls.scheme, lambda value: (Plugin.Priority.Medium, value))",
"assert executor.key, 'Plugin ... | <|body_start_0|>
cls.extension = resolve_tuples(cls.extension, lambda value: (Plugin.Priority.Medium, value))
cls.content_type = resolve_tuples(cls.content_type, lambda value: (Plugin.Priority.Medium, value))
cls.scheme = resolve_tuples(cls.scheme, lambda value: (Plugin.Priority.Medium, value))
... | Executor plugin metadata. | Meta | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Meta:
"""Executor plugin metadata."""
def transform(cls):
"""Transform executor metadata."""
<|body_0|>
def validate(cls, executor):
"""Validate executor metadata. :param executor: Executor :type executor: ExecutorPlugin"""
<|body_1|>
<|end_skeleton|>
<... | stack_v2_sparse_classes_36k_train_034940 | 3,541 | no_license | [
{
"docstring": "Transform executor metadata.",
"name": "transform",
"signature": "def transform(cls)"
},
{
"docstring": "Validate executor metadata. :param executor: Executor :type executor: ExecutorPlugin",
"name": "validate",
"signature": "def validate(cls, executor)"
}
] | 2 | stack_v2_sparse_classes_30k_train_010646 | Implement the Python class `Meta` described below.
Class description:
Executor plugin metadata.
Method signatures and docstrings:
- def transform(cls): Transform executor metadata.
- def validate(cls, executor): Validate executor metadata. :param executor: Executor :type executor: ExecutorPlugin | Implement the Python class `Meta` described below.
Class description:
Executor plugin metadata.
Method signatures and docstrings:
- def transform(cls): Transform executor metadata.
- def validate(cls, executor): Validate executor metadata. :param executor: Executor :type executor: ExecutorPlugin
<|skeleton|>
class M... | cfd552583a20afded620058e18b950fe344b0245 | <|skeleton|>
class Meta:
"""Executor plugin metadata."""
def transform(cls):
"""Transform executor metadata."""
<|body_0|>
def validate(cls, executor):
"""Validate executor metadata. :param executor: Executor :type executor: ExecutorPlugin"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Meta:
"""Executor plugin metadata."""
def transform(cls):
"""Transform executor metadata."""
cls.extension = resolve_tuples(cls.extension, lambda value: (Plugin.Priority.Medium, value))
cls.content_type = resolve_tuples(cls.content_type, lambda value: (Plugin.Priority.Medium, valu... | the_stack_v2_python_sparse | byte/executors/core/base/executor.py | fuzeman/byte | train | 0 |
1a0e931f67807b0ddaf8571551ebb87418accd08 | [
"ret = []\nself.walk(root, defaultdict(int), ret)\nreturn ret",
"if not cur:\n return 'None'\ncur_key = ','.join([self.walk(cur.left, counter, ret), self.walk(cur.right, counter, ret), str(cur.val)])\nif counter[cur_key] == 1:\n ret.append(cur)\ncounter[cur_key] += 1\nreturn cur_key"
] | <|body_start_0|>
ret = []
self.walk(root, defaultdict(int), ret)
return ret
<|end_body_0|>
<|body_start_1|>
if not cur:
return 'None'
cur_key = ','.join([self.walk(cur.left, counter, ret), self.walk(cur.right, counter, ret), str(cur.val)])
if counter[cur_key]... | Solution2 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution2:
def findDuplicateSubtrees(self, root: TreeNode) -> List[TreeNode]:
"""Only need to return the root"""
<|body_0|>
def walk(self, cur, counter, ret) -> str:
"""serialize the subtrees and check existence Needs to have a unique representation for the key, cann... | stack_v2_sparse_classes_36k_train_034941 | 2,915 | no_license | [
{
"docstring": "Only need to return the root",
"name": "findDuplicateSubtrees",
"signature": "def findDuplicateSubtrees(self, root: TreeNode) -> List[TreeNode]"
},
{
"docstring": "serialize the subtrees and check existence Needs to have a unique representation for the key, cannot but cur.val in ... | 2 | stack_v2_sparse_classes_30k_train_019613 | Implement the Python class `Solution2` described below.
Class description:
Implement the Solution2 class.
Method signatures and docstrings:
- def findDuplicateSubtrees(self, root: TreeNode) -> List[TreeNode]: Only need to return the root
- def walk(self, cur, counter, ret) -> str: serialize the subtrees and check exi... | Implement the Python class `Solution2` described below.
Class description:
Implement the Solution2 class.
Method signatures and docstrings:
- def findDuplicateSubtrees(self, root: TreeNode) -> List[TreeNode]: Only need to return the root
- def walk(self, cur, counter, ret) -> str: serialize the subtrees and check exi... | 929dde1723fb2f54870c8a9badc80fc23e8400d3 | <|skeleton|>
class Solution2:
def findDuplicateSubtrees(self, root: TreeNode) -> List[TreeNode]:
"""Only need to return the root"""
<|body_0|>
def walk(self, cur, counter, ret) -> str:
"""serialize the subtrees and check existence Needs to have a unique representation for the key, cann... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution2:
def findDuplicateSubtrees(self, root: TreeNode) -> List[TreeNode]:
"""Only need to return the root"""
ret = []
self.walk(root, defaultdict(int), ret)
return ret
def walk(self, cur, counter, ret) -> str:
"""serialize the subtrees and check existence Needs... | the_stack_v2_python_sparse | _algorithms_challenges/leetcode/LeetCode/652 Find Duplicate Subtrees.py | syurskyi/Algorithms_and_Data_Structure | train | 4 | |
eca57b80ccc11698f5b1d8d335263cb647758501 | [
"with fixture_type_context():\n Dhis2OrgUnit.objects = FixtureManager(Dhis2OrgUnit, DOMAIN, ORG_UNIT_FIXTURES)\n org_unit = Dhis2OrgUnit(id='QXOOG2Foong', name='Somerset West', parent_id=None)\n id_ = org_unit.save()\n self.assertIsNotNone(id_)\n self.assertIsNotNone(org_unit._fixture_id)",
"with f... | <|body_start_0|>
with fixture_type_context():
Dhis2OrgUnit.objects = FixtureManager(Dhis2OrgUnit, DOMAIN, ORG_UNIT_FIXTURES)
org_unit = Dhis2OrgUnit(id='QXOOG2Foong', name='Somerset West', parent_id=None)
id_ = org_unit.save()
self.assertIsNotNone(id_)
... | Dhis2OrgUnitTest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Dhis2OrgUnitTest:
def test_save(self):
"""Dhis2OrgUnit.save should save a FixtureDataItem"""
<|body_0|>
def test_delete_dhis2_org_unit_does_nothing(self):
"""Dhis2OrgUnit.delete should do nothing if it's not saved"""
<|body_1|>
def test_delete_dhis2_org_... | stack_v2_sparse_classes_36k_train_034942 | 18,511 | no_license | [
{
"docstring": "Dhis2OrgUnit.save should save a FixtureDataItem",
"name": "test_save",
"signature": "def test_save(self)"
},
{
"docstring": "Dhis2OrgUnit.delete should do nothing if it's not saved",
"name": "test_delete_dhis2_org_unit_does_nothing",
"signature": "def test_delete_dhis2_or... | 3 | stack_v2_sparse_classes_30k_train_005042 | Implement the Python class `Dhis2OrgUnitTest` described below.
Class description:
Implement the Dhis2OrgUnitTest class.
Method signatures and docstrings:
- def test_save(self): Dhis2OrgUnit.save should save a FixtureDataItem
- def test_delete_dhis2_org_unit_does_nothing(self): Dhis2OrgUnit.delete should do nothing if... | Implement the Python class `Dhis2OrgUnitTest` described below.
Class description:
Implement the Dhis2OrgUnitTest class.
Method signatures and docstrings:
- def test_save(self): Dhis2OrgUnit.save should save a FixtureDataItem
- def test_delete_dhis2_org_unit_does_nothing(self): Dhis2OrgUnit.delete should do nothing if... | 6d3eb1a0e70cc2a59a82ec5bba12170387803150 | <|skeleton|>
class Dhis2OrgUnitTest:
def test_save(self):
"""Dhis2OrgUnit.save should save a FixtureDataItem"""
<|body_0|>
def test_delete_dhis2_org_unit_does_nothing(self):
"""Dhis2OrgUnit.delete should do nothing if it's not saved"""
<|body_1|>
def test_delete_dhis2_org_... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Dhis2OrgUnitTest:
def test_save(self):
"""Dhis2OrgUnit.save should save a FixtureDataItem"""
with fixture_type_context():
Dhis2OrgUnit.objects = FixtureManager(Dhis2OrgUnit, DOMAIN, ORG_UNIT_FIXTURES)
org_unit = Dhis2OrgUnit(id='QXOOG2Foong', name='Somerset West', paren... | the_stack_v2_python_sparse | custom/dhis2/tests.py | saketkanth/commcare-hq | train | 0 | |
c273307560cddad80cd6009b73e0e2ac49685e4d | [
"super().__init__()\nself.has_pool = pool is not None\nself.pool = pool if pool is not None else Identity()\nself.has_cls_embed = has_cls_embed\nif norm is not None:\n self.norm_before_pool = isinstance(norm, (BatchNorm3d, Identity))\n self.has_norm = True\n self.norm = norm\nelse:\n self.norm_before_po... | <|body_start_0|>
super().__init__()
self.has_pool = pool is not None
self.pool = pool if pool is not None else Identity()
self.has_cls_embed = has_cls_embed
if norm is not None:
self.norm_before_pool = isinstance(norm, (BatchNorm3d, Identity))
self.has_nor... | _AttentionPool | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _AttentionPool:
def __init__(self, pool: Optional[Module], has_cls_embed: bool, norm: Optional[Module]) -> None:
"""Apply pool to a flattened input (given pool operation and the unflattened shape). Input ↓ Reshape ↓ Pool ↓ Reshape ↓ Norm Params: pool (Optional[Callable]): Pool operation ... | stack_v2_sparse_classes_36k_train_034943 | 28,184 | permissive | [
{
"docstring": "Apply pool to a flattened input (given pool operation and the unflattened shape). Input ↓ Reshape ↓ Pool ↓ Reshape ↓ Norm Params: pool (Optional[Callable]): Pool operation that is applied to the input tensor. If pool is none, return the input tensor. has_cls_embed (bool): Whether the input tenso... | 2 | null | Implement the Python class `_AttentionPool` described below.
Class description:
Implement the _AttentionPool class.
Method signatures and docstrings:
- def __init__(self, pool: Optional[Module], has_cls_embed: bool, norm: Optional[Module]) -> None: Apply pool to a flattened input (given pool operation and the unflatt... | Implement the Python class `_AttentionPool` described below.
Class description:
Implement the _AttentionPool class.
Method signatures and docstrings:
- def __init__(self, pool: Optional[Module], has_cls_embed: bool, norm: Optional[Module]) -> None: Apply pool to a flattened input (given pool operation and the unflatt... | c60dc19788217556ba12ea378c02b9fd0aea9ffe | <|skeleton|>
class _AttentionPool:
def __init__(self, pool: Optional[Module], has_cls_embed: bool, norm: Optional[Module]) -> None:
"""Apply pool to a flattened input (given pool operation and the unflattened shape). Input ↓ Reshape ↓ Pool ↓ Reshape ↓ Norm Params: pool (Optional[Callable]): Pool operation ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class _AttentionPool:
def __init__(self, pool: Optional[Module], has_cls_embed: bool, norm: Optional[Module]) -> None:
"""Apply pool to a flattened input (given pool operation and the unflattened shape). Input ↓ Reshape ↓ Pool ↓ Reshape ↓ Norm Params: pool (Optional[Callable]): Pool operation that is applie... | the_stack_v2_python_sparse | python/aitemplate/frontend/nn/multiscale_attention.py | facebookincubator/AITemplate | train | 4,065 | |
e563ab1ccfc045a090bbdc0ecbeb8deb61be53bb | [
"self.gsutil_bin_dir = gsutil_bin_dir\nself.boto_lib_dir = boto_lib_dir\nself.config_file_list = config_file_list\nself.gsutil_ver = gsutil_ver\nself.bucket_storage_uri_class = bucket_storage_uri_class\nself.command_map = self._LoadCommandMap()",
"commands_dir = os.path.join(self.gsutil_bin_dir, 'gslib', 'command... | <|body_start_0|>
self.gsutil_bin_dir = gsutil_bin_dir
self.boto_lib_dir = boto_lib_dir
self.config_file_list = config_file_list
self.gsutil_ver = gsutil_ver
self.bucket_storage_uri_class = bucket_storage_uri_class
self.command_map = self._LoadCommandMap()
<|end_body_0|>
... | CommandRunner | [
"Apache-2.0",
"LicenseRef-scancode-free-unknown",
"GPL-1.0-or-later",
"Python-2.0",
"LicenseRef-scancode-python-cwi",
"LicenseRef-scancode-other-copyleft",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CommandRunner:
def __init__(self, gsutil_bin_dir, boto_lib_dir, config_file_list, gsutil_ver, bucket_storage_uri_class=BucketStorageUri):
"""Args: gsutil_bin_dir: Bin dir from which gsutil is running. boto_lib_dir: Lib dir where boto runs. config_file_list: Config file list returned by _... | stack_v2_sparse_classes_36k_train_034944 | 4,281 | permissive | [
{
"docstring": "Args: gsutil_bin_dir: Bin dir from which gsutil is running. boto_lib_dir: Lib dir where boto runs. config_file_list: Config file list returned by _GetBotoConfigFileList(). gsutil_ver: Version string of currently running gsutil command. bucket_storage_uri_class: Class to instantiate for cloud Sto... | 3 | stack_v2_sparse_classes_30k_train_009449 | Implement the Python class `CommandRunner` described below.
Class description:
Implement the CommandRunner class.
Method signatures and docstrings:
- def __init__(self, gsutil_bin_dir, boto_lib_dir, config_file_list, gsutil_ver, bucket_storage_uri_class=BucketStorageUri): Args: gsutil_bin_dir: Bin dir from which gsut... | Implement the Python class `CommandRunner` described below.
Class description:
Implement the CommandRunner class.
Method signatures and docstrings:
- def __init__(self, gsutil_bin_dir, boto_lib_dir, config_file_list, gsutil_ver, bucket_storage_uri_class=BucketStorageUri): Args: gsutil_bin_dir: Bin dir from which gsut... | 9171447efcf0bb393d41d1dc877c7c13c46d8e38 | <|skeleton|>
class CommandRunner:
def __init__(self, gsutil_bin_dir, boto_lib_dir, config_file_list, gsutil_ver, bucket_storage_uri_class=BucketStorageUri):
"""Args: gsutil_bin_dir: Bin dir from which gsutil is running. boto_lib_dir: Lib dir where boto runs. config_file_list: Config file list returned by _... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CommandRunner:
def __init__(self, gsutil_bin_dir, boto_lib_dir, config_file_list, gsutil_ver, bucket_storage_uri_class=BucketStorageUri):
"""Args: gsutil_bin_dir: Bin dir from which gsutil is running. boto_lib_dir: Lib dir where boto runs. config_file_list: Config file list returned by _GetBotoConfigF... | the_stack_v2_python_sparse | depot_tools/third_party/gsutil/gslib/command_runner.py | webosce/chromium53 | train | 0 | |
24dcf22a708158097163197b66ebdae05285626f | [
"super().__init__()\nself.player = player\nself.spawnTime = 0\nself.disappear = False\npygame.sprite.Sprite.__init__(self)\nsprite_sheet = SpriteSheet('Lava.png')\nimage = sprite_sheet.get_image(547, 252, 133, 133)\nself.image = image\nself.rect = self.image.get_rect()\nspot = randint(0, 2)\nif spot == 0:\n spot... | <|body_start_0|>
super().__init__()
self.player = player
self.spawnTime = 0
self.disappear = False
pygame.sprite.Sprite.__init__(self)
sprite_sheet = SpriteSheet('Lava.png')
image = sprite_sheet.get_image(547, 252, 133, 133)
self.image = image
self... | RockDown | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RockDown:
def __init__(self, player):
""":param player: The player object This initializes the boulder Variables: self.player: The player object self.spawnTime: The amount of time the punch will stay on screen self.lava_frames: Holds the custom sprites self.disappear: True to allow the p... | stack_v2_sparse_classes_36k_train_034945 | 3,012 | no_license | [
{
"docstring": ":param player: The player object This initializes the boulder Variables: self.player: The player object self.spawnTime: The amount of time the punch will stay on screen self.lava_frames: Holds the custom sprites self.disappear: True to allow the punch to disappear sprite_sheet: The spritesheet t... | 2 | null | Implement the Python class `RockDown` described below.
Class description:
Implement the RockDown class.
Method signatures and docstrings:
- def __init__(self, player): :param player: The player object This initializes the boulder Variables: self.player: The player object self.spawnTime: The amount of time the punch w... | Implement the Python class `RockDown` described below.
Class description:
Implement the RockDown class.
Method signatures and docstrings:
- def __init__(self, player): :param player: The player object This initializes the boulder Variables: self.player: The player object self.spawnTime: The amount of time the punch w... | 56fbcfc786dfc373f477270468f06e31b6271749 | <|skeleton|>
class RockDown:
def __init__(self, player):
""":param player: The player object This initializes the boulder Variables: self.player: The player object self.spawnTime: The amount of time the punch will stay on screen self.lava_frames: Holds the custom sprites self.disappear: True to allow the p... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RockDown:
def __init__(self, player):
""":param player: The player object This initializes the boulder Variables: self.player: The player object self.spawnTime: The amount of time the punch will stay on screen self.lava_frames: Holds the custom sprites self.disappear: True to allow the punch to disapp... | the_stack_v2_python_sparse | Doki Doki Island/bossAttacks/mag/magAttack2.py | cashpop5000/DokiProject | train | 0 | |
872c2603067cdb8c282ff11a387b7666c1b4f0b0 | [
"assert type(ensemble_weights) == list or type(ensemble_weights) == np.ndarray\nself.weights = ensemble_weights\nself.sum_weights = np.sum(self.weights) if ensemble_weights else None",
"assert type(scores) == list or type(scores) == np.ndarray, 'Unsupport score types, it should be list or numpy.ndarray'\nassert l... | <|body_start_0|>
assert type(ensemble_weights) == list or type(ensemble_weights) == np.ndarray
self.weights = ensemble_weights
self.sum_weights = np.sum(self.weights) if ensemble_weights else None
<|end_body_0|>
<|body_start_1|>
assert type(scores) == list or type(scores) == np.ndarray,... | WeightEnsemble | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WeightEnsemble:
def __init__(self, ensemble_weights: list=None):
"""Anomaly scores ensemble with weighted average. Args: ensemble_weights (list, optional): Weights for scores with orders, we use equal weights/mean to recalculate the scores when it is None. Defaults to None."""
<|... | stack_v2_sparse_classes_36k_train_034946 | 1,511 | permissive | [
{
"docstring": "Anomaly scores ensemble with weighted average. Args: ensemble_weights (list, optional): Weights for scores with orders, we use equal weights/mean to recalculate the scores when it is None. Defaults to None.",
"name": "__init__",
"signature": "def __init__(self, ensemble_weights: list=Non... | 2 | stack_v2_sparse_classes_30k_train_001026 | Implement the Python class `WeightEnsemble` described below.
Class description:
Implement the WeightEnsemble class.
Method signatures and docstrings:
- def __init__(self, ensemble_weights: list=None): Anomaly scores ensemble with weighted average. Args: ensemble_weights (list, optional): Weights for scores with order... | Implement the Python class `WeightEnsemble` described below.
Class description:
Implement the WeightEnsemble class.
Method signatures and docstrings:
- def __init__(self, ensemble_weights: list=None): Anomaly scores ensemble with weighted average. Args: ensemble_weights (list, optional): Weights for scores with order... | d2e38f4c35349b05c9bbd3ac753efc9a96e0ab05 | <|skeleton|>
class WeightEnsemble:
def __init__(self, ensemble_weights: list=None):
"""Anomaly scores ensemble with weighted average. Args: ensemble_weights (list, optional): Weights for scores with orders, we use equal weights/mean to recalculate the scores when it is None. Defaults to None."""
<|... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class WeightEnsemble:
def __init__(self, ensemble_weights: list=None):
"""Anomaly scores ensemble with weighted average. Args: ensemble_weights (list, optional): Weights for scores with orders, we use equal weights/mean to recalculate the scores when it is None. Defaults to None."""
assert type(ense... | the_stack_v2_python_sparse | streamad/process/weight_ensemble.py | Fengrui-Liu/StreamAD | train | 73 | |
17180925069fc4ed68eb2ef0415c0286b12ce395 | [
"self._attr_name = f'{name} {SENSOR_TYPES[sensor_type][0]}'\nself.bme680_client = bme680_client\nself.temp_unit = temp_unit\nself.type = sensor_type\nself._attr_unit_of_measurement = SENSOR_TYPES[sensor_type][1]\nself._attr_device_class = SENSOR_TYPES[sensor_type][2]",
"await self.hass.async_add_executor_job(self... | <|body_start_0|>
self._attr_name = f'{name} {SENSOR_TYPES[sensor_type][0]}'
self.bme680_client = bme680_client
self.temp_unit = temp_unit
self.type = sensor_type
self._attr_unit_of_measurement = SENSOR_TYPES[sensor_type][1]
self._attr_device_class = SENSOR_TYPES[sensor_ty... | Implementation of the BME680 sensor. | BME680Sensor | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BME680Sensor:
"""Implementation of the BME680 sensor."""
def __init__(self, bme680_client, sensor_type, temp_unit, name):
"""Initialize the sensor."""
<|body_0|>
async def async_update(self):
"""Get the latest data from the BME680 and update the states."""
... | stack_v2_sparse_classes_36k_train_034947 | 13,136 | permissive | [
{
"docstring": "Initialize the sensor.",
"name": "__init__",
"signature": "def __init__(self, bme680_client, sensor_type, temp_unit, name)"
},
{
"docstring": "Get the latest data from the BME680 and update the states.",
"name": "async_update",
"signature": "async def async_update(self)"
... | 2 | stack_v2_sparse_classes_30k_train_020610 | Implement the Python class `BME680Sensor` described below.
Class description:
Implementation of the BME680 sensor.
Method signatures and docstrings:
- def __init__(self, bme680_client, sensor_type, temp_unit, name): Initialize the sensor.
- async def async_update(self): Get the latest data from the BME680 and update ... | Implement the Python class `BME680Sensor` described below.
Class description:
Implementation of the BME680 sensor.
Method signatures and docstrings:
- def __init__(self, bme680_client, sensor_type, temp_unit, name): Initialize the sensor.
- async def async_update(self): Get the latest data from the BME680 and update ... | 2fee32fce03bc49e86cf2e7b741a15621a97cce5 | <|skeleton|>
class BME680Sensor:
"""Implementation of the BME680 sensor."""
def __init__(self, bme680_client, sensor_type, temp_unit, name):
"""Initialize the sensor."""
<|body_0|>
async def async_update(self):
"""Get the latest data from the BME680 and update the states."""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BME680Sensor:
"""Implementation of the BME680 sensor."""
def __init__(self, bme680_client, sensor_type, temp_unit, name):
"""Initialize the sensor."""
self._attr_name = f'{name} {SENSOR_TYPES[sensor_type][0]}'
self.bme680_client = bme680_client
self.temp_unit = temp_unit
... | the_stack_v2_python_sparse | homeassistant/components/bme680/sensor.py | BenWoodford/home-assistant | train | 11 |
ce4e0583e9320114c9d072d46e4abc5f473299ec | [
"clients = Client.objects.all()\nserializer_obj = ClientSerializer(clients, many=True)\nreturn JsonResponse(serializer_obj.data, safe=False, status=200)",
"data = JSONParser().parse(request)\nserializer_obj = ClientSerializer(data=data)\nif serializer_obj.is_valid():\n serializer_obj.save()\n return JsonRes... | <|body_start_0|>
clients = Client.objects.all()
serializer_obj = ClientSerializer(clients, many=True)
return JsonResponse(serializer_obj.data, safe=False, status=200)
<|end_body_0|>
<|body_start_1|>
data = JSONParser().parse(request)
serializer_obj = ClientSerializer(data=data)
... | Class based view for Client for listing and adding. | ClientView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ClientView:
"""Class based view for Client for listing and adding."""
def get(self, request):
"""Get clients view."""
<|body_0|>
def post(self, request):
"""Add new client through post request."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
cli... | stack_v2_sparse_classes_36k_train_034948 | 2,528 | no_license | [
{
"docstring": "Get clients view.",
"name": "get",
"signature": "def get(self, request)"
},
{
"docstring": "Add new client through post request.",
"name": "post",
"signature": "def post(self, request)"
}
] | 2 | null | Implement the Python class `ClientView` described below.
Class description:
Class based view for Client for listing and adding.
Method signatures and docstrings:
- def get(self, request): Get clients view.
- def post(self, request): Add new client through post request. | Implement the Python class `ClientView` described below.
Class description:
Class based view for Client for listing and adding.
Method signatures and docstrings:
- def get(self, request): Get clients view.
- def post(self, request): Add new client through post request.
<|skeleton|>
class ClientView:
"""Class bas... | 93c3106ab90fb9aed85658f93f51686ba4734091 | <|skeleton|>
class ClientView:
"""Class based view for Client for listing and adding."""
def get(self, request):
"""Get clients view."""
<|body_0|>
def post(self, request):
"""Add new client through post request."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ClientView:
"""Class based view for Client for listing and adding."""
def get(self, request):
"""Get clients view."""
clients = Client.objects.all()
serializer_obj = ClientSerializer(clients, many=True)
return JsonResponse(serializer_obj.data, safe=False, status=200)
... | the_stack_v2_python_sparse | client/client_apis.py | saadali5997/tms | train | 0 |
2ea436f30a73cb05c3e4638b0860ae76553ad758 | [
"super(DispToPix, self).__init__()\nself.batch_size = batch_size\nself.height = height\nself.width = width\nmeshgrid = np.meshgrid(range(self.width), range(self.height), indexing='xy')\nself.id_coords = np.stack(meshgrid, axis=0).astype(np.float32)\nself.id_coords = nn.Parameter(torch.from_numpy(self.id_coords))\ns... | <|body_start_0|>
super(DispToPix, self).__init__()
self.batch_size = batch_size
self.height = height
self.width = width
meshgrid = np.meshgrid(range(self.width), range(self.height), indexing='xy')
self.id_coords = np.stack(meshgrid, axis=0).astype(np.float32)
self... | Layer to transform disparity into camera pixel coordiantes | DispToPix | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DispToPix:
"""Layer to transform disparity into camera pixel coordiantes"""
def __init__(self, batch_size, height, width):
"""Prepare regular grid (Nx2xHxW)"""
<|body_0|>
def forward(self, disp, normalized=True):
"""Forward Args: disp (tensor, [Nx1xHxW]): dispari... | stack_v2_sparse_classes_36k_train_034949 | 13,421 | permissive | [
{
"docstring": "Prepare regular grid (Nx2xHxW)",
"name": "__init__",
"signature": "def __init__(self, batch_size, height, width)"
},
{
"docstring": "Forward Args: disp (tensor, [Nx1xHxW]): disparity normalized (bool): normalized to [-1, 1] if True; otherwise [0, H-1 or W-1] Returns: pix_coords (... | 2 | stack_v2_sparse_classes_30k_train_002156 | Implement the Python class `DispToPix` described below.
Class description:
Layer to transform disparity into camera pixel coordiantes
Method signatures and docstrings:
- def __init__(self, batch_size, height, width): Prepare regular grid (Nx2xHxW)
- def forward(self, disp, normalized=True): Forward Args: disp (tensor... | Implement the Python class `DispToPix` described below.
Class description:
Layer to transform disparity into camera pixel coordiantes
Method signatures and docstrings:
- def __init__(self, batch_size, height, width): Prepare regular grid (Nx2xHxW)
- def forward(self, disp, normalized=True): Forward Args: disp (tensor... | 50e6ffa9b5164a0dfb34d3215e86cc2288df256d | <|skeleton|>
class DispToPix:
"""Layer to transform disparity into camera pixel coordiantes"""
def __init__(self, batch_size, height, width):
"""Prepare regular grid (Nx2xHxW)"""
<|body_0|>
def forward(self, disp, normalized=True):
"""Forward Args: disp (tensor, [Nx1xHxW]): dispari... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DispToPix:
"""Layer to transform disparity into camera pixel coordiantes"""
def __init__(self, batch_size, height, width):
"""Prepare regular grid (Nx2xHxW)"""
super(DispToPix, self).__init__()
self.batch_size = batch_size
self.height = height
self.width = width
... | the_stack_v2_python_sparse | libs/deep_models/depth/monodepth2/layers.py | Huangying-Zhan/DF-VO | train | 494 |
2611c1bef0d54f8a6fb8d7b001fcf32e415881cd | [
"super(DCGenerator, self).__init__()\nself.img_shape = img_shape\nself.latent_size = latent_size\nn_filters = clip_channels(self.latent_size)\nself.initial_linear = nn.Linear(self.latent_size, n_filters * 4 * 4)\nnn.init.xavier_uniform_(self.initial_linear.weight)\nself.init_batch_norm = nn.BatchNorm1d(self.initial... | <|body_start_0|>
super(DCGenerator, self).__init__()
self.img_shape = img_shape
self.latent_size = latent_size
n_filters = clip_channels(self.latent_size)
self.initial_linear = nn.Linear(self.latent_size, n_filters * 4 * 4)
nn.init.xavier_uniform_(self.initial_linear.weig... | DCGenerator | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DCGenerator:
def __init__(self, latent_size: int, img_shape: Tuple[int, int, int]):
"""Builds the DCGAN generator. Builds the very simple generator that takes a latent input vector and applies the following block until the desired image size is reached: 3x3 convolutional layer with ReLu ... | stack_v2_sparse_classes_36k_train_034950 | 5,032 | no_license | [
{
"docstring": "Builds the DCGAN generator. Builds the very simple generator that takes a latent input vector and applies the following block until the desired image size is reached: 3x3 convolutional layer with ReLu activation -> Batch Normalization -> Upsamling layer. The last Convolutional layer wit tanH act... | 2 | stack_v2_sparse_classes_30k_train_018374 | Implement the Python class `DCGenerator` described below.
Class description:
Implement the DCGenerator class.
Method signatures and docstrings:
- def __init__(self, latent_size: int, img_shape: Tuple[int, int, int]): Builds the DCGAN generator. Builds the very simple generator that takes a latent input vector and app... | Implement the Python class `DCGenerator` described below.
Class description:
Implement the DCGenerator class.
Method signatures and docstrings:
- def __init__(self, latent_size: int, img_shape: Tuple[int, int, int]): Builds the DCGAN generator. Builds the very simple generator that takes a latent input vector and app... | e7388d5bac4451b0c72ece5c3c2cd399b08048e6 | <|skeleton|>
class DCGenerator:
def __init__(self, latent_size: int, img_shape: Tuple[int, int, int]):
"""Builds the DCGAN generator. Builds the very simple generator that takes a latent input vector and applies the following block until the desired image size is reached: 3x3 convolutional layer with ReLu ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DCGenerator:
def __init__(self, latent_size: int, img_shape: Tuple[int, int, int]):
"""Builds the DCGAN generator. Builds the very simple generator that takes a latent input vector and applies the following block until the desired image size is reached: 3x3 convolutional layer with ReLu activation -> ... | the_stack_v2_python_sparse | networks/modules/dcgan.py | mcschmitz/duck_and_cover | train | 0 | |
9c7c397f52781a5a52376e4a904672c7c1647aaa | [
"if not settings.NEW_ACCOUNT_REGISTRATION_ENABLED:\n self.msg('Registration is currently disabled.')\n return True\nreturn super().at_pre_cmd()",
"session = self.caller\nargs = self.args.strip()\naddress = session.address\nAccount = class_from_module(settings.BASE_ACCOUNT_TYPECLASS)\nparts = [part.strip() f... | <|body_start_0|>
if not settings.NEW_ACCOUNT_REGISTRATION_ENABLED:
self.msg('Registration is currently disabled.')
return True
return super().at_pre_cmd()
<|end_body_0|>
<|body_start_1|>
session = self.caller
args = self.args.strip()
address = session.add... | create a new account account Usage (at login screen): create <accountname> <password> create "account name" "pass word" This creates a new account account. If you have spaces in your name, enclose it in double quotes. | CmdUnconnectedCreate | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CmdUnconnectedCreate:
"""create a new account account Usage (at login screen): create <accountname> <password> create "account name" "pass word" This creates a new account account. If you have spaces in your name, enclose it in double quotes."""
def at_pre_cmd(self):
"""Verify that a... | stack_v2_sparse_classes_36k_train_034951 | 15,057 | permissive | [
{
"docstring": "Verify that account creation is enabled.",
"name": "at_pre_cmd",
"signature": "def at_pre_cmd(self)"
},
{
"docstring": "Do checks and create account",
"name": "func",
"signature": "def func(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_004872 | Implement the Python class `CmdUnconnectedCreate` described below.
Class description:
create a new account account Usage (at login screen): create <accountname> <password> create "account name" "pass word" This creates a new account account. If you have spaces in your name, enclose it in double quotes.
Method signatu... | Implement the Python class `CmdUnconnectedCreate` described below.
Class description:
create a new account account Usage (at login screen): create <accountname> <password> create "account name" "pass word" This creates a new account account. If you have spaces in your name, enclose it in double quotes.
Method signatu... | b3ca58b5c1325a3bf57051dfe23560a08d2947b7 | <|skeleton|>
class CmdUnconnectedCreate:
"""create a new account account Usage (at login screen): create <accountname> <password> create "account name" "pass word" This creates a new account account. If you have spaces in your name, enclose it in double quotes."""
def at_pre_cmd(self):
"""Verify that a... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CmdUnconnectedCreate:
"""create a new account account Usage (at login screen): create <accountname> <password> create "account name" "pass word" This creates a new account account. If you have spaces in your name, enclose it in double quotes."""
def at_pre_cmd(self):
"""Verify that account creati... | the_stack_v2_python_sparse | evennia/commands/default/unloggedin.py | evennia/evennia | train | 1,781 |
711f41e07c4bb3e3d411357225c2232a88d00d5c | [
"self.input_fc = kwargs['input_fc']\nself.network_data_source = kwargs['network_data_source']\nself.travel_mode = kwargs['travel_mode']\nself.scratch_folder = kwargs['scratch_folder']\nself.search_tolerance = kwargs.get('search_tolerance', None)\nself.search_criteria = kwargs.get('search_criteria', None)\nself.sear... | <|body_start_0|>
self.input_fc = kwargs['input_fc']
self.network_data_source = kwargs['network_data_source']
self.travel_mode = kwargs['travel_mode']
self.scratch_folder = kwargs['scratch_folder']
self.search_tolerance = kwargs.get('search_tolerance', None)
self.search_cr... | Used for calculating network locations for a designated chunk of the input datasets. | LocationCalculator | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LocationCalculator:
"""Used for calculating network locations for a designated chunk of the input datasets."""
def __init__(self, **kwargs):
"""Initialize the location calculator for the given inputs. Expected arguments: - input_fc - network_data_source - travel_mode - search_toleran... | stack_v2_sparse_classes_36k_train_034952 | 17,175 | permissive | [
{
"docstring": "Initialize the location calculator for the given inputs. Expected arguments: - input_fc - network_data_source - travel_mode - search_tolerance - search_criteria - search_query - scratch_folder",
"name": "__init__",
"signature": "def __init__(self, **kwargs)"
},
{
"docstring": "Cr... | 3 | stack_v2_sparse_classes_30k_train_003051 | Implement the Python class `LocationCalculator` described below.
Class description:
Used for calculating network locations for a designated chunk of the input datasets.
Method signatures and docstrings:
- def __init__(self, **kwargs): Initialize the location calculator for the given inputs. Expected arguments: - inpu... | Implement the Python class `LocationCalculator` described below.
Class description:
Used for calculating network locations for a designated chunk of the input datasets.
Method signatures and docstrings:
- def __init__(self, **kwargs): Initialize the location calculator for the given inputs. Expected arguments: - inpu... | 47cbc3de67a7b1bf9255e07e88cba7b051db0505 | <|skeleton|>
class LocationCalculator:
"""Used for calculating network locations for a designated chunk of the input datasets."""
def __init__(self, **kwargs):
"""Initialize the location calculator for the given inputs. Expected arguments: - input_fc - network_data_source - travel_mode - search_toleran... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LocationCalculator:
"""Used for calculating network locations for a designated chunk of the input datasets."""
def __init__(self, **kwargs):
"""Initialize the location calculator for the given inputs. Expected arguments: - input_fc - network_data_source - travel_mode - search_tolerance - search_c... | the_stack_v2_python_sparse | transit-network-analysis-tools/parallel_calculate_locations.py | Esri/public-transit-tools | train | 155 |
7ebf84e1e23dbb7e1b6c0d30e4f99882062f4017 | [
"super().__init__(type, x, y)\nself.text = text\nself.image_template = None\nself.highlighted = False\nself.selected = False\nself.disabled = False\nif text == 'Game Over':\n self.set_image(self.image_over)\nelse:\n self.set_image(self.image_s)\nself.rect = self.image.get_rect()\nself.rect.x = x\nself.rect.y ... | <|body_start_0|>
super().__init__(type, x, y)
self.text = text
self.image_template = None
self.highlighted = False
self.selected = False
self.disabled = False
if text == 'Game Over':
self.set_image(self.image_over)
else:
self.set_im... | 菜单系统显示的标签,包含背景 | MenuLabel | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MenuLabel:
"""菜单系统显示的标签,包含背景"""
def __init__(self, menu, type, text, x, y):
"""Args: menu (Menu): menu实例 type (str): prefab名称,用于字体和背景 text (str): 在按钮上显示的文字 x (int): x坐标 y (int): y坐标"""
<|body_0|>
def update(self):
"""每帧调用,查找鼠标点击"""
<|body_1|>
def set... | stack_v2_sparse_classes_36k_train_034953 | 8,937 | no_license | [
{
"docstring": "Args: menu (Menu): menu实例 type (str): prefab名称,用于字体和背景 text (str): 在按钮上显示的文字 x (int): x坐标 y (int): y坐标",
"name": "__init__",
"signature": "def __init__(self, menu, type, text, x, y)"
},
{
"docstring": "每帧调用,查找鼠标点击",
"name": "update",
"signature": "def update(self)"
},
... | 5 | stack_v2_sparse_classes_30k_train_017766 | Implement the Python class `MenuLabel` described below.
Class description:
菜单系统显示的标签,包含背景
Method signatures and docstrings:
- def __init__(self, menu, type, text, x, y): Args: menu (Menu): menu实例 type (str): prefab名称,用于字体和背景 text (str): 在按钮上显示的文字 x (int): x坐标 y (int): y坐标
- def update(self): 每帧调用,查找鼠标点击
- def set_tex... | Implement the Python class `MenuLabel` described below.
Class description:
菜单系统显示的标签,包含背景
Method signatures and docstrings:
- def __init__(self, menu, type, text, x, y): Args: menu (Menu): menu实例 type (str): prefab名称,用于字体和背景 text (str): 在按钮上显示的文字 x (int): x坐标 y (int): y坐标
- def update(self): 每帧调用,查找鼠标点击
- def set_tex... | 4dfcab372fe3d0562e685b9f553f2af4a83f7f5f | <|skeleton|>
class MenuLabel:
"""菜单系统显示的标签,包含背景"""
def __init__(self, menu, type, text, x, y):
"""Args: menu (Menu): menu实例 type (str): prefab名称,用于字体和背景 text (str): 在按钮上显示的文字 x (int): x坐标 y (int): y坐标"""
<|body_0|>
def update(self):
"""每帧调用,查找鼠标点击"""
<|body_1|>
def set... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MenuLabel:
"""菜单系统显示的标签,包含背景"""
def __init__(self, menu, type, text, x, y):
"""Args: menu (Menu): menu实例 type (str): prefab名称,用于字体和背景 text (str): 在按钮上显示的文字 x (int): x坐标 y (int): y坐标"""
super().__init__(type, x, y)
self.text = text
self.image_template = None
self.hi... | the_stack_v2_python_sparse | 高级编程技术/python-game/tower-defence-master/core/menu.py | ZhuangXuward/Learning-data-backup | train | 0 |
98c2a5d868ed9d9185eddbf19302fa24e35071ea | [
"max_mul = -float('inf')\nfor i in range(len(nums)):\n mul = 1\n for j in range(i, len(nums)):\n mul *= nums[j]\n max_mul = max(max_mul, mul)\nreturn max_mul",
"if not nums:\n return\nmax_num = [0 for _ in range(len(nums))]\nmin_num = [0 for _ in range(len(nums))]\nmax_val = -float('inf')\n... | <|body_start_0|>
max_mul = -float('inf')
for i in range(len(nums)):
mul = 1
for j in range(i, len(nums)):
mul *= nums[j]
max_mul = max(max_mul, mul)
return max_mul
<|end_body_0|>
<|body_start_1|>
if not nums:
return
... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def _maxProduct(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def __maxProduct(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
def maxProduct(self, nums):
""":type nums: List[int] :rtype: int"""
... | stack_v2_sparse_classes_36k_train_034954 | 2,216 | permissive | [
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "_maxProduct",
"signature": "def _maxProduct(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "__maxProduct",
"signature": "def __maxProduct(self, nums)"
},
{
"docstring": ":type nums: List[int... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def _maxProduct(self, nums): :type nums: List[int] :rtype: int
- def __maxProduct(self, nums): :type nums: List[int] :rtype: int
- def maxProduct(self, nums): :type nums: List[in... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def _maxProduct(self, nums): :type nums: List[int] :rtype: int
- def __maxProduct(self, nums): :type nums: List[int] :rtype: int
- def maxProduct(self, nums): :type nums: List[in... | 0dd67edca4e0b0323cb5a7239f02ea46383cd15a | <|skeleton|>
class Solution:
def _maxProduct(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def __maxProduct(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
def maxProduct(self, nums):
""":type nums: List[int] :rtype: int"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def _maxProduct(self, nums):
""":type nums: List[int] :rtype: int"""
max_mul = -float('inf')
for i in range(len(nums)):
mul = 1
for j in range(i, len(nums)):
mul *= nums[j]
max_mul = max(max_mul, mul)
return max_... | the_stack_v2_python_sparse | 152.maximum-product-subarray.py | windard/leeeeee | train | 0 | |
3f4b8f24136aa531101e5c0643163f534ba1ee94 | [
"seg_logits = self(inputs)\nvalid_label_mask = get_valid_label_mask_per_batch(img_metas, self.num_classes)\nlosses = self.losses(seg_logits, gt_semantic_seg, train_cfg, valid_label_mask=valid_label_mask, pixel_weights=pixel_weights)\nif return_logits:\n logits = self.forward_output if self.forward_output is not ... | <|body_start_0|>
seg_logits = self(inputs)
valid_label_mask = get_valid_label_mask_per_batch(img_metas, self.num_classes)
losses = self.losses(seg_logits, gt_semantic_seg, train_cfg, valid_label_mask=valid_label_mask, pixel_weights=pixel_weights)
if return_logits:
logits = se... | PixelWeightsMixin2 | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PixelWeightsMixin2:
def forward_train(self, inputs, img_metas, gt_semantic_seg, train_cfg, pixel_weights=None, return_logits=False):
"""Forward function for training. Args: inputs (list[Tensor]): List of multi-level img features. img_metas (list[dict]): List of image info dict where each... | stack_v2_sparse_classes_36k_train_034955 | 7,209 | permissive | [
{
"docstring": "Forward function for training. Args: inputs (list[Tensor]): List of multi-level img features. img_metas (list[dict]): List of image info dict where each dict has: 'img_shape', 'scale_factor', 'flip', and may also contain 'filename', 'ori_shape', 'pad_shape', 'img_norm_cfg', and 'ignored_labels'.... | 2 | stack_v2_sparse_classes_30k_train_013855 | Implement the Python class `PixelWeightsMixin2` described below.
Class description:
Implement the PixelWeightsMixin2 class.
Method signatures and docstrings:
- def forward_train(self, inputs, img_metas, gt_semantic_seg, train_cfg, pixel_weights=None, return_logits=False): Forward function for training. Args: inputs (... | Implement the Python class `PixelWeightsMixin2` described below.
Class description:
Implement the PixelWeightsMixin2 class.
Method signatures and docstrings:
- def forward_train(self, inputs, img_metas, gt_semantic_seg, train_cfg, pixel_weights=None, return_logits=False): Forward function for training. Args: inputs (... | 6116639caeff100b06a6c10a96c7e7f5951f20c7 | <|skeleton|>
class PixelWeightsMixin2:
def forward_train(self, inputs, img_metas, gt_semantic_seg, train_cfg, pixel_weights=None, return_logits=False):
"""Forward function for training. Args: inputs (list[Tensor]): List of multi-level img features. img_metas (list[dict]): List of image info dict where each... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PixelWeightsMixin2:
def forward_train(self, inputs, img_metas, gt_semantic_seg, train_cfg, pixel_weights=None, return_logits=False):
"""Forward function for training. Args: inputs (list[Tensor]): List of multi-level img features. img_metas (list[dict]): List of image info dict where each dict has: 'im... | the_stack_v2_python_sparse | otx/mpa/modules/models/heads/pixel_weights_mixin.py | GalyaZalesskaya/openvino_training_extensions | train | 0 | |
cefbd0464db5762ad670394baf0502c961302603 | [
"self.caffe = Caffe.objects.create(name='kafo', city='Gliwice', street='Wieczorka', house_number='14', postal_code='44-100')\nself.filtry = Caffe.objects.create(name='filtry', city='Warszawa', street='Filry', house_number='14', postal_code='44-100')\nself.gram = Unit.objects.create(name='gram', caffe=self.caffe)\nU... | <|body_start_0|>
self.caffe = Caffe.objects.create(name='kafo', city='Gliwice', street='Wieczorka', house_number='14', postal_code='44-100')
self.filtry = Caffe.objects.create(name='filtry', city='Warszawa', street='Filry', house_number='14', postal_code='44-100')
self.gram = Unit.objects.create... | Unit tests. | UnitModelTest | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UnitModelTest:
"""Unit tests."""
def setUp(self):
"""Test data setup."""
<|body_0|>
def test_unit(self):
"""Check creating units."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.caffe = Caffe.objects.create(name='kafo', city='Gliwice', stre... | stack_v2_sparse_classes_36k_train_034956 | 14,711 | permissive | [
{
"docstring": "Test data setup.",
"name": "setUp",
"signature": "def setUp(self)"
},
{
"docstring": "Check creating units.",
"name": "test_unit",
"signature": "def test_unit(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_015057 | Implement the Python class `UnitModelTest` described below.
Class description:
Unit tests.
Method signatures and docstrings:
- def setUp(self): Test data setup.
- def test_unit(self): Check creating units. | Implement the Python class `UnitModelTest` described below.
Class description:
Unit tests.
Method signatures and docstrings:
- def setUp(self): Test data setup.
- def test_unit(self): Check creating units.
<|skeleton|>
class UnitModelTest:
"""Unit tests."""
def setUp(self):
"""Test data setup."""
... | cdb7f5edb29255c7e874eaa6231621063210a8b0 | <|skeleton|>
class UnitModelTest:
"""Unit tests."""
def setUp(self):
"""Test data setup."""
<|body_0|>
def test_unit(self):
"""Check creating units."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UnitModelTest:
"""Unit tests."""
def setUp(self):
"""Test data setup."""
self.caffe = Caffe.objects.create(name='kafo', city='Gliwice', street='Wieczorka', house_number='14', postal_code='44-100')
self.filtry = Caffe.objects.create(name='filtry', city='Warszawa', street='Filry', h... | the_stack_v2_python_sparse | caffe/reports/test_models.py | VirrageS/io-kawiarnie | train | 3 |
4a8f0e5e1d53827cd43c487ddf3b7f384c341376 | [
"if not isinstance(item, Area):\n raise TypeError(f'{item} is not an Area. Only Area objects can be inside Areas.')\nself.data.append(item)",
"containing = Areas()\nfor area in self:\n field = rgetattr(area, field_name)\n if field.value == field_value:\n containing.append(area)\nreturn containing"... | <|body_start_0|>
if not isinstance(item, Area):
raise TypeError(f'{item} is not an Area. Only Area objects can be inside Areas.')
self.data.append(item)
<|end_body_0|>
<|body_start_1|>
containing = Areas()
for area in self:
field = rgetattr(area, field_name)
... | Searchable collection of Areas. Behaves like a list. | Areas | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Areas:
"""Searchable collection of Areas. Behaves like a list."""
def append(self, item: Area) -> None:
"""Add a new Area to the container. Raises: TypeError: If a non-Area object is given."""
<|body_0|>
def containing(self, field_name: str, field_value: str):
""... | stack_v2_sparse_classes_36k_train_034957 | 3,005 | permissive | [
{
"docstring": "Add a new Area to the container. Raises: TypeError: If a non-Area object is given.",
"name": "append",
"signature": "def append(self, item: Area) -> None"
},
{
"docstring": "Search for Areas where the Field's value matches the expected value and then returns an Areas object with ... | 3 | stack_v2_sparse_classes_30k_train_002788 | Implement the Python class `Areas` described below.
Class description:
Searchable collection of Areas. Behaves like a list.
Method signatures and docstrings:
- def append(self, item: Area) -> None: Add a new Area to the container. Raises: TypeError: If a non-Area object is given.
- def containing(self, field_name: st... | Implement the Python class `Areas` described below.
Class description:
Searchable collection of Areas. Behaves like a list.
Method signatures and docstrings:
- def append(self, item: Area) -> None: Add a new Area to the container. Raises: TypeError: If a non-Area object is given.
- def containing(self, field_name: st... | c9864db2237d63055378c30652f43c84d20b3592 | <|skeleton|>
class Areas:
"""Searchable collection of Areas. Behaves like a list."""
def append(self, item: Area) -> None:
"""Add a new Area to the container. Raises: TypeError: If a non-Area object is given."""
<|body_0|>
def containing(self, field_name: str, field_value: str):
""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Areas:
"""Searchable collection of Areas. Behaves like a list."""
def append(self, item: Area) -> None:
"""Add a new Area to the container. Raises: TypeError: If a non-Area object is given."""
if not isinstance(item, Area):
raise TypeError(f'{item} is not an Area. Only Area ob... | the_stack_v2_python_sparse | stere/areas/areas.py | jsfehler/stere | train | 23 |
17f63617387c3b441ab93f51252e403d3f32a010 | [
"tk.Frame.__init__(self, parent, relief=const.DAO_FRAME_RELIEF, padx=const.DAO_FRAME_PADX, pady=const.DAO_FRAME_PADY, bd=const.DAO_FRAME_BD)\nself._cio_output = []\nself._lbl_title = tk.Label(self, font=const.DAO_TITLE_FONT, text=const.DAO_TITLE_TEXT, padx=const.DAO_TITLE_PADX, pady=const.DAO_TITLE_PADY)\nself._f_o... | <|body_start_0|>
tk.Frame.__init__(self, parent, relief=const.DAO_FRAME_RELIEF, padx=const.DAO_FRAME_PADX, pady=const.DAO_FRAME_PADY, bd=const.DAO_FRAME_BD)
self._cio_output = []
self._lbl_title = tk.Label(self, font=const.DAO_TITLE_FONT, text=const.DAO_TITLE_TEXT, padx=const.DAO_TITLE_PADX, pad... | DataAugmentationOutputF | [
"CC-BY-3.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DataAugmentationOutputF:
def __init__(self, parent, disabled=False):
""":param parent: Parent. :param disabled: - Default: False; - If True all the widgets will be disabled."""
<|body_0|>
def update_status(self, data_augmentation_options: DataAugmentation):
"""- Upda... | stack_v2_sparse_classes_36k_train_034958 | 3,130 | permissive | [
{
"docstring": ":param parent: Parent. :param disabled: - Default: False; - If True all the widgets will be disabled.",
"name": "__init__",
"signature": "def __init__(self, parent, disabled=False)"
},
{
"docstring": "- Updates the option's state. :param data_augmentation_options: DataAugmentatio... | 4 | null | Implement the Python class `DataAugmentationOutputF` described below.
Class description:
Implement the DataAugmentationOutputF class.
Method signatures and docstrings:
- def __init__(self, parent, disabled=False): :param parent: Parent. :param disabled: - Default: False; - If True all the widgets will be disabled.
- ... | Implement the Python class `DataAugmentationOutputF` described below.
Class description:
Implement the DataAugmentationOutputF class.
Method signatures and docstrings:
- def __init__(self, parent, disabled=False): :param parent: Parent. :param disabled: - Default: False; - If True all the widgets will be disabled.
- ... | 138c7fa83e084ccb8f5c2ad8827f1fbb2527c00c | <|skeleton|>
class DataAugmentationOutputF:
def __init__(self, parent, disabled=False):
""":param parent: Parent. :param disabled: - Default: False; - If True all the widgets will be disabled."""
<|body_0|>
def update_status(self, data_augmentation_options: DataAugmentation):
"""- Upda... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DataAugmentationOutputF:
def __init__(self, parent, disabled=False):
""":param parent: Parent. :param disabled: - Default: False; - If True all the widgets will be disabled."""
tk.Frame.__init__(self, parent, relief=const.DAO_FRAME_RELIEF, padx=const.DAO_FRAME_PADX, pady=const.DAO_FRAME_PADY, ... | the_stack_v2_python_sparse | graphics/output/data_augmentation_output_f.py | iliesidaniel/image-classification | train | 0 | |
96913276d483996a4c499e7aa1c4c45970014abc | [
"logger.info('BWA Indexer')\nTool.__init__(self)\nif configuration is None:\n configuration = {}\nself.configuration.update(configuration)",
"au_handler = alignerUtils()\namb_loc, ann_loc, bwt_loc, pac_loc, sa_loc = au_handler.bwa_index_genome(file_loc)\ntry:\n logger.info('BWA - idx_out', idx_out, idx_out.... | <|body_start_0|>
logger.info('BWA Indexer')
Tool.__init__(self)
if configuration is None:
configuration = {}
self.configuration.update(configuration)
<|end_body_0|>
<|body_start_1|>
au_handler = alignerUtils()
amb_loc, ann_loc, bwt_loc, pac_loc, sa_loc = au_h... | Tool for running indexers over a genome FASTA file | bwaIndexerTool | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class bwaIndexerTool:
"""Tool for running indexers over a genome FASTA file"""
def __init__(self, configuration=None):
"""Initialise the tool with its configuration. Parameters ---------- configuration : dict a dictionary containing parameters that define how the operation should be carrie... | stack_v2_sparse_classes_36k_train_034959 | 5,186 | permissive | [
{
"docstring": "Initialise the tool with its configuration. Parameters ---------- configuration : dict a dictionary containing parameters that define how the operation should be carried out, which are specific to each Tool.",
"name": "__init__",
"signature": "def __init__(self, configuration=None)"
},... | 3 | stack_v2_sparse_classes_30k_train_006249 | Implement the Python class `bwaIndexerTool` described below.
Class description:
Tool for running indexers over a genome FASTA file
Method signatures and docstrings:
- def __init__(self, configuration=None): Initialise the tool with its configuration. Parameters ---------- configuration : dict a dictionary containing ... | Implement the Python class `bwaIndexerTool` described below.
Class description:
Tool for running indexers over a genome FASTA file
Method signatures and docstrings:
- def __init__(self, configuration=None): Initialise the tool with its configuration. Parameters ---------- configuration : dict a dictionary containing ... | 50c7115c0c1a6af48dc34f275e469d1b9eb02999 | <|skeleton|>
class bwaIndexerTool:
"""Tool for running indexers over a genome FASTA file"""
def __init__(self, configuration=None):
"""Initialise the tool with its configuration. Parameters ---------- configuration : dict a dictionary containing parameters that define how the operation should be carrie... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class bwaIndexerTool:
"""Tool for running indexers over a genome FASTA file"""
def __init__(self, configuration=None):
"""Initialise the tool with its configuration. Parameters ---------- configuration : dict a dictionary containing parameters that define how the operation should be carried out, which ... | the_stack_v2_python_sparse | tool/bwa_indexer.py | Multiscale-Genomics/mg-process-fastq | train | 2 |
f1f2ab8a2dd361b8dd32ad5e25f9c3c0393a02d9 | [
"if not field:\n raise ValueError('Empty field name.')\nif not is_string(field):\n raise TypeError('The field name must be a string, not {0}'.format(type(field).__name__))\nif ' ' in field:\n raise ValueError(\"Field name can't contain spaces.\")\nself.__field = field\nspecifications = _get_specifications(... | <|body_start_0|>
if not field:
raise ValueError('Empty field name.')
if not is_string(field):
raise TypeError('The field name must be a string, not {0}'.format(type(field).__name__))
if ' ' in field:
raise ValueError("Field name can't contain spaces.")
... | @RequiresMap decorator Defines a required service, injected in a dictionary | RequiresMap | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RequiresMap:
"""@RequiresMap decorator Defines a required service, injected in a dictionary"""
def __init__(self, field, specification, key, allow_none=False, aggregate=False, optional=False, spec_filter=None):
"""Sets up the requirement :param field: The injected field :param specif... | stack_v2_sparse_classes_36k_train_034960 | 41,418 | permissive | [
{
"docstring": "Sets up the requirement :param field: The injected field :param specification: The injected service specification :param key: Name of the service property to use as a dictionary key :param allow_none: If True, inject services with a None property value :param aggregate: If true, injects a list :... | 2 | stack_v2_sparse_classes_30k_val_000021 | Implement the Python class `RequiresMap` described below.
Class description:
@RequiresMap decorator Defines a required service, injected in a dictionary
Method signatures and docstrings:
- def __init__(self, field, specification, key, allow_none=False, aggregate=False, optional=False, spec_filter=None): Sets up the r... | Implement the Python class `RequiresMap` described below.
Class description:
@RequiresMap decorator Defines a required service, injected in a dictionary
Method signatures and docstrings:
- def __init__(self, field, specification, key, allow_none=False, aggregate=False, optional=False, spec_filter=None): Sets up the r... | 686556cdde20beba77ae202de9969be46feed5e2 | <|skeleton|>
class RequiresMap:
"""@RequiresMap decorator Defines a required service, injected in a dictionary"""
def __init__(self, field, specification, key, allow_none=False, aggregate=False, optional=False, spec_filter=None):
"""Sets up the requirement :param field: The injected field :param specif... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RequiresMap:
"""@RequiresMap decorator Defines a required service, injected in a dictionary"""
def __init__(self, field, specification, key, allow_none=False, aggregate=False, optional=False, spec_filter=None):
"""Sets up the requirement :param field: The injected field :param specification: The ... | the_stack_v2_python_sparse | python/src/lib/python/pelix/ipopo/decorators.py | cohorte/cohorte-runtime | train | 3 |
d467e86a4e75da9cb5d5e31ea34863e88cb706e8 | [
"super().__init__(self.PROBLEM_NAME)\nself.input_string1 = input_string1\nself.input_string2 = input_string2",
"print('Solving {} problem ...'.format(self.PROBLEM_NAME))\nlen1 = len(self.input_string1)\nlen2 = len(self.input_string2)\nlcs_matrix = [[None] * (len2 + 1) for i in range(len1 + 1)]\n'Following steps b... | <|body_start_0|>
super().__init__(self.PROBLEM_NAME)
self.input_string1 = input_string1
self.input_string2 = input_string2
<|end_body_0|>
<|body_start_1|>
print('Solving {} problem ...'.format(self.PROBLEM_NAME))
len1 = len(self.input_string1)
len2 = len(self.input_strin... | LongestCommonSubsequence | LongestCommonSubsequence | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LongestCommonSubsequence:
"""LongestCommonSubsequence"""
def __init__(self, input_string1, input_string2):
"""LongestCommonSubsequence Args: input_string1: First string input_string2: Second string Returns: None Raises: None"""
<|body_0|>
def solve(self):
"""Solv... | stack_v2_sparse_classes_36k_train_034961 | 1,976 | no_license | [
{
"docstring": "LongestCommonSubsequence Args: input_string1: First string input_string2: Second string Returns: None Raises: None",
"name": "__init__",
"signature": "def __init__(self, input_string1, input_string2)"
},
{
"docstring": "Solve the problem Args: Note: O(mn) solution uses dynamic pr... | 2 | null | Implement the Python class `LongestCommonSubsequence` described below.
Class description:
LongestCommonSubsequence
Method signatures and docstrings:
- def __init__(self, input_string1, input_string2): LongestCommonSubsequence Args: input_string1: First string input_string2: Second string Returns: None Raises: None
- ... | Implement the Python class `LongestCommonSubsequence` described below.
Class description:
LongestCommonSubsequence
Method signatures and docstrings:
- def __init__(self, input_string1, input_string2): LongestCommonSubsequence Args: input_string1: First string input_string2: Second string Returns: None Raises: None
- ... | 11f4d25cb211740514c119a60962d075a0817abd | <|skeleton|>
class LongestCommonSubsequence:
"""LongestCommonSubsequence"""
def __init__(self, input_string1, input_string2):
"""LongestCommonSubsequence Args: input_string1: First string input_string2: Second string Returns: None Raises: None"""
<|body_0|>
def solve(self):
"""Solv... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LongestCommonSubsequence:
"""LongestCommonSubsequence"""
def __init__(self, input_string1, input_string2):
"""LongestCommonSubsequence Args: input_string1: First string input_string2: Second string Returns: None Raises: None"""
super().__init__(self.PROBLEM_NAME)
self.input_string... | the_stack_v2_python_sparse | python/problems/dynamic_programming/longest_common_subsequence.py | santhosh-kumar/AlgorithmsAndDataStructures | train | 2 |
41e2ae7491efb761ae9b4e1d6082af78c43f2db5 | [
"from collections import defaultdict\nif not stones:\n return True\ndp = defaultdict(set)\ndp[1] = set([1])\nstones_set = set(stones)\nfor i, v in enumerate(stones):\n if v == 0:\n continue\n for prev_k in dp[v]:\n for next_k in [prev_k - 1, prev_k, prev_k + 1]:\n if v + next_k in ... | <|body_start_0|>
from collections import defaultdict
if not stones:
return True
dp = defaultdict(set)
dp[1] = set([1])
stones_set = set(stones)
for i, v in enumerate(stones):
if v == 0:
continue
for prev_k in dp[v]:
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def canCross(self, stones: List[int]) -> bool:
"""Dynamic Programming"""
<|body_0|>
def can_cross(self, stones: List[int]) -> bool:
"""DFS"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
from collections import defaultdict
if not s... | stack_v2_sparse_classes_36k_train_034962 | 1,262 | no_license | [
{
"docstring": "Dynamic Programming",
"name": "canCross",
"signature": "def canCross(self, stones: List[int]) -> bool"
},
{
"docstring": "DFS",
"name": "can_cross",
"signature": "def can_cross(self, stones: List[int]) -> bool"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def canCross(self, stones: List[int]) -> bool: Dynamic Programming
- def can_cross(self, stones: List[int]) -> bool: DFS | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def canCross(self, stones: List[int]) -> bool: Dynamic Programming
- def can_cross(self, stones: List[int]) -> bool: DFS
<|skeleton|>
class Solution:
def canCross(self, sto... | 33252434f8d90b46fd2de07e257842331dcd81a8 | <|skeleton|>
class Solution:
def canCross(self, stones: List[int]) -> bool:
"""Dynamic Programming"""
<|body_0|>
def can_cross(self, stones: List[int]) -> bool:
"""DFS"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def canCross(self, stones: List[int]) -> bool:
"""Dynamic Programming"""
from collections import defaultdict
if not stones:
return True
dp = defaultdict(set)
dp[1] = set([1])
stones_set = set(stones)
for i, v in enumerate(stones):
... | the_stack_v2_python_sparse | main/leetcode/403.py | dawnonme/Eureka | train | 0 | |
dab313f28337b078371feb476773f309f0e900ce | [
"super().__init__()\nself._log_std_min = log_std_min\nself._log_std_max = log_std_max\nself.net = mlp([obs_dim] + list(hidden_sizes), nn.ReLU, nn.ReLU)\nself.mu = nn.Linear(hidden_sizes[-1], act_dim)\nself.log_sigma = nn.Linear(hidden_sizes[-1], act_dim)",
"net_out = self.net(obs)\n_ = self.mu(net_out)\nlog_std =... | <|body_start_0|>
super().__init__()
self._log_std_min = log_std_min
self._log_std_max = log_std_max
self.net = mlp([obs_dim] + list(hidden_sizes), nn.ReLU, nn.ReLU)
self.mu = nn.Linear(hidden_sizes[-1], act_dim)
self.log_sigma = nn.Linear(hidden_sizes[-1], act_dim)
<|end_... | The squashed gaussian actor network. Attributes: net (torch.nn.modules.container.Sequential): The input/hidden layers of the network. mu (torch.nn.modules.linear.Linear): The output layer which returns the mean of the actions. log_sigma (torch.nn.modules.linear.Linear): The output layer which returns the log standard d... | SquashedGaussianMLPActor | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SquashedGaussianMLPActor:
"""The squashed gaussian actor network. Attributes: net (torch.nn.modules.container.Sequential): The input/hidden layers of the network. mu (torch.nn.modules.linear.Linear): The output layer which returns the mean of the actions. log_sigma (torch.nn.modules.linear.Linear... | stack_v2_sparse_classes_36k_train_034963 | 2,937 | no_license | [
{
"docstring": "Constructs all the necessary attributes for the Squashed Gaussian Actor object. Args: obs_dim (int): Dimension of the observation space. act_dim (int): Dimension of the action space. hidden_sizes (list): Sizes of the hidden layers. log_std_min (int, optional): The minimum log standard deviation.... | 2 | stack_v2_sparse_classes_30k_train_005418 | Implement the Python class `SquashedGaussianMLPActor` described below.
Class description:
The squashed gaussian actor network. Attributes: net (torch.nn.modules.container.Sequential): The input/hidden layers of the network. mu (torch.nn.modules.linear.Linear): The output layer which returns the mean of the actions. lo... | Implement the Python class `SquashedGaussianMLPActor` described below.
Class description:
The squashed gaussian actor network. Attributes: net (torch.nn.modules.container.Sequential): The input/hidden layers of the network. mu (torch.nn.modules.linear.Linear): The output layer which returns the mean of the actions. lo... | 7828af7b44f54b0d9ed8a7bd11dd0dd4738a3d2e | <|skeleton|>
class SquashedGaussianMLPActor:
"""The squashed gaussian actor network. Attributes: net (torch.nn.modules.container.Sequential): The input/hidden layers of the network. mu (torch.nn.modules.linear.Linear): The output layer which returns the mean of the actions. log_sigma (torch.nn.modules.linear.Linear... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SquashedGaussianMLPActor:
"""The squashed gaussian actor network. Attributes: net (torch.nn.modules.container.Sequential): The input/hidden layers of the network. mu (torch.nn.modules.linear.Linear): The output layer which returns the mean of the actions. log_sigma (torch.nn.modules.linear.Linear): The output... | the_stack_v2_python_sparse | sandbox/speed_comparison/timeit_comparison/gaussian_actor_torch_small.py | rickstaa/LAC-TF2-TORCH-translation | train | 0 |
5648299478f8283ce1d66ed093898dbbbe8e8113 | [
"if self.request.validated['tender_status'] == 'active.tendering' and calculate_business_date(get_now(), TENDERING_EXTRA_PERIOD, self.request.validated['tender']) > self.request.validated['tender'].tenderPeriod.endDate:\n raise_operation_error(self.request, 'tenderPeriod should be extended by {0.days} days'.form... | <|body_start_0|>
if self.request.validated['tender_status'] == 'active.tendering' and calculate_business_date(get_now(), TENDERING_EXTRA_PERIOD, self.request.validated['tender']) > self.request.validated['tender'].tenderPeriod.endDate:
raise_operation_error(self.request, 'tenderPeriod should be exte... | TenderUaDocumentResource | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TenderUaDocumentResource:
def validate_update_tender(self):
"""TODO move validators This class is inherited in cd stage 2 package, but validate_update_tender function has different validators. For now, we have no way to use different validators on methods according to procedure type."""
... | stack_v2_sparse_classes_36k_train_034964 | 5,027 | permissive | [
{
"docstring": "TODO move validators This class is inherited in cd stage 2 package, but validate_update_tender function has different validators. For now, we have no way to use different validators on methods according to procedure type.",
"name": "validate_update_tender",
"signature": "def validate_upd... | 4 | stack_v2_sparse_classes_30k_train_011231 | Implement the Python class `TenderUaDocumentResource` described below.
Class description:
Implement the TenderUaDocumentResource class.
Method signatures and docstrings:
- def validate_update_tender(self): TODO move validators This class is inherited in cd stage 2 package, but validate_update_tender function has diff... | Implement the Python class `TenderUaDocumentResource` described below.
Class description:
Implement the TenderUaDocumentResource class.
Method signatures and docstrings:
- def validate_update_tender(self): TODO move validators This class is inherited in cd stage 2 package, but validate_update_tender function has diff... | 5586f483021ff1d8e89ba0e932e4db53c8c06e74 | <|skeleton|>
class TenderUaDocumentResource:
def validate_update_tender(self):
"""TODO move validators This class is inherited in cd stage 2 package, but validate_update_tender function has different validators. For now, we have no way to use different validators on methods according to procedure type."""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TenderUaDocumentResource:
def validate_update_tender(self):
"""TODO move validators This class is inherited in cd stage 2 package, but validate_update_tender function has different validators. For now, we have no way to use different validators on methods according to procedure type."""
if sel... | the_stack_v2_python_sparse | openprocurement/tender/openua/views/tender_document.py | ProzorroUKR/openprocurement.tender.openua | train | 0 | |
d3d358dc1644305c04e334c95458237ecb8416e2 | [
"self._param = kwargs.copy()\nfparam = kwargs.copy()\nif 'upsert' in fparam:\n fparam.pop('upsert')\nself._collect = pymongo.MongoClient(host, port, **fparam)[db][collection]",
"if '_id' in value.keys():\n try:\n self._collect.insert(value)\n self.logger.info('Insert document with _id {0}'.for... | <|body_start_0|>
self._param = kwargs.copy()
fparam = kwargs.copy()
if 'upsert' in fparam:
fparam.pop('upsert')
self._collect = pymongo.MongoClient(host, port, **fparam)[db][collection]
<|end_body_0|>
<|body_start_1|>
if '_id' in value.keys():
try:
... | MongoDBDriver | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MongoDBDriver:
def __init__(self, host='localhost', port=27017, db='test', collection='collection', **kwargs):
"""如果存在名称为_id的字段,则使用此字段中的值为documents的_id @param upsert: 当存在名称为_id的字段时,如果该_id存在, 且upins为True则更新其内容;否则不做更改 z @param kwargs: Others paramters of mongodb, e.g. socketTimeoutMS, conn... | stack_v2_sparse_classes_36k_train_034965 | 1,661 | no_license | [
{
"docstring": "如果存在名称为_id的字段,则使用此字段中的值为documents的_id @param upsert: 当存在名称为_id的字段时,如果该_id存在, 且upins为True则更新其内容;否则不做更改 z @param kwargs: Others paramters of mongodb, e.g. socketTimeoutMS, connectTimeoutMS @return: 文档``_id``",
"name": "__init__",
"signature": "def __init__(self, host='localhost', port=2701... | 2 | stack_v2_sparse_classes_30k_train_000619 | Implement the Python class `MongoDBDriver` described below.
Class description:
Implement the MongoDBDriver class.
Method signatures and docstrings:
- def __init__(self, host='localhost', port=27017, db='test', collection='collection', **kwargs): 如果存在名称为_id的字段,则使用此字段中的值为documents的_id @param upsert: 当存在名称为_id的字段时,如果该_i... | Implement the Python class `MongoDBDriver` described below.
Class description:
Implement the MongoDBDriver class.
Method signatures and docstrings:
- def __init__(self, host='localhost', port=27017, db='test', collection='collection', **kwargs): 如果存在名称为_id的字段,则使用此字段中的值为documents的_id @param upsert: 当存在名称为_id的字段时,如果该_i... | 15e72f41d66899cc0b85bf62eb2c659b6cc8efd1 | <|skeleton|>
class MongoDBDriver:
def __init__(self, host='localhost', port=27017, db='test', collection='collection', **kwargs):
"""如果存在名称为_id的字段,则使用此字段中的值为documents的_id @param upsert: 当存在名称为_id的字段时,如果该_id存在, 且upins为True则更新其内容;否则不做更改 z @param kwargs: Others paramters of mongodb, e.g. socketTimeoutMS, conn... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MongoDBDriver:
def __init__(self, host='localhost', port=27017, db='test', collection='collection', **kwargs):
"""如果存在名称为_id的字段,则使用此字段中的值为documents的_id @param upsert: 当存在名称为_id的字段时,如果该_id存在, 且upins为True则更新其内容;否则不做更改 z @param kwargs: Others paramters of mongodb, e.g. socketTimeoutMS, connectTimeoutMS @... | the_stack_v2_python_sparse | spiderflow/storage/mongostorage.py | zzpwelkin/autospider | train | 1 | |
610a5c3471eaac24cc4dc102d099c366b7af718b | [
"if index is None:\n index_ = np.arange(self.n_views_)\nelse:\n index_ = np.copy(index)\n index_ = np.atleast_1d(index_)\nassert len(index_) == len(Xs)\ncheck_is_fitted(self)\nXs = check_Xs(Xs)\nXs_transformed = []\nfor estimator, X in zip([self.estimators_[i] for i in index_], Xs):\n Xs_transformed.app... | <|body_start_0|>
if index is None:
index_ = np.arange(self.n_views_)
else:
index_ = np.copy(index)
index_ = np.atleast_1d(index_)
assert len(index_) == len(Xs)
check_is_fitted(self)
Xs = check_Xs(Xs)
Xs_transformed = []
for esti... | Apply a sklearn transformer to each view of a dataset Build a transformer from multiview dataset to multiview dataset by using one or more individual scikit-learn transformers on each view. Parameters ---------- base_estimator : a sklearn transformer instance, or a list Either a single sklearn transformer that will be ... | ViewTransformer | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ViewTransformer:
"""Apply a sklearn transformer to each view of a dataset Build a transformer from multiview dataset to multiview dataset by using one or more individual scikit-learn transformers on each view. Parameters ---------- base_estimator : a sklearn transformer instance, or a list Either... | stack_v2_sparse_classes_36k_train_034966 | 10,189 | permissive | [
{
"docstring": "Transform each dataset Applies the transform of each transformer on the individual views. Parameters ---------- Xs : list of array-likes or numpy.ndarray - Xs length: n_views - Xs[i] shape: (n_samples, n_features_i) The input data. index: int or array-like, default=None The index or list of indi... | 3 | null | Implement the Python class `ViewTransformer` described below.
Class description:
Apply a sklearn transformer to each view of a dataset Build a transformer from multiview dataset to multiview dataset by using one or more individual scikit-learn transformers on each view. Parameters ---------- base_estimator : a sklearn... | Implement the Python class `ViewTransformer` described below.
Class description:
Apply a sklearn transformer to each view of a dataset Build a transformer from multiview dataset to multiview dataset by using one or more individual scikit-learn transformers on each view. Parameters ---------- base_estimator : a sklearn... | 003dccea563926fca5d957f5bbf39c1494acfe94 | <|skeleton|>
class ViewTransformer:
"""Apply a sklearn transformer to each view of a dataset Build a transformer from multiview dataset to multiview dataset by using one or more individual scikit-learn transformers on each view. Parameters ---------- base_estimator : a sklearn transformer instance, or a list Either... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ViewTransformer:
"""Apply a sklearn transformer to each view of a dataset Build a transformer from multiview dataset to multiview dataset by using one or more individual scikit-learn transformers on each view. Parameters ---------- base_estimator : a sklearn transformer instance, or a list Either a single skl... | the_stack_v2_python_sparse | mvlearn/compose/wrap.py | mvlearn/mvlearn | train | 136 |
207e23d8f9b38c2531e34335e73ab15c27390800 | [
"st, c1, min_so_far, result, fmap = (0, Counter(t), len(s) + 1, '', defaultdict(int))\nunique_ch = len(c1)\nfor end in range(len(s)):\n if s[end] in c1:\n fmap[s[end]] += 1\n if fmap[s[end]] == c1[s[end]]:\n unique_ch -= 1\n while st <= end and unique_ch == 0:\n if end ... | <|body_start_0|>
st, c1, min_so_far, result, fmap = (0, Counter(t), len(s) + 1, '', defaultdict(int))
unique_ch = len(c1)
for end in range(len(s)):
if s[end] in c1:
fmap[s[end]] += 1
if fmap[s[end]] == c1[s[end]]:
unique_ch -= 1
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def minWindow(self, s: str, t: str) -> str:
""":type s: str :type t: str :rtype: str"""
<|body_0|>
def minWindow_facebook_and_google_phone_screen(self, s: str, t: List[str]) -> str:
""":type s: str :type t: List[str] :rtype: str"""
<|body_1|>
<|end... | stack_v2_sparse_classes_36k_train_034967 | 7,059 | no_license | [
{
"docstring": ":type s: str :type t: str :rtype: str",
"name": "minWindow",
"signature": "def minWindow(self, s: str, t: str) -> str"
},
{
"docstring": ":type s: str :type t: List[str] :rtype: str",
"name": "minWindow_facebook_and_google_phone_screen",
"signature": "def minWindow_facebo... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minWindow(self, s: str, t: str) -> str: :type s: str :type t: str :rtype: str
- def minWindow_facebook_and_google_phone_screen(self, s: str, t: List[str]) -> str: :type s: st... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minWindow(self, s: str, t: str) -> str: :type s: str :type t: str :rtype: str
- def minWindow_facebook_and_google_phone_screen(self, s: str, t: List[str]) -> str: :type s: st... | f2621cd76822a922c49b60f32931f26cce1c571d | <|skeleton|>
class Solution:
def minWindow(self, s: str, t: str) -> str:
""":type s: str :type t: str :rtype: str"""
<|body_0|>
def minWindow_facebook_and_google_phone_screen(self, s: str, t: List[str]) -> str:
""":type s: str :type t: List[str] :rtype: str"""
<|body_1|>
<|end... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def minWindow(self, s: str, t: str) -> str:
""":type s: str :type t: str :rtype: str"""
st, c1, min_so_far, result, fmap = (0, Counter(t), len(s) + 1, '', defaultdict(int))
unique_ch = len(c1)
for end in range(len(s)):
if s[end] in c1:
fmap... | the_stack_v2_python_sparse | String/022_leetcode_P_076_MinimumWindowSubstring/Solution.py | Keshav1506/competitive_programming | train | 0 | |
519411b913798932158b515005e45c3c44e01cae | [
"assert policy in {'newest', 'oldest', 'lowest', 'highest'}\nself.policy = policy\nself.counter = itertools.count()\nself.notes = list()\nheapq.heapify(self.notes)",
"if self.policy == 'newest':\n key = next(self.counter)\nelif self.policy == 'oldest':\n key = -next(self.counter)\nelif self.policy == 'highe... | <|body_start_0|>
assert policy in {'newest', 'oldest', 'lowest', 'highest'}
self.policy = policy
self.counter = itertools.count()
self.notes = list()
heapq.heapify(self.notes)
<|end_body_0|>
<|body_start_1|>
if self.policy == 'newest':
key = next(self.counter... | Note scheduling for monophonic synthesizers. Manages the active note-ons. Notes get inserted-sorted according to chosen policy. | NoteScheduler | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NoteScheduler:
"""Note scheduling for monophonic synthesizers. Manages the active note-ons. Notes get inserted-sorted according to chosen policy."""
def __init__(self, policy='newest'):
"""Kwargs: policy (str): Note scheduling policy."""
<|body_0|>
def get_key(self, note... | stack_v2_sparse_classes_36k_train_034968 | 7,904 | no_license | [
{
"docstring": "Kwargs: policy (str): Note scheduling policy.",
"name": "__init__",
"signature": "def __init__(self, policy='newest')"
},
{
"docstring": "Note key function. Get key for note according to scheduling policy.",
"name": "get_key",
"signature": "def get_key(self, note)"
},
... | 5 | null | Implement the Python class `NoteScheduler` described below.
Class description:
Note scheduling for monophonic synthesizers. Manages the active note-ons. Notes get inserted-sorted according to chosen policy.
Method signatures and docstrings:
- def __init__(self, policy='newest'): Kwargs: policy (str): Note scheduling ... | Implement the Python class `NoteScheduler` described below.
Class description:
Note scheduling for monophonic synthesizers. Manages the active note-ons. Notes get inserted-sorted according to chosen policy.
Method signatures and docstrings:
- def __init__(self, policy='newest'): Kwargs: policy (str): Note scheduling ... | 94b7e8eb399bb4d1a9096cf5514c0359f2125589 | <|skeleton|>
class NoteScheduler:
"""Note scheduling for monophonic synthesizers. Manages the active note-ons. Notes get inserted-sorted according to chosen policy."""
def __init__(self, policy='newest'):
"""Kwargs: policy (str): Note scheduling policy."""
<|body_0|>
def get_key(self, note... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NoteScheduler:
"""Note scheduling for monophonic synthesizers. Manages the active note-ons. Notes get inserted-sorted according to chosen policy."""
def __init__(self, policy='newest'):
"""Kwargs: policy (str): Note scheduling policy."""
assert policy in {'newest', 'oldest', 'lowest', 'hi... | the_stack_v2_python_sparse | klang/audio/synthesizer.py | atheler/klang | train | 21 |
367aa5f4410ffc2e15bfdf9cc877ada54a190d81 | [
"if not parse_node:\n raise TypeError('parse_node cannot be null.')\ntry:\n mapping_value = parse_node.get_child_node('@odata.type').get_str_value()\nexcept AttributeError:\n mapping_value = None\nif mapping_value and mapping_value.casefold() == '#microsoft.graph.serviceHealthIssue'.casefold():\n from .... | <|body_start_0|>
if not parse_node:
raise TypeError('parse_node cannot be null.')
try:
mapping_value = parse_node.get_child_node('@odata.type').get_str_value()
except AttributeError:
mapping_value = None
if mapping_value and mapping_value.casefold() ==... | ServiceAnnouncementBase | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ServiceAnnouncementBase:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ServiceAnnouncementBase:
"""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 creat... | stack_v2_sparse_classes_36k_train_034969 | 4,266 | 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: ServiceAnnouncementBase",
"name": "create_from_discriminator_value",
"signature": "def create_from_discrimin... | 3 | null | Implement the Python class `ServiceAnnouncementBase` described below.
Class description:
Implement the ServiceAnnouncementBase class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ServiceAnnouncementBase: Creates a new instance of the appropriate clas... | Implement the Python class `ServiceAnnouncementBase` described below.
Class description:
Implement the ServiceAnnouncementBase class.
Method signatures and docstrings:
- def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ServiceAnnouncementBase: Creates a new instance of the appropriate clas... | 27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949 | <|skeleton|>
class ServiceAnnouncementBase:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ServiceAnnouncementBase:
"""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 creat... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ServiceAnnouncementBase:
def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> ServiceAnnouncementBase:
"""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 R... | the_stack_v2_python_sparse | msgraph/generated/models/service_announcement_base.py | microsoftgraph/msgraph-sdk-python | train | 135 | |
26e5453708fabaa4561fd001b114bb6e389dba81 | [
"parser = config_file.SshdConfigParser()\nresults = list(parser.Parse(None, StringIO.StringIO(CFG), None))\nself.assertEqual(1, len(results))\nreturn results[0]",
"result = self.GetConfig()\nself.assertTrue(isinstance(result, rdfvalue.SshdConfig))\nself.assertItemsEqual([2], result.config.protocol)\nexpect = ['ae... | <|body_start_0|>
parser = config_file.SshdConfigParser()
results = list(parser.Parse(None, StringIO.StringIO(CFG), None))
self.assertEqual(1, len(results))
return results[0]
<|end_body_0|>
<|body_start_1|>
result = self.GetConfig()
self.assertTrue(isinstance(result, rdfv... | Test parsing of an sshd configuration. | SshdConfigTest | [
"Apache-2.0",
"DOC"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SshdConfigTest:
"""Test parsing of an sshd configuration."""
def GetConfig(self):
"""Read in the test configuration file."""
<|body_0|>
def testParseConfig(self):
"""Ensure we can extract sshd settings."""
<|body_1|>
def testFindNumericValues(self):
... | stack_v2_sparse_classes_36k_train_034970 | 2,239 | permissive | [
{
"docstring": "Read in the test configuration file.",
"name": "GetConfig",
"signature": "def GetConfig(self)"
},
{
"docstring": "Ensure we can extract sshd settings.",
"name": "testParseConfig",
"signature": "def testParseConfig(self)"
},
{
"docstring": "Keywords with numeric se... | 4 | null | Implement the Python class `SshdConfigTest` described below.
Class description:
Test parsing of an sshd configuration.
Method signatures and docstrings:
- def GetConfig(self): Read in the test configuration file.
- def testParseConfig(self): Ensure we can extract sshd settings.
- def testFindNumericValues(self): Keyw... | Implement the Python class `SshdConfigTest` described below.
Class description:
Test parsing of an sshd configuration.
Method signatures and docstrings:
- def GetConfig(self): Read in the test configuration file.
- def testParseConfig(self): Ensure we can extract sshd settings.
- def testFindNumericValues(self): Keyw... | ba1648b97a76f844ffb8e1891cc9e2680f9b1c6e | <|skeleton|>
class SshdConfigTest:
"""Test parsing of an sshd configuration."""
def GetConfig(self):
"""Read in the test configuration file."""
<|body_0|>
def testParseConfig(self):
"""Ensure we can extract sshd settings."""
<|body_1|>
def testFindNumericValues(self):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SshdConfigTest:
"""Test parsing of an sshd configuration."""
def GetConfig(self):
"""Read in the test configuration file."""
parser = config_file.SshdConfigParser()
results = list(parser.Parse(None, StringIO.StringIO(CFG), None))
self.assertEqual(1, len(results))
r... | the_stack_v2_python_sparse | parsers/config_file_test.py | defaultnamehere/grr | train | 3 |
86ea5b412a5051862aa5a8479f9359323b11a33f | [
"nodes_val = []\nstack = [root]\nwhile stack:\n node = stack.pop()\n nodes_val.append(node.val)\n if node.left:\n stack.append(node.left)\n if node.right:\n stack.append(node.right)\nnodes_val.sort()\nreturn min((nodes_val[i] - nodes_val[i - 1] for i in range(1, len(nodes_val))))",
"node... | <|body_start_0|>
nodes_val = []
stack = [root]
while stack:
node = stack.pop()
nodes_val.append(node.val)
if node.left:
stack.append(node.left)
if node.right:
stack.append(node.right)
nodes_val.sort()
... | Solution | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def getMinimumDifference(self, root):
"""a general case, 52ms"""
<|body_0|>
def getMinimumDifference2(self, root):
"""BST, 48ms"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
nodes_val = []
stack = [root]
while stack:
... | stack_v2_sparse_classes_36k_train_034971 | 1,556 | permissive | [
{
"docstring": "a general case, 52ms",
"name": "getMinimumDifference",
"signature": "def getMinimumDifference(self, root)"
},
{
"docstring": "BST, 48ms",
"name": "getMinimumDifference2",
"signature": "def getMinimumDifference2(self, root)"
}
] | 2 | stack_v2_sparse_classes_30k_train_006127 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def getMinimumDifference(self, root): a general case, 52ms
- def getMinimumDifference2(self, root): BST, 48ms | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def getMinimumDifference(self, root): a general case, 52ms
- def getMinimumDifference2(self, root): BST, 48ms
<|skeleton|>
class Solution:
def getMinimumDifference(self, ro... | 49a0b03c55d8a702785888d473ef96539265ce9c | <|skeleton|>
class Solution:
def getMinimumDifference(self, root):
"""a general case, 52ms"""
<|body_0|>
def getMinimumDifference2(self, root):
"""BST, 48ms"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def getMinimumDifference(self, root):
"""a general case, 52ms"""
nodes_val = []
stack = [root]
while stack:
node = stack.pop()
nodes_val.append(node.val)
if node.left:
stack.append(node.left)
if node.righ... | the_stack_v2_python_sparse | leetcode/0530_minimum_absolute_difference_in_bst.py | chaosWsF/Python-Practice | train | 1 | |
27ddaaefc9e8d1d7be94d184e14312e800e73830 | [
"if not nums:\n return False\nif k < 1:\n return False\nmax_length = max(len(nums) - k, len(nums))\nfor i in range(max_length):\n for j in range(i + 1, min(i + k + 1, len(nums))):\n if nums[i] == nums[j]:\n return True\nreturn False",
"d = {}\nfor i in range(0, min(k + 1, len(nums))):\n... | <|body_start_0|>
if not nums:
return False
if k < 1:
return False
max_length = max(len(nums) - k, len(nums))
for i in range(max_length):
for j in range(i + 1, min(i + k + 1, len(nums))):
if nums[i] == nums[j]:
return... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def _containsNearbyDuplicate(self, nums, k):
""":type nums: List[int] :type k: int :rtype: bool"""
<|body_0|>
def __containsNearbyDuplicate(self, nums, k):
""":type nums: List[int] :type k: int :rtype: bool"""
<|body_1|>
def ___containsNearbyDu... | stack_v2_sparse_classes_36k_train_034972 | 3,651 | permissive | [
{
"docstring": ":type nums: List[int] :type k: int :rtype: bool",
"name": "_containsNearbyDuplicate",
"signature": "def _containsNearbyDuplicate(self, nums, k)"
},
{
"docstring": ":type nums: List[int] :type k: int :rtype: bool",
"name": "__containsNearbyDuplicate",
"signature": "def __c... | 5 | stack_v2_sparse_classes_30k_train_002076 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def _containsNearbyDuplicate(self, nums, k): :type nums: List[int] :type k: int :rtype: bool
- def __containsNearbyDuplicate(self, nums, k): :type nums: List[int] :type k: int :r... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def _containsNearbyDuplicate(self, nums, k): :type nums: List[int] :type k: int :rtype: bool
- def __containsNearbyDuplicate(self, nums, k): :type nums: List[int] :type k: int :r... | 0dd67edca4e0b0323cb5a7239f02ea46383cd15a | <|skeleton|>
class Solution:
def _containsNearbyDuplicate(self, nums, k):
""":type nums: List[int] :type k: int :rtype: bool"""
<|body_0|>
def __containsNearbyDuplicate(self, nums, k):
""":type nums: List[int] :type k: int :rtype: bool"""
<|body_1|>
def ___containsNearbyDu... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def _containsNearbyDuplicate(self, nums, k):
""":type nums: List[int] :type k: int :rtype: bool"""
if not nums:
return False
if k < 1:
return False
max_length = max(len(nums) - k, len(nums))
for i in range(max_length):
for j... | the_stack_v2_python_sparse | 219.contains-duplicate-ii.py | windard/leeeeee | train | 0 | |
93305daaac323b14a8f3131f62084a5cea006bfd | [
"if data is not None:\n if type(data) is not list:\n raise TypeError('data must be a list')\n if len(data) <= 2:\n raise ValueError('data must contain multiple values')\n self.mean = sum(data) / int(len(data))\n pre_var = []\n for i in data:\n pre_var.append((i - self.mean) ** 2)... | <|body_start_0|>
if data is not None:
if type(data) is not list:
raise TypeError('data must be a list')
if len(data) <= 2:
raise ValueError('data must contain multiple values')
self.mean = sum(data) / int(len(data))
pre_var = []
... | doc | Binomial | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Binomial:
"""doc"""
def __init__(self, data=None, n=1, p=0.5):
"""doc"""
<|body_0|>
def factorial(self, x):
"""doc"""
<|body_1|>
def pmf(self, k):
"""doc"""
<|body_2|>
def cdf(self, k):
"""doc"""
<|body_3|>
<|end... | stack_v2_sparse_classes_36k_train_034973 | 1,814 | no_license | [
{
"docstring": "doc",
"name": "__init__",
"signature": "def __init__(self, data=None, n=1, p=0.5)"
},
{
"docstring": "doc",
"name": "factorial",
"signature": "def factorial(self, x)"
},
{
"docstring": "doc",
"name": "pmf",
"signature": "def pmf(self, k)"
},
{
"doc... | 4 | stack_v2_sparse_classes_30k_train_005283 | Implement the Python class `Binomial` described below.
Class description:
doc
Method signatures and docstrings:
- def __init__(self, data=None, n=1, p=0.5): doc
- def factorial(self, x): doc
- def pmf(self, k): doc
- def cdf(self, k): doc | Implement the Python class `Binomial` described below.
Class description:
doc
Method signatures and docstrings:
- def __init__(self, data=None, n=1, p=0.5): doc
- def factorial(self, x): doc
- def pmf(self, k): doc
- def cdf(self, k): doc
<|skeleton|>
class Binomial:
"""doc"""
def __init__(self, data=None, ... | 3bffd1391b3fc790f0137d0afbe90eb8e2f7d713 | <|skeleton|>
class Binomial:
"""doc"""
def __init__(self, data=None, n=1, p=0.5):
"""doc"""
<|body_0|>
def factorial(self, x):
"""doc"""
<|body_1|>
def pmf(self, k):
"""doc"""
<|body_2|>
def cdf(self, k):
"""doc"""
<|body_3|>
<|end... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Binomial:
"""doc"""
def __init__(self, data=None, n=1, p=0.5):
"""doc"""
if data is not None:
if type(data) is not list:
raise TypeError('data must be a list')
if len(data) <= 2:
raise ValueError('data must contain multiple values')
... | the_stack_v2_python_sparse | math/0x03-probability/binomial.py | pafuentess/holbertonschool-machine_learning | train | 0 |
06ca5f88badc833510d948f797ba3ffa9d1729b7 | [
"def write(root):\n if not root:\n return\n res.append(str(root.val))\n for child in root.children:\n write(child)\n res.append('#')\nres = []\nwrite(root)\nreturn ' '.join(res)",
"if not data:\n return None\ndata = collections.deque(data.split(' '))\nroot = Node(int(data.popleft()), ... | <|body_start_0|>
def write(root):
if not root:
return
res.append(str(root.val))
for child in root.children:
write(child)
res.append('#')
res = []
write(root)
return ' '.join(res)
<|end_body_0|>
<|body_start_... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: Node :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: Node"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|... | stack_v2_sparse_classes_36k_train_034974 | 1,306 | no_license | [
{
"docstring": "Encodes a tree to a single string. :type root: Node :rtype: str",
"name": "serialize",
"signature": "def serialize(self, root)"
},
{
"docstring": "Decodes your encoded data to tree. :type data: str :rtype: Node",
"name": "deserialize",
"signature": "def deserialize(self, ... | 2 | stack_v2_sparse_classes_30k_train_019659 | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: Node :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype: Nod... | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: Node :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype: Nod... | 431b763bf3019bac7c08619d7ffef37e638940e8 | <|skeleton|>
class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: Node :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: Node"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Codec:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: Node :rtype: str"""
def write(root):
if not root:
return
res.append(str(root.val))
for child in root.children:
write(child)
res.ap... | the_stack_v2_python_sparse | notes/0428/0428.py | PaulGuo5/Leetcode-notes | train | 1 | |
1570a9e3f56f5326b90a087254f2cf8a76d175ce | [
"super(BayesNetChain, self).__init__(rng)\nself.net = net\nself.evidence = evidence",
"accepted = False\nwhile not accepted:\n self.state = self.net.sample(self.evidence)\n accepted = self.net.log_probability(self.state) != utils.LOG_PROB_0",
"counter = marg.MarginalCounter(self.net)\nfor _ in xrange(num_... | <|body_start_0|>
super(BayesNetChain, self).__init__(rng)
self.net = net
self.evidence = evidence
<|end_body_0|>
<|body_start_1|>
accepted = False
while not accepted:
self.state = self.net.sample(self.evidence)
accepted = self.net.log_probability(self.sta... | A sequence of dependent (Bayes net) random variables. | BayesNetChain | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BayesNetChain:
"""A sequence of dependent (Bayes net) random variables."""
def __init__(self, net, rng, evidence):
"""Initialize Markov chain state."""
<|body_0|>
def initialize_state(self):
"""Initialize from prior, set evidence nodes."""
<|body_1|>
... | stack_v2_sparse_classes_36k_train_034975 | 5,157 | no_license | [
{
"docstring": "Initialize Markov chain state.",
"name": "__init__",
"signature": "def __init__(self, net, rng, evidence)"
},
{
"docstring": "Initialize from prior, set evidence nodes.",
"name": "initialize_state",
"signature": "def initialize_state(self)"
},
{
"docstring": "Comp... | 3 | stack_v2_sparse_classes_30k_train_014801 | Implement the Python class `BayesNetChain` described below.
Class description:
A sequence of dependent (Bayes net) random variables.
Method signatures and docstrings:
- def __init__(self, net, rng, evidence): Initialize Markov chain state.
- def initialize_state(self): Initialize from prior, set evidence nodes.
- def... | Implement the Python class `BayesNetChain` described below.
Class description:
A sequence of dependent (Bayes net) random variables.
Method signatures and docstrings:
- def __init__(self, net, rng, evidence): Initialize Markov chain state.
- def initialize_state(self): Initialize from prior, set evidence nodes.
- def... | 49630b731bd5b1c43eb015075cbd794428569f53 | <|skeleton|>
class BayesNetChain:
"""A sequence of dependent (Bayes net) random variables."""
def __init__(self, net, rng, evidence):
"""Initialize Markov chain state."""
<|body_0|>
def initialize_state(self):
"""Initialize from prior, set evidence nodes."""
<|body_1|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BayesNetChain:
"""A sequence of dependent (Bayes net) random variables."""
def __init__(self, net, rng, evidence):
"""Initialize Markov chain state."""
super(BayesNetChain, self).__init__(rng)
self.net = net
self.evidence = evidence
def initialize_state(self):
... | the_stack_v2_python_sparse | i3/mcmc.py | stuhlmueller/i3 | train | 5 |
6a784239976d9be54c7d4ae367de6c6e2435b058 | [
"self.cosmology = cosmology\nself.redshift = redshift\nself.prim_haloprop_key = prim_haloprop_key\nself.conc_mass_model = conc_mass_model",
"if 'galaxy_table' in kwargs.keys():\n key = model_defaults.host_haloprop_prefix + self.prim_haloprop_key\n mass = kwargs['galaxy_table'][key]\nelif 'halos' in kwargs.k... | <|body_start_0|>
self.cosmology = cosmology
self.redshift = redshift
self.prim_haloprop_key = prim_haloprop_key
self.conc_mass_model = conc_mass_model
<|end_body_0|>
<|body_start_1|>
if 'galaxy_table' in kwargs.keys():
key = model_defaults.host_haloprop_prefix + self... | Container class for commonly used concentration-mass relations in the literature. The only currently supported model is `dutton_maccio14`. | ConcMass | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ConcMass:
"""Container class for commonly used concentration-mass relations in the literature. The only currently supported model is `dutton_maccio14`."""
def __init__(self, cosmology=sim_defaults.default_cosmology, redshift=sim_defaults.default_redshift, prim_haloprop_key=model_defaults.pri... | stack_v2_sparse_classes_36k_train_034976 | 5,068 | permissive | [
{
"docstring": "Parameters ---------- cosmology : object, optional keyword argument Astropy cosmology object. Default is set in `~halotools.empirical_models.sim_defaults`. redshift : float, optional keyword argument Default is set in `~halotools.empirical_models.sim_defaults`. prim_haloprop_key : string, option... | 3 | stack_v2_sparse_classes_30k_train_015938 | Implement the Python class `ConcMass` described below.
Class description:
Container class for commonly used concentration-mass relations in the literature. The only currently supported model is `dutton_maccio14`.
Method signatures and docstrings:
- def __init__(self, cosmology=sim_defaults.default_cosmology, redshift... | Implement the Python class `ConcMass` described below.
Class description:
Container class for commonly used concentration-mass relations in the literature. The only currently supported model is `dutton_maccio14`.
Method signatures and docstrings:
- def __init__(self, cosmology=sim_defaults.default_cosmology, redshift... | f63988f7e1d66c7c19d7c2b4d628ed2524b7aec1 | <|skeleton|>
class ConcMass:
"""Container class for commonly used concentration-mass relations in the literature. The only currently supported model is `dutton_maccio14`."""
def __init__(self, cosmology=sim_defaults.default_cosmology, redshift=sim_defaults.default_redshift, prim_haloprop_key=model_defaults.pri... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ConcMass:
"""Container class for commonly used concentration-mass relations in the literature. The only currently supported model is `dutton_maccio14`."""
def __init__(self, cosmology=sim_defaults.default_cosmology, redshift=sim_defaults.default_redshift, prim_haloprop_key=model_defaults.prim_haloprop_ke... | the_stack_v2_python_sparse | halotools/empirical_models/halo_prof_param_components.py | lanakurdi/halotools | train | 1 |
a6a37236fe95b91052b74470a379bda5693e2526 | [
"del losses\ninputs = common_layers.flatten4d3d(inputs)\nencoder_input, self_attention_bias, _ = transformer.transformer_prepare_encoder(inputs, target_space, hparams)\nencoder_input = tf.nn.dropout(encoder_input, 1.0 - hparams.layer_prepostprocess_dropout)\nencoder_output, encoder_extra_output = universal_transfor... | <|body_start_0|>
del losses
inputs = common_layers.flatten4d3d(inputs)
encoder_input, self_attention_bias, _ = transformer.transformer_prepare_encoder(inputs, target_space, hparams)
encoder_input = tf.nn.dropout(encoder_input, 1.0 - hparams.layer_prepostprocess_dropout)
encoder_o... | Universal Transformer Encoder: Has no decoder (e.g.for classification). | UniversalTransformerEncoder | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UniversalTransformerEncoder:
"""Universal Transformer Encoder: Has no decoder (e.g.for classification)."""
def encode(self, inputs, target_space, hparams, features=None, losses=None):
"""Encode transformer inputs. Args: inputs: Transformer inputs [batch_size, input_length, input_heig... | stack_v2_sparse_classes_36k_train_034977 | 28,270 | permissive | [
{
"docstring": "Encode transformer inputs. Args: inputs: Transformer inputs [batch_size, input_length, input_height, hidden_dim] which will be flattened along the two spatial dimensions. target_space: scalar, target space ID. hparams: hyperparmeters for model. features: optionally pass the entire features dicti... | 2 | null | Implement the Python class `UniversalTransformerEncoder` described below.
Class description:
Universal Transformer Encoder: Has no decoder (e.g.for classification).
Method signatures and docstrings:
- def encode(self, inputs, target_space, hparams, features=None, losses=None): Encode transformer inputs. Args: inputs:... | Implement the Python class `UniversalTransformerEncoder` described below.
Class description:
Universal Transformer Encoder: Has no decoder (e.g.for classification).
Method signatures and docstrings:
- def encode(self, inputs, target_space, hparams, features=None, losses=None): Encode transformer inputs. Args: inputs:... | 480c909e0835a455606e829310ff949c9dd23549 | <|skeleton|>
class UniversalTransformerEncoder:
"""Universal Transformer Encoder: Has no decoder (e.g.for classification)."""
def encode(self, inputs, target_space, hparams, features=None, losses=None):
"""Encode transformer inputs. Args: inputs: Transformer inputs [batch_size, input_length, input_heig... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UniversalTransformerEncoder:
"""Universal Transformer Encoder: Has no decoder (e.g.for classification)."""
def encode(self, inputs, target_space, hparams, features=None, losses=None):
"""Encode transformer inputs. Args: inputs: Transformer inputs [batch_size, input_length, input_height, hidden_di... | the_stack_v2_python_sparse | t2t_bert/utils/tensor2tensor/models/research/universal_transformer.py | yyht/BERT | train | 37 |
9ca69eb0038f6065d6c8bad82f6cf0b9e9547292 | [
"if isinstance(key, int):\n return FlowIDSuboption(key)\nif key not in FlowIDSuboption._member_map_:\n return extend_enum(FlowIDSuboption, key, default)\nreturn FlowIDSuboption[key]",
"if not (isinstance(value, int) and 0 <= value <= 255):\n raise ValueError('%r is not a valid %s' % (value, cls.__name__)... | <|body_start_0|>
if isinstance(key, int):
return FlowIDSuboption(key)
if key not in FlowIDSuboption._member_map_:
return extend_enum(FlowIDSuboption, key, default)
return FlowIDSuboption[key]
<|end_body_0|>
<|body_start_1|>
if not (isinstance(value, int) and 0 <=... | [FlowIDSuboption] Flow Identification Sub-Options | FlowIDSuboption | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FlowIDSuboption:
"""[FlowIDSuboption] Flow Identification Sub-Options"""
def get(key: 'int | str', default: 'int'=-1) -> 'FlowIDSuboption':
"""Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:"""
<|body_0... | stack_v2_sparse_classes_36k_train_034978 | 2,145 | permissive | [
{
"docstring": "Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:",
"name": "get",
"signature": "def get(key: 'int | str', default: 'int'=-1) -> 'FlowIDSuboption'"
},
{
"docstring": "Lookup function used when value is not fo... | 2 | null | Implement the Python class `FlowIDSuboption` described below.
Class description:
[FlowIDSuboption] Flow Identification Sub-Options
Method signatures and docstrings:
- def get(key: 'int | str', default: 'int'=-1) -> 'FlowIDSuboption': Backport support for original codes. Args: key: Key to get enum item. default: Defau... | Implement the Python class `FlowIDSuboption` described below.
Class description:
[FlowIDSuboption] Flow Identification Sub-Options
Method signatures and docstrings:
- def get(key: 'int | str', default: 'int'=-1) -> 'FlowIDSuboption': Backport support for original codes. Args: key: Key to get enum item. default: Defau... | a6fe49ec58f09e105bec5a00fb66d9b3f22730d9 | <|skeleton|>
class FlowIDSuboption:
"""[FlowIDSuboption] Flow Identification Sub-Options"""
def get(key: 'int | str', default: 'int'=-1) -> 'FlowIDSuboption':
"""Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:"""
<|body_0... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FlowIDSuboption:
"""[FlowIDSuboption] Flow Identification Sub-Options"""
def get(key: 'int | str', default: 'int'=-1) -> 'FlowIDSuboption':
"""Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private:"""
if isinstance(key, in... | the_stack_v2_python_sparse | pcapkit/const/mh/flow_id_suboption.py | JarryShaw/PyPCAPKit | train | 204 |
f3089e133b65d4afec817a342fb66fe627ab2005 | [
"def gen_preorder(node):\n if not node:\n yield '#'\n else:\n yield str(node.val)\n for n in gen_preorder(node.left):\n yield n\n for n in gen_preorder(node.right):\n yield n\nreturn ' '.join(gen_preorder(root))",
"def builder(chunk_iter):\n val = next(ch... | <|body_start_0|>
def gen_preorder(node):
if not node:
yield '#'
else:
yield str(node.val)
for n in gen_preorder(node.left):
yield n
for n in gen_preorder(node.right):
yield n
r... | Codec2 | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec2:
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_034979 | 2,569 | permissive | [
{
"docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str",
"name": "serialize",
"signature": "def serialize(self, root)"
},
{
"docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode",
"name": "deserialize",
"signature": "def deserializ... | 2 | null | Implement the Python class `Codec2` described below.
Class description:
Implement the Codec2 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 :rtyp... | Implement the Python class `Codec2` described below.
Class description:
Implement the Codec2 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 :rtyp... | 4dc4e6642dc92f1983c13564cc0fd99917cab358 | <|skeleton|>
class Codec2:
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 Codec2:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
def gen_preorder(node):
if not node:
yield '#'
else:
yield str(node.val)
for n in gen_preorder(node.left):
... | the_stack_v2_python_sparse | Python/serialize-and-deserialize-binary-tree.py | kamyu104/LeetCode-Solutions | train | 4,549 | |
6e256b6d2927d3b8788ddc3e35ed29846bb1c0ec | [
"l1, l2 = (headA, headB)\nwhile l1 != l2:\n l1 = l1.next if l1 else headB\n l2 = l2.next if l2 else headA\nreturn l1",
"p1, p2 = (headA, headB)\nc1, c2 = (0, 0)\nwhile p1:\n p1 = p1.next\n c1 += 1\nwhile p2:\n p2 = p2.next\n c2 += 1\nheadA, headB = (headA, headB)\nif c1 > c2:\n for _ in range... | <|body_start_0|>
l1, l2 = (headA, headB)
while l1 != l2:
l1 = l1.next if l1 else headB
l2 = l2.next if l2 else headA
return l1
<|end_body_0|>
<|body_start_1|>
p1, p2 = (headA, headB)
c1, c2 = (0, 0)
while p1:
p1 = p1.next
c... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def getIntersectionNode(self, headA, headB):
""":type head1, head1: ListNode :rtype: ListNode"""
<|body_0|>
def getIntersectionNode2(self, headA, headB):
""":type head1, head1: ListNode :rtype: ListNode"""
<|body_1|>
<|end_skeleton|>
<|body_start_... | stack_v2_sparse_classes_36k_train_034980 | 2,813 | no_license | [
{
"docstring": ":type head1, head1: ListNode :rtype: ListNode",
"name": "getIntersectionNode",
"signature": "def getIntersectionNode(self, headA, headB)"
},
{
"docstring": ":type head1, head1: ListNode :rtype: ListNode",
"name": "getIntersectionNode2",
"signature": "def getIntersectionNo... | 2 | stack_v2_sparse_classes_30k_train_005178 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def getIntersectionNode(self, headA, headB): :type head1, head1: ListNode :rtype: ListNode
- def getIntersectionNode2(self, headA, headB): :type head1, head1: ListNode :rtype: Li... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def getIntersectionNode(self, headA, headB): :type head1, head1: ListNode :rtype: ListNode
- def getIntersectionNode2(self, headA, headB): :type head1, head1: ListNode :rtype: Li... | d4215451f1cad3ab6dfb4b082f4fd694fe0d31b4 | <|skeleton|>
class Solution:
def getIntersectionNode(self, headA, headB):
""":type head1, head1: ListNode :rtype: ListNode"""
<|body_0|>
def getIntersectionNode2(self, headA, headB):
""":type head1, head1: ListNode :rtype: ListNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def getIntersectionNode(self, headA, headB):
""":type head1, head1: ListNode :rtype: ListNode"""
l1, l2 = (headA, headB)
while l1 != l2:
l1 = l1.next if l1 else headB
l2 = l2.next if l2 else headA
return l1
def getIntersectionNode2(self, h... | the_stack_v2_python_sparse | leetcode/探索中级算法/2链表/3相交链表.py | FishRedLeaf/my_code | train | 3 | |
1a77a9303e4409fcd63876798322549aa828af96 | [
"super(GraspSensorSimulator, self).__init__()\npackage_path = rospkg.RosPack().get_path('test_tools')\nui_filename = os.path.join(package_path, 'resource', 'grasp_sensor.ui')\nloadUi(ui_filename, self)\nself.left_slider.valueChanged.connect(self.left_indicator.display)\nself.right_slider.valueChanged.connect(self.r... | <|body_start_0|>
super(GraspSensorSimulator, self).__init__()
package_path = rospkg.RosPack().get_path('test_tools')
ui_filename = os.path.join(package_path, 'resource', 'grasp_sensor.ui')
loadUi(ui_filename, self)
self.left_slider.valueChanged.connect(self.left_indicator.display... | QWidget to simulate the distance sensors on the grippers | GraspSensorSimulator | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GraspSensorSimulator:
"""QWidget to simulate the distance sensors on the grippers"""
def __init__(self, robot_name):
"""Constructor :param robot_name: string with robot name"""
<|body_0|>
def _publish_values(self):
"""Publishes the current sensor values (converte... | stack_v2_sparse_classes_36k_train_034981 | 2,775 | no_license | [
{
"docstring": "Constructor :param robot_name: string with robot name",
"name": "__init__",
"signature": "def __init__(self, robot_name)"
},
{
"docstring": "Publishes the current sensor values (converted from mm to m)",
"name": "_publish_values",
"signature": "def _publish_values(self)"
... | 2 | null | Implement the Python class `GraspSensorSimulator` described below.
Class description:
QWidget to simulate the distance sensors on the grippers
Method signatures and docstrings:
- def __init__(self, robot_name): Constructor :param robot_name: string with robot name
- def _publish_values(self): Publishes the current se... | Implement the Python class `GraspSensorSimulator` described below.
Class description:
QWidget to simulate the distance sensors on the grippers
Method signatures and docstrings:
- def __init__(self, robot_name): Constructor :param robot_name: string with robot name
- def _publish_values(self): Publishes the current se... | 092a354315b9b2c08e32cdc049791d82dfd47745 | <|skeleton|>
class GraspSensorSimulator:
"""QWidget to simulate the distance sensors on the grippers"""
def __init__(self, robot_name):
"""Constructor :param robot_name: string with robot name"""
<|body_0|>
def _publish_values(self):
"""Publishes the current sensor values (converte... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GraspSensorSimulator:
"""QWidget to simulate the distance sensors on the grippers"""
def __init__(self, robot_name):
"""Constructor :param robot_name: string with robot name"""
super(GraspSensorSimulator, self).__init__()
package_path = rospkg.RosPack().get_path('test_tools')
... | the_stack_v2_python_sparse | test_tools/scripts/grasp-sensor-sim | tue-robotics/tue_robocup | train | 39 |
e102c74e7f37b7594d24612c699b4f01ad994fb9 | [
"self.asin = asin\nself.title = title\nself.detail_page_url = detail_page_url\nself.product_group = product_group\nself.author = author\nself.artist = artist\nself.actor = actor",
"if dictionary is None:\n return None\nasin = dictionary.get('ASIN')\ntitle = dictionary.get('Title')\ndetail_page_url = dictionary... | <|body_start_0|>
self.asin = asin
self.title = title
self.detail_page_url = detail_page_url
self.product_group = product_group
self.author = author
self.artist = artist
self.actor = actor
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
... | Implementation of the 'TopItem' model. TODO: type model description here. Attributes: asin (string): TODO: type description here. title (string): TODO: type description here. detail_page_url (string): TODO: type description here. product_group (string): TODO: type description here. author (list of string): TODO: type d... | TopItem | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TopItem:
"""Implementation of the 'TopItem' model. TODO: type model description here. Attributes: asin (string): TODO: type description here. title (string): TODO: type description here. detail_page_url (string): TODO: type description here. product_group (string): TODO: type description here. au... | stack_v2_sparse_classes_36k_train_034982 | 2,701 | permissive | [
{
"docstring": "Constructor for the TopItem class",
"name": "__init__",
"signature": "def __init__(self, asin=None, title=None, detail_page_url=None, product_group=None, author=None, artist=None, actor=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dictionary... | 2 | stack_v2_sparse_classes_30k_train_017519 | Implement the Python class `TopItem` described below.
Class description:
Implementation of the 'TopItem' model. TODO: type model description here. Attributes: asin (string): TODO: type description here. title (string): TODO: type description here. detail_page_url (string): TODO: type description here. product_group (s... | Implement the Python class `TopItem` described below.
Class description:
Implementation of the 'TopItem' model. TODO: type model description here. Attributes: asin (string): TODO: type description here. title (string): TODO: type description here. detail_page_url (string): TODO: type description here. product_group (s... | 26ea1019115a1de3b1b37a4b830525e164ac55ce | <|skeleton|>
class TopItem:
"""Implementation of the 'TopItem' model. TODO: type model description here. Attributes: asin (string): TODO: type description here. title (string): TODO: type description here. detail_page_url (string): TODO: type description here. product_group (string): TODO: type description here. au... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TopItem:
"""Implementation of the 'TopItem' model. TODO: type model description here. Attributes: asin (string): TODO: type description here. title (string): TODO: type description here. detail_page_url (string): TODO: type description here. product_group (string): TODO: type description here. author (list of... | the_stack_v2_python_sparse | awsecommerceservice/models/top_item.py | nidaizamir/Test-PY | train | 0 |
88d76a539b2cd4ad58c9520517732161b909e668 | [
"if uri == DOMAIN_UNIPROT:\n return KeywordType.DOMAIN\nelif uri == BIOLOGICAL_PROCESS_UNIPROT:\n return KeywordType.BIOLOGICAL_PROCESS\nelif uri == CELLULAR_COMPONENT_UNIPROT:\n return KeywordType.CELLULAR_COMPONENT\nelif uri == CODING_SEQUENCE_DIVERSITY_UNIPROT:\n return KeywordType.CODING_SEQUENCE_DI... | <|body_start_0|>
if uri == DOMAIN_UNIPROT:
return KeywordType.DOMAIN
elif uri == BIOLOGICAL_PROCESS_UNIPROT:
return KeywordType.BIOLOGICAL_PROCESS
elif uri == CELLULAR_COMPONENT_UNIPROT:
return KeywordType.CELLULAR_COMPONENT
elif uri == CODING_SEQUENCE... | Enum specifying the category of a Keyword. | KeywordType | [
"MIT",
"LicenseRef-scancode-generic-cla"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class KeywordType:
"""Enum specifying the category of a Keyword."""
def from_uniprot_uri(uri: str):
"""Helper function that returns a `KeywordType` (Keyword Category) from the UniProt URL."""
<|body_0|>
def from_obo_ns(obo_namespace: str):
"""Helper function that retur... | stack_v2_sparse_classes_36k_train_034983 | 5,246 | permissive | [
{
"docstring": "Helper function that returns a `KeywordType` (Keyword Category) from the UniProt URL.",
"name": "from_uniprot_uri",
"signature": "def from_uniprot_uri(uri: str)"
},
{
"docstring": "Helper function that returns a `KeywordType` (Keyword Category) from the Ontobee URL.",
"name":... | 2 | stack_v2_sparse_classes_30k_test_000334 | Implement the Python class `KeywordType` described below.
Class description:
Enum specifying the category of a Keyword.
Method signatures and docstrings:
- def from_uniprot_uri(uri: str): Helper function that returns a `KeywordType` (Keyword Category) from the UniProt URL.
- def from_obo_ns(obo_namespace: str): Helpe... | Implement the Python class `KeywordType` described below.
Class description:
Enum specifying the category of a Keyword.
Method signatures and docstrings:
- def from_uniprot_uri(uri: str): Helper function that returns a `KeywordType` (Keyword Category) from the UniProt URL.
- def from_obo_ns(obo_namespace: str): Helpe... | 40bab526af6562653c42dbb32b174524c44ce2ba | <|skeleton|>
class KeywordType:
"""Enum specifying the category of a Keyword."""
def from_uniprot_uri(uri: str):
"""Helper function that returns a `KeywordType` (Keyword Category) from the UniProt URL."""
<|body_0|>
def from_obo_ns(obo_namespace: str):
"""Helper function that retur... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class KeywordType:
"""Enum specifying the category of a Keyword."""
def from_uniprot_uri(uri: str):
"""Helper function that returns a `KeywordType` (Keyword Category) from the UniProt URL."""
if uri == DOMAIN_UNIPROT:
return KeywordType.DOMAIN
elif uri == BIOLOGICAL_PROCESS_... | the_stack_v2_python_sparse | PyStationB/libraries/UniProt/uniProt/keyword.py | mebristo/station-b-libraries | train | 0 |
00f9d0b3e403dd3de6d8da2b9b89bd9121e29e2e | [
"super().__init__(**kwargs)\nif level_fn is None:\n level_fn = lambda outputs_old, **kwargs: tf.reduce_min(outputs_old)\nself.level_fn = level_fn\nself.temperature = temperature",
"if level_fn is None:\n level_fn = self.level_fn\nwith tf.name_scope('closed_form') as scope:\n if levels is None:\n l... | <|body_start_0|>
super().__init__(**kwargs)
if level_fn is None:
level_fn = lambda outputs_old, **kwargs: tf.reduce_min(outputs_old)
self.level_fn = level_fn
self.temperature = temperature
<|end_body_0|>
<|body_start_1|>
if level_fn is None:
level_fn = se... | negative_pi | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class negative_pi:
def __init__(self, level_fn=None, temperature=None, **kwargs):
"""Arguments level_fn : function returning the level w.r.t. improvement is measured temperature : temperature parameter for soft_less"""
<|body_0|>
def _closed_form(self, means, var, levels=None, lev... | stack_v2_sparse_classes_36k_train_034984 | 2,799 | no_license | [
{
"docstring": "Arguments level_fn : function returning the level w.r.t. improvement is measured temperature : temperature parameter for soft_less",
"name": "__init__",
"signature": "def __init__(self, level_fn=None, temperature=None, **kwargs)"
},
{
"docstring": "Closed-form expression for nega... | 3 | stack_v2_sparse_classes_30k_train_016542 | Implement the Python class `negative_pi` described below.
Class description:
Implement the negative_pi class.
Method signatures and docstrings:
- def __init__(self, level_fn=None, temperature=None, **kwargs): Arguments level_fn : function returning the level w.r.t. improvement is measured temperature : temperature pa... | Implement the Python class `negative_pi` described below.
Class description:
Implement the negative_pi class.
Method signatures and docstrings:
- def __init__(self, level_fn=None, temperature=None, **kwargs): Arguments level_fn : function returning the level w.r.t. improvement is measured temperature : temperature pa... | f9243678f8979ea16c7c86513d6b51d061ace239 | <|skeleton|>
class negative_pi:
def __init__(self, level_fn=None, temperature=None, **kwargs):
"""Arguments level_fn : function returning the level w.r.t. improvement is measured temperature : temperature parameter for soft_less"""
<|body_0|>
def _closed_form(self, means, var, levels=None, lev... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class negative_pi:
def __init__(self, level_fn=None, temperature=None, **kwargs):
"""Arguments level_fn : function returning the level w.r.t. improvement is measured temperature : temperature parameter for soft_less"""
super().__init__(**kwargs)
if level_fn is None:
level_fn = la... | the_stack_v2_python_sparse | src/losses/negative_pi.py | j-wilson/MaximizingAcquisitionFunctions | train | 11 | |
114f8d907a5beb2a9c22b74a22701ce05479501b | [
"time.sleep(2)\nUserInfoPage(web_page).login(data['username'], data['code'])\nlogging.info('开始断言')\ntime.sleep(3)\ntry:\n assert UserInfoPage(web_page).user_manage() == data['check']\n logging.info('账号管理页面跳转成功')\nexcept:\n print('账号管理页面跳转失败')\n common.save_screenShot(web_page, model_name='账号管理页面')\n ... | <|body_start_0|>
time.sleep(2)
UserInfoPage(web_page).login(data['username'], data['code'])
logging.info('开始断言')
time.sleep(3)
try:
assert UserInfoPage(web_page).user_manage() == data['check']
logging.info('账号管理页面跳转成功')
except:
print('账... | TestUserManage | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestUserManage:
def test_login_success(self, data, web_page):
"""成功登录-跳转账户管理页面"""
<|body_0|>
def test_user_name_info(self, data, web_page):
"""账号管理页面"""
<|body_1|>
def test_user_pwd_err(self, data, web_page):
"""旧密码密码长度最少6位"""
<|body_2|>
... | stack_v2_sparse_classes_36k_train_034985 | 5,468 | no_license | [
{
"docstring": "成功登录-跳转账户管理页面",
"name": "test_login_success",
"signature": "def test_login_success(self, data, web_page)"
},
{
"docstring": "账号管理页面",
"name": "test_user_name_info",
"signature": "def test_user_name_info(self, data, web_page)"
},
{
"docstring": "旧密码密码长度最少6位",
"... | 6 | null | Implement the Python class `TestUserManage` described below.
Class description:
Implement the TestUserManage class.
Method signatures and docstrings:
- def test_login_success(self, data, web_page): 成功登录-跳转账户管理页面
- def test_user_name_info(self, data, web_page): 账号管理页面
- def test_user_pwd_err(self, data, web_page): 旧密码... | Implement the Python class `TestUserManage` described below.
Class description:
Implement the TestUserManage class.
Method signatures and docstrings:
- def test_login_success(self, data, web_page): 成功登录-跳转账户管理页面
- def test_user_name_info(self, data, web_page): 账号管理页面
- def test_user_pwd_err(self, data, web_page): 旧密码... | b262c13e55a6e9eae1d4fa11d50b71814028261c | <|skeleton|>
class TestUserManage:
def test_login_success(self, data, web_page):
"""成功登录-跳转账户管理页面"""
<|body_0|>
def test_user_name_info(self, data, web_page):
"""账号管理页面"""
<|body_1|>
def test_user_pwd_err(self, data, web_page):
"""旧密码密码长度最少6位"""
<|body_2|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestUserManage:
def test_login_success(self, data, web_page):
"""成功登录-跳转账户管理页面"""
time.sleep(2)
UserInfoPage(web_page).login(data['username'], data['code'])
logging.info('开始断言')
time.sleep(3)
try:
assert UserInfoPage(web_page).user_manage() == data['... | the_stack_v2_python_sparse | TestCase/test_C_web/test_user_manage.py | xjx985426946/Test_UI | train | 0 | |
441ea3621c9c35d3b7a435213c3460c9cdfe0c64 | [
"mapper = {}\naverages = []\nitems.sort()\nfor item in items:\n if item[0] in mapper:\n mapper[item[0]].append(item[1])\n else:\n mapper[item[0]] = [item[1]]\nfor id, scores in mapper.items():\n scores.sort(reverse=True)\n total, i = (0, 0)\n while i < 5 and i < len(scores):\n to... | <|body_start_0|>
mapper = {}
averages = []
items.sort()
for item in items:
if item[0] in mapper:
mapper[item[0]].append(item[1])
else:
mapper[item[0]] = [item[1]]
for id, scores in mapper.items():
scores.sort(rev... | HighFive | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HighFive:
def average_(self, items: List[List[int]]) -> List[int]:
"""Approach: Without python built in. Time Complexity: O(N log N) Space Complexity: O(N) :param items: :return:"""
<|body_0|>
def average(self, items: List[List[int]]) -> List[int]:
"""Approach: Pytho... | stack_v2_sparse_classes_36k_train_034986 | 1,699 | no_license | [
{
"docstring": "Approach: Without python built in. Time Complexity: O(N log N) Space Complexity: O(N) :param items: :return:",
"name": "average_",
"signature": "def average_(self, items: List[List[int]]) -> List[int]"
},
{
"docstring": "Approach: Python built-in Time Complexity: O(N log N) Space... | 2 | stack_v2_sparse_classes_30k_train_012578 | Implement the Python class `HighFive` described below.
Class description:
Implement the HighFive class.
Method signatures and docstrings:
- def average_(self, items: List[List[int]]) -> List[int]: Approach: Without python built in. Time Complexity: O(N log N) Space Complexity: O(N) :param items: :return:
- def averag... | Implement the Python class `HighFive` described below.
Class description:
Implement the HighFive class.
Method signatures and docstrings:
- def average_(self, items: List[List[int]]) -> List[int]: Approach: Without python built in. Time Complexity: O(N log N) Space Complexity: O(N) :param items: :return:
- def averag... | 65cc78b5afa0db064f9fe8f06597e3e120f7363d | <|skeleton|>
class HighFive:
def average_(self, items: List[List[int]]) -> List[int]:
"""Approach: Without python built in. Time Complexity: O(N log N) Space Complexity: O(N) :param items: :return:"""
<|body_0|>
def average(self, items: List[List[int]]) -> List[int]:
"""Approach: Pytho... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class HighFive:
def average_(self, items: List[List[int]]) -> List[int]:
"""Approach: Without python built in. Time Complexity: O(N log N) Space Complexity: O(N) :param items: :return:"""
mapper = {}
averages = []
items.sort()
for item in items:
if item[0] in mapp... | the_stack_v2_python_sparse | revisited_2021/arrays/high_five.py | Shiv2157k/leet_code | train | 1 | |
733c533f6e1a0c798f400f62927dd217fafe5658 | [
"self.m = mass\nself.l = length\nself.b = damping\nself.g = gravity\nself.coulomb_fric = coulomb_fric\nif inertia is None:\n self.inertia = mass * length * length\nelse:\n self.inertia = inertia\nself.torque_limit = torque_limit\nself.dof = 1\nself.n_actuators = 1\nself.base = [0, 0]\nself.n_links = 1\nself.w... | <|body_start_0|>
self.m = mass
self.l = length
self.b = damping
self.g = gravity
self.coulomb_fric = coulomb_fric
if inertia is None:
self.inertia = mass * length * length
else:
self.inertia = inertia
self.torque_limit = torque_limi... | PendulumPlantApprox | [
"MIT",
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PendulumPlantApprox:
def __init__(self, mass=1.0, length=0.5, damping=0.1, gravity=9.81, coulomb_fric=0.0, inertia=None, torque_limit=np.inf, taylorApprox_order=1):
"""The PendulumPlantApprox class contains the taylor-approximated dynamics of the simple pendulum. The state of the pendulu... | stack_v2_sparse_classes_36k_train_034987 | 10,005 | permissive | [
{
"docstring": "The PendulumPlantApprox class contains the taylor-approximated dynamics of the simple pendulum. The state of the pendulum in this class is described by state = [angle, angular velocity] (array like with len(state)=2) in units: rad and rad/s The zero state of the angle corresponds to the pendulum... | 3 | null | Implement the Python class `PendulumPlantApprox` described below.
Class description:
Implement the PendulumPlantApprox class.
Method signatures and docstrings:
- def __init__(self, mass=1.0, length=0.5, damping=0.1, gravity=9.81, coulomb_fric=0.0, inertia=None, torque_limit=np.inf, taylorApprox_order=1): The Pendulum... | Implement the Python class `PendulumPlantApprox` described below.
Class description:
Implement the PendulumPlantApprox class.
Method signatures and docstrings:
- def __init__(self, mass=1.0, length=0.5, damping=0.1, gravity=9.81, coulomb_fric=0.0, inertia=None, torque_limit=np.inf, taylorApprox_order=1): The Pendulum... | 2dab162a3a7bd33632fd36924b2bfb289249ffa3 | <|skeleton|>
class PendulumPlantApprox:
def __init__(self, mass=1.0, length=0.5, damping=0.1, gravity=9.81, coulomb_fric=0.0, inertia=None, torque_limit=np.inf, taylorApprox_order=1):
"""The PendulumPlantApprox class contains the taylor-approximated dynamics of the simple pendulum. The state of the pendulu... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PendulumPlantApprox:
def __init__(self, mass=1.0, length=0.5, damping=0.1, gravity=9.81, coulomb_fric=0.0, inertia=None, torque_limit=np.inf, taylorApprox_order=1):
"""The PendulumPlantApprox class contains the taylor-approximated dynamics of the simple pendulum. The state of the pendulum in this clas... | the_stack_v2_python_sparse | software/python/simple_pendulum/controllers/lqr/roa/utils.py | dfki-ric-underactuated-lab/torque_limited_simple_pendulum | train | 37 | |
6f60157e7883c47cb91311452d7f68b9eea9356c | [
"super(FineTuneModel, self).__init__()\nself.emb_size = emb_size\nself.emb_dimension = emb_dimension\nself.p = p\nself.sigma = sigma\nself.i_embeddings = nn.Embedding(emb_size, emb_dimension)\nself.u_embeddings = nn.Embedding(emb_size, emb_dimension)\nself.v_embeddings = nn.Embedding(emb_size, emb_dimension)\nself.... | <|body_start_0|>
super(FineTuneModel, self).__init__()
self.emb_size = emb_size
self.emb_dimension = emb_dimension
self.p = p
self.sigma = sigma
self.i_embeddings = nn.Embedding(emb_size, emb_dimension)
self.u_embeddings = nn.Embedding(emb_size, emb_dimension)
... | Skip gram model of word2vec. Attributes: emb_size: Embedding size. emb_dimention: Embedding dimention, typically from 50 to 500. u_embedding: Embedding for center word. v_embedding: Embedding for neibor words. | FineTuneModel | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FineTuneModel:
"""Skip gram model of word2vec. Attributes: emb_size: Embedding size. emb_dimention: Embedding dimention, typically from 50 to 500. u_embedding: Embedding for center word. v_embedding: Embedding for neibor words."""
def __init__(self, emb_size, emb_dimension, p, sigma, wvector... | stack_v2_sparse_classes_36k_train_034988 | 3,989 | no_license | [
{
"docstring": "Initialize model parameters. Apply for two embedding layers. Initialize layer weight Args: emb_size: Embedding size. emb_dimention: Embedding dimention, typically from 50 to 500. Returns: None",
"name": "__init__",
"signature": "def __init__(self, emb_size, emb_dimension, p, sigma, wvect... | 2 | stack_v2_sparse_classes_30k_train_009758 | Implement the Python class `FineTuneModel` described below.
Class description:
Skip gram model of word2vec. Attributes: emb_size: Embedding size. emb_dimention: Embedding dimention, typically from 50 to 500. u_embedding: Embedding for center word. v_embedding: Embedding for neibor words.
Method signatures and docstri... | Implement the Python class `FineTuneModel` described below.
Class description:
Skip gram model of word2vec. Attributes: emb_size: Embedding size. emb_dimention: Embedding dimention, typically from 50 to 500. u_embedding: Embedding for center word. v_embedding: Embedding for neibor words.
Method signatures and docstri... | 6b00d0d096b5b9700cd50f6a99a43db5b1ee26a3 | <|skeleton|>
class FineTuneModel:
"""Skip gram model of word2vec. Attributes: emb_size: Embedding size. emb_dimention: Embedding dimention, typically from 50 to 500. u_embedding: Embedding for center word. v_embedding: Embedding for neibor words."""
def __init__(self, emb_size, emb_dimension, p, sigma, wvector... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FineTuneModel:
"""Skip gram model of word2vec. Attributes: emb_size: Embedding size. emb_dimention: Embedding dimention, typically from 50 to 500. u_embedding: Embedding for center word. v_embedding: Embedding for neibor words."""
def __init__(self, emb_size, emb_dimension, p, sigma, wvector, cvector):
... | the_stack_v2_python_sparse | model.py | Yueqi-Zhang/fine-tune-w2v-v2 | train | 0 |
31919fdb73c1df3d861ead5e8a2e9cfdbbd413ec | [
"description = kwargs.pop('description', None)\nresponse = kwargs.pop('response', None)\nsuper().__init__(code, errors, description=description, response=response)\nself._extra_fields = kwargs",
"body = {'status': self.code, 'message': self.get_description(environ), **self._extra_fields}\nerrors = self.get_errors... | <|body_start_0|>
description = kwargs.pop('description', None)
response = kwargs.pop('response', None)
super().__init__(code, errors, description=description, response=response)
self._extra_fields = kwargs
<|end_body_0|>
<|body_start_1|>
body = {'status': self.code, 'message': s... | HTTPJSONException that supports setting some extra body fields. | HTTPJSONException | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HTTPJSONException:
"""HTTPJSONException that supports setting some extra body fields."""
def __init__(self, code=None, errors=None, **kwargs):
"""Constructor."""
<|body_0|>
def get_body(self, environ=None, scope=None):
"""Get the response body."""
<|body_... | stack_v2_sparse_classes_36k_train_034989 | 1,850 | permissive | [
{
"docstring": "Constructor.",
"name": "__init__",
"signature": "def __init__(self, code=None, errors=None, **kwargs)"
},
{
"docstring": "Get the response body.",
"name": "get_body",
"signature": "def get_body(self, environ=None, scope=None)"
}
] | 2 | null | Implement the Python class `HTTPJSONException` described below.
Class description:
HTTPJSONException that supports setting some extra body fields.
Method signatures and docstrings:
- def __init__(self, code=None, errors=None, **kwargs): Constructor.
- def get_body(self, environ=None, scope=None): Get the response bod... | Implement the Python class `HTTPJSONException` described below.
Class description:
HTTPJSONException that supports setting some extra body fields.
Method signatures and docstrings:
- def __init__(self, code=None, errors=None, **kwargs): Constructor.
- def get_body(self, environ=None, scope=None): Get the response bod... | c41f1ce4ee1ae876baf931bd392712d21ce87680 | <|skeleton|>
class HTTPJSONException:
"""HTTPJSONException that supports setting some extra body fields."""
def __init__(self, code=None, errors=None, **kwargs):
"""Constructor."""
<|body_0|>
def get_body(self, environ=None, scope=None):
"""Get the response body."""
<|body_... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class HTTPJSONException:
"""HTTPJSONException that supports setting some extra body fields."""
def __init__(self, code=None, errors=None, **kwargs):
"""Constructor."""
description = kwargs.pop('description', None)
response = kwargs.pop('response', None)
super().__init__(code, er... | the_stack_v2_python_sparse | invenio_rdm_records/resources/errors.py | fenekku/invenio-rdm-records | train | 0 |
bbf6895b2dbe5c82b862e5ea4fda6bad8f5a2038 | [
"if rect is None:\n rect = cocos.rect.Rect(0, 0, *cocos.director.director.get_window_size())\nsuper(RectDrawingBox, self).__init__(rect)\nself._rects_in_progress: Dict[int, MouseDefinedRect] = {}\nself._rect_displays: Dict[int, cocos.layer.ColorLayer] = {}\nself.drawing_definition: RectDrawingBoxDefinition = def... | <|body_start_0|>
if rect is None:
rect = cocos.rect.Rect(0, 0, *cocos.director.director.get_window_size())
super(RectDrawingBox, self).__init__(rect)
self._rects_in_progress: Dict[int, MouseDefinedRect] = {}
self._rect_displays: Dict[int, cocos.layer.ColorLayer] = {}
... | A RectDrawingBox defines a rectangular area where Rects can be drawn using the mouse. The `on_complete` method in the definition is called every time a mouse button is released, returning the rect that was defined with that current set of buttons pressed. Multiple rects are recorded at once for each combination of mous... | RectDrawingBox | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RectDrawingBox:
"""A RectDrawingBox defines a rectangular area where Rects can be drawn using the mouse. The `on_complete` method in the definition is called every time a mouse button is released, returning the rect that was defined with that current set of buttons pressed. Multiple rects are rec... | stack_v2_sparse_classes_36k_train_034990 | 9,755 | permissive | [
{
"docstring": "Creates a new RectDrawingBox. :param rect: Definition of the rectangle that this Box encompasses. If None, defaults to the entire window.",
"name": "__init__",
"signature": "def __init__(self, definition: RectDrawingBoxDefinition, rect: Optional[cocos.rect.Rect]=None)"
},
{
"docs... | 5 | stack_v2_sparse_classes_30k_train_006312 | Implement the Python class `RectDrawingBox` described below.
Class description:
A RectDrawingBox defines a rectangular area where Rects can be drawn using the mouse. The `on_complete` method in the definition is called every time a mouse button is released, returning the rect that was defined with that current set of ... | Implement the Python class `RectDrawingBox` described below.
Class description:
A RectDrawingBox defines a rectangular area where Rects can be drawn using the mouse. The `on_complete` method in the definition is called every time a mouse button is released, returning the rect that was defined with that current set of ... | 541247482748300bbebf9bdec5ecdc19339fe665 | <|skeleton|>
class RectDrawingBox:
"""A RectDrawingBox defines a rectangular area where Rects can be drawn using the mouse. The `on_complete` method in the definition is called every time a mouse button is released, returning the rect that was defined with that current set of buttons pressed. Multiple rects are rec... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RectDrawingBox:
"""A RectDrawingBox defines a rectangular area where Rects can be drawn using the mouse. The `on_complete` method in the definition is called every time a mouse button is released, returning the rect that was defined with that current set of buttons pressed. Multiple rects are recorded at once... | the_stack_v2_python_sparse | shimmer/components/drawing.py | MartinHowarth/shimmer | train | 3 |
299df9c86874ffd9f5c46e66aedbd6d8ce9cd633 | [
"email = request.data['email']\ntry:\n user = TaskUser.objects.get(email__iexact=email)\n uid = base64.urlsafe_b64encode(force_bytes(user.id)).rstrip(b'\\n=')\n token = uuid.uuid4().hex\n get, created = Token.objects.get_or_create(uid=user.id)\n get.token = token\n get.status = False\n get.save... | <|body_start_0|>
email = request.data['email']
try:
user = TaskUser.objects.get(email__iexact=email)
uid = base64.urlsafe_b64encode(force_bytes(user.id)).rstrip(b'\n=')
token = uuid.uuid4().hex
get, created = Token.objects.get_or_create(uid=user.id)
... | ResetPasswordView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ResetPasswordView:
def reset(self, request):
"""First step of forget password. In mail it sends user short name, token, uid(formatted), domain(site domain) :param request: email :return: message"""
<|body_0|>
def reset_done(self, request):
"""Second step of reset pas... | stack_v2_sparse_classes_36k_train_034991 | 9,380 | no_license | [
{
"docstring": "First step of forget password. In mail it sends user short name, token, uid(formatted), domain(site domain) :param request: email :return: message",
"name": "reset",
"signature": "def reset(self, request)"
},
{
"docstring": "Second step of reset password after clicking link which... | 2 | stack_v2_sparse_classes_30k_train_007013 | Implement the Python class `ResetPasswordView` described below.
Class description:
Implement the ResetPasswordView class.
Method signatures and docstrings:
- def reset(self, request): First step of forget password. In mail it sends user short name, token, uid(formatted), domain(site domain) :param request: email :ret... | Implement the Python class `ResetPasswordView` described below.
Class description:
Implement the ResetPasswordView class.
Method signatures and docstrings:
- def reset(self, request): First step of forget password. In mail it sends user short name, token, uid(formatted), domain(site domain) :param request: email :ret... | 21e60c564a513972995b44e22ca0238b3f4480bc | <|skeleton|>
class ResetPasswordView:
def reset(self, request):
"""First step of forget password. In mail it sends user short name, token, uid(formatted), domain(site domain) :param request: email :return: message"""
<|body_0|>
def reset_done(self, request):
"""Second step of reset pas... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ResetPasswordView:
def reset(self, request):
"""First step of forget password. In mail it sends user short name, token, uid(formatted), domain(site domain) :param request: email :return: message"""
email = request.data['email']
try:
user = TaskUser.objects.get(email__iexact... | the_stack_v2_python_sparse | account/views.py | aryankeshri/task | train | 0 | |
63d3b2e21da89af97aa971767baa588ec0f33200 | [
"if data is None:\n if lambtha <= 0:\n raise ValueError('lambtha must be a positive value')\n self.lambtha = float(lambtha)\nelse:\n if type(data) != list:\n raise TypeError('data must be a list')\n if len(data) < 2:\n raise ValueError('data must contain multiple values')\n self.... | <|body_start_0|>
if data is None:
if lambtha <= 0:
raise ValueError('lambtha must be a positive value')
self.lambtha = float(lambtha)
else:
if type(data) != list:
raise TypeError('data must be a list')
if len(data) < 2:
... | Poisson distribution stats class | Exponential | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Exponential:
"""Poisson distribution stats class"""
def __init__(self, data=None, lambtha=1.0):
"""Initialize poisson distribution stats"""
<|body_0|>
def pdf(self, x):
"""PMF at k number of events"""
<|body_1|>
def cdf(self, x):
"""CDF at k ... | stack_v2_sparse_classes_36k_train_034992 | 1,040 | no_license | [
{
"docstring": "Initialize poisson distribution stats",
"name": "__init__",
"signature": "def __init__(self, data=None, lambtha=1.0)"
},
{
"docstring": "PMF at k number of events",
"name": "pdf",
"signature": "def pdf(self, x)"
},
{
"docstring": "CDF at k number of events",
"... | 3 | stack_v2_sparse_classes_30k_train_011748 | Implement the Python class `Exponential` described below.
Class description:
Poisson distribution stats class
Method signatures and docstrings:
- def __init__(self, data=None, lambtha=1.0): Initialize poisson distribution stats
- def pdf(self, x): PMF at k number of events
- def cdf(self, x): CDF at k number of event... | Implement the Python class `Exponential` described below.
Class description:
Poisson distribution stats class
Method signatures and docstrings:
- def __init__(self, data=None, lambtha=1.0): Initialize poisson distribution stats
- def pdf(self, x): PMF at k number of events
- def cdf(self, x): CDF at k number of event... | a51fbcb76dae9281ff34ace0fb762ef899b4c380 | <|skeleton|>
class Exponential:
"""Poisson distribution stats class"""
def __init__(self, data=None, lambtha=1.0):
"""Initialize poisson distribution stats"""
<|body_0|>
def pdf(self, x):
"""PMF at k number of events"""
<|body_1|>
def cdf(self, x):
"""CDF at k ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Exponential:
"""Poisson distribution stats class"""
def __init__(self, data=None, lambtha=1.0):
"""Initialize poisson distribution stats"""
if data is None:
if lambtha <= 0:
raise ValueError('lambtha must be a positive value')
self.lambtha = float(l... | the_stack_v2_python_sparse | math/0x03-probability/exponential.py | Diegokernel/holbertonschool-machine_learning | train | 0 |
27cd9f891a47492a11710d3083a318f65dd9036c | [
"from apysc import EventType\nfrom apysc import MouseEvent\nfrom apysc.event.handler import append_handler_expression\nfrom apysc.event.handler import get_handler_name\nfrom apysc.type.variable_name_interface import VariableNameInterface\nself_instance: VariableNameInterface = self._validate_self_is_variable_name_i... | <|body_start_0|>
from apysc import EventType
from apysc import MouseEvent
from apysc.event.handler import append_handler_expression
from apysc.event.handler import get_handler_name
from apysc.type.variable_name_interface import VariableNameInterface
self_instance: Variabl... | MouseUpInterface | [
"MIT",
"CC-BY-4.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MouseUpInterface:
def mouseup(self, handler: Handler, options: Optional[Dict[str, Any]]=None) -> str:
"""Add mouse up event listener setting. Parameters ---------- handler : Handler Callable that called when mouse is upped on this instance. options : dict or None, default None Optional a... | stack_v2_sparse_classes_36k_train_034993 | 3,006 | permissive | [
{
"docstring": "Add mouse up event listener setting. Parameters ---------- handler : Handler Callable that called when mouse is upped on this instance. options : dict or None, default None Optional arguments dictionary to be passed to handler. Returns ------- name : str Handler's name.",
"name": "mouseup",
... | 4 | null | Implement the Python class `MouseUpInterface` described below.
Class description:
Implement the MouseUpInterface class.
Method signatures and docstrings:
- def mouseup(self, handler: Handler, options: Optional[Dict[str, Any]]=None) -> str: Add mouse up event listener setting. Parameters ---------- handler : Handler C... | Implement the Python class `MouseUpInterface` described below.
Class description:
Implement the MouseUpInterface class.
Method signatures and docstrings:
- def mouseup(self, handler: Handler, options: Optional[Dict[str, Any]]=None) -> str: Add mouse up event listener setting. Parameters ---------- handler : Handler C... | 5c6a4674e2e9684cb2cb1325dc9b070879d4d355 | <|skeleton|>
class MouseUpInterface:
def mouseup(self, handler: Handler, options: Optional[Dict[str, Any]]=None) -> str:
"""Add mouse up event listener setting. Parameters ---------- handler : Handler Callable that called when mouse is upped on this instance. options : dict or None, default None Optional a... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MouseUpInterface:
def mouseup(self, handler: Handler, options: Optional[Dict[str, Any]]=None) -> str:
"""Add mouse up event listener setting. Parameters ---------- handler : Handler Callable that called when mouse is upped on this instance. options : dict or None, default None Optional arguments dicti... | the_stack_v2_python_sparse | apysc/event/mouse_up_interface.py | TrendingTechnology/apysc | train | 0 | |
6fd2960c9ecfd3bac941bfb20e7ab7bac0247530 | [
"logger.debug('>>getWells()')\ncreatedLocalSession = False\nif len(ids) == 0:\n return None\nif session == None:\n session = WellDao.getSession()\n createdLocalSession = True\nif ids[0] <= 0:\n logger.error('Invalid well id:{0}'.format(ids[0]))\n if AppSettings.isDebugMode:\n raise ValueError\... | <|body_start_0|>
logger.debug('>>getWells()')
createdLocalSession = False
if len(ids) == 0:
return None
if session == None:
session = WellDao.getSession()
createdLocalSession = True
if ids[0] <= 0:
logger.error('Invalid well id:{0}'... | classdocs | WellDao | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class WellDao:
"""classdocs"""
def getWells(cls, ids, session=None):
"""gets wells of given ids from database"""
<|body_0|>
def getWell(cls, id, session=None):
"""gets well of given id from database"""
<|body_1|>
def getAllWells(cls, session=None):
... | stack_v2_sparse_classes_36k_train_034994 | 2,766 | permissive | [
{
"docstring": "gets wells of given ids from database",
"name": "getWells",
"signature": "def getWells(cls, ids, session=None)"
},
{
"docstring": "gets well of given id from database",
"name": "getWell",
"signature": "def getWell(cls, id, session=None)"
},
{
"docstring": "gets al... | 3 | null | Implement the Python class `WellDao` described below.
Class description:
classdocs
Method signatures and docstrings:
- def getWells(cls, ids, session=None): gets wells of given ids from database
- def getWell(cls, id, session=None): gets well of given id from database
- def getAllWells(cls, session=None): gets all we... | Implement the Python class `WellDao` described below.
Class description:
classdocs
Method signatures and docstrings:
- def getWells(cls, ids, session=None): gets wells of given ids from database
- def getWell(cls, id, session=None): gets well of given id from database
- def getAllWells(cls, session=None): gets all we... | 20fba1b1fd1a42add223d9e8af2d267665bec493 | <|skeleton|>
class WellDao:
"""classdocs"""
def getWells(cls, ids, session=None):
"""gets wells of given ids from database"""
<|body_0|>
def getWell(cls, id, session=None):
"""gets well of given id from database"""
<|body_1|>
def getAllWells(cls, session=None):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class WellDao:
"""classdocs"""
def getWells(cls, ids, session=None):
"""gets wells of given ids from database"""
logger.debug('>>getWells()')
createdLocalSession = False
if len(ids) == 0:
return None
if session == None:
session = WellDao.getSessio... | the_stack_v2_python_sparse | db/core/well/welldao.py | ABV-Hub/qreservoir | train | 0 |
ad0962d98f173889ed8f675a91617719ef954591 | [
"super().__init__(name, schema)\nself.ses = Session()\nself.url = url\nself.db_name = 'db_' + name\nself.db_exists = False\nurl = self.url + '/' + self.db_name\nresp = self.ses.head(url)\nlog.info('ses.head(%s) => %d', url, resp.status_code)\nif resp.status_code == 404:\n resp = self.ses.put(url)\n log.info('... | <|body_start_0|>
super().__init__(name, schema)
self.ses = Session()
self.url = url
self.db_name = 'db_' + name
self.db_exists = False
url = self.url + '/' + self.db_name
resp = self.ses.head(url)
log.info('ses.head(%s) => %d', url, resp.status_code)
... | Class to represent an in-CouchDB collection of objects | DataSetCouchDB | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DataSetCouchDB:
"""Class to represent an in-CouchDB collection of objects"""
def __init__(self, name, schema, url):
"""In: name - dataset name - e.g. 'animal' schema - dataset schema url - CouchDB URL"""
<|body_0|>
def get(self, id):
"""Access the record by id"""... | stack_v2_sparse_classes_36k_train_034995 | 7,970 | permissive | [
{
"docstring": "In: name - dataset name - e.g. 'animal' schema - dataset schema url - CouchDB URL",
"name": "__init__",
"signature": "def __init__(self, name, schema, url)"
},
{
"docstring": "Access the record by id",
"name": "get",
"signature": "def get(self, id)"
},
{
"docstrin... | 5 | stack_v2_sparse_classes_30k_train_001123 | Implement the Python class `DataSetCouchDB` described below.
Class description:
Class to represent an in-CouchDB collection of objects
Method signatures and docstrings:
- def __init__(self, name, schema, url): In: name - dataset name - e.g. 'animal' schema - dataset schema url - CouchDB URL
- def get(self, id): Acces... | Implement the Python class `DataSetCouchDB` described below.
Class description:
Class to represent an in-CouchDB collection of objects
Method signatures and docstrings:
- def __init__(self, name, schema, url): In: name - dataset name - e.g. 'animal' schema - dataset schema url - CouchDB URL
- def get(self, id): Acces... | f1ce1e439ce23c3df6b97777cbeceb0eefdc5871 | <|skeleton|>
class DataSetCouchDB:
"""Class to represent an in-CouchDB collection of objects"""
def __init__(self, name, schema, url):
"""In: name - dataset name - e.g. 'animal' schema - dataset schema url - CouchDB URL"""
<|body_0|>
def get(self, id):
"""Access the record by id"""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DataSetCouchDB:
"""Class to represent an in-CouchDB collection of objects"""
def __init__(self, name, schema, url):
"""In: name - dataset name - e.g. 'animal' schema - dataset schema url - CouchDB URL"""
super().__init__(name, schema)
self.ses = Session()
self.url = url
... | the_stack_v2_python_sparse | 04.couchdb/farm/app/dataset.py | asokolsky/RESTing-with-Flask | train | 0 |
eaacc88a0d0076a6e62fe43a3117d74325d5bcd9 | [
"basename = os.path.basename(fastq)\nif basename.endswith('.gz'):\n basename = '.'.join(basename.split('.')[:-1])\nif basename.endswith('.fastq'):\n basename = '.'.join(basename.split('.')[:-1])\nreturn basename",
"basename = self.fastq_basename(fastq)\nfastqc_dir = os.path.join(qc_dir, basename + '_fastqc'... | <|body_start_0|>
basename = os.path.basename(fastq)
if basename.endswith('.gz'):
basename = '.'.join(basename.split('.')[:-1])
if basename.endswith('.fastq'):
basename = '.'.join(basename.split('.')[:-1])
return basename
<|end_body_0|>
<|body_start_1|>
ba... | Utility class for creating mock auto-process QC outputs | MockQCOutputs | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MockQCOutputs:
"""Utility class for creating mock auto-process QC outputs"""
def fastq_basename(self, fastq):
"""Return the basename for a FASTQ file"""
<|body_0|>
def fastqc_v0_11_2(self, fastq, qc_dir):
"""Create mock outputs from FastQC v0.11.2"""
<|bo... | stack_v2_sparse_classes_36k_train_034996 | 5,719 | no_license | [
{
"docstring": "Return the basename for a FASTQ file",
"name": "fastq_basename",
"signature": "def fastq_basename(self, fastq)"
},
{
"docstring": "Create mock outputs from FastQC v0.11.2",
"name": "fastqc_v0_11_2",
"signature": "def fastqc_v0_11_2(self, fastq, qc_dir)"
},
{
"docs... | 4 | stack_v2_sparse_classes_30k_train_018788 | Implement the Python class `MockQCOutputs` described below.
Class description:
Utility class for creating mock auto-process QC outputs
Method signatures and docstrings:
- def fastq_basename(self, fastq): Return the basename for a FASTQ file
- def fastqc_v0_11_2(self, fastq, qc_dir): Create mock outputs from FastQC v0... | Implement the Python class `MockQCOutputs` described below.
Class description:
Utility class for creating mock auto-process QC outputs
Method signatures and docstrings:
- def fastq_basename(self, fastq): Return the basename for a FASTQ file
- def fastqc_v0_11_2(self, fastq, qc_dir): Create mock outputs from FastQC v0... | 9b09f20b344d0ee87227e8771a479aa7c04f1837 | <|skeleton|>
class MockQCOutputs:
"""Utility class for creating mock auto-process QC outputs"""
def fastq_basename(self, fastq):
"""Return the basename for a FASTQ file"""
<|body_0|>
def fastqc_v0_11_2(self, fastq, qc_dir):
"""Create mock outputs from FastQC v0.11.2"""
<|bo... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MockQCOutputs:
"""Utility class for creating mock auto-process QC outputs"""
def fastq_basename(self, fastq):
"""Return the basename for a FASTQ file"""
basename = os.path.basename(fastq)
if basename.endswith('.gz'):
basename = '.'.join(basename.split('.')[:-1])
... | the_stack_v2_python_sparse | auto_process_ngs/mockqc.py | nandr0id/auto_process_ngs | train | 0 |
5e9cffdbc12e82d2691eb313dc3bee95387015b8 | [
"self._parent_form = parent_form\nself._field_index = field_index\npy_cui.ui.UIElement.__init__(self, 0, field, renderer, logger)\nFormField.__init__(self, field, init_text, passwd, required, logger)\nself._help_text = 'Press Tab to move to the next field, or Enter to submit.'\nself._padx = 0\nself._pady = 0\nself.... | <|body_start_0|>
self._parent_form = parent_form
self._field_index = field_index
py_cui.ui.UIElement.__init__(self, 0, field, renderer, logger)
FormField.__init__(self, field, init_text, passwd, required, logger)
self._help_text = 'Press Tab to move to the next field, or Enter to... | Extension of UI element representing an individual field in the form Attributes ---------- _field_index : int The index of the field in the form _parent_form : FormPopup / Form The parent UI Element that contains the form element | FormFieldElement | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FormFieldElement:
"""Extension of UI element representing an individual field in the form Attributes ---------- _field_index : int The index of the field in the form _parent_form : FormPopup / Form The parent UI Element that contains the form element"""
def __init__(self, parent_form, field_... | stack_v2_sparse_classes_36k_train_034997 | 18,026 | permissive | [
{
"docstring": "Initializer for the FormFieldElement class",
"name": "__init__",
"signature": "def __init__(self, parent_form, field_index: int, field, init_text: str, passwd: bool, required: bool, renderer: 'py_cui.renderer.Renderer', logger)"
},
{
"docstring": "Override of base function. Uses ... | 6 | stack_v2_sparse_classes_30k_train_018005 | Implement the Python class `FormFieldElement` described below.
Class description:
Extension of UI element representing an individual field in the form Attributes ---------- _field_index : int The index of the field in the form _parent_form : FormPopup / Form The parent UI Element that contains the form element
Method... | Implement the Python class `FormFieldElement` described below.
Class description:
Extension of UI element representing an individual field in the form Attributes ---------- _field_index : int The index of the field in the form _parent_form : FormPopup / Form The parent UI Element that contains the form element
Method... | 3a7f79cb1cfda4e5aa650a7f92ac04ef7c360e5f | <|skeleton|>
class FormFieldElement:
"""Extension of UI element representing an individual field in the form Attributes ---------- _field_index : int The index of the field in the form _parent_form : FormPopup / Form The parent UI Element that contains the form element"""
def __init__(self, parent_form, field_... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FormFieldElement:
"""Extension of UI element representing an individual field in the form Attributes ---------- _field_index : int The index of the field in the form _parent_form : FormPopup / Form The parent UI Element that contains the form element"""
def __init__(self, parent_form, field_index: int, f... | the_stack_v2_python_sparse | py_cui/dialogs/form.py | jwlodek/py_cui | train | 771 |
33e7cac3c176df3dbfce6cb8ed9b4140694b1fcb | [
"if not grid:\n return 0\nm = len(grid)\nn = len(grid[0])\npath = [[0] * n for i in range(m)]\npath[0][0] = grid[0][0]\nfor i in range(1, n):\n path[0][i] = path[0][i - 1] + grid[0][i]\nfor i in range(1, m):\n path[i][0] = path[i - 1][0] + grid[i][0]\nfor i in range(1, m):\n for j in range(1, n):\n ... | <|body_start_0|>
if not grid:
return 0
m = len(grid)
n = len(grid[0])
path = [[0] * n for i in range(m)]
path[0][0] = grid[0][0]
for i in range(1, n):
path[0][i] = path[0][i - 1] + grid[0][i]
for i in range(1, m):
path[i][0] = p... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def minPathSum(self, grid):
""":type grid: List[List[int]] :rtype: int"""
<|body_0|>
def minPathSum1(self, grid):
""":type grid: List[List[int]] :rtype: int"""
<|body_1|>
def minPathSum2(self, grid):
""":type grid: List[List[int]] :rtyp... | stack_v2_sparse_classes_36k_train_034998 | 2,229 | no_license | [
{
"docstring": ":type grid: List[List[int]] :rtype: int",
"name": "minPathSum",
"signature": "def minPathSum(self, grid)"
},
{
"docstring": ":type grid: List[List[int]] :rtype: int",
"name": "minPathSum1",
"signature": "def minPathSum1(self, grid)"
},
{
"docstring": ":type grid: ... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minPathSum(self, grid): :type grid: List[List[int]] :rtype: int
- def minPathSum1(self, grid): :type grid: List[List[int]] :rtype: int
- def minPathSum2(self, grid): :type gr... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def minPathSum(self, grid): :type grid: List[List[int]] :rtype: int
- def minPathSum1(self, grid): :type grid: List[List[int]] :rtype: int
- def minPathSum2(self, grid): :type gr... | eedf73b5f167025a97f0905d3718b6eab2ee3e09 | <|skeleton|>
class Solution:
def minPathSum(self, grid):
""":type grid: List[List[int]] :rtype: int"""
<|body_0|>
def minPathSum1(self, grid):
""":type grid: List[List[int]] :rtype: int"""
<|body_1|>
def minPathSum2(self, grid):
""":type grid: List[List[int]] :rtyp... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def minPathSum(self, grid):
""":type grid: List[List[int]] :rtype: int"""
if not grid:
return 0
m = len(grid)
n = len(grid[0])
path = [[0] * n for i in range(m)]
path[0][0] = grid[0][0]
for i in range(1, n):
path[0][i] =... | the_stack_v2_python_sparse | Array/64_Minimum_Path_Sum.py | xiaomojie/LeetCode | train | 0 | |
c042f42d783c5e61ec6d6e7ae7f488a725e2ae6f | [
"self.carrier_direct_port = carrier_direct_port\nself.http_direct_port = http_direct_port\nself.requires_ssl = requires_ssl\nself.seeds = seeds",
"if dictionary is None:\n return None\ncarrier_direct_port = dictionary.get('carrierDirectPort')\nhttp_direct_port = dictionary.get('httpDirectPort')\nrequires_ssl =... | <|body_start_0|>
self.carrier_direct_port = carrier_direct_port
self.http_direct_port = http_direct_port
self.requires_ssl = requires_ssl
self.seeds = seeds
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
return None
carrier_direct_port = dictionary.ge... | Implementation of the 'CouchbaseConnectParams' model. Specifies an Object containing information about a registered couchbase source. Attributes: carrier_direct_port (int): Specifies the Carrier direct/sll port. http_direct_port (int): Specifies the HTTP direct/sll port. requires_ssl (bool): Specifies whether this clus... | CouchbaseConnectParams | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CouchbaseConnectParams:
"""Implementation of the 'CouchbaseConnectParams' model. Specifies an Object containing information about a registered couchbase source. Attributes: carrier_direct_port (int): Specifies the Carrier direct/sll port. http_direct_port (int): Specifies the HTTP direct/sll port... | stack_v2_sparse_classes_36k_train_034999 | 2,287 | permissive | [
{
"docstring": "Constructor for the CouchbaseConnectParams class",
"name": "__init__",
"signature": "def __init__(self, carrier_direct_port=None, http_direct_port=None, requires_ssl=None, seeds=None)"
},
{
"docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictio... | 2 | stack_v2_sparse_classes_30k_train_001096 | Implement the Python class `CouchbaseConnectParams` described below.
Class description:
Implementation of the 'CouchbaseConnectParams' model. Specifies an Object containing information about a registered couchbase source. Attributes: carrier_direct_port (int): Specifies the Carrier direct/sll port. http_direct_port (i... | Implement the Python class `CouchbaseConnectParams` described below.
Class description:
Implementation of the 'CouchbaseConnectParams' model. Specifies an Object containing information about a registered couchbase source. Attributes: carrier_direct_port (int): Specifies the Carrier direct/sll port. http_direct_port (i... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class CouchbaseConnectParams:
"""Implementation of the 'CouchbaseConnectParams' model. Specifies an Object containing information about a registered couchbase source. Attributes: carrier_direct_port (int): Specifies the Carrier direct/sll port. http_direct_port (int): Specifies the HTTP direct/sll port... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CouchbaseConnectParams:
"""Implementation of the 'CouchbaseConnectParams' model. Specifies an Object containing information about a registered couchbase source. Attributes: carrier_direct_port (int): Specifies the Carrier direct/sll port. http_direct_port (int): Specifies the HTTP direct/sll port. requires_ss... | the_stack_v2_python_sparse | cohesity_management_sdk/models/couchbase_connect_params.py | cohesity/management-sdk-python | train | 24 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.