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
6565dd37f814dd602ed8b9dbf4480676f157da9f
[ "if rel.to not in self.admin_site._registry:\n for parent in rel.to.mro():\n if parent in self.admin_site._registry and hasattr(self.admin_site._registry[parent], '_child_admin_site'):\n return self.admin_site._registry[parent]._child_admin_site\nreturn self.admin_site", "db = kwargs.get('usi...
<|body_start_0|> if rel.to not in self.admin_site._registry: for parent in rel.to.mro(): if parent in self.admin_site._registry and hasattr(self.admin_site._registry[parent], '_child_admin_site'): return self.admin_site._registry[parent]._child_admin_site ...
Use this mixin in any ModelAdmin that has a foreign key to a polymorphic model that you would like to be a raw id field.
PolymorphicAdminRawIdFix
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PolymorphicAdminRawIdFix: """Use this mixin in any ModelAdmin that has a foreign key to a polymorphic model that you would like to be a raw id field.""" def _get_child_admin_site(self, rel): """Returns the separate AdminSite instance that django-polymorphic maintains for child models...
stack_v2_sparse_classes_36k_train_012400
9,643
permissive
[ { "docstring": "Returns the separate AdminSite instance that django-polymorphic maintains for child models. This admin site needs to be passed to the widget so that it passes the check of whether the field is pointing to a model that's registered in the admin. The hackiness of this implementation reflects the h...
3
stack_v2_sparse_classes_30k_train_018705
Implement the Python class `PolymorphicAdminRawIdFix` described below. Class description: Use this mixin in any ModelAdmin that has a foreign key to a polymorphic model that you would like to be a raw id field. Method signatures and docstrings: - def _get_child_admin_site(self, rel): Returns the separate AdminSite in...
Implement the Python class `PolymorphicAdminRawIdFix` described below. Class description: Use this mixin in any ModelAdmin that has a foreign key to a polymorphic model that you would like to be a raw id field. Method signatures and docstrings: - def _get_child_admin_site(self, rel): Returns the separate AdminSite in...
c507ea5b1864303732c53ad7c5800571fca5fa94
<|skeleton|> class PolymorphicAdminRawIdFix: """Use this mixin in any ModelAdmin that has a foreign key to a polymorphic model that you would like to be a raw id field.""" def _get_child_admin_site(self, rel): """Returns the separate AdminSite instance that django-polymorphic maintains for child models...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PolymorphicAdminRawIdFix: """Use this mixin in any ModelAdmin that has a foreign key to a polymorphic model that you would like to be a raw id field.""" def _get_child_admin_site(self, rel): """Returns the separate AdminSite instance that django-polymorphic maintains for child models. This admin ...
the_stack_v2_python_sparse
icekit/admin_tools/polymorphic.py
ic-labs/django-icekit
train
53
852e977699115e691a92bf32e780d2c9b2424997
[ "if self.test_mode:\n current_time = datetime.datetime.now()\n order.invoice = int(time.mktime(current_time.timetuple()))\nreturn super(ProPayConnector, self).process_payment(order, amount, credit_card, billing_record)", "live_data = {'gateway_url': 'https://epay.propay.com/api/propayapi.aspx', 'cert': 'dcc...
<|body_start_0|> if self.test_mode: current_time = datetime.datetime.now() order.invoice = int(time.mktime(current_time.timetuple())) return super(ProPayConnector, self).process_payment(order, amount, credit_card, billing_record) <|end_body_0|> <|body_start_1|> live_data...
An ecommerce connector to the ProPay gateway. Link to the docs: http://epay.propay.com/pdf/xmldoc.pdf
ProPayConnector
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProPayConnector: """An ecommerce connector to the ProPay gateway. Link to the docs: http://epay.propay.com/pdf/xmldoc.pdf""" def process_payment(self, order, amount, credit_card, billing_record): """For tests, ProPay requires order invoice number to be unique once every 24 hours.""" ...
stack_v2_sparse_classes_36k_train_012401
11,934
no_license
[ { "docstring": "For tests, ProPay requires order invoice number to be unique once every 24 hours.", "name": "process_payment", "signature": "def process_payment(self, order, amount, credit_card, billing_record)" }, { "docstring": "Process a payment of an order through ProPay gateway.", "name...
4
stack_v2_sparse_classes_30k_train_017738
Implement the Python class `ProPayConnector` described below. Class description: An ecommerce connector to the ProPay gateway. Link to the docs: http://epay.propay.com/pdf/xmldoc.pdf Method signatures and docstrings: - def process_payment(self, order, amount, credit_card, billing_record): For tests, ProPay requires o...
Implement the Python class `ProPayConnector` described below. Class description: An ecommerce connector to the ProPay gateway. Link to the docs: http://epay.propay.com/pdf/xmldoc.pdf Method signatures and docstrings: - def process_payment(self, order, amount, credit_card, billing_record): For tests, ProPay requires o...
a780ccdc3350d4b5c7990c65d1af8d71060c62cc
<|skeleton|> class ProPayConnector: """An ecommerce connector to the ProPay gateway. Link to the docs: http://epay.propay.com/pdf/xmldoc.pdf""" def process_payment(self, order, amount, credit_card, billing_record): """For tests, ProPay requires order invoice number to be unique once every 24 hours.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProPayConnector: """An ecommerce connector to the ProPay gateway. Link to the docs: http://epay.propay.com/pdf/xmldoc.pdf""" def process_payment(self, order, amount, credit_card, billing_record): """For tests, ProPay requires order invoice number to be unique once every 24 hours.""" if se...
the_stack_v2_python_sparse
ecommerce/connector.py
wcirillo/ten
train
0
e39d095d412449dda0330fe53d079656088c9ea5
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn DetectedApp()", "from .detected_app_platform_type import DetectedAppPlatformType\nfrom .entity import Entity\nfrom .managed_device import ManagedDevice\nfrom .detected_app_platform_type import DetectedAppPlatformType\nfrom .entity impo...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return DetectedApp() <|end_body_0|> <|body_start_1|> from .detected_app_platform_type import DetectedAppPlatformType from .entity import Entity from .managed_device import ManagedDevice...
A managed or unmanaged app that is installed on a managed device. Unmanaged apps will only appear for devices marked as corporate owned.
DetectedApp
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DetectedApp: """A managed or unmanaged app that is installed on a managed device. Unmanaged apps will only appear for devices marked as corporate owned.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> DetectedApp: """Creates a new instance of the appro...
stack_v2_sparse_classes_36k_train_012402
4,234
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: DetectedApp", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_value(p...
3
stack_v2_sparse_classes_30k_train_016966
Implement the Python class `DetectedApp` described below. Class description: A managed or unmanaged app that is installed on a managed device. Unmanaged apps will only appear for devices marked as corporate owned. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=...
Implement the Python class `DetectedApp` described below. Class description: A managed or unmanaged app that is installed on a managed device. Unmanaged apps will only appear for devices marked as corporate owned. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class DetectedApp: """A managed or unmanaged app that is installed on a managed device. Unmanaged apps will only appear for devices marked as corporate owned.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> DetectedApp: """Creates a new instance of the appro...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DetectedApp: """A managed or unmanaged app that is installed on a managed device. Unmanaged apps will only appear for devices marked as corporate owned.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> DetectedApp: """Creates a new instance of the appropriate class ...
the_stack_v2_python_sparse
msgraph/generated/models/detected_app.py
microsoftgraph/msgraph-sdk-python
train
135
7f21dcf95b011292844fa197982adee16c80fead
[ "super().__init__()\nself.proj = nn.Conv2d(in_channels, in_channels, 5, padding=2, groups=in_channels)\nself.conv0_1 = nn.Conv2d(in_channels, in_channels, (1, 7), padding=(0, 3), groups=in_channels)\nself.conv0_2 = nn.Conv2d(in_channels, in_channels, (7, 1), padding=(3, 0), groups=in_channels)\nself.conv1_1 = nn.Co...
<|body_start_0|> super().__init__() self.proj = nn.Conv2d(in_channels, in_channels, 5, padding=2, groups=in_channels) self.conv0_1 = nn.Conv2d(in_channels, in_channels, (1, 7), padding=(0, 3), groups=in_channels) self.conv0_2 = nn.Conv2d(in_channels, in_channels, (7, 1), padding=(3, 0), ...
MSCA
[ "MIT", "Apache-2.0", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MSCA: def __init__(self, in_channels: int, **kwargs) -> None: """Multi-scale convolutional attention (MSCA). - SegNeXt: http://arxiv.org/abs/2209.08575 Parameters ---------- in_channels : int The number of input channels.""" <|body_0|> def forward(self, x: torch.Tensor) -> t...
stack_v2_sparse_classes_36k_train_012403
11,576
permissive
[ { "docstring": "Multi-scale convolutional attention (MSCA). - SegNeXt: http://arxiv.org/abs/2209.08575 Parameters ---------- in_channels : int The number of input channels.", "name": "__init__", "signature": "def __init__(self, in_channels: int, **kwargs) -> None" }, { "docstring": "Forward pass...
2
null
Implement the Python class `MSCA` described below. Class description: Implement the MSCA class. Method signatures and docstrings: - def __init__(self, in_channels: int, **kwargs) -> None: Multi-scale convolutional attention (MSCA). - SegNeXt: http://arxiv.org/abs/2209.08575 Parameters ---------- in_channels : int The...
Implement the Python class `MSCA` described below. Class description: Implement the MSCA class. Method signatures and docstrings: - def __init__(self, in_channels: int, **kwargs) -> None: Multi-scale convolutional attention (MSCA). - SegNeXt: http://arxiv.org/abs/2209.08575 Parameters ---------- in_channels : int The...
7f79405012eb934b419bbdba8de23f35e840ca85
<|skeleton|> class MSCA: def __init__(self, in_channels: int, **kwargs) -> None: """Multi-scale convolutional attention (MSCA). - SegNeXt: http://arxiv.org/abs/2209.08575 Parameters ---------- in_channels : int The number of input channels.""" <|body_0|> def forward(self, x: torch.Tensor) -> t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MSCA: def __init__(self, in_channels: int, **kwargs) -> None: """Multi-scale convolutional attention (MSCA). - SegNeXt: http://arxiv.org/abs/2209.08575 Parameters ---------- in_channels : int The number of input channels.""" super().__init__() self.proj = nn.Conv2d(in_channels, in_chan...
the_stack_v2_python_sparse
cellseg_models_pytorch/modules/attention_modules.py
okunator/cellseg_models.pytorch
train
43
bb1b1932492c568a3117bdff4f149386c95123f5
[ "super(TabularCNNNetBasic, self).__init__()\nself.fc1_data = nn.Linear(meta_channels, 16)\nself.fc2_data = nn.Linear(16, 8)\nself.conv1_img = nn.Conv2d(in_channels, 6, kernel_size=5, bias=False)\nself.pool_img = nn.MaxPool2d(kernel_size=2, stride=2)\nself.conv2_img = nn.Conv2d(6, 16, kernel_size=5, bias=False)\nsel...
<|body_start_0|> super(TabularCNNNetBasic, self).__init__() self.fc1_data = nn.Linear(meta_channels, 16) self.fc2_data = nn.Linear(16, 8) self.conv1_img = nn.Conv2d(in_channels, 6, kernel_size=5, bias=False) self.pool_img = nn.MaxPool2d(kernel_size=2, stride=2) self.conv2...
Basic neural network class for residual maps and metadata. The output returns a sigmoid of size 3. Neural network structure : (metadata): (0): Linear(in_features=meta_channels, out_features=16, bias=True) (1): Linear(in_features=16, out_features=8, bias=True) (conv_base): (0): Conv2d(in_channels, 6, kernel_size=(5, 5),...
TabularCNNNetBasic
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TabularCNNNetBasic: """Basic neural network class for residual maps and metadata. The output returns a sigmoid of size 3. Neural network structure : (metadata): (0): Linear(in_features=meta_channels, out_features=16, bias=True) (1): Linear(in_features=16, out_features=8, bias=True) (conv_base): (...
stack_v2_sparse_classes_36k_train_012404
5,888
no_license
[ { "docstring": ":param meta_channels : int, metadata parameters size :param in_channels : int, image channel size - default : in_channels = 1 :param out_channels : int, number of output classes - default : out_channels = 2", "name": "__init__", "signature": "def __init__(self, meta_channels: int, in_cha...
2
stack_v2_sparse_classes_30k_train_010781
Implement the Python class `TabularCNNNetBasic` described below. Class description: Basic neural network class for residual maps and metadata. The output returns a sigmoid of size 3. Neural network structure : (metadata): (0): Linear(in_features=meta_channels, out_features=16, bias=True) (1): Linear(in_features=16, ou...
Implement the Python class `TabularCNNNetBasic` described below. Class description: Basic neural network class for residual maps and metadata. The output returns a sigmoid of size 3. Neural network structure : (metadata): (0): Linear(in_features=meta_channels, out_features=16, bias=True) (1): Linear(in_features=16, ou...
9189d2eeb748b1e539a1062a09a06b38a09780de
<|skeleton|> class TabularCNNNetBasic: """Basic neural network class for residual maps and metadata. The output returns a sigmoid of size 3. Neural network structure : (metadata): (0): Linear(in_features=meta_channels, out_features=16, bias=True) (1): Linear(in_features=16, out_features=8, bias=True) (conv_base): (...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TabularCNNNetBasic: """Basic neural network class for residual maps and metadata. The output returns a sigmoid of size 3. Neural network structure : (metadata): (0): Linear(in_features=meta_channels, out_features=16, bias=True) (1): Linear(in_features=16, out_features=8, bias=True) (conv_base): (0): Conv2d(in...
the_stack_v2_python_sparse
Simulations/helpers/model/baseline.py
emmahoggett/Error_class_lenstronomy
train
1
bddc953027593aedb9e9519b3f74892df84226cc
[ "if user.is_anonymous or user.is_client:\n return False\nif user.is_administrator:\n return False\nif user.is_manager:\n return False\nif user.is_advisor:\n return Image.objects.filter(pk=image.pk).accessible_by(user).exists()\nreturn self.admin_permission(user, image, *args)", "if user.is_anonymous o...
<|body_start_0|> if user.is_anonymous or user.is_client: return False if user.is_administrator: return False if user.is_manager: return False if user.is_advisor: return Image.objects.filter(pk=image.pk).accessible_by(user).exists() ...
ImagePermissionLogic
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImagePermissionLogic: def view(self, user, image, *args): """Permissions for viewing Image""" <|body_0|> def create(self, user, image, *args): """Permissions for creating image""" <|body_1|> <|end_skeleton|> <|body_start_0|> if user.is_anonymous or ...
stack_v2_sparse_classes_36k_train_012405
1,151
no_license
[ { "docstring": "Permissions for viewing Image", "name": "view", "signature": "def view(self, user, image, *args)" }, { "docstring": "Permissions for creating image", "name": "create", "signature": "def create(self, user, image, *args)" } ]
2
stack_v2_sparse_classes_30k_train_018731
Implement the Python class `ImagePermissionLogic` described below. Class description: Implement the ImagePermissionLogic class. Method signatures and docstrings: - def view(self, user, image, *args): Permissions for viewing Image - def create(self, user, image, *args): Permissions for creating image
Implement the Python class `ImagePermissionLogic` described below. Class description: Implement the ImagePermissionLogic class. Method signatures and docstrings: - def view(self, user, image, *args): Permissions for viewing Image - def create(self, user, image, *args): Permissions for creating image <|skeleton|> cla...
95d21cd6036a99c5f399b700a5426e9e2e17e878
<|skeleton|> class ImagePermissionLogic: def view(self, user, image, *args): """Permissions for viewing Image""" <|body_0|> def create(self, user, image, *args): """Permissions for creating image""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ImagePermissionLogic: def view(self, user, image, *args): """Permissions for viewing Image""" if user.is_anonymous or user.is_client: return False if user.is_administrator: return False if user.is_manager: return False if user.is_advi...
the_stack_v2_python_sparse
newsletters/perms/image_perm.py
alexandrenorman/mixeur
train
0
0d638be1356d8d56ed9720c241a5f8cc401c2b40
[ "self._session = requests.Session()\nself._adapter = requests.adapters.HTTPAdapter(max_retries=2)\nself._session.mount('https://', self._adapter)\nif not endpoint[-1] == '/':\n endpoint += '/'\nself.endpoint = endpoint", "if not document_id:\n raise ValueError('Invalid value for document_id')\ntry:\n res...
<|body_start_0|> self._session = requests.Session() self._adapter = requests.adapters.HTTPAdapter(max_retries=2) self._session.mount('https://', self._adapter) if not endpoint[-1] == '/': endpoint += '/' self.endpoint = endpoint <|end_body_0|> <|body_start_1|> ...
An HTTP session with the fulltext endpoint.
FulltextSession
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FulltextSession: """An HTTP session with the fulltext endpoint.""" def __init__(self, endpoint: str) -> None: """Initialize an HTTP session.""" <|body_0|> def retrieve(self, document_id: str) -> Fulltext: """Retrieve fulltext content for an arXiv paper. Parameter...
stack_v2_sparse_classes_36k_train_012406
3,414
permissive
[ { "docstring": "Initialize an HTTP session.", "name": "__init__", "signature": "def __init__(self, endpoint: str) -> None" }, { "docstring": "Retrieve fulltext content for an arXiv paper. Parameters ---------- document_id : str arXiv identifier, including version tag. E.g. ``\"1234.56787v3\"``. ...
2
stack_v2_sparse_classes_30k_train_011356
Implement the Python class `FulltextSession` described below. Class description: An HTTP session with the fulltext endpoint. Method signatures and docstrings: - def __init__(self, endpoint: str) -> None: Initialize an HTTP session. - def retrieve(self, document_id: str) -> Fulltext: Retrieve fulltext content for an a...
Implement the Python class `FulltextSession` described below. Class description: An HTTP session with the fulltext endpoint. Method signatures and docstrings: - def __init__(self, endpoint: str) -> None: Initialize an HTTP session. - def retrieve(self, document_id: str) -> Fulltext: Retrieve fulltext content for an a...
e48f74bb2a858ae7bcf19d68f80cb6dcaa1f4761
<|skeleton|> class FulltextSession: """An HTTP session with the fulltext endpoint.""" def __init__(self, endpoint: str) -> None: """Initialize an HTTP session.""" <|body_0|> def retrieve(self, document_id: str) -> Fulltext: """Retrieve fulltext content for an arXiv paper. Parameter...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FulltextSession: """An HTTP session with the fulltext endpoint.""" def __init__(self, endpoint: str) -> None: """Initialize an HTTP session.""" self._session = requests.Session() self._adapter = requests.adapters.HTTPAdapter(max_retries=2) self._session.mount('https://', s...
the_stack_v2_python_sparse
search/services/fulltext.py
arXiv/arxiv-search
train
54
0121c2adaeb0041cd982e7d67436ad83af1e04e6
[ "try:\n return True if pkgutil.find_loader(module_name) else False\nexcept ImportError:\n return False", "module_spec = importlib.util.find_spec(module_name)\nmodule_path = module_spec.submodule_search_locations\nif module_path:\n return list(module_path)[0]\nreturn module_spec.origin" ]
<|body_start_0|> try: return True if pkgutil.find_loader(module_name) else False except ImportError: return False <|end_body_0|> <|body_start_1|> module_spec = importlib.util.find_spec(module_name) module_path = module_spec.submodule_search_locations if m...
CustomModules
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CustomModules: def is_importable(module_name: str) -> bool: """Return whether `module_name` can be imported.""" <|body_0|> def get_module_path(module_name: str) -> str: """Return file/directory path to `module_name`.""" <|body_1|> <|end_skeleton|> <|body_st...
stack_v2_sparse_classes_36k_train_012407
866
permissive
[ { "docstring": "Return whether `module_name` can be imported.", "name": "is_importable", "signature": "def is_importable(module_name: str) -> bool" }, { "docstring": "Return file/directory path to `module_name`.", "name": "get_module_path", "signature": "def get_module_path(module_name: ...
2
stack_v2_sparse_classes_30k_train_012147
Implement the Python class `CustomModules` described below. Class description: Implement the CustomModules class. Method signatures and docstrings: - def is_importable(module_name: str) -> bool: Return whether `module_name` can be imported. - def get_module_path(module_name: str) -> str: Return file/directory path to...
Implement the Python class `CustomModules` described below. Class description: Implement the CustomModules class. Method signatures and docstrings: - def is_importable(module_name: str) -> bool: Return whether `module_name` can be imported. - def get_module_path(module_name: str) -> str: Return file/directory path to...
ec9ac7712500adb13fd815dfd476ce9f536c6921
<|skeleton|> class CustomModules: def is_importable(module_name: str) -> bool: """Return whether `module_name` can be imported.""" <|body_0|> def get_module_path(module_name: str) -> str: """Return file/directory path to `module_name`.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CustomModules: def is_importable(module_name: str) -> bool: """Return whether `module_name` can be imported.""" try: return True if pkgutil.find_loader(module_name) else False except ImportError: return False def get_module_path(module_name: str) -> str: ...
the_stack_v2_python_sparse
client/verta/verta/_internal_utils/custom_modules.py
VertaAI/modeldb
train
844
5e8b9932734bec2eac26839189e7c997956ec95b
[ "if self.request.version == 'v6':\n return WorkspaceSerializerV6\nelif self.request.version == 'v7':\n return WorkspaceSerializerV6", "if request.version == 'v6':\n return self._list_v6(request)\nelif request.version == 'v7':\n return self._list_v6(request)\nraise Http404()", "started = rest_util.pa...
<|body_start_0|> if self.request.version == 'v6': return WorkspaceSerializerV6 elif self.request.version == 'v7': return WorkspaceSerializerV6 <|end_body_0|> <|body_start_1|> if request.version == 'v6': return self._list_v6(request) elif request.versi...
This view is the endpoint for retrieving the list of all workspaces.
WorkspacesView
[ "LicenseRef-scancode-free-unknown", "Apache-2.0", "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WorkspacesView: """This view is the endpoint for retrieving the list of all workspaces.""" def get_serializer_class(self): """Returns the appropriate serializer based off the requests version of the REST API""" <|body_0|> def list(self, request): """Retrieves the...
stack_v2_sparse_classes_36k_train_012408
19,677
permissive
[ { "docstring": "Returns the appropriate serializer based off the requests version of the REST API", "name": "get_serializer_class", "signature": "def get_serializer_class(self)" }, { "docstring": "Retrieves the list of all workspaces and returns it in JSON form :param request: the HTTP GET reque...
5
stack_v2_sparse_classes_30k_train_008264
Implement the Python class `WorkspacesView` described below. Class description: This view is the endpoint for retrieving the list of all workspaces. Method signatures and docstrings: - def get_serializer_class(self): Returns the appropriate serializer based off the requests version of the REST API - def list(self, re...
Implement the Python class `WorkspacesView` described below. Class description: This view is the endpoint for retrieving the list of all workspaces. Method signatures and docstrings: - def get_serializer_class(self): Returns the appropriate serializer based off the requests version of the REST API - def list(self, re...
28618aee07ceed9e4a6eb7b8d0e6f05b31d8fd6b
<|skeleton|> class WorkspacesView: """This view is the endpoint for retrieving the list of all workspaces.""" def get_serializer_class(self): """Returns the appropriate serializer based off the requests version of the REST API""" <|body_0|> def list(self, request): """Retrieves the...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WorkspacesView: """This view is the endpoint for retrieving the list of all workspaces.""" def get_serializer_class(self): """Returns the appropriate serializer based off the requests version of the REST API""" if self.request.version == 'v6': return WorkspaceSerializerV6 ...
the_stack_v2_python_sparse
scale/storage/views.py
kfconsultant/scale
train
0
a970ea305c8058bd4e71175c46904b104992c4f4
[ "self.find(By.ID, 'username').send_keys(username)\nself.find(By.ID, 'memberAdd_acctid').send_keys(account)\nself.find(By.ID, 'memberAdd_phone').send_keys(phonenum)\nself.find(By.CSS_SELECTOR, '.js_btn_save').click()\nreturn True", "self.wait((By.CSS_SELECTOR, '.member_colRight_memberTable_td:nth-child(2)'))\neles...
<|body_start_0|> self.find(By.ID, 'username').send_keys(username) self.find(By.ID, 'memberAdd_acctid').send_keys(account) self.find(By.ID, 'memberAdd_phone').send_keys(phonenum) self.find(By.CSS_SELECTOR, '.js_btn_save').click() return True <|end_body_0|> <|body_start_1|> ...
AddMemberPage
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AddMemberPage: def add_member(self, username, account, phonenum): """添加联系人,详细信息 :return:""" <|body_0|> def get_member(self): """获取所有联系人姓名""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.find(By.ID, 'username').send_keys(username) self.f...
stack_v2_sparse_classes_36k_train_012409
1,403
no_license
[ { "docstring": "添加联系人,详细信息 :return:", "name": "add_member", "signature": "def add_member(self, username, account, phonenum)" }, { "docstring": "获取所有联系人姓名", "name": "get_member", "signature": "def get_member(self)" } ]
2
null
Implement the Python class `AddMemberPage` described below. Class description: Implement the AddMemberPage class. Method signatures and docstrings: - def add_member(self, username, account, phonenum): 添加联系人,详细信息 :return: - def get_member(self): 获取所有联系人姓名
Implement the Python class `AddMemberPage` described below. Class description: Implement the AddMemberPage class. Method signatures and docstrings: - def add_member(self, username, account, phonenum): 添加联系人,详细信息 :return: - def get_member(self): 获取所有联系人姓名 <|skeleton|> class AddMemberPage: def add_member(self, us...
bf5a94321c4f2d28a0de2413760e6d517bfba0b8
<|skeleton|> class AddMemberPage: def add_member(self, username, account, phonenum): """添加联系人,详细信息 :return:""" <|body_0|> def get_member(self): """获取所有联系人姓名""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AddMemberPage: def add_member(self, username, account, phonenum): """添加联系人,详细信息 :return:""" self.find(By.ID, 'username').send_keys(username) self.find(By.ID, 'memberAdd_acctid').send_keys(account) self.find(By.ID, 'memberAdd_phone').send_keys(phonenum) self.find(By.CSS_...
the_stack_v2_python_sparse
pratice_lesson5_selenium/po_wework/PO_add_contactor/page/add_member_page.py
testdemo11/test2_pratice
train
1
db669baa521963388b76b5bea745c8adb0b63de1
[ "_type = request.GET.get('type')\nif not _type:\n promotion_id = request.GET['id']\n promotion = models.Promotion.objects.get(owner=request.manager, type=models.PROMOTION_TYPE_PREMIUM_SALE, id=promotion_id)\n models.Promotion.fill_details(request.manager, [promotion], {'with_product': True, 'with_concrete_...
<|body_start_0|> _type = request.GET.get('type') if not _type: promotion_id = request.GET['id'] promotion = models.Promotion.objects.get(owner=request.manager, type=models.PROMOTION_TYPE_PREMIUM_SALE, id=promotion_id) models.Promotion.fill_details(request.manager, [pr...
PremiumSale
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PremiumSale: def get(request): """添加买赠""" <|body_0|> def api_put(request): """创建买赠活动""" <|body_1|> <|end_skeleton|> <|body_start_0|> _type = request.GET.get('type') if not _type: promotion_id = request.GET['id'] promo...
stack_v2_sparse_classes_36k_train_012410
7,295
no_license
[ { "docstring": "添加买赠", "name": "get", "signature": "def get(request)" }, { "docstring": "创建买赠活动", "name": "api_put", "signature": "def api_put(request)" } ]
2
stack_v2_sparse_classes_30k_train_009493
Implement the Python class `PremiumSale` described below. Class description: Implement the PremiumSale class. Method signatures and docstrings: - def get(request): 添加买赠 - def api_put(request): 创建买赠活动
Implement the Python class `PremiumSale` described below. Class description: Implement the PremiumSale class. Method signatures and docstrings: - def get(request): 添加买赠 - def api_put(request): 创建买赠活动 <|skeleton|> class PremiumSale: def get(request): """添加买赠""" <|body_0|> def api_put(request...
8b2f7befe92841bcc35e0e60cac5958ef3f3af54
<|skeleton|> class PremiumSale: def get(request): """添加买赠""" <|body_0|> def api_put(request): """创建买赠活动""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PremiumSale: def get(request): """添加买赠""" _type = request.GET.get('type') if not _type: promotion_id = request.GET['id'] promotion = models.Promotion.objects.get(owner=request.manager, type=models.PROMOTION_TYPE_PREMIUM_SALE, id=promotion_id) models....
the_stack_v2_python_sparse
weapp/mall/promotion/premium_sale.py
chengdg/weizoom
train
1
94a888a1499bb625e2f178d3fc6de808917f70b2
[ "self.api = api\nself.data = None\nself.tasks = {}", "try:\n self.data = await self.api.user.get()\nexcept ClientResponseError as error:\n if error.status == HTTPStatus.TOO_MANY_REQUESTS:\n _LOGGER.warning('Sensor data update for %s has too many API requests; Skipping the update', DOMAIN)\n else:\...
<|body_start_0|> self.api = api self.data = None self.tasks = {} <|end_body_0|> <|body_start_1|> try: self.data = await self.api.user.get() except ClientResponseError as error: if error.status == HTTPStatus.TOO_MANY_REQUESTS: _LOGGER.warni...
Habitica API user data cache.
HabitipyData
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HabitipyData: """Habitica API user data cache.""" def __init__(self, api): """Habitica API user data cache.""" <|body_0|> async def update(self): """Get a new fix from Habitica servers.""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.api = ...
stack_v2_sparse_classes_36k_train_012411
8,016
permissive
[ { "docstring": "Habitica API user data cache.", "name": "__init__", "signature": "def __init__(self, api)" }, { "docstring": "Get a new fix from Habitica servers.", "name": "update", "signature": "async def update(self)" } ]
2
null
Implement the Python class `HabitipyData` described below. Class description: Habitica API user data cache. Method signatures and docstrings: - def __init__(self, api): Habitica API user data cache. - async def update(self): Get a new fix from Habitica servers.
Implement the Python class `HabitipyData` described below. Class description: Habitica API user data cache. Method signatures and docstrings: - def __init__(self, api): Habitica API user data cache. - async def update(self): Get a new fix from Habitica servers. <|skeleton|> class HabitipyData: """Habitica API us...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class HabitipyData: """Habitica API user data cache.""" def __init__(self, api): """Habitica API user data cache.""" <|body_0|> async def update(self): """Get a new fix from Habitica servers.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HabitipyData: """Habitica API user data cache.""" def __init__(self, api): """Habitica API user data cache.""" self.api = api self.data = None self.tasks = {} async def update(self): """Get a new fix from Habitica servers.""" try: self.data...
the_stack_v2_python_sparse
homeassistant/components/habitica/sensor.py
home-assistant/core
train
35,501
52c9b76566500cea20db5a0f88432ef9581a160c
[ "super().__init__('DiseaseService')\nself.declare_parameter('model_file')\nself.declare_parameter('diseases')\nmodel_file = self.get_parameter('model_file').get_parameter_value().string_value\nself.get_logger().info('Loading Model %s' % model_file)\nself.model = tf.keras.models.load_model(model_file)\nself.bridge =...
<|body_start_0|> super().__init__('DiseaseService') self.declare_parameter('model_file') self.declare_parameter('diseases') model_file = self.get_parameter('model_file').get_parameter_value().string_value self.get_logger().info('Loading Model %s' % model_file) self.model ...
Specification of disease classification service node. Args: None Params: model_file (str): Pretrained TensorFlow model.
DiseaseService
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DiseaseService: """Specification of disease classification service node. Args: None Params: model_file (str): Pretrained TensorFlow model.""" def __init__(self): """Initialises the service by creating the cvBridge, loading the model from the given parameter and loading the list of va...
stack_v2_sparse_classes_36k_train_012412
4,255
no_license
[ { "docstring": "Initialises the service by creating the cvBridge, loading the model from the given parameter and loading the list of valid disease classes.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Callback for handeling incomeing requests. Basically updates dise...
3
stack_v2_sparse_classes_30k_train_020160
Implement the Python class `DiseaseService` described below. Class description: Specification of disease classification service node. Args: None Params: model_file (str): Pretrained TensorFlow model. Method signatures and docstrings: - def __init__(self): Initialises the service by creating the cvBridge, loading the ...
Implement the Python class `DiseaseService` described below. Class description: Specification of disease classification service node. Args: None Params: model_file (str): Pretrained TensorFlow model. Method signatures and docstrings: - def __init__(self): Initialises the service by creating the cvBridge, loading the ...
d8d6c05c52673dc90ed7296235196c544461d940
<|skeleton|> class DiseaseService: """Specification of disease classification service node. Args: None Params: model_file (str): Pretrained TensorFlow model.""" def __init__(self): """Initialises the service by creating the cvBridge, loading the model from the given parameter and loading the list of va...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DiseaseService: """Specification of disease classification service node. Args: None Params: model_file (str): Pretrained TensorFlow model.""" def __init__(self): """Initialises the service by creating the cvBridge, loading the model from the given parameter and loading the list of valid disease c...
the_stack_v2_python_sparse
fruit_detection_component/scripts/disease_service.py
robmosys-tum/PapPercComp
train
2
83d8934243fca224c7e1a80afeeea578b846d601
[ "self.random_init = cacgmm is None\nself.obs = np.einsum('mft->fmt', norm_observation(obs, axis=0))\nF, M, T = self.obs.shape\nlogger.info(f'CACGMM instance: F = {F:d}, T = {T:}, M = {M}')\nif self.random_init:\n if cgmm_init and num_classes == 2:\n cacg = CacgDistribution()\n covar = np.stack([np....
<|body_start_0|> self.random_init = cacgmm is None self.obs = np.einsum('mft->fmt', norm_observation(obs, axis=0)) F, M, T = self.obs.shape logger.info(f'CACGMM instance: F = {F:d}, T = {T:}, M = {M}') if self.random_init: if cgmm_init and num_classes == 2: ...
Cacgmm Trainer
CacgmmTrainer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CacgmmTrainer: """Cacgmm Trainer""" def __init__(self, obs, num_classes, gamma=None, cacgmm=None, cgmm_init=False): """Arguments: obs: mixture observation, M x F x T num_classes: number of the cluster gamma: initial gamma, K x F x T cgmm_init: init like cgmm papers""" <|body_...
stack_v2_sparse_classes_36k_train_012413
16,663
permissive
[ { "docstring": "Arguments: obs: mixture observation, M x F x T num_classes: number of the cluster gamma: initial gamma, K x F x T cgmm_init: init like cgmm papers", "name": "__init__", "signature": "def __init__(self, obs, num_classes, gamma=None, cacgmm=None, cgmm_init=False)" }, { "docstring":...
2
stack_v2_sparse_classes_30k_train_010867
Implement the Python class `CacgmmTrainer` described below. Class description: Cacgmm Trainer Method signatures and docstrings: - def __init__(self, obs, num_classes, gamma=None, cacgmm=None, cgmm_init=False): Arguments: obs: mixture observation, M x F x T num_classes: number of the cluster gamma: initial gamma, K x ...
Implement the Python class `CacgmmTrainer` described below. Class description: Cacgmm Trainer Method signatures and docstrings: - def __init__(self, obs, num_classes, gamma=None, cacgmm=None, cgmm_init=False): Arguments: obs: mixture observation, M x F x T num_classes: number of the cluster gamma: initial gamma, K x ...
e9fd899c50e266e7101c41da646982c4d0777dce
<|skeleton|> class CacgmmTrainer: """Cacgmm Trainer""" def __init__(self, obs, num_classes, gamma=None, cacgmm=None, cgmm_init=False): """Arguments: obs: mixture observation, M x F x T num_classes: number of the cluster gamma: initial gamma, K x F x T cgmm_init: init like cgmm papers""" <|body_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CacgmmTrainer: """Cacgmm Trainer""" def __init__(self, obs, num_classes, gamma=None, cacgmm=None, cgmm_init=False): """Arguments: obs: mixture observation, M x F x T num_classes: number of the cluster gamma: initial gamma, K x F x T cgmm_init: init like cgmm papers""" self.random_init = c...
the_stack_v2_python_sparse
scripts/sptk/libs/cluster.py
JusperLee/setk
train
1
6d7a2eb11cf2f14d3092f0d9a0d0d4afd66740c3
[ "super().__init__()\nn = int(nOut / 5)\nn1 = nOut - 4 * n\nself.c1 = C(nIn, n, 1, 1)\nself.d1 = CDilated(n, n1, 3, 1, 1)\nself.d2 = CDilated(n, n, 3, 1, 2)\nself.d4 = CDilated(n, n, 3, 1, 4)\nself.d8 = CDilated(n, n, 3, 1, 8)\nself.d16 = CDilated(n, n, 3, 1, 16)\nself.bn = BR(nOut)\nself.add = add", "output1 = se...
<|body_start_0|> super().__init__() n = int(nOut / 5) n1 = nOut - 4 * n self.c1 = C(nIn, n, 1, 1) self.d1 = CDilated(n, n1, 3, 1, 1) self.d2 = CDilated(n, n, 3, 1, 2) self.d4 = CDilated(n, n, 3, 1, 4) self.d8 = CDilated(n, n, 3, 1, 8) self.d16 = CD...
This class defines the ESP block, which is based on the following principle Reduce ---> Split ---> Transform --> Merge
DilatedParllelResidualBlockB
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DilatedParllelResidualBlockB: """This class defines the ESP block, which is based on the following principle Reduce ---> Split ---> Transform --> Merge""" def __init__(self, nIn, nOut, add=True): """:param nIn: number of input channels :param nOut: number of output channels :param ad...
stack_v2_sparse_classes_36k_train_012414
15,567
permissive
[ { "docstring": ":param nIn: number of input channels :param nOut: number of output channels :param add: if true, add a residual connection through identity operation. You can use projection too as in ResNet paper, but we avoid to use it if the dimensions are not the same because we do not want to increase the m...
2
null
Implement the Python class `DilatedParllelResidualBlockB` described below. Class description: This class defines the ESP block, which is based on the following principle Reduce ---> Split ---> Transform --> Merge Method signatures and docstrings: - def __init__(self, nIn, nOut, add=True): :param nIn: number of input ...
Implement the Python class `DilatedParllelResidualBlockB` described below. Class description: This class defines the ESP block, which is based on the following principle Reduce ---> Split ---> Transform --> Merge Method signatures and docstrings: - def __init__(self, nIn, nOut, add=True): :param nIn: number of input ...
f2993d3ce73a2f7ddba05da3891defb08547d504
<|skeleton|> class DilatedParllelResidualBlockB: """This class defines the ESP block, which is based on the following principle Reduce ---> Split ---> Transform --> Merge""" def __init__(self, nIn, nOut, add=True): """:param nIn: number of input channels :param nOut: number of output channels :param ad...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DilatedParllelResidualBlockB: """This class defines the ESP block, which is based on the following principle Reduce ---> Split ---> Transform --> Merge""" def __init__(self, nIn, nOut, add=True): """:param nIn: number of input channels :param nOut: number of output channels :param add: if true, a...
the_stack_v2_python_sparse
pytorch/pytorchcv/models/others/oth_espnet.py
osmr/imgclsmob
train
3,017
3f3512127d680bb5f79a9685decf337d7c91c727
[ "conn, cursor = get_db_cursor()\nbuild = 'toy_build'\ndatabase = 'scratch/toy.db'\nrun_info = talon.init_run_info(database, build)\ntalon.get_counters(database)\nedge_dict = init_refs.make_edge_dict(cursor)\nlocation_dict = init_refs.make_location_dict(build, cursor)\ntranscript_dict = init_refs.make_transcript_dic...
<|body_start_0|> conn, cursor = get_db_cursor() build = 'toy_build' database = 'scratch/toy.db' run_info = talon.init_run_info(database, build) talon.get_counters(database) edge_dict = init_refs.make_edge_dict(cursor) location_dict = init_refs.make_location_dict(b...
TestIdentifyISM
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestIdentifyISM: def test_ISM_suffix(self): """Example where the transcript is an ISM with suffix""" <|body_0|> def test_ISM_prefix(self): """Example where the transcript is a prefix ISM with a novel start""" <|body_1|> def test_no_match(self): "...
stack_v2_sparse_classes_36k_train_012415
4,995
permissive
[ { "docstring": "Example where the transcript is an ISM with suffix", "name": "test_ISM_suffix", "signature": "def test_ISM_suffix(self)" }, { "docstring": "Example where the transcript is a prefix ISM with a novel start", "name": "test_ISM_prefix", "signature": "def test_ISM_prefix(self)...
3
stack_v2_sparse_classes_30k_val_000603
Implement the Python class `TestIdentifyISM` described below. Class description: Implement the TestIdentifyISM class. Method signatures and docstrings: - def test_ISM_suffix(self): Example where the transcript is an ISM with suffix - def test_ISM_prefix(self): Example where the transcript is a prefix ISM with a novel...
Implement the Python class `TestIdentifyISM` described below. Class description: Implement the TestIdentifyISM class. Method signatures and docstrings: - def test_ISM_suffix(self): Example where the transcript is an ISM with suffix - def test_ISM_prefix(self): Example where the transcript is a prefix ISM with a novel...
8014faed5f982e5e106ec05239e47d65878e76c3
<|skeleton|> class TestIdentifyISM: def test_ISM_suffix(self): """Example where the transcript is an ISM with suffix""" <|body_0|> def test_ISM_prefix(self): """Example where the transcript is a prefix ISM with a novel start""" <|body_1|> def test_no_match(self): "...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestIdentifyISM: def test_ISM_suffix(self): """Example where the transcript is an ISM with suffix""" conn, cursor = get_db_cursor() build = 'toy_build' database = 'scratch/toy.db' run_info = talon.init_run_info(database, build) talon.get_counters(database) ...
the_stack_v2_python_sparse
testing_suite/test_ISM_identification.py
kopardev/TALON
train
0
aa9acd679a00509e545732e94cf29cdaa23abeee
[ "super().__init__(**kwargs)\nself.factory = factory\nself.curriculum_guide_slug = self.content_path\nself.curriculum_guide_number = curriculum_guide_number", "curriculum_guide_structure = self.load_yaml_file(self.structure_file_path)\nsections = curriculum_guide_structure.get('sections', None)\nif sections is Non...
<|body_start_0|> super().__init__(**kwargs) self.factory = factory self.curriculum_guide_slug = self.content_path self.curriculum_guide_number = curriculum_guide_number <|end_body_0|> <|body_start_1|> curriculum_guide_structure = self.load_yaml_file(self.structure_file_path) ...
Custom loader for loading curriculum guides.
CurriculumGuidesLoader
[ "CC-BY-NC-SA-4.0", "BSD-3-Clause", "CC0-1.0", "ISC", "Unlicense", "LicenseRef-scancode-secret-labs-2011", "WTFPL", "Apache-2.0", "LGPL-3.0-only", "MIT", "CC-BY-SA-4.0", "LicenseRef-scancode-public-domain", "CC-BY-NC-2.5", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-unknown...
stack_v2_sparse_python_classes_v1
<|skeleton|> class CurriculumGuidesLoader: """Custom loader for loading curriculum guides.""" def __init__(self, factory, curriculum_guide_number, **kwargs): """Create the loader for loading a CurriculumGuide. Args: factory (LoaderFactory): Object for creating other loaders.""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_012416
3,004
permissive
[ { "docstring": "Create the loader for loading a CurriculumGuide. Args: factory (LoaderFactory): Object for creating other loaders.", "name": "__init__", "signature": "def __init__(self, factory, curriculum_guide_number, **kwargs)" }, { "docstring": "Load the content for a curriculum guide. Raise...
2
null
Implement the Python class `CurriculumGuidesLoader` described below. Class description: Custom loader for loading curriculum guides. Method signatures and docstrings: - def __init__(self, factory, curriculum_guide_number, **kwargs): Create the loader for loading a CurriculumGuide. Args: factory (LoaderFactory): Objec...
Implement the Python class `CurriculumGuidesLoader` described below. Class description: Custom loader for loading curriculum guides. Method signatures and docstrings: - def __init__(self, factory, curriculum_guide_number, **kwargs): Create the loader for loading a CurriculumGuide. Args: factory (LoaderFactory): Objec...
ea3281ec6f4d17538f6d3cf6f88d74fa54581b34
<|skeleton|> class CurriculumGuidesLoader: """Custom loader for loading curriculum guides.""" def __init__(self, factory, curriculum_guide_number, **kwargs): """Create the loader for loading a CurriculumGuide. Args: factory (LoaderFactory): Object for creating other loaders.""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CurriculumGuidesLoader: """Custom loader for loading curriculum guides.""" def __init__(self, factory, curriculum_guide_number, **kwargs): """Create the loader for loading a CurriculumGuide. Args: factory (LoaderFactory): Object for creating other loaders.""" super().__init__(**kwargs) ...
the_stack_v2_python_sparse
csfieldguide/curriculum_guides/management/commands/_CurriculumGuidesLoader.py
uccser/cs-field-guide
train
364
dbfb4853b878677e58b0addcbf521a147e64db45
[ "pigsty_size = env_info.get('size', 7)\nself.init_state = None\nself.vision = env_info.get('vision', False)\nself.action_type = 'Categorical'\nself.n_agents = 2\nself.api_type = 'unified'\nreturn EnvCatchPigs(pigsty_size, True)", "self.env.reset()\nobs_list = self.env.get_obs()\nself.init_state = {'0': obs_list[0...
<|body_start_0|> pigsty_size = env_info.get('size', 7) self.init_state = None self.vision = env_info.get('vision', False) self.action_type = 'Categorical' self.n_agents = 2 self.api_type = 'unified' return EnvCatchPigs(pigsty_size, True) <|end_body_0|> <|body_sta...
Encapsulates multi-agents on catch pigs.
MaEnvCatchPigs
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MaEnvCatchPigs: """Encapsulates multi-agents on catch pigs.""" def init_env(self, env_info): """Create a atari environment instance. :param: the config information of environment. :return: the instance of environment""" <|body_0|> def reset(self): """Reset the en...
stack_v2_sparse_classes_36k_train_012417
3,231
permissive
[ { "docstring": "Create a atari environment instance. :param: the config information of environment. :return: the instance of environment", "name": "init_env", "signature": "def init_env(self, env_info)" }, { "docstring": "Reset the environment, if done is true, must clear obs array. :return: the...
3
stack_v2_sparse_classes_30k_train_001765
Implement the Python class `MaEnvCatchPigs` described below. Class description: Encapsulates multi-agents on catch pigs. Method signatures and docstrings: - def init_env(self, env_info): Create a atari environment instance. :param: the config information of environment. :return: the instance of environment - def rese...
Implement the Python class `MaEnvCatchPigs` described below. Class description: Encapsulates multi-agents on catch pigs. Method signatures and docstrings: - def init_env(self, env_info): Create a atari environment instance. :param: the config information of environment. :return: the instance of environment - def rese...
e4ef3a1c92d19d1d08c3ef0e2156b6fecefdbe04
<|skeleton|> class MaEnvCatchPigs: """Encapsulates multi-agents on catch pigs.""" def init_env(self, env_info): """Create a atari environment instance. :param: the config information of environment. :return: the instance of environment""" <|body_0|> def reset(self): """Reset the en...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MaEnvCatchPigs: """Encapsulates multi-agents on catch pigs.""" def init_env(self, env_info): """Create a atari environment instance. :param: the config information of environment. :return: the instance of environment""" pigsty_size = env_info.get('size', 7) self.init_state = None ...
the_stack_v2_python_sparse
xt/environment/ma/catchpigs.py
huawei-noah/xingtian
train
308
e6f089e584ae3fea6d6888b844e6b1d7c6403dd6
[ "self.bars = bars\nself.symbol_list = self.bars.symbol_list\nself.events = events\nself.short_window = short_window\nself.long_window = long_window\nself.bought = self._calculate_initial_bought()", "bought = {}\nfor s in self.symbol_list:\n bought[s] = 'OUT'\nreturn bought", "if event.type == 'MARKET':\n ...
<|body_start_0|> self.bars = bars self.symbol_list = self.bars.symbol_list self.events = events self.short_window = short_window self.long_window = long_window self.bought = self._calculate_initial_bought() <|end_body_0|> <|body_start_1|> bought = {} for ...
Performs a basic Moving Average Crossover strategy with a shorty/long simply weighted moving average. Default short/long windows are 100/400 periods respectively.
MovingAverageCrossStrategy
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MovingAverageCrossStrategy: """Performs a basic Moving Average Crossover strategy with a shorty/long simply weighted moving average. Default short/long windows are 100/400 periods respectively.""" def __init__(self, bars, events, short_window=100, long_window=400): """Initializes the...
stack_v2_sparse_classes_36k_train_012418
3,886
no_license
[ { "docstring": "Initializes the Moving Average Cross Strategy Parameters: bars - The DataHandler object that provides bar information events - The Event Queue object short_window - The short moving average lookback period long_window - The long moving average lookback period", "name": "__init__", "signa...
3
stack_v2_sparse_classes_30k_train_013446
Implement the Python class `MovingAverageCrossStrategy` described below. Class description: Performs a basic Moving Average Crossover strategy with a shorty/long simply weighted moving average. Default short/long windows are 100/400 periods respectively. Method signatures and docstrings: - def __init__(self, bars, ev...
Implement the Python class `MovingAverageCrossStrategy` described below. Class description: Performs a basic Moving Average Crossover strategy with a shorty/long simply weighted moving average. Default short/long windows are 100/400 periods respectively. Method signatures and docstrings: - def __init__(self, bars, ev...
8fbaf833e03977fa8d0c6e073889ec75bee8f01b
<|skeleton|> class MovingAverageCrossStrategy: """Performs a basic Moving Average Crossover strategy with a shorty/long simply weighted moving average. Default short/long windows are 100/400 periods respectively.""" def __init__(self, bars, events, short_window=100, long_window=400): """Initializes the...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MovingAverageCrossStrategy: """Performs a basic Moving Average Crossover strategy with a shorty/long simply weighted moving average. Default short/long windows are 100/400 periods respectively.""" def __init__(self, bars, events, short_window=100, long_window=400): """Initializes the Moving Avera...
the_stack_v2_python_sparse
strategy_mac.py
jonathan-soll/quantstrat_backtester
train
1
a92d92f0d509646d051134d9a7ffcb8989c6d48d
[ "if instance is None and data is not empty:\n data = data.copy()\n ModelClass = self.Meta.model\n fields = model_meta.get_field_info(ModelClass)\n for field_name, field in fields.fields.items():\n '\\n Update the field IF (and ONLY IF):\\n - The field has a specified...
<|body_start_0|> if instance is None and data is not empty: data = data.copy() ModelClass = self.Meta.model fields = model_meta.get_field_info(ModelClass) for field_name, field in fields.fields.items(): '\n Update the field IF (and O...
Inherits the standard Django ModelSerializer class, but also ensures that the underlying model class data are checked on validation.
InvenTreeModelSerializer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InvenTreeModelSerializer: """Inherits the standard Django ModelSerializer class, but also ensures that the underlying model class data are checked on validation.""" def __init__(self, instance=None, data=empty, **kwargs): """Custom __init__ routine to ensure that *default* values (as...
stack_v2_sparse_classes_36k_train_012419
7,561
permissive
[ { "docstring": "Custom __init__ routine to ensure that *default* values (as specified in the ORM) are used by the DRF serializers, *if* the values are not provided by the user.", "name": "__init__", "signature": "def __init__(self, instance=None, data=empty, **kwargs)" }, { "docstring": "Constru...
4
stack_v2_sparse_classes_30k_train_020500
Implement the Python class `InvenTreeModelSerializer` described below. Class description: Inherits the standard Django ModelSerializer class, but also ensures that the underlying model class data are checked on validation. Method signatures and docstrings: - def __init__(self, instance=None, data=empty, **kwargs): Cu...
Implement the Python class `InvenTreeModelSerializer` described below. Class description: Inherits the standard Django ModelSerializer class, but also ensures that the underlying model class data are checked on validation. Method signatures and docstrings: - def __init__(self, instance=None, data=empty, **kwargs): Cu...
2a0ea66f6591756eeb62da28d24daec3ad4209e8
<|skeleton|> class InvenTreeModelSerializer: """Inherits the standard Django ModelSerializer class, but also ensures that the underlying model class data are checked on validation.""" def __init__(self, instance=None, data=empty, **kwargs): """Custom __init__ routine to ensure that *default* values (as...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InvenTreeModelSerializer: """Inherits the standard Django ModelSerializer class, but also ensures that the underlying model class data are checked on validation.""" def __init__(self, instance=None, data=empty, **kwargs): """Custom __init__ routine to ensure that *default* values (as specified in...
the_stack_v2_python_sparse
InvenTree/InvenTree/serializers.py
MedShift/InvenTree
train
0
cdff29985afd8f18dc0a362b9c49cc24f08032e4
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn AutomaticRepliesSetting()", "from .automatic_replies_status import AutomaticRepliesStatus\nfrom .date_time_time_zone import DateTimeTimeZone\nfrom .external_audience_scope import ExternalAudienceScope\nfrom .automatic_replies_status im...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return AutomaticRepliesSetting() <|end_body_0|> <|body_start_1|> from .automatic_replies_status import AutomaticRepliesStatus from .date_time_time_zone import DateTimeTimeZone from .ext...
AutomaticRepliesSetting
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AutomaticRepliesSetting: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AutomaticRepliesSetting: """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_012420
5,128
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: AutomaticRepliesSetting", "name": "create_from_discriminator_value", "signature": "def create_from_discrimin...
3
null
Implement the Python class `AutomaticRepliesSetting` described below. Class description: Implement the AutomaticRepliesSetting class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AutomaticRepliesSetting: Creates a new instance of the appropriate clas...
Implement the Python class `AutomaticRepliesSetting` described below. Class description: Implement the AutomaticRepliesSetting class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AutomaticRepliesSetting: Creates a new instance of the appropriate clas...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class AutomaticRepliesSetting: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AutomaticRepliesSetting: """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 AutomaticRepliesSetting: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> AutomaticRepliesSetting: """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/automatic_replies_setting.py
microsoftgraph/msgraph-sdk-python
train
135
80d8fcd049714a931c5e8daf5f6c1c6c26f1d7ca
[ "ruleTableName = 'Rule %s %s %s %s %s' % (indicatorTable, indicatorColumn, relativeIndex, comparison, multiplier)\nRule.__init__(self, ruleTableName)\nself._selectQuery = 'select Date, Code, %s from %s' % (indicatorColumn, indicatorTable)\nself._indicatorColumn = indicatorColumn\nself._relativeIndex = relativeIndex...
<|body_start_0|> ruleTableName = 'Rule %s %s %s %s %s' % (indicatorTable, indicatorColumn, relativeIndex, comparison, multiplier) Rule.__init__(self, ruleTableName) self._selectQuery = 'select Date, Code, %s from %s' % (indicatorColumn, indicatorTable) self._indicatorColumn = indicatorCo...
Relative Rule Class.
RelativeRule
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RelativeRule: """Relative Rule Class.""" def __init__(self, indicatorTable, indicatorColumn, relativeIndex, comparison, multiplier=1.0): """Class Constructor. :param indicatorTable: :param indicatorColumn: :param relativeIndex: Relative Index to compare the Indicator Column e.g. -1 m...
stack_v2_sparse_classes_36k_train_012421
2,834
no_license
[ { "docstring": "Class Constructor. :param indicatorTable: :param indicatorColumn: :param relativeIndex: Relative Index to compare the Indicator Column e.g. -1 means previous day and -5 means five days ago :param comparison: :param multiplier:", "name": "__init__", "signature": "def __init__(self, indica...
2
stack_v2_sparse_classes_30k_train_021212
Implement the Python class `RelativeRule` described below. Class description: Relative Rule Class. Method signatures and docstrings: - def __init__(self, indicatorTable, indicatorColumn, relativeIndex, comparison, multiplier=1.0): Class Constructor. :param indicatorTable: :param indicatorColumn: :param relativeIndex:...
Implement the Python class `RelativeRule` described below. Class description: Relative Rule Class. Method signatures and docstrings: - def __init__(self, indicatorTable, indicatorColumn, relativeIndex, comparison, multiplier=1.0): Class Constructor. :param indicatorTable: :param indicatorColumn: :param relativeIndex:...
08b07b50ead69decd381cf5f866f4d8ffb80fa54
<|skeleton|> class RelativeRule: """Relative Rule Class.""" def __init__(self, indicatorTable, indicatorColumn, relativeIndex, comparison, multiplier=1.0): """Class Constructor. :param indicatorTable: :param indicatorColumn: :param relativeIndex: Relative Index to compare the Indicator Column e.g. -1 m...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RelativeRule: """Relative Rule Class.""" def __init__(self, indicatorTable, indicatorColumn, relativeIndex, comparison, multiplier=1.0): """Class Constructor. :param indicatorTable: :param indicatorColumn: :param relativeIndex: Relative Index to compare the Indicator Column e.g. -1 means previous...
the_stack_v2_python_sparse
pyswing/objects/rules/relativeRule.py
garyjoy/pyswing
train
1
94185403ea5a9d86b133aae81608774fb2ffd013
[ "self.pay_date = pay_date\nself.start_date = start_date\nself.end_date = end_date\nself.pay_period_hours = pay_period_hours\nself.gross_pay_amount = gross_pay_amount\nself.gross_pay_ytd = gross_pay_ytd\nself.net_pay_amount = net_pay_amount\nself.net_pay_ytd = net_pay_ytd\nself.payroll_provider = payroll_provider\ns...
<|body_start_0|> self.pay_date = pay_date self.start_date = start_date self.end_date = end_date self.pay_period_hours = pay_period_hours self.gross_pay_amount = gross_pay_amount self.gross_pay_ytd = gross_pay_ytd self.net_pay_amount = net_pay_amount self.n...
Implementation of the 'Payroll Main Paystatement Fields' model. TODO: type model description here. Attributes: pay_date (long|int): Pay date for a pay period start_date (long|int): Start date for a pay period end_date (long|int): End date for a pay period pay_period_hours (int): The sum total of the number of hours wor...
PayrollMainPaystatementFields
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PayrollMainPaystatementFields: """Implementation of the 'Payroll Main Paystatement Fields' model. TODO: type model description here. Attributes: pay_date (long|int): Pay date for a pay period start_date (long|int): Start date for a pay period end_date (long|int): End date for a pay period pay_per...
stack_v2_sparse_classes_36k_train_012422
5,216
permissive
[ { "docstring": "Constructor for the PayrollMainPaystatementFields class", "name": "__init__", "signature": "def __init__(self, pay_date=None, start_date=None, end_date=None, pay_period_hours=None, gross_pay_amount=None, gross_pay_ytd=None, net_pay_amount=None, net_pay_ytd=None, payroll_provider=None, pa...
2
null
Implement the Python class `PayrollMainPaystatementFields` described below. Class description: Implementation of the 'Payroll Main Paystatement Fields' model. TODO: type model description here. Attributes: pay_date (long|int): Pay date for a pay period start_date (long|int): Start date for a pay period end_date (long|...
Implement the Python class `PayrollMainPaystatementFields` described below. Class description: Implementation of the 'Payroll Main Paystatement Fields' model. TODO: type model description here. Attributes: pay_date (long|int): Pay date for a pay period start_date (long|int): Start date for a pay period end_date (long|...
b2ab1ded435db75c78d42261f5e4acd2a3061487
<|skeleton|> class PayrollMainPaystatementFields: """Implementation of the 'Payroll Main Paystatement Fields' model. TODO: type model description here. Attributes: pay_date (long|int): Pay date for a pay period start_date (long|int): Start date for a pay period end_date (long|int): End date for a pay period pay_per...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PayrollMainPaystatementFields: """Implementation of the 'Payroll Main Paystatement Fields' model. TODO: type model description here. Attributes: pay_date (long|int): Pay date for a pay period start_date (long|int): Start date for a pay period end_date (long|int): End date for a pay period pay_period_hours (in...
the_stack_v2_python_sparse
finicityapi/models/payroll_main_paystatement_fields.py
monarchmoney/finicity-python
train
0
5d92f08a57780bc3b787d5535c42a6ec287cd9e9
[ "favorite_existence = Favorite.query(Favorite.model_key == fav.model_key, Favorite.model_type == fav.model_type, ancestor=fav.key.parent()).count()\nif favorite_existence == 0:\n fav.put()\n TBANSHelper.update_favorites(fav.user_id, device_key)\n return True\nelse:\n return False", "to_delete = Favori...
<|body_start_0|> favorite_existence = Favorite.query(Favorite.model_key == fav.model_key, Favorite.model_type == fav.model_type, ancestor=fav.key.parent()).count() if favorite_existence == 0: fav.put() TBANSHelper.update_favorites(fav.user_id, device_key) return True ...
MyTBAHelper
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MyTBAHelper: def add_favorite(fav: Favorite, device_key: Optional[str]=None) -> bool: """returns true if the favorite was successfully added, or false if it already existed""" <|body_0|> def remove_favorite(account_key: ndb.Key, model_key: str, model_type: ModelType, device_...
stack_v2_sparse_classes_36k_train_012423
4,103
permissive
[ { "docstring": "returns true if the favorite was successfully added, or false if it already existed", "name": "add_favorite", "signature": "def add_favorite(fav: Favorite, device_key: Optional[str]=None) -> bool" }, { "docstring": "returns true if the favorite was deleted, or false if it didn't ...
4
stack_v2_sparse_classes_30k_train_004796
Implement the Python class `MyTBAHelper` described below. Class description: Implement the MyTBAHelper class. Method signatures and docstrings: - def add_favorite(fav: Favorite, device_key: Optional[str]=None) -> bool: returns true if the favorite was successfully added, or false if it already existed - def remove_fa...
Implement the Python class `MyTBAHelper` described below. Class description: Implement the MyTBAHelper class. Method signatures and docstrings: - def add_favorite(fav: Favorite, device_key: Optional[str]=None) -> bool: returns true if the favorite was successfully added, or false if it already existed - def remove_fa...
6d42f3cdb2f785d192f2871419e58aaae3445029
<|skeleton|> class MyTBAHelper: def add_favorite(fav: Favorite, device_key: Optional[str]=None) -> bool: """returns true if the favorite was successfully added, or false if it already existed""" <|body_0|> def remove_favorite(account_key: ndb.Key, model_key: str, model_type: ModelType, device_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MyTBAHelper: def add_favorite(fav: Favorite, device_key: Optional[str]=None) -> bool: """returns true if the favorite was successfully added, or false if it already existed""" favorite_existence = Favorite.query(Favorite.model_key == fav.model_key, Favorite.model_type == fav.model_type, ancest...
the_stack_v2_python_sparse
src/backend/common/helpers/mytba_helper.py
the-blue-alliance/the-blue-alliance
train
344
4420faa3fef2e2c25e658043004a198c1468c048
[ "self.lang = 'polish'\nself.region = 'pl'\nself.offline = offline\nabs_path = os.path.dirname(os.path.abspath(__file__))\nwith open(os.path.join(abs_path, self.path_key), 'r') as f:\n self.api_key = f.read()\nself.client = googlemaps.Client(key=self.api_key)", "print('Requesting geolocation of: ', addr)\nif se...
<|body_start_0|> self.lang = 'polish' self.region = 'pl' self.offline = offline abs_path = os.path.dirname(os.path.abspath(__file__)) with open(os.path.join(abs_path, self.path_key), 'r') as f: self.api_key = f.read() self.client = googlemaps.Client(key=self.a...
GMaps
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GMaps: def __init__(self, offline=False): """Initialize GMaps object. Read API key. `offline` arg can be set to True if you want to test code using this object.""" <|body_0|> def get_location(self, addr): """Do the request to GMaps and extract latitude and longitude ...
stack_v2_sparse_classes_36k_train_012424
5,343
no_license
[ { "docstring": "Initialize GMaps object. Read API key. `offline` arg can be set to True if you want to test code using this object.", "name": "__init__", "signature": "def __init__(self, offline=False)" }, { "docstring": "Do the request to GMaps and extract latitude and longitude of given place....
4
null
Implement the Python class `GMaps` described below. Class description: Implement the GMaps class. Method signatures and docstrings: - def __init__(self, offline=False): Initialize GMaps object. Read API key. `offline` arg can be set to True if you want to test code using this object. - def get_location(self, addr): D...
Implement the Python class `GMaps` described below. Class description: Implement the GMaps class. Method signatures and docstrings: - def __init__(self, offline=False): Initialize GMaps object. Read API key. `offline` arg can be set to True if you want to test code using this object. - def get_location(self, addr): D...
d9209f20073d075ae7150250cb1a369f8cb215b7
<|skeleton|> class GMaps: def __init__(self, offline=False): """Initialize GMaps object. Read API key. `offline` arg can be set to True if you want to test code using this object.""" <|body_0|> def get_location(self, addr): """Do the request to GMaps and extract latitude and longitude ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GMaps: def __init__(self, offline=False): """Initialize GMaps object. Read API key. `offline` arg can be set to True if you want to test code using this object.""" self.lang = 'polish' self.region = 'pl' self.offline = offline abs_path = os.path.dirname(os.path.abspath(...
the_stack_v2_python_sparse
Experiments/CVRP_DWave/2018_10_19_benchmark_small_csvrp/src/vrp_solver_subtree/src/gmaps.py
BOHRTECHNOLOGY/public_research
train
17
e06f0aecbc9c0f40b7bea990f1e68d6d37df31ad
[ "if not isinstance(loader, SAMLMetadataLoader):\n raise ValueError(\"Argument 'loader' must be an instance of {0} class\".format(SAMLMetadataLoader))\nif not isinstance(validator, SAMLFederatedMetadataValidator):\n raise ValueError(\"Argument 'validator' must be an instance of {0} class\".format(SAMLFederated...
<|body_start_0|> if not isinstance(loader, SAMLMetadataLoader): raise ValueError("Argument 'loader' must be an instance of {0} class".format(SAMLMetadataLoader)) if not isinstance(validator, SAMLFederatedMetadataValidator): raise ValueError("Argument 'validator' must be an instan...
Loads metadata of federated IdPs from the specified metadata service.
SAMLFederatedIdentityProviderLoader
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SAMLFederatedIdentityProviderLoader: """Loads metadata of federated IdPs from the specified metadata service.""" def __init__(self, loader, validator, parser): """Initialize a new instance of SAMLFederatedIdentityProviderLoader class. :param loader: SAML metadata loader :type loader:...
stack_v2_sparse_classes_36k_train_012425
6,037
permissive
[ { "docstring": "Initialize a new instance of SAMLFederatedIdentityProviderLoader class. :param loader: SAML metadata loader :type loader: api.saml.metadata.federations.loader.SAMLMetadataLoader :param validator: SAML metadata validator :type validator: api.saml.metadata.federations.validator.SAMLFederatedMetada...
3
stack_v2_sparse_classes_30k_val_000905
Implement the Python class `SAMLFederatedIdentityProviderLoader` described below. Class description: Loads metadata of federated IdPs from the specified metadata service. Method signatures and docstrings: - def __init__(self, loader, validator, parser): Initialize a new instance of SAMLFederatedIdentityProviderLoader...
Implement the Python class `SAMLFederatedIdentityProviderLoader` described below. Class description: Loads metadata of federated IdPs from the specified metadata service. Method signatures and docstrings: - def __init__(self, loader, validator, parser): Initialize a new instance of SAMLFederatedIdentityProviderLoader...
662cc7e0721d0153857c8c17a37e2a6df86f8ce6
<|skeleton|> class SAMLFederatedIdentityProviderLoader: """Loads metadata of federated IdPs from the specified metadata service.""" def __init__(self, loader, validator, parser): """Initialize a new instance of SAMLFederatedIdentityProviderLoader class. :param loader: SAML metadata loader :type loader:...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SAMLFederatedIdentityProviderLoader: """Loads metadata of federated IdPs from the specified metadata service.""" def __init__(self, loader, validator, parser): """Initialize a new instance of SAMLFederatedIdentityProviderLoader class. :param loader: SAML metadata loader :type loader: api.saml.met...
the_stack_v2_python_sparse
api/saml/metadata/federations/loader.py
NYPL-Simplified/circulation
train
20
3175b321c9ee4a7e7dd15993c3f5446461f56ee7
[ "line_to_journey_pattern = {}\nfor line in self.lines:\n jp_refs = self.get_journey_pattern_refs_by_line_ref(line.ref)\n line_to_journey_pattern[line.ref] = jp_refs\ncombinations = itertools.combinations(line_to_journey_pattern.keys(), 2)\nfor line1, line2 in combinations:\n line1_refs = line_to_journey_pa...
<|body_start_0|> line_to_journey_pattern = {} for line in self.lines: jp_refs = self.get_journey_pattern_refs_by_line_ref(line.ref) line_to_journey_pattern[line.ref] = jp_refs combinations = itertools.combinations(line_to_journey_pattern.keys(), 2) for line1, line...
LinesValidator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LinesValidator: def check_for_common_journey_patterns(self): """Check whether related lines share a JourneyPattern with the designated main line.""" <|body_0|> def check_for_common_stops_points(self): """Check if all lines share common stop points.""" <|body_...
stack_v2_sparse_classes_36k_train_012426
15,204
no_license
[ { "docstring": "Check whether related lines share a JourneyPattern with the designated main line.", "name": "check_for_common_journey_patterns", "signature": "def check_for_common_journey_patterns(self)" }, { "docstring": "Check if all lines share common stop points.", "name": "check_for_com...
3
null
Implement the Python class `LinesValidator` described below. Class description: Implement the LinesValidator class. Method signatures and docstrings: - def check_for_common_journey_patterns(self): Check whether related lines share a JourneyPattern with the designated main line. - def check_for_common_stops_points(sel...
Implement the Python class `LinesValidator` described below. Class description: Implement the LinesValidator class. Method signatures and docstrings: - def check_for_common_journey_patterns(self): Check whether related lines share a JourneyPattern with the designated main line. - def check_for_common_stops_points(sel...
4e147829500a85dd1822e94a375f24e304f67a98
<|skeleton|> class LinesValidator: def check_for_common_journey_patterns(self): """Check whether related lines share a JourneyPattern with the designated main line.""" <|body_0|> def check_for_common_stops_points(self): """Check if all lines share common stop points.""" <|body_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LinesValidator: def check_for_common_journey_patterns(self): """Check whether related lines share a JourneyPattern with the designated main line.""" line_to_journey_pattern = {} for line in self.lines: jp_refs = self.get_journey_pattern_refs_by_line_ref(line.ref) ...
the_stack_v2_python_sparse
transit_odp/data_quality/pti/validators.py
yx20och/bods
train
0
ee57c5fcca4fabb1eadcb4b8845f5d0cafc75b10
[ "if isinstance(path, Path):\n self.path = path\nelif isinstance(path, str):\n self.path = Path(path)\nelse:\n raise TypeError(path)\nif str(self.path).endswith('.py'):\n self.modulename = self.path.stem\n self.path = self.path.parent", "if not module:\n if hasattr(self, 'modulename'):\n m...
<|body_start_0|> if isinstance(path, Path): self.path = path elif isinstance(path, str): self.path = Path(path) else: raise TypeError(path) if str(self.path).endswith('.py'): self.modulename = self.path.stem self.path = self.pat...
DynamicLoader
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DynamicLoader: def __init__(self, path): """:param path: directory or .py file to load classes from""" <|body_0|> def load_class(self, module=None, class_name=None, class_base=None): """Load a class from a module :param module: module name (a file name without .py lo...
stack_v2_sparse_classes_36k_train_012427
2,224
permissive
[ { "docstring": ":param path: directory or .py file to load classes from", "name": "__init__", "signature": "def __init__(self, path)" }, { "docstring": "Load a class from a module :param module: module name (a file name without .py located in path). If None, search everywhere :param class_name: ...
2
null
Implement the Python class `DynamicLoader` described below. Class description: Implement the DynamicLoader class. Method signatures and docstrings: - def __init__(self, path): :param path: directory or .py file to load classes from - def load_class(self, module=None, class_name=None, class_base=None): Load a class fr...
Implement the Python class `DynamicLoader` described below. Class description: Implement the DynamicLoader class. Method signatures and docstrings: - def __init__(self, path): :param path: directory or .py file to load classes from - def load_class(self, module=None, class_name=None, class_base=None): Load a class fr...
a0b53f67d75cccbd8e1e6a0419d85babab7041f5
<|skeleton|> class DynamicLoader: def __init__(self, path): """:param path: directory or .py file to load classes from""" <|body_0|> def load_class(self, module=None, class_name=None, class_base=None): """Load a class from a module :param module: module name (a file name without .py lo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DynamicLoader: def __init__(self, path): """:param path: directory or .py file to load classes from""" if isinstance(path, Path): self.path = path elif isinstance(path, str): self.path = Path(path) else: raise TypeError(path) if str(s...
the_stack_v2_python_sparse
dynamicloader.py
pashazz/vmemperor
train
1
1210b6c6ad0faf278cf00bc7cbf3822ec19ab17d
[ "if left == 0 and right == 0:\n array += [string]\nif left > 0:\n self.func(array, string + '(', left - 1, right)\nif right > 0 and left < right:\n self.func(array, string + ')', left, right - 1)", "rtn = []\nself.func(rtn, '', n, n)\nreturn rtn" ]
<|body_start_0|> if left == 0 and right == 0: array += [string] if left > 0: self.func(array, string + '(', left - 1, right) if right > 0 and left < right: self.func(array, string + ')', left, right - 1) <|end_body_0|> <|body_start_1|> rtn = [] ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def func(self, array, string, left, right): """:param array: 最终生成的list :param string: 本轮已经完成的str :param left: 左括号剩余个数 :param rigt: 右括号剩余个数""" <|body_0|> def generateParenthese(self, n): """:param n:int :return: List[str]""" <|body_1|> <|end_skeleto...
stack_v2_sparse_classes_36k_train_012428
1,485
no_license
[ { "docstring": ":param array: 最终生成的list :param string: 本轮已经完成的str :param left: 左括号剩余个数 :param rigt: 右括号剩余个数", "name": "func", "signature": "def func(self, array, string, left, right)" }, { "docstring": ":param n:int :return: List[str]", "name": "generateParenthese", "signature": "def gen...
2
stack_v2_sparse_classes_30k_train_000548
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def func(self, array, string, left, right): :param array: 最终生成的list :param string: 本轮已经完成的str :param left: 左括号剩余个数 :param rigt: 右括号剩余个数 - def generateParenthese(self, n): :param ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def func(self, array, string, left, right): :param array: 最终生成的list :param string: 本轮已经完成的str :param left: 左括号剩余个数 :param rigt: 右括号剩余个数 - def generateParenthese(self, n): :param ...
b0a87b696cfc032b120d99fed504e772efd34251
<|skeleton|> class Solution: def func(self, array, string, left, right): """:param array: 最终生成的list :param string: 本轮已经完成的str :param left: 左括号剩余个数 :param rigt: 右括号剩余个数""" <|body_0|> def generateParenthese(self, n): """:param n:int :return: List[str]""" <|body_1|> <|end_skeleto...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def func(self, array, string, left, right): """:param array: 最终生成的list :param string: 本轮已经完成的str :param left: 左括号剩余个数 :param rigt: 右括号剩余个数""" if left == 0 and right == 0: array += [string] if left > 0: self.func(array, string + '(', left - 1, right) ...
the_stack_v2_python_sparse
22genrateParentheses.py
chronosvv/algorithm
train
0
13899fbb5823e3e140cf5c1738ba6da5be2ccd0b
[ "self.service = 'pcm'\nself.root = 'ManagedSystem'\nself.ip = ip\nself.x_api_session = x_api_session\nself.managedsystem_id = managedsystem_id", "HTTP_object = HTTPClient.HTTPClient(self.service, self.ip, self.root, 'application/vnd.ibm.powervm.pcm.xml', self.x_api_session)\nHTTP_object.HTTPGet(append=self.manage...
<|body_start_0|> self.service = 'pcm' self.root = 'ManagedSystem' self.ip = ip self.x_api_session = x_api_session self.managedsystem_id = managedsystem_id <|end_body_0|> <|body_start_1|> HTTP_object = HTTPClient.HTTPClient(self.service, self.ip, self.root, 'application/v...
ManagedSystemPcmPreference
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ManagedSystemPcmPreference: def __init__(self, ip, managedsystem_id, x_api_session): """Initializes the required arguments for ManagedSystemPcmPreferences Args: ip : IP address of the HMC Managedsystem_id : The managed system uuid for which the pcm preferences has to be obtained x_api_se...
stack_v2_sparse_classes_36k_train_012429
6,271
permissive
[ { "docstring": "Initializes the required arguments for ManagedSystemPcmPreferences Args: ip : IP address of the HMC Managedsystem_id : The managed system uuid for which the pcm preferences has to be obtained x_api_session: The session id for the current session", "name": "__init__", "signature": "def __...
4
stack_v2_sparse_classes_30k_train_002223
Implement the Python class `ManagedSystemPcmPreference` described below. Class description: Implement the ManagedSystemPcmPreference class. Method signatures and docstrings: - def __init__(self, ip, managedsystem_id, x_api_session): Initializes the required arguments for ManagedSystemPcmPreferences Args: ip : IP addr...
Implement the Python class `ManagedSystemPcmPreference` described below. Class description: Implement the ManagedSystemPcmPreference class. Method signatures and docstrings: - def __init__(self, ip, managedsystem_id, x_api_session): Initializes the required arguments for ManagedSystemPcmPreferences Args: ip : IP addr...
8e46a5a25a57d07f0612404f4b978234d6d2cd4b
<|skeleton|> class ManagedSystemPcmPreference: def __init__(self, ip, managedsystem_id, x_api_session): """Initializes the required arguments for ManagedSystemPcmPreferences Args: ip : IP address of the HMC Managedsystem_id : The managed system uuid for which the pcm preferences has to be obtained x_api_se...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ManagedSystemPcmPreference: def __init__(self, ip, managedsystem_id, x_api_session): """Initializes the required arguments for ManagedSystemPcmPreferences Args: ip : IP address of the HMC Managedsystem_id : The managed system uuid for which the pcm preferences has to be obtained x_api_session: The ses...
the_stack_v2_python_sparse
src/performance_capacity_monitor/ManagedSystemPcm.py
Python3pkg/HmcRestClient
train
0
d8add02c4584d8263f7cebcd87d70f375e75c7b5
[ "super(EngineRichViewHandler, self).init_info(info)\ninfo.on_trait_change(self.select_selected, 'initialized')\nreturn", "editors = self.info.ui._editors\nif editors is not None:\n for editor in editors:\n if editor.factory is self.info.object.tree_editor:\n tree_editor = editor\n ...
<|body_start_0|> super(EngineRichViewHandler, self).init_info(info) info.on_trait_change(self.select_selected, 'initialized') return <|end_body_0|> <|body_start_1|> editors = self.info.ui._editors if editors is not None: for editor in editors: if edit...
A handler for the EngineRichView object.
EngineRichViewHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EngineRichViewHandler: """A handler for the EngineRichView object.""" def init_info(self, info): """Informs the handler what the UIInfo object for a View will be. Overridden here to add a callback on the creation of the view.""" <|body_0|> def select_selected(self, initi...
stack_v2_sparse_classes_36k_train_012430
6,676
no_license
[ { "docstring": "Informs the handler what the UIInfo object for a View will be. Overridden here to add a callback on the creation of the view.", "name": "init_info", "signature": "def init_info(self, info)" }, { "docstring": "Force the tree editor to select the current engine selection, and event...
3
null
Implement the Python class `EngineRichViewHandler` described below. Class description: A handler for the EngineRichView object. Method signatures and docstrings: - def init_info(self, info): Informs the handler what the UIInfo object for a View will be. Overridden here to add a callback on the creation of the view. -...
Implement the Python class `EngineRichViewHandler` described below. Class description: A handler for the EngineRichView object. Method signatures and docstrings: - def init_info(self, info): Informs the handler what the UIInfo object for a View will be. Overridden here to add a callback on the creation of the view. -...
5466f5858dbd2f1f082fa0d7417b57c8fb068fad
<|skeleton|> class EngineRichViewHandler: """A handler for the EngineRichView object.""" def init_info(self, info): """Informs the handler what the UIInfo object for a View will be. Overridden here to add a callback on the creation of the view.""" <|body_0|> def select_selected(self, initi...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EngineRichViewHandler: """A handler for the EngineRichView object.""" def init_info(self, info): """Informs the handler what the UIInfo object for a View will be. Overridden here to add a callback on the creation of the view.""" super(EngineRichViewHandler, self).init_info(info) i...
the_stack_v2_python_sparse
maps/build/mayavi/enthought/mayavi/core/ui/engine_rich_view.py
m-elhussieny/code
train
0
662a09a5889628bb42ea03819a145b275276c5e5
[ "if not l1 or not l2:\n return l1 or l2\nif l1.val < l2.val:\n l1.next = self.mergeTwoLists(l1.next, l2)\n return l1\nelse:\n l2.next = self.mergeTwoLists(l1, l2.next)\n return l2", "if not l1 or not l2:\n return l1 or l2\ndummyHead = ListNode(-1)\ncur = dummyHead\nwhile l1 and l2:\n if l1.va...
<|body_start_0|> if not l1 or not l2: return l1 or l2 if l1.val < l2.val: l1.next = self.mergeTwoLists(l1.next, l2) return l1 else: l2.next = self.mergeTwoLists(l1, l2.next) return l2 <|end_body_0|> <|body_start_1|> if not l1 o...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode: """递归:先用if-else确定一个小的在前面,假如是l1,则l1.next=用同样的函数对l1.next 和 l2 进行处理, 然后直接返回这一个条件中确定的最小的那个node,也就是l1! 直接返回很重要,写这样的递归到后面很容易就会不知道最后到底要返回啥!以及在哪里返回!""" <|body_0|> def mergeTwoLists2(self, l1, l2): """...
stack_v2_sparse_classes_36k_train_012431
2,769
no_license
[ { "docstring": "递归:先用if-else确定一个小的在前面,假如是l1,则l1.next=用同样的函数对l1.next 和 l2 进行处理, 然后直接返回这一个条件中确定的最小的那个node,也就是l1! 直接返回很重要,写这样的递归到后面很容易就会不知道最后到底要返回啥!以及在哪里返回!", "name": "mergeTwoLists", "signature": "def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode" }, { "docstring": "non-recursive: 初始...
2
stack_v2_sparse_classes_30k_train_010989
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode: 递归:先用if-else确定一个小的在前面,假如是l1,则l1.next=用同样的函数对l1.next 和 l2 进行处理, 然后直接返回这一个条件中确定的最小的那个node,也就是l1! 直接返回很重要,写这样的递归到后面很...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode: 递归:先用if-else确定一个小的在前面,假如是l1,则l1.next=用同样的函数对l1.next 和 l2 进行处理, 然后直接返回这一个条件中确定的最小的那个node,也就是l1! 直接返回很重要,写这样的递归到后面很...
b9a2bd8385e44cc79454f9c7f2146370896559ec
<|skeleton|> class Solution: def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode: """递归:先用if-else确定一个小的在前面,假如是l1,则l1.next=用同样的函数对l1.next 和 l2 进行处理, 然后直接返回这一个条件中确定的最小的那个node,也就是l1! 直接返回很重要,写这样的递归到后面很容易就会不知道最后到底要返回啥!以及在哪里返回!""" <|body_0|> def mergeTwoLists2(self, l1, l2): """...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode: """递归:先用if-else确定一个小的在前面,假如是l1,则l1.next=用同样的函数对l1.next 和 l2 进行处理, 然后直接返回这一个条件中确定的最小的那个node,也就是l1! 直接返回很重要,写这样的递归到后面很容易就会不知道最后到底要返回啥!以及在哪里返回!""" if not l1 or not l2: return l1 or l2 if l1.val < l2.val...
the_stack_v2_python_sparse
21.MergeTwoSortedLists.py
haveGrasses/Algorithm
train
0
8c0f2322a4b7798620bfdeb094c0914dbe3c4455
[ "errors = {}\nhost = DEFAULT_HOST\nif user_input is not None:\n host = user_input[CONF_HOST].strip()\n try:\n info = await validate_host(host)\n if info.server_only:\n raise UnsupportedError\n except ConnectionError:\n errors['base'] = ERROR_CANNOT_CONNECT\n except Unsupp...
<|body_start_0|> errors = {} host = DEFAULT_HOST if user_input is not None: host = user_input[CONF_HOST].strip() try: info = await validate_host(host) if info.server_only: raise UnsupportedError except Connec...
Config flow for Kaleidescape integration.
KaleidescapeConfigFlow
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KaleidescapeConfigFlow: """Config flow for Kaleidescape integration.""" async def async_step_user(self, user_input: dict[str, Any] | None=None) -> FlowResult: """Handle user initiated device additions.""" <|body_0|> async def async_step_ssdp(self, discovery_info: ssdp.Ss...
stack_v2_sparse_classes_36k_train_012432
3,713
permissive
[ { "docstring": "Handle user initiated device additions.", "name": "async_step_user", "signature": "async def async_step_user(self, user_input: dict[str, Any] | None=None) -> FlowResult" }, { "docstring": "Handle discovered device.", "name": "async_step_ssdp", "signature": "async def asyn...
3
null
Implement the Python class `KaleidescapeConfigFlow` described below. Class description: Config flow for Kaleidescape integration. Method signatures and docstrings: - async def async_step_user(self, user_input: dict[str, Any] | None=None) -> FlowResult: Handle user initiated device additions. - async def async_step_ss...
Implement the Python class `KaleidescapeConfigFlow` described below. Class description: Config flow for Kaleidescape integration. Method signatures and docstrings: - async def async_step_user(self, user_input: dict[str, Any] | None=None) -> FlowResult: Handle user initiated device additions. - async def async_step_ss...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class KaleidescapeConfigFlow: """Config flow for Kaleidescape integration.""" async def async_step_user(self, user_input: dict[str, Any] | None=None) -> FlowResult: """Handle user initiated device additions.""" <|body_0|> async def async_step_ssdp(self, discovery_info: ssdp.Ss...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KaleidescapeConfigFlow: """Config flow for Kaleidescape integration.""" async def async_step_user(self, user_input: dict[str, Any] | None=None) -> FlowResult: """Handle user initiated device additions.""" errors = {} host = DEFAULT_HOST if user_input is not None: ...
the_stack_v2_python_sparse
homeassistant/components/kaleidescape/config_flow.py
home-assistant/core
train
35,501
b369c93ba7777240f783e9dd5d09d8b89c9521ac
[ "issue_tracker_data = self.get('issue_tracker', {})\nparameters = issue_tracker_data.get('parameters', {})\nurl = parameters.get('url', '')\nissue_parameters = IssueParameters(parameters.get('project_key', ''), parameters.get('issue_type', ''), parameters.get('issue_labels', []), parameters.get('epic_link', ''))\nc...
<|body_start_0|> issue_tracker_data = self.get('issue_tracker', {}) parameters = issue_tracker_data.get('parameters', {}) url = parameters.get('url', '') issue_parameters = IssueParameters(parameters.get('project_key', ''), parameters.get('issue_type', ''), parameters.get('issue_labels',...
Subclass the shared report class to add methods specific for the API-server.
Report
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Report: """Subclass the shared report class to add methods specific for the API-server.""" def issue_tracker(self) -> IssueTracker: """Return the issue tracker of the report.""" <|body_0|> def desired_response_time(self, status: str) -> int: """Return the desired...
stack_v2_sparse_classes_36k_train_012433
2,013
permissive
[ { "docstring": "Return the issue tracker of the report.", "name": "issue_tracker", "signature": "def issue_tracker(self) -> IssueTracker" }, { "docstring": "Return the desired response time for the metric status.", "name": "desired_response_time", "signature": "def desired_response_time(...
3
stack_v2_sparse_classes_30k_train_015371
Implement the Python class `Report` described below. Class description: Subclass the shared report class to add methods specific for the API-server. Method signatures and docstrings: - def issue_tracker(self) -> IssueTracker: Return the issue tracker of the report. - def desired_response_time(self, status: str) -> in...
Implement the Python class `Report` described below. Class description: Subclass the shared report class to add methods specific for the API-server. Method signatures and docstrings: - def issue_tracker(self) -> IssueTracker: Return the issue tracker of the report. - def desired_response_time(self, status: str) -> in...
5d9952bf0bd47895824fa78428d3e4f4d6b5d9b3
<|skeleton|> class Report: """Subclass the shared report class to add methods specific for the API-server.""" def issue_tracker(self) -> IssueTracker: """Return the issue tracker of the report.""" <|body_0|> def desired_response_time(self, status: str) -> int: """Return the desired...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Report: """Subclass the shared report class to add methods specific for the API-server.""" def issue_tracker(self) -> IssueTracker: """Return the issue tracker of the report.""" issue_tracker_data = self.get('issue_tracker', {}) parameters = issue_tracker_data.get('parameters', {}...
the_stack_v2_python_sparse
components/api_server/src/model/report.py
ICTU/quality-time
train
43
65e2e0901eafab88627c231cb157938f52ea5472
[ "category_id = None\nif 'category_id' in self.request.data:\n category_id = self.request.data['category_id']\ncategory_instance = get_object_or_404(Category, id=category_id)\nserializer.save(user=self.request.user, category=category_instance)", "queryset = self.queryset.filter(user=self.request.user)\ncategory...
<|body_start_0|> category_id = None if 'category_id' in self.request.data: category_id = self.request.data['category_id'] category_instance = get_object_or_404(Category, id=category_id) serializer.save(user=self.request.user, category=category_instance) <|end_body_0|> <|body...
detail: pk -- category id e.g. api/study/hanzi_study_count/1" login required, so by default, filtering against the current user
HanziStudyCountViewSet
[ "Artistic-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HanziStudyCountViewSet: """detail: pk -- category id e.g. api/study/hanzi_study_count/1" login required, so by default, filtering against the current user""" def perform_create(self, serializer): """required 'category_id' is part of POST body""" <|body_0|> def get_querys...
stack_v2_sparse_classes_36k_train_012434
10,903
permissive
[ { "docstring": "required 'category_id' is part of POST body", "name": "perform_create", "signature": "def perform_create(self, serializer)" }, { "docstring": "filter by user, and category if asked", "name": "get_queryset", "signature": "def get_queryset(self)" } ]
2
stack_v2_sparse_classes_30k_train_003121
Implement the Python class `HanziStudyCountViewSet` described below. Class description: detail: pk -- category id e.g. api/study/hanzi_study_count/1" login required, so by default, filtering against the current user Method signatures and docstrings: - def perform_create(self, serializer): required 'category_id' is pa...
Implement the Python class `HanziStudyCountViewSet` described below. Class description: detail: pk -- category id e.g. api/study/hanzi_study_count/1" login required, so by default, filtering against the current user Method signatures and docstrings: - def perform_create(self, serializer): required 'category_id' is pa...
eff8dd71474e64ed6acb7a2eaaa90cff72daef1f
<|skeleton|> class HanziStudyCountViewSet: """detail: pk -- category id e.g. api/study/hanzi_study_count/1" login required, so by default, filtering against the current user""" def perform_create(self, serializer): """required 'category_id' is part of POST body""" <|body_0|> def get_querys...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class HanziStudyCountViewSet: """detail: pk -- category id e.g. api/study/hanzi_study_count/1" login required, so by default, filtering against the current user""" def perform_create(self, serializer): """required 'category_id' is part of POST body""" category_id = None if 'category_id'...
the_stack_v2_python_sparse
wsgi/hornbook/study/views.py
pz325/hornbook
train
0
0bfbd884377492309d28a0524b1cb9193b8981e6
[ "self.pieces_chessboard = pieces_chessboard\nself.pieces_chessboard_01 = pieces_chessboard_01\nself.joined_matrix_2 = joined_matrix_2\nself.per_matrix_02 = per_matrix_02", "king = 6 * np.ones((2, 1), dtype=int)\nqueen = 5 * np.ones((2, 1), dtype=int)\nrook = 4 * np.ones((2, 2), dtype=int)\nbishop = 3 * np.ones((2...
<|body_start_0|> self.pieces_chessboard = pieces_chessboard self.pieces_chessboard_01 = pieces_chessboard_01 self.joined_matrix_2 = joined_matrix_2 self.per_matrix_02 = per_matrix_02 <|end_body_0|> <|body_start_1|> king = 6 * np.ones((2, 1), dtype=int) queen = 5 * np.one...
Chess class
Chess
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Chess: """Chess class""" def __init__(self, pieces_chessboard, pieces_chessboard_01, joined_matrix_2, per_matrix_02): """Constructor, initialize the chessboard""" <|body_0|> def board_in(self): """Prints the chessboard configuration in the format""" <|bod...
stack_v2_sparse_classes_36k_train_012435
3,078
no_license
[ { "docstring": "Constructor, initialize the chessboard", "name": "__init__", "signature": "def __init__(self, pieces_chessboard, pieces_chessboard_01, joined_matrix_2, per_matrix_02)" }, { "docstring": "Prints the chessboard configuration in the format", "name": "board_in", "signature": ...
4
null
Implement the Python class `Chess` described below. Class description: Chess class Method signatures and docstrings: - def __init__(self, pieces_chessboard, pieces_chessboard_01, joined_matrix_2, per_matrix_02): Constructor, initialize the chessboard - def board_in(self): Prints the chessboard configuration in the fo...
Implement the Python class `Chess` described below. Class description: Chess class Method signatures and docstrings: - def __init__(self, pieces_chessboard, pieces_chessboard_01, joined_matrix_2, per_matrix_02): Constructor, initialize the chessboard - def board_in(self): Prints the chessboard configuration in the fo...
c055c7ac8090dc8c54180fba39dcf975171c5cd1
<|skeleton|> class Chess: """Chess class""" def __init__(self, pieces_chessboard, pieces_chessboard_01, joined_matrix_2, per_matrix_02): """Constructor, initialize the chessboard""" <|body_0|> def board_in(self): """Prints the chessboard configuration in the format""" <|bod...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Chess: """Chess class""" def __init__(self, pieces_chessboard, pieces_chessboard_01, joined_matrix_2, per_matrix_02): """Constructor, initialize the chessboard""" self.pieces_chessboard = pieces_chessboard self.pieces_chessboard_01 = pieces_chessboard_01 self.joined_matrix...
the_stack_v2_python_sparse
desafio-04/caviuna/python/op_04_xadrez.py
OsProgramadores/op-desafios
train
130
c87919dc93fafaa2d8e584a99a9487bedd084d4f
[ "self._x0 = x0\nself._rhol = rhol\nself._rhor = rhor\nself._energyl = pleft\nself._energyr = pright\nself._dim = dim\nself._xdir = xdir\nif self._xdir >= self._dim:\n self._xdir = self._dim - 1", "if eos is None:\n eos = IdealSingleGas()\ngm1 = eos.gamma() - 1.0\ngmn1 = 1.0 / gm1\nx_rel = x_vec[self._xdir]\...
<|body_start_0|> self._x0 = x0 self._rhol = rhol self._rhor = rhor self._energyl = pleft self._energyr = pright self._dim = dim self._xdir = xdir if self._xdir >= self._dim: self._xdir = self._dim - 1 <|end_body_0|> <|body_start_1|> if...
Solution initializer for the 1D Sod Shock. This is Sod's 1D shock solution as explained in [Hesthaven_2008]_, Section 5.9 The Sod Shock setup is defined by: .. math:: {\\rho}(x < x_0, 0) &= \\rho_l\\\\ {\\rho}(x > x_0, 0) &= \\rho_r\\\\ {\\rho}{V_x}(x, 0) &= 0\\\\ {\\rho}E(x < x_0, 0) &= \\frac{1}{\\gamma - 1}\\\\ {\\r...
SodShock1D
[ "X11", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SodShock1D: """Solution initializer for the 1D Sod Shock. This is Sod's 1D shock solution as explained in [Hesthaven_2008]_, Section 5.9 The Sod Shock setup is defined by: .. math:: {\\rho}(x < x_0, 0) &= \\rho_l\\\\ {\\rho}(x > x_0, 0) &= \\rho_r\\\\ {\\rho}{V_x}(x, 0) &= 0\\\\ {\\rho}E(x < x_0,...
stack_v2_sparse_classes_36k_train_012436
32,800
permissive
[ { "docstring": "Initialize shock parameters. Parameters ---------- dim: int dimension of domain x0: float location of shock rhol: float density to left of shock rhor: float density to right of shock pleft: float pressure to left of shock pright: float pressure to right of shock", "name": "__init__", "si...
2
stack_v2_sparse_classes_30k_train_004859
Implement the Python class `SodShock1D` described below. Class description: Solution initializer for the 1D Sod Shock. This is Sod's 1D shock solution as explained in [Hesthaven_2008]_, Section 5.9 The Sod Shock setup is defined by: .. math:: {\\rho}(x < x_0, 0) &= \\rho_l\\\\ {\\rho}(x > x_0, 0) &= \\rho_r\\\\ {\\rho...
Implement the Python class `SodShock1D` described below. Class description: Solution initializer for the 1D Sod Shock. This is Sod's 1D shock solution as explained in [Hesthaven_2008]_, Section 5.9 The Sod Shock setup is defined by: .. math:: {\\rho}(x < x_0, 0) &= \\rho_l\\\\ {\\rho}(x > x_0, 0) &= \\rho_r\\\\ {\\rho...
47f144782258eae2b1fb39520e96f414ae176ff4
<|skeleton|> class SodShock1D: """Solution initializer for the 1D Sod Shock. This is Sod's 1D shock solution as explained in [Hesthaven_2008]_, Section 5.9 The Sod Shock setup is defined by: .. math:: {\\rho}(x < x_0, 0) &= \\rho_l\\\\ {\\rho}(x > x_0, 0) &= \\rho_r\\\\ {\\rho}{V_x}(x, 0) &= 0\\\\ {\\rho}E(x < x_0,...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SodShock1D: """Solution initializer for the 1D Sod Shock. This is Sod's 1D shock solution as explained in [Hesthaven_2008]_, Section 5.9 The Sod Shock setup is defined by: .. math:: {\\rho}(x < x_0, 0) &= \\rho_l\\\\ {\\rho}(x > x_0, 0) &= \\rho_r\\\\ {\\rho}{V_x}(x, 0) &= 0\\\\ {\\rho}E(x < x_0, 0) &= \\frac...
the_stack_v2_python_sparse
mirgecom/initializers.py
kaushikcfd/mirgecom
train
0
bac4db69a0f7a82e0e142a7c49319c49344a5886
[ "me = request.me\narticle = Article.objects.filter(pk=article_id, is_deleted=False, is_draft=False).first()\nif article is None:\n return self.error(errorcode.MSG_NO_DATA, errorcode.NO_DATA)\ntry:\n ArticleFollow.objects.get_or_create(user=me, article=article)\nexcept:\n return self.error(errorcode.MSG_DB_...
<|body_start_0|> me = request.me article = Article.objects.filter(pk=article_id, is_deleted=False, is_draft=False).first() if article is None: return self.error(errorcode.MSG_NO_DATA, errorcode.NO_DATA) try: ArticleFollow.objects.get_or_create(user=me, article=art...
ArticleFollowView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ArticleFollowView: def post(self, request, article_id): """关注文章,不会重复关注""" <|body_0|> def delete(self, request, article_id): """取消关注文章""" <|body_1|> def get(self, request): """查看某人关注的文章,可分页""" <|body_2|> <|end_skeleton|> <|body_start_0|>...
stack_v2_sparse_classes_36k_train_012437
8,733
no_license
[ { "docstring": "关注文章,不会重复关注", "name": "post", "signature": "def post(self, request, article_id)" }, { "docstring": "取消关注文章", "name": "delete", "signature": "def delete(self, request, article_id)" }, { "docstring": "查看某人关注的文章,可分页", "name": "get", "signature": "def get(self...
3
stack_v2_sparse_classes_30k_train_016859
Implement the Python class `ArticleFollowView` described below. Class description: Implement the ArticleFollowView class. Method signatures and docstrings: - def post(self, request, article_id): 关注文章,不会重复关注 - def delete(self, request, article_id): 取消关注文章 - def get(self, request): 查看某人关注的文章,可分页
Implement the Python class `ArticleFollowView` described below. Class description: Implement the ArticleFollowView class. Method signatures and docstrings: - def post(self, request, article_id): 关注文章,不会重复关注 - def delete(self, request, article_id): 取消关注文章 - def get(self, request): 查看某人关注的文章,可分页 <|skeleton|> class Art...
6a68fb207f43e5ed65299cc08535b35d5e934ead
<|skeleton|> class ArticleFollowView: def post(self, request, article_id): """关注文章,不会重复关注""" <|body_0|> def delete(self, request, article_id): """取消关注文章""" <|body_1|> def get(self, request): """查看某人关注的文章,可分页""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ArticleFollowView: def post(self, request, article_id): """关注文章,不会重复关注""" me = request.me article = Article.objects.filter(pk=article_id, is_deleted=False, is_draft=False).first() if article is None: return self.error(errorcode.MSG_NO_DATA, errorcode.NO_DATA) ...
the_stack_v2_python_sparse
apps/articles_v2/views.py
Slowhalfframe/fanyijiang-API
train
0
a4d1cd96ef6f289a26fd456306c6001617b3d5b8
[ "logger.debug('self=%s model=%s' % (self, model.__dict__))\nif settings.DATABASE_APPS_MAPPING.has_key(model._meta.app_label):\n return settings.DATABASE_APPS_MAPPING[model._meta.app_label]\nreturn None", "logger.debug('self=%s model=%s' % (self, model.__dict__))\nif settings.DATABASE_APPS_MAPPING.has_key(model...
<|body_start_0|> logger.debug('self=%s model=%s' % (self, model.__dict__)) if settings.DATABASE_APPS_MAPPING.has_key(model._meta.app_label): return settings.DATABASE_APPS_MAPPING[model._meta.app_label] return None <|end_body_0|> <|body_start_1|> logger.debug('self=%s model=%...
A router to control all database operations on models for different databases. In case an app is not set in settings.DATABASE_APPS_MAPPING, the router will fallback to the `default` database. Settings example: DATABASE_APPS_MAPPING = {'app1': 'db1', 'app2': 'db2'}
DatabaseAppsRouter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DatabaseAppsRouter: """A router to control all database operations on models for different databases. In case an app is not set in settings.DATABASE_APPS_MAPPING, the router will fallback to the `default` database. Settings example: DATABASE_APPS_MAPPING = {'app1': 'db1', 'app2': 'db2'}""" d...
stack_v2_sparse_classes_36k_train_012438
2,349
no_license
[ { "docstring": "\"Point all read operations to the specific database.", "name": "db_for_read", "signature": "def db_for_read(self, model, **hints)" }, { "docstring": "Point all write operations to the specific database.", "name": "db_for_write", "signature": "def db_for_write(self, model...
4
stack_v2_sparse_classes_30k_test_000834
Implement the Python class `DatabaseAppsRouter` described below. Class description: A router to control all database operations on models for different databases. In case an app is not set in settings.DATABASE_APPS_MAPPING, the router will fallback to the `default` database. Settings example: DATABASE_APPS_MAPPING = {...
Implement the Python class `DatabaseAppsRouter` described below. Class description: A router to control all database operations on models for different databases. In case an app is not set in settings.DATABASE_APPS_MAPPING, the router will fallback to the `default` database. Settings example: DATABASE_APPS_MAPPING = {...
fd37868fa3c502e4d228090c21aac14865657aa1
<|skeleton|> class DatabaseAppsRouter: """A router to control all database operations on models for different databases. In case an app is not set in settings.DATABASE_APPS_MAPPING, the router will fallback to the `default` database. Settings example: DATABASE_APPS_MAPPING = {'app1': 'db1', 'app2': 'db2'}""" d...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DatabaseAppsRouter: """A router to control all database operations on models for different databases. In case an app is not set in settings.DATABASE_APPS_MAPPING, the router will fallback to the `default` database. Settings example: DATABASE_APPS_MAPPING = {'app1': 'db1', 'app2': 'db2'}""" def db_for_rea...
the_stack_v2_python_sparse
runner/router.py
tonyPayetDev/resellingsaiyan
train
0
bcab17324dc75b74af2a3ab2f72d54eed9f3f658
[ "self.client.defaults['HTTP_AUTHORIZATION'] = 'f2823f78920bd288b9f84ebb4cf6a90d702335c2'\npayload = {'username': 'albert', 'password': 'albertsecret'}\nurl = '/api/v1/signup/'\nresponse = self.client.post(url, payload)\nself.assertEqual(response.status_code, 201)\nself.resp = json.loads(response.content)", "paylo...
<|body_start_0|> self.client.defaults['HTTP_AUTHORIZATION'] = 'f2823f78920bd288b9f84ebb4cf6a90d702335c2' payload = {'username': 'albert', 'password': 'albertsecret'} url = '/api/v1/signup/' response = self.client.post(url, payload) self.assertEqual(response.status_code, 201) ...
Test case for signing up
SignupTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SignupTest: """Test case for signing up""" def setUp(self): """Setting up the SignupTest""" <|body_0|> def test_signup(self): """>>> Testing sign up""" <|body_1|> def test_update_user(self): """Updating some user information""" <|body...
stack_v2_sparse_classes_36k_train_012439
3,993
permissive
[ { "docstring": "Setting up the SignupTest", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": ">>> Testing sign up", "name": "test_signup", "signature": "def test_signup(self)" }, { "docstring": "Updating some user information", "name": "test_update_user", ...
3
stack_v2_sparse_classes_30k_train_014475
Implement the Python class `SignupTest` described below. Class description: Test case for signing up Method signatures and docstrings: - def setUp(self): Setting up the SignupTest - def test_signup(self): >>> Testing sign up - def test_update_user(self): Updating some user information
Implement the Python class `SignupTest` described below. Class description: Test case for signing up Method signatures and docstrings: - def setUp(self): Setting up the SignupTest - def test_signup(self): >>> Testing sign up - def test_update_user(self): Updating some user information <|skeleton|> class SignupTest: ...
f19d757a4aea232f61c19ceb12fc86d3e071ef44
<|skeleton|> class SignupTest: """Test case for signing up""" def setUp(self): """Setting up the SignupTest""" <|body_0|> def test_signup(self): """>>> Testing sign up""" <|body_1|> def test_update_user(self): """Updating some user information""" <|body...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SignupTest: """Test case for signing up""" def setUp(self): """Setting up the SignupTest""" self.client.defaults['HTTP_AUTHORIZATION'] = 'f2823f78920bd288b9f84ebb4cf6a90d702335c2' payload = {'username': 'albert', 'password': 'albertsecret'} url = '/api/v1/signup/' ...
the_stack_v2_python_sparse
user_service/user_app/tests.py
ptchankue/microservices
train
2
425c12839a8ea7d54dd97f07fbc184d3770b6968
[ "if x is None:\n return print('The input x is None!')\nxStr = str(x)\nlength = len(xStr)\nif xStr[0] == '-':\n if int(xStr[length - 1:0:-1]) > 2 ** 31:\n return 0\n else:\n return -1 * int(xStr[length - 1:0:-1])\nelif int(xStr[::-1]) > 2 ** 31:\n return 0\nelse:\n return int(xStr[::-1])...
<|body_start_0|> if x is None: return print('The input x is None!') xStr = str(x) length = len(xStr) if xStr[0] == '-': if int(xStr[length - 1:0:-1]) > 2 ** 31: return 0 else: return -1 * int(xStr[length - 1:0:-1]) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def reverse(self, x): """:type x: int :rtype: int""" <|body_0|> def reverseWithoutCheating(self, x): """:type x: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> if x is None: return print('The input x is None!')...
stack_v2_sparse_classes_36k_train_012440
1,239
no_license
[ { "docstring": ":type x: int :rtype: int", "name": "reverse", "signature": "def reverse(self, x)" }, { "docstring": ":type x: int :rtype: int", "name": "reverseWithoutCheating", "signature": "def reverseWithoutCheating(self, x)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverse(self, x): :type x: int :rtype: int - def reverseWithoutCheating(self, x): :type x: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def reverse(self, x): :type x: int :rtype: int - def reverseWithoutCheating(self, x): :type x: int :rtype: int <|skeleton|> class Solution: def reverse(self, x): ""...
d1666d44226274f13af25cf878cd63a24e1c5528
<|skeleton|> class Solution: def reverse(self, x): """:type x: int :rtype: int""" <|body_0|> def reverseWithoutCheating(self, x): """:type x: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def reverse(self, x): """:type x: int :rtype: int""" if x is None: return print('The input x is None!') xStr = str(x) length = len(xStr) if xStr[0] == '-': if int(xStr[length - 1:0:-1]) > 2 ** 31: return 0 el...
the_stack_v2_python_sparse
LeetCode007_ReverseInteger.py
rexhzhang/LeetCodeProbelms
train
0
dd3667b8278cde9b75c7b766a3e77aa47b0409e9
[ "self.id = id\nself.is_max_snapshots_config_enabled = is_max_snapshots_config_enabled\nself.is_max_space_config_enabled = is_max_space_config_enabled\nself.max_snapshot_config = max_snapshot_config\nself.max_space_config = max_space_config", "if dictionary is None:\n return None\nid = dictionary.get('id')\nis_...
<|body_start_0|> self.id = id self.is_max_snapshots_config_enabled = is_max_snapshots_config_enabled self.is_max_space_config_enabled = is_max_space_config_enabled self.max_snapshot_config = max_snapshot_config self.max_space_config = max_space_config <|end_body_0|> <|body_start...
Implementation of the 'StorageArraySnapshotThrottlingPolicy' model. TODO: type description here. Attributes: id (long|int): Specifies the volume id of the storage array snapshot config. is_max_snapshots_config_enabled (bool): Specifies if the storage array snapshot max snapshots config is enabled or not. is_max_space_c...
StorageArraySnapshotThrottlingPolicy
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StorageArraySnapshotThrottlingPolicy: """Implementation of the 'StorageArraySnapshotThrottlingPolicy' model. TODO: type description here. Attributes: id (long|int): Specifies the volume id of the storage array snapshot config. is_max_snapshots_config_enabled (bool): Specifies if the storage array...
stack_v2_sparse_classes_36k_train_012441
3,740
permissive
[ { "docstring": "Constructor for the StorageArraySnapshotThrottlingPolicy class", "name": "__init__", "signature": "def __init__(self, id=None, is_max_snapshots_config_enabled=None, is_max_space_config_enabled=None, max_snapshot_config=None, max_space_config=None)" }, { "docstring": "Creates an i...
2
stack_v2_sparse_classes_30k_train_008880
Implement the Python class `StorageArraySnapshotThrottlingPolicy` described below. Class description: Implementation of the 'StorageArraySnapshotThrottlingPolicy' model. TODO: type description here. Attributes: id (long|int): Specifies the volume id of the storage array snapshot config. is_max_snapshots_config_enabled...
Implement the Python class `StorageArraySnapshotThrottlingPolicy` described below. Class description: Implementation of the 'StorageArraySnapshotThrottlingPolicy' model. TODO: type description here. Attributes: id (long|int): Specifies the volume id of the storage array snapshot config. is_max_snapshots_config_enabled...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class StorageArraySnapshotThrottlingPolicy: """Implementation of the 'StorageArraySnapshotThrottlingPolicy' model. TODO: type description here. Attributes: id (long|int): Specifies the volume id of the storage array snapshot config. is_max_snapshots_config_enabled (bool): Specifies if the storage array...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StorageArraySnapshotThrottlingPolicy: """Implementation of the 'StorageArraySnapshotThrottlingPolicy' model. TODO: type description here. Attributes: id (long|int): Specifies the volume id of the storage array snapshot config. is_max_snapshots_config_enabled (bool): Specifies if the storage array snapshot max...
the_stack_v2_python_sparse
cohesity_management_sdk/models/storage_array_snapshot_throttling_policy.py
cohesity/management-sdk-python
train
24
397712fb8f2369fc535f77090b6f6264002cb1f0
[ "result = []\n\ndef preorderDFS(node, result):\n if not node:\n result += ['#']\n return\n result += [str(node.val)]\n preorderDFS(node.left, result)\n preorderDFS(node.right, result)\npreorderDFS(root, result)\nreturn ' '.join(result)", "serial_tree = data.split(' ')\n\ndef constructTre...
<|body_start_0|> result = [] def preorderDFS(node, result): if not node: result += ['#'] return result += [str(node.val)] preorderDFS(node.left, result) preorderDFS(node.right, result) preorderDFS(root, result) ...
Codec_II
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec_II: 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|> <|bo...
stack_v2_sparse_classes_36k_train_012442
2,710
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_train_019993
Implement the Python class `Codec_II` described below. Class description: Implement the Codec_II 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 :...
Implement the Python class `Codec_II` described below. Class description: Implement the Codec_II 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 :...
1461b10b8910fa90a311939c6df9082a8526f9b1
<|skeleton|> class Codec_II: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec_II: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" result = [] def preorderDFS(node, result): if not node: result += ['#'] return result += [str(node.val)] p...
the_stack_v2_python_sparse
Hard/297_serialize&DeserializeBinaryTree.py
Yucheng7713/CodingPracticeByYuch
train
0
2a20bfd2fb40b79e343755b0387c69df89e997dc
[ "_filter = '' if _filter == None else _filter\n_filter = _filter.rstrip(' ')\n_filter = '%' if _filter == '' else _filter\n_filter = _filter.replace('*', '%')\n_filter = _filter.replace('?', '_')\nreturn _filter", "pwdlen = random.randint(minlen, maxlen)\nzeichensatz = string.lowercase + string.uppercase + string...
<|body_start_0|> _filter = '' if _filter == None else _filter _filter = _filter.rstrip(' ') _filter = '%' if _filter == '' else _filter _filter = _filter.replace('*', '%') _filter = _filter.replace('?', '_') return _filter <|end_body_0|> <|body_start_1|> pwdlen =...
Utility
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Utility: def normalizeFilter(_filter): """Bearbeiten des Filters '' --> % None --> % * --> % ? --> _""" <|body_0|> def getpassword(minlen=8, maxlen=8): """Generiert ein Passwort @param minlen minimale Lnge @param maxlen maximale Lnge""" <|body_1|> <|end_skel...
stack_v2_sparse_classes_36k_train_012443
1,059
permissive
[ { "docstring": "Bearbeiten des Filters '' --> % None --> % * --> % ? --> _", "name": "normalizeFilter", "signature": "def normalizeFilter(_filter)" }, { "docstring": "Generiert ein Passwort @param minlen minimale Lnge @param maxlen maximale Lnge", "name": "getpassword", "signature": "def...
2
stack_v2_sparse_classes_30k_train_014293
Implement the Python class `Utility` described below. Class description: Implement the Utility class. Method signatures and docstrings: - def normalizeFilter(_filter): Bearbeiten des Filters '' --> % None --> % * --> % ? --> _ - def getpassword(minlen=8, maxlen=8): Generiert ein Passwort @param minlen minimale Lnge @...
Implement the Python class `Utility` described below. Class description: Implement the Utility class. Method signatures and docstrings: - def normalizeFilter(_filter): Bearbeiten des Filters '' --> % None --> % * --> % ? --> _ - def getpassword(minlen=8, maxlen=8): Generiert ein Passwort @param minlen minimale Lnge @...
1b0a220ad943ad4ca2d712e308d9a72d7388e831
<|skeleton|> class Utility: def normalizeFilter(_filter): """Bearbeiten des Filters '' --> % None --> % * --> % ? --> _""" <|body_0|> def getpassword(minlen=8, maxlen=8): """Generiert ein Passwort @param minlen minimale Lnge @param maxlen maximale Lnge""" <|body_1|> <|end_skel...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Utility: def normalizeFilter(_filter): """Bearbeiten des Filters '' --> % None --> % * --> % ? --> _""" _filter = '' if _filter == None else _filter _filter = _filter.rstrip(' ') _filter = '%' if _filter == '' else _filter _filter = _filter.replace('*', '%') _fi...
the_stack_v2_python_sparse
WEB-INF/helper/utility.py
wnagy/pymframe
train
0
55abbed335856edce14fdfad7a592c34b81a6378
[ "if isinstance(self.id, str):\n self.id = [self.id]\nif 'entit' in self.data_type.value and 'instance' not in self.data_type.value:\n for id in self.id:\n if '_' not in id:\n print(f'WARNING: {id} not valid for {self.data_type.value}.')\nelif 'instance' in self.data_type.value:\n for id i...
<|body_start_0|> if isinstance(self.id, str): self.id = [self.id] if 'entit' in self.data_type.value and 'instance' not in self.data_type.value: for id in self.id: if '_' not in id: print(f'WARNING: {id} not valid for {self.data_type.value}.') ...
General class that will host various data types, as detailed above.
DataFetcher
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataFetcher: """General class that will host various data types, as detailed above.""" def __post_init__(self): """Check types of IDs given, format accordingly.""" <|body_0|> def add_property(self, property): """Add property to the list of data to fetch from the ...
stack_v2_sparse_classes_36k_train_012444
6,236
permissive
[ { "docstring": "Check types of IDs given, format accordingly.", "name": "__post_init__", "signature": "def __post_init__(self)" }, { "docstring": "Add property to the list of data to fetch from the PDB. property is a python dict, with keys as properties, and values as subproperties. e.g.: {\"cel...
5
stack_v2_sparse_classes_30k_test_000409
Implement the Python class `DataFetcher` described below. Class description: General class that will host various data types, as detailed above. Method signatures and docstrings: - def __post_init__(self): Check types of IDs given, format accordingly. - def add_property(self, property): Add property to the list of da...
Implement the Python class `DataFetcher` described below. Class description: General class that will host various data types, as detailed above. Method signatures and docstrings: - def __post_init__(self): Check types of IDs given, format accordingly. - def add_property(self, property): Add property to the list of da...
386359f91c5e064c0b51966a007c5475403e37a0
<|skeleton|> class DataFetcher: """General class that will host various data types, as detailed above.""" def __post_init__(self): """Check types of IDs given, format accordingly.""" <|body_0|> def add_property(self, property): """Add property to the list of data to fetch from the ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DataFetcher: """General class that will host various data types, as detailed above.""" def __post_init__(self): """Check types of IDs given, format accordingly.""" if isinstance(self.id, str): self.id = [self.id] if 'entit' in self.data_type.value and 'instance' not in...
the_stack_v2_python_sparse
pypdb/clients/data/data_types.py
williamgilpin/pypdb
train
268
3525e27ca64f2b2cb00abc45ce5fa314a6390579
[ "for project_id, igms in resource_from_api.iteritems():\n for igm in igms:\n yield {'project_id': project_id, 'id': igm.get('id'), 'creation_timestamp': parser.format_timestamp(igm.get('creationTimestamp'), self.MYSQL_DATETIME_FORMAT), 'name': igm.get('name'), 'description': igm.get('description'), 'base_...
<|body_start_0|> for project_id, igms in resource_from_api.iteritems(): for igm in igms: yield {'project_id': project_id, 'id': igm.get('id'), 'creation_timestamp': parser.format_timestamp(igm.get('creationTimestamp'), self.MYSQL_DATETIME_FORMAT), 'name': igm.get('name'), 'descriptio...
Load compute instance group managers for all projects.
LoadInstanceGroupManagersPipeline
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LoadInstanceGroupManagersPipeline: """Load compute instance group managers for all projects.""" def _transform(self, resource_from_api): """Create an iterator of instance group managers to load into database. Args: resource_from_api (dict): Instance group managers, keyed by project i...
stack_v2_sparse_classes_36k_train_012445
3,877
permissive
[ { "docstring": "Create an iterator of instance group managers to load into database. Args: resource_from_api (dict): Instance group managers, keyed by project id, from GCP API. Yields: iterator: instance group manager properties in a dict.", "name": "_transform", "signature": "def _transform(self, resou...
3
stack_v2_sparse_classes_30k_train_021492
Implement the Python class `LoadInstanceGroupManagersPipeline` described below. Class description: Load compute instance group managers for all projects. Method signatures and docstrings: - def _transform(self, resource_from_api): Create an iterator of instance group managers to load into database. Args: resource_fro...
Implement the Python class `LoadInstanceGroupManagersPipeline` described below. Class description: Load compute instance group managers for all projects. Method signatures and docstrings: - def _transform(self, resource_from_api): Create an iterator of instance group managers to load into database. Args: resource_fro...
a6a1aa7464cda2ad5948e3e8876eb8dded5e2514
<|skeleton|> class LoadInstanceGroupManagersPipeline: """Load compute instance group managers for all projects.""" def _transform(self, resource_from_api): """Create an iterator of instance group managers to load into database. Args: resource_from_api (dict): Instance group managers, keyed by project i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LoadInstanceGroupManagersPipeline: """Load compute instance group managers for all projects.""" def _transform(self, resource_from_api): """Create an iterator of instance group managers to load into database. Args: resource_from_api (dict): Instance group managers, keyed by project id, from GCP A...
the_stack_v2_python_sparse
google/cloud/security/inventory/pipelines/load_instance_group_managers_pipeline.py
shimizu19691210/forseti-security
train
1
db5981bcb87979b8820c2aa6db9e410cf59f8cd3
[ "maarten = FilmFan.film_fans.get(name='Maarten')\nfan = me()\nself.assertEqual(fan, maarten)", "fan_number_one = FilmFan.film_fans.get(seq_nr=1)\nfan = me()\nself.assertIs(fan.seq_nr, fan_number_one.seq_nr)", "first_fan = FilmFan.film_fans.order_by('seq_nr')[0]\nmaarten = me()\nself.assertEqual(maarten, first_f...
<|body_start_0|> maarten = FilmFan.film_fans.get(name='Maarten') fan = me() self.assertEqual(fan, maarten) <|end_body_0|> <|body_start_1|> fan_number_one = FilmFan.film_fans.get(seq_nr=1) fan = me() self.assertIs(fan.seq_nr, fan_number_one.seq_nr) <|end_body_1|> <|body_...
FilmFanModelTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FilmFanModelTests: def test_film_fan_me_is_maarten(self): """me() always returns 'Maarten'.""" <|body_0|> def test_film_fan_me_is_number_one(self): """me() always has sequence number 1.""" <|body_1|> def test_film_fan_me_has_lowest_sequence_number(self):...
stack_v2_sparse_classes_36k_train_012446
17,658
no_license
[ { "docstring": "me() always returns 'Maarten'.", "name": "test_film_fan_me_is_maarten", "signature": "def test_film_fan_me_is_maarten(self)" }, { "docstring": "me() always has sequence number 1.", "name": "test_film_fan_me_is_number_one", "signature": "def test_film_fan_me_is_number_one(...
3
stack_v2_sparse_classes_30k_train_013904
Implement the Python class `FilmFanModelTests` described below. Class description: Implement the FilmFanModelTests class. Method signatures and docstrings: - def test_film_fan_me_is_maarten(self): me() always returns 'Maarten'. - def test_film_fan_me_is_number_one(self): me() always has sequence number 1. - def test_...
Implement the Python class `FilmFanModelTests` described below. Class description: Implement the FilmFanModelTests class. Method signatures and docstrings: - def test_film_fan_me_is_maarten(self): me() always returns 'Maarten'. - def test_film_fan_me_is_number_one(self): me() always has sequence number 1. - def test_...
4ebc9b43a07bbc627b5e21cae368ae31828d3d2e
<|skeleton|> class FilmFanModelTests: def test_film_fan_me_is_maarten(self): """me() always returns 'Maarten'.""" <|body_0|> def test_film_fan_me_is_number_one(self): """me() always has sequence number 1.""" <|body_1|> def test_film_fan_me_has_lowest_sequence_number(self):...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FilmFanModelTests: def test_film_fan_me_is_maarten(self): """me() always returns 'Maarten'.""" maarten = FilmFan.film_fans.get(name='Maarten') fan = me() self.assertEqual(fan, maarten) def test_film_fan_me_is_number_one(self): """me() always has sequence number 1."...
the_stack_v2_python_sparse
FilmRatings/film_list/tests.py
maar35/film-festival-planner
train
0
27ffc7d0b6818a2cce1d58d0393392cd6af9cadb
[ "self.c_num = c_num\nself.c_name = c_name\nself.teacher = teacher", "if isinstance(teacher, Teacher) and teacher.t_name:\n self.teacher = teacher.t_name\n rest_dist = {'课程名称': self.c_name, '教师名称': self.teacher}\n return rest_dist\nelse:\n return None" ]
<|body_start_0|> self.c_num = c_num self.c_name = c_name self.teacher = teacher <|end_body_0|> <|body_start_1|> if isinstance(teacher, Teacher) and teacher.t_name: self.teacher = teacher.t_name rest_dist = {'课程名称': self.c_name, '教师名称': self.teacher} r...
定义课程类
Cource
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Cource: """定义课程类""" def __init__(self, c_num, c_name, teacher=None): """定义构造函数描述课程编号、课程名称、授课教师""" <|body_0|> def binding(self, teacher): """实现课程绑定授课教师""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.c_num = c_num self.c_name = c_nam...
stack_v2_sparse_classes_36k_train_012447
1,792
no_license
[ { "docstring": "定义构造函数描述课程编号、课程名称、授课教师", "name": "__init__", "signature": "def __init__(self, c_num, c_name, teacher=None)" }, { "docstring": "实现课程绑定授课教师", "name": "binding", "signature": "def binding(self, teacher)" } ]
2
stack_v2_sparse_classes_30k_train_006497
Implement the Python class `Cource` described below. Class description: 定义课程类 Method signatures and docstrings: - def __init__(self, c_num, c_name, teacher=None): 定义构造函数描述课程编号、课程名称、授课教师 - def binding(self, teacher): 实现课程绑定授课教师
Implement the Python class `Cource` described below. Class description: 定义课程类 Method signatures and docstrings: - def __init__(self, c_num, c_name, teacher=None): 定义构造函数描述课程编号、课程名称、授课教师 - def binding(self, teacher): 实现课程绑定授课教师 <|skeleton|> class Cource: """定义课程类""" def __init__(self, c_num, c_name, teacher=...
48f15687f6639d1415aeba7e419beb91234d87e2
<|skeleton|> class Cource: """定义课程类""" def __init__(self, c_num, c_name, teacher=None): """定义构造函数描述课程编号、课程名称、授课教师""" <|body_0|> def binding(self, teacher): """实现课程绑定授课教师""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Cource: """定义课程类""" def __init__(self, c_num, c_name, teacher=None): """定义构造函数描述课程编号、课程名称、授课教师""" self.c_num = c_num self.c_name = c_name self.teacher = teacher def binding(self, teacher): """实现课程绑定授课教师""" if isinstance(teacher, Teacher) and teacher.t_...
the_stack_v2_python_sparse
homework/project_58/example.py
AnacondaFeng/AnacondaFeng
train
0
f899d4e2c3627bdd3816386c0e610bf62e9e3bb1
[ "self.capacity = capacity\nself.d = {}\nself.op = 0", "self.op += 1\nif key not in self.d:\n return -1\nelse:\n self.d[key] = [self.d[key][0], self.d[key][1] + 1, self.op]\n return self.d[key][0]", "self.op += 1\nif key not in self.d:\n if self.capacity > 0:\n if len(self.d) >= self.capacity:...
<|body_start_0|> self.capacity = capacity self.d = {} self.op = 0 <|end_body_0|> <|body_start_1|> self.op += 1 if key not in self.d: return -1 else: self.d[key] = [self.d[key][0], self.d[key][1] + 1, self.op] return self.d[key][0] <|en...
LFUCache
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LFUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: None""" <|body_2|> <|end_s...
stack_v2_sparse_classes_36k_train_012448
4,992
no_license
[ { "docstring": ":type capacity: int", "name": "__init__", "signature": "def __init__(self, capacity)" }, { "docstring": ":type key: int :rtype: int", "name": "get", "signature": "def get(self, key)" }, { "docstring": ":type key: int :type value: int :rtype: None", "name": "pu...
3
stack_v2_sparse_classes_30k_train_014221
Implement the Python class `LFUCache` described below. Class description: Implement the LFUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: None
Implement the Python class `LFUCache` described below. Class description: Implement the LFUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: None <|sk...
36d7f9e967a62db77622e0888f61999d7f37579a
<|skeleton|> class LFUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: None""" <|body_2|> <|end_s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LFUCache: def __init__(self, capacity): """:type capacity: int""" self.capacity = capacity self.d = {} self.op = 0 def get(self, key): """:type key: int :rtype: int""" self.op += 1 if key not in self.d: return -1 else: ...
the_stack_v2_python_sparse
P0460.py
westgate458/LeetCode
train
0
69e99b258182a9c78627a6973f04b5d62b13e744
[ "n = len(prices)\ndp = [[None] * 5 for _ in range(n)]\ndp[0][0] = 0\ndp[0][1] = -prices[0]\ndp[0][2] = 0\ndp[0][3] = -prices[0]\ndp[0][4] = 0\nfor idx in range(1, n):\n dp[idx][0] = 0\n dp[idx][1] = max(dp[idx - 1][1], dp[idx - 1][0] - prices[idx])\n dp[idx][2] = max(dp[idx - 1][2], dp[idx - 1][1] + prices...
<|body_start_0|> n = len(prices) dp = [[None] * 5 for _ in range(n)] dp[0][0] = 0 dp[0][1] = -prices[0] dp[0][2] = 0 dp[0][3] = -prices[0] dp[0][4] = 0 for idx in range(1, n): dp[idx][0] = 0 dp[idx][1] = max(dp[idx - 1][1], dp[idx -...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maxProfit(self, prices: List[int]) -> int: """动态规划-二维数组""" <|body_0|> def maxProfitDPOpt(self, prices: List[int]) -> int: """动态规划-空间优化""" <|body_1|> <|end_skeleton|> <|body_start_0|> n = len(prices) dp = [[None] * 5 for _ in ra...
stack_v2_sparse_classes_36k_train_012449
2,661
no_license
[ { "docstring": "动态规划-二维数组", "name": "maxProfit", "signature": "def maxProfit(self, prices: List[int]) -> int" }, { "docstring": "动态规划-空间优化", "name": "maxProfitDPOpt", "signature": "def maxProfitDPOpt(self, prices: List[int]) -> int" } ]
2
stack_v2_sparse_classes_30k_train_011399
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, prices: List[int]) -> int: 动态规划-二维数组 - def maxProfitDPOpt(self, prices: List[int]) -> int: 动态规划-空间优化
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maxProfit(self, prices: List[int]) -> int: 动态规划-二维数组 - def maxProfitDPOpt(self, prices: List[int]) -> int: 动态规划-空间优化 <|skeleton|> class Solution: def maxProfit(self, pr...
52756b30e9d51794591aca030bc918e707f473f1
<|skeleton|> class Solution: def maxProfit(self, prices: List[int]) -> int: """动态规划-二维数组""" <|body_0|> def maxProfitDPOpt(self, prices: List[int]) -> int: """动态规划-空间优化""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def maxProfit(self, prices: List[int]) -> int: """动态规划-二维数组""" n = len(prices) dp = [[None] * 5 for _ in range(n)] dp[0][0] = 0 dp[0][1] = -prices[0] dp[0][2] = 0 dp[0][3] = -prices[0] dp[0][4] = 0 for idx in range(1, n): ...
the_stack_v2_python_sparse
123.买卖股票的最佳时机III/solution.py
QtTao/daily_leetcode
train
0
2bb26fb54187c204cad576885411fe120e4a5916
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')" ]
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
Missing associated documentation comment in .proto file.
ScreenRpcServerServicer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ScreenRpcServerServicer: """Missing associated documentation comment in .proto file.""" def FundCategory(self, request, context): """基金行业分类""" <|body_0|> def FundBasicInfoHandler(self, request, context): """获取基金基础信息""" <|body_1|> <|end_skeleton|> <|body...
stack_v2_sparse_classes_36k_train_012450
4,073
no_license
[ { "docstring": "基金行业分类", "name": "FundCategory", "signature": "def FundCategory(self, request, context)" }, { "docstring": "获取基金基础信息", "name": "FundBasicInfoHandler", "signature": "def FundBasicInfoHandler(self, request, context)" } ]
2
null
Implement the Python class `ScreenRpcServerServicer` described below. Class description: Missing associated documentation comment in .proto file. Method signatures and docstrings: - def FundCategory(self, request, context): 基金行业分类 - def FundBasicInfoHandler(self, request, context): 获取基金基础信息
Implement the Python class `ScreenRpcServerServicer` described below. Class description: Missing associated documentation comment in .proto file. Method signatures and docstrings: - def FundCategory(self, request, context): 基金行业分类 - def FundBasicInfoHandler(self, request, context): 获取基金基础信息 <|skeleton|> class Screen...
99462cea1f8b027bc9e38d79a99e9194d1e72548
<|skeleton|> class ScreenRpcServerServicer: """Missing associated documentation comment in .proto file.""" def FundCategory(self, request, context): """基金行业分类""" <|body_0|> def FundBasicInfoHandler(self, request, context): """获取基金基础信息""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ScreenRpcServerServicer: """Missing associated documentation comment in .proto file.""" def FundCategory(self, request, context): """基金行业分类""" context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method n...
the_stack_v2_python_sparse
rpc/services/api_pb2_grpc.py
rexcorp01/inv
train
1
cf654818c3d4fa50d3cee837f7942e3dd7ac4725
[ "self.ls = []\nself.rs = []\nself.val = None\nself.empty = True", "if self.val == None:\n if self.empty or (num >= self.ls[-1] and self.rs[-1] >= num):\n self.val = num\n elif num < self.ls[-1]:\n self.val = self.ls[-1]\n self.ls[-1] = num\n else:\n self.val = self.rs[-1]\n ...
<|body_start_0|> self.ls = [] self.rs = [] self.val = None self.empty = True <|end_body_0|> <|body_start_1|> if self.val == None: if self.empty or (num >= self.ls[-1] and self.rs[-1] >= num): self.val = num elif num < self.ls[-1]: ...
MedianFinder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MedianFinder: def __init__(self): """Initialize your data structure here.""" <|body_0|> def addNum(self, num): """Adds a num into the data structure. :type num: int :rtype: void""" <|body_1|> def findMedian(self): """Returns the median of current...
stack_v2_sparse_classes_36k_train_012451
3,350
no_license
[ { "docstring": "Initialize your data structure here.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Adds a num into the data structure. :type num: int :rtype: void", "name": "addNum", "signature": "def addNum(self, num)" }, { "docstring": "Returns the ...
3
stack_v2_sparse_classes_30k_train_017280
Implement the Python class `MedianFinder` described below. Class description: Implement the MedianFinder class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def addNum(self, num): Adds a num into the data structure. :type num: int :rtype: void - def findMedian(self): ...
Implement the Python class `MedianFinder` described below. Class description: Implement the MedianFinder class. Method signatures and docstrings: - def __init__(self): Initialize your data structure here. - def addNum(self, num): Adds a num into the data structure. :type num: int :rtype: void - def findMedian(self): ...
737b9bac5a73c319e46cda8c3e9d729f734d7792
<|skeleton|> class MedianFinder: def __init__(self): """Initialize your data structure here.""" <|body_0|> def addNum(self, num): """Adds a num into the data structure. :type num: int :rtype: void""" <|body_1|> def findMedian(self): """Returns the median of current...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MedianFinder: def __init__(self): """Initialize your data structure here.""" self.ls = [] self.rs = [] self.val = None self.empty = True def addNum(self, num): """Adds a num into the data structure. :type num: int :rtype: void""" if self.val == None...
the_stack_v2_python_sparse
leetcode/python/295-find-median-from-data-stream.py
iampkuhz/OnlineJudge_cpp
train
0
9cc08f6c74946e7479285a41597e110090ea4162
[ "UserProfile.objects.create(id=1, password='pbkdf2_sha256$36000$4cg1SAMlOhxd$ONEWDCYTR/kbWBuwpMIo1GUJvMsC+cHZgFUl9YF6KC0=', is_superuser=1, username='cheertt', first_name='cheertt', last_name='油炸皮卡丘', email='1913278504@qq.com', is_staff=1, is_active=1, date_joined='2019-03-01 14:56:48.298648', name='python1234', mo...
<|body_start_0|> UserProfile.objects.create(id=1, password='pbkdf2_sha256$36000$4cg1SAMlOhxd$ONEWDCYTR/kbWBuwpMIo1GUJvMsC+cHZgFUl9YF6KC0=', is_superuser=1, username='cheertt', first_name='cheertt', last_name='油炸皮卡丘', email='1913278504@qq.com', is_staff=1, is_active=1, date_joined='2019-03-01 14:56:48.298648', n...
UserViewTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserViewTest: def setUp(self): """创建一条用户信息数据 :return: None""" <|body_0|> def test_CreditListView_get(self): """点击积分之后显示该用户积分详情的单元测试 若返回200状态码,表示可以登陆页面可以正常显示 否则,系统BUG,需要检查修复 :return:""" <|body_1|> def test_ShareView_post(self): """分享商品加积分 :return:...
stack_v2_sparse_classes_36k_train_012452
2,630
no_license
[ { "docstring": "创建一条用户信息数据 :return: None", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "点击积分之后显示该用户积分详情的单元测试 若返回200状态码,表示可以登陆页面可以正常显示 否则,系统BUG,需要检查修复 :return:", "name": "test_CreditListView_get", "signature": "def test_CreditListView_get(self)" }, { "docstri...
3
stack_v2_sparse_classes_30k_train_004888
Implement the Python class `UserViewTest` described below. Class description: Implement the UserViewTest class. Method signatures and docstrings: - def setUp(self): 创建一条用户信息数据 :return: None - def test_CreditListView_get(self): 点击积分之后显示该用户积分详情的单元测试 若返回200状态码,表示可以登陆页面可以正常显示 否则,系统BUG,需要检查修复 :return: - def test_ShareView...
Implement the Python class `UserViewTest` described below. Class description: Implement the UserViewTest class. Method signatures and docstrings: - def setUp(self): 创建一条用户信息数据 :return: None - def test_CreditListView_get(self): 点击积分之后显示该用户积分详情的单元测试 若返回200状态码,表示可以登陆页面可以正常显示 否则,系统BUG,需要检查修复 :return: - def test_ShareView...
e83b94a44e6188b0c745b61512845c3da5cc9643
<|skeleton|> class UserViewTest: def setUp(self): """创建一条用户信息数据 :return: None""" <|body_0|> def test_CreditListView_get(self): """点击积分之后显示该用户积分详情的单元测试 若返回200状态码,表示可以登陆页面可以正常显示 否则,系统BUG,需要检查修复 :return:""" <|body_1|> def test_ShareView_post(self): """分享商品加积分 :return:...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserViewTest: def setUp(self): """创建一条用户信息数据 :return: None""" UserProfile.objects.create(id=1, password='pbkdf2_sha256$36000$4cg1SAMlOhxd$ONEWDCYTR/kbWBuwpMIo1GUJvMsC+cHZgFUl9YF6KC0=', is_superuser=1, username='cheertt', first_name='cheertt', last_name='油炸皮卡丘', email='1913278504@qq.com', is_st...
the_stack_v2_python_sparse
apps/api/tests_credit.py
TTWen/REProject-RED
train
1
9923f29d3cc88b68ee931e8f9406b423c8e0f587
[ "try:\n article = Articles.objects.get(slug=self.kwargs['slug'])\nexcept Articles.DoesNotExist:\n return Response({'errors': COMMENTS_MSG['ARTICLE_DOES_NOT_EXIST']}, status=status.HTTP_404_NOT_FOUND)\ntry:\n comment = Comment.objects.get(pk=self.kwargs['id'])\n serializer = self.serializer_class(comment...
<|body_start_0|> try: article = Articles.objects.get(slug=self.kwargs['slug']) except Articles.DoesNotExist: return Response({'errors': COMMENTS_MSG['ARTICLE_DOES_NOT_EXIST']}, status=status.HTTP_404_NOT_FOUND) try: comment = Comment.objects.get(pk=self.kwargs...
Handles viewing of a specific comment if not authenticated and Handles replying to a comment on an article if authenticated Handles Deleting a comment from an article
RetrieveUpdateDeleteCommentAPIView
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RetrieveUpdateDeleteCommentAPIView: """Handles viewing of a specific comment if not authenticated and Handles replying to a comment on an article if authenticated Handles Deleting a comment from an article""" def get(self, request, *args, **kwargs): """Handles retrieving a specific c...
stack_v2_sparse_classes_36k_train_012453
7,543
permissive
[ { "docstring": "Handles retrieving a specific comment and all their replies :param request: :param args: :param kwargs: :return:", "name": "get", "signature": "def get(self, request, *args, **kwargs)" }, { "docstring": "Handles updating a comment if author is same as the requester :param request...
3
stack_v2_sparse_classes_30k_test_000712
Implement the Python class `RetrieveUpdateDeleteCommentAPIView` described below. Class description: Handles viewing of a specific comment if not authenticated and Handles replying to a comment on an article if authenticated Handles Deleting a comment from an article Method signatures and docstrings: - def get(self, r...
Implement the Python class `RetrieveUpdateDeleteCommentAPIView` described below. Class description: Handles viewing of a specific comment if not authenticated and Handles replying to a comment on an article if authenticated Handles Deleting a comment from an article Method signatures and docstrings: - def get(self, r...
5a31840856de4b361fe2594dfa7a33d7774d3fe2
<|skeleton|> class RetrieveUpdateDeleteCommentAPIView: """Handles viewing of a specific comment if not authenticated and Handles replying to a comment on an article if authenticated Handles Deleting a comment from an article""" def get(self, request, *args, **kwargs): """Handles retrieving a specific c...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RetrieveUpdateDeleteCommentAPIView: """Handles viewing of a specific comment if not authenticated and Handles replying to a comment on an article if authenticated Handles Deleting a comment from an article""" def get(self, request, *args, **kwargs): """Handles retrieving a specific comment and al...
the_stack_v2_python_sparse
authors/apps/comments/views.py
bl4ck4ndbr0wn/ah-centauri-backend
train
0
de2941373c627b0f71a510aad1ee3b2e8adf99c3
[ "super(Encoder, self).__init__()\nself.input_size = input_size\nself.latent_size = latent_size\nself.class_size = class_size\nself.hidden_dim = 51200\nself.enc_cfg = enc_cfg\nself.cnn1 = nn.Sequential(nn.Conv2d(self.enc_cfg.in_channels, self.enc_cfg.cnn_filters[0], 3), nn.ReLU(), nn.BatchNorm2d(self.enc_cfg.cnn_fil...
<|body_start_0|> super(Encoder, self).__init__() self.input_size = input_size self.latent_size = latent_size self.class_size = class_size self.hidden_dim = 51200 self.enc_cfg = enc_cfg self.cnn1 = nn.Sequential(nn.Conv2d(self.enc_cfg.in_channels, self.enc_cfg.cnn_...
Encoder
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Encoder: def __init__(self, input_size, latent_size, class_size, enc_cfg): """Calculates q(z|x) from the given data input_size : (1, 28, 28) for MNIST dataset enc_cfg : Class object of Encoder Config class""" <|body_0|> def forward(self, x): """forward pass for the e...
stack_v2_sparse_classes_36k_train_012454
4,969
no_license
[ { "docstring": "Calculates q(z|x) from the given data input_size : (1, 28, 28) for MNIST dataset enc_cfg : Class object of Encoder Config class", "name": "__init__", "signature": "def __init__(self, input_size, latent_size, class_size, enc_cfg)" }, { "docstring": "forward pass for the encoder", ...
2
stack_v2_sparse_classes_30k_train_013308
Implement the Python class `Encoder` described below. Class description: Implement the Encoder class. Method signatures and docstrings: - def __init__(self, input_size, latent_size, class_size, enc_cfg): Calculates q(z|x) from the given data input_size : (1, 28, 28) for MNIST dataset enc_cfg : Class object of Encoder...
Implement the Python class `Encoder` described below. Class description: Implement the Encoder class. Method signatures and docstrings: - def __init__(self, input_size, latent_size, class_size, enc_cfg): Calculates q(z|x) from the given data input_size : (1, 28, 28) for MNIST dataset enc_cfg : Class object of Encoder...
b134e4e6b1e6c110fad8cb38b033c92c34d3c8ce
<|skeleton|> class Encoder: def __init__(self, input_size, latent_size, class_size, enc_cfg): """Calculates q(z|x) from the given data input_size : (1, 28, 28) for MNIST dataset enc_cfg : Class object of Encoder Config class""" <|body_0|> def forward(self, x): """forward pass for the e...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Encoder: def __init__(self, input_size, latent_size, class_size, enc_cfg): """Calculates q(z|x) from the given data input_size : (1, 28, 28) for MNIST dataset enc_cfg : Class object of Encoder Config class""" super(Encoder, self).__init__() self.input_size = input_size self.lat...
the_stack_v2_python_sparse
architectures_networks/Adversarial_Autoencoders/model.py
shubham14/Machine_learning_research
train
3
b8a0eec06985c395c47c93b27d8d00f74f186f85
[ "output = []\ndictionary = dict()\nfor i in range(0, 256):\n dictionary[bytes([i])] = i\nnew_codeword_index = 256\nwith open(input_file, 'rb') as f:\n cur = f.read(1)\n while True:\n nex = f.read(1)\n if dictionary.get(cur + nex) is not None:\n cur += nex\n else:\n ...
<|body_start_0|> output = [] dictionary = dict() for i in range(0, 256): dictionary[bytes([i])] = i new_codeword_index = 256 with open(input_file, 'rb') as f: cur = f.read(1) while True: nex = f.read(1) if dictio...
Implements the Lempel–Ziv–Welch algorithm for data compression.
LZW
[ "Unlicense", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LZW: """Implements the Lempel–Ziv–Welch algorithm for data compression.""" def encode(input_file: str) -> List[int]: """Encodes a whole file into a binary file using LZW algorithm.""" <|body_0|> def decode(encoded: List[int]) -> List[str]: """Decodes list of LZW-...
stack_v2_sparse_classes_36k_train_012455
2,169
permissive
[ { "docstring": "Encodes a whole file into a binary file using LZW algorithm.", "name": "encode", "signature": "def encode(input_file: str) -> List[int]" }, { "docstring": "Decodes list of LZW-encoded numbers back to original bytes.", "name": "decode", "signature": "def decode(encoded: Li...
2
stack_v2_sparse_classes_30k_test_001153
Implement the Python class `LZW` described below. Class description: Implements the Lempel–Ziv–Welch algorithm for data compression. Method signatures and docstrings: - def encode(input_file: str) -> List[int]: Encodes a whole file into a binary file using LZW algorithm. - def decode(encoded: List[int]) -> List[str]:...
Implement the Python class `LZW` described below. Class description: Implements the Lempel–Ziv–Welch algorithm for data compression. Method signatures and docstrings: - def encode(input_file: str) -> List[int]: Encodes a whole file into a binary file using LZW algorithm. - def decode(encoded: List[int]) -> List[str]:...
cafc1d42e7e9528b34868b0ed299df1879cb07cd
<|skeleton|> class LZW: """Implements the Lempel–Ziv–Welch algorithm for data compression.""" def encode(input_file: str) -> List[int]: """Encodes a whole file into a binary file using LZW algorithm.""" <|body_0|> def decode(encoded: List[int]) -> List[str]: """Decodes list of LZW-...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LZW: """Implements the Lempel–Ziv–Welch algorithm for data compression.""" def encode(input_file: str) -> List[int]: """Encodes a whole file into a binary file using LZW algorithm.""" output = [] dictionary = dict() for i in range(0, 256): dictionary[bytes([i])...
the_stack_v2_python_sparse
electives/kkd/lab/lista-3/lzw.py
Admaxx/academic-notebook
train
0
6bae48632bfbf0ce680b4fcbc7a4233f9d5a8134
[ "for i in range(len(nums)):\n for j in range(len(nums)):\n if i == j:\n continue\n if nums[i] + nums[j] == target:\n return [i, j]", "lookup = {}\nfor idx, num in enumerate(nums):\n if target - num in lookup:\n return [lookup[target - num], idx]\n lookup[num] = ...
<|body_start_0|> for i in range(len(nums)): for j in range(len(nums)): if i == j: continue if nums[i] + nums[j] == target: return [i, j] <|end_body_0|> <|body_start_1|> lookup = {} for idx, num in enumerate(nums...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def twoSum(self, nums, target): """Time: N^2 Space 1 :type nums: List[int] :type target: int :rtype: List[int]""" <|body_0|> def twoSum2(self, nums, target): """Time: N Space: N :type nums: List[int] :type target: int :rtype: List[int]""" <|body_1|>...
stack_v2_sparse_classes_36k_train_012456
910
permissive
[ { "docstring": "Time: N^2 Space 1 :type nums: List[int] :type target: int :rtype: List[int]", "name": "twoSum", "signature": "def twoSum(self, nums, target)" }, { "docstring": "Time: N Space: N :type nums: List[int] :type target: int :rtype: List[int]", "name": "twoSum2", "signature": "d...
2
stack_v2_sparse_classes_30k_train_016040
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def twoSum(self, nums, target): Time: N^2 Space 1 :type nums: List[int] :type target: int :rtype: List[int] - def twoSum2(self, nums, target): Time: N Space: N :type nums: List[i...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def twoSum(self, nums, target): Time: N^2 Space 1 :type nums: List[int] :type target: int :rtype: List[int] - def twoSum2(self, nums, target): Time: N Space: N :type nums: List[i...
d2ffcccede5d1543aea48f18a39cdbd3d83e3ed8
<|skeleton|> class Solution: def twoSum(self, nums, target): """Time: N^2 Space 1 :type nums: List[int] :type target: int :rtype: List[int]""" <|body_0|> def twoSum2(self, nums, target): """Time: N Space: N :type nums: List[int] :type target: int :rtype: List[int]""" <|body_1|>...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def twoSum(self, nums, target): """Time: N^2 Space 1 :type nums: List[int] :type target: int :rtype: List[int]""" for i in range(len(nums)): for j in range(len(nums)): if i == j: continue if nums[i] + nums[j] == target: ...
the_stack_v2_python_sparse
arrays/2sum.py
kandarpck/leetcode
train
0
46f324c5e26717807963c5ebe1bd34e28eacbc0e
[ "game_class = GameClass.objects.all()\nserializer = GameClassListSerializer(game_class, many=True)\nreturn Response(serializer.data)", "queryset = GameClass.objects.all()\ngame_class = get_object_or_404(queryset, pk=pk)\nserializer = GameClassSerializer(game_class)\nreturn Response(serializer.data)" ]
<|body_start_0|> game_class = GameClass.objects.all() serializer = GameClassListSerializer(game_class, many=True) return Response(serializer.data) <|end_body_0|> <|body_start_1|> queryset = GameClass.objects.all() game_class = get_object_or_404(queryset, pk=pk) serialize...
GameClassView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GameClassView: def list(self, request): """Получение списка классов""" <|body_0|> def retrieve(self, request, pk=None): """Получение класса по идентификатору pk - идентификатор класса""" <|body_1|> <|end_skeleton|> <|body_start_0|> game_class = Game...
stack_v2_sparse_classes_36k_train_012457
12,404
no_license
[ { "docstring": "Получение списка классов", "name": "list", "signature": "def list(self, request)" }, { "docstring": "Получение класса по идентификатору pk - идентификатор класса", "name": "retrieve", "signature": "def retrieve(self, request, pk=None)" } ]
2
stack_v2_sparse_classes_30k_train_001126
Implement the Python class `GameClassView` described below. Class description: Implement the GameClassView class. Method signatures and docstrings: - def list(self, request): Получение списка классов - def retrieve(self, request, pk=None): Получение класса по идентификатору pk - идентификатор класса
Implement the Python class `GameClassView` described below. Class description: Implement the GameClassView class. Method signatures and docstrings: - def list(self, request): Получение списка классов - def retrieve(self, request, pk=None): Получение класса по идентификатору pk - идентификатор класса <|skeleton|> cla...
be47a0a6f50bf8680b22e0b9cae3e3b34a198a3d
<|skeleton|> class GameClassView: def list(self, request): """Получение списка классов""" <|body_0|> def retrieve(self, request, pk=None): """Получение класса по идентификатору pk - идентификатор класса""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GameClassView: def list(self, request): """Получение списка классов""" game_class = GameClass.objects.all() serializer = GameClassListSerializer(game_class, many=True) return Response(serializer.data) def retrieve(self, request, pk=None): """Получение класса по иде...
the_stack_v2_python_sparse
StarfinderBack/starfinder/views.py
Skirgus/StarfinderMasterAssistant
train
0
f33dd088b2f7f3fe2b3635e3733ea0f8fe2572dd
[ "geo_api = GeoNamesAPI()\nresults = geo_api.search(self.q, max_rows=50)\nreturn JsonResponse({'results': [dict(id=geo_api.uri_from_id(item['geonameId']), text=self.get_label(item), name=item['name'], lat=item['lat'], lng=item['lng']) for item in results]})", "if 'countryName' in item:\n return '%(name)s, %(cou...
<|body_start_0|> geo_api = GeoNamesAPI() results = geo_api.search(self.q, max_rows=50) return JsonResponse({'results': [dict(id=geo_api.uri_from_id(item['geonameId']), text=self.get_label(item), name=item['name'], lat=item['lat'], lng=item['lng']) for item in results]}) <|end_body_0|> <|body_st...
GeoNames ajax lookup for use as autocomplete. Currently restricted to staff only.
GeonamesLookup
[ "Apache-2.0", "LicenseRef-scancode-free-unknown" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GeonamesLookup: """GeoNames ajax lookup for use as autocomplete. Currently restricted to staff only.""" def get(self, request, *args, **kwargs): """Return option list json response.""" <|body_0|> def get_label(self, item): """Display country name as part of label...
stack_v2_sparse_classes_36k_train_012458
1,477
permissive
[ { "docstring": "Return option list json response.", "name": "get", "signature": "def get(self, request, *args, **kwargs)" }, { "docstring": "Display country name as part of label for context.", "name": "get_label", "signature": "def get_label(self, item)" } ]
2
stack_v2_sparse_classes_30k_test_000062
Implement the Python class `GeonamesLookup` described below. Class description: GeoNames ajax lookup for use as autocomplete. Currently restricted to staff only. Method signatures and docstrings: - def get(self, request, *args, **kwargs): Return option list json response. - def get_label(self, item): Display country ...
Implement the Python class `GeonamesLookup` described below. Class description: GeoNames ajax lookup for use as autocomplete. Currently restricted to staff only. Method signatures and docstrings: - def get(self, request, *args, **kwargs): Return option list json response. - def get_label(self, item): Display country ...
6371bb1266d7751af59aeaa3426ef7ac02a1fe17
<|skeleton|> class GeonamesLookup: """GeoNames ajax lookup for use as autocomplete. Currently restricted to staff only.""" def get(self, request, *args, **kwargs): """Return option list json response.""" <|body_0|> def get_label(self, item): """Display country name as part of label...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GeonamesLookup: """GeoNames ajax lookup for use as autocomplete. Currently restricted to staff only.""" def get(self, request, *args, **kwargs): """Return option list json response.""" geo_api = GeoNamesAPI() results = geo_api.search(self.q, max_rows=50) return JsonRespons...
the_stack_v2_python_sparse
derrida/places/views.py
Princeton-CDH/derrida-django
train
13
63831f277af565015f8eca88da88fe3fb34e7875
[ "Problem.__init__(self, **kwargs)\nself.spacecraft = Spacecraft(**spacecraft_prm)\nself.cr3bp = Cr3bp(Primary.EARTH, Primary.MOON)\nself.cr3bp_dyna = Cr3bpDynamics(self.cr3bp, Cr3bpDynamics.Eqm.dimensions6)\nself.set_problem_values()", "if expl_int == False:\n dynamics = np.ndarray((states.shape[0], states.sha...
<|body_start_0|> Problem.__init__(self, **kwargs) self.spacecraft = Spacecraft(**spacecraft_prm) self.cr3bp = Cr3bp(Primary.EARTH, Primary.MOON) self.cr3bp_dyna = Cr3bpDynamics(self.cr3bp, Cr3bpDynamics.Eqm.dimensions6) self.set_problem_values() <|end_body_0|> <|body_start_1|> ...
`Mission` class manages the general frame common to every transfers in the cis-lunar environment. It instantiates the `spacecraft`, `cr3bp` objects and the dynamic of the environment. Inherits from the `Problem` class. Parameters ---------- spacecraft_prm : dict Spacecraft parameters dictionnary Attributs --------- spa...
Mission
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Mission: """`Mission` class manages the general frame common to every transfers in the cis-lunar environment. It instantiates the `spacecraft`, `cr3bp` objects and the dynamic of the environment. Inherits from the `Problem` class. Parameters ---------- spacecraft_prm : dict Spacecraft parameters ...
stack_v2_sparse_classes_36k_train_012459
3,634
no_license
[ { "docstring": "Initialization of the `Mission` class", "name": "__init__", "signature": "def __init__(self, spacecraft_prm, **kwargs)" }, { "docstring": "Sets the dynamics equations in the cr3bp frame (synodic ref.), common for both LLO and NRHO missions", "name": "dynamics", "signature...
3
null
Implement the Python class `Mission` described below. Class description: `Mission` class manages the general frame common to every transfers in the cis-lunar environment. It instantiates the `spacecraft`, `cr3bp` objects and the dynamic of the environment. Inherits from the `Problem` class. Parameters ---------- space...
Implement the Python class `Mission` described below. Class description: `Mission` class manages the general frame common to every transfers in the cis-lunar environment. It instantiates the `spacecraft`, `cr3bp` objects and the dynamic of the environment. Inherits from the `Problem` class. Parameters ---------- space...
9d4b1809e868aec674d6bf3c48958b23418290e7
<|skeleton|> class Mission: """`Mission` class manages the general frame common to every transfers in the cis-lunar environment. It instantiates the `spacecraft`, `cr3bp` objects and the dynamic of the environment. Inherits from the `Problem` class. Parameters ---------- spacecraft_prm : dict Spacecraft parameters ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Mission: """`Mission` class manages the general frame common to every transfers in the cis-lunar environment. It instantiates the `spacecraft`, `cr3bp` objects and the dynamic of the environment. Inherits from the `Problem` class. Parameters ---------- spacecraft_prm : dict Spacecraft parameters dictionnary A...
the_stack_v2_python_sparse
collocation/GL_V/spacecraft_trajectories/mission.py
TomSemblanet/Asteroid-Retrieval-Mission
train
1
80c06ecb77350f2e76c41e0aadd085b1db15039a
[ "p = generate_large_prime(digit)\nq = generate_large_prime(digit)\nn = p * q\nperiod = (p - 1) * (q - 1)\nwhile True:\n e = randint(1, n - 1)\n if gcd(period, e) == 1:\n break\nd = multiplicative_inverse(period, e)\nreturn (RSA_public_key(n, e), RSA_private_key(n, d))", "if isinstance(public_key, RSA...
<|body_start_0|> p = generate_large_prime(digit) q = generate_large_prime(digit) n = p * q period = (p - 1) * (q - 1) while True: e = randint(1, n - 1) if gcd(period, e) == 1: break d = multiplicative_inverse(period, e) retu...
RSA encryption/decryption algorithm
RSA_protocol
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RSA_protocol: """RSA encryption/decryption algorithm""" def generate_keys(cls, digit): """Generate public and private keys. The length of each number is roughly twice the value of 'digit'""" <|body_0|> def encrypt(cls, message, public_key): """Encode plain text i...
stack_v2_sparse_classes_36k_train_012460
1,793
no_license
[ { "docstring": "Generate public and private keys. The length of each number is roughly twice the value of 'digit'", "name": "generate_keys", "signature": "def generate_keys(cls, digit)" }, { "docstring": "Encode plain text into cipher text", "name": "encrypt", "signature": "def encrypt(c...
3
stack_v2_sparse_classes_30k_train_013101
Implement the Python class `RSA_protocol` described below. Class description: RSA encryption/decryption algorithm Method signatures and docstrings: - def generate_keys(cls, digit): Generate public and private keys. The length of each number is roughly twice the value of 'digit' - def encrypt(cls, message, public_key)...
Implement the Python class `RSA_protocol` described below. Class description: RSA encryption/decryption algorithm Method signatures and docstrings: - def generate_keys(cls, digit): Generate public and private keys. The length of each number is roughly twice the value of 'digit' - def encrypt(cls, message, public_key)...
d2ff1f7d7988e8408b02b123e867d83f4bdc01de
<|skeleton|> class RSA_protocol: """RSA encryption/decryption algorithm""" def generate_keys(cls, digit): """Generate public and private keys. The length of each number is roughly twice the value of 'digit'""" <|body_0|> def encrypt(cls, message, public_key): """Encode plain text i...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RSA_protocol: """RSA encryption/decryption algorithm""" def generate_keys(cls, digit): """Generate public and private keys. The length of each number is roughly twice the value of 'digit'""" p = generate_large_prime(digit) q = generate_large_prime(digit) n = p * q ...
the_stack_v2_python_sparse
code/RSA.py
gkmjack/number-theory-gadgets
train
0
c101e70effa34fdee627956d2f097860942afce5
[ "self.cold_file_window = cold_file_window\nself.delete_orphan_data = delete_orphan_data\nself.file_path_filter = file_path_filter\nself.file_selection_policy = file_selection_policy\nself.file_size_bytes = file_size_bytes\nself.file_size_policy = file_size_policy\nself.migrate_without_stub = migrate_without_stub\ns...
<|body_start_0|> self.cold_file_window = cold_file_window self.delete_orphan_data = delete_orphan_data self.file_path_filter = file_path_filter self.file_selection_policy = file_selection_policy self.file_size_bytes = file_size_bytes self.file_size_policy = file_size_poli...
Implementation of the 'DataMigrationJobParameters' model. Specifies parameters applicable for data migration jobs in NAS environment. Attributes: cold_file_window (long|int): Identifies the cold files in the NAS source. Files that haven't been accessed/modified in the last cold_file_window are migrated. delete_orphan_d...
DataMigrationJobParameters
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataMigrationJobParameters: """Implementation of the 'DataMigrationJobParameters' model. Specifies parameters applicable for data migration jobs in NAS environment. Attributes: cold_file_window (long|int): Identifies the cold files in the NAS source. Files that haven't been accessed/modified in t...
stack_v2_sparse_classes_36k_train_012461
5,852
permissive
[ { "docstring": "Constructor for the DataMigrationJobParameters class", "name": "__init__", "signature": "def __init__(self, cold_file_window=None, delete_orphan_data=None, file_path_filter=None, file_selection_policy=None, file_size_bytes=None, file_size_policy=None, migrate_without_stub=None, nfs_mount...
2
null
Implement the Python class `DataMigrationJobParameters` described below. Class description: Implementation of the 'DataMigrationJobParameters' model. Specifies parameters applicable for data migration jobs in NAS environment. Attributes: cold_file_window (long|int): Identifies the cold files in the NAS source. Files t...
Implement the Python class `DataMigrationJobParameters` described below. Class description: Implementation of the 'DataMigrationJobParameters' model. Specifies parameters applicable for data migration jobs in NAS environment. Attributes: cold_file_window (long|int): Identifies the cold files in the NAS source. Files t...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class DataMigrationJobParameters: """Implementation of the 'DataMigrationJobParameters' model. Specifies parameters applicable for data migration jobs in NAS environment. Attributes: cold_file_window (long|int): Identifies the cold files in the NAS source. Files that haven't been accessed/modified in t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DataMigrationJobParameters: """Implementation of the 'DataMigrationJobParameters' model. Specifies parameters applicable for data migration jobs in NAS environment. Attributes: cold_file_window (long|int): Identifies the cold files in the NAS source. Files that haven't been accessed/modified in the last cold_...
the_stack_v2_python_sparse
cohesity_management_sdk/models/data_migration_job_parameters.py
cohesity/management-sdk-python
train
24
33f01f6a41f63f4a22c9c3457d71ed2d44853e5e
[ "super(InTimeToArrivalToVehicle, self).__init__(name)\nself.logger.debug('%s.__init__()' % self.__class__.__name__)\nself._other_actor = other_actor\nself._actor = actor\nself._time = time", "new_status = py_trees.common.Status.RUNNING\ncurrent_location = CarlaDataProvider.get_location(self._actor)\ntarget_locati...
<|body_start_0|> super(InTimeToArrivalToVehicle, self).__init__(name) self.logger.debug('%s.__init__()' % self.__class__.__name__) self._other_actor = other_actor self._actor = actor self._time = time <|end_body_0|> <|body_start_1|> new_status = py_trees.common.Status.RU...
This class contains a check if a actor arrives within a given time at another actor.
InTimeToArrivalToVehicle
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InTimeToArrivalToVehicle: """This class contains a check if a actor arrives within a given time at another actor.""" def __init__(self, other_actor, actor, time, name='TimeToArrival'): """Setup parameters""" <|body_0|> def update(self): """Check if the ego vehicl...
stack_v2_sparse_classes_36k_train_012462
25,380
permissive
[ { "docstring": "Setup parameters", "name": "__init__", "signature": "def __init__(self, other_actor, actor, time, name='TimeToArrival')" }, { "docstring": "Check if the ego vehicle can arrive at other actor within time", "name": "update", "signature": "def update(self)" } ]
2
stack_v2_sparse_classes_30k_train_007049
Implement the Python class `InTimeToArrivalToVehicle` described below. Class description: This class contains a check if a actor arrives within a given time at another actor. Method signatures and docstrings: - def __init__(self, other_actor, actor, time, name='TimeToArrival'): Setup parameters - def update(self): Ch...
Implement the Python class `InTimeToArrivalToVehicle` described below. Class description: This class contains a check if a actor arrives within a given time at another actor. Method signatures and docstrings: - def __init__(self, other_actor, actor, time, name='TimeToArrival'): Setup parameters - def update(self): Ch...
1d3e8339f8e60f7bdcaefeff49ec238b1746b047
<|skeleton|> class InTimeToArrivalToVehicle: """This class contains a check if a actor arrives within a given time at another actor.""" def __init__(self, other_actor, actor, time, name='TimeToArrival'): """Setup parameters""" <|body_0|> def update(self): """Check if the ego vehicl...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class InTimeToArrivalToVehicle: """This class contains a check if a actor arrives within a given time at another actor.""" def __init__(self, other_actor, actor, time, name='TimeToArrival'): """Setup parameters""" super(InTimeToArrivalToVehicle, self).__init__(name) self.logger.debug('%...
the_stack_v2_python_sparse
srunner/scenariomanager/atomic_scenario_behavior.py
chauvinSimon/scenario_runner
train
2
d3c783e522474a2909db83b3b734cc9b4b2c54f2
[ "self.fragments = {}\nself.rootFragments = []\nself.nextTxnId = 0", "resumeFragment = TxnFragment(txn, resumeId=linkId)\nresumeKey = ResumeKey(linkId)\nresumeFragments = self.fragments.get(resumeKey, None)\nif not resumeFragments:\n resumeFragments = []\n self.fragments.update({resumeKey: resumeFragments})\...
<|body_start_0|> self.fragments = {} self.rootFragments = [] self.nextTxnId = 0 <|end_body_0|> <|body_start_1|> resumeFragment = TxnFragment(txn, resumeId=linkId) resumeKey = ResumeKey(linkId) resumeFragments = self.fragments.get(resumeKey, None) if not resumeFra...
A collection of suspending and resuming transaction fragemnts
TxnFragments
[ "MIT", "BSD-3-Clause", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TxnFragments: """A collection of suspending and resuming transaction fragemnts""" def __init__(self): """Constructs an instance of transaction fragment collection""" <|body_0|> def addResumeFragment(self, linkId, txn): """Adds a resuming transaction fragment to t...
stack_v2_sparse_classes_36k_train_012463
4,916
permissive
[ { "docstring": "Constructs an instance of transaction fragment collection", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Adds a resuming transaction fragment to the collection. Resuming fragments lookup for the previous suspended fragement to form a link :param linkId...
5
null
Implement the Python class `TxnFragments` described below. Class description: A collection of suspending and resuming transaction fragemnts Method signatures and docstrings: - def __init__(self): Constructs an instance of transaction fragment collection - def addResumeFragment(self, linkId, txn): Adds a resuming tran...
Implement the Python class `TxnFragments` described below. Class description: A collection of suspending and resuming transaction fragemnts Method signatures and docstrings: - def __init__(self): Constructs an instance of transaction fragment collection - def addResumeFragment(self, linkId, txn): Adds a resuming tran...
d6b67e98d4b640c98499a373425f1f009e5b9061
<|skeleton|> class TxnFragments: """A collection of suspending and resuming transaction fragemnts""" def __init__(self): """Constructs an instance of transaction fragment collection""" <|body_0|> def addResumeFragment(self, linkId, txn): """Adds a resuming transaction fragment to t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TxnFragments: """A collection of suspending and resuming transaction fragemnts""" def __init__(self): """Constructs an instance of transaction fragment collection""" self.fragments = {} self.rootFragments = [] self.nextTxnId = 0 def addResumeFragment(self, linkId, txn...
the_stack_v2_python_sparse
scripts/lib/xpedite/txn/fragments.py
dendisuhubdy/Xpedite
train
1
100ea3c93eb565581eae6cc268641b63bd776f46
[ "self.data = {}\nself.file_txt = '\\n'.join((i for i in self.file_txt.split('\\n') if i))\nself.get_sects()\nfor sect in self.sect_txt:\n self.data[sect] = {}\n for line in self.sect_txt[sect]:\n splitter = line.split('=')\n vals = '='.join(splitter[1:]).strip().split()\n if len(vals) == ...
<|body_start_0|> self.data = {} self.file_txt = '\n'.join((i for i in self.file_txt.split('\n') if i)) self.get_sects() for sect in self.sect_txt: self.data[sect] = {} for line in self.sect_txt[sect]: splitter = line.split('=') vals...
Will parse the parameter files. A parameter file takes the form: SECTION: param1 = var1 var2 ... varN . . . One can specify any number (greater than 1) of sections and params and vars.
Params
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Params: """Will parse the parameter files. A parameter file takes the form: SECTION: param1 = var1 var2 ... varN . . . One can specify any number (greater than 1) of sections and params and vars.""" def _parse_(self): """Will parse the file""" <|body_0|> def get_sects(se...
stack_v2_sparse_classes_36k_train_012464
2,357
no_license
[ { "docstring": "Will parse the file", "name": "_parse_", "signature": "def _parse_(self)" }, { "docstring": "Will get the sections and store the raw txt in self.data Outputs: <dict> self.sect_txt => Keys are sections, vals are txt split by", "name": "get_sects", "signature": "def get_sec...
2
null
Implement the Python class `Params` described below. Class description: Will parse the parameter files. A parameter file takes the form: SECTION: param1 = var1 var2 ... varN . . . One can specify any number (greater than 1) of sections and params and vars. Method signatures and docstrings: - def _parse_(self): Will p...
Implement the Python class `Params` described below. Class description: Will parse the parameter files. A parameter file takes the form: SECTION: param1 = var1 var2 ... varN . . . One can specify any number (greater than 1) of sections and params and vars. Method signatures and docstrings: - def _parse_(self): Will p...
1c7225968f7eab9ae6c9cb48c53d6d54cf0040a2
<|skeleton|> class Params: """Will parse the parameter files. A parameter file takes the form: SECTION: param1 = var1 var2 ... varN . . . One can specify any number (greater than 1) of sections and params and vars.""" def _parse_(self): """Will parse the file""" <|body_0|> def get_sects(se...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Params: """Will parse the parameter files. A parameter file takes the form: SECTION: param1 = var1 var2 ... varN . . . One can specify any number (greater than 1) of sections and params and vars.""" def _parse_(self): """Will parse the file""" self.data = {} self.file_txt = '\n'.j...
the_stack_v2_python_sparse
src/io_utils/param_files.py
Roolthasiva/MD_Analysis_Scripts
train
0
e9c32f36a1365b4dfbe8c593f8d51cfe54fcedf0
[ "if widget.currentIndex() == -1:\n return None\nelse:\n return widget.itemData(widget.currentIndex())", "try:\n idx = _find_combo_data(widget, value)\nexcept ValueError:\n if value is None:\n idx = -1\n else:\n raise ValueError(\"Cannot find data '{0}' in combo box\".format(value))\nw...
<|body_start_0|> if widget.currentIndex() == -1: return None else: return widget.itemData(widget.currentIndex()) <|end_body_0|> <|body_start_1|> try: idx = _find_combo_data(widget, value) except ValueError: if value is None: ...
Wrapper around the data in QComboBox.
CurrentComboDataProperty
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CurrentComboDataProperty: """Wrapper around the data in QComboBox.""" def getter(self, widget): """Return the itemData stored in the currently-selected item""" <|body_0|> def setter(self, widget, value): """Update the currently selected item to the one which stor...
stack_v2_sparse_classes_36k_train_012465
8,602
permissive
[ { "docstring": "Return the itemData stored in the currently-selected item", "name": "getter", "signature": "def getter(self, widget)" }, { "docstring": "Update the currently selected item to the one which stores value in its itemData", "name": "setter", "signature": "def setter(self, wid...
2
null
Implement the Python class `CurrentComboDataProperty` described below. Class description: Wrapper around the data in QComboBox. Method signatures and docstrings: - def getter(self, widget): Return the itemData stored in the currently-selected item - def setter(self, widget, value): Update the currently selected item ...
Implement the Python class `CurrentComboDataProperty` described below. Class description: Wrapper around the data in QComboBox. Method signatures and docstrings: - def getter(self, widget): Return the itemData stored in the currently-selected item - def setter(self, widget, value): Update the currently selected item ...
4aa8c64a6f65629207e40df9963232473a24c9f6
<|skeleton|> class CurrentComboDataProperty: """Wrapper around the data in QComboBox.""" def getter(self, widget): """Return the itemData stored in the currently-selected item""" <|body_0|> def setter(self, widget, value): """Update the currently selected item to the one which stor...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CurrentComboDataProperty: """Wrapper around the data in QComboBox.""" def getter(self, widget): """Return the itemData stored in the currently-selected item""" if widget.currentIndex() == -1: return None else: return widget.itemData(widget.currentIndex()) ...
the_stack_v2_python_sparse
glue/utils/qt/widget_properties.py
astrofrog/glue
train
3
bfb845418a9379f70e7cbf933e4b5124f6858b49
[ "image = tf.zeros((224, 224, 3), dtype=tf.uint8)\naug_image = autoaugment.distort_image_with_autoaugment(image, 'v0')\nself.assertEqual((224, 224, 3), aug_image.shape)", "num_layers = 2\nmagnitude = 15\nimage = tf.zeros((224, 224, 3), dtype=tf.uint8)\naug_image = autoaugment.distort_image_with_randaugment(image, ...
<|body_start_0|> image = tf.zeros((224, 224, 3), dtype=tf.uint8) aug_image = autoaugment.distort_image_with_autoaugment(image, 'v0') self.assertEqual((224, 224, 3), aug_image.shape) <|end_body_0|> <|body_start_1|> num_layers = 2 magnitude = 15 image = tf.zeros((224, 224,...
AutoaugmentTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AutoaugmentTest: def test_autoaugment(self): """Smoke test to be sure no syntax errors.""" <|body_0|> def test_randaug(self): """Smoke test to be sure no syntax errors.""" <|body_1|> <|end_skeleton|> <|body_start_0|> image = tf.zeros((224, 224, 3), ...
stack_v2_sparse_classes_36k_train_012466
1,429
permissive
[ { "docstring": "Smoke test to be sure no syntax errors.", "name": "test_autoaugment", "signature": "def test_autoaugment(self)" }, { "docstring": "Smoke test to be sure no syntax errors.", "name": "test_randaug", "signature": "def test_randaug(self)" } ]
2
null
Implement the Python class `AutoaugmentTest` described below. Class description: Implement the AutoaugmentTest class. Method signatures and docstrings: - def test_autoaugment(self): Smoke test to be sure no syntax errors. - def test_randaug(self): Smoke test to be sure no syntax errors.
Implement the Python class `AutoaugmentTest` described below. Class description: Implement the AutoaugmentTest class. Method signatures and docstrings: - def test_autoaugment(self): Smoke test to be sure no syntax errors. - def test_randaug(self): Smoke test to be sure no syntax errors. <|skeleton|> class Autoaugmen...
c7392f2bab3165244d1c565b66409fa11fa82367
<|skeleton|> class AutoaugmentTest: def test_autoaugment(self): """Smoke test to be sure no syntax errors.""" <|body_0|> def test_randaug(self): """Smoke test to be sure no syntax errors.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AutoaugmentTest: def test_autoaugment(self): """Smoke test to be sure no syntax errors.""" image = tf.zeros((224, 224, 3), dtype=tf.uint8) aug_image = autoaugment.distort_image_with_autoaugment(image, 'v0') self.assertEqual((224, 224, 3), aug_image.shape) def test_randaug(...
the_stack_v2_python_sparse
efficientnetv2/autoaugment_test.py
google/automl
train
6,415
6020acf1143a12164983ea1e03fd1c2d2c0b8430
[ "try:\n verify_token(request.headers)\nexcept Exception as err:\n ns.abort(401, message=err)\noffset = request.args.get('offset', '0')\nlimit = request.args.get('limit', '10')\norder_by = request.args.get('order_by', 'id')\norder = request.args.get('order', 'ASC')\nper_page = request.args.get('per_page', '10'...
<|body_start_0|> try: verify_token(request.headers) except Exception as err: ns.abort(401, message=err) offset = request.args.get('offset', '0') limit = request.args.get('limit', '10') order_by = request.args.get('order_by', 'id') order = request.a...
ProgramaSocialList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ProgramaSocialList: def get(self): """Listado de programas sociales. On Success it returns two custom headers: X-SOA-Total-Items, X-SOA-Total-Pages""" <|body_0|> def post(self): """Crear un programa social""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_012467
6,332
no_license
[ { "docstring": "Listado de programas sociales. On Success it returns two custom headers: X-SOA-Total-Items, X-SOA-Total-Pages", "name": "get", "signature": "def get(self)" }, { "docstring": "Crear un programa social", "name": "post", "signature": "def post(self)" } ]
2
stack_v2_sparse_classes_30k_train_010289
Implement the Python class `ProgramaSocialList` described below. Class description: Implement the ProgramaSocialList class. Method signatures and docstrings: - def get(self): Listado de programas sociales. On Success it returns two custom headers: X-SOA-Total-Items, X-SOA-Total-Pages - def post(self): Crear un progra...
Implement the Python class `ProgramaSocialList` described below. Class description: Implement the ProgramaSocialList class. Method signatures and docstrings: - def get(self): Listado de programas sociales. On Success it returns two custom headers: X-SOA-Total-Items, X-SOA-Total-Pages - def post(self): Crear un progra...
e00610fac26ef3ca078fd037c0649b70fa0e9a09
<|skeleton|> class ProgramaSocialList: def get(self): """Listado de programas sociales. On Success it returns two custom headers: X-SOA-Total-Items, X-SOA-Total-Pages""" <|body_0|> def post(self): """Crear un programa social""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ProgramaSocialList: def get(self): """Listado de programas sociales. On Success it returns two custom headers: X-SOA-Total-Items, X-SOA-Total-Pages""" try: verify_token(request.headers) except Exception as err: ns.abort(401, message=err) offset = request...
the_stack_v2_python_sparse
DOS/soa/service/genl/endpoints/programas_sociales.py
Telematica/knight-rider
train
1
805089ae03c6d915df67daecc8f7b52d656943e3
[ "current_user = self.authenticate_user()\nif not post_id:\n self.render('post.html', error='No post id provided')\nelse:\n post = Post.get_by_id(long(post_id))\n if not post:\n self.render('post404.html')\n else:\n user = User.get_by_id(post.user.id())\n comments = Comment.query().f...
<|body_start_0|> current_user = self.authenticate_user() if not post_id: self.render('post.html', error='No post id provided') else: post = Post.get_by_id(long(post_id)) if not post: self.render('post404.html') else: ...
Displays the content of a blog post
PostPage
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PostPage: """Displays the content of a blog post""" def get(self, post_id): """Renders the post.html template with the requested post""" <|body_0|> def post(self, post_id): """Handles the post request from the post page. This is the comment submission.""" ...
stack_v2_sparse_classes_36k_train_012468
2,574
no_license
[ { "docstring": "Renders the post.html template with the requested post", "name": "get", "signature": "def get(self, post_id)" }, { "docstring": "Handles the post request from the post page. This is the comment submission.", "name": "post", "signature": "def post(self, post_id)" } ]
2
stack_v2_sparse_classes_30k_train_014145
Implement the Python class `PostPage` described below. Class description: Displays the content of a blog post Method signatures and docstrings: - def get(self, post_id): Renders the post.html template with the requested post - def post(self, post_id): Handles the post request from the post page. This is the comment s...
Implement the Python class `PostPage` described below. Class description: Displays the content of a blog post Method signatures and docstrings: - def get(self, post_id): Renders the post.html template with the requested post - def post(self, post_id): Handles the post request from the post page. This is the comment s...
c8f4d16938304a1acaec86862de48cda01436720
<|skeleton|> class PostPage: """Displays the content of a blog post""" def get(self, post_id): """Renders the post.html template with the requested post""" <|body_0|> def post(self, post_id): """Handles the post request from the post page. This is the comment submission.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PostPage: """Displays the content of a blog post""" def get(self, post_id): """Renders the post.html template with the requested post""" current_user = self.authenticate_user() if not post_id: self.render('post.html', error='No post id provided') else: ...
the_stack_v2_python_sparse
AppEngine/Blog_Project/pages/PostPage.py
JCherryhomes/Udacity
train
0
de83eef9e945a68a360bb99b2522bfa6d7fe2c49
[ "formula = Formula.objects.filter(id=id).first()\nif not formula:\n return BackstageHTTPResponse(code=BackstageHTTPResponse.API_HTTP_CODE_NOT_FOUND).to_response()\nserializer = FormulaSerializer(formula)\nreturn BackstageHTTPResponse(code=BackstageHTTPResponse.API_HTTP_CODE_NORMAL, data=serializer.data).to_respo...
<|body_start_0|> formula = Formula.objects.filter(id=id).first() if not formula: return BackstageHTTPResponse(code=BackstageHTTPResponse.API_HTTP_CODE_NOT_FOUND).to_response() serializer = FormulaSerializer(formula) return BackstageHTTPResponse(code=BackstageHTTPResponse.API_...
FormulasDetailAPI
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FormulasDetailAPI: def get(self, request, id): """公式详情 --- parameters: - name: id description: 公式id type: integer paramType: path required: true""" <|body_0|> def patch(self, request, id): """公式详情 --- parameters: - name: id description: 公式id type: integer paramType: ...
stack_v2_sparse_classes_36k_train_012469
8,968
no_license
[ { "docstring": "公式详情 --- parameters: - name: id description: 公式id type: integer paramType: path required: true", "name": "get", "signature": "def get(self, request, id)" }, { "docstring": "公式详情 --- parameters: - name: id description: 公式id type: integer paramType: path required: true - name: form...
2
null
Implement the Python class `FormulasDetailAPI` described below. Class description: Implement the FormulasDetailAPI class. Method signatures and docstrings: - def get(self, request, id): 公式详情 --- parameters: - name: id description: 公式id type: integer paramType: path required: true - def patch(self, request, id): 公式详情 ...
Implement the Python class `FormulasDetailAPI` described below. Class description: Implement the FormulasDetailAPI class. Method signatures and docstrings: - def get(self, request, id): 公式详情 --- parameters: - name: id description: 公式id type: integer paramType: path required: true - def patch(self, request, id): 公式详情 ...
c50def8cde58fd4663032b860eb058302cbac6da
<|skeleton|> class FormulasDetailAPI: def get(self, request, id): """公式详情 --- parameters: - name: id description: 公式id type: integer paramType: path required: true""" <|body_0|> def patch(self, request, id): """公式详情 --- parameters: - name: id description: 公式id type: integer paramType: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FormulasDetailAPI: def get(self, request, id): """公式详情 --- parameters: - name: id description: 公式id type: integer paramType: path required: true""" formula = Formula.objects.filter(id=id).first() if not formula: return BackstageHTTPResponse(code=BackstageHTTPResponse.API_HT...
the_stack_v2_python_sparse
src/api/formulas/views.py
fan1018wen/Alpha
train
0
61f0d8573d7f88a1d0e9de91def9a8c9adaeecf3
[ "self.screen_width = 1200\nself.screen_height = 800\nself.bg_color = (230, 230, 230)\nself.bullet_width = 15\nself.bullet_height = 3\nself.bullet_color = (60, 60, 60)\nself.bullets_limit = 3\nself.speedup_scale = 1.1\nself.initialize_dynamic_settings()", "self.ship_speed_factor = 1.5\nself.bullet_speed_factor = 5...
<|body_start_0|> self.screen_width = 1200 self.screen_height = 800 self.bg_color = (230, 230, 230) self.bullet_width = 15 self.bullet_height = 3 self.bullet_color = (60, 60, 60) self.bullets_limit = 3 self.speedup_scale = 1.1 self.initialize_dynami...
存储游戏中的所有设置的类
Settings
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Settings: """存储游戏中的所有设置的类""" def __init__(self): """初始化游戏的设置""" <|body_0|> def initialize_dynamic_settings(self): """初始化随游戏进行而变化的设置""" <|body_1|> def increase_speed(self): """提高速度设置""" <|body_2|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_012470
1,233
no_license
[ { "docstring": "初始化游戏的设置", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "初始化随游戏进行而变化的设置", "name": "initialize_dynamic_settings", "signature": "def initialize_dynamic_settings(self)" }, { "docstring": "提高速度设置", "name": "increase_speed", "signatur...
3
stack_v2_sparse_classes_30k_train_005419
Implement the Python class `Settings` described below. Class description: 存储游戏中的所有设置的类 Method signatures and docstrings: - def __init__(self): 初始化游戏的设置 - def initialize_dynamic_settings(self): 初始化随游戏进行而变化的设置 - def increase_speed(self): 提高速度设置
Implement the Python class `Settings` described below. Class description: 存储游戏中的所有设置的类 Method signatures and docstrings: - def __init__(self): 初始化游戏的设置 - def initialize_dynamic_settings(self): 初始化随游戏进行而变化的设置 - def increase_speed(self): 提高速度设置 <|skeleton|> class Settings: """存储游戏中的所有设置的类""" def __init__(self...
9dc8ddd440e56a9961b118813162323fdfd4f16e
<|skeleton|> class Settings: """存储游戏中的所有设置的类""" def __init__(self): """初始化游戏的设置""" <|body_0|> def initialize_dynamic_settings(self): """初始化随游戏进行而变化的设置""" <|body_1|> def increase_speed(self): """提高速度设置""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Settings: """存储游戏中的所有设置的类""" def __init__(self): """初始化游戏的设置""" self.screen_width = 1200 self.screen_height = 800 self.bg_color = (230, 230, 230) self.bullet_width = 15 self.bullet_height = 3 self.bullet_color = (60, 60, 60) self.bullets_lim...
the_stack_v2_python_sparse
python编程从入门到实践/第十四章/14-3/settings_class.py
huanglun1994/learn
train
0
df47e0ccdf43faae7efd5af7988527f7f4733825
[ "user_form = UserForm(data=request.POST)\nprofile_form = MemberForm(data=request.POST)\nif user_form.is_valid() and profile_form.is_valid():\n user_form.clean()\n profile_form.clean()\n new_user = User(username=user_form.cleaned_data[u'username'].lower(), email=user_form.cleaned_data[u'email'])\n new_us...
<|body_start_0|> user_form = UserForm(data=request.POST) profile_form = MemberForm(data=request.POST) if user_form.is_valid() and profile_form.is_valid(): user_form.clean() profile_form.clean() new_user = User(username=user_form.cleaned_data[u'username'].lower...
Handles showing and parsing registration form.
MemberRegisterView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MemberRegisterView: """Handles showing and parsing registration form.""" def post(self, request, *args, **kwargs): """Serve POST request - when user submits registration form""" <|body_0|> def get(self, request, *args, **kwargs): """Serve GET request - swoh regis...
stack_v2_sparse_classes_36k_train_012471
11,610
no_license
[ { "docstring": "Serve POST request - when user submits registration form", "name": "post", "signature": "def post(self, request, *args, **kwargs)" }, { "docstring": "Serve GET request - swoh registration form", "name": "get", "signature": "def get(self, request, *args, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_train_017884
Implement the Python class `MemberRegisterView` described below. Class description: Handles showing and parsing registration form. Method signatures and docstrings: - def post(self, request, *args, **kwargs): Serve POST request - when user submits registration form - def get(self, request, *args, **kwargs): Serve GET...
Implement the Python class `MemberRegisterView` described below. Class description: Handles showing and parsing registration form. Method signatures and docstrings: - def post(self, request, *args, **kwargs): Serve POST request - when user submits registration form - def get(self, request, *args, **kwargs): Serve GET...
f14b4a9ef7e9379476ddee9c065d6a23bd42cd5d
<|skeleton|> class MemberRegisterView: """Handles showing and parsing registration form.""" def post(self, request, *args, **kwargs): """Serve POST request - when user submits registration form""" <|body_0|> def get(self, request, *args, **kwargs): """Serve GET request - swoh regis...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MemberRegisterView: """Handles showing and parsing registration form.""" def post(self, request, *args, **kwargs): """Serve POST request - when user submits registration form""" user_form = UserForm(data=request.POST) profile_form = MemberForm(data=request.POST) if user_fo...
the_stack_v2_python_sparse
members/views.py
nnikolic72/funtograph
train
0
706a695cb773baa6e74e8c33d07cd3b885579129
[ "self.validation_split = validation_split\nself.shuffle = shuffle\nself.batch_idx = 0\nself.n_samples = len(dataset)\nself.sampler, self.valid_sampler = self._split_sampler(self.validation_split)\nself.init_kwargs = {'dataset': dataset, 'batch_size': batch_size, 'shuffle': self.shuffle, 'collate_fn': collate_fn, 'n...
<|body_start_0|> self.validation_split = validation_split self.shuffle = shuffle self.batch_idx = 0 self.n_samples = len(dataset) self.sampler, self.valid_sampler = self._split_sampler(self.validation_split) self.init_kwargs = {'dataset': dataset, 'batch_size': batch_size...
Base class for all data loaders
BaseDataLoader
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseDataLoader: """Base class for all data loaders""" def __init__(self, dataset, batch_size, shuffle, validation_split, num_workers, collate_fn=default_collate): """params: dataset: Pytorch Dataset object validation_split: float between 0 and 1. Indicates the percentage of data to a...
stack_v2_sparse_classes_36k_train_012472
2,641
no_license
[ { "docstring": "params: dataset: Pytorch Dataset object validation_split: float between 0 and 1. Indicates the percentage of data to assign to the validation set", "name": "__init__", "signature": "def __init__(self, dataset, batch_size, shuffle, validation_split, num_workers, collate_fn=default_collate...
3
null
Implement the Python class `BaseDataLoader` described below. Class description: Base class for all data loaders Method signatures and docstrings: - def __init__(self, dataset, batch_size, shuffle, validation_split, num_workers, collate_fn=default_collate): params: dataset: Pytorch Dataset object validation_split: flo...
Implement the Python class `BaseDataLoader` described below. Class description: Base class for all data loaders Method signatures and docstrings: - def __init__(self, dataset, batch_size, shuffle, validation_split, num_workers, collate_fn=default_collate): params: dataset: Pytorch Dataset object validation_split: flo...
cda0a4b53d8625ec46dfcc23857a0f2cc974ac36
<|skeleton|> class BaseDataLoader: """Base class for all data loaders""" def __init__(self, dataset, batch_size, shuffle, validation_split, num_workers, collate_fn=default_collate): """params: dataset: Pytorch Dataset object validation_split: float between 0 and 1. Indicates the percentage of data to a...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BaseDataLoader: """Base class for all data loaders""" def __init__(self, dataset, batch_size, shuffle, validation_split, num_workers, collate_fn=default_collate): """params: dataset: Pytorch Dataset object validation_split: float between 0 and 1. Indicates the percentage of data to assign to the ...
the_stack_v2_python_sparse
semantic_segmentation/unet/base/base_data_loader.py
DS3Lab/forest-prediction
train
23
6cfee43b0338e9d172c4ca80bc8a6451963240fd
[ "super(DJFCoordFeatureFusionBlock, self).__init__()\nself.resConfUnit1 = ResidualConvUnit(features)\nself.inter = nn.Sequential(nn.ReLU(True), nn.Conv2d(features + 40 + 1, features, kernel_size=1))\nself.resConfUnit2 = ResidualConvUnit(features)", "guidance = xs[0]\noutput = xs[1]\nif len(xs) == 3:\n output +=...
<|body_start_0|> super(DJFCoordFeatureFusionBlock, self).__init__() self.resConfUnit1 = ResidualConvUnit(features) self.inter = nn.Sequential(nn.ReLU(True), nn.Conv2d(features + 40 + 1, features, kernel_size=1)) self.resConfUnit2 = ResidualConvUnit(features) <|end_body_0|> <|body_start_...
Feature fusion block.
DJFCoordFeatureFusionBlock
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DJFCoordFeatureFusionBlock: """Feature fusion block.""" def __init__(self, features): """Init. Args: features (int): number of features""" <|body_0|> def forward(self, *xs): """Forward pass. Returns: tensor: output""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_012473
17,410
permissive
[ { "docstring": "Init. Args: features (int): number of features", "name": "__init__", "signature": "def __init__(self, features)" }, { "docstring": "Forward pass. Returns: tensor: output", "name": "forward", "signature": "def forward(self, *xs)" } ]
2
null
Implement the Python class `DJFCoordFeatureFusionBlock` described below. Class description: Feature fusion block. Method signatures and docstrings: - def __init__(self, features): Init. Args: features (int): number of features - def forward(self, *xs): Forward pass. Returns: tensor: output
Implement the Python class `DJFCoordFeatureFusionBlock` described below. Class description: Feature fusion block. Method signatures and docstrings: - def __init__(self, features): Init. Args: features (int): number of features - def forward(self, *xs): Forward pass. Returns: tensor: output <|skeleton|> class DJFCoor...
a00c3619bf4042e446e1919087f0b09fe9fa3a65
<|skeleton|> class DJFCoordFeatureFusionBlock: """Feature fusion block.""" def __init__(self, features): """Init. Args: features (int): number of features""" <|body_0|> def forward(self, *xs): """Forward pass. Returns: tensor: output""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DJFCoordFeatureFusionBlock: """Feature fusion block.""" def __init__(self, features): """Init. Args: features (int): number of features""" super(DJFCoordFeatureFusionBlock, self).__init__() self.resConfUnit1 = ResidualConvUnit(features) self.inter = nn.Sequential(nn.ReLU(T...
the_stack_v2_python_sparse
nasws/cnn/search_space/monodepth/models/blocks.py
kcyu2014/nas-landmarkreg
train
10
de25d5871c4fed7907e799504bdff308a55c6c49
[ "self.model, self.file = (model, rampage_file)\nself.chains_map = dict(zip(chains, chains_seq))\nself.residues = self.read_residues()\nself.summary = self.read_summary()", "parsed = []\nwith open(self.file) as rf:\n rf_residues = [res.rstrip('\\n') for res in rf]\n for res in rf_residues:\n if phrase...
<|body_start_0|> self.model, self.file = (model, rampage_file) self.chains_map = dict(zip(chains, chains_seq)) self.residues = self.read_residues() self.summary = self.read_summary() <|end_body_0|> <|body_start_1|> parsed = [] with open(self.file) as rf: rf_r...
RamachandranEval
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RamachandranEval: def __init__(self, model, rampage_file, chains, chains_seq): """:param model: model name :param rampage_file: rampage outfile name :param chains: list of chains as in pdb :param chains_seq: list of chain proper naming""" <|body_0|> def read_file(self, phras...
stack_v2_sparse_classes_36k_train_012474
6,566
no_license
[ { "docstring": ":param model: model name :param rampage_file: rampage outfile name :param chains: list of chains as in pdb :param chains_seq: list of chain proper naming", "name": "__init__", "signature": "def __init__(self, model, rampage_file, chains, chains_seq)" }, { "docstring": ":param phr...
4
stack_v2_sparse_classes_30k_train_011583
Implement the Python class `RamachandranEval` described below. Class description: Implement the RamachandranEval class. Method signatures and docstrings: - def __init__(self, model, rampage_file, chains, chains_seq): :param model: model name :param rampage_file: rampage outfile name :param chains: list of chains as i...
Implement the Python class `RamachandranEval` described below. Class description: Implement the RamachandranEval class. Method signatures and docstrings: - def __init__(self, model, rampage_file, chains, chains_seq): :param model: model name :param rampage_file: rampage outfile name :param chains: list of chains as i...
fdb8a1a14bcf0b372ebaf152f2bbb1f5d804172e
<|skeleton|> class RamachandranEval: def __init__(self, model, rampage_file, chains, chains_seq): """:param model: model name :param rampage_file: rampage outfile name :param chains: list of chains as in pdb :param chains_seq: list of chain proper naming""" <|body_0|> def read_file(self, phras...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RamachandranEval: def __init__(self, model, rampage_file, chains, chains_seq): """:param model: model name :param rampage_file: rampage outfile name :param chains: list of chains as in pdb :param chains_seq: list of chain proper naming""" self.model, self.file = (model, rampage_file) s...
the_stack_v2_python_sparse
homology_modeling/model_evaluation/_OLD/OLD_maindir/mm_homology_parse_rama.py
michal2am/bioscripts
train
3
0b44003e4c51d27d22ac0735f4b9317cc343cb96
[ "x = kwargs.get('x', self.problem.data_x)\ny = kwargs.get('y', self.problem.data_y)\ne = kwargs.get('e', self.problem.data_e)\nif len(x) != len(y) or len(x) != len(e):\n raise CostFuncError(f'The length of the x, y and e are not the same, len(x)={len(x)}, len(y)={len(y)} and len(e)={len(e)}')\nresult = (y - self...
<|body_start_0|> x = kwargs.get('x', self.problem.data_x) y = kwargs.get('y', self.problem.data_y) e = kwargs.get('e', self.problem.data_e) if len(x) != len(y) or len(x) != len(e): raise CostFuncError(f'The length of the x, y and e are not the same, len(x)={len(x)}, len(y)={l...
This defines the weighted non-linear least squares cost function where, given a set of :math:`n` data points :math:`(x_i,y_i)`, associated errors :math:`e_i`, and a model function :math:`f(x,p)`, we find the optimal parameters in the root least-squares sense by solving: .. math:: \\min_p \\sum_{i=1}^n \\left(\\frac{y_i...
WeightedNLLSCostFunc
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WeightedNLLSCostFunc: """This defines the weighted non-linear least squares cost function where, given a set of :math:`n` data points :math:`(x_i,y_i)`, associated errors :math:`e_i`, and a model function :math:`f(x,p)`, we find the optimal parameters in the root least-squares sense by solving: ....
stack_v2_sparse_classes_36k_train_012475
3,159
permissive
[ { "docstring": "Calculate the residuals, :math:`\\\\frac{y_i - f(x_i, p)}{e_i}` :param params: The parameters, :math:`p`, to calculate residuals for :type params: list :return: The residuals for the data points at the given parameters :rtype: numpy array", "name": "eval_r", "signature": "def eval_r(self...
3
stack_v2_sparse_classes_30k_train_014981
Implement the Python class `WeightedNLLSCostFunc` described below. Class description: This defines the weighted non-linear least squares cost function where, given a set of :math:`n` data points :math:`(x_i,y_i)`, associated errors :math:`e_i`, and a model function :math:`f(x,p)`, we find the optimal parameters in the...
Implement the Python class `WeightedNLLSCostFunc` described below. Class description: This defines the weighted non-linear least squares cost function where, given a set of :math:`n` data points :math:`(x_i,y_i)`, associated errors :math:`e_i`, and a model function :math:`f(x,p)`, we find the optimal parameters in the...
5ee7e66d963ebe9296c0a62c24b9616f6c65537e
<|skeleton|> class WeightedNLLSCostFunc: """This defines the weighted non-linear least squares cost function where, given a set of :math:`n` data points :math:`(x_i,y_i)`, associated errors :math:`e_i`, and a model function :math:`f(x,p)`, we find the optimal parameters in the root least-squares sense by solving: ....
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WeightedNLLSCostFunc: """This defines the weighted non-linear least squares cost function where, given a set of :math:`n` data points :math:`(x_i,y_i)`, associated errors :math:`e_i`, and a model function :math:`f(x,p)`, we find the optimal parameters in the root least-squares sense by solving: .. math:: \\mi...
the_stack_v2_python_sparse
fitbenchmarking/cost_func/weighted_nlls_cost_func.py
fitbenchmarking/fitbenchmarking
train
15
b719fe9d12473290591d766c41e78fb862bf7b50
[ "environ = werkzeug_test.EnvironBuilder(path='/').get_environ()\nrequest = wsgiapp.HttpRequest(environ)\n\ndef Handler(request, *args, **kwargs):\n del request, args, kwargs\n return http_response.HttpResponse('foobar', status=200)\nmanager = webauth.IAPWebAuthManager()\nresponse = manager.SecurityCheck(Handl...
<|body_start_0|> environ = werkzeug_test.EnvironBuilder(path='/').get_environ() request = wsgiapp.HttpRequest(environ) def Handler(request, *args, **kwargs): del request, args, kwargs return http_response.HttpResponse('foobar', status=200) manager = webauth.IAPWe...
IAPWebAuthManagerTest
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IAPWebAuthManagerTest: def testNoHeader(self): """Test requests sent to the Admin UI without an IAP Header.""" <|body_0|> def testFailedSignatureKey(self, mock_get): """Test requests with an invalid JWT Token.""" <|body_1|> def testSuccessfulKey(self, mo...
stack_v2_sparse_classes_36k_train_012476
12,354
permissive
[ { "docstring": "Test requests sent to the Admin UI without an IAP Header.", "name": "testNoHeader", "signature": "def testNoHeader(self)" }, { "docstring": "Test requests with an invalid JWT Token.", "name": "testFailedSignatureKey", "signature": "def testFailedSignatureKey(self, mock_ge...
3
null
Implement the Python class `IAPWebAuthManagerTest` described below. Class description: Implement the IAPWebAuthManagerTest class. Method signatures and docstrings: - def testNoHeader(self): Test requests sent to the Admin UI without an IAP Header. - def testFailedSignatureKey(self, mock_get): Test requests with an in...
Implement the Python class `IAPWebAuthManagerTest` described below. Class description: Implement the IAPWebAuthManagerTest class. Method signatures and docstrings: - def testNoHeader(self): Test requests sent to the Admin UI without an IAP Header. - def testFailedSignatureKey(self, mock_get): Test requests with an in...
44c0eb8c938302098ef7efae8cfd6b90bcfbb2d6
<|skeleton|> class IAPWebAuthManagerTest: def testNoHeader(self): """Test requests sent to the Admin UI without an IAP Header.""" <|body_0|> def testFailedSignatureKey(self, mock_get): """Test requests with an invalid JWT Token.""" <|body_1|> def testSuccessfulKey(self, mo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IAPWebAuthManagerTest: def testNoHeader(self): """Test requests sent to the Admin UI without an IAP Header.""" environ = werkzeug_test.EnvironBuilder(path='/').get_environ() request = wsgiapp.HttpRequest(environ) def Handler(request, *args, **kwargs): del request, ...
the_stack_v2_python_sparse
grr/server/grr_response_server/gui/webauth_test.py
google/grr
train
4,683
c953c06d61c6359e042770b914a158157e55143b
[ "for i in range(1, len(nums)):\n if nums[i - 1] > 0:\n nums[i] += nums[i - 1]\nreturn max(nums)", "dp = [nums[0] for _ in range(len(nums))]\nmaxSum = dp[0]\nfor i in range(1, len(nums)):\n dp[i] = dp[i - 1] + nums[i] if dp[i - 1] > 0 else nums[i]\n maxSum = max(dp[i], maxSum)\nreturn maxSum", "m...
<|body_start_0|> for i in range(1, len(nums)): if nums[i - 1] > 0: nums[i] += nums[i - 1] return max(nums) <|end_body_0|> <|body_start_1|> dp = [nums[0] for _ in range(len(nums))] maxSum = dp[0] for i in range(1, len(nums)): dp[i] = dp[i -...
genius solution, using dp(?) 对于每一个数来说,其有可能有两个选择,一个是作为已累积字串的结尾, 另一个是作为新字串的开头 只有当前面已累计的和是正数时, 后一个数累积到前面的字串中才会大于该数作为一个新字串的开头得到的结果 因此程序执行后的nums的每一元素代表这个位置能取得的连续字串的最大和
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """genius solution, using dp(?) 对于每一个数来说,其有可能有两个选择,一个是作为已累积字串的结尾, 另一个是作为新字串的开头 只有当前面已累计的和是正数时, 后一个数累积到前面的字串中才会大于该数作为一个新字串的开头得到的结果 因此程序执行后的nums的每一元素代表这个位置能取得的连续字串的最大和""" def maxSubArray1(self, nums: List[int]) -> int: """emmmm,不太喜欢这个解法了""" <|body_0|> def maxSubA...
stack_v2_sparse_classes_36k_train_012477
1,307
no_license
[ { "docstring": "emmmm,不太喜欢这个解法了", "name": "maxSubArray1", "signature": "def maxSubArray1(self, nums: List[int]) -> int" }, { "docstring": "正规dp方法", "name": "maxSubArray2", "signature": "def maxSubArray2(self, nums: List[int]) -> int" }, { "docstring": "第一种方法", "name": "maxSub...
3
null
Implement the Python class `Solution` described below. Class description: genius solution, using dp(?) 对于每一个数来说,其有可能有两个选择,一个是作为已累积字串的结尾, 另一个是作为新字串的开头 只有当前面已累计的和是正数时, 后一个数累积到前面的字串中才会大于该数作为一个新字串的开头得到的结果 因此程序执行后的nums的每一元素代表这个位置能取得的连续字串的最大和 Method signatures and docstrings: - def maxSubArray1(self, nums: List[int]) -> in...
Implement the Python class `Solution` described below. Class description: genius solution, using dp(?) 对于每一个数来说,其有可能有两个选择,一个是作为已累积字串的结尾, 另一个是作为新字串的开头 只有当前面已累计的和是正数时, 后一个数累积到前面的字串中才会大于该数作为一个新字串的开头得到的结果 因此程序执行后的nums的每一元素代表这个位置能取得的连续字串的最大和 Method signatures and docstrings: - def maxSubArray1(self, nums: List[int]) -> in...
b9a2bd8385e44cc79454f9c7f2146370896559ec
<|skeleton|> class Solution: """genius solution, using dp(?) 对于每一个数来说,其有可能有两个选择,一个是作为已累积字串的结尾, 另一个是作为新字串的开头 只有当前面已累计的和是正数时, 后一个数累积到前面的字串中才会大于该数作为一个新字串的开头得到的结果 因此程序执行后的nums的每一元素代表这个位置能取得的连续字串的最大和""" def maxSubArray1(self, nums: List[int]) -> int: """emmmm,不太喜欢这个解法了""" <|body_0|> def maxSubA...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: """genius solution, using dp(?) 对于每一个数来说,其有可能有两个选择,一个是作为已累积字串的结尾, 另一个是作为新字串的开头 只有当前面已累计的和是正数时, 后一个数累积到前面的字串中才会大于该数作为一个新字串的开头得到的结果 因此程序执行后的nums的每一元素代表这个位置能取得的连续字串的最大和""" def maxSubArray1(self, nums: List[int]) -> int: """emmmm,不太喜欢这个解法了""" for i in range(1, len(nums)): ...
the_stack_v2_python_sparse
53.MaximumSubarray.py
haveGrasses/Algorithm
train
0
7def743d855b421a290cc62905dacb5c35b0308d
[ "self._size = None\nself.source = source\nself.autoTransform = autoTransform", "reader = QImageReader(self.source)\nreader.setAutoTransform(self.autoTransform)\nreturn reader", "if self._size is None:\n self._size = QSize()\n reader = self._reader()\n if reader.canRead():\n size = reader.size()\...
<|body_start_0|> self._size = None self.source = source self.autoTransform = autoTransform <|end_body_0|> <|body_start_1|> reader = QImageReader(self.source) reader.setAutoTransform(self.autoTransform) return reader <|end_body_1|> <|body_start_2|> if self._size ...
Represent an image loaded from a file or IO device.
ImageLoader
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImageLoader: """Represent an image loaded from a file or IO device.""" def __init__(self, source, autoTransform=True): """Init with a filename or QIODevice. If autoTransform is True (the default), EXIF rotation is automatically applied when loading the image.""" <|body_0|> ...
stack_v2_sparse_classes_36k_train_012478
7,688
no_license
[ { "docstring": "Init with a filename or QIODevice. If autoTransform is True (the default), EXIF rotation is automatically applied when loading the image.", "name": "__init__", "signature": "def __init__(self, source, autoTransform=True)" }, { "docstring": "Return a QImageReader for the source.",...
4
stack_v2_sparse_classes_30k_train_005461
Implement the Python class `ImageLoader` described below. Class description: Represent an image loaded from a file or IO device. Method signatures and docstrings: - def __init__(self, source, autoTransform=True): Init with a filename or QIODevice. If autoTransform is True (the default), EXIF rotation is automatically...
Implement the Python class `ImageLoader` described below. Class description: Represent an image loaded from a file or IO device. Method signatures and docstrings: - def __init__(self, source, autoTransform=True): Init with a filename or QIODevice. If autoTransform is True (the default), EXIF rotation is automatically...
2f870fa69495ffc22913550cbdf3e8c606d3d998
<|skeleton|> class ImageLoader: """Represent an image loaded from a file or IO device.""" def __init__(self, source, autoTransform=True): """Init with a filename or QIODevice. If autoTransform is True (the default), EXIF rotation is automatically applied when loading the image.""" <|body_0|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ImageLoader: """Represent an image loaded from a file or IO device.""" def __init__(self, source, autoTransform=True): """Init with a filename or QIODevice. If autoTransform is True (the default), EXIF rotation is automatically applied when loading the image.""" self._size = None ...
the_stack_v2_python_sparse
VenvSocket/Lib/site-packages/qpageview/image.py
crq-13/PintMegaPapel
train
0
f6b1e71ade3babfa4e6a0ca4f0478177dddbdc0a
[ "self.mrcexcite = float(mrcexcite)\nself.variable = float(variable)\nself.A = 0.0024886\nself.B = 0.00025079\nself.C = 3.1754e-07\nself.offset = float(offset)\nsuper(mrctherm, self).__init__(variable, bad_val)", "if abs(self.variable) >= 6999 or self.variable <= 0:\n self.result = self.bad_value\n return\nm...
<|body_start_0|> self.mrcexcite = float(mrcexcite) self.variable = float(variable) self.A = 0.0024886 self.B = 0.00025079 self.C = 3.1754e-07 self.offset = float(offset) super(mrctherm, self).__init__(variable, bad_val) <|end_body_0|> <|body_start_1|> if ...
This class is for processing thermistor values using the Steinhart-Hart equation. This class takes a resistance and cofficents and calculates a temperature into the resultant variable
mrctherm
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class mrctherm: """This class is for processing thermistor values using the Steinhart-Hart equation. This class takes a resistance and cofficents and calculates a temperature into the resultant variable""" def __init__(self, variable, mrcexcite, offset=0, bad_val=6999): """Class initialize...
stack_v2_sparse_classes_36k_train_012479
17,830
no_license
[ { "docstring": "Class initializer arguments: variable: (convertible to float) the resistance variable value offset: (convertible to float) a correctional offset mrcexccol: column for the mrc excitation voltage bad_val: (convertible to int) the value to indicate a bad data item", "name": "__init__", "sig...
2
stack_v2_sparse_classes_30k_train_007560
Implement the Python class `mrctherm` described below. Class description: This class is for processing thermistor values using the Steinhart-Hart equation. This class takes a resistance and cofficents and calculates a temperature into the resultant variable Method signatures and docstrings: - def __init__(self, varia...
Implement the Python class `mrctherm` described below. Class description: This class is for processing thermistor values using the Steinhart-Hart equation. This class takes a resistance and cofficents and calculates a temperature into the resultant variable Method signatures and docstrings: - def __init__(self, varia...
95d0c102d649c5b028d262f5254106f997a7c77a
<|skeleton|> class mrctherm: """This class is for processing thermistor values using the Steinhart-Hart equation. This class takes a resistance and cofficents and calculates a temperature into the resultant variable""" def __init__(self, variable, mrcexcite, offset=0, bad_val=6999): """Class initialize...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class mrctherm: """This class is for processing thermistor values using the Steinhart-Hart equation. This class takes a resistance and cofficents and calculates a temperature into the resultant variable""" def __init__(self, variable, mrcexcite, offset=0, bad_val=6999): """Class initializer arguments: ...
the_stack_v2_python_sparse
csv_lib/equations.py
rwspicer/csv_utilities
train
1
5dc20667eee5a88a23df4422824590f7927c0419
[ "threading.Thread.__init__(self)\nself.f2run = f\nself.results = None\nself.list_of_params = list_of_params", "self.results = []\nfor params in self.list_of_params:\n l, p = (params, {}) if len(params) else params\n self.results.append(self.f2run(*l, **p))", "th = []\nsplit = [list_of_params[i::nbthread] ...
<|body_start_0|> threading.Thread.__init__(self) self.f2run = f self.results = None self.list_of_params = list_of_params <|end_body_0|> <|body_start_1|> self.results = [] for params in self.list_of_params: l, p = (params, {}) if len(params) else params ...
Cette classe implémente un thread qui exécute en boucle une fonction sur tous les éléments d'une liste.
ParallelThread
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ParallelThread: """Cette classe implémente un thread qui exécute en boucle une fonction sur tous les éléments d'une liste.""" def __init__(self, f, list_of_params): """Constructeur @param f fonction à exécuter @param list_of_params liste des paramètres à exécuter""" <|body_0|...
stack_v2_sparse_classes_36k_train_012480
2,785
no_license
[ { "docstring": "Constructeur @param f fonction à exécuter @param list_of_params liste des paramètres à exécuter", "name": "__init__", "signature": "def __init__(self, f, list_of_params)" }, { "docstring": "Appelle une fonction plusieurs sur tous les paramètres dans une liste.", "name": "run"...
3
stack_v2_sparse_classes_30k_test_000142
Implement the Python class `ParallelThread` described below. Class description: Cette classe implémente un thread qui exécute en boucle une fonction sur tous les éléments d'une liste. Method signatures and docstrings: - def __init__(self, f, list_of_params): Constructeur @param f fonction à exécuter @param list_of_pa...
Implement the Python class `ParallelThread` described below. Class description: Cette classe implémente un thread qui exécute en boucle une fonction sur tous les éléments d'une liste. Method signatures and docstrings: - def __init__(self, f, list_of_params): Constructeur @param f fonction à exécuter @param list_of_pa...
d737c044cc4976f93e1fbac90f56012980557143
<|skeleton|> class ParallelThread: """Cette classe implémente un thread qui exécute en boucle une fonction sur tous les éléments d'une liste.""" def __init__(self, f, list_of_params): """Constructeur @param f fonction à exécuter @param list_of_params liste des paramètres à exécuter""" <|body_0|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ParallelThread: """Cette classe implémente un thread qui exécute en boucle une fonction sur tous les éléments d'une liste.""" def __init__(self, f, list_of_params): """Constructeur @param f fonction à exécuter @param list_of_params liste des paramètres à exécuter""" threading.Thread.__ini...
the_stack_v2_python_sparse
src/ensae_teaching_cs/td_2a/parallel_thread.py
jfbercher/ensae_teaching_cs
train
0
9cd03b74bffbd2313f52df66601c11a5bb79daee
[ "if len(matrix) == 0 or len(matrix[0]) == 0:\n return\nself.matrix_sum = [[matrix[r][c] for c in range(len(matrix[0]))] for r in range(len(matrix))]\nfor r in range(1, len(matrix)):\n self.matrix_sum[r][0] = self.matrix_sum[r - 1][0] + matrix[r][0]\nfor c in range(1, len(matrix[0])):\n self.matrix_sum[0][c...
<|body_start_0|> if len(matrix) == 0 or len(matrix[0]) == 0: return self.matrix_sum = [[matrix[r][c] for c in range(len(matrix[0]))] for r in range(len(matrix))] for r in range(1, len(matrix)): self.matrix_sum[r][0] = self.matrix_sum[r - 1][0] + matrix[r][0] for c...
NumMatrix
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumMatrix: def __init__(self, matrix): """initialize your data structure here. :type matrix: List[List[int]]""" <|body_0|> def sumRegion(self, row1, col1, row2, col2): """sum of elements matrix[(row1,col1)..(row2,col2)], inclusive. :type row1: int :type col1: int :ty...
stack_v2_sparse_classes_36k_train_012481
1,876
no_license
[ { "docstring": "initialize your data structure here. :type matrix: List[List[int]]", "name": "__init__", "signature": "def __init__(self, matrix)" }, { "docstring": "sum of elements matrix[(row1,col1)..(row2,col2)], inclusive. :type row1: int :type col1: int :type row2: int :type col2: int :rtyp...
2
stack_v2_sparse_classes_30k_train_003342
Implement the Python class `NumMatrix` described below. Class description: Implement the NumMatrix class. Method signatures and docstrings: - def __init__(self, matrix): initialize your data structure here. :type matrix: List[List[int]] - def sumRegion(self, row1, col1, row2, col2): sum of elements matrix[(row1,col1)...
Implement the Python class `NumMatrix` described below. Class description: Implement the NumMatrix class. Method signatures and docstrings: - def __init__(self, matrix): initialize your data structure here. :type matrix: List[List[int]] - def sumRegion(self, row1, col1, row2, col2): sum of elements matrix[(row1,col1)...
c9a53ef2fc1fd1fea7377c3633689fa87601dba6
<|skeleton|> class NumMatrix: def __init__(self, matrix): """initialize your data structure here. :type matrix: List[List[int]]""" <|body_0|> def sumRegion(self, row1, col1, row2, col2): """sum of elements matrix[(row1,col1)..(row2,col2)], inclusive. :type row1: int :type col1: int :ty...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NumMatrix: def __init__(self, matrix): """initialize your data structure here. :type matrix: List[List[int]]""" if len(matrix) == 0 or len(matrix[0]) == 0: return self.matrix_sum = [[matrix[r][c] for c in range(len(matrix[0]))] for r in range(len(matrix))] for r in ...
the_stack_v2_python_sparse
leetcode304.py
yuchien302/LeetCode
train
2
93288cd86c251193c06219e6f00b61239e7cee1c
[ "from sol_factory.base.utils.tools.titleize import str_titleize\nfor e in cls:\n if value == e.value:\n return str_titleize(e.name)\nreturn default", "from sol_factory.base.utils.tools.titleize import str_titleize\nname = name.strip()\nfor e in cls:\n if name.lower() == e.name.lower() or name.lower()...
<|body_start_0|> from sol_factory.base.utils.tools.titleize import str_titleize for e in cls: if value == e.value: return str_titleize(e.name) return default <|end_body_0|> <|body_start_1|> from sol_factory.base.utils.tools.titleize import str_titleize ...
BWEnum is the base for all enums in blackwidow project. This class provide some extra functionality added to the class Enum.
BaseEnum
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BaseEnum: """BWEnum is the base for all enums in blackwidow project. This class provide some extra functionality added to the class Enum.""" def get_name_from_value(cls, value, default='N/A'): """Get the name (label) of enum from value :param value: value of the enum :param default: ...
stack_v2_sparse_classes_36k_train_012482
2,894
no_license
[ { "docstring": "Get the name (label) of enum from value :param value: value of the enum :param default: to return if no value is matched with enum's value :return: label of enum if value is found. default otherwise", "name": "get_name_from_value", "signature": "def get_name_from_value(cls, value, defaul...
4
null
Implement the Python class `BaseEnum` described below. Class description: BWEnum is the base for all enums in blackwidow project. This class provide some extra functionality added to the class Enum. Method signatures and docstrings: - def get_name_from_value(cls, value, default='N/A'): Get the name (label) of enum fr...
Implement the Python class `BaseEnum` described below. Class description: BWEnum is the base for all enums in blackwidow project. This class provide some extra functionality added to the class Enum. Method signatures and docstrings: - def get_name_from_value(cls, value, default='N/A'): Get the name (label) of enum fr...
bf2ca0a952244a35e060366db57160114e711cfb
<|skeleton|> class BaseEnum: """BWEnum is the base for all enums in blackwidow project. This class provide some extra functionality added to the class Enum.""" def get_name_from_value(cls, value, default='N/A'): """Get the name (label) of enum from value :param value: value of the enum :param default: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BaseEnum: """BWEnum is the base for all enums in blackwidow project. This class provide some extra functionality added to the class Enum.""" def get_name_from_value(cls, value, default='N/A'): """Get the name (label) of enum from value :param value: value of the enum :param default: to return if ...
the_stack_v2_python_sparse
sol_factory/base/utils/extras/base_enum.py
ashfaqshuvo007/shop_django_api
train
0
f63f790b42b9446ca7ab69bef9b3481725721a79
[ "ip = self.get_argument('ip')\nresponse = (yield self.get_ip_info(ip))\nif response['code'] == 0:\n self.write(response)\nelse:\n self.write('查询ip地址失败!')\nself.finish()", "http = tornado.httpclient.AsyncHTTPClient()\nresponse = (yield http.fetch(request='http://ip.taobao.com/service/getIpInfo.php?ip={}'.for...
<|body_start_0|> ip = self.get_argument('ip') response = (yield self.get_ip_info(ip)) if response['code'] == 0: self.write(response) else: self.write('查询ip地址失败!') self.finish() <|end_body_0|> <|body_start_1|> http = tornado.httpclient.AsyncHTTPCli...
首页handler类
IndexHandler
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IndexHandler: """首页handler类""" def get(self): """异步请求客户端""" <|body_0|> def get_ip_info(self, ip): """将异步web请求单独出来""" <|body_1|> <|end_skeleton|> <|body_start_0|> ip = self.get_argument('ip') response = (yield self.get_ip_info(ip)) ...
stack_v2_sparse_classes_36k_train_012483
2,195
no_license
[ { "docstring": "异步请求客户端", "name": "get", "signature": "def get(self)" }, { "docstring": "将异步web请求单独出来", "name": "get_ip_info", "signature": "def get_ip_info(self, ip)" } ]
2
stack_v2_sparse_classes_30k_train_002234
Implement the Python class `IndexHandler` described below. Class description: 首页handler类 Method signatures and docstrings: - def get(self): 异步请求客户端 - def get_ip_info(self, ip): 将异步web请求单独出来
Implement the Python class `IndexHandler` described below. Class description: 首页handler类 Method signatures and docstrings: - def get(self): 异步请求客户端 - def get_ip_info(self, ip): 将异步web请求单独出来 <|skeleton|> class IndexHandler: """首页handler类""" def get(self): """异步请求客户端""" <|body_0|> def get...
34021339fea059ef1ba1d562cf091f3f07aeedc9
<|skeleton|> class IndexHandler: """首页handler类""" def get(self): """异步请求客户端""" <|body_0|> def get_ip_info(self, ip): """将异步web请求单独出来""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class IndexHandler: """首页handler类""" def get(self): """异步请求客户端""" ip = self.get_argument('ip') response = (yield self.get_ip_info(ip)) if response['code'] == 0: self.write(response) else: self.write('查询ip地址失败!') self.finish() def get_...
the_stack_v2_python_sparse
4_异步与Websocket/06_tornado协程异步.py
Sbwillbealier/tornado_study
train
0
99ec9eea977b63fa6bc30eb49ff79122b177b0d0
[ "self.input_size = input_size\nself.output_size = output_size\nself.neural_net = neural_net\nself.memory = []\nself.performance = []\nself.epsilon = 1\nself.epsilon_decay = 0.995\nself.epsilon_min = 0.01\nself.state = deque(maxlen=2)\nself.state.append(np.reshape([0] * self.input_size, [1, self.input_size]))\nself....
<|body_start_0|> self.input_size = input_size self.output_size = output_size self.neural_net = neural_net self.memory = [] self.performance = [] self.epsilon = 1 self.epsilon_decay = 0.995 self.epsilon_min = 0.01 self.state = deque(maxlen=2) ...
'Agent' class that represents the actions taken by a single neural network.
Agent
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Agent: """'Agent' class that represents the actions taken by a single neural network.""" def __init__(self, neural_net, input_size: int, output_size: int): """Initialise class with the neural network.""" <|body_0|> def perform_action(self, state: list, reward: float, don...
stack_v2_sparse_classes_36k_train_012484
4,546
no_license
[ { "docstring": "Initialise class with the neural network.", "name": "__init__", "signature": "def __init__(self, neural_net, input_size: int, output_size: int)" }, { "docstring": "Takes state as [angle, velocity] and reward representing reward of previous action. Returns outputs as [leg_angle, t...
2
stack_v2_sparse_classes_30k_val_000402
Implement the Python class `Agent` described below. Class description: 'Agent' class that represents the actions taken by a single neural network. Method signatures and docstrings: - def __init__(self, neural_net, input_size: int, output_size: int): Initialise class with the neural network. - def perform_action(self,...
Implement the Python class `Agent` described below. Class description: 'Agent' class that represents the actions taken by a single neural network. Method signatures and docstrings: - def __init__(self, neural_net, input_size: int, output_size: int): Initialise class with the neural network. - def perform_action(self,...
c72db39f7e49bd2c4ba9d8446f6ac7b3678928fd
<|skeleton|> class Agent: """'Agent' class that represents the actions taken by a single neural network.""" def __init__(self, neural_net, input_size: int, output_size: int): """Initialise class with the neural network.""" <|body_0|> def perform_action(self, state: list, reward: float, don...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Agent: """'Agent' class that represents the actions taken by a single neural network.""" def __init__(self, neural_net, input_size: int, output_size: int): """Initialise class with the neural network.""" self.input_size = input_size self.output_size = output_size self.neur...
the_stack_v2_python_sparse
Machine_Learning/DeepQ/RLController.py
JamesNunns/Robotics-Group-Studies
train
8
9fb86ebe3ca0bc2e40dc831f0a0507f6da6702e6
[ "B, nfeatures, nsample = idx.size()\n_, C, N = features.size()\nctx.for_backwards = (idx, N)\nreturn _ext.group_points(features, idx)", "idx, N = ctx.for_backwards\ngrad_features = _ext.group_points_grad(grad_out.contiguous(), idx, N)\nreturn (grad_features, None)" ]
<|body_start_0|> B, nfeatures, nsample = idx.size() _, C, N = features.size() ctx.for_backwards = (idx, N) return _ext.group_points(features, idx) <|end_body_0|> <|body_start_1|> idx, N = ctx.for_backwards grad_features = _ext.group_points_grad(grad_out.contiguous(), idx...
GroupingOperation
[ "Unlicense" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GroupingOperation: def forward(ctx, features, idx): """Parameters ---------- features : torch.Tensor (B, C, N) tensor of features to group idx : torch.Tensor (B, npoint, nsample) tensor containing the indicies of features to group with Returns ------- torch.Tensor (B, C, npoint, nsample)...
stack_v2_sparse_classes_36k_train_012485
15,763
permissive
[ { "docstring": "Parameters ---------- features : torch.Tensor (B, C, N) tensor of features to group idx : torch.Tensor (B, npoint, nsample) tensor containing the indicies of features to group with Returns ------- torch.Tensor (B, C, npoint, nsample) tensor", "name": "forward", "signature": "def forward(...
2
stack_v2_sparse_classes_30k_train_005828
Implement the Python class `GroupingOperation` described below. Class description: Implement the GroupingOperation class. Method signatures and docstrings: - def forward(ctx, features, idx): Parameters ---------- features : torch.Tensor (B, C, N) tensor of features to group idx : torch.Tensor (B, npoint, nsample) ten...
Implement the Python class `GroupingOperation` described below. Class description: Implement the GroupingOperation class. Method signatures and docstrings: - def forward(ctx, features, idx): Parameters ---------- features : torch.Tensor (B, C, N) tensor of features to group idx : torch.Tensor (B, npoint, nsample) ten...
c0eecf2223c3c28d048d816fd239c118b8568dcf
<|skeleton|> class GroupingOperation: def forward(ctx, features, idx): """Parameters ---------- features : torch.Tensor (B, C, N) tensor of features to group idx : torch.Tensor (B, npoint, nsample) tensor containing the indicies of features to group with Returns ------- torch.Tensor (B, C, npoint, nsample)...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GroupingOperation: def forward(ctx, features, idx): """Parameters ---------- features : torch.Tensor (B, C, N) tensor of features to group idx : torch.Tensor (B, npoint, nsample) tensor containing the indicies of features to group with Returns ------- torch.Tensor (B, C, npoint, nsample) tensor""" ...
the_stack_v2_python_sparse
pointcloud/pointnet2/utils/pointnet2_utils.py
WangLi2019Gt/qpu_code
train
0
a56551e462bf434139ffd8498015c81df1bcc9e0
[ "filename = os.path.join(dir_name, ListOfTracks.DEFAULT_FILENAME)\nif os.path.exists(filename) is False:\n raise IOError('The list of tracks is missing of the directory {:s}'.format(dir_name))\nwith open(filename, 'r') as fp:\n lines = fp.readlines()\n fp.close()\n_units = list()\nfor line in lines:\n s...
<|body_start_0|> filename = os.path.join(dir_name, ListOfTracks.DEFAULT_FILENAME) if os.path.exists(filename) is False: raise IOError('The list of tracks is missing of the directory {:s}'.format(dir_name)) with open(filename, 'r') as fp: lines = fp.readlines() ...
Manage the file with a list of tracks (units, ipus...). :author: Brigitte Bigi :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :contact: develop@sppas.org :license: GPL, v3 :copyright: Copyright (C) 2011-2018 Brigitte Bigi
ListOfTracks
[ "MIT", "GFDL-1.1-or-later", "GPL-3.0-only", "GPL-3.0-or-later" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ListOfTracks: """Manage the file with a list of tracks (units, ipus...). :author: Brigitte Bigi :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :contact: develop@sppas.org :license: GPL, v3 :copyright: Copyright (C) 2011-2018 Brigitte Bigi""" def read(dir_name): ...
stack_v2_sparse_classes_36k_train_012486
20,964
permissive
[ { "docstring": "Return a list of (start-time end-time). :param dir_name: Name of the directory with the file to read. :returns: list of units", "name": "read", "signature": "def read(dir_name)" }, { "docstring": "Write a list file (start-time end-time). :param dir_name: Name of the directory wit...
2
null
Implement the Python class `ListOfTracks` described below. Class description: Manage the file with a list of tracks (units, ipus...). :author: Brigitte Bigi :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :contact: develop@sppas.org :license: GPL, v3 :copyright: Copyright (C) 2011-2018 Brigitte B...
Implement the Python class `ListOfTracks` described below. Class description: Manage the file with a list of tracks (units, ipus...). :author: Brigitte Bigi :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :contact: develop@sppas.org :license: GPL, v3 :copyright: Copyright (C) 2011-2018 Brigitte B...
3167b65f576abcc27a8767d24c274a04712bd948
<|skeleton|> class ListOfTracks: """Manage the file with a list of tracks (units, ipus...). :author: Brigitte Bigi :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :contact: develop@sppas.org :license: GPL, v3 :copyright: Copyright (C) 2011-2018 Brigitte Bigi""" def read(dir_name): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ListOfTracks: """Manage the file with a list of tracks (units, ipus...). :author: Brigitte Bigi :organization: Laboratoire Parole et Langage, Aix-en-Provence, France :contact: develop@sppas.org :license: GPL, v3 :copyright: Copyright (C) 2011-2018 Brigitte Bigi""" def read(dir_name): """Return a ...
the_stack_v2_python_sparse
sppas/sppas/src/annotations/Align/tracksio.py
mirfan899/MTTS
train
0
04ee4e453cf19a3484acb9e6269ae38f467164e5
[ "d = {}\nfor i in strs:\n li = []\n for j in i:\n li.append(j)\n len_i = len(li)\n for p in range(len_i):\n for k in range(p + 1, len_i):\n if li[p] > li[k]:\n temp = li[p]\n li[p] = li[k]\n li[k] = temp\n ss = ''.join(li)\n if ...
<|body_start_0|> d = {} for i in strs: li = [] for j in i: li.append(j) len_i = len(li) for p in range(len_i): for k in range(p + 1, len_i): if li[p] > li[k]: temp = li[p] ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def groupAnagrams(self, strs): """:type strs: List[str] :rtype: List[List[str]]""" <|body_0|> def groupAnagrams2(self, strs): """:type strs: List[str] :rtype: List[List[str]]""" <|body_1|> <|end_skeleton|> <|body_start_0|> d = {} f...
stack_v2_sparse_classes_36k_train_012487
1,390
no_license
[ { "docstring": ":type strs: List[str] :rtype: List[List[str]]", "name": "groupAnagrams", "signature": "def groupAnagrams(self, strs)" }, { "docstring": ":type strs: List[str] :rtype: List[List[str]]", "name": "groupAnagrams2", "signature": "def groupAnagrams2(self, strs)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def groupAnagrams(self, strs): :type strs: List[str] :rtype: List[List[str]] - def groupAnagrams2(self, strs): :type strs: List[str] :rtype: List[List[str]]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def groupAnagrams(self, strs): :type strs: List[str] :rtype: List[List[str]] - def groupAnagrams2(self, strs): :type strs: List[str] :rtype: List[List[str]] <|skeleton|> class S...
2866df7587ee867a958a2b4fc02345bc3ef56999
<|skeleton|> class Solution: def groupAnagrams(self, strs): """:type strs: List[str] :rtype: List[List[str]]""" <|body_0|> def groupAnagrams2(self, strs): """:type strs: List[str] :rtype: List[List[str]]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def groupAnagrams(self, strs): """:type strs: List[str] :rtype: List[List[str]]""" d = {} for i in strs: li = [] for j in i: li.append(j) len_i = len(li) for p in range(len_i): for k in range(p + ...
the_stack_v2_python_sparse
中级算法/groupAnagrams.py
OrangeJessie/Fighting_Leetcode
train
1
44159b0a3772fe353e137cb16998a13b41e49740
[ "super(ScatterConnection, self).__init__()\nself.scatter_type = scatter_type\nassert self.scatter_type in ['cover', 'add']", "device = x.device\nB, M, N = x.shape\nH, W = spatial_size\nindex = location.view(-1, 2)\nbias = torch.arange(B).mul_(H * W).unsqueeze(1).repeat(1, M).view(-1).to(device)\nindex = index[:, ...
<|body_start_0|> super(ScatterConnection, self).__init__() self.scatter_type = scatter_type assert self.scatter_type in ['cover', 'add'] <|end_body_0|> <|body_start_1|> device = x.device B, M, N = x.shape H, W = spatial_size index = location.view(-1, 2) b...
Overview: Scatter feature to its corresponding location In AlphaStar, each entity is embedded into a tensor, and these tensors are scattered into a feature map with map size.
ScatterConnection
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ScatterConnection: """Overview: Scatter feature to its corresponding location In AlphaStar, each entity is embedded into a tensor, and these tensors are scattered into a feature map with map size.""" def __init__(self, scatter_type: str) -> None: """Overview: Init class Arguments: - ...
stack_v2_sparse_classes_36k_train_012488
3,626
permissive
[ { "docstring": "Overview: Init class Arguments: - scatter_type (:obj:`str`): Supports ['add', 'cover']. If two entities have the same location, \\\\ scatter_type decides the first one should be covered or added to second one", "name": "__init__", "signature": "def __init__(self, scatter_type: str) -> No...
2
stack_v2_sparse_classes_30k_train_000448
Implement the Python class `ScatterConnection` described below. Class description: Overview: Scatter feature to its corresponding location In AlphaStar, each entity is embedded into a tensor, and these tensors are scattered into a feature map with map size. Method signatures and docstrings: - def __init__(self, scatt...
Implement the Python class `ScatterConnection` described below. Class description: Overview: Scatter feature to its corresponding location In AlphaStar, each entity is embedded into a tensor, and these tensors are scattered into a feature map with map size. Method signatures and docstrings: - def __init__(self, scatt...
eb483fa6e46602d58c8e7d2ca1e566adca28e703
<|skeleton|> class ScatterConnection: """Overview: Scatter feature to its corresponding location In AlphaStar, each entity is embedded into a tensor, and these tensors are scattered into a feature map with map size.""" def __init__(self, scatter_type: str) -> None: """Overview: Init class Arguments: - ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ScatterConnection: """Overview: Scatter feature to its corresponding location In AlphaStar, each entity is embedded into a tensor, and these tensors are scattered into a feature map with map size.""" def __init__(self, scatter_type: str) -> None: """Overview: Init class Arguments: - scatter_type ...
the_stack_v2_python_sparse
ding/torch_utils/network/scatter_connection.py
shengxuesun/DI-engine
train
1
97cfa37a5d0e4c9964b962c37a6eba4e568c88ab
[ "if self.charging_start_time_no_tz:\n return self.charging_start_time_no_tz.astimezone(self.account_timezone)\nreturn None", "parsed = cls._parse_vehicle_data(vehicle_data) or {}\nif len(parsed) > 0:\n return cls(**parsed)\nreturn None", "retval: Dict[str, Any] = {}\ndrivetrain = DriveTrainType(vehicle_da...
<|body_start_0|> if self.charging_start_time_no_tz: return self.charging_start_time_no_tz.astimezone(self.account_timezone) return None <|end_body_0|> <|body_start_1|> parsed = cls._parse_vehicle_data(vehicle_data) or {} if len(parsed) > 0: return cls(**parsed) ...
Provides an accessible version of `status.FuelAndBattery`.
FuelAndBattery
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FuelAndBattery: """Provides an accessible version of `status.FuelAndBattery`.""" def charging_start_time(self) -> Optional[datetime.datetime]: """The planned time the vehicle will start charging.""" <|body_0|> def from_vehicle_data(cls, vehicle_data: Dict): """Cr...
stack_v2_sparse_classes_36k_train_012489
8,138
permissive
[ { "docstring": "The planned time the vehicle will start charging.", "name": "charging_start_time", "signature": "def charging_start_time(self) -> Optional[datetime.datetime]" }, { "docstring": "Create the class based on vehicle data from API.", "name": "from_vehicle_data", "signature": "...
5
stack_v2_sparse_classes_30k_train_020883
Implement the Python class `FuelAndBattery` described below. Class description: Provides an accessible version of `status.FuelAndBattery`. Method signatures and docstrings: - def charging_start_time(self) -> Optional[datetime.datetime]: The planned time the vehicle will start charging. - def from_vehicle_data(cls, ve...
Implement the Python class `FuelAndBattery` described below. Class description: Provides an accessible version of `status.FuelAndBattery`. Method signatures and docstrings: - def charging_start_time(self) -> Optional[datetime.datetime]: The planned time the vehicle will start charging. - def from_vehicle_data(cls, ve...
b27e299e47cddec462ba61668e50bdef914cd4fe
<|skeleton|> class FuelAndBattery: """Provides an accessible version of `status.FuelAndBattery`.""" def charging_start_time(self) -> Optional[datetime.datetime]: """The planned time the vehicle will start charging.""" <|body_0|> def from_vehicle_data(cls, vehicle_data: Dict): """Cr...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FuelAndBattery: """Provides an accessible version of `status.FuelAndBattery`.""" def charging_start_time(self) -> Optional[datetime.datetime]: """The planned time the vehicle will start charging.""" if self.charging_start_time_no_tz: return self.charging_start_time_no_tz.astim...
the_stack_v2_python_sparse
bimmer_connected/vehicle/fuel_and_battery.py
rikroe/bimmer_connected
train
0
1570a9e3f56f5326b90a087254f2cf8a76d175ce
[ "super(GibbsChain, self).__init__(net, rng, evidence)\nself.gibbs_distributions = {}\nfor node in self.net.nodes():\n self.gibbs_distributions[node] = gibbs.all_gibbs_distributions(node, rng)", "for node in self.net.nodes():\n if node not in self.evidence:\n self.update_node(node)", "markov_blanket...
<|body_start_0|> super(GibbsChain, self).__init__(net, rng, evidence) self.gibbs_distributions = {} for node in self.net.nodes(): self.gibbs_distributions[node] = gibbs.all_gibbs_distributions(node, rng) <|end_body_0|> <|body_start_1|> for node in self.net.nodes(): ...
A Gibbs Markov chain.
GibbsChain
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GibbsChain: """A Gibbs Markov chain.""" def __init__(self, net, rng, evidence): """Initialize Gibbs sampler. Args: net: a BayesNet rng: a RandomState evidence: a mapping from nodes to values""" <|body_0|> def transition(self): """Transition to next chain state by...
stack_v2_sparse_classes_36k_train_012490
5,157
no_license
[ { "docstring": "Initialize Gibbs sampler. Args: net: a BayesNet rng: a RandomState evidence: a mapping from nodes to values", "name": "__init__", "signature": "def __init__(self, net, rng, evidence)" }, { "docstring": "Transition to next chain state by randomly updating each node in net.", "...
3
stack_v2_sparse_classes_30k_train_012790
Implement the Python class `GibbsChain` described below. Class description: A Gibbs Markov chain. Method signatures and docstrings: - def __init__(self, net, rng, evidence): Initialize Gibbs sampler. Args: net: a BayesNet rng: a RandomState evidence: a mapping from nodes to values - def transition(self): Transition t...
Implement the Python class `GibbsChain` described below. Class description: A Gibbs Markov chain. Method signatures and docstrings: - def __init__(self, net, rng, evidence): Initialize Gibbs sampler. Args: net: a BayesNet rng: a RandomState evidence: a mapping from nodes to values - def transition(self): Transition t...
49630b731bd5b1c43eb015075cbd794428569f53
<|skeleton|> class GibbsChain: """A Gibbs Markov chain.""" def __init__(self, net, rng, evidence): """Initialize Gibbs sampler. Args: net: a BayesNet rng: a RandomState evidence: a mapping from nodes to values""" <|body_0|> def transition(self): """Transition to next chain state by...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GibbsChain: """A Gibbs Markov chain.""" def __init__(self, net, rng, evidence): """Initialize Gibbs sampler. Args: net: a BayesNet rng: a RandomState evidence: a mapping from nodes to values""" super(GibbsChain, self).__init__(net, rng, evidence) self.gibbs_distributions = {} ...
the_stack_v2_python_sparse
i3/mcmc.py
stuhlmueller/i3
train
5
ef85ee7e61a105aef7ad7fc91db103ca20edffcf
[ "self.ip_address = ip_address\nself.name = name\nself.vlan = vlan", "if dictionary is None:\n return None\nip_address = dictionary.get('ipAddress')\nname = dictionary.get('name')\nvlan = dictionary.get('vlan')\nreturn cls(ip_address, name, vlan)" ]
<|body_start_0|> self.ip_address = ip_address self.name = name self.vlan = vlan <|end_body_0|> <|body_start_1|> if dictionary is None: return None ip_address = dictionary.get('ipAddress') name = dictionary.get('name') vlan = dictionary.get('vlan') ...
Implementation of the 'FlashBladeNetworkInterface' model. Specifies network interface detail of a Flash Blade Storage Array. Attributes: ip_address (string): Specifies the IP address of the Pure Storage FlashBlade Array. name (string): Specifies the name of the network interface. vlan (int): Specifies the id of the VLA...
FlashBladeNetworkInterface
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FlashBladeNetworkInterface: """Implementation of the 'FlashBladeNetworkInterface' model. Specifies network interface detail of a Flash Blade Storage Array. Attributes: ip_address (string): Specifies the IP address of the Pure Storage FlashBlade Array. name (string): Specifies the name of the netw...
stack_v2_sparse_classes_36k_train_012491
1,868
permissive
[ { "docstring": "Constructor for the FlashBladeNetworkInterface class", "name": "__init__", "signature": "def __init__(self, ip_address=None, name=None, vlan=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary representation of...
2
null
Implement the Python class `FlashBladeNetworkInterface` described below. Class description: Implementation of the 'FlashBladeNetworkInterface' model. Specifies network interface detail of a Flash Blade Storage Array. Attributes: ip_address (string): Specifies the IP address of the Pure Storage FlashBlade Array. name (...
Implement the Python class `FlashBladeNetworkInterface` described below. Class description: Implementation of the 'FlashBladeNetworkInterface' model. Specifies network interface detail of a Flash Blade Storage Array. Attributes: ip_address (string): Specifies the IP address of the Pure Storage FlashBlade Array. name (...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class FlashBladeNetworkInterface: """Implementation of the 'FlashBladeNetworkInterface' model. Specifies network interface detail of a Flash Blade Storage Array. Attributes: ip_address (string): Specifies the IP address of the Pure Storage FlashBlade Array. name (string): Specifies the name of the netw...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FlashBladeNetworkInterface: """Implementation of the 'FlashBladeNetworkInterface' model. Specifies network interface detail of a Flash Blade Storage Array. Attributes: ip_address (string): Specifies the IP address of the Pure Storage FlashBlade Array. name (string): Specifies the name of the network interface...
the_stack_v2_python_sparse
cohesity_management_sdk/models/flash_blade_network_interface.py
cohesity/management-sdk-python
train
24
f735c1ecfddca8b864f4a04ebd4e3acad7119169
[ "deg = [0] * n\nedgeCounter = defaultdict(int)\nfor u, v in edges:\n u, v = (u - 1, v - 1)\n deg[u] += 1\n deg[v] += 1\n if u > v:\n u, v = (v, u)\n edgeCounter[u, v] += 1\ndegFreq = Counter(deg)\npairDegSum = [0] * (max(deg) * 2 + 2)\nfor deg1, freq1 in degFreq.items():\n for deg2, freq2 i...
<|body_start_0|> deg = [0] * n edgeCounter = defaultdict(int) for u, v in edges: u, v = (u - 1, v - 1) deg[u] += 1 deg[v] += 1 if u > v: u, v = (v, u) edgeCounter[u, v] += 1 degFreq = Counter(deg) pairDeg...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def countPairs(self, n: int, edges: List[List[int]], queries: List[int]) -> List[int]: """O(n+m+q) !无向图本质不同的度数只有根号m个.因此可以二重循环枚举度数.""" <|body_0|> def countPairs2(self, n: int, edges: List[List[int]], queries: List[int]) -> List[int]: """!排序+双指针 O(nlogn+q(n+m...
stack_v2_sparse_classes_36k_train_012492
3,486
no_license
[ { "docstring": "O(n+m+q) !无向图本质不同的度数只有根号m个.因此可以二重循环枚举度数.", "name": "countPairs", "signature": "def countPairs(self, n: int, edges: List[List[int]], queries: List[int]) -> List[int]" }, { "docstring": "!排序+双指针 O(nlogn+q(n+m))", "name": "countPairs2", "signature": "def countPairs2(self, n:...
2
stack_v2_sparse_classes_30k_train_010009
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countPairs(self, n: int, edges: List[List[int]], queries: List[int]) -> List[int]: O(n+m+q) !无向图本质不同的度数只有根号m个.因此可以二重循环枚举度数. - def countPairs2(self, n: int, edges: List[List[i...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countPairs(self, n: int, edges: List[List[int]], queries: List[int]) -> List[int]: O(n+m+q) !无向图本质不同的度数只有根号m个.因此可以二重循环枚举度数. - def countPairs2(self, n: int, edges: List[List[i...
7e79e26bb8f641868561b186e34c1127ed63c9e0
<|skeleton|> class Solution: def countPairs(self, n: int, edges: List[List[int]], queries: List[int]) -> List[int]: """O(n+m+q) !无向图本质不同的度数只有根号m个.因此可以二重循环枚举度数.""" <|body_0|> def countPairs2(self, n: int, edges: List[List[int]], queries: List[int]) -> List[int]: """!排序+双指针 O(nlogn+q(n+m...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def countPairs(self, n: int, edges: List[List[int]], queries: List[int]) -> List[int]: """O(n+m+q) !无向图本质不同的度数只有根号m个.因此可以二重循环枚举度数.""" deg = [0] * n edgeCounter = defaultdict(int) for u, v in edges: u, v = (u - 1, v - 1) deg[u] += 1 ...
the_stack_v2_python_sparse
7_graph/经典题/度数/1782. 统计点对的数目.py
981377660LMT/algorithm-study
train
225
ddcce92c09f66cba5252185319007086695f1f86
[ "test_donor1 = Donor('test_donor', [100.0])\ntest_donor2 = Donor('test_donor2', [200.0])\ntest_donor1.add_donation(float(50))\ntest_donor1.name = 'test_donor1'\ncomparison = test_donor1 < test_donor2\nexpected_letter = 'Dear test_donor1,\\n\\nThank you for your generous donation of $50.00.\\n\\nSincerely,\\nThe Cha...
<|body_start_0|> test_donor1 = Donor('test_donor', [100.0]) test_donor2 = Donor('test_donor2', [200.0]) test_donor1.add_donation(float(50)) test_donor1.name = 'test_donor1' comparison = test_donor1 < test_donor2 expected_letter = 'Dear test_donor1,\n\nThank you for your g...
Write a class containing a full suite of tests
TestMailroom
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestMailroom: """Write a class containing a full suite of tests""" def test_donor_class(self): """Check that the data for individual donors is being saved properly""" <|body_0|> def test_collection_class(self): """Check that the data for a collection of donors is...
stack_v2_sparse_classes_36k_train_012493
2,652
no_license
[ { "docstring": "Check that the data for individual donors is being saved properly", "name": "test_donor_class", "signature": "def test_donor_class(self)" }, { "docstring": "Check that the data for a collection of donors is being saved properly", "name": "test_collection_class", "signatur...
4
stack_v2_sparse_classes_30k_train_012546
Implement the Python class `TestMailroom` described below. Class description: Write a class containing a full suite of tests Method signatures and docstrings: - def test_donor_class(self): Check that the data for individual donors is being saved properly - def test_collection_class(self): Check that the data for a co...
Implement the Python class `TestMailroom` described below. Class description: Write a class containing a full suite of tests Method signatures and docstrings: - def test_donor_class(self): Check that the data for individual donors is being saved properly - def test_collection_class(self): Check that the data for a co...
e298b1151dab639659d8dfa56f47bcb43dd3438f
<|skeleton|> class TestMailroom: """Write a class containing a full suite of tests""" def test_donor_class(self): """Check that the data for individual donors is being saved properly""" <|body_0|> def test_collection_class(self): """Check that the data for a collection of donors is...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestMailroom: """Write a class containing a full suite of tests""" def test_donor_class(self): """Check that the data for individual donors is being saved properly""" test_donor1 = Donor('test_donor', [100.0]) test_donor2 = Donor('test_donor2', [200.0]) test_donor1.add_don...
the_stack_v2_python_sparse
students/Daniel_Spray/Lesson09/test_mailroom5.py
UWPCE-PythonCert-ClassRepos/Self_Paced-Online
train
13
4f97ec9cc945f95e9a154e731ea1dd9c84327d32
[ "wordAsSet = ''.join(set(word.lower()))\nwordLength = len(wordAsSet)\nindex = 0\nfor char in wordAsSet:\n if char not in self.row1:\n index = 0\n break\n if index == wordLength - 1:\n return True\n index += 1\nfor char in wordAsSet:\n if char not in self.row2:\n index = 0\n ...
<|body_start_0|> wordAsSet = ''.join(set(word.lower())) wordLength = len(wordAsSet) index = 0 for char in wordAsSet: if char not in self.row1: index = 0 break if index == wordLength - 1: return True index...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def testWord(self, word): """:type word: String :rtype: Bool""" <|body_0|> def findWords(self, words): """:type words: List[str] :rtype: List[str]""" <|body_1|> <|end_skeleton|> <|body_start_0|> wordAsSet = ''.join(set(word.lower())) ...
stack_v2_sparse_classes_36k_train_012494
2,350
no_license
[ { "docstring": ":type word: String :rtype: Bool", "name": "testWord", "signature": "def testWord(self, word)" }, { "docstring": ":type words: List[str] :rtype: List[str]", "name": "findWords", "signature": "def findWords(self, words)" } ]
2
stack_v2_sparse_classes_30k_train_002431
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def testWord(self, word): :type word: String :rtype: Bool - def findWords(self, words): :type words: List[str] :rtype: List[str]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def testWord(self, word): :type word: String :rtype: Bool - def findWords(self, words): :type words: List[str] :rtype: List[str] <|skeleton|> class Solution: def testWord(s...
db0351189611bfb3a06048b696f55d5511692274
<|skeleton|> class Solution: def testWord(self, word): """:type word: String :rtype: Bool""" <|body_0|> def findWords(self, words): """:type words: List[str] :rtype: List[str]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def testWord(self, word): """:type word: String :rtype: Bool""" wordAsSet = ''.join(set(word.lower())) wordLength = len(wordAsSet) index = 0 for char in wordAsSet: if char not in self.row1: index = 0 break ...
the_stack_v2_python_sparse
KeyboardRow.py
yufanglin/Basic-Python
train
0
f53387ca07a78c16686b8d2d36ebc41a1f92f01c
[ "db = get_dname()\nexternal_db = {'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': 'pg_primemall', 'USER': 'primemall', 'PASSWORD': 'primemall', 'HOST': '192.168.0.65', 'PORT': ''}\nprint(settings.DATABASES['web'])\nreturn 'web'", "if 'localhost:8000' == 'localhost:8000':\n DATABASES = {'external_db...
<|body_start_0|> db = get_dname() external_db = {'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': 'pg_primemall', 'USER': 'primemall', 'PASSWORD': 'primemall', 'HOST': '192.168.0.65', 'PORT': ''} print(settings.DATABASES['web']) return 'web' <|end_body_0|> <|body_start_1|> ...
DatabaseRouter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DatabaseRouter: def db_for_read(self, model, **hints): """"Point all read operations to the specific database.""" <|body_0|> def db_for_write(self, model, **hints): """Point all write operations to the specific database.""" <|body_1|> <|end_skeleton|> <|bod...
stack_v2_sparse_classes_36k_train_012495
7,159
no_license
[ { "docstring": "\"Point all read operations to the specific database.", "name": "db_for_read", "signature": "def db_for_read(self, model, **hints)" }, { "docstring": "Point all write operations to the specific database.", "name": "db_for_write", "signature": "def db_for_write(self, model...
2
null
Implement the Python class `DatabaseRouter` described below. Class description: Implement the DatabaseRouter class. Method signatures and docstrings: - def db_for_read(self, model, **hints): "Point all read operations to the specific database. - def db_for_write(self, model, **hints): Point all write operations to th...
Implement the Python class `DatabaseRouter` described below. Class description: Implement the DatabaseRouter class. Method signatures and docstrings: - def db_for_read(self, model, **hints): "Point all read operations to the specific database. - def db_for_write(self, model, **hints): Point all write operations to th...
6b084547bed2af43a67bada313d68e56f4228f96
<|skeleton|> class DatabaseRouter: def db_for_read(self, model, **hints): """"Point all read operations to the specific database.""" <|body_0|> def db_for_write(self, model, **hints): """Point all write operations to the specific database.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DatabaseRouter: def db_for_read(self, model, **hints): """"Point all read operations to the specific database.""" db = get_dname() external_db = {'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': 'pg_primemall', 'USER': 'primemall', 'PASSWORD': 'primemall', 'HOST': '192.168.0...
the_stack_v2_python_sparse
webservices/views/routers.py
obxlifco/Web-Picking-App-GoGrocery
train
0
37cec75c0862a16454ff11d73a081aa59cc4bd6a
[ "t = hashlib.sha1(seed).digest()\nkey = hashlib.sha1(t).digest()\nself.orig_key = key\nseed = hashlib.sha1(key).digest()\nself.key = key[:16]\nself.seed = seed[:16]", "p_size_bytes = p_size_bits // 8\nwhile True:\n prime_bytes = b''\n idx = 0\n while len(prime_bytes) <= p_size_bytes:\n encryptor =...
<|body_start_0|> t = hashlib.sha1(seed).digest() key = hashlib.sha1(t).digest() self.orig_key = key seed = hashlib.sha1(key).digest() self.key = key[:16] self.seed = seed[:16] <|end_body_0|> <|body_start_1|> p_size_bytes = p_size_bits // 8 while True: ...
Class for generating Keypair modulus for a given seed and bit size.
Generator
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Generator: """Class for generating Keypair modulus for a given seed and bit size.""" def __init__(self, seed: bytes): """Initializes the PRNG given an initial seed. Args: seed: the initial seed used in the PRNG.""" <|body_0|> def generate_prime(self, p_size_bits: int) ->...
stack_v2_sparse_classes_36k_train_012496
3,434
permissive
[ { "docstring": "Initializes the PRNG given an initial seed. Args: seed: the initial seed used in the PRNG.", "name": "__init__", "signature": "def __init__(self, seed: bytes)" }, { "docstring": "Generates a prime using Keypair PRNG. The prime is assembled by concatenating AES blocks. Original im...
3
stack_v2_sparse_classes_30k_test_000545
Implement the Python class `Generator` described below. Class description: Class for generating Keypair modulus for a given seed and bit size. Method signatures and docstrings: - def __init__(self, seed: bytes): Initializes the PRNG given an initial seed. Args: seed: the initial seed used in the PRNG. - def generate_...
Implement the Python class `Generator` described below. Class description: Class for generating Keypair modulus for a given seed and bit size. Method signatures and docstrings: - def __init__(self, seed: bytes): Initializes the PRNG given an initial seed. Args: seed: the initial seed used in the PRNG. - def generate_...
16e5f47fcc11f51d3fb58b50adddd075f4373bbc
<|skeleton|> class Generator: """Class for generating Keypair modulus for a given seed and bit size.""" def __init__(self, seed: bytes): """Initializes the PRNG given an initial seed. Args: seed: the initial seed used in the PRNG.""" <|body_0|> def generate_prime(self, p_size_bits: int) ->...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Generator: """Class for generating Keypair modulus for a given seed and bit size.""" def __init__(self, seed: bytes): """Initializes the PRNG given an initial seed. Args: seed: the initial seed used in the PRNG.""" t = hashlib.sha1(seed).digest() key = hashlib.sha1(t).digest() ...
the_stack_v2_python_sparse
paranoid_crypto/lib/keypair_generator.py
google/paranoid_crypto
train
766
fbd0ddc95ceb073b57f4c93ef662acf25584b37e
[ "l, r = (0, len(nums) - 1)\nwhile l <= r:\n mid = l + (r - l) // 2\n if nums[mid] == target:\n return True\n while l < mid and nums[l] == nums[mid]:\n l += 1\n if nums[l] <= nums[mid]:\n if nums[l] <= target < nums[mid]:\n r = mid - 1\n else:\n l = mid +...
<|body_start_0|> l, r = (0, len(nums) - 1) while l <= r: mid = l + (r - l) // 2 if nums[mid] == target: return True while l < mid and nums[l] == nums[mid]: l += 1 if nums[l] <= nums[mid]: if nums[l] <= target...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def search(self, nums, target): """:type nums: List[int] :type target: int :rtype: bool""" <|body_0|> def search0(self, nums, target): """:type nums: List[int] :type target: int :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_012497
2,200
no_license
[ { "docstring": ":type nums: List[int] :type target: int :rtype: bool", "name": "search", "signature": "def search(self, nums, target)" }, { "docstring": ":type nums: List[int] :type target: int :rtype: bool", "name": "search0", "signature": "def search0(self, nums, target)" } ]
2
stack_v2_sparse_classes_30k_train_020942
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def search(self, nums, target): :type nums: List[int] :type target: int :rtype: bool - def search0(self, nums, target): :type nums: List[int] :type target: int :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def search(self, nums, target): :type nums: List[int] :type target: int :rtype: bool - def search0(self, nums, target): :type nums: List[int] :type target: int :rtype: bool <|sk...
9e49b2c6003b957276737005d4aaac276b44d251
<|skeleton|> class Solution: def search(self, nums, target): """:type nums: List[int] :type target: int :rtype: bool""" <|body_0|> def search0(self, nums, target): """:type nums: 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 search(self, nums, target): """:type nums: List[int] :type target: int :rtype: bool""" l, r = (0, len(nums) - 1) while l <= r: mid = l + (r - l) // 2 if nums[mid] == target: return True while l < mid and nums[l] == nums[...
the_stack_v2_python_sparse
PythonCode/src/0081_Search_in_Rotated_Sorted_Array_II.py
oneyuan/CodeforFun
train
0
41d62cabb6a6adbc9dee219516a7470522384061
[ "n = len(arr)\nres = 0\npre = [0] * (n + 1)\nfor i in range(n):\n pre[i + 1] = pre[i] ^ arr[i]\nfor i in range(n):\n for k in range(i + 2, n + 1):\n if pre[i] == pre[k]:\n res += k - i - 1\nreturn res", "n = len(arr)\nres = 0\npre = 0\ncnt, total = (Counter(), Counter())\nfor i in range(n)...
<|body_start_0|> n = len(arr) res = 0 pre = [0] * (n + 1) for i in range(n): pre[i + 1] = pre[i] ^ arr[i] for i in range(n): for k in range(i + 2, n + 1): if pre[i] == pre[k]: res += k - i - 1 return res <|end_bo...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def countTriplets1(self, arr: List[int]) -> int: """思路: 1. 由题意得,arr[i]^……^arr[k]==0,k>i,我们可以想到前缀和 2. 如果pre[i]==pre[k],k>=i+2那么[i+1,k]之间所有数都满足条件 @param arr: @return:""" <|body_0|> def countTriplets2(self, arr: List[int]) -> int: """思路: 1. 在j1,j2,……,jm中都满足,则总...
stack_v2_sparse_classes_36k_train_012498
2,490
no_license
[ { "docstring": "思路: 1. 由题意得,arr[i]^……^arr[k]==0,k>i,我们可以想到前缀和 2. 如果pre[i]==pre[k],k>=i+2那么[i+1,k]之间所有数都满足条件 @param arr: @return:", "name": "countTriplets1", "signature": "def countTriplets1(self, arr: List[int]) -> int" }, { "docstring": "思路: 1. 在j1,j2,……,jm中都满足,则总数为(i-j1)+(i-j2)+……+(i-jm) 2. 所以...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countTriplets1(self, arr: List[int]) -> int: 思路: 1. 由题意得,arr[i]^……^arr[k]==0,k>i,我们可以想到前缀和 2. 如果pre[i]==pre[k],k>=i+2那么[i+1,k]之间所有数都满足条件 @param arr: @return: - def countTripl...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def countTriplets1(self, arr: List[int]) -> int: 思路: 1. 由题意得,arr[i]^……^arr[k]==0,k>i,我们可以想到前缀和 2. 如果pre[i]==pre[k],k>=i+2那么[i+1,k]之间所有数都满足条件 @param arr: @return: - def countTripl...
e43ee86c5a8cdb808da09b4b6138e10275abadb5
<|skeleton|> class Solution: def countTriplets1(self, arr: List[int]) -> int: """思路: 1. 由题意得,arr[i]^……^arr[k]==0,k>i,我们可以想到前缀和 2. 如果pre[i]==pre[k],k>=i+2那么[i+1,k]之间所有数都满足条件 @param arr: @return:""" <|body_0|> def countTriplets2(self, arr: List[int]) -> int: """思路: 1. 在j1,j2,……,jm中都满足,则总...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def countTriplets1(self, arr: List[int]) -> int: """思路: 1. 由题意得,arr[i]^……^arr[k]==0,k>i,我们可以想到前缀和 2. 如果pre[i]==pre[k],k>=i+2那么[i+1,k]之间所有数都满足条件 @param arr: @return:""" n = len(arr) res = 0 pre = [0] * (n + 1) for i in range(n): pre[i + 1] = pre[i] ...
the_stack_v2_python_sparse
LeetCode/位运算/1442. 形成两个异或相等数组的三元组数目.py
yiming1012/MyLeetCode
train
2
ffe377f13e89f893afa8cb986f7461b23fe96b79
[ "super(CurriculumWrapper, self).__init__(env)\nself.interventions_curriculum = Curriculum(intervention_actors=intervention_actors, actives=actives)\nself.interventions_curriculum.initialize_actors(env=env)\nself.env.add_wrapper_info({'curriculum_environment': self.interventions_curriculum.get_params()})\nself._elap...
<|body_start_0|> super(CurriculumWrapper, self).__init__(env) self.interventions_curriculum = Curriculum(intervention_actors=intervention_actors, actives=actives) self.interventions_curriculum.initialize_actors(env=env) self.env.add_wrapper_info({'curriculum_environment': self.interventi...
CurriculumWrapper
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CurriculumWrapper: def __init__(self, env, intervention_actors, actives): """:param env: (causal_world.CausalWorld) the environment to convert. :param intervention_actors: (list) list of intervention actors :param actives: (list of tuples) each tuple indicates (episode_start, episode_end...
stack_v2_sparse_classes_36k_train_012499
4,459
permissive
[ { "docstring": ":param env: (causal_world.CausalWorld) the environment to convert. :param intervention_actors: (list) list of intervention actors :param actives: (list of tuples) each tuple indicates (episode_start, episode_end, episode_periodicity, time_step_for_intervention)", "name": "__init__", "sig...
3
null
Implement the Python class `CurriculumWrapper` described below. Class description: Implement the CurriculumWrapper class. Method signatures and docstrings: - def __init__(self, env, intervention_actors, actives): :param env: (causal_world.CausalWorld) the environment to convert. :param intervention_actors: (list) lis...
Implement the Python class `CurriculumWrapper` described below. Class description: Implement the CurriculumWrapper class. Method signatures and docstrings: - def __init__(self, env, intervention_actors, actives): :param env: (causal_world.CausalWorld) the environment to convert. :param intervention_actors: (list) lis...
548e66c36fba01125cf6290992dfd833ae42709b
<|skeleton|> class CurriculumWrapper: def __init__(self, env, intervention_actors, actives): """:param env: (causal_world.CausalWorld) the environment to convert. :param intervention_actors: (list) list of intervention actors :param actives: (list of tuples) each tuple indicates (episode_start, episode_end...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CurriculumWrapper: def __init__(self, env, intervention_actors, actives): """:param env: (causal_world.CausalWorld) the environment to convert. :param intervention_actors: (list) list of intervention actors :param actives: (list of tuples) each tuple indicates (episode_start, episode_end, episode_peri...
the_stack_v2_python_sparse
causal_world/wrappers/curriculum_wrappers.py
InspectorDidi/CausalWorld
train
0