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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
981db8e6227436fa28617cab2656a7401f230519 | [
"self.set_header('content-type', 'application/json')\ntry:\n strategy = StrategyCustDao().get_strategy_by_app_and_name(app, name).get_dict()\n if self.group.is_root():\n self.process_error(-1, 'root用户组没有权限查询策略')\n elif self.group.is_manager():\n self.finish(json_dumps({'status': 200, 'msg': '... | <|body_start_0|>
self.set_header('content-type', 'application/json')
try:
strategy = StrategyCustDao().get_strategy_by_app_and_name(app, name).get_dict()
if self.group.is_root():
self.process_error(-1, 'root用户组没有权限查询策略')
elif self.group.is_manager():
... | StrategyQueryHandler | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StrategyQueryHandler:
def get(self, app, name):
"""get a specific strategy @API summary: get a specific strategy notes: get an strategy according to its app and name tags: - nebula parameters: - name: app in: path required: true type: string description: the app of the strategy - name: n... | stack_v2_sparse_classes_36k_train_004400 | 20,036 | permissive | [
{
"docstring": "get a specific strategy @API summary: get a specific strategy notes: get an strategy according to its app and name tags: - nebula parameters: - name: app in: path required: true type: string description: the app of the strategy - name: name in: path required: true type: string description: the n... | 3 | stack_v2_sparse_classes_30k_val_000936 | Implement the Python class `StrategyQueryHandler` described below.
Class description:
Implement the StrategyQueryHandler class.
Method signatures and docstrings:
- def get(self, app, name): get a specific strategy @API summary: get a specific strategy notes: get an strategy according to its app and name tags: - nebul... | Implement the Python class `StrategyQueryHandler` described below.
Class description:
Implement the StrategyQueryHandler class.
Method signatures and docstrings:
- def get(self, app, name): get a specific strategy @API summary: get a specific strategy notes: get an strategy according to its app and name tags: - nebul... | 2e32e6e7b225e0bd87ee8c847c22862f12c51bb1 | <|skeleton|>
class StrategyQueryHandler:
def get(self, app, name):
"""get a specific strategy @API summary: get a specific strategy notes: get an strategy according to its app and name tags: - nebula parameters: - name: app in: path required: true type: string description: the app of the strategy - name: n... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class StrategyQueryHandler:
def get(self, app, name):
"""get a specific strategy @API summary: get a specific strategy notes: get an strategy according to its app and name tags: - nebula parameters: - name: app in: path required: true type: string description: the app of the strategy - name: name in: path r... | the_stack_v2_python_sparse | nebula/views/strategy.py | threathunterX/nebula_web | train | 2 | |
ba27ba73c8af398383de5b82b993ee9c2890c3cc | [
"for k, v in params.items():\n if v == str(None):\n params[k] = None\nnetworks = cxmate.Adapter.to_networkx(input_stream)\nnodedata_tmp = []\nnet = networks[0]\nnet.graph['label'] = OUTPUT_LABEL\nif params['prog'] == 'twopi' and 'root' in net.graph.keys():\n params['root'] = net.graph['root']\nfor n, n... | <|body_start_0|>
for k, v in params.items():
if v == str(None):
params[k] = None
networks = cxmate.Adapter.to_networkx(input_stream)
nodedata_tmp = []
net = networks[0]
net.graph['label'] = OUTPUT_LABEL
if params['prog'] == 'twopi' and 'root' i... | NxLayoutService | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NxLayoutService:
def process(self, params, input_stream):
"""CI service for creating node positions for the given network data using Graphviz."""
<|body_0|>
def outputStream(self, networks, pos):
"""Creates a CX element generator added cartesianCoordinate from a list... | stack_v2_sparse_classes_36k_train_004401 | 2,430 | permissive | [
{
"docstring": "CI service for creating node positions for the given network data using Graphviz.",
"name": "process",
"signature": "def process(self, params, input_stream)"
},
{
"docstring": "Creates a CX element generator added cartesianCoordinate from a list of networkx objects. :params netwo... | 2 | stack_v2_sparse_classes_30k_train_021304 | Implement the Python class `NxLayoutService` described below.
Class description:
Implement the NxLayoutService class.
Method signatures and docstrings:
- def process(self, params, input_stream): CI service for creating node positions for the given network data using Graphviz.
- def outputStream(self, networks, pos): ... | Implement the Python class `NxLayoutService` described below.
Class description:
Implement the NxLayoutService class.
Method signatures and docstrings:
- def process(self, params, input_stream): CI service for creating node positions for the given network data using Graphviz.
- def outputStream(self, networks, pos): ... | 97c0237381528ac72f76c600071573fd1cbcdce6 | <|skeleton|>
class NxLayoutService:
def process(self, params, input_stream):
"""CI service for creating node positions for the given network data using Graphviz."""
<|body_0|>
def outputStream(self, networks, pos):
"""Creates a CX element generator added cartesianCoordinate from a list... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NxLayoutService:
def process(self, params, input_stream):
"""CI service for creating node positions for the given network data using Graphviz."""
for k, v in params.items():
if v == str(None):
params[k] = None
networks = cxmate.Adapter.to_networkx(input_stre... | the_stack_v2_python_sparse | services/nx_layout/service/service.py | idekerlab/graph-services | train | 0 | |
3b3ee9358282c726bcfc0e91582a55c1bd53cfab | [
"search = self\nif document_pid:\n search = search.filter('term', document_pid=document_pid)\nelse:\n raise MissingRequiredParameterError(description='document_pid is required')\nif filter_states:\n search = search.filter('terms', state=filter_states)\nelif exclude_states:\n search = search.exclude('ter... | <|body_start_0|>
search = self
if document_pid:
search = search.filter('term', document_pid=document_pid)
else:
raise MissingRequiredParameterError(description='document_pid is required')
if filter_states:
search = search.filter('terms', state=filter_s... | RecordsSearch for requests. | DocumentRequestSearch | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DocumentRequestSearch:
"""RecordsSearch for requests."""
def search_by_document_pid(self, document_pid=None, filter_states=None, exclude_states=None):
"""Retrieve requests based on the given document pid."""
<|body_0|>
def search_by_patron_pid(self, patron_pid=None):
... | stack_v2_sparse_classes_36k_train_004402 | 1,495 | permissive | [
{
"docstring": "Retrieve requests based on the given document pid.",
"name": "search_by_document_pid",
"signature": "def search_by_document_pid(self, document_pid=None, filter_states=None, exclude_states=None)"
},
{
"docstring": "Search by patron pid.",
"name": "search_by_patron_pid",
"s... | 2 | null | Implement the Python class `DocumentRequestSearch` described below.
Class description:
RecordsSearch for requests.
Method signatures and docstrings:
- def search_by_document_pid(self, document_pid=None, filter_states=None, exclude_states=None): Retrieve requests based on the given document pid.
- def search_by_patron... | Implement the Python class `DocumentRequestSearch` described below.
Class description:
RecordsSearch for requests.
Method signatures and docstrings:
- def search_by_document_pid(self, document_pid=None, filter_states=None, exclude_states=None): Retrieve requests based on the given document pid.
- def search_by_patron... | 1c36526e85510100c5f64059518d1b716d87ac10 | <|skeleton|>
class DocumentRequestSearch:
"""RecordsSearch for requests."""
def search_by_document_pid(self, document_pid=None, filter_states=None, exclude_states=None):
"""Retrieve requests based on the given document pid."""
<|body_0|>
def search_by_patron_pid(self, patron_pid=None):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DocumentRequestSearch:
"""RecordsSearch for requests."""
def search_by_document_pid(self, document_pid=None, filter_states=None, exclude_states=None):
"""Retrieve requests based on the given document pid."""
search = self
if document_pid:
search = search.filter('term',... | the_stack_v2_python_sparse | invenio_app_ils/document_requests/search.py | inveniosoftware/invenio-app-ils | train | 64 |
ff14f9c959ef3a3497975e4138158316719050b0 | [
"T = len(self.x)\ndLdx = np.zeros((T, self.input_size))\nself.nodes.reset_error()\nfor t in xrange(T):\n dLdp = dLds[t] * self.acfun.derivate(self.s[t])\n self.nodes.dLdu += np.outer(dLdp, self.x[t])\n if self.en_bias:\n self.nodes.dLdb += dLdp\n dLdx[t] = np.dot(self.nodes.u.T, dLdp)\nself.nodes... | <|body_start_0|>
T = len(self.x)
dLdx = np.zeros((T, self.input_size))
self.nodes.reset_error()
for t in xrange(T):
dLdp = dLds[t] * self.acfun.derivate(self.s[t])
self.nodes.dLdu += np.outer(dLdp, self.x[t])
if self.en_bias:
self.nodes... | Feed-forward neural network. | FNN | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FNN:
"""Feed-forward neural network."""
def update(self, dLds, alpha, beta):
"""Update neural network's parameters using stochastic gradient descent(SGD) method. :Param dLds: error gradients of hidden layer's outputs. :Param alpha: learning rate :Param beta: regularization parameter"... | stack_v2_sparse_classes_36k_train_004403 | 1,800 | permissive | [
{
"docstring": "Update neural network's parameters using stochastic gradient descent(SGD) method. :Param dLds: error gradients of hidden layer's outputs. :Param alpha: learning rate :Param beta: regularization parameter",
"name": "update",
"signature": "def update(self, dLds, alpha, beta)"
},
{
... | 2 | stack_v2_sparse_classes_30k_train_012481 | Implement the Python class `FNN` described below.
Class description:
Feed-forward neural network.
Method signatures and docstrings:
- def update(self, dLds, alpha, beta): Update neural network's parameters using stochastic gradient descent(SGD) method. :Param dLds: error gradients of hidden layer's outputs. :Param al... | Implement the Python class `FNN` described below.
Class description:
Feed-forward neural network.
Method signatures and docstrings:
- def update(self, dLds, alpha, beta): Update neural network's parameters using stochastic gradient descent(SGD) method. :Param dLds: error gradients of hidden layer's outputs. :Param al... | 1a08b12767cf028626f0368b993933092390f28d | <|skeleton|>
class FNN:
"""Feed-forward neural network."""
def update(self, dLds, alpha, beta):
"""Update neural network's parameters using stochastic gradient descent(SGD) method. :Param dLds: error gradients of hidden layer's outputs. :Param alpha: learning rate :Param beta: regularization parameter"... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FNN:
"""Feed-forward neural network."""
def update(self, dLds, alpha, beta):
"""Update neural network's parameters using stochastic gradient descent(SGD) method. :Param dLds: error gradients of hidden layer's outputs. :Param alpha: learning rate :Param beta: regularization parameter"""
T ... | the_stack_v2_python_sparse | nnlm/nnm/fnn.py | dengliangshi/pynnlms | train | 11 |
3c83ab4713119336ab3daa4880399cc30acf5f05 | [
"fd_mock = mock.mock_open()\nargs = ['script_name', 'gtest', '--test-exe=out_eve/Release/base_unittests', '--board=eve', '--path-to-outdir=out_eve/Release', '--use-vm' if use_vm else '--device=localhost:2222']\nif stop_ui:\n args.append('--stop-ui')\nwith mock.patch.object(sys, 'argv', args), mock.patch.object(t... | <|body_start_0|>
fd_mock = mock.mock_open()
args = ['script_name', 'gtest', '--test-exe=out_eve/Release/base_unittests', '--board=eve', '--path-to-outdir=out_eve/Release', '--use-vm' if use_vm else '--device=localhost:2222']
if stop_ui:
args.append('--stop-ui')
with mock.patc... | GTestTest | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class GTestTest:
def test_gtest(self, use_vm, stop_ui):
"""Tests running a gtest."""
<|body_0|>
def test_gtest_with_vpython(self):
"""Tests building a gtest with --vpython-dir."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
fd_mock = mock.mock_open()
... | stack_v2_sparse_classes_36k_train_004404 | 12,985 | permissive | [
{
"docstring": "Tests running a gtest.",
"name": "test_gtest",
"signature": "def test_gtest(self, use_vm, stop_ui)"
},
{
"docstring": "Tests building a gtest with --vpython-dir.",
"name": "test_gtest_with_vpython",
"signature": "def test_gtest_with_vpython(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_001548 | Implement the Python class `GTestTest` described below.
Class description:
Implement the GTestTest class.
Method signatures and docstrings:
- def test_gtest(self, use_vm, stop_ui): Tests running a gtest.
- def test_gtest_with_vpython(self): Tests building a gtest with --vpython-dir. | Implement the Python class `GTestTest` described below.
Class description:
Implement the GTestTest class.
Method signatures and docstrings:
- def test_gtest(self, use_vm, stop_ui): Tests running a gtest.
- def test_gtest_with_vpython(self): Tests building a gtest with --vpython-dir.
<|skeleton|>
class GTestTest:
... | a401d6cf4f7bf0e2d2e964c512ebb923c3d8832c | <|skeleton|>
class GTestTest:
def test_gtest(self, use_vm, stop_ui):
"""Tests running a gtest."""
<|body_0|>
def test_gtest_with_vpython(self):
"""Tests building a gtest with --vpython-dir."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class GTestTest:
def test_gtest(self, use_vm, stop_ui):
"""Tests running a gtest."""
fd_mock = mock.mock_open()
args = ['script_name', 'gtest', '--test-exe=out_eve/Release/base_unittests', '--board=eve', '--path-to-outdir=out_eve/Release', '--use-vm' if use_vm else '--device=localhost:2222']... | the_stack_v2_python_sparse | build/chromeos/test_runner_test.py | chromium/chromium | train | 17,408 | |
948465607d5d900b53e50bf6d6c5af150c9f8456 | [
"super(ContinuousConvGenerator, self).__init__()\nself.design_shape = design_shape\nself.latent_size = latent_size\nself.embed_0 = tfkl.Dense(hidden)\nself.embed_0.build((None, 1))\nself.dense_0 = tfkl.Conv1D(hidden, 3, strides=1, padding='same')\nself.dense_0.build((None, None, latent_size + hidden))\nself.ln_0 = ... | <|body_start_0|>
super(ContinuousConvGenerator, self).__init__()
self.design_shape = design_shape
self.latent_size = latent_size
self.embed_0 = tfkl.Dense(hidden)
self.embed_0.build((None, 1))
self.dense_0 = tfkl.Conv1D(hidden, 3, strides=1, padding='same')
self.d... | A Fully Connected Network conditioned on a score | ContinuousConvGenerator | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ContinuousConvGenerator:
"""A Fully Connected Network conditioned on a score"""
def __init__(self, design_shape, latent_size, hidden=50):
"""Create a fully connected architecture using keras that can process several parallel streams of weights and biases Args: design_shape: List[int]... | stack_v2_sparse_classes_36k_train_004405 | 30,757 | permissive | [
{
"docstring": "Create a fully connected architecture using keras that can process several parallel streams of weights and biases Args: design_shape: List[int] a list of tuple of integers that represents the shape of a single design for a particular task latent_size: int the number of hidden units in the latent... | 2 | stack_v2_sparse_classes_30k_train_001860 | Implement the Python class `ContinuousConvGenerator` described below.
Class description:
A Fully Connected Network conditioned on a score
Method signatures and docstrings:
- def __init__(self, design_shape, latent_size, hidden=50): Create a fully connected architecture using keras that can process several parallel st... | Implement the Python class `ContinuousConvGenerator` described below.
Class description:
A Fully Connected Network conditioned on a score
Method signatures and docstrings:
- def __init__(self, design_shape, latent_size, hidden=50): Create a fully connected architecture using keras that can process several parallel st... | d46ff40d8b665953afb64a3332ddf1953b8a0766 | <|skeleton|>
class ContinuousConvGenerator:
"""A Fully Connected Network conditioned on a score"""
def __init__(self, design_shape, latent_size, hidden=50):
"""Create a fully connected architecture using keras that can process several parallel streams of weights and biases Args: design_shape: List[int]... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ContinuousConvGenerator:
"""A Fully Connected Network conditioned on a score"""
def __init__(self, design_shape, latent_size, hidden=50):
"""Create a fully connected architecture using keras that can process several parallel streams of weights and biases Args: design_shape: List[int] a list of tu... | the_stack_v2_python_sparse | design_baselines/mins/nets.py | stjordanis/design-baselines | train | 0 |
91b7cc416e070f71d64f2648313fe832105774e5 | [
"self.pre_processor = TextProcessor([white_space_remover_upmc, sub_deid_patterns_upmc])\nself.tokenizer = CoreNLPTokenizer()\nself.post_processor = TextProcessor([AbbrDetector(abbr_inventory_path)])\nself.filter_processor = TextProcessor([TextTokenFilter(), repeat_non_word_remover])\ntrain_path = train_processed_pa... | <|body_start_0|>
self.pre_processor = TextProcessor([white_space_remover_upmc, sub_deid_patterns_upmc])
self.tokenizer = CoreNLPTokenizer()
self.post_processor = TextProcessor([AbbrDetector(abbr_inventory_path)])
self.filter_processor = TextProcessor([TextTokenFilter(), repeat_non_word_r... | AbbrDisambiguation | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AbbrDisambiguation:
def __init__(self, train_processed_path, abbr_inventory_path, use_pretrain=False, use_softmax=False):
"""Initialize environment & model."""
<|body_0|>
def process_single_text(self, text, save_json_path=None):
"""Process one text."""
<|body... | stack_v2_sparse_classes_36k_train_004406 | 11,517 | no_license | [
{
"docstring": "Initialize environment & model.",
"name": "__init__",
"signature": "def __init__(self, train_processed_path, abbr_inventory_path, use_pretrain=False, use_softmax=False)"
},
{
"docstring": "Process one text.",
"name": "process_single_text",
"signature": "def process_single... | 3 | stack_v2_sparse_classes_30k_train_021528 | Implement the Python class `AbbrDisambiguation` described below.
Class description:
Implement the AbbrDisambiguation class.
Method signatures and docstrings:
- def __init__(self, train_processed_path, abbr_inventory_path, use_pretrain=False, use_softmax=False): Initialize environment & model.
- def process_single_tex... | Implement the Python class `AbbrDisambiguation` described below.
Class description:
Implement the AbbrDisambiguation class.
Method signatures and docstrings:
- def __init__(self, train_processed_path, abbr_inventory_path, use_pretrain=False, use_softmax=False): Initialize environment & model.
- def process_single_tex... | 2d47772ca24aa5a71c1cc467635c74136b5da38b | <|skeleton|>
class AbbrDisambiguation:
def __init__(self, train_processed_path, abbr_inventory_path, use_pretrain=False, use_softmax=False):
"""Initialize environment & model."""
<|body_0|>
def process_single_text(self, text, save_json_path=None):
"""Process one text."""
<|body... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AbbrDisambiguation:
def __init__(self, train_processed_path, abbr_inventory_path, use_pretrain=False, use_softmax=False):
"""Initialize environment & model."""
self.pre_processor = TextProcessor([white_space_remover_upmc, sub_deid_patterns_upmc])
self.tokenizer = CoreNLPTokenizer()
... | the_stack_v2_python_sparse | pipeline/fasttext.py | Sanqiang/wsd | train | 4 | |
cc878044d30b3563836322d6f429d72294c9dd17 | [
"request = current.request\nsettings = current.deployment_settings\nscope = 'profile'\nredirect_uri = '%s/%s/default/humanitarian_id/login' % (settings.get_base_public_url(), request.application)\nOAuthAccount.__init__(self, client_id=channel['id'], client_secret=channel['secret'], auth_url=self.AUTH_URL, token_url... | <|body_start_0|>
request = current.request
settings = current.deployment_settings
scope = 'profile'
redirect_uri = '%s/%s/default/humanitarian_id/login' % (settings.get_base_public_url(), request.application)
OAuthAccount.__init__(self, client_id=channel['id'], client_secret=chan... | OAuth implementation for Humanitarian.ID https://docs.google.com/document/d/1-FGDOo2BkhuclxqHcBjCprywZKE_wA6IFTbrs8W26i0 | HumanitarianIDAccount | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class HumanitarianIDAccount:
"""OAuth implementation for Humanitarian.ID https://docs.google.com/document/d/1-FGDOo2BkhuclxqHcBjCprywZKE_wA6IFTbrs8W26i0"""
def __init__(self, channel):
"""Constructor @param channel: dict with Humanitarian.ID API credentials: {id=clientID, secret=clientSecr... | stack_v2_sparse_classes_36k_train_004407 | 31,965 | permissive | [
{
"docstring": "Constructor @param channel: dict with Humanitarian.ID API credentials: {id=clientID, secret=clientSecret}",
"name": "__init__",
"signature": "def __init__(self, channel)"
},
{
"docstring": "Build the url opener for managing HTTP Basic Authentication",
"name": "__build_url_ope... | 6 | stack_v2_sparse_classes_30k_train_001484 | Implement the Python class `HumanitarianIDAccount` described below.
Class description:
OAuth implementation for Humanitarian.ID https://docs.google.com/document/d/1-FGDOo2BkhuclxqHcBjCprywZKE_wA6IFTbrs8W26i0
Method signatures and docstrings:
- def __init__(self, channel): Constructor @param channel: dict with Humanit... | Implement the Python class `HumanitarianIDAccount` described below.
Class description:
OAuth implementation for Humanitarian.ID https://docs.google.com/document/d/1-FGDOo2BkhuclxqHcBjCprywZKE_wA6IFTbrs8W26i0
Method signatures and docstrings:
- def __init__(self, channel): Constructor @param channel: dict with Humanit... | 7ec4b959d009daf26d5ca6ce91dd9c3c0bd978d6 | <|skeleton|>
class HumanitarianIDAccount:
"""OAuth implementation for Humanitarian.ID https://docs.google.com/document/d/1-FGDOo2BkhuclxqHcBjCprywZKE_wA6IFTbrs8W26i0"""
def __init__(self, channel):
"""Constructor @param channel: dict with Humanitarian.ID API credentials: {id=clientID, secret=clientSecr... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class HumanitarianIDAccount:
"""OAuth implementation for Humanitarian.ID https://docs.google.com/document/d/1-FGDOo2BkhuclxqHcBjCprywZKE_wA6IFTbrs8W26i0"""
def __init__(self, channel):
"""Constructor @param channel: dict with Humanitarian.ID API credentials: {id=clientID, secret=clientSecret}"""
... | the_stack_v2_python_sparse | modules/core/aaa/oauth.py | nursix/drkcm | train | 3 |
1c0907e96f8dea93c4d9666cbfd003d21b5e3cea | [
"self._form_fields = form_fields\nself._data_id = form_fields['id'].value\nif results_path is not None:\n self._results_path = normpath(str(results_path))\nelse:\n self._results_path = None\nself._return_format = str(return_format)\nself.WaitStylePath = None\nself.ResultStylePath = None",
"file_extension = ... | <|body_start_0|>
self._form_fields = form_fields
self._data_id = form_fields['id'].value
if results_path is not None:
self._results_path = normpath(str(results_path))
else:
self._results_path = None
self._return_format = str(return_format)
self.Wai... | Object to check for results and send them back to client | ResultsRetriever | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ResultsRetriever:
"""Object to check for results and send them back to client"""
def __init__(self, form_fields, results_path, return_format):
"""Fill properties from form inputs form_fields: a FieldStorage or FieldStorage-like object containing form inputs results_path: the path spe... | stack_v2_sparse_classes_36k_train_004408 | 6,509 | no_license | [
{
"docstring": "Fill properties from form inputs form_fields: a FieldStorage or FieldStorage-like object containing form inputs results_path: the path specifying the directory in which results files will be saved return_format: the format that the browser should receive (xml, html, svg, etc.)",
"name": "__i... | 6 | null | Implement the Python class `ResultsRetriever` described below.
Class description:
Object to check for results and send them back to client
Method signatures and docstrings:
- def __init__(self, form_fields, results_path, return_format): Fill properties from form inputs form_fields: a FieldStorage or FieldStorage-like... | Implement the Python class `ResultsRetriever` described below.
Class description:
Object to check for results and send them back to client
Method signatures and docstrings:
- def __init__(self, form_fields, results_path, return_format): Fill properties from form inputs form_fields: a FieldStorage or FieldStorage-like... | b49442bd793a743188a43809903dc140512420b7 | <|skeleton|>
class ResultsRetriever:
"""Object to check for results and send them back to client"""
def __init__(self, form_fields, results_path, return_format):
"""Fill properties from form inputs form_fields: a FieldStorage or FieldStorage-like object containing form inputs results_path: the path spe... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ResultsRetriever:
"""Object to check for results and send them back to client"""
def __init__(self, form_fields, results_path, return_format):
"""Fill properties from form inputs form_fields: a FieldStorage or FieldStorage-like object containing form inputs results_path: the path specifying the d... | the_stack_v2_python_sparse | old_cogent/www/results_retriever.py | pycogent/old-cogent | train | 0 |
98154d085080d4186595a3baa9a24819483d43c2 | [
"self.max_power = max_power\nself.min_power = min_power\nself.min_bitrate = min_bitrate\nself.valid_auto_channels = valid_auto_channels\nself.ax_enabled = ax_enabled\nself.rxsop = rxsop",
"if dictionary is None:\n return None\nmax_power = dictionary.get('maxPower')\nmin_power = dictionary.get('minPower')\nmin_... | <|body_start_0|>
self.max_power = max_power
self.min_power = min_power
self.min_bitrate = min_bitrate
self.valid_auto_channels = valid_auto_channels
self.ax_enabled = ax_enabled
self.rxsop = rxsop
<|end_body_0|>
<|body_start_1|>
if dictionary is None:
... | Implementation of the 'TwoFourGhzSettings1' model. Settings related to 2.4Ghz band Attributes: max_power (int): Sets max power (dBm) of 2.4Ghz band. Can be integer between 5 and 30. min_power (int): Sets min power (dBm) of 2.4Ghz band. Can be integer between 5 and 30. min_bitrate (float): Sets min bitrate (Mbps) of 2.4... | TwoFourGhzSettings1Model | [
"MIT",
"Python-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TwoFourGhzSettings1Model:
"""Implementation of the 'TwoFourGhzSettings1' model. Settings related to 2.4Ghz band Attributes: max_power (int): Sets max power (dBm) of 2.4Ghz band. Can be integer between 5 and 30. min_power (int): Sets min power (dBm) of 2.4Ghz band. Can be integer between 5 and 30.... | stack_v2_sparse_classes_36k_train_004409 | 3,411 | permissive | [
{
"docstring": "Constructor for the TwoFourGhzSettings1Model class",
"name": "__init__",
"signature": "def __init__(self, max_power=None, min_power=None, min_bitrate=None, valid_auto_channels=None, ax_enabled=None, rxsop=None)"
},
{
"docstring": "Creates an instance of this model from a dictiona... | 2 | null | Implement the Python class `TwoFourGhzSettings1Model` described below.
Class description:
Implementation of the 'TwoFourGhzSettings1' model. Settings related to 2.4Ghz band Attributes: max_power (int): Sets max power (dBm) of 2.4Ghz band. Can be integer between 5 and 30. min_power (int): Sets min power (dBm) of 2.4Ghz... | Implement the Python class `TwoFourGhzSettings1Model` described below.
Class description:
Implementation of the 'TwoFourGhzSettings1' model. Settings related to 2.4Ghz band Attributes: max_power (int): Sets max power (dBm) of 2.4Ghz band. Can be integer between 5 and 30. min_power (int): Sets min power (dBm) of 2.4Ghz... | 9894089eb013318243ae48869cc5130eb37f80c0 | <|skeleton|>
class TwoFourGhzSettings1Model:
"""Implementation of the 'TwoFourGhzSettings1' model. Settings related to 2.4Ghz band Attributes: max_power (int): Sets max power (dBm) of 2.4Ghz band. Can be integer between 5 and 30. min_power (int): Sets min power (dBm) of 2.4Ghz band. Can be integer between 5 and 30.... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TwoFourGhzSettings1Model:
"""Implementation of the 'TwoFourGhzSettings1' model. Settings related to 2.4Ghz band Attributes: max_power (int): Sets max power (dBm) of 2.4Ghz band. Can be integer between 5 and 30. min_power (int): Sets min power (dBm) of 2.4Ghz band. Can be integer between 5 and 30. min_bitrate ... | the_stack_v2_python_sparse | meraki_sdk/models/two_four_ghz_settings_1_model.py | RaulCatalano/meraki-python-sdk | train | 1 |
fcf844f8394eb89daf71b9ee27c79e74f78e0e54 | [
"logging.info('Horting Exclude One GUR')\ngur_ids = load_courses('Test/gur_all.dat')\nindex = self.storage.student_index.student_index\ncount, pos, num = (0.0, 0.0, 0.0)\nfor i in range(NUM_TESTS):\n course_ids = set()\n while len(course_ids) == 0:\n student_id = random.choice(index.keys())\n co... | <|body_start_0|>
logging.info('Horting Exclude One GUR')
gur_ids = load_courses('Test/gur_all.dat')
index = self.storage.student_index.student_index
count, pos, num = (0.0, 0.0, 0.0)
for i in range(NUM_TESTS):
course_ids = set()
while len(course_ids) == 0:... | TestStudentIndex | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestStudentIndex:
def testGUROne(self):
"""Take one GUR course out student history and try to predict it."""
<|body_0|>
def testGURAll(self):
"""Take all GUR courses out student history and try to predict them. Load all GUR courses, remove all GURs from student cours... | stack_v2_sparse_classes_36k_train_004410 | 2,637 | no_license | [
{
"docstring": "Take one GUR course out student history and try to predict it.",
"name": "testGUROne",
"signature": "def testGUROne(self)"
},
{
"docstring": "Take all GUR courses out student history and try to predict them. Load all GUR courses, remove all GURs from student course history and th... | 2 | stack_v2_sparse_classes_30k_test_000661 | Implement the Python class `TestStudentIndex` described below.
Class description:
Implement the TestStudentIndex class.
Method signatures and docstrings:
- def testGUROne(self): Take one GUR course out student history and try to predict it.
- def testGURAll(self): Take all GUR courses out student history and try to p... | Implement the Python class `TestStudentIndex` described below.
Class description:
Implement the TestStudentIndex class.
Method signatures and docstrings:
- def testGUROne(self): Take one GUR course out student history and try to predict it.
- def testGURAll(self): Take all GUR courses out student history and try to p... | a5c6eb7a31ff7ed0cee133d5860108b81b916cf0 | <|skeleton|>
class TestStudentIndex:
def testGUROne(self):
"""Take one GUR course out student history and try to predict it."""
<|body_0|>
def testGURAll(self):
"""Take all GUR courses out student history and try to predict them. Load all GUR courses, remove all GURs from student cours... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestStudentIndex:
def testGUROne(self):
"""Take one GUR course out student history and try to predict it."""
logging.info('Horting Exclude One GUR')
gur_ids = load_courses('Test/gur_all.dat')
index = self.storage.student_index.student_index
count, pos, num = (0.0, 0.0, ... | the_stack_v2_python_sparse | TestGUR.py | camradal/CourseRecommender | train | 0 | |
c32b17d3d8b467c9c45293706f43a2db6f1385ed | [
"self.total_steps = np.floor(float(controller_freq) / float(policy_freq) * 0.2)\nself.prev_goal = None\nself.goal = None\nself.fraction = fraction\nself.step = 1",
"if goal.shape[0] != 4:\n raise ValueError('Incorrect goal dimension for orientation interpolator.')\nif self.prev_goal is None:\n self.prev_goa... | <|body_start_0|>
self.total_steps = np.floor(float(controller_freq) / float(policy_freq) * 0.2)
self.prev_goal = None
self.goal = None
self.fraction = fraction
self.step = 1
<|end_body_0|>
<|body_start_1|>
if goal.shape[0] != 4:
raise ValueError('Incorrect go... | SLERP Interpolator for orientation. Interpolates between previous goal commands to produce smooth trajectory. Attributes: total_steps (int): number of control steps per policy step. prev_goal (list): 4f previous goal commanded to controller. goal (list): 4f previous goal commanded to controller fraction (float): fracti... | LinearOriInterpolator | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class LinearOriInterpolator:
"""SLERP Interpolator for orientation. Interpolates between previous goal commands to produce smooth trajectory. Attributes: total_steps (int): number of control steps per policy step. prev_goal (list): 4f previous goal commanded to controller. goal (list): 4f previous goal... | stack_v2_sparse_classes_36k_train_004411 | 2,522 | no_license | [
{
"docstring": "Initialize interpolator. Args: controller_freq (float): Frequency (Hz) of the controller policy_freq (float): Frequency (Hz) of the policy model fraction (float): 0 to 1 fraction of path to interpolate.",
"name": "__init__",
"signature": "def __init__(self, controller_freq=500, policy_fr... | 3 | stack_v2_sparse_classes_30k_train_010250 | Implement the Python class `LinearOriInterpolator` described below.
Class description:
SLERP Interpolator for orientation. Interpolates between previous goal commands to produce smooth trajectory. Attributes: total_steps (int): number of control steps per policy step. prev_goal (list): 4f previous goal commanded to co... | Implement the Python class `LinearOriInterpolator` described below.
Class description:
SLERP Interpolator for orientation. Interpolates between previous goal commands to produce smooth trajectory. Attributes: total_steps (int): number of control steps per policy step. prev_goal (list): 4f previous goal commanded to co... | d15791905abf8ff5def7fd0d3e303e619fc150d1 | <|skeleton|>
class LinearOriInterpolator:
"""SLERP Interpolator for orientation. Interpolates between previous goal commands to produce smooth trajectory. Attributes: total_steps (int): number of control steps per policy step. prev_goal (list): 4f previous goal commanded to controller. goal (list): 4f previous goal... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class LinearOriInterpolator:
"""SLERP Interpolator for orientation. Interpolates between previous goal commands to produce smooth trajectory. Attributes: total_steps (int): number of control steps per policy step. prev_goal (list): 4f previous goal commanded to controller. goal (list): 4f previous goal commanded to... | the_stack_v2_python_sparse | perls2/controllers/interpolator/linear_ori_interpolator.py | kayburns/perls2 | train | 0 |
9e0fd25b9bc3c5d5a34b8fa6b14ce95f4ed0cbfa | [
"query = quote_plus(query.lower())\nsoup = self.get_soup(search_url % query)\nresults = []\nfor a in soup.select('ul li a'):\n results.append({'title': a.text.strip(), 'url': self.absolute_url(a['href'])})\nreturn results",
"logger.debug('Visiting %s', self.novel_url)\nsoup = self.get_soup(self.novel_url)\nima... | <|body_start_0|>
query = quote_plus(query.lower())
soup = self.get_soup(search_url % query)
results = []
for a in soup.select('ul li a'):
results.append({'title': a.text.strip(), 'url': self.absolute_url(a['href'])})
return results
<|end_body_0|>
<|body_start_1|>
... | NovelFullPlus | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NovelFullPlus:
def search_novel(self, query):
"""Gets a list of {title, url} matching the given query"""
<|body_0|>
def read_novel_info(self):
"""Get novel title, autor, cover etc"""
<|body_1|>
def download_chapter_body(self, chapter):
"""Downloa... | stack_v2_sparse_classes_36k_train_004412 | 2,378 | permissive | [
{
"docstring": "Gets a list of {title, url} matching the given query",
"name": "search_novel",
"signature": "def search_novel(self, query)"
},
{
"docstring": "Get novel title, autor, cover etc",
"name": "read_novel_info",
"signature": "def read_novel_info(self)"
},
{
"docstring":... | 3 | stack_v2_sparse_classes_30k_train_001400 | Implement the Python class `NovelFullPlus` described below.
Class description:
Implement the NovelFullPlus class.
Method signatures and docstrings:
- def search_novel(self, query): Gets a list of {title, url} matching the given query
- def read_novel_info(self): Get novel title, autor, cover etc
- def download_chapte... | Implement the Python class `NovelFullPlus` described below.
Class description:
Implement the NovelFullPlus class.
Method signatures and docstrings:
- def search_novel(self, query): Gets a list of {title, url} matching the given query
- def read_novel_info(self): Get novel title, autor, cover etc
- def download_chapte... | 04143afe1abded83bbf221da2df7ea57f4c7778c | <|skeleton|>
class NovelFullPlus:
def search_novel(self, query):
"""Gets a list of {title, url} matching the given query"""
<|body_0|>
def read_novel_info(self):
"""Get novel title, autor, cover etc"""
<|body_1|>
def download_chapter_body(self, chapter):
"""Downloa... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NovelFullPlus:
def search_novel(self, query):
"""Gets a list of {title, url} matching the given query"""
query = quote_plus(query.lower())
soup = self.get_soup(search_url % query)
results = []
for a in soup.select('ul li a'):
results.append({'title': a.text.... | the_stack_v2_python_sparse | sources/en/n/novelfullplus.py | Takishima/lightnovel-crawler | train | 0 | |
435b2f192cd22e0af748734c701b465bcc46ee9f | [
"objs = Roles.objects.filter(agent=request.user.userinfo.agent)\nrole = []\nfor obj in objs:\n role.append({'name': obj.name, 'id': obj.id, 'status': bool(obj.two_factor)})\nreturn Response({'status': 200, 'msg': '获取数据成功', 'data': role})",
"tablelist = request.data.get('tablelist')\nfor obj in tablelist:\n ... | <|body_start_0|>
objs = Roles.objects.filter(agent=request.user.userinfo.agent)
role = []
for obj in objs:
role.append({'name': obj.name, 'id': obj.id, 'status': bool(obj.two_factor)})
return Response({'status': 200, 'msg': '获取数据成功', 'data': role})
<|end_body_0|>
<|body_star... | 是否开启二次验证 | TwoValidation | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TwoValidation:
"""是否开启二次验证"""
def get(self, request):
"""获取所有角色的二次验证信息"""
<|body_0|>
def put(self, request):
"""修改角色的二次验证"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
objs = Roles.objects.filter(agent=request.user.userinfo.agent)
role... | stack_v2_sparse_classes_36k_train_004413 | 32,690 | no_license | [
{
"docstring": "获取所有角色的二次验证信息",
"name": "get",
"signature": "def get(self, request)"
},
{
"docstring": "修改角色的二次验证",
"name": "put",
"signature": "def put(self, request)"
}
] | 2 | null | Implement the Python class `TwoValidation` described below.
Class description:
是否开启二次验证
Method signatures and docstrings:
- def get(self, request): 获取所有角色的二次验证信息
- def put(self, request): 修改角色的二次验证 | Implement the Python class `TwoValidation` described below.
Class description:
是否开启二次验证
Method signatures and docstrings:
- def get(self, request): 获取所有角色的二次验证信息
- def put(self, request): 修改角色的二次验证
<|skeleton|>
class TwoValidation:
"""是否开启二次验证"""
def get(self, request):
"""获取所有角色的二次验证信息"""
<... | d6e025d7e9d9e3aecfd399c77f376130edd8a2df | <|skeleton|>
class TwoValidation:
"""是否开启二次验证"""
def get(self, request):
"""获取所有角色的二次验证信息"""
<|body_0|>
def put(self, request):
"""修改角色的二次验证"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TwoValidation:
"""是否开启二次验证"""
def get(self, request):
"""获取所有角色的二次验证信息"""
objs = Roles.objects.filter(agent=request.user.userinfo.agent)
role = []
for obj in objs:
role.append({'name': obj.name, 'id': obj.id, 'status': bool(obj.two_factor)})
return Resp... | the_stack_v2_python_sparse | soc_system/views/set_views.py | sundw2015/841 | train | 4 |
7b4bdf836250f6bae91d4601910913791fbc7ad3 | [
"self.v = [v1, v2]\nself.index = [0, 0]\nself.current_list = 0\nself.n = 2",
"for i in range(self.n):\n k = (self.current_list + i) % self.n\n if self.index[k] < len(self.v[k]):\n result = self.v[k][self.index[k]]\n self.index[k] += 1\n self.current_list = (k + 1) % self.n\n retu... | <|body_start_0|>
self.v = [v1, v2]
self.index = [0, 0]
self.current_list = 0
self.n = 2
<|end_body_0|>
<|body_start_1|>
for i in range(self.n):
k = (self.current_list + i) % self.n
if self.index[k] < len(self.v[k]):
result = self.v[k][self... | ZigzagIterator | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ZigzagIterator:
def __init__(self, v1, v2):
"""Initialize your data structure here. :type v1: List[int] :type v2: List[int]"""
<|body_0|>
def next(self):
""":rtype: int"""
<|body_1|>
def hasNext(self):
""":rtype: bool"""
<|body_2|>
<|end... | stack_v2_sparse_classes_36k_train_004414 | 1,073 | no_license | [
{
"docstring": "Initialize your data structure here. :type v1: List[int] :type v2: List[int]",
"name": "__init__",
"signature": "def __init__(self, v1, v2)"
},
{
"docstring": ":rtype: int",
"name": "next",
"signature": "def next(self)"
},
{
"docstring": ":rtype: bool",
"name"... | 3 | null | Implement the Python class `ZigzagIterator` described below.
Class description:
Implement the ZigzagIterator class.
Method signatures and docstrings:
- def __init__(self, v1, v2): Initialize your data structure here. :type v1: List[int] :type v2: List[int]
- def next(self): :rtype: int
- def hasNext(self): :rtype: bo... | Implement the Python class `ZigzagIterator` described below.
Class description:
Implement the ZigzagIterator class.
Method signatures and docstrings:
- def __init__(self, v1, v2): Initialize your data structure here. :type v1: List[int] :type v2: List[int]
- def next(self): :rtype: int
- def hasNext(self): :rtype: bo... | 6ce22264a9c34d6addf4eff4c196105eec12b113 | <|skeleton|>
class ZigzagIterator:
def __init__(self, v1, v2):
"""Initialize your data structure here. :type v1: List[int] :type v2: List[int]"""
<|body_0|>
def next(self):
""":rtype: int"""
<|body_1|>
def hasNext(self):
""":rtype: bool"""
<|body_2|>
<|end... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ZigzagIterator:
def __init__(self, v1, v2):
"""Initialize your data structure here. :type v1: List[int] :type v2: List[int]"""
self.v = [v1, v2]
self.index = [0, 0]
self.current_list = 0
self.n = 2
def next(self):
""":rtype: int"""
for i in range(se... | the_stack_v2_python_sparse | ZigZag_Iterator.py | zhubw91/Leetcode | train | 0 | |
80b2c664bf95039f3f1c8abb460ba7dc04c81b88 | [
"angle_limit = _check_and_convert_limit_value(angle_limit, None, 0)\nself.angle_uniform = ops.Uniform(range=angle_limit)\nself.rotate = ops.Rotate(device='gpu', fill_value=0.0, keep_size=True)\nself.rng = ops.CoinFlip(probability=p)\nself.bool = ops.Cast(dtype=types.DALIDataType.BOOL)",
"data = EasyDict(data)\nan... | <|body_start_0|>
angle_limit = _check_and_convert_limit_value(angle_limit, None, 0)
self.angle_uniform = ops.Uniform(range=angle_limit)
self.rotate = ops.Rotate(device='gpu', fill_value=0.0, keep_size=True)
self.rng = ops.CoinFlip(probability=p)
self.bool = ops.Cast(dtype=types.D... | Random rotate the image, currently not support coordinates sensitive labels | RandomRotate | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RandomRotate:
"""Random rotate the image, currently not support coordinates sensitive labels"""
def __init__(self, p: float=0.5, angle_limit: Union[List, float]=45.0, fill_value: float=0.0):
"""Initialization Args: p (float, optional): Probability to apply this transformation.. Defau... | stack_v2_sparse_classes_36k_train_004415 | 22,608 | no_license | [
{
"docstring": "Initialization Args: p (float, optional): Probability to apply this transformation.. Defaults to .5. angle_limit (Union[List,float], optional): Range for changing angle in [min,max] value format. If provided as a single float, the range will be (-limit, limit). Defaults to 45.. fill_value (float... | 2 | stack_v2_sparse_classes_30k_train_018370 | Implement the Python class `RandomRotate` described below.
Class description:
Random rotate the image, currently not support coordinates sensitive labels
Method signatures and docstrings:
- def __init__(self, p: float=0.5, angle_limit: Union[List, float]=45.0, fill_value: float=0.0): Initialization Args: p (float, op... | Implement the Python class `RandomRotate` described below.
Class description:
Random rotate the image, currently not support coordinates sensitive labels
Method signatures and docstrings:
- def __init__(self, p: float=0.5, angle_limit: Union[List, float]=45.0, fill_value: float=0.0): Initialization Args: p (float, op... | 1532db8447d03e75d5ec26f93111270a4ccb7a7e | <|skeleton|>
class RandomRotate:
"""Random rotate the image, currently not support coordinates sensitive labels"""
def __init__(self, p: float=0.5, angle_limit: Union[List, float]=45.0, fill_value: float=0.0):
"""Initialization Args: p (float, optional): Probability to apply this transformation.. Defau... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RandomRotate:
"""Random rotate the image, currently not support coordinates sensitive labels"""
def __init__(self, p: float=0.5, angle_limit: Union[List, float]=45.0, fill_value: float=0.0):
"""Initialization Args: p (float, optional): Probability to apply this transformation.. Defaults to .5. an... | the_stack_v2_python_sparse | src/development/vortex/development/utils/data/augment/modules/nvidia_dali/modules.py | jesslynsepthiaa/vortex | train | 0 |
bbb127e8589cb421126a51c11224c730e89465e3 | [
"try:\n return Gateway.objects.get(reservoir=self, task=task)\nexcept Gateway.DoesNotExist:\n return None",
"gateway = self.get_gateway(task)\nif gateway and gateway.pipe:\n return gateway.pipe\nelse:\n return None"
] | <|body_start_0|>
try:
return Gateway.objects.get(reservoir=self, task=task)
except Gateway.DoesNotExist:
return None
<|end_body_0|>
<|body_start_1|>
gateway = self.get_gateway(task)
if gateway and gateway.pipe:
return gateway.pipe
else:
... | Determines whether a platform is enabled for use. The platform corresponds to a subpackage in the Platforms package. A Reservoir's primary key is the name of the subpackage associated with the Reservoir (e.g., 'twitter'). | Reservoir | [
"MIT",
"LicenseRef-scancode-proprietary-license",
"GPL-3.0-only",
"LicenseRef-scancode-unknown-license-reference",
"GPL-1.0-or-later",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-other-copyleft"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Reservoir:
"""Determines whether a platform is enabled for use. The platform corresponds to a subpackage in the Platforms package. A Reservoir's primary key is the name of the subpackage associated with the Reservoir (e.g., 'twitter')."""
def get_gateway(self, task):
"""Returns the g... | stack_v2_sparse_classes_36k_train_004416 | 3,199 | permissive | [
{
"docstring": "Returns the gateway for a given task, or None if the gateway doesn't exist.",
"name": "get_gateway",
"signature": "def get_gateway(self, task)"
},
{
"docstring": "Takes the primary key (name) of a SearchTask and returns the Pipe for that task, if one exists. Otherwise, returns No... | 2 | stack_v2_sparse_classes_30k_train_007614 | Implement the Python class `Reservoir` described below.
Class description:
Determines whether a platform is enabled for use. The platform corresponds to a subpackage in the Platforms package. A Reservoir's primary key is the name of the subpackage associated with the Reservoir (e.g., 'twitter').
Method signatures and... | Implement the Python class `Reservoir` described below.
Class description:
Determines whether a platform is enabled for use. The platform corresponds to a subpackage in the Platforms package. A Reservoir's primary key is the name of the subpackage associated with the Reservoir (e.g., 'twitter').
Method signatures and... | a379a134c0c5af14df4ed2afa066c1626506b754 | <|skeleton|>
class Reservoir:
"""Determines whether a platform is enabled for use. The platform corresponds to a subpackage in the Platforms package. A Reservoir's primary key is the name of the subpackage associated with the Reservoir (e.g., 'twitter')."""
def get_gateway(self, task):
"""Returns the g... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Reservoir:
"""Determines whether a platform is enabled for use. The platform corresponds to a subpackage in the Platforms package. A Reservoir's primary key is the name of the subpackage associated with the Reservoir (e.g., 'twitter')."""
def get_gateway(self, task):
"""Returns the gateway for a ... | the_stack_v2_python_sparse | Incident-Response/Tools/cyphon/cyphon/aggregator/reservoirs/models.py | foss2cyber/Incident-Playbook | train | 1 |
d04950f9f010ad8b58cdea82af53bf9314aea11b | [
"super().__init__(seed, max_outputs=max_outputs)\nself.model = spacy_nlp if spacy_nlp else spacy.load('en_core_web_sm')\nif lang == 'en':\n if data_path is None:\n self.transformer = ChangeCityNames(os.path.dirname(os.path.abspath(__file__)), language='en')\n else:\n self.transformer = ChangeCit... | <|body_start_0|>
super().__init__(seed, max_outputs=max_outputs)
self.model = spacy_nlp if spacy_nlp else spacy.load('en_core_web_sm')
if lang == 'en':
if data_path is None:
self.transformer = ChangeCityNames(os.path.dirname(os.path.abspath(__file__)), language='en')
... | CityNamesTransformation | [
"MIT",
"LicenseRef-scancode-free-unknown"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CityNamesTransformation:
def __init__(self, seed=0, max_outputs=1, lang='en', data_path=None):
"""Constructor of the CityNamesTransformation object in a given language Parameters ---------- seed : int, optional seed value for random operations. The default is 0. max_outputs : 1, optional... | stack_v2_sparse_classes_36k_train_004417 | 8,923 | permissive | [
{
"docstring": "Constructor of the CityNamesTransformation object in a given language Parameters ---------- seed : int, optional seed value for random operations. The default is 0. max_outputs : 1, optional How many ouput sentences can be created by an operation. The default is 1. lang : str, optional What lang... | 2 | null | Implement the Python class `CityNamesTransformation` described below.
Class description:
Implement the CityNamesTransformation class.
Method signatures and docstrings:
- def __init__(self, seed=0, max_outputs=1, lang='en', data_path=None): Constructor of the CityNamesTransformation object in a given language Paramete... | Implement the Python class `CityNamesTransformation` described below.
Class description:
Implement the CityNamesTransformation class.
Method signatures and docstrings:
- def __init__(self, seed=0, max_outputs=1, lang='en', data_path=None): Constructor of the CityNamesTransformation object in a given language Paramete... | 619bc081fa506778526a1963d19a697367f1d553 | <|skeleton|>
class CityNamesTransformation:
def __init__(self, seed=0, max_outputs=1, lang='en', data_path=None):
"""Constructor of the CityNamesTransformation object in a given language Parameters ---------- seed : int, optional seed value for random operations. The default is 0. max_outputs : 1, optional... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CityNamesTransformation:
def __init__(self, seed=0, max_outputs=1, lang='en', data_path=None):
"""Constructor of the CityNamesTransformation object in a given language Parameters ---------- seed : int, optional seed value for random operations. The default is 0. max_outputs : 1, optional How many oupu... | the_stack_v2_python_sparse | transformations/city_names_transformation/transformation.py | dyrson11/NL-Augmenter | train | 1 | |
e3f619f08b839e1e1d7b5bb10daf8eb34bdeb2c8 | [
"if directory is None:\n directory = os.getcwd()\nproject_name = os.path.basename(directory)\nif app_name == project_name:\n raise CommandError('You cannot create an app with the same name (%r) as your project.' % app_name)\ntry:\n __import__(app_name)\nexcept ImportError:\n pass\nelse:\n raise Comma... | <|body_start_0|>
if directory is None:
directory = os.getcwd()
project_name = os.path.basename(directory)
if app_name == project_name:
raise CommandError('You cannot create an app with the same name (%r) as your project.' % app_name)
try:
__import__(ap... | Creates new XML Collection Application. | Command | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Command:
"""Creates new XML Collection Application."""
def handle_label(self, app_name, directory=None, **options):
"""Deal with the given label."""
<|body_0|>
def create_xml_database(self, app_name, directory):
"""Create the XML Database and the stub pixelate.""... | stack_v2_sparse_classes_36k_train_004418 | 2,868 | no_license | [
{
"docstring": "Deal with the given label.",
"name": "handle_label",
"signature": "def handle_label(self, app_name, directory=None, **options)"
},
{
"docstring": "Create the XML Database and the stub pixelate.",
"name": "create_xml_database",
"signature": "def create_xml_database(self, a... | 2 | stack_v2_sparse_classes_30k_train_020251 | Implement the Python class `Command` described below.
Class description:
Creates new XML Collection Application.
Method signatures and docstrings:
- def handle_label(self, app_name, directory=None, **options): Deal with the given label.
- def create_xml_database(self, app_name, directory): Create the XML Database and... | Implement the Python class `Command` described below.
Class description:
Creates new XML Collection Application.
Method signatures and docstrings:
- def handle_label(self, app_name, directory=None, **options): Deal with the given label.
- def create_xml_database(self, app_name, directory): Create the XML Database and... | 5486128b5b3b7ddb9ec81d43e3bb601a23b4025a | <|skeleton|>
class Command:
"""Creates new XML Collection Application."""
def handle_label(self, app_name, directory=None, **options):
"""Deal with the given label."""
<|body_0|>
def create_xml_database(self, app_name, directory):
"""Create the XML Database and the stub pixelate.""... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Command:
"""Creates new XML Collection Application."""
def handle_label(self, app_name, directory=None, **options):
"""Deal with the given label."""
if directory is None:
directory = os.getcwd()
project_name = os.path.basename(directory)
if app_name == project_... | the_stack_v2_python_sparse | sdpub/staging/SDPublisher_MIN/pixelise/management/commands/startxml.py | mikanyman/.virtualenvs-legacy | train | 0 |
d8d5af7e9d43dae370b6e906d91d08314538d7bd | [
"self.badlimit = badlimit\nself.badcount = 0\nself.current_loss = sys.float_info.max",
"if mat is None:\n sys.stderr.write('Done Training. End of data stream.')\n cond = 0\nelif math.isnan(loss) or math.isinf(loss):\n sys.stderr.write('Exiting due divergence: %s\\n\\n' % loss)\n cond = -1\nelif loss >... | <|body_start_0|>
self.badlimit = badlimit
self.badcount = 0
self.current_loss = sys.float_info.max
<|end_body_0|>
<|body_start_1|>
if mat is None:
sys.stderr.write('Done Training. End of data stream.')
cond = 0
elif math.isnan(loss) or math.isinf(loss):
... | A class for determining when to stop a training while loop by a bad count criterion. If the data is exhausted or the model's performance hasn't improved for *badlimit* training steps, the __call__ function returns false. Otherwise it returns true. | EarlyStop | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EarlyStop:
"""A class for determining when to stop a training while loop by a bad count criterion. If the data is exhausted or the model's performance hasn't improved for *badlimit* training steps, the __call__ function returns false. Otherwise it returns true."""
def __init__(self, badlimit... | stack_v2_sparse_classes_36k_train_004419 | 6,495 | permissive | [
{
"docstring": ":param badlimit: Limit of for number of training steps without improvement for early stopping.",
"name": "__init__",
"signature": "def __init__(self, badlimit=20)"
},
{
"docstring": "Returns a boolean for customizable stopping criterion. For first loop iteration set loss to sys.f... | 2 | stack_v2_sparse_classes_30k_train_009640 | Implement the Python class `EarlyStop` described below.
Class description:
A class for determining when to stop a training while loop by a bad count criterion. If the data is exhausted or the model's performance hasn't improved for *badlimit* training steps, the __call__ function returns false. Otherwise it returns tr... | Implement the Python class `EarlyStop` described below.
Class description:
A class for determining when to stop a training while loop by a bad count criterion. If the data is exhausted or the model's performance hasn't improved for *badlimit* training steps, the __call__ function returns false. Otherwise it returns tr... | 92c004bc72f1480a4f9b26d304a900cbc8dea48d | <|skeleton|>
class EarlyStop:
"""A class for determining when to stop a training while loop by a bad count criterion. If the data is exhausted or the model's performance hasn't improved for *badlimit* training steps, the __call__ function returns false. Otherwise it returns true."""
def __init__(self, badlimit... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class EarlyStop:
"""A class for determining when to stop a training while loop by a bad count criterion. If the data is exhausted or the model's performance hasn't improved for *badlimit* training steps, the __call__ function returns false. Otherwise it returns true."""
def __init__(self, badlimit=20):
... | the_stack_v2_python_sparse | safekit/graph_training_utils.py | Tubbz-alt/safekit | train | 0 |
b19ebbd3115995e0a4b26393567c46763067bf62 | [
"url = host + '/api/news/list'\ndata = {'size': 10, 'page': 1}\nr = requests.post(url=url, data=data).json()\ns = len(r['data'])\nif s == 0:\n print('data is NULL')\nelse:\n out_format('新闻列表:', r)\n news_id = r['data'][-1]['id']\n print('id', news_id)\n return news_id",
"news_id = self.news_list()\... | <|body_start_0|>
url = host + '/api/news/list'
data = {'size': 10, 'page': 1}
r = requests.post(url=url, data=data).json()
s = len(r['data'])
if s == 0:
print('data is NULL')
else:
out_format('新闻列表:', r)
news_id = r['data'][-1]['id']
... | 定义一个官网接口的测试类 | official | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class official:
"""定义一个官网接口的测试类"""
def news_list(self):
"""新闻列表 :param:size:单页记录数 :param:page:页码"""
<|body_0|>
def news_details(self):
"""新闻详情 :param:id:记录id"""
<|body_1|>
def work_list(self):
"""职位列表 :param:size:单页记录数 :param:page:页码"""
<|b... | stack_v2_sparse_classes_36k_train_004420 | 1,983 | no_license | [
{
"docstring": "新闻列表 :param:size:单页记录数 :param:page:页码",
"name": "news_list",
"signature": "def news_list(self)"
},
{
"docstring": "新闻详情 :param:id:记录id",
"name": "news_details",
"signature": "def news_details(self)"
},
{
"docstring": "职位列表 :param:size:单页记录数 :param:page:页码",
"n... | 4 | stack_v2_sparse_classes_30k_train_007034 | Implement the Python class `official` described below.
Class description:
定义一个官网接口的测试类
Method signatures and docstrings:
- def news_list(self): 新闻列表 :param:size:单页记录数 :param:page:页码
- def news_details(self): 新闻详情 :param:id:记录id
- def work_list(self): 职位列表 :param:size:单页记录数 :param:page:页码
- def work_details(self): 职位详... | Implement the Python class `official` described below.
Class description:
定义一个官网接口的测试类
Method signatures and docstrings:
- def news_list(self): 新闻列表 :param:size:单页记录数 :param:page:页码
- def news_details(self): 新闻详情 :param:id:记录id
- def work_list(self): 职位列表 :param:size:单页记录数 :param:page:页码
- def work_details(self): 职位详... | 0ebaae335de2f1633e31c4fc3f60e556220a8bfb | <|skeleton|>
class official:
"""定义一个官网接口的测试类"""
def news_list(self):
"""新闻列表 :param:size:单页记录数 :param:page:页码"""
<|body_0|>
def news_details(self):
"""新闻详情 :param:id:记录id"""
<|body_1|>
def work_list(self):
"""职位列表 :param:size:单页记录数 :param:page:页码"""
<|b... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class official:
"""定义一个官网接口的测试类"""
def news_list(self):
"""新闻列表 :param:size:单页记录数 :param:page:页码"""
url = host + '/api/news/list'
data = {'size': 10, 'page': 1}
r = requests.post(url=url, data=data).json()
s = len(r['data'])
if s == 0:
print('data is ... | the_stack_v2_python_sparse | Atle/interface/framework/base/official.py | shiqi0128/My_scripts | train | 0 |
ba991809856a415d22abdc466deaa8431100a04f | [
"strs = map(lambda x: x.replace('\\x00', '\\\\x00'), strs)\nret = ''\nfor s in strs:\n ret += s + '\\x00'\nreturn ret",
"if '\\x00' not in s:\n return []\ns = s[:-1]\nstrs = s.split('\\x00')\nstrs = map(lambda x: x.replace('\\\\x00', '\\x00'), strs)\nreturn strs"
] | <|body_start_0|>
strs = map(lambda x: x.replace('\x00', '\\x00'), strs)
ret = ''
for s in strs:
ret += s + '\x00'
return ret
<|end_body_0|>
<|body_start_1|>
if '\x00' not in s:
return []
s = s[:-1]
strs = s.split('\x00')
strs = map... | CodecError | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CodecError:
def encode(self, strs):
"""Encodes a list of strings to a single string. This algorithm contains bugs if \\x00 exits in the original string :type strs: List[str] :rtype: str"""
<|body_0|>
def decode(self, s):
"""Decodes a single string to a list of string... | stack_v2_sparse_classes_36k_train_004421 | 2,130 | permissive | [
{
"docstring": "Encodes a list of strings to a single string. This algorithm contains bugs if \\\\x00 exits in the original string :type strs: List[str] :rtype: str",
"name": "encode",
"signature": "def encode(self, strs)"
},
{
"docstring": "Decodes a single string to a list of strings. :type s:... | 2 | stack_v2_sparse_classes_30k_train_005603 | Implement the Python class `CodecError` described below.
Class description:
Implement the CodecError class.
Method signatures and docstrings:
- def encode(self, strs): Encodes a list of strings to a single string. This algorithm contains bugs if \\x00 exits in the original string :type strs: List[str] :rtype: str
- d... | Implement the Python class `CodecError` described below.
Class description:
Implement the CodecError class.
Method signatures and docstrings:
- def encode(self, strs): Encodes a list of strings to a single string. This algorithm contains bugs if \\x00 exits in the original string :type strs: List[str] :rtype: str
- d... | cbbd4a67ab342ada2421e13f82d660b1d47d4d20 | <|skeleton|>
class CodecError:
def encode(self, strs):
"""Encodes a list of strings to a single string. This algorithm contains bugs if \\x00 exits in the original string :type strs: List[str] :rtype: str"""
<|body_0|>
def decode(self, s):
"""Decodes a single string to a list of string... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CodecError:
def encode(self, strs):
"""Encodes a list of strings to a single string. This algorithm contains bugs if \\x00 exits in the original string :type strs: List[str] :rtype: str"""
strs = map(lambda x: x.replace('\x00', '\\x00'), strs)
ret = ''
for s in strs:
... | the_stack_v2_python_sparse | 271 Encode and Decode Strings.py | Aminaba123/LeetCode | train | 1 | |
bdd4fee24b83a1cad7bf986ca8a7aa72211f6b1f | [
"self._env = multi_env\nself._model = model\nself._num_steps = num_steps\nself._observations = None",
"observation_steps = []\naction_steps = []\nreward_steps = []\nterminal_steps = []\ninfo_steps = []\nnext_observations = self._observations\nif next_observations is None:\n next_observations = self._env.reset(... | <|body_start_0|>
self._env = multi_env
self._model = model
self._num_steps = num_steps
self._observations = None
<|end_body_0|>
<|body_start_1|>
observation_steps = []
action_steps = []
reward_steps = []
terminal_steps = []
info_steps = []
... | An agent that maintains multiple environments (via :obj:`~actorcritic.multi_env.MultiEnv`) and samples multiple steps. | MultiEnvAgent | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MultiEnvAgent:
"""An agent that maintains multiple environments (via :obj:`~actorcritic.multi_env.MultiEnv`) and samples multiple steps."""
def __init__(self, multi_env, model, num_steps):
"""Args: multi_env (:obj:`~actorcritic.multi_env.MultiEnv`): Multiple environments. model (:obj... | stack_v2_sparse_classes_36k_train_004422 | 10,204 | permissive | [
{
"docstring": "Args: multi_env (:obj:`~actorcritic.multi_env.MultiEnv`): Multiple environments. model (:obj:`~actorcritic.model.ActorCriticModel`): A model to sample actions. num_steps (:obj:`int`): The number of steps to take in :meth:`interact`.",
"name": "__init__",
"signature": "def __init__(self, ... | 2 | stack_v2_sparse_classes_30k_train_019959 | Implement the Python class `MultiEnvAgent` described below.
Class description:
An agent that maintains multiple environments (via :obj:`~actorcritic.multi_env.MultiEnv`) and samples multiple steps.
Method signatures and docstrings:
- def __init__(self, multi_env, model, num_steps): Args: multi_env (:obj:`~actorcritic... | Implement the Python class `MultiEnvAgent` described below.
Class description:
An agent that maintains multiple environments (via :obj:`~actorcritic.multi_env.MultiEnv`) and samples multiple steps.
Method signatures and docstrings:
- def __init__(self, multi_env, model, num_steps): Args: multi_env (:obj:`~actorcritic... | 2f72d296c0b550982b0400b6afb7a7a0dfe3f144 | <|skeleton|>
class MultiEnvAgent:
"""An agent that maintains multiple environments (via :obj:`~actorcritic.multi_env.MultiEnv`) and samples multiple steps."""
def __init__(self, multi_env, model, num_steps):
"""Args: multi_env (:obj:`~actorcritic.multi_env.MultiEnv`): Multiple environments. model (:obj... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MultiEnvAgent:
"""An agent that maintains multiple environments (via :obj:`~actorcritic.multi_env.MultiEnv`) and samples multiple steps."""
def __init__(self, multi_env, model, num_steps):
"""Args: multi_env (:obj:`~actorcritic.multi_env.MultiEnv`): Multiple environments. model (:obj:`~actorcriti... | the_stack_v2_python_sparse | actorcritic/agents.py | jrobine/actor-critic | train | 10 |
c0a26c4ee40c5e7a1bc91eb030c4c311b14be04b | [
"self._filter_configuration = filter_configuration\nself._output_format = output_format\nself.max_reports_per_category = max_reports_per_category\nself.min_confidence = min_confidence\nself.stderr_write = stderr_write",
"if confidence_in_error < self.min_confidence:\n return False\nreturn self._filter_configur... | <|body_start_0|>
self._filter_configuration = filter_configuration
self._output_format = output_format
self.max_reports_per_category = max_reports_per_category
self.min_confidence = min_confidence
self.stderr_write = stderr_write
<|end_body_0|>
<|body_start_1|>
if confid... | Stores configuration values for the StyleProcessor class. Attributes: min_confidence: An integer between 1 and 5 inclusive that is the minimum confidence level of style errors to report. max_reports_per_category: The maximum number of errors to report per category, per file. stderr_write: A function that takes a string... | StyleProcessorConfiguration | [
"LGPL-2.0-or-later",
"LicenseRef-scancode-warranty-disclaimer",
"LGPL-2.1-only",
"GPL-1.0-or-later",
"GPL-2.0-only",
"LGPL-2.0-only",
"BSD-2-Clause",
"LicenseRef-scancode-other-copyleft",
"BSD-3-Clause",
"MIT",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StyleProcessorConfiguration:
"""Stores configuration values for the StyleProcessor class. Attributes: min_confidence: An integer between 1 and 5 inclusive that is the minimum confidence level of style errors to report. max_reports_per_category: The maximum number of errors to report per category,... | stack_v2_sparse_classes_36k_train_004423 | 23,775 | permissive | [
{
"docstring": "Create a StyleProcessorConfiguration instance. Args: filter_configuration: A FilterConfiguration instance. The default is the \"empty\" filter configuration, which means that all errors should be checked. max_reports_per_category: The maximum number of errors to report per category, per file. mi... | 3 | null | Implement the Python class `StyleProcessorConfiguration` described below.
Class description:
Stores configuration values for the StyleProcessor class. Attributes: min_confidence: An integer between 1 and 5 inclusive that is the minimum confidence level of style errors to report. max_reports_per_category: The maximum n... | Implement the Python class `StyleProcessorConfiguration` described below.
Class description:
Stores configuration values for the StyleProcessor class. Attributes: min_confidence: An integer between 1 and 5 inclusive that is the minimum confidence level of style errors to report. max_reports_per_category: The maximum n... | a401d6cf4f7bf0e2d2e964c512ebb923c3d8832c | <|skeleton|>
class StyleProcessorConfiguration:
"""Stores configuration values for the StyleProcessor class. Attributes: min_confidence: An integer between 1 and 5 inclusive that is the minimum confidence level of style errors to report. max_reports_per_category: The maximum number of errors to report per category,... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class StyleProcessorConfiguration:
"""Stores configuration values for the StyleProcessor class. Attributes: min_confidence: An integer between 1 and 5 inclusive that is the minimum confidence level of style errors to report. max_reports_per_category: The maximum number of errors to report per category, per file. st... | the_stack_v2_python_sparse | third_party/blink/tools/blinkpy/style/checker.py | chromium/chromium | train | 17,408 |
1ba450a1ade41723aef67b9dbf5b9e8a08e6dc26 | [
"try:\n self._client.load_model(model.name())\nexcept InferenceServerException as e:\n raise TritonModelAnalyzerException(f'Unable to load the model : {e}')",
"try:\n self._client.unload_model(model.name())\nexcept InferenceServerException as e:\n raise TritonModelAnalyzerException(f'Unable to unload ... | <|body_start_0|>
try:
self._client.load_model(model.name())
except InferenceServerException as e:
raise TritonModelAnalyzerException(f'Unable to load the model : {e}')
<|end_body_0|>
<|body_start_1|>
try:
self._client.unload_model(model.name())
except... | Defines the interface for the objects created by TritonClientFactory | TritonClient | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TritonClient:
"""Defines the interface for the objects created by TritonClientFactory"""
def load_model(self, model):
"""Request the inference server to load a particular model in explicit model control mode. Parameters ---------- model : Model model to load from repository Raises --... | stack_v2_sparse_classes_36k_train_004424 | 4,163 | permissive | [
{
"docstring": "Request the inference server to load a particular model in explicit model control mode. Parameters ---------- model : Model model to load from repository Raises ------ TritonModelAnalyzerException If server throws InferenceServerException",
"name": "load_model",
"signature": "def load_mo... | 3 | stack_v2_sparse_classes_30k_train_011665 | Implement the Python class `TritonClient` described below.
Class description:
Defines the interface for the objects created by TritonClientFactory
Method signatures and docstrings:
- def load_model(self, model): Request the inference server to load a particular model in explicit model control mode. Parameters -------... | Implement the Python class `TritonClient` described below.
Class description:
Defines the interface for the objects created by TritonClientFactory
Method signatures and docstrings:
- def load_model(self, model): Request the inference server to load a particular model in explicit model control mode. Parameters -------... | 3448283cebdd07f7b39400abea50a375917842f5 | <|skeleton|>
class TritonClient:
"""Defines the interface for the objects created by TritonClientFactory"""
def load_model(self, model):
"""Request the inference server to load a particular model in explicit model control mode. Parameters ---------- model : Model model to load from repository Raises --... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TritonClient:
"""Defines the interface for the objects created by TritonClientFactory"""
def load_model(self, model):
"""Request the inference server to load a particular model in explicit model control mode. Parameters ---------- model : Model model to load from repository Raises ------ TritonMo... | the_stack_v2_python_sparse | model_analyzer/triton/client/client.py | SHEN-YI/model_analyzer | train | 0 |
0e2f99b060c406b0c4c7546f6deb1f372ec326a5 | [
"not_run_files = DocumentFileAttachment.objects.filter(document=attachment.document, security_scan_status='NOT RUN', is_removed=False)\nin_progress_files = DocumentFileAttachment.objects.filter(document=attachment.document, security_scan_status='IN PROGRESS', is_removed=False)\nfailed_files = DocumentFileAttachment... | <|body_start_0|>
not_run_files = DocumentFileAttachment.objects.filter(document=attachment.document, security_scan_status='NOT RUN', is_removed=False)
in_progress_files = DocumentFileAttachment.objects.filter(document=attachment.document, security_scan_status='IN PROGRESS', is_removed=False)
fai... | Class to update and send notifications for the file attachments | SecurityScan | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SecurityScan:
"""Class to update and send notifications for the file attachments"""
def update_status_and_send_notifications(attachment):
"""Update document status and send notifications is it is required"""
<|body_0|>
def resubmit_stalled_scans():
"""Method to f... | stack_v2_sparse_classes_36k_train_004425 | 5,879 | permissive | [
{
"docstring": "Update document status and send notifications is it is required",
"name": "update_status_and_send_notifications",
"signature": "def update_status_and_send_notifications(attachment)"
},
{
"docstring": "Method to find documents that have been scanning for a long time and resubmit t... | 4 | null | Implement the Python class `SecurityScan` described below.
Class description:
Class to update and send notifications for the file attachments
Method signatures and docstrings:
- def update_status_and_send_notifications(attachment): Update document status and send notifications is it is required
- def resubmit_stalled... | Implement the Python class `SecurityScan` described below.
Class description:
Class to update and send notifications for the file attachments
Method signatures and docstrings:
- def update_status_and_send_notifications(attachment): Update document status and send notifications is it is required
- def resubmit_stalled... | 80ae1ef5938ef5e580128ed0c622071b307fc7e1 | <|skeleton|>
class SecurityScan:
"""Class to update and send notifications for the file attachments"""
def update_status_and_send_notifications(attachment):
"""Update document status and send notifications is it is required"""
<|body_0|>
def resubmit_stalled_scans():
"""Method to f... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SecurityScan:
"""Class to update and send notifications for the file attachments"""
def update_status_and_send_notifications(attachment):
"""Update document status and send notifications is it is required"""
not_run_files = DocumentFileAttachment.objects.filter(document=attachment.documen... | the_stack_v2_python_sparse | backend/api/services/SecurityScan.py | kuanfandevops/tfrs | train | 0 |
e62e1cad1a77f3ca78c76ae643354ca8ee22cc12 | [
"d = json.loads(getattr(self, field))\nd[key] = d.get(key, 0) + 1\nsetattr(self, field, json.dumps(d))",
"d = json.loads(getattr(self, field))\nd[key] = d.get(key, 0) - 1\nsetattr(self, field, json.dumps(d))",
"self.num_games = (self.num_games or 0) + 1\nself._incr_json_field('outcomes', 'active')\nself._incr_j... | <|body_start_0|>
d = json.loads(getattr(self, field))
d[key] = d.get(key, 0) + 1
setattr(self, field, json.dumps(d))
<|end_body_0|>
<|body_start_1|>
d = json.loads(getattr(self, field))
d[key] = d.get(key, 0) - 1
setattr(self, field, json.dumps(d))
<|end_body_1|>
<|body... | Table ``users`` with fields: * ``user_id`` - UUID primary key of length 38 * ``user_name`` - String of maximum length 30 * ``num_games`` - Integer count of games started * ``outcomes`` - JSON string storing game counts by outcome * ``by_lang`` - JSON string storing game counts by game language * ``first_time`` - DateTi... | User | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class User:
"""Table ``users`` with fields: * ``user_id`` - UUID primary key of length 38 * ``user_name`` - String of maximum length 30 * ``num_games`` - Integer count of games started * ``outcomes`` - JSON string storing game counts by outcome * ``by_lang`` - JSON string storing game counts by game la... | stack_v2_sparse_classes_36k_train_004426 | 7,142 | no_license | [
{
"docstring": "Increment the value of self.``field``[``key``] by one where ``field`` is a JSON text string. (Does not commit.)",
"name": "_incr_json_field",
"signature": "def _incr_json_field(self, field, key)"
},
{
"docstring": "Decrement the value of self.``field``[``key``] by one where ``fie... | 4 | stack_v2_sparse_classes_30k_test_000184 | Implement the Python class `User` described below.
Class description:
Table ``users`` with fields: * ``user_id`` - UUID primary key of length 38 * ``user_name`` - String of maximum length 30 * ``num_games`` - Integer count of games started * ``outcomes`` - JSON string storing game counts by outcome * ``by_lang`` - JSO... | Implement the Python class `User` described below.
Class description:
Table ``users`` with fields: * ``user_id`` - UUID primary key of length 38 * ``user_name`` - String of maximum length 30 * ``num_games`` - Integer count of games started * ``outcomes`` - JSON string storing game counts by outcome * ``by_lang`` - JSO... | 55871c1dd2ae9b79d82a21dd2b73746c77d0bc41 | <|skeleton|>
class User:
"""Table ``users`` with fields: * ``user_id`` - UUID primary key of length 38 * ``user_name`` - String of maximum length 30 * ``num_games`` - Integer count of games started * ``outcomes`` - JSON string storing game counts by outcome * ``by_lang`` - JSON string storing game counts by game la... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class User:
"""Table ``users`` with fields: * ``user_id`` - UUID primary key of length 38 * ``user_name`` - String of maximum length 30 * ``num_games`` - Integer count of games started * ``outcomes`` - JSON string storing game counts by outcome * ``by_lang`` - JSON string storing game counts by game language * ``fi... | the_stack_v2_python_sparse | server/langman_orm.py | socratecha/frapbook-v1.0-langman | train | 2 |
e6c89bf384975eaee93f59265e6bed0afdd03055 | [
"trie = Trie(words)\nres = []\nfor w in words:\n res.append(sum(trie.countWordStartsWith(w)))\nreturn res",
"mp = defaultdict(int)\nfor word in words:\n for i in range(len(word)):\n mp[word[:i + 1]] += 1\nres = []\nfor word in words:\n count = 0\n for i in range(len(word)):\n count += mp... | <|body_start_0|>
trie = Trie(words)
res = []
for w in words:
res.append(sum(trie.countWordStartsWith(w)))
return res
<|end_body_0|>
<|body_start_1|>
mp = defaultdict(int)
for word in words:
for i in range(len(word)):
mp[word[:i + 1... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def sumPrefixScores(self, words: List[str]) -> List[int]:
"""1. 字典树"""
<|body_0|>
def sumPrefixScores2(self, words: List[str]) -> List[int]:
"""2. 暴力切片 # !python 暴力 4400ms js 暴力 9000ms python 字符串切片比js快很多 # !字符串长度<=1000时 字符串切片可以当作常数时间"""
<|body_1|>
... | stack_v2_sparse_classes_36k_train_004427 | 1,935 | no_license | [
{
"docstring": "1. 字典树",
"name": "sumPrefixScores",
"signature": "def sumPrefixScores(self, words: List[str]) -> List[int]"
},
{
"docstring": "2. 暴力切片 # !python 暴力 4400ms js 暴力 9000ms python 字符串切片比js快很多 # !字符串长度<=1000时 字符串切片可以当作常数时间",
"name": "sumPrefixScores2",
"signature": "def sumPref... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def sumPrefixScores(self, words: List[str]) -> List[int]: 1. 字典树
- def sumPrefixScores2(self, words: List[str]) -> List[int]: 2. 暴力切片 # !python 暴力 4400ms js 暴力 9000ms python 字符串切... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def sumPrefixScores(self, words: List[str]) -> List[int]: 1. 字典树
- def sumPrefixScores2(self, words: List[str]) -> List[int]: 2. 暴力切片 # !python 暴力 4400ms js 暴力 9000ms python 字符串切... | 7e79e26bb8f641868561b186e34c1127ed63c9e0 | <|skeleton|>
class Solution:
def sumPrefixScores(self, words: List[str]) -> List[int]:
"""1. 字典树"""
<|body_0|>
def sumPrefixScores2(self, words: List[str]) -> List[int]:
"""2. 暴力切片 # !python 暴力 4400ms js 暴力 9000ms python 字符串切片比js快很多 # !字符串长度<=1000时 字符串切片可以当作常数时间"""
<|body_1|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def sumPrefixScores(self, words: List[str]) -> List[int]:
"""1. 字典树"""
trie = Trie(words)
res = []
for w in words:
res.append(sum(trie.countWordStartsWith(w)))
return res
def sumPrefixScores2(self, words: List[str]) -> List[int]:
"""2.... | the_stack_v2_python_sparse | 6_tree/前缀树trie/6183. 字符串的前缀分数和.py | 981377660LMT/algorithm-study | train | 225 | |
b262c340a44780636a623d2e6a78f82fc81ace64 | [
"if d and 'object_type' in d:\n ObjectRegistry.registry[d['object_type']] = self\nABCMeta.__init__(self, name, bases, d)",
"if name in ObjectRegistry.registry:\n return ObjectRegistry.registry[name](**kwargs)\nraise NotImplementedError(gettext(\"This feature has not been implemented for object type '{0}'.\"... | <|body_start_0|>
if d and 'object_type' in d:
ObjectRegistry.registry[d['object_type']] = self
ABCMeta.__init__(self, name, bases, d)
<|end_body_0|>
<|body_start_1|>
if name in ObjectRegistry.registry:
return ObjectRegistry.registry[name](**kwargs)
raise NotImple... | class ObjectRegistry(ABCMeta) Every object will be registered automatically by its object type. Class-level Methods: ----------- ------- * get_object(cls, name, **kwargs) - This method returns the object based on register object type else return not implemented error. | ObjectRegistry | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ObjectRegistry:
"""class ObjectRegistry(ABCMeta) Every object will be registered automatically by its object type. Class-level Methods: ----------- ------- * get_object(cls, name, **kwargs) - This method returns the object based on register object type else return not implemented error."""
d... | stack_v2_sparse_classes_36k_train_004428 | 31,605 | permissive | [
{
"docstring": "This method is used to register the objects based on object type.",
"name": "__init__",
"signature": "def __init__(self, name, bases, d)"
},
{
"docstring": "This method returns the object based on register object type else return not implemented error Args: name: object type for ... | 2 | stack_v2_sparse_classes_30k_test_000970 | Implement the Python class `ObjectRegistry` described below.
Class description:
class ObjectRegistry(ABCMeta) Every object will be registered automatically by its object type. Class-level Methods: ----------- ------- * get_object(cls, name, **kwargs) - This method returns the object based on register object type else ... | Implement the Python class `ObjectRegistry` described below.
Class description:
class ObjectRegistry(ABCMeta) Every object will be registered automatically by its object type. Class-level Methods: ----------- ------- * get_object(cls, name, **kwargs) - This method returns the object based on register object type else ... | 2cb4b45dd14a230aa0e800042e893f8dfb23beda | <|skeleton|>
class ObjectRegistry:
"""class ObjectRegistry(ABCMeta) Every object will be registered automatically by its object type. Class-level Methods: ----------- ------- * get_object(cls, name, **kwargs) - This method returns the object based on register object type else return not implemented error."""
d... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ObjectRegistry:
"""class ObjectRegistry(ABCMeta) Every object will be registered automatically by its object type. Class-level Methods: ----------- ------- * get_object(cls, name, **kwargs) - This method returns the object based on register object type else return not implemented error."""
def __init__(s... | the_stack_v2_python_sparse | _MY_ORGS/Web-Dev-Collaborative/blog-research/database/pg-admin/web/pgadmin/tools/sqleditor/command.py | bgoonz/UsefulResourceRepo2.0 | train | 10 |
2ec8bf069ad3cb19ae038c139c25629bbc1c95d3 | [
"self.count = 0\nself.target = sum\nself.helper(root)\nreturn self.count",
"if not root:\n return []\nelse:\n left = self.helper(root.left)\n right = self.helper(root.right)\n res = [root.val]\n if root.val == self.target:\n self.count += 1\n for num in left + right:\n res.append(r... | <|body_start_0|>
self.count = 0
self.target = sum
self.helper(root)
return self.count
<|end_body_0|>
<|body_start_1|>
if not root:
return []
else:
left = self.helper(root.left)
right = self.helper(root.right)
res = [root.va... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def pathSum(self, root, sum):
""":type root: TreeNode :type sum: int :rtype: int"""
<|body_0|>
def helper(self, root):
"""get a list of sums including: (1) this node's value (so this node serves as the end) (2) this node's value + left child's sums list (in... | stack_v2_sparse_classes_36k_train_004429 | 3,257 | no_license | [
{
"docstring": ":type root: TreeNode :type sum: int :rtype: int",
"name": "pathSum",
"signature": "def pathSum(self, root, sum)"
},
{
"docstring": "get a list of sums including: (1) this node's value (so this node serves as the end) (2) this node's value + left child's sums list (include left ch... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def pathSum(self, root, sum): :type root: TreeNode :type sum: int :rtype: int
- def helper(self, root): get a list of sums including: (1) this node's value (so this node serves a... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def pathSum(self, root, sum): :type root: TreeNode :type sum: int :rtype: int
- def helper(self, root): get a list of sums including: (1) this node's value (so this node serves a... | 635af6e22aa8eef8e7920a585d43a45a891a8157 | <|skeleton|>
class Solution:
def pathSum(self, root, sum):
""":type root: TreeNode :type sum: int :rtype: int"""
<|body_0|>
def helper(self, root):
"""get a list of sums including: (1) this node's value (so this node serves as the end) (2) this node's value + left child's sums list (in... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def pathSum(self, root, sum):
""":type root: TreeNode :type sum: int :rtype: int"""
self.count = 0
self.target = sum
self.helper(root)
return self.count
def helper(self, root):
"""get a list of sums including: (1) this node's value (so this node s... | the_stack_v2_python_sparse | code437PathSumIII.py | cybelewang/leetcode-python | train | 0 | |
357b4b7e64ee4a0b6d7cca0424e6584bbede3373 | [
"entry1 = stats_values.StatsStoreEntry(process_id='test_process', metric_name='test_metric', metric_value=stats_values.StatsStoreValue(value_type=rdf_stats.MetricMetadata.ValueType.INT, fields_values=[stats_values.StatsStoreFieldValue(field_type=rdf_stats.MetricFieldDefinition.FieldType.STR, str_value='dim1'), stat... | <|body_start_0|>
entry1 = stats_values.StatsStoreEntry(process_id='test_process', metric_name='test_metric', metric_value=stats_values.StatsStoreValue(value_type=rdf_stats.MetricMetadata.ValueType.INT, fields_values=[stats_values.StatsStoreFieldValue(field_type=rdf_stats.MetricFieldDefinition.FieldType.STR, str... | StatsDBUtilsTest | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StatsDBUtilsTest:
def testStatsEntryId_VaryStringDimensions(self):
"""Ensures StatsEntries with different str dimensions get different ids."""
<|body_0|>
def testStatsEntryId_VaryIntDimensions(self):
"""Ensures StatsEntries with different int dimensions get different... | stack_v2_sparse_classes_36k_train_004430 | 7,868 | permissive | [
{
"docstring": "Ensures StatsEntries with different str dimensions get different ids.",
"name": "testStatsEntryId_VaryStringDimensions",
"signature": "def testStatsEntryId_VaryStringDimensions(self)"
},
{
"docstring": "Ensures StatsEntries with different int dimensions get different ids.",
"... | 3 | stack_v2_sparse_classes_30k_train_003793 | Implement the Python class `StatsDBUtilsTest` described below.
Class description:
Implement the StatsDBUtilsTest class.
Method signatures and docstrings:
- def testStatsEntryId_VaryStringDimensions(self): Ensures StatsEntries with different str dimensions get different ids.
- def testStatsEntryId_VaryIntDimensions(se... | Implement the Python class `StatsDBUtilsTest` described below.
Class description:
Implement the StatsDBUtilsTest class.
Method signatures and docstrings:
- def testStatsEntryId_VaryStringDimensions(self): Ensures StatsEntries with different str dimensions get different ids.
- def testStatsEntryId_VaryIntDimensions(se... | cfc725b5ee3a2626ac4cdae7fb14471612da4522 | <|skeleton|>
class StatsDBUtilsTest:
def testStatsEntryId_VaryStringDimensions(self):
"""Ensures StatsEntries with different str dimensions get different ids."""
<|body_0|>
def testStatsEntryId_VaryIntDimensions(self):
"""Ensures StatsEntries with different int dimensions get different... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class StatsDBUtilsTest:
def testStatsEntryId_VaryStringDimensions(self):
"""Ensures StatsEntries with different str dimensions get different ids."""
entry1 = stats_values.StatsStoreEntry(process_id='test_process', metric_name='test_metric', metric_value=stats_values.StatsStoreValue(value_type=rdf_st... | the_stack_v2_python_sparse | grr/server/grr_response_server/db_utils_test.py | 4ndygu/grr | train | 0 | |
0000676cc93b8e397479fab7fc4b243e12d0a16a | [
"if type(data) is not np.ndarray or len(data.shape) != 2:\n raise TypeError('data must be a 2D numpy.ndarray')\nd, n = data.shape\nif n < 2:\n raise ValueError('data must contain multiple data points')\nmean = np.mean(data, axis=1, keepdims=True)\nself.mean = mean\ncov = np.matmul(data - mean, data.T - mean.T... | <|body_start_0|>
if type(data) is not np.ndarray or len(data.shape) != 2:
raise TypeError('data must be a 2D numpy.ndarray')
d, n = data.shape
if n < 2:
raise ValueError('data must contain multiple data points')
mean = np.mean(data, axis=1, keepdims=True)
... | Class that represents Multivariate Normal Distribution class constructor: def __init__(self, data) public instance variables: mean [numpy.ndarray of shape (d, 1)]: contains the mean of data cov [numpy.ndarray of shape (d, d)]: contains the covariance matrix of data public instance method: def pdf(self, x): calculates t... | MultiNormal | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MultiNormal:
"""Class that represents Multivariate Normal Distribution class constructor: def __init__(self, data) public instance variables: mean [numpy.ndarray of shape (d, 1)]: contains the mean of data cov [numpy.ndarray of shape (d, d)]: contains the covariance matrix of data public instance... | stack_v2_sparse_classes_36k_train_004431 | 2,274 | no_license | [
{
"docstring": "Class constructor parameters: data [numpy.ndarray of shape (d, n)]: contains the data set d: number of dimensions in each data point n: number of data points",
"name": "__init__",
"signature": "def __init__(self, data)"
},
{
"docstring": "Calculates the PDF at a data point parame... | 2 | null | Implement the Python class `MultiNormal` described below.
Class description:
Class that represents Multivariate Normal Distribution class constructor: def __init__(self, data) public instance variables: mean [numpy.ndarray of shape (d, 1)]: contains the mean of data cov [numpy.ndarray of shape (d, d)]: contains the co... | Implement the Python class `MultiNormal` described below.
Class description:
Class that represents Multivariate Normal Distribution class constructor: def __init__(self, data) public instance variables: mean [numpy.ndarray of shape (d, 1)]: contains the mean of data cov [numpy.ndarray of shape (d, d)]: contains the co... | 8834b201ca84937365e4dcc0fac978656cdf5293 | <|skeleton|>
class MultiNormal:
"""Class that represents Multivariate Normal Distribution class constructor: def __init__(self, data) public instance variables: mean [numpy.ndarray of shape (d, 1)]: contains the mean of data cov [numpy.ndarray of shape (d, d)]: contains the covariance matrix of data public instance... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MultiNormal:
"""Class that represents Multivariate Normal Distribution class constructor: def __init__(self, data) public instance variables: mean [numpy.ndarray of shape (d, 1)]: contains the mean of data cov [numpy.ndarray of shape (d, d)]: contains the covariance matrix of data public instance method: def ... | the_stack_v2_python_sparse | math/0x06-multivariate_prob/multinormal.py | ejonakodra/holbertonschool-machine_learning-1 | train | 0 |
2844b5ac8b823775a8675ba32e0092b1e34b8671 | [
"self.S = 0.5 * (self.R + self.L)\nself.D = 0.5 * (self.R - self.L)\nreturn self",
"m_e = gamma * cgs.me\nm_i = cgs.mp\nn_i = n_e\nomega = 2 * np.pi * ghz * 1000000000.0\nom_pe = omega_plasma(n_e, m_e)\nom_pi = omega_plasma(n_i, m_i)\nom_ce = omega_cyclotron(-1, B, m_e)\nom_ci = omega_cyclotron(+1, B, m_i)\nalpha... | <|body_start_0|>
self.S = 0.5 * (self.R + self.L)
self.D = 0.5 * (self.R - self.L)
return self
<|end_body_0|>
<|body_start_1|>
m_e = gamma * cgs.me
m_i = cgs.mp
n_i = n_e
omega = 2 * np.pi * ghz * 1000000000.0
om_pe = omega_plasma(n_e, m_e)
om_pi ... | Parameters | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Parameters:
def _finish(self):
"""Stix equation 1-19."""
<|body_0|>
def new_basic(cls, ghz, n_e, B, gamma=1.0):
"""Set up plasma parameters for an electron-proton plasma in the standard cold approximation. ghz The oscillation frequency of the modes to consider, in GH... | stack_v2_sparse_classes_36k_train_004432 | 10,768 | permissive | [
{
"docstring": "Stix equation 1-19.",
"name": "_finish",
"signature": "def _finish(self)"
},
{
"docstring": "Set up plasma parameters for an electron-proton plasma in the standard cold approximation. ghz The oscillation frequency of the modes to consider, in GHz. (Note that ideally we'd express ... | 4 | stack_v2_sparse_classes_30k_train_014129 | Implement the Python class `Parameters` described below.
Class description:
Implement the Parameters class.
Method signatures and docstrings:
- def _finish(self): Stix equation 1-19.
- def new_basic(cls, ghz, n_e, B, gamma=1.0): Set up plasma parameters for an electron-proton plasma in the standard cold approximation... | Implement the Python class `Parameters` described below.
Class description:
Implement the Parameters class.
Method signatures and docstrings:
- def _finish(self): Stix equation 1-19.
- def new_basic(cls, ghz, n_e, B, gamma=1.0): Set up plasma parameters for an electron-proton plasma in the standard cold approximation... | 9dd52d813722d0932195723cf8c37a5dd2fd0d25 | <|skeleton|>
class Parameters:
def _finish(self):
"""Stix equation 1-19."""
<|body_0|>
def new_basic(cls, ghz, n_e, B, gamma=1.0):
"""Set up plasma parameters for an electron-proton plasma in the standard cold approximation. ghz The oscillation frequency of the modes to consider, in GH... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Parameters:
def _finish(self):
"""Stix equation 1-19."""
self.S = 0.5 * (self.R + self.L)
self.D = 0.5 * (self.R - self.L)
return self
def new_basic(cls, ghz, n_e, B, gamma=1.0):
"""Set up plasma parameters for an electron-proton plasma in the standard cold approxi... | the_stack_v2_python_sparse | vernon/plasma.py | pkgw/vernon | train | 1 | |
9e37b728d8045726aef7625fccc14111ecb0e1c8 | [
"self.size = size\nself.q = collections.deque()\nself.sum_ = 0",
"if len(self.q) == self.size:\n a = self.q.popleft()\n self.sum_ -= a\nself.q.append(val)\nself.sum_ += val\nreturn float(self.sum_) / len(self.q)"
] | <|body_start_0|>
self.size = size
self.q = collections.deque()
self.sum_ = 0
<|end_body_0|>
<|body_start_1|>
if len(self.q) == self.size:
a = self.q.popleft()
self.sum_ -= a
self.q.append(val)
self.sum_ += val
return float(self.sum_) / len... | MovingAverage | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MovingAverage:
def __init__(self, size):
"""Initialize your data structure here. :type size: int"""
<|body_0|>
def next(self, val):
""":type val: int :rtype: float"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
self.size = size
self.q = col... | stack_v2_sparse_classes_36k_train_004433 | 826 | no_license | [
{
"docstring": "Initialize your data structure here. :type size: int",
"name": "__init__",
"signature": "def __init__(self, size)"
},
{
"docstring": ":type val: int :rtype: float",
"name": "next",
"signature": "def next(self, val)"
}
] | 2 | stack_v2_sparse_classes_30k_train_003663 | Implement the Python class `MovingAverage` described below.
Class description:
Implement the MovingAverage class.
Method signatures and docstrings:
- def __init__(self, size): Initialize your data structure here. :type size: int
- def next(self, val): :type val: int :rtype: float | Implement the Python class `MovingAverage` described below.
Class description:
Implement the MovingAverage class.
Method signatures and docstrings:
- def __init__(self, size): Initialize your data structure here. :type size: int
- def next(self, val): :type val: int :rtype: float
<|skeleton|>
class MovingAverage:
... | e890bd480de93418ce10867085b52137be2caa7a | <|skeleton|>
class MovingAverage:
def __init__(self, size):
"""Initialize your data structure here. :type size: int"""
<|body_0|>
def next(self, val):
""":type val: int :rtype: float"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MovingAverage:
def __init__(self, size):
"""Initialize your data structure here. :type size: int"""
self.size = size
self.q = collections.deque()
self.sum_ = 0
def next(self, val):
""":type val: int :rtype: float"""
if len(self.q) == self.size:
... | the_stack_v2_python_sparse | python/346.py | LichAmnesia/LeetCode | train | 0 | |
820ea7fec2bc95abcef0a8e598e632a2cff9bd6b | [
"amount = 1\nch = self.get_pingpp().Charge.create(order_no='cmm' + str(int(time.time())), channel=channel, amount=amount, subject=PAY_TYPE[pay_type], body=PAY_TYPE[pay_type], currency='cny', app=dict(id=settings.PINGXX_APPID), client_ip=client_ip, extra=extra)\nprint(ch)\nreturn ch",
"withdraw = Withdraw.objects.... | <|body_start_0|>
amount = 1
ch = self.get_pingpp().Charge.create(order_no='cmm' + str(int(time.time())), channel=channel, amount=amount, subject=PAY_TYPE[pay_type], body=PAY_TYPE[pay_type], currency='cny', app=dict(id=settings.PINGXX_APPID), client_ip=client_ip, extra=extra)
print(ch)
re... | ChargeService | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ChargeService:
def pay(self, user_id=None, amount=0, channel='wx', pay_type=0, client_ip='127.0.0.1', extra={}):
"""支付 :params :channel 支付渠道 :params :subject 支付主题 :prams :body 支付内容 :params :user_id 用户标识 :params :amount 支付金额"""
<|body_0|>
def comfirm_withdraw(self, user_id, w... | stack_v2_sparse_classes_36k_train_004434 | 3,601 | permissive | [
{
"docstring": "支付 :params :channel 支付渠道 :params :subject 支付主题 :prams :body 支付内容 :params :user_id 用户标识 :params :amount 支付金额",
"name": "pay",
"signature": "def pay(self, user_id=None, amount=0, channel='wx', pay_type=0, client_ip='127.0.0.1', extra={})"
},
{
"docstring": "提现",
"name": "comfir... | 4 | stack_v2_sparse_classes_30k_train_004283 | Implement the Python class `ChargeService` described below.
Class description:
Implement the ChargeService class.
Method signatures and docstrings:
- def pay(self, user_id=None, amount=0, channel='wx', pay_type=0, client_ip='127.0.0.1', extra={}): 支付 :params :channel 支付渠道 :params :subject 支付主题 :prams :body 支付内容 :para... | Implement the Python class `ChargeService` described below.
Class description:
Implement the ChargeService class.
Method signatures and docstrings:
- def pay(self, user_id=None, amount=0, channel='wx', pay_type=0, client_ip='127.0.0.1', extra={}): 支付 :params :channel 支付渠道 :params :subject 支付主题 :prams :body 支付内容 :para... | f92357e1962b3ae4d6c2125fb3b71844ae59d3dd | <|skeleton|>
class ChargeService:
def pay(self, user_id=None, amount=0, channel='wx', pay_type=0, client_ip='127.0.0.1', extra={}):
"""支付 :params :channel 支付渠道 :params :subject 支付主题 :prams :body 支付内容 :params :user_id 用户标识 :params :amount 支付金额"""
<|body_0|>
def comfirm_withdraw(self, user_id, w... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ChargeService:
def pay(self, user_id=None, amount=0, channel='wx', pay_type=0, client_ip='127.0.0.1', extra={}):
"""支付 :params :channel 支付渠道 :params :subject 支付主题 :prams :body 支付内容 :params :user_id 用户标识 :params :amount 支付金额"""
amount = 1
ch = self.get_pingpp().Charge.create(order_no='c... | the_stack_v2_python_sparse | oms_server/services/charge_service.py | jinpy666/OMS | train | 0 | |
7652bc8c9b4d40ab67a82c9f5a74fb24a749d89e | [
"mock_zhifu.return_value = {'result': 'success', 'reason': 'null'}\nstatues = temple.zhifu_statues()\nprint(statues)\nself.assertEqual(statues, '支付成功')",
"mock_zhifu.return_value = {'result': 'fail', 'reason': '余额不足'}\nstatues = temple.zhifu_statues()\nself.assertEqual(statues, '支付失败')"
] | <|body_start_0|>
mock_zhifu.return_value = {'result': 'success', 'reason': 'null'}
statues = temple.zhifu_statues()
print(statues)
self.assertEqual(statues, '支付成功')
<|end_body_0|>
<|body_start_1|>
mock_zhifu.return_value = {'result': 'fail', 'reason': '余额不足'}
statues = t... | 单元测试用例 | Test_zhifu_statues_withpatch | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Test_zhifu_statues_withpatch:
"""单元测试用例"""
def test_01(self, mock_zhifu):
"""测试支付成功场景"""
<|body_0|>
def test_02(self, mock_zhifu):
"""测试支付失败场景"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
mock_zhifu.return_value = {'result': 'success', 'reaso... | stack_v2_sparse_classes_36k_train_004435 | 4,862 | no_license | [
{
"docstring": "测试支付成功场景",
"name": "test_01",
"signature": "def test_01(self, mock_zhifu)"
},
{
"docstring": "测试支付失败场景",
"name": "test_02",
"signature": "def test_02(self, mock_zhifu)"
}
] | 2 | stack_v2_sparse_classes_30k_train_017761 | Implement the Python class `Test_zhifu_statues_withpatch` described below.
Class description:
单元测试用例
Method signatures and docstrings:
- def test_01(self, mock_zhifu): 测试支付成功场景
- def test_02(self, mock_zhifu): 测试支付失败场景 | Implement the Python class `Test_zhifu_statues_withpatch` described below.
Class description:
单元测试用例
Method signatures and docstrings:
- def test_01(self, mock_zhifu): 测试支付成功场景
- def test_02(self, mock_zhifu): 测试支付失败场景
<|skeleton|>
class Test_zhifu_statues_withpatch:
"""单元测试用例"""
def test_01(self, mock_zhif... | a58fdcc3eb0b52c94e50a110b4f1a053c6fa0ab2 | <|skeleton|>
class Test_zhifu_statues_withpatch:
"""单元测试用例"""
def test_01(self, mock_zhifu):
"""测试支付成功场景"""
<|body_0|>
def test_02(self, mock_zhifu):
"""测试支付失败场景"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Test_zhifu_statues_withpatch:
"""单元测试用例"""
def test_01(self, mock_zhifu):
"""测试支付成功场景"""
mock_zhifu.return_value = {'result': 'success', 'reason': 'null'}
statues = temple.zhifu_statues()
print(statues)
self.assertEqual(statues, '支付成功')
def test_02(self, mock_... | the_stack_v2_python_sparse | testcase/test_temple.py | yangyilin182/IotInterFace | train | 0 |
1ea156fe30c9b93415dd21f0bacf7a1e197c8205 | [
"super(DMSelfAttention, self).__init__(name=name)\nself._normalizer = gn.modules._unsorted_segment_softmax\nself._kq_dim_division = kq_dim_division\nself._kq_dim = kq_dim",
"sender_keys = gn.blocks.broadcast_sender_nodes_to_edges(attention_graph.replace(nodes=node_keys))\nsender_values = gn.blocks.broadcast_sende... | <|body_start_0|>
super(DMSelfAttention, self).__init__(name=name)
self._normalizer = gn.modules._unsorted_segment_softmax
self._kq_dim_division = kq_dim_division
self._kq_dim = kq_dim
<|end_body_0|>
<|body_start_1|>
sender_keys = gn.blocks.broadcast_sender_nodes_to_edges(attenti... | Multi-head self-attention module. The module is based on the following three papers: * A simple neural network module for relational reasoning (RNs): https://arxiv.org/abs/1706.01427 * Non-local Neural Networks: https://arxiv.org/abs/1711.07971. * Attention Is All You Need (AIAYN): https://arxiv.org/abs/1706.03762. The... | DMSelfAttention | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DMSelfAttention:
"""Multi-head self-attention module. The module is based on the following three papers: * A simple neural network module for relational reasoning (RNs): https://arxiv.org/abs/1706.01427 * Non-local Neural Networks: https://arxiv.org/abs/1711.07971. * Attention Is All You Need (AI... | stack_v2_sparse_classes_36k_train_004436 | 43,752 | no_license | [
{
"docstring": "Inits the module. Args: name: The module name.",
"name": "__init__",
"signature": "def __init__(self, kq_dim_division, kq_dim, name='dm_self_attention')"
},
{
"docstring": "Connects the multi-head self-attention module. The self-attention is only computed according to the connect... | 2 | stack_v2_sparse_classes_30k_train_021475 | Implement the Python class `DMSelfAttention` described below.
Class description:
Multi-head self-attention module. The module is based on the following three papers: * A simple neural network module for relational reasoning (RNs): https://arxiv.org/abs/1706.01427 * Non-local Neural Networks: https://arxiv.org/abs/1711... | Implement the Python class `DMSelfAttention` described below.
Class description:
Multi-head self-attention module. The module is based on the following three papers: * A simple neural network module for relational reasoning (RNs): https://arxiv.org/abs/1706.01427 * Non-local Neural Networks: https://arxiv.org/abs/1711... | 212b45a74db63cbf371478d72ed467e372803a47 | <|skeleton|>
class DMSelfAttention:
"""Multi-head self-attention module. The module is based on the following three papers: * A simple neural network module for relational reasoning (RNs): https://arxiv.org/abs/1706.01427 * Non-local Neural Networks: https://arxiv.org/abs/1711.07971. * Attention Is All You Need (AI... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DMSelfAttention:
"""Multi-head self-attention module. The module is based on the following three papers: * A simple neural network module for relational reasoning (RNs): https://arxiv.org/abs/1706.01427 * Non-local Neural Networks: https://arxiv.org/abs/1711.07971. * Attention Is All You Need (AIAYN): https:/... | the_stack_v2_python_sparse | gnn.py | xju2/graph-normalizing-flows | train | 1 |
56d0fbb0193432d8084ea39ca535d9394ce8a0e8 | [
"self.use_trigger_channel_model = use_trigger_channel_model\nself.use_action_channel_model = use_action_channel_model\nself.use_trigger_fn_model = use_trigger_fn_model\nself.use_action_fn_model = use_action_fn_model",
"args, model_classes = ([], [])\nif self.use_trigger_channel_model:\n args.append(self.t_chan... | <|body_start_0|>
self.use_trigger_channel_model = use_trigger_channel_model
self.use_action_channel_model = use_action_channel_model
self.use_trigger_fn_model = use_trigger_fn_model
self.use_action_fn_model = use_action_fn_model
<|end_body_0|>
<|body_start_1|>
args, model_classe... | Model class that combines different types of models -- such as `TriggerChannelModel`, `ActionChannelModel`, and `EnsembledModel` -- and exposes methods to enable them to be evaluated or used on the same set of examples or inputs. Attributes: use_trigger_channel_model (bool): Set to `True` if the trained `TriggerChannel... | CombinedModel | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CombinedModel:
"""Model class that combines different types of models -- such as `TriggerChannelModel`, `ActionChannelModel`, and `EnsembledModel` -- and exposes methods to enable them to be evaluated or used on the same set of examples or inputs. Attributes: use_trigger_channel_model (bool): Set... | stack_v2_sparse_classes_36k_train_004437 | 33,655 | no_license | [
{
"docstring": "Sets which types of models to include in the cocktail of models to be used together. Args: use_trigger_channel_model (bool): Add an ensemble of `TriggerChannelModel` models to the cocktail of models if `True`. Defaults to `True`. use_action_channel_model (bool): Add an ensemble of `ActionChannel... | 5 | stack_v2_sparse_classes_30k_train_020154 | Implement the Python class `CombinedModel` described below.
Class description:
Model class that combines different types of models -- such as `TriggerChannelModel`, `ActionChannelModel`, and `EnsembledModel` -- and exposes methods to enable them to be evaluated or used on the same set of examples or inputs. Attributes... | Implement the Python class `CombinedModel` described below.
Class description:
Model class that combines different types of models -- such as `TriggerChannelModel`, `ActionChannelModel`, and `EnsembledModel` -- and exposes methods to enable them to be evaluated or used on the same set of examples or inputs. Attributes... | 578323676c040f881d79e6dfae96522639fdb753 | <|skeleton|>
class CombinedModel:
"""Model class that combines different types of models -- such as `TriggerChannelModel`, `ActionChannelModel`, and `EnsembledModel` -- and exposes methods to enable them to be evaluated or used on the same set of examples or inputs. Attributes: use_trigger_channel_model (bool): Set... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CombinedModel:
"""Model class that combines different types of models -- such as `TriggerChannelModel`, `ActionChannelModel`, and `EnsembledModel` -- and exposes methods to enable them to be evaluated or used on the same set of examples or inputs. Attributes: use_trigger_channel_model (bool): Set to `True` if... | the_stack_v2_python_sparse | parser/combined_model.py | shobhit6993/natural-language-to-code | train | 1 |
797dfcfff6749fb51880e5888829a1c957e406fe | [
"Parametre.__init__(self, 'creer', 'create')\nself.schema = '(<cle>)'\nself.aide_courte = 'crée une perturbation'\nself.aide_longue = \"Cette commande permet de créer une perturbation météorologique dans la salle où vous vous trouvez (par exemple, faire apparaître un nuage). La salle où vous vous trouvez est prise ... | <|body_start_0|>
Parametre.__init__(self, 'creer', 'create')
self.schema = '(<cle>)'
self.aide_courte = 'crée une perturbation'
self.aide_longue = "Cette commande permet de créer une perturbation météorologique dans la salle où vous vous trouvez (par exemple, faire apparaître un nuage). ... | Commande 'meteo créer' | PrmCreer | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class PrmCreer:
"""Commande 'meteo créer'"""
def __init__(self):
"""Constructeur du paramètre."""
<|body_0|>
def interpreter(self, personnage, dic_masques):
"""Méthode d'interprétation de commande"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
Parame... | stack_v2_sparse_classes_36k_train_004438 | 4,658 | permissive | [
{
"docstring": "Constructeur du paramètre.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Méthode d'interprétation de commande",
"name": "interpreter",
"signature": "def interpreter(self, personnage, dic_masques)"
}
] | 2 | stack_v2_sparse_classes_30k_train_001504 | Implement the Python class `PrmCreer` described below.
Class description:
Commande 'meteo créer'
Method signatures and docstrings:
- def __init__(self): Constructeur du paramètre.
- def interpreter(self, personnage, dic_masques): Méthode d'interprétation de commande | Implement the Python class `PrmCreer` described below.
Class description:
Commande 'meteo créer'
Method signatures and docstrings:
- def __init__(self): Constructeur du paramètre.
- def interpreter(self, personnage, dic_masques): Méthode d'interprétation de commande
<|skeleton|>
class PrmCreer:
"""Commande 'mete... | 7e93bff08cdf891352efba587e89c40f3b4a2301 | <|skeleton|>
class PrmCreer:
"""Commande 'meteo créer'"""
def __init__(self):
"""Constructeur du paramètre."""
<|body_0|>
def interpreter(self, personnage, dic_masques):
"""Méthode d'interprétation de commande"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class PrmCreer:
"""Commande 'meteo créer'"""
def __init__(self):
"""Constructeur du paramètre."""
Parametre.__init__(self, 'creer', 'create')
self.schema = '(<cle>)'
self.aide_courte = 'crée une perturbation'
self.aide_longue = "Cette commande permet de créer une perturb... | the_stack_v2_python_sparse | src/primaires/meteo/commandes/meteo/creer.py | vincent-lg/tsunami | train | 5 |
71c1f64447557adcf48dfc35654bdeec9fa506b4 | [
"session = requests.Session()\nlogin_res = session.post(url=self.TestData['login']['login_url'], data=self.TestData['login']['login_data'], headers=self.headers)\nself.assertTrue(login_res.status_code == 200)\nLogger(self.TestData['name']).Info(str(self.TestData['login']) + '\\n' + login_res.text)\nsession.close()"... | <|body_start_0|>
session = requests.Session()
login_res = session.post(url=self.TestData['login']['login_url'], data=self.TestData['login']['login_data'], headers=self.headers)
self.assertTrue(login_res.status_code == 200)
Logger(self.TestData['name']).Info(str(self.TestData['login']) + ... | 商城接口测试 | MallAS | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MallAS:
"""商城接口测试"""
def test1(self):
"""登录接口测试"""
<|body_0|>
def test2(self):
"""商品分类标题展示"""
<|body_1|>
def test3(self):
"""商品信息信息展示"""
<|body_2|>
def test4(self):
"""店铺订单信息展示"""
<|body_3|>
def test5(self):
... | stack_v2_sparse_classes_36k_train_004439 | 6,191 | no_license | [
{
"docstring": "登录接口测试",
"name": "test1",
"signature": "def test1(self)"
},
{
"docstring": "商品分类标题展示",
"name": "test2",
"signature": "def test2(self)"
},
{
"docstring": "商品信息信息展示",
"name": "test3",
"signature": "def test3(self)"
},
{
"docstring": "店铺订单信息展示",
"... | 6 | null | Implement the Python class `MallAS` described below.
Class description:
商城接口测试
Method signatures and docstrings:
- def test1(self): 登录接口测试
- def test2(self): 商品分类标题展示
- def test3(self): 商品信息信息展示
- def test4(self): 店铺订单信息展示
- def test5(self): 店铺红包可用接口信息
- def test6(self): 店铺优惠券可用接口信息 | Implement the Python class `MallAS` described below.
Class description:
商城接口测试
Method signatures and docstrings:
- def test1(self): 登录接口测试
- def test2(self): 商品分类标题展示
- def test3(self): 商品信息信息展示
- def test4(self): 店铺订单信息展示
- def test5(self): 店铺红包可用接口信息
- def test6(self): 店铺优惠券可用接口信息
<|skeleton|>
class MallAS:
""... | c32f1686f44454ca2d32eb0a2a8258a0f5d64601 | <|skeleton|>
class MallAS:
"""商城接口测试"""
def test1(self):
"""登录接口测试"""
<|body_0|>
def test2(self):
"""商品分类标题展示"""
<|body_1|>
def test3(self):
"""商品信息信息展示"""
<|body_2|>
def test4(self):
"""店铺订单信息展示"""
<|body_3|>
def test5(self):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MallAS:
"""商城接口测试"""
def test1(self):
"""登录接口测试"""
session = requests.Session()
login_res = session.post(url=self.TestData['login']['login_url'], data=self.TestData['login']['login_data'], headers=self.headers)
self.assertTrue(login_res.status_code == 200)
Logger(s... | the_stack_v2_python_sparse | pycharmProjects/System_Api/Project/mall_ApiServer/MallApiS.py | xiaocheng903/projects | train | 0 |
bfeafaadc6fd0c350c3a59e02565ccf3be744853 | [
"products_db = ProductDbQueries()\norder_db = OrderDbQueries()\ndata = request.get_json()\nif validate_order(data) == 'valid':\n product_query = products_db.fetch_all_products()\n for product in product_query:\n if product['product_name'] == data['product_name']:\n username = current_user.us... | <|body_start_0|>
products_db = ProductDbQueries()
order_db = OrderDbQueries()
data = request.get_json()
if validate_order(data) == 'valid':
product_query = products_db.fetch_all_products()
for product in product_query:
if product['product_name'] ==... | OrderView | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OrderView:
def post(self, current_user):
"""Create an order."""
<|body_0|>
def get(self, current_user):
"""Return single user orders."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
products_db = ProductDbQueries()
order_db = OrderDbQueries(... | stack_v2_sparse_classes_36k_train_004440 | 3,187 | no_license | [
{
"docstring": "Create an order.",
"name": "post",
"signature": "def post(self, current_user)"
},
{
"docstring": "Return single user orders.",
"name": "get",
"signature": "def get(self, current_user)"
}
] | 2 | stack_v2_sparse_classes_30k_train_019401 | Implement the Python class `OrderView` described below.
Class description:
Implement the OrderView class.
Method signatures and docstrings:
- def post(self, current_user): Create an order.
- def get(self, current_user): Return single user orders. | Implement the Python class `OrderView` described below.
Class description:
Implement the OrderView class.
Method signatures and docstrings:
- def post(self, current_user): Create an order.
- def get(self, current_user): Return single user orders.
<|skeleton|>
class OrderView:
def post(self, current_user):
... | 4c02cb785ff39e99f678a9e36d992dcd62c01f2d | <|skeleton|>
class OrderView:
def post(self, current_user):
"""Create an order."""
<|body_0|>
def get(self, current_user):
"""Return single user orders."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class OrderView:
def post(self, current_user):
"""Create an order."""
products_db = ProductDbQueries()
order_db = OrderDbQueries()
data = request.get_json()
if validate_order(data) == 'valid':
product_query = products_db.fetch_all_products()
for produc... | the_stack_v2_python_sparse | app/orders/api.py | alexkayabula/data-vizr | train | 0 | |
80b2c664bf95039f3f1c8abb460ba7dc04c81b88 | [
"self.normalize = normalize\nself.image_normalize = ops.CropMirrorNormalize(device='gpu', mean=[value * 255 for value in mean], std=[value * 255 for value in std], output_layout='CHW', image_type=types.DALIImageType.BGR)\nself.scaler = ops.Normalize(device='gpu', scale=float(255 / scaler), mean=0, stddev=1)\nself.i... | <|body_start_0|>
self.normalize = normalize
self.image_normalize = ops.CropMirrorNormalize(device='gpu', mean=[value * 255 for value in mean], std=[value * 255 for value in std], output_layout='CHW', image_type=types.DALIImageType.BGR)
self.scaler = ops.Normalize(device='gpu', scale=float(255 / ... | Standard augmentation which resize the input image into desired size and pad it to square, also additionally normalize the input | StandardAugment | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StandardAugment:
"""Standard augmentation which resize the input image into desired size and pad it to square, also additionally normalize the input"""
def __init__(self, input_size: int, scaler: Union[int, float]=255, mean: List[float]=[0.0, 0.0, 0.0], std: List[float]=[1.0, 1.0, 1.0], imag... | stack_v2_sparse_classes_36k_train_004441 | 22,608 | no_license | [
{
"docstring": "Initialization Args: input_size (int): Target size of image resize scaler (Union[int,float], optional): The scaling factor applied to the input pixel value. Defaults to 255. mean (List[float], optional): Mean pixel values for image normalization. Defaults to [0.,0.,0.]. std (List[float], optiona... | 2 | stack_v2_sparse_classes_30k_val_001182 | Implement the Python class `StandardAugment` described below.
Class description:
Standard augmentation which resize the input image into desired size and pad it to square, also additionally normalize the input
Method signatures and docstrings:
- def __init__(self, input_size: int, scaler: Union[int, float]=255, mean:... | Implement the Python class `StandardAugment` described below.
Class description:
Standard augmentation which resize the input image into desired size and pad it to square, also additionally normalize the input
Method signatures and docstrings:
- def __init__(self, input_size: int, scaler: Union[int, float]=255, mean:... | 1532db8447d03e75d5ec26f93111270a4ccb7a7e | <|skeleton|>
class StandardAugment:
"""Standard augmentation which resize the input image into desired size and pad it to square, also additionally normalize the input"""
def __init__(self, input_size: int, scaler: Union[int, float]=255, mean: List[float]=[0.0, 0.0, 0.0], std: List[float]=[1.0, 1.0, 1.0], imag... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class StandardAugment:
"""Standard augmentation which resize the input image into desired size and pad it to square, also additionally normalize the input"""
def __init__(self, input_size: int, scaler: Union[int, float]=255, mean: List[float]=[0.0, 0.0, 0.0], std: List[float]=[1.0, 1.0, 1.0], image_pad_value: ... | the_stack_v2_python_sparse | src/development/vortex/development/utils/data/augment/modules/nvidia_dali/modules.py | jesslynsepthiaa/vortex | train | 0 |
85b64b8c19b12e6c1aad5839e39e5e9348d634ea | [
"INT_MAX = 2 ** 31 - 1\nm = len(matrix)\nif m < 1:\n return matrix\nn = len(matrix[0])\nfor i in range(m):\n for j in range(n):\n if matrix[i][j] != 0:\n matrix[i][j] = INT_MAX - 1\nfor i in range(m):\n for j in range(n):\n if matrix[i][j] != 0:\n if i > 0:\n ... | <|body_start_0|>
INT_MAX = 2 ** 31 - 1
m = len(matrix)
if m < 1:
return matrix
n = len(matrix[0])
for i in range(m):
for j in range(n):
if matrix[i][j] != 0:
matrix[i][j] = INT_MAX - 1
for i in range(m):
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def updateMatrix(self, matrix):
""":type matrix: List[List[int]] :rtype: List[List[int]]"""
<|body_0|>
def updateMatrix2(self, matrix):
""":type matrix: List[List[int]] :rtype: List[List[int]]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_36k_train_004442 | 3,369 | no_license | [
{
"docstring": ":type matrix: List[List[int]] :rtype: List[List[int]]",
"name": "updateMatrix",
"signature": "def updateMatrix(self, matrix)"
},
{
"docstring": ":type matrix: List[List[int]] :rtype: List[List[int]]",
"name": "updateMatrix2",
"signature": "def updateMatrix2(self, matrix)"... | 2 | stack_v2_sparse_classes_30k_train_020722 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def updateMatrix(self, matrix): :type matrix: List[List[int]] :rtype: List[List[int]]
- def updateMatrix2(self, matrix): :type matrix: List[List[int]] :rtype: List[List[int]] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def updateMatrix(self, matrix): :type matrix: List[List[int]] :rtype: List[List[int]]
- def updateMatrix2(self, matrix): :type matrix: List[List[int]] :rtype: List[List[int]]
<|... | 635af6e22aa8eef8e7920a585d43a45a891a8157 | <|skeleton|>
class Solution:
def updateMatrix(self, matrix):
""":type matrix: List[List[int]] :rtype: List[List[int]]"""
<|body_0|>
def updateMatrix2(self, matrix):
""":type matrix: List[List[int]] :rtype: List[List[int]]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def updateMatrix(self, matrix):
""":type matrix: List[List[int]] :rtype: List[List[int]]"""
INT_MAX = 2 ** 31 - 1
m = len(matrix)
if m < 1:
return matrix
n = len(matrix[0])
for i in range(m):
for j in range(n):
i... | the_stack_v2_python_sparse | code542_01Matrix.py | cybelewang/leetcode-python | train | 0 | |
97aefb1f829cacd4aa4de3826dd561f8df89b185 | [
"xmltree = etree.fromstring('<video>test</video>')\noutput = self.xmodule.get_timeframe(xmltree)\nself.assertEqual(output, ('', ''))",
"xmltree = etree.fromstring('<video from=\"00:04:07\">test</video>')\noutput = self.xmodule.get_timeframe(xmltree)\nself.assertEqual(output, (247, ''))",
"xmltree = etree.fromst... | <|body_start_0|>
xmltree = etree.fromstring('<video>test</video>')
output = self.xmodule.get_timeframe(xmltree)
self.assertEqual(output, ('', ''))
<|end_body_0|>
<|body_start_1|>
xmltree = etree.fromstring('<video from="00:04:07">test</video>')
output = self.xmodule.get_timefram... | Tests for logic of Video Xmodule. | VideoModuleLogicTest | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class VideoModuleLogicTest:
"""Tests for logic of Video Xmodule."""
def test_get_timeframe_no_parameters(self):
"""Make sure that timeframe() works correctly w/o parameters"""
<|body_0|>
def test_get_timeframe_with_one_parameter(self):
"""Make sure that timeframe() wor... | stack_v2_sparse_classes_36k_train_004443 | 4,499 | no_license | [
{
"docstring": "Make sure that timeframe() works correctly w/o parameters",
"name": "test_get_timeframe_no_parameters",
"signature": "def test_get_timeframe_no_parameters(self)"
},
{
"docstring": "Make sure that timeframe() works correctly with one parameter",
"name": "test_get_timeframe_wit... | 3 | null | Implement the Python class `VideoModuleLogicTest` described below.
Class description:
Tests for logic of Video Xmodule.
Method signatures and docstrings:
- def test_get_timeframe_no_parameters(self): Make sure that timeframe() works correctly w/o parameters
- def test_get_timeframe_with_one_parameter(self): Make sure... | Implement the Python class `VideoModuleLogicTest` described below.
Class description:
Tests for logic of Video Xmodule.
Method signatures and docstrings:
- def test_get_timeframe_no_parameters(self): Make sure that timeframe() works correctly w/o parameters
- def test_get_timeframe_with_one_parameter(self): Make sure... | 5fa3a818c3d41bd9c3eb25122e1d376c8910269c | <|skeleton|>
class VideoModuleLogicTest:
"""Tests for logic of Video Xmodule."""
def test_get_timeframe_no_parameters(self):
"""Make sure that timeframe() works correctly w/o parameters"""
<|body_0|>
def test_get_timeframe_with_one_parameter(self):
"""Make sure that timeframe() wor... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class VideoModuleLogicTest:
"""Tests for logic of Video Xmodule."""
def test_get_timeframe_no_parameters(self):
"""Make sure that timeframe() works correctly w/o parameters"""
xmltree = etree.fromstring('<video>test</video>')
output = self.xmodule.get_timeframe(xmltree)
self.ass... | the_stack_v2_python_sparse | ExtractFeatures/Data/pratik98/test_video_xml.py | vivekaxl/LexisNexis | train | 9 |
381dcb326cdd71a13af851fc77a1f6927b7d1c0a | [
"if not issubclass(target_event_cls, Event):\n raise TypeError(\"'target_event_cls' must be a subclass of 'Event'\")\nif not isinstance(action_matcher, (target_action_cls, type(None))) and (not callable(action_matcher)):\n raise TypeError(f\"action_matcher must be an '{target_action_cls.__name__}' instance or... | <|body_start_0|>
if not issubclass(target_event_cls, Event):
raise TypeError("'target_event_cls' must be a subclass of 'Event'")
if not isinstance(action_matcher, (target_action_cls, type(None))) and (not callable(action_matcher)):
raise TypeError(f"action_matcher must be an '{ta... | Base event handler for events that have a source action. | OnActionEventBase | [
"BSD-3-Clause",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OnActionEventBase:
"""Base event handler for events that have a source action."""
def __init__(self, *, action_matcher: Optional[Union[Callable[['Action'], bool], 'Action']], on_event: Union[SomeEntitiesType, Callable[[Event, LaunchContext], Optional[SomeEntitiesType]]], target_event_cls: Ty... | stack_v2_sparse_classes_36k_train_004444 | 5,756 | permissive | [
{
"docstring": "Construct a `OnActionEventBase` instance. :param action_matcher: `ExecuteProcess` instance or callable to filter events from which process/processes to handle. :param on_event: Action to be done to handle the event. :param target_event_cls: A subclass of `Event`, indicating which events should b... | 5 | stack_v2_sparse_classes_30k_train_017699 | Implement the Python class `OnActionEventBase` described below.
Class description:
Base event handler for events that have a source action.
Method signatures and docstrings:
- def __init__(self, *, action_matcher: Optional[Union[Callable[['Action'], bool], 'Action']], on_event: Union[SomeEntitiesType, Callable[[Event... | Implement the Python class `OnActionEventBase` described below.
Class description:
Base event handler for events that have a source action.
Method signatures and docstrings:
- def __init__(self, *, action_matcher: Optional[Union[Callable[['Action'], bool], 'Action']], on_event: Union[SomeEntitiesType, Callable[[Event... | f2b232555900d62c3cec839a49afd4cdc01cda58 | <|skeleton|>
class OnActionEventBase:
"""Base event handler for events that have a source action."""
def __init__(self, *, action_matcher: Optional[Union[Callable[['Action'], bool], 'Action']], on_event: Union[SomeEntitiesType, Callable[[Event, LaunchContext], Optional[SomeEntitiesType]]], target_event_cls: Ty... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class OnActionEventBase:
"""Base event handler for events that have a source action."""
def __init__(self, *, action_matcher: Optional[Union[Callable[['Action'], bool], 'Action']], on_event: Union[SomeEntitiesType, Callable[[Event, LaunchContext], Optional[SomeEntitiesType]]], target_event_cls: Type[Event], ta... | the_stack_v2_python_sparse | launch/launch/event_handlers/on_action_event_base.py | ros2/launch | train | 116 |
eaa433abbca9c56428cb8314d8a4c8c73e5e7f75 | [
"try:\n set_up()\n customer = (1, 'Amy', 'Walker', 'Washington', '12345', 'amywalker@gmail.com', True, 750)\n add_customer(*customer)\n a_customer = Customer.get(Customer.customer_id == 1)\n self.assertEqual(a_customer.customer_id, 1)\n self.assertEqual(a_customer.first_name, 'Amy')\n self.asse... | <|body_start_0|>
try:
set_up()
customer = (1, 'Amy', 'Walker', 'Washington', '12345', 'amywalker@gmail.com', True, 750)
add_customer(*customer)
a_customer = Customer.get(Customer.customer_id == 1)
self.assertEqual(a_customer.customer_id, 1)
... | BasicOperationsTests | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class BasicOperationsTests:
def test_add_customer(self):
"""Test add_customer :return: None"""
<|body_0|>
def test_search_customer(self):
"""Test search_customer :return: None"""
<|body_1|>
def test_delete_customer(self):
"""Test delete_customer :retur... | stack_v2_sparse_classes_36k_train_004445 | 3,131 | no_license | [
{
"docstring": "Test add_customer :return: None",
"name": "test_add_customer",
"signature": "def test_add_customer(self)"
},
{
"docstring": "Test search_customer :return: None",
"name": "test_search_customer",
"signature": "def test_search_customer(self)"
},
{
"docstring": "Test ... | 5 | null | Implement the Python class `BasicOperationsTests` described below.
Class description:
Implement the BasicOperationsTests class.
Method signatures and docstrings:
- def test_add_customer(self): Test add_customer :return: None
- def test_search_customer(self): Test search_customer :return: None
- def test_delete_custom... | Implement the Python class `BasicOperationsTests` described below.
Class description:
Implement the BasicOperationsTests class.
Method signatures and docstrings:
- def test_add_customer(self): Test add_customer :return: None
- def test_search_customer(self): Test search_customer :return: None
- def test_delete_custom... | 5dac60f39e3909ff05b26721d602ed20f14d6be3 | <|skeleton|>
class BasicOperationsTests:
def test_add_customer(self):
"""Test add_customer :return: None"""
<|body_0|>
def test_search_customer(self):
"""Test search_customer :return: None"""
<|body_1|>
def test_delete_customer(self):
"""Test delete_customer :retur... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class BasicOperationsTests:
def test_add_customer(self):
"""Test add_customer :return: None"""
try:
set_up()
customer = (1, 'Amy', 'Walker', 'Washington', '12345', 'amywalker@gmail.com', True, 750)
add_customer(*customer)
a_customer = Customer.get(Cust... | the_stack_v2_python_sparse | students/Luyao_Xu/lesson04/test.py | JavaRod/SP_Python220B_2019 | train | 1 | |
5d515b05714c524a6c42646fa26afae38e68c618 | [
"test, traceback = super(SetAWGParametersTask, self).check(*args, **kwargs)\nerr_path = self.get_error_path()\nfor id, ch in self._channels.items():\n res, tr = ch.check(self)\n aux = {err_path + 'Ch{}_{}'.format(id, err): val for err, val in tr.items()}\n traceback.update(aux)\n test &= res\nreturn (te... | <|body_start_0|>
test, traceback = super(SetAWGParametersTask, self).check(*args, **kwargs)
err_path = self.get_error_path()
for id, ch in self._channels.items():
res, tr = ch.check(self)
aux = {err_path + 'Ch{}_{}'.format(id, err): val for err, val in tr.items()}
... | Set the parameters of the different channels of the AWG. | SetAWGParametersTask | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SetAWGParametersTask:
"""Set the parameters of the different channels of the AWG."""
def check(self, *args, **kwargs):
"""Automatically test all parameters evaluation."""
<|body_0|>
def register_preferences(self):
"""Overriden to handle channels."""
<|bod... | stack_v2_sparse_classes_36k_train_004446 | 8,675 | permissive | [
{
"docstring": "Automatically test all parameters evaluation.",
"name": "check",
"signature": "def check(self, *args, **kwargs)"
},
{
"docstring": "Overriden to handle channels.",
"name": "register_preferences",
"signature": "def register_preferences(self)"
},
{
"docstring": "Han... | 4 | stack_v2_sparse_classes_30k_train_020997 | Implement the Python class `SetAWGParametersTask` described below.
Class description:
Set the parameters of the different channels of the AWG.
Method signatures and docstrings:
- def check(self, *args, **kwargs): Automatically test all parameters evaluation.
- def register_preferences(self): Overriden to handle chann... | Implement the Python class `SetAWGParametersTask` described below.
Class description:
Set the parameters of the different channels of the AWG.
Method signatures and docstrings:
- def check(self, *args, **kwargs): Automatically test all parameters evaluation.
- def register_preferences(self): Overriden to handle chann... | b6f1f5b236c7a4e28d9a3bc8da9820c52d789309 | <|skeleton|>
class SetAWGParametersTask:
"""Set the parameters of the different channels of the AWG."""
def check(self, *args, **kwargs):
"""Automatically test all parameters evaluation."""
<|body_0|>
def register_preferences(self):
"""Overriden to handle channels."""
<|bod... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SetAWGParametersTask:
"""Set the parameters of the different channels of the AWG."""
def check(self, *args, **kwargs):
"""Automatically test all parameters evaluation."""
test, traceback = super(SetAWGParametersTask, self).check(*args, **kwargs)
err_path = self.get_error_path()
... | the_stack_v2_python_sparse | exopy_hqc_legacy/tasks/tasks/instr/set_awg_parameters.py | Exopy/exopy_hqc_legacy | train | 0 |
f9d3c7f1e9ffe1e3c38cee5eeafd17c93abe2304 | [
"self._alphabet = alphabet\nself._min_size = min_size\nself._max_size = max_size",
"motif_size = random.randrange(self._min_size, self._max_size)\nmotif = ''\nfor letter_num in range(motif_size):\n cur_letter = random.choice(self._alphabet.letters)\n motif += cur_letter\nreturn MutableSeq(motif, self._alpha... | <|body_start_0|>
self._alphabet = alphabet
self._min_size = min_size
self._max_size = max_size
<|end_body_0|>
<|body_start_1|>
motif_size = random.randrange(self._min_size, self._max_size)
motif = ''
for letter_num in range(motif_size):
cur_letter = random.ch... | Generate a random motif within given parameters. | RandomMotifGenerator | [
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class RandomMotifGenerator:
"""Generate a random motif within given parameters."""
def __init__(self, alphabet, min_size=12, max_size=17):
"""Initialize with the motif parameters. Arguments: o alphabet - An alphabet specifying what letters can be inserted in a motif. o min_size, max_size -... | stack_v2_sparse_classes_36k_train_004447 | 26,199 | permissive | [
{
"docstring": "Initialize with the motif parameters. Arguments: o alphabet - An alphabet specifying what letters can be inserted in a motif. o min_size, max_size - Specify the range of sizes for motifs.",
"name": "__init__",
"signature": "def __init__(self, alphabet, min_size=12, max_size=17)"
},
{... | 2 | stack_v2_sparse_classes_30k_val_000151 | Implement the Python class `RandomMotifGenerator` described below.
Class description:
Generate a random motif within given parameters.
Method signatures and docstrings:
- def __init__(self, alphabet, min_size=12, max_size=17): Initialize with the motif parameters. Arguments: o alphabet - An alphabet specifying what l... | Implement the Python class `RandomMotifGenerator` described below.
Class description:
Generate a random motif within given parameters.
Method signatures and docstrings:
- def __init__(self, alphabet, min_size=12, max_size=17): Initialize with the motif parameters. Arguments: o alphabet - An alphabet specifying what l... | 1d9a8e84a8572809ee3260ede44290e14de3bdd1 | <|skeleton|>
class RandomMotifGenerator:
"""Generate a random motif within given parameters."""
def __init__(self, alphabet, min_size=12, max_size=17):
"""Initialize with the motif parameters. Arguments: o alphabet - An alphabet specifying what letters can be inserted in a motif. o min_size, max_size -... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class RandomMotifGenerator:
"""Generate a random motif within given parameters."""
def __init__(self, alphabet, min_size=12, max_size=17):
"""Initialize with the motif parameters. Arguments: o alphabet - An alphabet specifying what letters can be inserted in a motif. o min_size, max_size - Specify the ... | the_stack_v2_python_sparse | bin/last_wrapper/Bio/NeuralNetwork/Gene/Schema.py | LyonsLab/coge | train | 41 |
afaada0e69696bb31d662c4a35d0a8f89617f08c | [
"maxNum = nums[0]\nfor i in range(len(nums)):\n n = i + 1\n sonMaxNum = sum(nums[:n])\n for index, value in enumerate(nums):\n sonMaxNum = max(sonMaxNum, sum(nums[index:index + n]))\n maxNum = max(maxNum, sonMaxNum)\nreturn maxNum",
"sonMaxNum = maxNum = nums[0]\nfor i in nums[1:]:\n sonMaxN... | <|body_start_0|>
maxNum = nums[0]
for i in range(len(nums)):
n = i + 1
sonMaxNum = sum(nums[:n])
for index, value in enumerate(nums):
sonMaxNum = max(sonMaxNum, sum(nums[index:index + n]))
maxNum = max(maxNum, sonMaxNum)
return maxN... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxSubArray_1(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def maxSubArray_2(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
maxNum = nums[0]
for i in range(l... | stack_v2_sparse_classes_36k_train_004448 | 1,358 | permissive | [
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "maxSubArray_1",
"signature": "def maxSubArray_1(self, nums)"
},
{
"docstring": ":type nums: List[int] :rtype: int",
"name": "maxSubArray_2",
"signature": "def maxSubArray_2(self, nums)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxSubArray_1(self, nums): :type nums: List[int] :rtype: int
- def maxSubArray_2(self, nums): :type nums: List[int] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxSubArray_1(self, nums): :type nums: List[int] :rtype: int
- def maxSubArray_2(self, nums): :type nums: List[int] :rtype: int
<|skeleton|>
class Solution:
def maxSubA... | e93f93fd58d1945708d6aa300dcbcd17d0708274 | <|skeleton|>
class Solution:
def maxSubArray_1(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_0|>
def maxSubArray_2(self, nums):
""":type nums: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def maxSubArray_1(self, nums):
""":type nums: List[int] :rtype: int"""
maxNum = nums[0]
for i in range(len(nums)):
n = i + 1
sonMaxNum = sum(nums[:n])
for index, value in enumerate(nums):
sonMaxNum = max(sonMaxNum, sum(nums[... | the_stack_v2_python_sparse | LeetCode/Python/53.MaximumSubarray.py | Alfonsxh/LeetCode-Challenge-python | train | 1 | |
b0d65d588ca63566e28b2dd3d363cba7dd30c1c1 | [
"result = ListNode(0)\ncurrent = result\nadd_one = 0\nfor i, j in self.next_move(l1, l2):\n new_node = ListNode((i + j + add_one) % 10)\n current.next = new_node\n current = new_node\n add_one = (i + j + add_one) / 10\nif add_one:\n current.next = ListNode(1)\nreturn result.next",
"p1 = l1\np2 = l2... | <|body_start_0|>
result = ListNode(0)
current = result
add_one = 0
for i, j in self.next_move(l1, l2):
new_node = ListNode((i + j + add_one) % 10)
current.next = new_node
current = new_node
add_one = (i + j + add_one) / 10
if add_on... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def addTwoNumbers(self, l1, l2):
""":type l1: ListNode :type l2: ListNode :rtype: ListNode"""
<|body_0|>
def next_move(l1, l2):
"""move to next node simultaneously"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
result = ListNode(0)
... | stack_v2_sparse_classes_36k_train_004449 | 1,235 | no_license | [
{
"docstring": ":type l1: ListNode :type l2: ListNode :rtype: ListNode",
"name": "addTwoNumbers",
"signature": "def addTwoNumbers(self, l1, l2)"
},
{
"docstring": "move to next node simultaneously",
"name": "next_move",
"signature": "def next_move(l1, l2)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def addTwoNumbers(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode
- def next_move(l1, l2): move to next node simultaneously | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def addTwoNumbers(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode
- def next_move(l1, l2): move to next node simultaneously
<|skeleton|>
class Solution:
... | d2cbd0aabff2f0b617d34a59b62771f6764adf95 | <|skeleton|>
class Solution:
def addTwoNumbers(self, l1, l2):
""":type l1: ListNode :type l2: ListNode :rtype: ListNode"""
<|body_0|>
def next_move(l1, l2):
"""move to next node simultaneously"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def addTwoNumbers(self, l1, l2):
""":type l1: ListNode :type l2: ListNode :rtype: ListNode"""
result = ListNode(0)
current = result
add_one = 0
for i, j in self.next_move(l1, l2):
new_node = ListNode((i + j + add_one) % 10)
current.next... | the_stack_v2_python_sparse | 2.两数相加.py | ChenghaoZHU/LeetCode | train | 0 | |
bc85292e50e83d173dac3311122f36760e51cab4 | [
"assert 'score' in record\nif record['status'] == u'首发':\n record['score'] += score_rule.first_on_group\nif lost == 0:\n if record['posi'] in (u'门将', u'后卫', u'后腰', u'左后卫', u'右后卫', u'中后卫', u'边后卫'):\n record['score'] += score_rule.unlost_goal_ev_1\n elif record['posi'] in (u'前卫', u'前腰', u'左前卫', u'右前卫'... | <|body_start_0|>
assert 'score' in record
if record['status'] == u'首发':
record['score'] += score_rule.first_on_group
if lost == 0:
if record['posi'] in (u'门将', u'后卫', u'后腰', u'左后卫', u'右后卫', u'中后卫', u'边后卫'):
record['score'] += score_rule.unlost_goal_ev_1
... | 足球球员得分计算方法 | FootballRule | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FootballRule:
"""足球球员得分计算方法"""
def calc_score(score_rule, record, lost):
"""根据策划需求计算球员得分 :score_rule: 得分规则 :record: 一个球员的表现记录 :lost: 球队失球数 :return: 球员得分"""
<|body_0|>
def get_player_position(uid, data):
"""取得某场比赛球员的信息(首发/替补,位置,姓名) :uid: 球员uid :data: 某场比赛的球员信息(来自图... | stack_v2_sparse_classes_36k_train_004450 | 5,235 | no_license | [
{
"docstring": "根据策划需求计算球员得分 :score_rule: 得分规则 :record: 一个球员的表现记录 :lost: 球队失球数 :return: 球员得分",
"name": "calc_score",
"signature": "def calc_score(score_rule, record, lost)"
},
{
"docstring": "取得某场比赛球员的信息(首发/替补,位置,姓名) :uid: 球员uid :data: 某场比赛的球员信息(来自图文直播数据) :return: (status, posi, name)",
"nam... | 2 | stack_v2_sparse_classes_30k_train_018865 | Implement the Python class `FootballRule` described below.
Class description:
足球球员得分计算方法
Method signatures and docstrings:
- def calc_score(score_rule, record, lost): 根据策划需求计算球员得分 :score_rule: 得分规则 :record: 一个球员的表现记录 :lost: 球队失球数 :return: 球员得分
- def get_player_position(uid, data): 取得某场比赛球员的信息(首发/替补,位置,姓名) :uid: 球员uid... | Implement the Python class `FootballRule` described below.
Class description:
足球球员得分计算方法
Method signatures and docstrings:
- def calc_score(score_rule, record, lost): 根据策划需求计算球员得分 :score_rule: 得分规则 :record: 一个球员的表现记录 :lost: 球队失球数 :return: 球员得分
- def get_player_position(uid, data): 取得某场比赛球员的信息(首发/替补,位置,姓名) :uid: 球员uid... | fc14e95fdf7abffbcbfc0c402686a401612080f6 | <|skeleton|>
class FootballRule:
"""足球球员得分计算方法"""
def calc_score(score_rule, record, lost):
"""根据策划需求计算球员得分 :score_rule: 得分规则 :record: 一个球员的表现记录 :lost: 球队失球数 :return: 球员得分"""
<|body_0|>
def get_player_position(uid, data):
"""取得某场比赛球员的信息(首发/替补,位置,姓名) :uid: 球员uid :data: 某场比赛的球员信息(来自图... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FootballRule:
"""足球球员得分计算方法"""
def calc_score(score_rule, record, lost):
"""根据策划需求计算球员得分 :score_rule: 得分规则 :record: 一个球员的表现记录 :lost: 球队失球数 :return: 球员得分"""
assert 'score' in record
if record['status'] == u'首发':
record['score'] += score_rule.first_on_group
if lo... | the_stack_v2_python_sparse | sports/sports/spiders/addons/rules.py | huiliu/spiders.learning.hui | train | 0 |
5562e5bdc5bf8c50a8585bff2c2a8e2d27b980cd | [
"low = self.directedBinarySearch(nums, target, 'lower')\nhigh = self.directedBinarySearch(nums, target, 'higher')\nreturn (low, high)",
"low, high = (0, len(nums) - 1)\nwhile low <= high:\n mid = (low + high) // 2\n if nums[mid] == target:\n if direction == 'lower':\n if mid == 0 or nums[m... | <|body_start_0|>
low = self.directedBinarySearch(nums, target, 'lower')
high = self.directedBinarySearch(nums, target, 'higher')
return (low, high)
<|end_body_0|>
<|body_start_1|>
low, high = (0, len(nums) - 1)
while low <= high:
mid = (low + high) // 2
i... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def searchRange(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int]"""
<|body_0|>
def directedBinarySearch(self, nums, target, direction='lower'):
"""Binary search with direction. In "lower" direction, we want to search for the... | stack_v2_sparse_classes_36k_train_004451 | 2,902 | no_license | [
{
"docstring": ":type nums: List[int] :type target: int :rtype: List[int]",
"name": "searchRange",
"signature": "def searchRange(self, nums, target)"
},
{
"docstring": "Binary search with direction. In \"lower\" direction, we want to search for the left boundary In \"higher\" direction, we want ... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def searchRange(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int]
- def directedBinarySearch(self, nums, target, direction='lower'): Binary search wi... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def searchRange(self, nums, target): :type nums: List[int] :type target: int :rtype: List[int]
- def directedBinarySearch(self, nums, target, direction='lower'): Binary search wi... | 69a960dd8f39e9c8435a3678852071e1085fcb72 | <|skeleton|>
class Solution:
def searchRange(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int]"""
<|body_0|>
def directedBinarySearch(self, nums, target, direction='lower'):
"""Binary search with direction. In "lower" direction, we want to search for the... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def searchRange(self, nums, target):
""":type nums: List[int] :type target: int :rtype: List[int]"""
low = self.directedBinarySearch(nums, target, 'lower')
high = self.directedBinarySearch(nums, target, 'higher')
return (low, high)
def directedBinarySearch(self, ... | the_stack_v2_python_sparse | python/binary_search/lc34.py | chao-ji/LeetCode | train | 1 | |
d04950f9f010ad8b58cdea82af53bf9314aea11b | [
"self.language = language\nif language == 'en':\n f_pop = open(os.path.join(data_path, 'Eng_Pop.txt'))\n f_scarce = open(os.path.join(data_path, 'Eng_Scarce.txt'))\nelse:\n f_pop = open(os.path.join(data_path, 'Esp_Pop.txt'))\n f_scarce = open(os.path.join(data_path, 'Esp_Scarce.txt'))\nself.populous_ci... | <|body_start_0|>
self.language = language
if language == 'en':
f_pop = open(os.path.join(data_path, 'Eng_Pop.txt'))
f_scarce = open(os.path.join(data_path, 'Eng_Scarce.txt'))
else:
f_pop = open(os.path.join(data_path, 'Esp_Pop.txt'))
f_scarce = ope... | ChangeCityNames | [
"MIT",
"LicenseRef-scancode-free-unknown"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ChangeCityNames:
def __init__(self, data_path, language='en'):
"""Constructor for ChangeCityNames object. Parameters ---------- data_path : str path to the .csv file with populous cities and sacrcely populous cities. language : str, optional language you are testing on. The default is "e... | stack_v2_sparse_classes_36k_train_004452 | 8,923 | permissive | [
{
"docstring": "Constructor for ChangeCityNames object. Parameters ---------- data_path : str path to the .csv file with populous cities and sacrcely populous cities. language : str, optional language you are testing on. The default is \"en\". Returns ------- None.",
"name": "__init__",
"signature": "de... | 4 | null | Implement the Python class `ChangeCityNames` described below.
Class description:
Implement the ChangeCityNames class.
Method signatures and docstrings:
- def __init__(self, data_path, language='en'): Constructor for ChangeCityNames object. Parameters ---------- data_path : str path to the .csv file with populous citi... | Implement the Python class `ChangeCityNames` described below.
Class description:
Implement the ChangeCityNames class.
Method signatures and docstrings:
- def __init__(self, data_path, language='en'): Constructor for ChangeCityNames object. Parameters ---------- data_path : str path to the .csv file with populous citi... | 619bc081fa506778526a1963d19a697367f1d553 | <|skeleton|>
class ChangeCityNames:
def __init__(self, data_path, language='en'):
"""Constructor for ChangeCityNames object. Parameters ---------- data_path : str path to the .csv file with populous cities and sacrcely populous cities. language : str, optional language you are testing on. The default is "e... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ChangeCityNames:
def __init__(self, data_path, language='en'):
"""Constructor for ChangeCityNames object. Parameters ---------- data_path : str path to the .csv file with populous cities and sacrcely populous cities. language : str, optional language you are testing on. The default is "en". Returns --... | the_stack_v2_python_sparse | transformations/city_names_transformation/transformation.py | dyrson11/NL-Augmenter | train | 1 | |
dc5f9fe3c14a38b24a60cc2dfb553f5b424bf5da | [
"base_url = base_url or self.env['ir.config_parameter'].sudo().get_param('web.base.url')\nshort_schema = base_url + '/r/'\nfor match in re.findall(tools.HTML_TAG_URL_REGEX, html):\n href = match[0]\n long_url = match[1]\n label = (match[3] or '').strip()\n if not blacklist or (not [s for s in blacklist ... | <|body_start_0|>
base_url = base_url or self.env['ir.config_parameter'].sudo().get_param('web.base.url')
short_schema = base_url + '/r/'
for match in re.findall(tools.HTML_TAG_URL_REGEX, html):
href = match[0]
long_url = match[1]
label = (match[3] or '').strip... | MailRenderMixin | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MailRenderMixin:
def _shorten_links(self, html, link_tracker_vals, blacklist=None, base_url=None):
"""Shorten links in an html content. It uses the '/r' short URL routing introduced in this module. Using the standard Odoo regex local links are found and replaced by global URLs (not inclu... | stack_v2_sparse_classes_36k_train_004453 | 3,332 | permissive | [
{
"docstring": "Shorten links in an html content. It uses the '/r' short URL routing introduced in this module. Using the standard Odoo regex local links are found and replaced by global URLs (not including mailto, tel, sms). TDE FIXME: could be great to have a record to enable website-based URLs :param link_tr... | 2 | null | Implement the Python class `MailRenderMixin` described below.
Class description:
Implement the MailRenderMixin class.
Method signatures and docstrings:
- def _shorten_links(self, html, link_tracker_vals, blacklist=None, base_url=None): Shorten links in an html content. It uses the '/r' short URL routing introduced in... | Implement the Python class `MailRenderMixin` described below.
Class description:
Implement the MailRenderMixin class.
Method signatures and docstrings:
- def _shorten_links(self, html, link_tracker_vals, blacklist=None, base_url=None): Shorten links in an html content. It uses the '/r' short URL routing introduced in... | 310497a9872db7844b521e6dab5f7a9f61d365a4 | <|skeleton|>
class MailRenderMixin:
def _shorten_links(self, html, link_tracker_vals, blacklist=None, base_url=None):
"""Shorten links in an html content. It uses the '/r' short URL routing introduced in this module. Using the standard Odoo regex local links are found and replaced by global URLs (not inclu... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MailRenderMixin:
def _shorten_links(self, html, link_tracker_vals, blacklist=None, base_url=None):
"""Shorten links in an html content. It uses the '/r' short URL routing introduced in this module. Using the standard Odoo regex local links are found and replaced by global URLs (not including mailto, t... | the_stack_v2_python_sparse | addons/link_tracker/models/mail_render_mixin.py | SHIVJITH/Odoo_Machine_Test | train | 0 | |
afe1fa7a300c774ac9df8e3e8655a64c2f38635e | [
"profit1, l, r = self.maxProfit_1(prices)\nprofits = []\nprofits.append(self.maxProfit_1(prices[r:]))\nprofits.append(self.maxProfit_1(prices[:l]))\nprofits.append(self.maxProfit_1(prices[l:r + 1][::-1]))\nprofit2 = max([profit[0] for profit in profits])\nreturn profit1 + profit2",
"mstart, bi, b, mend, m = (0, 0... | <|body_start_0|>
profit1, l, r = self.maxProfit_1(prices)
profits = []
profits.append(self.maxProfit_1(prices[r:]))
profits.append(self.maxProfit_1(prices[:l]))
profits.append(self.maxProfit_1(prices[l:r + 1][::-1]))
profit2 = max([profit[0] for profit in profits])
... | Solution | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxProfit(self, prices):
""":type prices: List[int] :rtype: int"""
<|body_0|>
def maxProfit_1(self, prices):
""":type prices: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
profit1, l, r = self.maxProfit_1(prices... | stack_v2_sparse_classes_36k_train_004454 | 1,533 | permissive | [
{
"docstring": ":type prices: List[int] :rtype: int",
"name": "maxProfit",
"signature": "def maxProfit(self, prices)"
},
{
"docstring": ":type prices: List[int] :rtype: int",
"name": "maxProfit_1",
"signature": "def maxProfit_1(self, prices)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxProfit(self, prices): :type prices: List[int] :rtype: int
- def maxProfit_1(self, prices): :type prices: List[int] :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxProfit(self, prices): :type prices: List[int] :rtype: int
- def maxProfit_1(self, prices): :type prices: List[int] :rtype: int
<|skeleton|>
class Solution:
def maxPr... | 64747eb172c2ecb3c889830246f3282669516e10 | <|skeleton|>
class Solution:
def maxProfit(self, prices):
""":type prices: List[int] :rtype: int"""
<|body_0|>
def maxProfit_1(self, prices):
""":type prices: List[int] :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def maxProfit(self, prices):
""":type prices: List[int] :rtype: int"""
profit1, l, r = self.maxProfit_1(prices)
profits = []
profits.append(self.maxProfit_1(prices[r:]))
profits.append(self.maxProfit_1(prices[:l]))
profits.append(self.maxProfit_1(price... | the_stack_v2_python_sparse | LC/123.py | szhu3210/LeetCode_Solutions | train | 2 | |
02cd138e965a2fda98083b4c30ce98e8f972821c | [
"self.temporary_directory = None\nself.files = []\nif repository.active_branch.is_valid():\n diff = repository.head.commit.diff()\n added_changes = diff.iter_change_type('A')\n modified_changes = diff.iter_change_type('M')\n self.changes = list(itertools.chain(added_changes, modified_changes))\nelse:\n ... | <|body_start_0|>
self.temporary_directory = None
self.files = []
if repository.active_branch.is_valid():
diff = repository.head.commit.diff()
added_changes = diff.iter_change_type('A')
modified_changes = diff.iter_change_type('M')
self.changes = li... | Class to represent the staging area as an whole. It should be used as context manager (with the "with" statement). | StagingArea | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StagingArea:
"""Class to represent the staging area as an whole. It should be used as context manager (with the "with" statement)."""
def __init__(self, repository):
""":param repository: GitPython Repository :rtype repository: git.repo.base.Repo"""
<|body_0|>
def __ente... | stack_v2_sparse_classes_36k_train_004455 | 2,486 | permissive | [
{
"docstring": ":param repository: GitPython Repository :rtype repository: git.repo.base.Repo",
"name": "__init__",
"signature": "def __init__(self, repository)"
},
{
"docstring": "Enter context manager and create a temporary directory",
"name": "__enter__",
"signature": "def __enter__(s... | 4 | stack_v2_sparse_classes_30k_train_013184 | Implement the Python class `StagingArea` described below.
Class description:
Class to represent the staging area as an whole. It should be used as context manager (with the "with" statement).
Method signatures and docstrings:
- def __init__(self, repository): :param repository: GitPython Repository :rtype repository:... | Implement the Python class `StagingArea` described below.
Class description:
Class to represent the staging area as an whole. It should be used as context manager (with the "with" statement).
Method signatures and docstrings:
- def __init__(self, repository): :param repository: GitPython Repository :rtype repository:... | 487f7eb4be04fb0dc17ea647c89c38d34819604e | <|skeleton|>
class StagingArea:
"""Class to represent the staging area as an whole. It should be used as context manager (with the "with" statement)."""
def __init__(self, repository):
""":param repository: GitPython Repository :rtype repository: git.repo.base.Repo"""
<|body_0|>
def __ente... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class StagingArea:
"""Class to represent the staging area as an whole. It should be used as context manager (with the "with" statement)."""
def __init__(self, repository):
""":param repository: GitPython Repository :rtype repository: git.repo.base.Repo"""
self.temporary_directory = None
... | the_stack_v2_python_sparse | turnstile/models/staging.py | jmcs/turnstile | train | 2 |
4c4efea66893fd8f0363e447f913b2cce6a7b93c | [
"cluster = self.cluster\ncluster.populate([1, 1]).start()\nsession = self.patient_cql_connection(cluster.nodelist()[0])\ncreate_ks(session, 'ks', {'dc1': 1, 'dc2': 1})\ncreate_cf(session, 'cf')\nputget(cluster, session)",
"cluster = self.cluster\ncluster.populate([2, 2]).start()\nsession = self.patient_cql_connec... | <|body_start_0|>
cluster = self.cluster
cluster.populate([1, 1]).start()
session = self.patient_cql_connection(cluster.nodelist()[0])
create_ks(session, 'ks', {'dc1': 1, 'dc2': 1})
create_cf(session, 'cf')
putget(cluster, session)
<|end_body_0|>
<|body_start_1|>
... | TestMultiDCPutGet | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TestMultiDCPutGet:
def test_putget_2dc_rf1(self):
"""Simple put-get test for 2 DC with one node each (RF=1) [catches #3539]"""
<|body_0|>
def test_putget_2dc_rf2(self):
"""Simple put-get test for 2 DC with 2 node each (RF=2) -- tests cross-DC efficient writes"""
... | stack_v2_sparse_classes_36k_train_004456 | 957 | permissive | [
{
"docstring": "Simple put-get test for 2 DC with one node each (RF=1) [catches #3539]",
"name": "test_putget_2dc_rf1",
"signature": "def test_putget_2dc_rf1(self)"
},
{
"docstring": "Simple put-get test for 2 DC with 2 node each (RF=2) -- tests cross-DC efficient writes",
"name": "test_putg... | 2 | stack_v2_sparse_classes_30k_train_001139 | Implement the Python class `TestMultiDCPutGet` described below.
Class description:
Implement the TestMultiDCPutGet class.
Method signatures and docstrings:
- def test_putget_2dc_rf1(self): Simple put-get test for 2 DC with one node each (RF=1) [catches #3539]
- def test_putget_2dc_rf2(self): Simple put-get test for 2... | Implement the Python class `TestMultiDCPutGet` described below.
Class description:
Implement the TestMultiDCPutGet class.
Method signatures and docstrings:
- def test_putget_2dc_rf1(self): Simple put-get test for 2 DC with one node each (RF=1) [catches #3539]
- def test_putget_2dc_rf2(self): Simple put-get test for 2... | 738d5de93def153338003a26e304a77463a7fd2a | <|skeleton|>
class TestMultiDCPutGet:
def test_putget_2dc_rf1(self):
"""Simple put-get test for 2 DC with one node each (RF=1) [catches #3539]"""
<|body_0|>
def test_putget_2dc_rf2(self):
"""Simple put-get test for 2 DC with 2 node each (RF=2) -- tests cross-DC efficient writes"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TestMultiDCPutGet:
def test_putget_2dc_rf1(self):
"""Simple put-get test for 2 DC with one node each (RF=1) [catches #3539]"""
cluster = self.cluster
cluster.populate([1, 1]).start()
session = self.patient_cql_connection(cluster.nodelist()[0])
create_ks(session, 'ks', {... | the_stack_v2_python_sparse | multidc_putget_test.py | apache/cassandra-dtest | train | 52 | |
5b99b19ef2db19e49fb46c9d39ad9fde3b8f3d47 | [
"self.availability_set_id = availability_set_id\nself.data_disk_type = data_disk_type\nself.instance_id = instance_id\nself.network_resource_group_id = network_resource_group_id\nself.os_disk_type = os_disk_type\nself.resource_group = resource_group\nself.storage_account = storage_account\nself.storage_container = ... | <|body_start_0|>
self.availability_set_id = availability_set_id
self.data_disk_type = data_disk_type
self.instance_id = instance_id
self.network_resource_group_id = network_resource_group_id
self.os_disk_type = os_disk_type
self.resource_group = resource_group
sel... | Implementation of the 'AzureParams' model. Specifies various resources when converting and deploying a VM to Azure. Attributes: availability_set_id (long|int): Specifies id of the Availability set in which the VM is to be restored. data_disk_type (DataDiskTypeEnum): Specifies the disk type used by the data. 'kPremiumSS... | AzureParams | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class AzureParams:
"""Implementation of the 'AzureParams' model. Specifies various resources when converting and deploying a VM to Azure. Attributes: availability_set_id (long|int): Specifies id of the Availability set in which the VM is to be restored. data_disk_type (DataDiskTypeEnum): Specifies the ... | stack_v2_sparse_classes_36k_train_004457 | 7,743 | permissive | [
{
"docstring": "Constructor for the AzureParams class",
"name": "__init__",
"signature": "def __init__(self, availability_set_id=None, data_disk_type=None, instance_id=None, network_resource_group_id=None, os_disk_type=None, resource_group=None, storage_account=None, storage_container=None, storage_reso... | 2 | null | Implement the Python class `AzureParams` described below.
Class description:
Implementation of the 'AzureParams' model. Specifies various resources when converting and deploying a VM to Azure. Attributes: availability_set_id (long|int): Specifies id of the Availability set in which the VM is to be restored. data_disk_... | Implement the Python class `AzureParams` described below.
Class description:
Implementation of the 'AzureParams' model. Specifies various resources when converting and deploying a VM to Azure. Attributes: availability_set_id (long|int): Specifies id of the Availability set in which the VM is to be restored. data_disk_... | e4973dfeb836266904d0369ea845513c7acf261e | <|skeleton|>
class AzureParams:
"""Implementation of the 'AzureParams' model. Specifies various resources when converting and deploying a VM to Azure. Attributes: availability_set_id (long|int): Specifies id of the Availability set in which the VM is to be restored. data_disk_type (DataDiskTypeEnum): Specifies the ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class AzureParams:
"""Implementation of the 'AzureParams' model. Specifies various resources when converting and deploying a VM to Azure. Attributes: availability_set_id (long|int): Specifies id of the Availability set in which the VM is to be restored. data_disk_type (DataDiskTypeEnum): Specifies the disk type use... | the_stack_v2_python_sparse | cohesity_management_sdk/models/azure_params.py | cohesity/management-sdk-python | train | 24 |
68ae12766519a9d97480fc856f792bdf7c9134f0 | [
"self._solver = solver\nself._norm = 1.0\nself._norm0 = 1.0",
"if counter == 0 and norm != 0.0:\n self._norm0 = norm\nself._norm = norm\nself._solver._mpi_print(counter, norm, norm / self._norm0)\nself._solver._iter_count += 1"
] | <|body_start_0|>
self._solver = solver
self._norm = 1.0
self._norm0 = 1.0
<|end_body_0|>
<|body_start_1|>
if counter == 0 and norm != 0.0:
self._norm0 = norm
self._norm = norm
self._solver._mpi_print(counter, norm, norm / self._norm0)
self._solver._it... | Prints output from PETSc's KSP solvers. Callable object given to KSP as a callback for printing the residual. Attributes ---------- _solver : _solver the openmdao solver. _norm : float the current norm. _norm0 : float the norm for the first iteration. | Monitor | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Monitor:
"""Prints output from PETSc's KSP solvers. Callable object given to KSP as a callback for printing the residual. Attributes ---------- _solver : _solver the openmdao solver. _norm : float the current norm. _norm0 : float the norm for the first iteration."""
def __init__(self, solver... | stack_v2_sparse_classes_36k_train_004458 | 13,874 | no_license | [
{
"docstring": "Store pointer to the openmdao solver and initialize norms. Parameters ---------- solver : object the openmdao solver.",
"name": "__init__",
"signature": "def __init__(self, solver)"
},
{
"docstring": "Store norm if first iteration, and print norm. Parameters ---------- ksp : obje... | 2 | stack_v2_sparse_classes_30k_train_011685 | Implement the Python class `Monitor` described below.
Class description:
Prints output from PETSc's KSP solvers. Callable object given to KSP as a callback for printing the residual. Attributes ---------- _solver : _solver the openmdao solver. _norm : float the current norm. _norm0 : float the norm for the first itera... | Implement the Python class `Monitor` described below.
Class description:
Prints output from PETSc's KSP solvers. Callable object given to KSP as a callback for printing the residual. Attributes ---------- _solver : _solver the openmdao solver. _norm : float the current norm. _norm0 : float the norm for the first itera... | d9e89fe017f1131d554599c248247f73bb9b534d | <|skeleton|>
class Monitor:
"""Prints output from PETSc's KSP solvers. Callable object given to KSP as a callback for printing the residual. Attributes ---------- _solver : _solver the openmdao solver. _norm : float the current norm. _norm0 : float the norm for the first iteration."""
def __init__(self, solver... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Monitor:
"""Prints output from PETSc's KSP solvers. Callable object given to KSP as a callback for printing the residual. Attributes ---------- _solver : _solver the openmdao solver. _norm : float the current norm. _norm0 : float the norm for the first iteration."""
def __init__(self, solver):
""... | the_stack_v2_python_sparse | venv/Lib/site-packages/openmdao/solvers/linear/petsc_ksp.py | ManojDjs/Heart-rate-estimation | train | 1 |
49228f94970d0c75a091f7e36d26f34d6dad2359 | [
"self.db_driver = config.get('db_driver', ExtractorDb.default_db_driver)\nself.db_url = config.get('db_url', ExtractorDb.default_db_url)\nself.database_name = config['database_name']\nself.table_name = config['table_name']\nself.user = config['user']\nself.password = config['password']\nself.logger = EtlLogger()",
... | <|body_start_0|>
self.db_driver = config.get('db_driver', ExtractorDb.default_db_driver)
self.db_url = config.get('db_url', ExtractorDb.default_db_url)
self.database_name = config['database_name']
self.table_name = config['table_name']
self.user = config['user']
self.pass... | Extractor implements the "extract" process of ETL | ExtractorDb | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ExtractorDb:
"""Extractor implements the "extract" process of ETL"""
def __init__(self, config: Dict[str, Any]):
"""Initialize the Extractor"""
<|body_0|>
def extract(self, spark: SparkSession) -> DataFrame:
"""Extract a DataFrame from a database query"""
... | stack_v2_sparse_classes_36k_train_004459 | 2,364 | permissive | [
{
"docstring": "Initialize the Extractor",
"name": "__init__",
"signature": "def __init__(self, config: Dict[str, Any])"
},
{
"docstring": "Extract a DataFrame from a database query",
"name": "extract",
"signature": "def extract(self, spark: SparkSession) -> DataFrame"
}
] | 2 | stack_v2_sparse_classes_30k_train_003955 | Implement the Python class `ExtractorDb` described below.
Class description:
Extractor implements the "extract" process of ETL
Method signatures and docstrings:
- def __init__(self, config: Dict[str, Any]): Initialize the Extractor
- def extract(self, spark: SparkSession) -> DataFrame: Extract a DataFrame from a data... | Implement the Python class `ExtractorDb` described below.
Class description:
Extractor implements the "extract" process of ETL
Method signatures and docstrings:
- def __init__(self, config: Dict[str, Any]): Initialize the Extractor
- def extract(self, spark: SparkSession) -> DataFrame: Extract a DataFrame from a data... | 42632d5cb94ab94c13e24526817efb1a4fb6fe74 | <|skeleton|>
class ExtractorDb:
"""Extractor implements the "extract" process of ETL"""
def __init__(self, config: Dict[str, Any]):
"""Initialize the Extractor"""
<|body_0|>
def extract(self, spark: SparkSession) -> DataFrame:
"""Extract a DataFrame from a database query"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ExtractorDb:
"""Extractor implements the "extract" process of ETL"""
def __init__(self, config: Dict[str, Any]):
"""Initialize the Extractor"""
self.db_driver = config.get('db_driver', ExtractorDb.default_db_driver)
self.db_url = config.get('db_url', ExtractorDb.default_db_url)
... | the_stack_v2_python_sparse | exercises/case_study/case_study/etl/extract/extractor_db.py | mwoinoski/python_bootcamp | train | 1 |
dc7c082da76ead298ccbcb1cac104e2f0ae5a092 | [
"if not a:\n return 0\np = deque()\nq = deque()\nt = float('-inf')\nm = float('-inf')\nn = len(a)\nfor i in range(0, n, 1):\n if not q or a[i] > q[-1]:\n p.append(i)\n q.append(a[i])\n elif a[i] < q[-1]:\n while q and a[i] < q[-1]:\n x = p.pop()\n y = q.pop()\n ... | <|body_start_0|>
if not a:
return 0
p = deque()
q = deque()
t = float('-inf')
m = float('-inf')
n = len(a)
for i in range(0, n, 1):
if not q or a[i] > q[-1]:
p.append(i)
q.append(a[i])
elif a[i] <... | Iteration over all array elements. Interpolates greedy algorithm. Reference: https://www.youtube.com/watch?v=VNbkzsnllsU Time complexity: O(n) - Iterate over all array indicies and collected index-height pairs Space complexity: O(n) - Amortized collect all array elements and indicies in stacks | Solution | [
"Unlicense"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
"""Iteration over all array elements. Interpolates greedy algorithm. Reference: https://www.youtube.com/watch?v=VNbkzsnllsU Time complexity: O(n) - Iterate over all array indicies and collected index-height pairs Space complexity: O(n) - Amortized collect all array elements and indicies... | stack_v2_sparse_classes_36k_train_004460 | 4,337 | permissive | [
{
"docstring": "Determines area of maximum rectangle in histogram. :param list[int] a: list of height values in histogram :return: area of maximum rectangle :rtype: int",
"name": "largest_rectangle_area",
"signature": "def largest_rectangle_area(self, a)"
},
{
"docstring": "Calculates maximum ar... | 2 | stack_v2_sparse_classes_30k_train_012560 | Implement the Python class `Solution` described below.
Class description:
Iteration over all array elements. Interpolates greedy algorithm. Reference: https://www.youtube.com/watch?v=VNbkzsnllsU Time complexity: O(n) - Iterate over all array indicies and collected index-height pairs Space complexity: O(n) - Amortized ... | Implement the Python class `Solution` described below.
Class description:
Iteration over all array elements. Interpolates greedy algorithm. Reference: https://www.youtube.com/watch?v=VNbkzsnllsU Time complexity: O(n) - Iterate over all array indicies and collected index-height pairs Space complexity: O(n) - Amortized ... | 69f90877c5466927e8b081c4268cbcda074813ec | <|skeleton|>
class Solution:
"""Iteration over all array elements. Interpolates greedy algorithm. Reference: https://www.youtube.com/watch?v=VNbkzsnllsU Time complexity: O(n) - Iterate over all array indicies and collected index-height pairs Space complexity: O(n) - Amortized collect all array elements and indicies... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
"""Iteration over all array elements. Interpolates greedy algorithm. Reference: https://www.youtube.com/watch?v=VNbkzsnllsU Time complexity: O(n) - Iterate over all array indicies and collected index-height pairs Space complexity: O(n) - Amortized collect all array elements and indicies in stacks"""... | the_stack_v2_python_sparse | 0084_largest_rectangle_histogram/python_source.py | arthurdysart/LeetCode | train | 0 |
a60bee01661d1c71f78f767280cce0526739996f | [
"if k == 1:\n return [[i + 1] for i in range(n)]\ns = self.combine(n, k - 1)\nu = []\nfor t in s:\n if t[-1] < n:\n for a in range(t[-1] + 1, n + 1):\n tx = t[:]\n tx.append(a)\n u.append(tx)\nreturn u",
"s = [[]]\nfor i in range(1, len(nums) + 1):\n t = self.combi... | <|body_start_0|>
if k == 1:
return [[i + 1] for i in range(n)]
s = self.combine(n, k - 1)
u = []
for t in s:
if t[-1] < n:
for a in range(t[-1] + 1, n + 1):
tx = t[:]
tx.append(a)
u.append... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def combine(self, n, k):
""":type n: int :type k: int :rtype: List[List[int]]"""
<|body_0|>
def subsets(self, nums):
""":type nums: List[int] :rtype: List[List[int]]"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if k == 1:
re... | stack_v2_sparse_classes_36k_train_004461 | 1,045 | no_license | [
{
"docstring": ":type n: int :type k: int :rtype: List[List[int]]",
"name": "combine",
"signature": "def combine(self, n, k)"
},
{
"docstring": ":type nums: List[int] :rtype: List[List[int]]",
"name": "subsets",
"signature": "def subsets(self, nums)"
}
] | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def combine(self, n, k): :type n: int :type k: int :rtype: List[List[int]]
- def subsets(self, nums): :type nums: List[int] :rtype: List[List[int]] | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def combine(self, n, k): :type n: int :type k: int :rtype: List[List[int]]
- def subsets(self, nums): :type nums: List[int] :rtype: List[List[int]]
<|skeleton|>
class Solution:
... | d9159ba7ebd14daec994380f3d4361777053ea67 | <|skeleton|>
class Solution:
def combine(self, n, k):
""":type n: int :type k: int :rtype: List[List[int]]"""
<|body_0|>
def subsets(self, nums):
""":type nums: List[int] :rtype: List[List[int]]"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def combine(self, n, k):
""":type n: int :type k: int :rtype: List[List[int]]"""
if k == 1:
return [[i + 1] for i in range(n)]
s = self.combine(n, k - 1)
u = []
for t in s:
if t[-1] < n:
for a in range(t[-1] + 1, n + 1):... | the_stack_v2_python_sparse | Python/78_Subsets.py | CollinErickson/LeetCode | train | 0 | |
26ae6c3f770bd3650fc5b0ac19043c30438b5fa0 | [
"node_base.__init__(self, MEM, IP)\nself.MAX_UDP_PACKET_SIZE = 2840\nself.resize_image = True\nself.scale_percent = 150\nself.save_image = True\nself.ramBuffer = b''",
"while True:\n packet = self._recv('CAMERA', local=False)\n if packet:\n self.ramBuffer += packet\n if self.ramBuffer.endswith... | <|body_start_0|>
node_base.__init__(self, MEM, IP)
self.MAX_UDP_PACKET_SIZE = 2840
self.resize_image = True
self.scale_percent = 150
self.save_image = True
self.ramBuffer = b''
<|end_body_0|>
<|body_start_1|>
while True:
packet = self._recv('CAMERA', ... | Recv Node captures the image data, resizes the image, and displays it. | Receive_Video_Stream | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Receive_Video_Stream:
"""Recv Node captures the image data, resizes the image, and displays it."""
def __init__(self, MEM, IP):
"""Sets the size of data packets, whether or not the image should be resized and if images should be saved. Parameters: MEM: Dictionary containing Node name... | stack_v2_sparse_classes_36k_train_004462 | 4,779 | permissive | [
{
"docstring": "Sets the size of data packets, whether or not the image should be resized and if images should be saved. Parameters: MEM: Dictionary containing Node name and the desired local memory location. IP: Dictionary containing Node name and desired streaming settings: The IP address, send and recieve so... | 2 | stack_v2_sparse_classes_30k_test_001054 | Implement the Python class `Receive_Video_Stream` described below.
Class description:
Recv Node captures the image data, resizes the image, and displays it.
Method signatures and docstrings:
- def __init__(self, MEM, IP): Sets the size of data packets, whether or not the image should be resized and if images should b... | Implement the Python class `Receive_Video_Stream` described below.
Class description:
Recv Node captures the image data, resizes the image, and displays it.
Method signatures and docstrings:
- def __init__(self, MEM, IP): Sets the size of data packets, whether or not the image should be resized and if images should b... | 26b476e1c8743f422c5affea744234e6322d4f59 | <|skeleton|>
class Receive_Video_Stream:
"""Recv Node captures the image data, resizes the image, and displays it."""
def __init__(self, MEM, IP):
"""Sets the size of data packets, whether or not the image should be resized and if images should be saved. Parameters: MEM: Dictionary containing Node name... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Receive_Video_Stream:
"""Recv Node captures the image data, resizes the image, and displays it."""
def __init__(self, MEM, IP):
"""Sets the size of data packets, whether or not the image should be resized and if images should be saved. Parameters: MEM: Dictionary containing Node name and the desi... | the_stack_v2_python_sparse | GUI/Src/receive_video_stream.py | senseishafi/mechatronics-2019 | train | 0 |
bc2a9860754522922cd65710a31a78c7c9b00f77 | [
"db_file = resource_filename('robocrys.condense', 'molecule_db.json.gz')\nself.molecule_db = loadfn(db_file)\nself.matched_molecules = {}\nself.use_online_pubchem = use_online_pubchem\nself.name_preference = tuple(list(name_preference) + list(self.name_sources))",
"smiles = self.molecule_graph_to_smiles(molecule_... | <|body_start_0|>
db_file = resource_filename('robocrys.condense', 'molecule_db.json.gz')
self.molecule_db = loadfn(db_file)
self.matched_molecules = {}
self.use_online_pubchem = use_online_pubchem
self.name_preference = tuple(list(name_preference) + list(self.name_sources))
<|end... | MoleculeNamer | [
"BSD-3-Clause",
"LicenseRef-scancode-generic-cla",
"LicenseRef-scancode-hdf5",
"BSD-2-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MoleculeNamer:
def __init__(self, use_online_pubchem: bool=True, name_preference: tuple[str]=name_sources):
"""Class to match molecule graphs to known molecule names. Args: use_online_pubchem: Whether to try using the Pubchem website for matching molecules if a match is not found in the ... | stack_v2_sparse_classes_36k_train_004463 | 4,836 | permissive | [
{
"docstring": "Class to match molecule graphs to known molecule names. Args: use_online_pubchem: Whether to try using the Pubchem website for matching molecules if a match is not found in the offline database. Defaults to ``True``. Requires a working internet connection and for the ``pubchempy`` package to be ... | 5 | stack_v2_sparse_classes_30k_train_005125 | Implement the Python class `MoleculeNamer` described below.
Class description:
Implement the MoleculeNamer class.
Method signatures and docstrings:
- def __init__(self, use_online_pubchem: bool=True, name_preference: tuple[str]=name_sources): Class to match molecule graphs to known molecule names. Args: use_online_pu... | Implement the Python class `MoleculeNamer` described below.
Class description:
Implement the MoleculeNamer class.
Method signatures and docstrings:
- def __init__(self, use_online_pubchem: bool=True, name_preference: tuple[str]=name_sources): Class to match molecule graphs to known molecule names. Args: use_online_pu... | 36a9b91a13272e80642058005aacb076404a855c | <|skeleton|>
class MoleculeNamer:
def __init__(self, use_online_pubchem: bool=True, name_preference: tuple[str]=name_sources):
"""Class to match molecule graphs to known molecule names. Args: use_online_pubchem: Whether to try using the Pubchem website for matching molecules if a match is not found in the ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MoleculeNamer:
def __init__(self, use_online_pubchem: bool=True, name_preference: tuple[str]=name_sources):
"""Class to match molecule graphs to known molecule names. Args: use_online_pubchem: Whether to try using the Pubchem website for matching molecules if a match is not found in the offline databa... | the_stack_v2_python_sparse | robocrys/condense/molecule.py | hackingmaterials/robocrystallographer | train | 78 | |
d307b21299a4353c3fcde55773b7bad6618c43c2 | [
"super().__init__()\nself.fc1 = torch.nn.Linear(observation_size, H1)\nself.fc2 = torch.nn.Linear(H1, H2)\nself.fc3 = torch.nn.Linear(H2, H3)\nself.fc4 = torch.nn.Linear(H3, H4)\nself.fc5 = torch.nn.Linear(H4, action_size)",
"x = F.relu(self.fc1(observation))\nx = F.relu(self.fc2(x))\nx = F.relu(self.fc3(x))\nx =... | <|body_start_0|>
super().__init__()
self.fc1 = torch.nn.Linear(observation_size, H1)
self.fc2 = torch.nn.Linear(H1, H2)
self.fc3 = torch.nn.Linear(H2, H3)
self.fc4 = torch.nn.Linear(H3, H4)
self.fc5 = torch.nn.Linear(H4, action_size)
<|end_body_0|>
<|body_start_1|>
... | DQN | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DQN:
def __init__(self, observation_size, action_size, H1=200, H2=160, H3=120, H4=60):
""":param observation_size: Size of belief as defined in belief_agent.py :param action_size: Model has 1 output for every single possible card in the deck. :param H1: size of hidden layer 1 :param H2: ... | stack_v2_sparse_classes_36k_train_004464 | 8,474 | permissive | [
{
"docstring": ":param observation_size: Size of belief as defined in belief_agent.py :param action_size: Model has 1 output for every single possible card in the deck. :param H1: size of hidden layer 1 :param H2: size of hidden layer 2",
"name": "__init__",
"signature": "def __init__(self, observation_... | 2 | stack_v2_sparse_classes_30k_train_016801 | Implement the Python class `DQN` described below.
Class description:
Implement the DQN class.
Method signatures and docstrings:
- def __init__(self, observation_size, action_size, H1=200, H2=160, H3=120, H4=60): :param observation_size: Size of belief as defined in belief_agent.py :param action_size: Model has 1 outp... | Implement the Python class `DQN` described below.
Class description:
Implement the DQN class.
Method signatures and docstrings:
- def __init__(self, observation_size, action_size, H1=200, H2=160, H3=120, H4=60): :param observation_size: Size of belief as defined in belief_agent.py :param action_size: Model has 1 outp... | ae32e85583c61cc27a44946a6b5fa7c1e2c152ff | <|skeleton|>
class DQN:
def __init__(self, observation_size, action_size, H1=200, H2=160, H3=120, H4=60):
""":param observation_size: Size of belief as defined in belief_agent.py :param action_size: Model has 1 output for every single possible card in the deck. :param H1: size of hidden layer 1 :param H2: ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DQN:
def __init__(self, observation_size, action_size, H1=200, H2=160, H3=120, H4=60):
""":param observation_size: Size of belief as defined in belief_agent.py :param action_size: Model has 1 output for every single possible card in the deck. :param H1: size of hidden layer 1 :param H2: size of hidden... | the_stack_v2_python_sparse | src/agents/dqn_agent.py | lilianluong/multitask-card-games | train | 1 | |
059e9a058d03fefd23cfa66cd68c33b8e2fd1e11 | [
"kwargs.update({'filename': filename, 'default_stream_id': default_stream_id, 'processing_chain': processing_chain})\nsuper(FeatureRepository, self).__init__(**kwargs)\nself.item_class = FeatureContainer",
"if filename is None:\n filename = self.filename\nif isinstance(filename, dict):\n file_format = {}\n ... | <|body_start_0|>
kwargs.update({'filename': filename, 'default_stream_id': default_stream_id, 'processing_chain': processing_chain})
super(FeatureRepository, self).__init__(**kwargs)
self.item_class = FeatureContainer
<|end_body_0|>
<|body_start_1|>
if filename is None:
file... | Feature repository container class to store multiple FeatureContainers together. Feature containers for each method are stored in a dict. Method label is used as dictionary key. | FeatureRepository | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FeatureRepository:
"""Feature repository container class to store multiple FeatureContainers together. Feature containers for each method are stored in a dict. Method label is used as dictionary key."""
def __init__(self, filename=None, default_stream_id=0, processing_chain=None, **kwargs):
... | stack_v2_sparse_classes_36k_train_004465 | 5,494 | permissive | [
{
"docstring": "Constructor Parameters ---------- filename: str or dict Either one filename (str) or multiple filenames in a dictionary. Dictionary based parameter is used to construct the repository from separate FeatureContainers, two formats for the dictionary is supported: 1) label as key, and filename as v... | 3 | stack_v2_sparse_classes_30k_train_015286 | Implement the Python class `FeatureRepository` described below.
Class description:
Feature repository container class to store multiple FeatureContainers together. Feature containers for each method are stored in a dict. Method label is used as dictionary key.
Method signatures and docstrings:
- def __init__(self, fi... | Implement the Python class `FeatureRepository` described below.
Class description:
Feature repository container class to store multiple FeatureContainers together. Feature containers for each method are stored in a dict. Method label is used as dictionary key.
Method signatures and docstrings:
- def __init__(self, fi... | a2694b0b9ad4592c9c27c935fb92b0e5751b8ab4 | <|skeleton|>
class FeatureRepository:
"""Feature repository container class to store multiple FeatureContainers together. Feature containers for each method are stored in a dict. Method label is used as dictionary key."""
def __init__(self, filename=None, default_stream_id=0, processing_chain=None, **kwargs):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FeatureRepository:
"""Feature repository container class to store multiple FeatureContainers together. Feature containers for each method are stored in a dict. Method label is used as dictionary key."""
def __init__(self, filename=None, default_stream_id=0, processing_chain=None, **kwargs):
"""Co... | the_stack_v2_python_sparse | dcase_util/containers/features.py | DCASE-REPO/dcase_util | train | 137 |
d2c2b13e48775424e9f4192350abbe2bb051f888 | [
"self.rest_prefix = 'http://' + ip + ':' + port + '/rests/'\nif username:\n self.auth = (username, password)\nelse:\n self.auth = None\nself.session = None",
"if self.session:\n self.session.close()\nself.session = requests.Session()\nself.session.auth = self.auth\nreturn self.session.request(method, sel... | <|body_start_0|>
self.rest_prefix = 'http://' + ip + ':' + port + '/rests/'
if username:
self.auth = (username, password)
else:
self.auth = None
self.session = None
<|end_body_0|>
<|body_start_1|>
if self.session:
self.session.close()
... | Handling of restconf requests using one-time sessions and basic http authentication. | _BasicClosingSession | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class _BasicClosingSession:
"""Handling of restconf requests using one-time sessions and basic http authentication."""
def __init__(self, ip, username='', password='', port='8181'):
"""Prepare session initialization data using hardcoded text, remember credentials."""
<|body_0|>
... | stack_v2_sparse_classes_36k_train_004466 | 9,914 | no_license | [
{
"docstring": "Prepare session initialization data using hardcoded text, remember credentials.",
"name": "__init__",
"signature": "def __init__(self, ip, username='', password='', port='8181')"
},
{
"docstring": "Create new session, send method using remembered credentials. Return response",
... | 2 | stack_v2_sparse_classes_30k_train_000593 | Implement the Python class `_BasicClosingSession` described below.
Class description:
Handling of restconf requests using one-time sessions and basic http authentication.
Method signatures and docstrings:
- def __init__(self, ip, username='', password='', port='8181'): Prepare session initialization data using hardco... | Implement the Python class `_BasicClosingSession` described below.
Class description:
Handling of restconf requests using one-time sessions and basic http authentication.
Method signatures and docstrings:
- def __init__(self, ip, username='', password='', port='8181'): Prepare session initialization data using hardco... | ff1bb51a8a14f89ceefd91c6fc535a4bce78e0de | <|skeleton|>
class _BasicClosingSession:
"""Handling of restconf requests using one-time sessions and basic http authentication."""
def __init__(self, ip, username='', password='', port='8181'):
"""Prepare session initialization data using hardcoded text, remember credentials."""
<|body_0|>
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class _BasicClosingSession:
"""Handling of restconf requests using one-time sessions and basic http authentication."""
def __init__(self, ip, username='', password='', port='8181'):
"""Prepare session initialization data using hardcoded text, remember credentials."""
self.rest_prefix = 'http://... | the_stack_v2_python_sparse | csit/libraries/AuthStandalone.py | opendaylight/integration-test | train | 29 |
2333602754edf3221787eeb0323fd210ba613ab9 | [
"self.battery_size = battery_size\nif self.battery_size == 70:\n self.range = 240\nelif self.battery_size == 85:\n self.range = 270",
"message = 'This car can go approximately ' + str(self.range)\nmessage += ' miles on a full charge.'\nprint(message)"
] | <|body_start_0|>
self.battery_size = battery_size
if self.battery_size == 70:
self.range = 240
elif self.battery_size == 85:
self.range = 270
<|end_body_0|>
<|body_start_1|>
message = 'This car can go approximately ' + str(self.range)
message += ' miles o... | A simple model of an electic car battery. | Battery | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Battery:
"""A simple model of an electic car battery."""
def __init__(self, battery_size):
"""Initialize the battery's attributes."""
<|body_0|>
def get_range(self):
"""Print the range of the battery."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
... | stack_v2_sparse_classes_36k_train_004467 | 2,340 | no_license | [
{
"docstring": "Initialize the battery's attributes.",
"name": "__init__",
"signature": "def __init__(self, battery_size)"
},
{
"docstring": "Print the range of the battery.",
"name": "get_range",
"signature": "def get_range(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_014235 | Implement the Python class `Battery` described below.
Class description:
A simple model of an electic car battery.
Method signatures and docstrings:
- def __init__(self, battery_size): Initialize the battery's attributes.
- def get_range(self): Print the range of the battery. | Implement the Python class `Battery` described below.
Class description:
A simple model of an electic car battery.
Method signatures and docstrings:
- def __init__(self, battery_size): Initialize the battery's attributes.
- def get_range(self): Print the range of the battery.
<|skeleton|>
class Battery:
"""A sim... | 115f712e0c7e3d02270b8748fcff85f0e3df2c30 | <|skeleton|>
class Battery:
"""A simple model of an electic car battery."""
def __init__(self, battery_size):
"""Initialize the battery's attributes."""
<|body_0|>
def get_range(self):
"""Print the range of the battery."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Battery:
"""A simple model of an electic car battery."""
def __init__(self, battery_size):
"""Initialize the battery's attributes."""
self.battery_size = battery_size
if self.battery_size == 70:
self.range = 240
elif self.battery_size == 85:
self.ra... | the_stack_v2_python_sparse | python_crash_course/car_classes.py | keithkay/python | train | 0 |
c8ec9d0f6b13b349ed565761a9edee521b00c1b8 | [
"answer = ''\nfor s in strs:\n answer += str(len(s)) + ':' + s\nreturn answer",
"strs = []\nwhile s:\n i = s.find(':')\n length = int(s[:i])\n s = s[i + 1:]\n strs.append(s[:length])\n s = s[length:]\nreturn strs"
] | <|body_start_0|>
answer = ''
for s in strs:
answer += str(len(s)) + ':' + s
return answer
<|end_body_0|>
<|body_start_1|>
strs = []
while s:
i = s.find(':')
length = int(s[:i])
s = s[i + 1:]
strs.append(s[:length])
... | Codec | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec:
def encode(self, strs):
"""Encodes a list of strings to a single string. :type strs: List[str] :rtype: str"""
<|body_0|>
def decode(self, s):
"""Decodes a single string to a list of strings. :type s: str :rtype: List[str]"""
<|body_1|>
<|end_skeleton|... | stack_v2_sparse_classes_36k_train_004468 | 2,430 | no_license | [
{
"docstring": "Encodes a list of strings to a single string. :type strs: List[str] :rtype: str",
"name": "encode",
"signature": "def encode(self, strs)"
},
{
"docstring": "Decodes a single string to a list of strings. :type s: str :rtype: List[str]",
"name": "decode",
"signature": "def ... | 2 | stack_v2_sparse_classes_30k_train_012430 | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def encode(self, strs): Encodes a list of strings to a single string. :type strs: List[str] :rtype: str
- def decode(self, s): Decodes a single string to a list of strings. :type s: st... | Implement the Python class `Codec` described below.
Class description:
Implement the Codec class.
Method signatures and docstrings:
- def encode(self, strs): Encodes a list of strings to a single string. :type strs: List[str] :rtype: str
- def decode(self, s): Decodes a single string to a list of strings. :type s: st... | eb6b11f97a022b66716cb3890cc56c58f62e8aa4 | <|skeleton|>
class Codec:
def encode(self, strs):
"""Encodes a list of strings to a single string. :type strs: List[str] :rtype: str"""
<|body_0|>
def decode(self, s):
"""Decodes a single string to a list of strings. :type s: str :rtype: List[str]"""
<|body_1|>
<|end_skeleton|... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Codec:
def encode(self, strs):
"""Encodes a list of strings to a single string. :type strs: List[str] :rtype: str"""
answer = ''
for s in strs:
answer += str(len(s)) + ':' + s
return answer
def decode(self, s):
"""Decodes a single string to a list of st... | the_stack_v2_python_sparse | problemSets/top75/271.py | Th3Lourde/l33tcode | train | 0 | |
a2cccdbd08faa977d51083ea531c59e180ee6305 | [
"examples = []\nfor i, line in enumerate(lines):\n if len(line) != 2:\n print('data format error: %s' % '\\t'.join(line))\n print('data row contains two parts: conversation_content \\t label1 label2 label3')\n continue\n guid = '%s-%d' % (set_type, i)\n text_a = line[0]\n label = li... | <|body_start_0|>
examples = []
for i, line in enumerate(lines):
if len(line) != 2:
print('data format error: %s' % '\t'.join(line))
print('data row contains two parts: conversation_content \t label1 label2 label3')
continue
guid = '... | Processor for the ATIS Slot data set. | ATISSlotProcessor | [
"Apache-2.0",
"LicenseRef-scancode-unknown",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ATISSlotProcessor:
"""Processor for the ATIS Slot data set."""
def _create_examples(self, lines, set_type):
"""Creates examples for the training and dev sets."""
<|body_0|>
def get_train_examples(self, data_dir):
"""See base class."""
<|body_1|>
def ... | stack_v2_sparse_classes_36k_train_004469 | 30,538 | permissive | [
{
"docstring": "Creates examples for the training and dev sets.",
"name": "_create_examples",
"signature": "def _create_examples(self, lines, set_type)"
},
{
"docstring": "See base class.",
"name": "get_train_examples",
"signature": "def get_train_examples(self, data_dir)"
},
{
"... | 5 | null | Implement the Python class `ATISSlotProcessor` described below.
Class description:
Processor for the ATIS Slot data set.
Method signatures and docstrings:
- def _create_examples(self, lines, set_type): Creates examples for the training and dev sets.
- def get_train_examples(self, data_dir): See base class.
- def get_... | Implement the Python class `ATISSlotProcessor` described below.
Class description:
Processor for the ATIS Slot data set.
Method signatures and docstrings:
- def _create_examples(self, lines, set_type): Creates examples for the training and dev sets.
- def get_train_examples(self, data_dir): See base class.
- def get_... | a60babdf382aba71fe447b3259441b4bed947414 | <|skeleton|>
class ATISSlotProcessor:
"""Processor for the ATIS Slot data set."""
def _create_examples(self, lines, set_type):
"""Creates examples for the training and dev sets."""
<|body_0|>
def get_train_examples(self, data_dir):
"""See base class."""
<|body_1|>
def ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ATISSlotProcessor:
"""Processor for the ATIS Slot data set."""
def _create_examples(self, lines, set_type):
"""Creates examples for the training and dev sets."""
examples = []
for i, line in enumerate(lines):
if len(line) != 2:
print('data format error:... | the_stack_v2_python_sparse | PaddleNLP/dialogue_system/dialogue_general_understanding/dgu/reader.py | littletomatodonkey/models | train | 5 |
0b6b362c8d56b4399304d42a9b9ca1d71d3ba473 | [
"super(ObjBranch, self).__init__()\nself.trans_factor = trans_factor\nself.scale_factor = scale_factor\nself.inp_res = [256, 256]",
"if scaletrans is None:\n batch_size = scale.shape[0]\nelse:\n batch_size = scaletrans.shape[0]\nif scale is None:\n scale = scaletrans[:, :1]\nif trans is None:\n trans ... | <|body_start_0|>
super(ObjBranch, self).__init__()
self.trans_factor = trans_factor
self.scale_factor = scale_factor
self.inp_res = [256, 256]
<|end_body_0|>
<|body_start_1|>
if scaletrans is None:
batch_size = scale.shape[0]
else:
batch_size = sc... | ObjBranch | [
"LicenseRef-scancode-unknown",
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ObjBranch:
def __init__(self, trans_factor=1, scale_factor=1):
"""Args: trans_factor: Scaling parameter to insure translation and scale are updated similarly during training (if one is updated much more than the other, training is slowed down, because for instance only the variation of t... | stack_v2_sparse_classes_36k_train_004470 | 3,616 | permissive | [
{
"docstring": "Args: trans_factor: Scaling parameter to insure translation and scale are updated similarly during training (if one is updated much more than the other, training is slowed down, because for instance only the variation of translation or scale significantly influences the final loss variation) sca... | 2 | stack_v2_sparse_classes_30k_train_020386 | Implement the Python class `ObjBranch` described below.
Class description:
Implement the ObjBranch class.
Method signatures and docstrings:
- def __init__(self, trans_factor=1, scale_factor=1): Args: trans_factor: Scaling parameter to insure translation and scale are updated similarly during training (if one is updat... | Implement the Python class `ObjBranch` described below.
Class description:
Implement the ObjBranch class.
Method signatures and docstrings:
- def __init__(self, trans_factor=1, scale_factor=1): Args: trans_factor: Scaling parameter to insure translation and scale are updated similarly during training (if one is updat... | 9651c569c328707cc1ad1e4797b9e4b32083c446 | <|skeleton|>
class ObjBranch:
def __init__(self, trans_factor=1, scale_factor=1):
"""Args: trans_factor: Scaling parameter to insure translation and scale are updated similarly during training (if one is updated much more than the other, training is slowed down, because for instance only the variation of t... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ObjBranch:
def __init__(self, trans_factor=1, scale_factor=1):
"""Args: trans_factor: Scaling parameter to insure translation and scale are updated similarly during training (if one is updated much more than the other, training is slowed down, because for instance only the variation of translation or ... | the_stack_v2_python_sparse | meshreg/models/objbranch.py | pgrady3/handobjectconsist | train | 0 | |
15695aa4b93dc6123ae0391eeff04b98ecc3ae43 | [
"for _ in range(100):\n radius = random.randint(1, 4)\n circumference = 2 * math.pi * radius\n x_position = random.randint(0, 100)\n y_position = random.randint(0, 100)\n z_position = random.randint(0, 100)\n position = Vector(x_position, y_position, z_position)\n x_velocity = random.randint(0,... | <|body_start_0|>
for _ in range(100):
radius = random.randint(1, 4)
circumference = 2 * math.pi * radius
x_position = random.randint(0, 100)
y_position = random.randint(0, 100)
z_position = random.randint(0, 100)
position = Vector(x_positio... | Controller class used to simulate Asteroid random movements. | Controller | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Controller:
"""Controller class used to simulate Asteroid random movements."""
def __init__(self):
"""creates 100 asteroid objects."""
<|body_0|>
def simulate(self, seconds):
"""simulates the randomly generated asteroids movements with random velocity and random ... | stack_v2_sparse_classes_36k_train_004471 | 2,740 | no_license | [
{
"docstring": "creates 100 asteroid objects.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "simulates the randomly generated asteroids movements with random velocity and random position. :param seconds:",
"name": "simulate",
"signature": "def simulate(self, s... | 2 | stack_v2_sparse_classes_30k_train_016351 | Implement the Python class `Controller` described below.
Class description:
Controller class used to simulate Asteroid random movements.
Method signatures and docstrings:
- def __init__(self): creates 100 asteroid objects.
- def simulate(self, seconds): simulates the randomly generated asteroids movements with random... | Implement the Python class `Controller` described below.
Class description:
Controller class used to simulate Asteroid random movements.
Method signatures and docstrings:
- def __init__(self): creates 100 asteroid objects.
- def simulate(self, seconds): simulates the randomly generated asteroids movements with random... | 7061af6821d25bf7df6fd6e419ad828f5c1e7d61 | <|skeleton|>
class Controller:
"""Controller class used to simulate Asteroid random movements."""
def __init__(self):
"""creates 100 asteroid objects."""
<|body_0|>
def simulate(self, seconds):
"""simulates the randomly generated asteroids movements with random velocity and random ... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Controller:
"""Controller class used to simulate Asteroid random movements."""
def __init__(self):
"""creates 100 asteroid objects."""
for _ in range(100):
radius = random.randint(1, 4)
circumference = 2 * math.pi * radius
x_position = random.randint(0,... | the_stack_v2_python_sparse | Labs/Lab2/controller.py | jieunyu0623/3522_A00998343 | train | 1 |
cb758fc8a862b2ee79632819c507e0a270f82912 | [
"uri = {'firstlogin': self.firstlogin}\nuser = self.get_current_user()\nif user and len(args) and (args[0] in uri):\n dialog = uri[args[0]]()\n if isinstance(options.story_signature, list):\n dialog.extend(options.story_signature)\n for index, line in enumerate(dialog):\n try:\n di... | <|body_start_0|>
uri = {'firstlogin': self.firstlogin}
user = self.get_current_user()
if user and len(args) and (args[0] in uri):
dialog = uri[args[0]]()
if isinstance(options.story_signature, list):
dialog.extend(options.story_signature)
for i... | StoryAjaxHandler | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class StoryAjaxHandler:
def get(self, *args, **kargs):
"""Renders AJAX snippit based on URI"""
<|body_0|>
def firstlogin(self):
"""Render the first login dialog"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
uri = {'firstlogin': self.firstlogin}
... | stack_v2_sparse_classes_36k_train_004472 | 22,288 | permissive | [
{
"docstring": "Renders AJAX snippit based on URI",
"name": "get",
"signature": "def get(self, *args, **kargs)"
},
{
"docstring": "Render the first login dialog",
"name": "firstlogin",
"signature": "def firstlogin(self)"
}
] | 2 | null | Implement the Python class `StoryAjaxHandler` described below.
Class description:
Implement the StoryAjaxHandler class.
Method signatures and docstrings:
- def get(self, *args, **kargs): Renders AJAX snippit based on URI
- def firstlogin(self): Render the first login dialog | Implement the Python class `StoryAjaxHandler` described below.
Class description:
Implement the StoryAjaxHandler class.
Method signatures and docstrings:
- def get(self, *args, **kargs): Renders AJAX snippit based on URI
- def firstlogin(self): Render the first login dialog
<|skeleton|>
class StoryAjaxHandler:
... | de44dd6ef86dd5b97524d0e438d0441922099930 | <|skeleton|>
class StoryAjaxHandler:
def get(self, *args, **kargs):
"""Renders AJAX snippit based on URI"""
<|body_0|>
def firstlogin(self):
"""Render the first login dialog"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class StoryAjaxHandler:
def get(self, *args, **kargs):
"""Renders AJAX snippit based on URI"""
uri = {'firstlogin': self.firstlogin}
user = self.get_current_user()
if user and len(args) and (args[0] in uri):
dialog = uri[args[0]]()
if isinstance(options.story_... | the_stack_v2_python_sparse | handlers/MissionsHandler.py | moloch--/RootTheBox | train | 804 | |
cabcb9dd961fb8132cda468f0a2139109f43fce5 | [
"super(Application, self).__init__(master)\nself.grid()\nself.createWidgets()",
"self.btn1 = Button(self, text='I still do nothing')\nself.btn1.grid()\nself.btn2 = Button(self)\nself.btn2.grid()\nself.btn2.configure(text='Me too!')\nself.btn3 = Button(self)\nself.btn3.grid()\nself.btn3['text'] = 'Same here !'"
] | <|body_start_0|>
super(Application, self).__init__(master)
self.grid()
self.createWidgets()
<|end_body_0|>
<|body_start_1|>
self.btn1 = Button(self, text='I still do nothing')
self.btn1.grid()
self.btn2 = Button(self)
self.btn2.grid()
self.btn2.configure(... | A GUI app with 3 Buttons | Application | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Application:
"""A GUI app with 3 Buttons"""
def __init__(self, master):
"""Initialize the Frame"""
<|body_0|>
def createWidgets(self):
"""Create three buttons that do nothing"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
super(Application, sel... | stack_v2_sparse_classes_36k_train_004473 | 855 | no_license | [
{
"docstring": "Initialize the Frame",
"name": "__init__",
"signature": "def __init__(self, master)"
},
{
"docstring": "Create three buttons that do nothing",
"name": "createWidgets",
"signature": "def createWidgets(self)"
}
] | 2 | stack_v2_sparse_classes_30k_train_005620 | Implement the Python class `Application` described below.
Class description:
A GUI app with 3 Buttons
Method signatures and docstrings:
- def __init__(self, master): Initialize the Frame
- def createWidgets(self): Create three buttons that do nothing | Implement the Python class `Application` described below.
Class description:
A GUI app with 3 Buttons
Method signatures and docstrings:
- def __init__(self, master): Initialize the Frame
- def createWidgets(self): Create three buttons that do nothing
<|skeleton|>
class Application:
"""A GUI app with 3 Buttons"""... | 55aad492998ee73bd17903fe4fafd0f31ca22cc9 | <|skeleton|>
class Application:
"""A GUI app with 3 Buttons"""
def __init__(self, master):
"""Initialize the Frame"""
<|body_0|>
def createWidgets(self):
"""Create three buttons that do nothing"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Application:
"""A GUI app with 3 Buttons"""
def __init__(self, master):
"""Initialize the Frame"""
super(Application, self).__init__(master)
self.grid()
self.createWidgets()
def createWidgets(self):
"""Create three buttons that do nothing"""
self.btn1 ... | the_stack_v2_python_sparse | CoursPython/GUIButtons2.py | patrenaud/Python | train | 0 |
d42ac7e52ee42df67e20171c3709f34a9f520005 | [
"for cc in filter(lambda c: sum([self.segment(sn).length for sn in c]) < minlen, self.connected_components()):\n for s in cc:\n self.rm(s)",
"for s in self.segments:\n c = s._connectivity()\n if s.length < minlen and (c[0] == 0 or c[1] == 0) and (not self.is_cut_segment(s)):\n self.rm(s)"
] | <|body_start_0|>
for cc in filter(lambda c: sum([self.segment(sn).length for sn in c]) < minlen, self.connected_components()):
for s in cc:
self.rm(s)
<|end_body_0|>
<|body_start_1|>
for s in self.segments:
c = s._connectivity()
if s.length < minlen a... | Artifacts | [
"ISC"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Artifacts:
def remove_small_components(self, minlen):
"""Remove connected components with combined segment length < minlen. Note: Connected components of the graph are computed, considering only dovetail overlaps as connection of segments. Parameters: minlen (int) : the minimal length of... | stack_v2_sparse_classes_36k_train_004474 | 1,242 | permissive | [
{
"docstring": "Remove connected components with combined segment length < minlen. Note: Connected components of the graph are computed, considering only dovetail overlaps as connection of segments. Parameters: minlen (int) : the minimal length of the components to keep.",
"name": "remove_small_components",... | 2 | null | Implement the Python class `Artifacts` described below.
Class description:
Implement the Artifacts class.
Method signatures and docstrings:
- def remove_small_components(self, minlen): Remove connected components with combined segment length < minlen. Note: Connected components of the graph are computed, considering ... | Implement the Python class `Artifacts` described below.
Class description:
Implement the Artifacts class.
Method signatures and docstrings:
- def remove_small_components(self, minlen): Remove connected components with combined segment length < minlen. Note: Connected components of the graph are computed, considering ... | 12b31daac26ab137b6ee4a29b4f14554ba962dcb | <|skeleton|>
class Artifacts:
def remove_small_components(self, minlen):
"""Remove connected components with combined segment length < minlen. Note: Connected components of the graph are computed, considering only dovetail overlaps as connection of segments. Parameters: minlen (int) : the minimal length of... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Artifacts:
def remove_small_components(self, minlen):
"""Remove connected components with combined segment length < minlen. Note: Connected components of the graph are computed, considering only dovetail overlaps as connection of segments. Parameters: minlen (int) : the minimal length of the component... | the_stack_v2_python_sparse | gfapy/graph_operations/artifacts.py | ggonnella/gfapy | train | 63 | |
441a13a3359174644eab0deca73e2743880ee24e | [
"self._caffe = kwargs.pop('caffe')\nkwargs.setdefault('label_suffix', '')\nsuper(FullExpenseForm, self).__init__(*args, **kwargs)\nself.fields['expense'].label = 'Przeznaczenie'\nself.fields['amount'].label = 'Kwota'\nself.fields['expense'].empty_label = None\nself.fields['expense'].queryset = Expense.objects.filte... | <|body_start_0|>
self._caffe = kwargs.pop('caffe')
kwargs.setdefault('label_suffix', '')
super(FullExpenseForm, self).__init__(*args, **kwargs)
self.fields['expense'].label = 'Przeznaczenie'
self.fields['amount'].label = 'Kwota'
self.fields['expense'].empty_label = None
... | Responsible for creating a full expense - expense and sum. | FullExpenseForm | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FullExpenseForm:
"""Responsible for creating a full expense - expense and sum."""
def __init__(self, *args, **kwargs):
"""Initialize all FullExpense's fields."""
<|body_0|>
def save(self, commit=True):
"""Override of save method, to add Caffe relation."""
... | stack_v2_sparse_classes_36k_train_004475 | 4,623 | permissive | [
{
"docstring": "Initialize all FullExpense's fields.",
"name": "__init__",
"signature": "def __init__(self, *args, **kwargs)"
},
{
"docstring": "Override of save method, to add Caffe relation.",
"name": "save",
"signature": "def save(self, commit=True)"
}
] | 2 | stack_v2_sparse_classes_30k_train_020951 | Implement the Python class `FullExpenseForm` described below.
Class description:
Responsible for creating a full expense - expense and sum.
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): Initialize all FullExpense's fields.
- def save(self, commit=True): Override of save method, to add Caffe... | Implement the Python class `FullExpenseForm` described below.
Class description:
Responsible for creating a full expense - expense and sum.
Method signatures and docstrings:
- def __init__(self, *args, **kwargs): Initialize all FullExpense's fields.
- def save(self, commit=True): Override of save method, to add Caffe... | cdb7f5edb29255c7e874eaa6231621063210a8b0 | <|skeleton|>
class FullExpenseForm:
"""Responsible for creating a full expense - expense and sum."""
def __init__(self, *args, **kwargs):
"""Initialize all FullExpense's fields."""
<|body_0|>
def save(self, commit=True):
"""Override of save method, to add Caffe relation."""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FullExpenseForm:
"""Responsible for creating a full expense - expense and sum."""
def __init__(self, *args, **kwargs):
"""Initialize all FullExpense's fields."""
self._caffe = kwargs.pop('caffe')
kwargs.setdefault('label_suffix', '')
super(FullExpenseForm, self).__init__(*... | the_stack_v2_python_sparse | caffe/cash/forms.py | VirrageS/io-kawiarnie | train | 3 |
2cd17d962d642c286680e94048d88eb91718c769 | [
"list_file = []\ndirs = os.listdir(path=ReadSchoolList.path)\nfor dir in dirs:\n list_file.append(dir)\nreturn list_file",
"file_name_list = ReadSchoolList.getFileNameList()\nfile_dict = {}\nfor file in file_name_list:\n file_content_list = []\n for line in open(ReadSchoolList.path + '\\\\' + file):\n ... | <|body_start_0|>
list_file = []
dirs = os.listdir(path=ReadSchoolList.path)
for dir in dirs:
list_file.append(dir)
return list_file
<|end_body_0|>
<|body_start_1|>
file_name_list = ReadSchoolList.getFileNameList()
file_dict = {}
for file in file_name_... | ReadSchoolList | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ReadSchoolList:
def getFileNameList(cls):
""":return:文件名列表"""
<|body_0|>
def getFileAllData(cls):
""":return:{'学校_学院名1':[url1,url2...],'学校_学院名2':[url1,url2...]}"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
list_file = []
dirs = os.listdir... | stack_v2_sparse_classes_36k_train_004476 | 1,216 | no_license | [
{
"docstring": ":return:文件名列表",
"name": "getFileNameList",
"signature": "def getFileNameList(cls)"
},
{
"docstring": ":return:{'学校_学院名1':[url1,url2...],'学校_学院名2':[url1,url2...]}",
"name": "getFileAllData",
"signature": "def getFileAllData(cls)"
}
] | 2 | stack_v2_sparse_classes_30k_train_007842 | Implement the Python class `ReadSchoolList` described below.
Class description:
Implement the ReadSchoolList class.
Method signatures and docstrings:
- def getFileNameList(cls): :return:文件名列表
- def getFileAllData(cls): :return:{'学校_学院名1':[url1,url2...],'学校_学院名2':[url1,url2...]} | Implement the Python class `ReadSchoolList` described below.
Class description:
Implement the ReadSchoolList class.
Method signatures and docstrings:
- def getFileNameList(cls): :return:文件名列表
- def getFileAllData(cls): :return:{'学校_学院名1':[url1,url2...],'学校_学院名2':[url1,url2...]}
<|skeleton|>
class ReadSchoolList:
... | 550beaf7063b2b14d996fbf9fc03aa678b5d4cbb | <|skeleton|>
class ReadSchoolList:
def getFileNameList(cls):
""":return:文件名列表"""
<|body_0|>
def getFileAllData(cls):
""":return:{'学校_学院名1':[url1,url2...],'学校_学院名2':[url1,url2...]}"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ReadSchoolList:
def getFileNameList(cls):
""":return:文件名列表"""
list_file = []
dirs = os.listdir(path=ReadSchoolList.path)
for dir in dirs:
list_file.append(dir)
return list_file
def getFileAllData(cls):
""":return:{'学校_学院名1':[url1,url2...],'学校_学院... | the_stack_v2_python_sparse | TeachSpider/TeachSpider/tools/ReadSchoolList.py | darkhorsecmd/Teach_intelligence | train | 1 | |
4eb02f91069b768394a66c36b64411d69619b3b8 | [
"if not root:\n return 'None'\nreturn str(root.val) + ',' + str(self.serialize(root.left)) + ',' + str(self.serialize(root.right))",
"def dfs(dataList):\n val = dataList.pop(0)\n if val == 'None':\n return None\n root = TreeNode(int(val))\n root.left = dfs(dataList)\n root.right = dfs(dat... | <|body_start_0|>
if not root:
return 'None'
return str(root.val) + ',' + str(self.serialize(root.left)) + ',' + str(self.serialize(root.right))
<|end_body_0|>
<|body_start_1|>
def dfs(dataList):
val = dataList.pop(0)
if val == 'None':
return N... | Codec2 | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Codec2:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|>
<|body... | stack_v2_sparse_classes_36k_train_004477 | 3,217 | 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 | null | Implement the Python class `Codec2` described below.
Class description:
Implement the Codec2 class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtyp... | Implement the Python class `Codec2` described below.
Class description:
Implement the Codec2 class.
Method signatures and docstrings:
- def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str
- def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtyp... | 79d4e3946309f6e37e18c1958243d63faf99861c | <|skeleton|>
class Codec2:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
<|body_0|>
def deserialize(self, data):
"""Decodes your encoded data to tree. :type data: str :rtype: TreeNode"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Codec2:
def serialize(self, root):
"""Encodes a tree to a single string. :type root: TreeNode :rtype: str"""
if not root:
return 'None'
return str(root.val) + ',' + str(self.serialize(root.left)) + ',' + str(self.serialize(root.right))
def deserialize(self, data):
... | the_stack_v2_python_sparse | 201-300/297_二叉树的序列化与反序列化.py | ZhiyuSun/leetcode-practice | train | 6 | |
5ed0602fea493474aaccea06a791ca1d34779c5e | [
"super().__init__(web3_or_provider, contract_address)\nweb3 = None\nif isinstance(web3_or_provider, BaseProvider):\n web3 = Web3(web3_or_provider)\nelif isinstance(web3_or_provider, Web3):\n web3 = web3_or_provider\nif web3 is None:\n raise TypeError(\"Expected parameter 'web3_or_provider' to be an instanc... | <|body_start_0|>
super().__init__(web3_or_provider, contract_address)
web3 = None
if isinstance(web3_or_provider, BaseProvider):
web3 = Web3(web3_or_provider)
elif isinstance(web3_or_provider, Web3):
web3 = web3_or_provider
if web3 is None:
rai... | Validate inputs to Exchange methods. | ExchangeValidator | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ExchangeValidator:
"""Validate inputs to Exchange methods."""
def __init__(self, web3_or_provider: Union[Web3, BaseProvider], contract_address: str):
"""Initialize the class."""
<|body_0|>
def assert_valid(self, method_name: str, parameter_name: str, argument_value: Any)... | stack_v2_sparse_classes_36k_train_004478 | 2,071 | permissive | [
{
"docstring": "Initialize the class.",
"name": "__init__",
"signature": "def __init__(self, web3_or_provider: Union[Web3, BaseProvider], contract_address: str)"
},
{
"docstring": "Raise an exception if method input is not valid. :param method_name: Name of the method whose input is to be valida... | 2 | stack_v2_sparse_classes_30k_train_017555 | Implement the Python class `ExchangeValidator` described below.
Class description:
Validate inputs to Exchange methods.
Method signatures and docstrings:
- def __init__(self, web3_or_provider: Union[Web3, BaseProvider], contract_address: str): Initialize the class.
- def assert_valid(self, method_name: str, parameter... | Implement the Python class `ExchangeValidator` described below.
Class description:
Validate inputs to Exchange methods.
Method signatures and docstrings:
- def __init__(self, web3_or_provider: Union[Web3, BaseProvider], contract_address: str): Initialize the class.
- def assert_valid(self, method_name: str, parameter... | 53b5bb16d8b4c9050a46978b6f347ef7595fe103 | <|skeleton|>
class ExchangeValidator:
"""Validate inputs to Exchange methods."""
def __init__(self, web3_or_provider: Union[Web3, BaseProvider], contract_address: str):
"""Initialize the class."""
<|body_0|>
def assert_valid(self, method_name: str, parameter_name: str, argument_value: Any)... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ExchangeValidator:
"""Validate inputs to Exchange methods."""
def __init__(self, web3_or_provider: Union[Web3, BaseProvider], contract_address: str):
"""Initialize the class."""
super().__init__(web3_or_provider, contract_address)
web3 = None
if isinstance(web3_or_provider... | the_stack_v2_python_sparse | python-packages/contract_wrappers/src/zero_ex/contract_wrappers/exchange/validator.py | 0xProject/0x-monorepo | train | 1,132 |
2155d160a19ea80a6e73257ac6e97261660ebe67 | [
"QWidget.__init__(self)\nself.setGeometry(QRect(400, 200, 700, 600))\nlayout = QtWidgets.QGridLayout(self)\nself.table = QtWidgets.QTableWidget()\nself.table.setColumnCount(2)\nself.table.horizontalHeader().setStretchLastSection(True)\nself.table.verticalHeader().setStretchLastSection(False)\nlayout.addWidget(self.... | <|body_start_0|>
QWidget.__init__(self)
self.setGeometry(QRect(400, 200, 700, 600))
layout = QtWidgets.QGridLayout(self)
self.table = QtWidgets.QTableWidget()
self.table.setColumnCount(2)
self.table.horizontalHeader().setStretchLastSection(True)
self.table.vertica... | Popup window with the list of shorcuts. | ShortcutPopup | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ShortcutPopup:
"""Popup window with the list of shorcuts."""
def __init__(self):
"""Init."""
<|body_0|>
def set_shortcuts(self, shdic):
"""Fill table."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
QWidget.__init__(self)
self.setGeometr... | stack_v2_sparse_classes_36k_train_004479 | 5,904 | permissive | [
{
"docstring": "Init.",
"name": "__init__",
"signature": "def __init__(self)"
},
{
"docstring": "Fill table.",
"name": "set_shortcuts",
"signature": "def set_shortcuts(self, shdic)"
}
] | 2 | stack_v2_sparse_classes_30k_train_018591 | Implement the Python class `ShortcutPopup` described below.
Class description:
Popup window with the list of shorcuts.
Method signatures and docstrings:
- def __init__(self): Init.
- def set_shortcuts(self, shdic): Fill table. | Implement the Python class `ShortcutPopup` described below.
Class description:
Popup window with the list of shorcuts.
Method signatures and docstrings:
- def __init__(self): Init.
- def set_shortcuts(self, shdic): Fill table.
<|skeleton|>
class ShortcutPopup:
"""Popup window with the list of shorcuts."""
d... | be096aa8a7058c329e7120d0bdb45d3c9eb8be42 | <|skeleton|>
class ShortcutPopup:
"""Popup window with the list of shorcuts."""
def __init__(self):
"""Init."""
<|body_0|>
def set_shortcuts(self, shdic):
"""Fill table."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ShortcutPopup:
"""Popup window with the list of shorcuts."""
def __init__(self):
"""Init."""
QWidget.__init__(self)
self.setGeometry(QRect(400, 200, 700, 600))
layout = QtWidgets.QGridLayout(self)
self.table = QtWidgets.QTableWidget()
self.table.setColumnCo... | the_stack_v2_python_sparse | visbrain/utils/gui/popup.py | lassemadsen/visbrain | train | 0 |
eaa8000765ae446e630cec15bb39601bfbb90441 | [
"df_list = []\nfor content1 in os.listdir(predictions_dir):\n if pred_nametag in content1:\n patientID1 = int(content1.split('_')[1])\n for content2 in os.listdir(ground_truth_dir):\n if gt_nametag in content2:\n patientID2 = int(content2.split('_')[1])\n if... | <|body_start_0|>
df_list = []
for content1 in os.listdir(predictions_dir):
if pred_nametag in content1:
patientID1 = int(content1.split('_')[1])
for content2 in os.listdir(ground_truth_dir):
if gt_nametag in content2:
... | EvaluatePredictedFiles | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class EvaluatePredictedFiles:
def evaluate_predicted_files_1(predictions_dir, ground_truth_dir, pred_nametag, gt_nametag):
"""Creates an excel file as well as returns a DataFrame containing evaluation metrics such as: Dice coefficient, Accuracy, Sensitivity, Specificity, TP, TN, FP, and FN. No... | stack_v2_sparse_classes_36k_train_004480 | 9,017 | no_license | [
{
"docstring": "Creates an excel file as well as returns a DataFrame containing evaluation metrics such as: Dice coefficient, Accuracy, Sensitivity, Specificity, TP, TN, FP, and FN. Note: All the predicted files should be inside the given predictions_dir, and GT files in ground_truth_dir as well. Parameters ---... | 2 | stack_v2_sparse_classes_30k_train_003808 | Implement the Python class `EvaluatePredictedFiles` described below.
Class description:
Implement the EvaluatePredictedFiles class.
Method signatures and docstrings:
- def evaluate_predicted_files_1(predictions_dir, ground_truth_dir, pred_nametag, gt_nametag): Creates an excel file as well as returns a DataFrame cont... | Implement the Python class `EvaluatePredictedFiles` described below.
Class description:
Implement the EvaluatePredictedFiles class.
Method signatures and docstrings:
- def evaluate_predicted_files_1(predictions_dir, ground_truth_dir, pred_nametag, gt_nametag): Creates an excel file as well as returns a DataFrame cont... | fad319f2f8061ff662b16bd935abefbc0c5e176d | <|skeleton|>
class EvaluatePredictedFiles:
def evaluate_predicted_files_1(predictions_dir, ground_truth_dir, pred_nametag, gt_nametag):
"""Creates an excel file as well as returns a DataFrame containing evaluation metrics such as: Dice coefficient, Accuracy, Sensitivity, Specificity, TP, TN, FP, and FN. No... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class EvaluatePredictedFiles:
def evaluate_predicted_files_1(predictions_dir, ground_truth_dir, pred_nametag, gt_nametag):
"""Creates an excel file as well as returns a DataFrame containing evaluation metrics such as: Dice coefficient, Accuracy, Sensitivity, Specificity, TP, TN, FP, and FN. Note: All the pr... | the_stack_v2_python_sparse | evaluate_predicted_files.py | youpele52/thesis | train | 2 | |
623fd46b618184aecad96437c0e2f462dae18f19 | [
"data = copy.deepcopy(annuli)\nfor values in data.itervalues():\n for index in xrange(len(values)):\n values[index] = values[index]._asdict()\n values.sort(key=operator.itemgetter('stdev'))\nfor pfilter in data.keys():\n data[str(pfilter)] = data.pop(pfilter)\nwith open(path, 'wt') as fd:\n kwarg... | <|body_start_0|>
data = copy.deepcopy(annuli)
for values in data.itervalues():
for index in xrange(len(values)):
values[index] = values[index]._asdict()
values.sort(key=operator.itemgetter('stdev'))
for pfilter in data.keys():
data[str(pfilter)... | Encapsulate the quality of a set of photometric parameters. How do we determine how good a set of parameters for aperture photometry is? In order to compare them, we need to identify the most constant stars (or, by extension, any other astronomical object) in the field and compute their light curves. The better the ape... | CandidateAnnuli | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class CandidateAnnuli:
"""Encapsulate the quality of a set of photometric parameters. How do we determine how good a set of parameters for aperture photometry is? In order to compare them, we need to identify the most constant stars (or, by extension, any other astronomical object) in the field and com... | stack_v2_sparse_classes_36k_train_004481 | 4,583 | no_license | [
{
"docstring": "Save a series of CadidateAnnuli objects to a JSON file. Serialize 'annuli' to a JSON file. It must be a dictionary which maps each photometric filter (a Passband object) to a sequence of the corresponding CandidateAnnuli objects -- i.e., the different aperture photometric parameters that were ev... | 2 | stack_v2_sparse_classes_30k_train_019182 | Implement the Python class `CandidateAnnuli` described below.
Class description:
Encapsulate the quality of a set of photometric parameters. How do we determine how good a set of parameters for aperture photometry is? In order to compare them, we need to identify the most constant stars (or, by extension, any other as... | Implement the Python class `CandidateAnnuli` described below.
Class description:
Encapsulate the quality of a set of photometric parameters. How do we determine how good a set of parameters for aperture photometry is? In order to compare them, we need to identify the most constant stars (or, by extension, any other as... | a043b145df0622006186488d284b848a489ee2e9 | <|skeleton|>
class CandidateAnnuli:
"""Encapsulate the quality of a set of photometric parameters. How do we determine how good a set of parameters for aperture photometry is? In order to compare them, we need to identify the most constant stars (or, by extension, any other astronomical object) in the field and com... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class CandidateAnnuli:
"""Encapsulate the quality of a set of photometric parameters. How do we determine how good a set of parameters for aperture photometry is? In order to compare them, we need to identify the most constant stars (or, by extension, any other astronomical object) in the field and compute their li... | the_stack_v2_python_sparse | json_parse.py | pablogsal/lemon | train | 1 |
dab49c5e1960e654f96f0f0c98076b1480cba305 | [
"if not s:\n return 0\nm = 1\nls = len(s)\nfor i in range(ls):\n j = i\n d = []\n while j < ls:\n if s[j] in d:\n break\n else:\n d.append(s[j])\n j += 1\n temp = j - i\n if temp > m:\n m = temp\nreturn m",
"l = 0\nstart = 0\nlength = len(s)\... | <|body_start_0|>
if not s:
return 0
m = 1
ls = len(s)
for i in range(ls):
j = i
d = []
while j < ls:
if s[j] in d:
break
else:
d.append(s[j])
j += 1... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def lengthOfLongestSubstring(self, s):
""":type s: str :rtype: int"""
<|body_0|>
def lengthOfLongestSubstring2(self, s):
""":type s: str :rtype: int"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
if not s:
return 0
m =... | stack_v2_sparse_classes_36k_train_004482 | 1,652 | no_license | [
{
"docstring": ":type s: str :rtype: int",
"name": "lengthOfLongestSubstring",
"signature": "def lengthOfLongestSubstring(self, s)"
},
{
"docstring": ":type s: str :rtype: int",
"name": "lengthOfLongestSubstring2",
"signature": "def lengthOfLongestSubstring2(self, s)"
}
] | 2 | stack_v2_sparse_classes_30k_test_001172 | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lengthOfLongestSubstring(self, s): :type s: str :rtype: int
- def lengthOfLongestSubstring2(self, s): :type s: str :rtype: int | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def lengthOfLongestSubstring(self, s): :type s: str :rtype: int
- def lengthOfLongestSubstring2(self, s): :type s: str :rtype: int
<|skeleton|>
class Solution:
def lengthOf... | 2866df7587ee867a958a2b4fc02345bc3ef56999 | <|skeleton|>
class Solution:
def lengthOfLongestSubstring(self, s):
""":type s: str :rtype: int"""
<|body_0|>
def lengthOfLongestSubstring2(self, s):
""":type s: str :rtype: int"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def lengthOfLongestSubstring(self, s):
""":type s: str :rtype: int"""
if not s:
return 0
m = 1
ls = len(s)
for i in range(ls):
j = i
d = []
while j < ls:
if s[j] in d:
break
... | the_stack_v2_python_sparse | 中级算法/lengthOfLongestSubstring.py | OrangeJessie/Fighting_Leetcode | train | 1 | |
ae12dc5b76fb51e151aa3e6542bb5d920cc689e1 | [
"graph = dict(enumerate(graph))\nmemo = [[] for _ in range(len(graph))]\n\ndef paths(s, e):\n if s == e:\n return [[e]]\n if memo[s]:\n return memo[s]\n ret = []\n for n in graph[s]:\n ret.extend(([s] + p for p in paths(n, e)))\n memo[s] = ret\n return ret\nreturn paths(0, len... | <|body_start_0|>
graph = dict(enumerate(graph))
memo = [[] for _ in range(len(graph))]
def paths(s, e):
if s == e:
return [[e]]
if memo[s]:
return memo[s]
ret = []
for n in graph[s]:
ret.extend(([s] ... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def allPathsSourceTarget(self, graph: List[List[int]]) -> List[List[int]]:
"""09/17/2020 22:46"""
<|body_0|>
def allPathsSourceTarget(self, graph: List[List[int]]) -> List[List[int]]:
"""Dec 09, 2021 10:57"""
<|body_1|>
def allPathsSourceTarget... | stack_v2_sparse_classes_36k_train_004483 | 2,892 | no_license | [
{
"docstring": "09/17/2020 22:46",
"name": "allPathsSourceTarget",
"signature": "def allPathsSourceTarget(self, graph: List[List[int]]) -> List[List[int]]"
},
{
"docstring": "Dec 09, 2021 10:57",
"name": "allPathsSourceTarget",
"signature": "def allPathsSourceTarget(self, graph: List[Lis... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def allPathsSourceTarget(self, graph: List[List[int]]) -> List[List[int]]: 09/17/2020 22:46
- def allPathsSourceTarget(self, graph: List[List[int]]) -> List[List[int]]: Dec 09, 2... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def allPathsSourceTarget(self, graph: List[List[int]]) -> List[List[int]]: 09/17/2020 22:46
- def allPathsSourceTarget(self, graph: List[List[int]]) -> List[List[int]]: Dec 09, 2... | 1389a009a02e90e8700a7a00e0b7f797c129cdf4 | <|skeleton|>
class Solution:
def allPathsSourceTarget(self, graph: List[List[int]]) -> List[List[int]]:
"""09/17/2020 22:46"""
<|body_0|>
def allPathsSourceTarget(self, graph: List[List[int]]) -> List[List[int]]:
"""Dec 09, 2021 10:57"""
<|body_1|>
def allPathsSourceTarget... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def allPathsSourceTarget(self, graph: List[List[int]]) -> List[List[int]]:
"""09/17/2020 22:46"""
graph = dict(enumerate(graph))
memo = [[] for _ in range(len(graph))]
def paths(s, e):
if s == e:
return [[e]]
if memo[s]:
... | the_stack_v2_python_sparse | leetcode/solved/813_All_Paths_From_Source_to_Target/solution.py | sungminoh/algorithms | train | 0 | |
0ca7d1b2ff449d02f18643ed6abb38ab91f3b14c | [
"super(UncertaintiesModel, self).__init__()\nself.distributions = []\npath = os.path.dirname(os.path.realpath(__file__))\nself.my_outputs = get_outputs(self)\nself.filename = path + '\\\\uncertainties.csv'\nself.init_distributions(self.filename)",
"for dist in self.distributions:\n probInput = getattr(self, di... | <|body_start_0|>
super(UncertaintiesModel, self).__init__()
self.distributions = []
path = os.path.dirname(os.path.realpath(__file__))
self.my_outputs = get_outputs(self)
self.filename = path + '\\uncertainties.csv'
self.init_distributions(self.filename)
<|end_body_0|>
<... | UncertaintiesModel | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class UncertaintiesModel:
def __init__(self):
"""The constructor of the OpenMDAO component is extended to initialize a :class:`list` to contain the distributions, then it loads the CSV file containing the uncertainties data, then initializes the :class:`Uncertainties.calc_uncertainties.Distrib... | stack_v2_sparse_classes_36k_train_004484 | 6,933 | no_license | [
{
"docstring": "The constructor of the OpenMDAO component is extended to initialize a :class:`list` to contain the distributions, then it loads the CSV file containing the uncertainties data, then initializes the :class:`Uncertainties.calc_uncertainties.Distribution` objects, and stores them in the list. :retur... | 3 | stack_v2_sparse_classes_30k_train_008914 | Implement the Python class `UncertaintiesModel` described below.
Class description:
Implement the UncertaintiesModel class.
Method signatures and docstrings:
- def __init__(self): The constructor of the OpenMDAO component is extended to initialize a :class:`list` to contain the distributions, then it loads the CSV fi... | Implement the Python class `UncertaintiesModel` described below.
Class description:
Implement the UncertaintiesModel class.
Method signatures and docstrings:
- def __init__(self): The constructor of the OpenMDAO component is extended to initialize a :class:`list` to contain the distributions, then it loads the CSV fi... | 5b650decfafbe8b8b5e3298a3a2da9f2db5e1daa | <|skeleton|>
class UncertaintiesModel:
def __init__(self):
"""The constructor of the OpenMDAO component is extended to initialize a :class:`list` to contain the distributions, then it loads the CSV file containing the uncertainties data, then initializes the :class:`Uncertainties.calc_uncertainties.Distrib... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class UncertaintiesModel:
def __init__(self):
"""The constructor of the OpenMDAO component is extended to initialize a :class:`list` to contain the distributions, then it loads the CSV file containing the uncertainties data, then initializes the :class:`Uncertainties.calc_uncertainties.Distribution` objects... | the_stack_v2_python_sparse | Uncertainties/Uncertainties.py | rothnic/GeorgiaAquarium | train | 0 | |
d3dc1e71d9fd55722318860df9a6b17b8f9216ce | [
"if geom_scan:\n await self.middleware.run_in_thread(geom.scan)\nsync = False\ntry:\n async with temporarily_disassemble_multipath(self.middleware, devname, overprovision_check) as real_devname:\n if not can_overprovision(real_devname):\n raise CanNotBeOverprovisionedException(real_devname)\... | <|body_start_0|>
if geom_scan:
await self.middleware.run_in_thread(geom.scan)
sync = False
try:
async with temporarily_disassemble_multipath(self.middleware, devname, overprovision_check) as real_devname:
if not can_overprovision(real_devname):
... | DiskService | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DiskService:
async def overprovision(self, devname, size, geom_scan):
"""Sets overprovision of disk `devname` to `size` gigabytes"""
<|body_0|>
async def unoverprovision(self, devname):
"""Removes overprovisioning of disk `devname`"""
<|body_1|>
<|end_skelet... | stack_v2_sparse_classes_36k_train_004485 | 5,535 | no_license | [
{
"docstring": "Sets overprovision of disk `devname` to `size` gigabytes",
"name": "overprovision",
"signature": "async def overprovision(self, devname, size, geom_scan)"
},
{
"docstring": "Removes overprovisioning of disk `devname`",
"name": "unoverprovision",
"signature": "async def un... | 2 | null | Implement the Python class `DiskService` described below.
Class description:
Implement the DiskService class.
Method signatures and docstrings:
- async def overprovision(self, devname, size, geom_scan): Sets overprovision of disk `devname` to `size` gigabytes
- async def unoverprovision(self, devname): Removes overpr... | Implement the Python class `DiskService` described below.
Class description:
Implement the DiskService class.
Method signatures and docstrings:
- async def overprovision(self, devname, size, geom_scan): Sets overprovision of disk `devname` to `size` gigabytes
- async def unoverprovision(self, devname): Removes overpr... | 3bd269199b404b8d3efe9e867d2c4f37ab187c4b | <|skeleton|>
class DiskService:
async def overprovision(self, devname, size, geom_scan):
"""Sets overprovision of disk `devname` to `size` gigabytes"""
<|body_0|>
async def unoverprovision(self, devname):
"""Removes overprovisioning of disk `devname`"""
<|body_1|>
<|end_skelet... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DiskService:
async def overprovision(self, devname, size, geom_scan):
"""Sets overprovision of disk `devname` to `size` gigabytes"""
if geom_scan:
await self.middleware.run_in_thread(geom.scan)
sync = False
try:
async with temporarily_disassemble_multipa... | the_stack_v2_python_sparse | src/middlewared/middlewared/plugins/disk_/overprovision_freebsd.py | cyberpower678/freenas | train | 2 | |
224c2628543e274794e968c4bf53922a95b6bc71 | [
"fields = (forms.ChoiceField(choices=choices, required=False), forms.CharField(required=False))\nself.widget = OptionalChoiceWidget(widgets=[f.widget for f in fields])\nsuper(OptionalChoiceField, self).__init__(*args, required=False, fields=fields, **kwargs)",
"if not data_list:\n raise ValidationError('Need t... | <|body_start_0|>
fields = (forms.ChoiceField(choices=choices, required=False), forms.CharField(required=False))
self.widget = OptionalChoiceWidget(widgets=[f.widget for f in fields])
super(OptionalChoiceField, self).__init__(*args, required=False, fields=fields, **kwargs)
<|end_body_0|>
<|body_... | OptionalChoiceField | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OptionalChoiceField:
def __init__(self, choices, max_length=80, *args, **kwargs):
"""sets the two fields as not required but will enforce that (at least) one is set in compress"""
<|body_0|>
def compress(self, data_list):
"""return the choicefield value if selected o... | stack_v2_sparse_classes_36k_train_004486 | 6,504 | no_license | [
{
"docstring": "sets the two fields as not required but will enforce that (at least) one is set in compress",
"name": "__init__",
"signature": "def __init__(self, choices, max_length=80, *args, **kwargs)"
},
{
"docstring": "return the choicefield value if selected or charfield value (if both emp... | 2 | null | Implement the Python class `OptionalChoiceField` described below.
Class description:
Implement the OptionalChoiceField class.
Method signatures and docstrings:
- def __init__(self, choices, max_length=80, *args, **kwargs): sets the two fields as not required but will enforce that (at least) one is set in compress
- d... | Implement the Python class `OptionalChoiceField` described below.
Class description:
Implement the OptionalChoiceField class.
Method signatures and docstrings:
- def __init__(self, choices, max_length=80, *args, **kwargs): sets the two fields as not required but will enforce that (at least) one is set in compress
- d... | b0b699dab3cc8efef2a91fb0706adcca130e0911 | <|skeleton|>
class OptionalChoiceField:
def __init__(self, choices, max_length=80, *args, **kwargs):
"""sets the two fields as not required but will enforce that (at least) one is set in compress"""
<|body_0|>
def compress(self, data_list):
"""return the choicefield value if selected o... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class OptionalChoiceField:
def __init__(self, choices, max_length=80, *args, **kwargs):
"""sets the two fields as not required but will enforce that (at least) one is set in compress"""
fields = (forms.ChoiceField(choices=choices, required=False), forms.CharField(required=False))
self.widget... | the_stack_v2_python_sparse | apps/public/widgets.py | pbpoon/dda | train | 0 | |
ec53f19c80eb1e296e12949fc45f5cd3af31f792 | [
"super().__init__()\nself.tade1 = TADELayer(in_channels=in_channels, aux_channels=aux_channels, kernel_size=kernel_size, bias=bias, upsample_factor=1, upsample_mode=upsample_mode)\nself.gated_conv1 = torch.nn.Conv1d(in_channels, in_channels * 2, kernel_size, 1, bias=bias, padding=(kernel_size - 1) // 2)\nself.tade2... | <|body_start_0|>
super().__init__()
self.tade1 = TADELayer(in_channels=in_channels, aux_channels=aux_channels, kernel_size=kernel_size, bias=bias, upsample_factor=1, upsample_mode=upsample_mode)
self.gated_conv1 = torch.nn.Conv1d(in_channels, in_channels * 2, kernel_size, 1, bias=bias, padding=(... | TADEResBlock module. | TADEResBlock | [
"MIT",
"LicenseRef-scancode-proprietary-license",
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TADEResBlock:
"""TADEResBlock module."""
def __init__(self, in_channels=64, aux_channels=80, kernel_size=9, dilation=2, bias=True, upsample_factor=2, upsample_mode='nearest', gated_function='softmax'):
"""Initialize TADEResBlock module."""
<|body_0|>
def forward(self, x,... | stack_v2_sparse_classes_36k_train_004487 | 4,805 | permissive | [
{
"docstring": "Initialize TADEResBlock module.",
"name": "__init__",
"signature": "def __init__(self, in_channels=64, aux_channels=80, kernel_size=9, dilation=2, bias=True, upsample_factor=2, upsample_mode='nearest', gated_function='softmax')"
},
{
"docstring": "Calculate forward propagation. A... | 2 | stack_v2_sparse_classes_30k_train_004386 | Implement the Python class `TADEResBlock` described below.
Class description:
TADEResBlock module.
Method signatures and docstrings:
- def __init__(self, in_channels=64, aux_channels=80, kernel_size=9, dilation=2, bias=True, upsample_factor=2, upsample_mode='nearest', gated_function='softmax'): Initialize TADEResBloc... | Implement the Python class `TADEResBlock` described below.
Class description:
TADEResBlock module.
Method signatures and docstrings:
- def __init__(self, in_channels=64, aux_channels=80, kernel_size=9, dilation=2, bias=True, upsample_factor=2, upsample_mode='nearest', gated_function='softmax'): Initialize TADEResBloc... | c68b4590ab20eaf55e0b96b82325a90177fffd5c | <|skeleton|>
class TADEResBlock:
"""TADEResBlock module."""
def __init__(self, in_channels=64, aux_channels=80, kernel_size=9, dilation=2, bias=True, upsample_factor=2, upsample_mode='nearest', gated_function='softmax'):
"""Initialize TADEResBlock module."""
<|body_0|>
def forward(self, x,... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TADEResBlock:
"""TADEResBlock module."""
def __init__(self, in_channels=64, aux_channels=80, kernel_size=9, dilation=2, bias=True, upsample_factor=2, upsample_mode='nearest', gated_function='softmax'):
"""Initialize TADEResBlock module."""
super().__init__()
self.tade1 = TADELayer... | the_stack_v2_python_sparse | parallel_wavegan/layers/tade_res_block.py | kan-bayashi/ParallelWaveGAN | train | 1,405 |
b208f3fe517962d1d6d5cb5153ab8cedf1d71582 | [
"self.value = None\n\ndef gen(nl):\n for x in nl:\n if x.isInteger():\n yield x.getInteger()\n else:\n for y in gen(x.getList()):\n yield y\nself.gen = gen(nestedList)",
"if self.value == None:\n self.value = next(self.gen)\nreturn self.value",
"try:\n ... | <|body_start_0|>
self.value = None
def gen(nl):
for x in nl:
if x.isInteger():
yield x.getInteger()
else:
for y in gen(x.getList()):
yield y
self.gen = gen(nestedList)
<|end_body_0|>
<|b... | NestedIterator | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class NestedIterator:
def __init__(self, nestedList):
"""Initialize your data structure here. :type nestedList: List[NestedInteger]"""
<|body_0|>
def next(self):
""":rtype: int"""
<|body_1|>
def hasNext(self):
""":rtype: bool"""
<|body_2|>
<|e... | stack_v2_sparse_classes_36k_train_004488 | 4,327 | no_license | [
{
"docstring": "Initialize your data structure here. :type nestedList: List[NestedInteger]",
"name": "__init__",
"signature": "def __init__(self, nestedList)"
},
{
"docstring": ":rtype: int",
"name": "next",
"signature": "def next(self)"
},
{
"docstring": ":rtype: bool",
"nam... | 3 | null | Implement the Python class `NestedIterator` described below.
Class description:
Implement the NestedIterator class.
Method signatures and docstrings:
- def __init__(self, nestedList): Initialize your data structure here. :type nestedList: List[NestedInteger]
- def next(self): :rtype: int
- def hasNext(self): :rtype: ... | Implement the Python class `NestedIterator` described below.
Class description:
Implement the NestedIterator class.
Method signatures and docstrings:
- def __init__(self, nestedList): Initialize your data structure here. :type nestedList: List[NestedInteger]
- def next(self): :rtype: int
- def hasNext(self): :rtype: ... | 36d7f9e967a62db77622e0888f61999d7f37579a | <|skeleton|>
class NestedIterator:
def __init__(self, nestedList):
"""Initialize your data structure here. :type nestedList: List[NestedInteger]"""
<|body_0|>
def next(self):
""":rtype: int"""
<|body_1|>
def hasNext(self):
""":rtype: bool"""
<|body_2|>
<|e... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class NestedIterator:
def __init__(self, nestedList):
"""Initialize your data structure here. :type nestedList: List[NestedInteger]"""
self.value = None
def gen(nl):
for x in nl:
if x.isInteger():
yield x.getInteger()
else:
... | the_stack_v2_python_sparse | P0341.py | westgate458/LeetCode | train | 0 | |
f54c70bccf53b3a61009efc4e4c59dec03e03fc0 | [
"kwds['channels'] = channels\nsuper().__init__(**kwds)\nfor channel in self.channels:\n channel[2].setValue(1.05)\n channel[2].setMaximum(9.9)",
"active = []\nincrement = []\nfor i, channel in enumerate(self.channels):\n if self.which_checked[i] and frame_number % channel[3].value() == 0:\n active... | <|body_start_0|>
kwds['channels'] = channels
super().__init__(**kwds)
for channel in self.channels:
channel[2].setValue(1.05)
channel[2].setMaximum(9.9)
<|end_body_0|>
<|body_start_1|>
active = []
increment = []
for i, channel in enumerate(self.ch... | Channels class for exponential progression. | ExponentialChannels | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class ExponentialChannels:
"""Channels class for exponential progression."""
def __init__(self, channels=None, **kwds):
"""This is basically the same as for MathChannels. It also specifies the current and maximum value of the increment spin box."""
<|body_0|>
def handleNewFram... | stack_v2_sparse_classes_36k_train_004489 | 25,535 | permissive | [
{
"docstring": "This is basically the same as for MathChannels. It also specifies the current and maximum value of the increment spin box.",
"name": "__init__",
"signature": "def __init__(self, channels=None, **kwds)"
},
{
"docstring": "Called when we get a new frame from the camera. Returns the... | 2 | null | Implement the Python class `ExponentialChannels` described below.
Class description:
Channels class for exponential progression.
Method signatures and docstrings:
- def __init__(self, channels=None, **kwds): This is basically the same as for MathChannels. It also specifies the current and maximum value of the increme... | Implement the Python class `ExponentialChannels` described below.
Class description:
Channels class for exponential progression.
Method signatures and docstrings:
- def __init__(self, channels=None, **kwds): This is basically the same as for MathChannels. It also specifies the current and maximum value of the increme... | f185df3d23b231a26c46f33b0b91fffa86356dc4 | <|skeleton|>
class ExponentialChannels:
"""Channels class for exponential progression."""
def __init__(self, channels=None, **kwds):
"""This is basically the same as for MathChannels. It also specifies the current and maximum value of the increment spin box."""
<|body_0|>
def handleNewFram... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class ExponentialChannels:
"""Channels class for exponential progression."""
def __init__(self, channels=None, **kwds):
"""This is basically the same as for MathChannels. It also specifies the current and maximum value of the increment spin box."""
kwds['channels'] = channels
super().__... | the_stack_v2_python_sparse | storm_control/hal4000/progressions/progressions.py | ZhuangLab/storm-control | train | 54 |
572dd89ba75e104427de46d6ac75569e530ce8dc | [
"super(TableAttribute, self).__init__()\nself.name = name\nself.table = table",
"if self.table is None:\n return str(self.name)\nelse:\n return str(self.table.name) + '.' + str(self.name)"
] | <|body_start_0|>
super(TableAttribute, self).__init__()
self.name = name
self.table = table
<|end_body_0|>
<|body_start_1|>
if self.table is None:
return str(self.name)
else:
return str(self.table.name) + '.' + str(self.name)
<|end_body_1|>
| Represents a table attribute for the purpose of querying. | TableAttribute | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class TableAttribute:
"""Represents a table attribute for the purpose of querying."""
def __init__(self, name, table=None):
"""Construct a TableAttribute object with the given name. Optionally may be associated with a specific TableItem."""
<|body_0|>
def __str__(self):
... | stack_v2_sparse_classes_36k_train_004490 | 2,538 | no_license | [
{
"docstring": "Construct a TableAttribute object with the given name. Optionally may be associated with a specific TableItem.",
"name": "__init__",
"signature": "def __init__(self, name, table=None)"
},
{
"docstring": "Returns the name associated with this TableAttribute.",
"name": "__str__... | 2 | stack_v2_sparse_classes_30k_train_014669 | Implement the Python class `TableAttribute` described below.
Class description:
Represents a table attribute for the purpose of querying.
Method signatures and docstrings:
- def __init__(self, name, table=None): Construct a TableAttribute object with the given name. Optionally may be associated with a specific TableI... | Implement the Python class `TableAttribute` described below.
Class description:
Represents a table attribute for the purpose of querying.
Method signatures and docstrings:
- def __init__(self, name, table=None): Construct a TableAttribute object with the given name. Optionally may be associated with a specific TableI... | afa9c9547716909d806a0bd8165bfe896617ca7e | <|skeleton|>
class TableAttribute:
"""Represents a table attribute for the purpose of querying."""
def __init__(self, name, table=None):
"""Construct a TableAttribute object with the given name. Optionally may be associated with a specific TableItem."""
<|body_0|>
def __str__(self):
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class TableAttribute:
"""Represents a table attribute for the purpose of querying."""
def __init__(self, name, table=None):
"""Construct a TableAttribute object with the given name. Optionally may be associated with a specific TableItem."""
super(TableAttribute, self).__init__()
self.na... | the_stack_v2_python_sparse | boxfish/Query.py | LLNL/boxfish | train | 4 |
d0080a7269e8d96a6ea0d65fc893088ddc8bfc76 | [
"def single_max_number(a, k):\n drop = len(a) - k\n stack = []\n for x in a:\n while stack and drop > 0 and (x > stack[-1]):\n drop -= 1\n stack.pop()\n stack.append(x)\n return stack[:k]\n\ndef merge(a, b):\n a, b = (collections.deque(a), collections.deque(b))\n ... | <|body_start_0|>
def single_max_number(a, k):
drop = len(a) - k
stack = []
for x in a:
while stack and drop > 0 and (x > stack[-1]):
drop -= 1
stack.pop()
stack.append(x)
return stack[:k]
... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def maxNumber(self, nums1, nums2, k):
""":type nums1: List[int] :type nums2: List[int] :type k: int :rtype: List[int]"""
<|body_0|>
def maxNumber_DP(self, nums1, nums2, k):
""":type nums1: List[int] :type nums2: List[int] :type k: int :rtype: List[int]"""
... | stack_v2_sparse_classes_36k_train_004491 | 2,784 | no_license | [
{
"docstring": ":type nums1: List[int] :type nums2: List[int] :type k: int :rtype: List[int]",
"name": "maxNumber",
"signature": "def maxNumber(self, nums1, nums2, k)"
},
{
"docstring": ":type nums1: List[int] :type nums2: List[int] :type k: int :rtype: List[int]",
"name": "maxNumber_DP",
... | 2 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxNumber(self, nums1, nums2, k): :type nums1: List[int] :type nums2: List[int] :type k: int :rtype: List[int]
- def maxNumber_DP(self, nums1, nums2, k): :type nums1: List[in... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def maxNumber(self, nums1, nums2, k): :type nums1: List[int] :type nums2: List[int] :type k: int :rtype: List[int]
- def maxNumber_DP(self, nums1, nums2, k): :type nums1: List[in... | 0a7aa09a2b95e4caca5b5123fb735ceb5c01e992 | <|skeleton|>
class Solution:
def maxNumber(self, nums1, nums2, k):
""":type nums1: List[int] :type nums2: List[int] :type k: int :rtype: List[int]"""
<|body_0|>
def maxNumber_DP(self, nums1, nums2, k):
""":type nums1: List[int] :type nums2: List[int] :type k: int :rtype: List[int]"""
... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def maxNumber(self, nums1, nums2, k):
""":type nums1: List[int] :type nums2: List[int] :type k: int :rtype: List[int]"""
def single_max_number(a, k):
drop = len(a) - k
stack = []
for x in a:
while stack and drop > 0 and (x > stack[-... | the_stack_v2_python_sparse | create-maximum-number.py | onestarshang/leetcode | train | 0 | |
e2f42685071f3258cfde9990e60b59bce8db6cc3 | [
"import os\nimport os.path\nfrom astropy.io import fits as pyfits\nif os.path.isfile(filename):\n os.unlink(filename)\nmex_hdu = pyfits.HDUList()\nmex_hdu.append(pyfits.PrimaryHDU())\nmex_hdu.append(self._make_dummy_ext('SCI'))\nmex_hdu.append(self._make_dummy_ext('ERR'))\nmex_hdu.append(self._make_dummy_ext('DQ... | <|body_start_0|>
import os
import os.path
from astropy.io import fits as pyfits
if os.path.isfile(filename):
os.unlink(filename)
mex_hdu = pyfits.HDUList()
mex_hdu.append(pyfits.PrimaryHDU())
mex_hdu.append(self._make_dummy_ext('SCI'))
mex_hdu.... | Class for the dummy image | DummyImage | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class DummyImage:
"""Class for the dummy image"""
def __init__(self, filename):
"""Initializes the class"""
<|body_0|>
def _make_dummy_ext(self, extname):
"""Creates an empty image extension"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
import os
... | stack_v2_sparse_classes_36k_train_004492 | 18,187 | permissive | [
{
"docstring": "Initializes the class",
"name": "__init__",
"signature": "def __init__(self, filename)"
},
{
"docstring": "Creates an empty image extension",
"name": "_make_dummy_ext",
"signature": "def _make_dummy_ext(self, extname)"
}
] | 2 | null | Implement the Python class `DummyImage` described below.
Class description:
Class for the dummy image
Method signatures and docstrings:
- def __init__(self, filename): Initializes the class
- def _make_dummy_ext(self, extname): Creates an empty image extension | Implement the Python class `DummyImage` described below.
Class description:
Class for the dummy image
Method signatures and docstrings:
- def __init__(self, filename): Initializes the class
- def _make_dummy_ext(self, extname): Creates an empty image extension
<|skeleton|>
class DummyImage:
"""Class for the dumm... | 043c173fd5497c18c2b1bfe8bcff65180bca3996 | <|skeleton|>
class DummyImage:
"""Class for the dummy image"""
def __init__(self, filename):
"""Initializes the class"""
<|body_0|>
def _make_dummy_ext(self, extname):
"""Creates an empty image extension"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class DummyImage:
"""Class for the dummy image"""
def __init__(self, filename):
"""Initializes the class"""
import os
import os.path
from astropy.io import fits as pyfits
if os.path.isfile(filename):
os.unlink(filename)
mex_hdu = pyfits.HDUList()
... | the_stack_v2_python_sparse | stsdas/pkg/analysis/slitless/axe/axesrc/mefobjects.py | spacetelescope/stsdas_stripped | train | 1 |
284b845b668cfc0d72c8a860873b77fe70f512b4 | [
"self.output_dir = output_dir\nself.postfix = postfix\nself.ext = extension\nself.parent = parent\nself.makedirs = makedirs\nself.data_root_dir = data_root_dir",
"full_name = create_file_basename(postfix=self.postfix, input_file_name=subject, folder_path=self.output_dir, data_root_dir=self.data_root_dir, separate... | <|body_start_0|>
self.output_dir = output_dir
self.postfix = postfix
self.ext = extension
self.parent = parent
self.makedirs = makedirs
self.data_root_dir = data_root_dir
<|end_body_0|>
<|body_start_1|>
full_name = create_file_basename(postfix=self.postfix, input... | A utility class to create organized filenames within ``output_dir``. The ``filename`` method could be used to create a filename following the folder structure. Example: .. code-block:: python from monai.data import FolderLayout layout = FolderLayout( output_dir="/test_run_1/", postfix="seg", extension="nii", makedirs=F... | FolderLayout | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class FolderLayout:
"""A utility class to create organized filenames within ``output_dir``. The ``filename`` method could be used to create a filename following the folder structure. Example: .. code-block:: python from monai.data import FolderLayout layout = FolderLayout( output_dir="/test_run_1/", po... | stack_v2_sparse_classes_36k_train_004493 | 6,344 | permissive | [
{
"docstring": "Args: output_dir: output directory. postfix: a postfix string for output file name appended to ``subject``. extension: output file extension to be appended to the end of an output filename. parent: whether to add a level of parent folder to contain each image to the output filename. makedirs: wh... | 2 | stack_v2_sparse_classes_30k_train_016436 | Implement the Python class `FolderLayout` described below.
Class description:
A utility class to create organized filenames within ``output_dir``. The ``filename`` method could be used to create a filename following the folder structure. Example: .. code-block:: python from monai.data import FolderLayout layout = Fold... | Implement the Python class `FolderLayout` described below.
Class description:
A utility class to create organized filenames within ``output_dir``. The ``filename`` method could be used to create a filename following the folder structure. Example: .. code-block:: python from monai.data import FolderLayout layout = Fold... | e48c3e2c741fa3fc705c4425d17ac4a5afac6c47 | <|skeleton|>
class FolderLayout:
"""A utility class to create organized filenames within ``output_dir``. The ``filename`` method could be used to create a filename following the folder structure. Example: .. code-block:: python from monai.data import FolderLayout layout = FolderLayout( output_dir="/test_run_1/", po... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class FolderLayout:
"""A utility class to create organized filenames within ``output_dir``. The ``filename`` method could be used to create a filename following the folder structure. Example: .. code-block:: python from monai.data import FolderLayout layout = FolderLayout( output_dir="/test_run_1/", postfix="seg", ... | the_stack_v2_python_sparse | monai/data/folder_layout.py | Project-MONAI/MONAI | train | 4,805 |
fe6ffdfdcd95bc4f3eb8154aa51fac8cbf0eb985 | [
"data = request.data\nif InterfaceMange.objects.filter(interfaceName=data['interfaceName']):\n return Response({'code': 1001, 'data': '接口已存在'})\ntry:\n serializer = InterfaceMangeListSer(data=data)\n if serializer.is_valid():\n serializer.save()\n return Response({'code': 1000, 'data': '新建接口成... | <|body_start_0|>
data = request.data
if InterfaceMange.objects.filter(interfaceName=data['interfaceName']):
return Response({'code': 1001, 'data': '接口已存在'})
try:
serializer = InterfaceMangeListSer(data=data)
if serializer.is_valid():
serializer... | InterfaceManageList | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class InterfaceManageList:
def post(self, request, *args, **kwargs):
"""新建接口"""
<|body_0|>
def put(self, request, *args, **kwargs):
"""编辑接口"""
<|body_1|>
def get(self, request, *args, **kwargs):
"""获取接口详情"""
<|body_2|>
def delete(self, req... | stack_v2_sparse_classes_36k_train_004494 | 9,587 | no_license | [
{
"docstring": "新建接口",
"name": "post",
"signature": "def post(self, request, *args, **kwargs)"
},
{
"docstring": "编辑接口",
"name": "put",
"signature": "def put(self, request, *args, **kwargs)"
},
{
"docstring": "获取接口详情",
"name": "get",
"signature": "def get(self, request, *... | 4 | stack_v2_sparse_classes_30k_train_019446 | Implement the Python class `InterfaceManageList` described below.
Class description:
Implement the InterfaceManageList class.
Method signatures and docstrings:
- def post(self, request, *args, **kwargs): 新建接口
- def put(self, request, *args, **kwargs): 编辑接口
- def get(self, request, *args, **kwargs): 获取接口详情
- def delet... | Implement the Python class `InterfaceManageList` described below.
Class description:
Implement the InterfaceManageList class.
Method signatures and docstrings:
- def post(self, request, *args, **kwargs): 新建接口
- def put(self, request, *args, **kwargs): 编辑接口
- def get(self, request, *args, **kwargs): 获取接口详情
- def delet... | f2523d6e51cde1b53ac6f453f8066b4b90c523b9 | <|skeleton|>
class InterfaceManageList:
def post(self, request, *args, **kwargs):
"""新建接口"""
<|body_0|>
def put(self, request, *args, **kwargs):
"""编辑接口"""
<|body_1|>
def get(self, request, *args, **kwargs):
"""获取接口详情"""
<|body_2|>
def delete(self, req... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class InterfaceManageList:
def post(self, request, *args, **kwargs):
"""新建接口"""
data = request.data
if InterfaceMange.objects.filter(interfaceName=data['interfaceName']):
return Response({'code': 1001, 'data': '接口已存在'})
try:
serializer = InterfaceMangeListSer(... | the_stack_v2_python_sparse | api/interface/rest/interfaceManage.py | zhuzhanhao1/backend | train | 0 | |
b956d548b5f02f154550547d2fbe3263a31f1790 | [
"user = request.user\norder_data = OrderSerializer(data=request.data)\nif order_data.is_valid():\n order = order_data.save(user=user)\n serialized_order = OrderSerializer(order)\n response_data = {'status': 'success', 'data': {'order': serialized_order.data}}\n return Response(response_data, status=stat... | <|body_start_0|>
user = request.user
order_data = OrderSerializer(data=request.data)
if order_data.is_valid():
order = order_data.save(user=user)
serialized_order = OrderSerializer(order)
response_data = {'status': 'success', 'data': {'order': serialized_order... | OrdersView | [
"MIT"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OrdersView:
def post(self, request, format=None):
"""Create a new Order."""
<|body_0|>
def get(self, request, format=None):
"""List the Orders of a Purchase Channel."""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
user = request.user
order_d... | stack_v2_sparse_classes_36k_train_004495 | 2,014 | permissive | [
{
"docstring": "Create a new Order.",
"name": "post",
"signature": "def post(self, request, format=None)"
},
{
"docstring": "List the Orders of a Purchase Channel.",
"name": "get",
"signature": "def get(self, request, format=None)"
}
] | 2 | stack_v2_sparse_classes_30k_train_001384 | Implement the Python class `OrdersView` described below.
Class description:
Implement the OrdersView class.
Method signatures and docstrings:
- def post(self, request, format=None): Create a new Order.
- def get(self, request, format=None): List the Orders of a Purchase Channel. | Implement the Python class `OrdersView` described below.
Class description:
Implement the OrdersView class.
Method signatures and docstrings:
- def post(self, request, format=None): Create a new Order.
- def get(self, request, format=None): List the Orders of a Purchase Channel.
<|skeleton|>
class OrdersView:
d... | c407eb29b694159eaf94668fad081862c74f3c18 | <|skeleton|>
class OrdersView:
def post(self, request, format=None):
"""Create a new Order."""
<|body_0|>
def get(self, request, format=None):
"""List the Orders of a Purchase Channel."""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class OrdersView:
def post(self, request, format=None):
"""Create a new Order."""
user = request.user
order_data = OrderSerializer(data=request.data)
if order_data.is_valid():
order = order_data.save(user=user)
serialized_order = OrderSerializer(order)
... | the_stack_v2_python_sparse | api/views/orders/orders_views.py | mdcg/awesome-backend-challenge-python-api | train | 0 | |
a4d98f5d57b730590af14185b984e342a0cef813 | [
"x = self.lrelu(self.conv1(x_in))\nx = self.lrelu(self.conv2(x))\nx = self.lrelu(self.conv3(x))\nx = self.conv4(x)\nreturn x",
"super(MidNet4, self).__init__()\nself.lrelu = nn.LeakyReLU()\nself.conv1 = nn.Conv2d(in_channels, 64, 3, 1, 4, 4)\nself.conv2 = nn.Conv2d(64, 64, 3, 1, 4, 4)\nself.conv3 = nn.Conv2d(64, ... | <|body_start_0|>
x = self.lrelu(self.conv1(x_in))
x = self.lrelu(self.conv2(x))
x = self.lrelu(self.conv3(x))
x = self.conv4(x)
return x
<|end_body_0|>
<|body_start_1|>
super(MidNet4, self).__init__()
self.lrelu = nn.LeakyReLU()
self.conv1 = nn.Conv2d(in_... | MidNet4 | [
"BSD-3-Clause"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class MidNet4:
def forward(self, x_in):
"""Network with dilation rate 4 :param x_in: input convolutional features :returns: processed convolutional features :rtype: Tensor"""
<|body_0|>
def __init__(self, in_channels=16):
"""FIXME! briefly describe function :param in_chann... | stack_v2_sparse_classes_36k_train_004496 | 8,922 | permissive | [
{
"docstring": "Network with dilation rate 4 :param x_in: input convolutional features :returns: processed convolutional features :rtype: Tensor",
"name": "forward",
"signature": "def forward(self, x_in)"
},
{
"docstring": "FIXME! briefly describe function :param in_channels: Input channels :ret... | 2 | null | Implement the Python class `MidNet4` described below.
Class description:
Implement the MidNet4 class.
Method signatures and docstrings:
- def forward(self, x_in): Network with dilation rate 4 :param x_in: input convolutional features :returns: processed convolutional features :rtype: Tensor
- def __init__(self, in_ch... | Implement the Python class `MidNet4` described below.
Class description:
Implement the MidNet4 class.
Method signatures and docstrings:
- def forward(self, x_in): Network with dilation rate 4 :param x_in: input convolutional features :returns: processed convolutional features :rtype: Tensor
- def __init__(self, in_ch... | 82c49c36b76987a46dec8479793f7cf0150839c6 | <|skeleton|>
class MidNet4:
def forward(self, x_in):
"""Network with dilation rate 4 :param x_in: input convolutional features :returns: processed convolutional features :rtype: Tensor"""
<|body_0|>
def __init__(self, in_channels=16):
"""FIXME! briefly describe function :param in_chann... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class MidNet4:
def forward(self, x_in):
"""Network with dilation rate 4 :param x_in: input convolutional features :returns: processed convolutional features :rtype: Tensor"""
x = self.lrelu(self.conv1(x_in))
x = self.lrelu(self.conv2(x))
x = self.lrelu(self.conv3(x))
x = self... | the_stack_v2_python_sparse | CURL/rgb_ted.py | huawei-noah/noah-research | train | 816 | |
8a3c8a046cbc91b4aee99771a107e0101f23ef7c | [
"if (serial_no := data_service.serial_no) is not None:\n self._attr_unique_id = f'{serial_no}_{description.key}'\nself._attr_device_info = data_service.device_info\nself.entity_description = description\nself._data_service = data_service",
"try:\n self._data_service.update()\nexcept OSError as ex:\n if s... | <|body_start_0|>
if (serial_no := data_service.serial_no) is not None:
self._attr_unique_id = f'{serial_no}_{description.key}'
self._attr_device_info = data_service.device_info
self.entity_description = description
self._data_service = data_service
<|end_body_0|>
<|body_star... | Representation of a UPS online status. | OnlineStatus | [
"Apache-2.0"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class OnlineStatus:
"""Representation of a UPS online status."""
def __init__(self, data_service: APCUPSdData, description: BinarySensorEntityDescription) -> None:
"""Initialize the APCUPSd binary device."""
<|body_0|>
def update(self) -> None:
"""Get the status report... | stack_v2_sparse_classes_36k_train_004497 | 2,445 | permissive | [
{
"docstring": "Initialize the APCUPSd binary device.",
"name": "__init__",
"signature": "def __init__(self, data_service: APCUPSdData, description: BinarySensorEntityDescription) -> None"
},
{
"docstring": "Get the status report from APCUPSd and set this entity's state.",
"name": "update",
... | 2 | null | Implement the Python class `OnlineStatus` described below.
Class description:
Representation of a UPS online status.
Method signatures and docstrings:
- def __init__(self, data_service: APCUPSdData, description: BinarySensorEntityDescription) -> None: Initialize the APCUPSd binary device.
- def update(self) -> None: ... | Implement the Python class `OnlineStatus` described below.
Class description:
Representation of a UPS online status.
Method signatures and docstrings:
- def __init__(self, data_service: APCUPSdData, description: BinarySensorEntityDescription) -> None: Initialize the APCUPSd binary device.
- def update(self) -> None: ... | 80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743 | <|skeleton|>
class OnlineStatus:
"""Representation of a UPS online status."""
def __init__(self, data_service: APCUPSdData, description: BinarySensorEntityDescription) -> None:
"""Initialize the APCUPSd binary device."""
<|body_0|>
def update(self) -> None:
"""Get the status report... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class OnlineStatus:
"""Representation of a UPS online status."""
def __init__(self, data_service: APCUPSdData, description: BinarySensorEntityDescription) -> None:
"""Initialize the APCUPSd binary device."""
if (serial_no := data_service.serial_no) is not None:
self._attr_unique_id ... | the_stack_v2_python_sparse | homeassistant/components/apcupsd/binary_sensor.py | home-assistant/core | train | 35,501 |
02f5036cf026cd3c12e1e5fe6aa402e6de6f812a | [
"j = n\nif n < 0:\n j = -n\nres = float(1)\nfor i in range(j):\n res = res * x\nif n < 0:\n res = 1 / res\nreturn res",
"if n < 0:\n x = 1 / x\n n = -n\nreturn self.divide(x, n)",
"if n == 1:\n return x\nif n == 0:\n return 1\nsub_res = self.divide(x, n // 2)\nif n % 2 == 1:\n return sub... | <|body_start_0|>
j = n
if n < 0:
j = -n
res = float(1)
for i in range(j):
res = res * x
if n < 0:
res = 1 / res
return res
<|end_body_0|>
<|body_start_1|>
if n < 0:
x = 1 / x
n = -n
return self.d... | Solution | [] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class Solution:
def myPow(self, x, n):
"""暴力法时间复杂度O(n) :type x: float :type n: int :rtype: float"""
<|body_0|>
def myPow2(self, x, n):
""":type x: float :type n: int :rtype: float"""
<|body_1|>
def divide(self, x, n):
"""分治 :param x: :param n: :return:... | stack_v2_sparse_classes_36k_train_004498 | 1,361 | no_license | [
{
"docstring": "暴力法时间复杂度O(n) :type x: float :type n: int :rtype: float",
"name": "myPow",
"signature": "def myPow(self, x, n)"
},
{
"docstring": ":type x: float :type n: int :rtype: float",
"name": "myPow2",
"signature": "def myPow2(self, x, n)"
},
{
"docstring": "分治 :param x: :p... | 3 | null | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def myPow(self, x, n): 暴力法时间复杂度O(n) :type x: float :type n: int :rtype: float
- def myPow2(self, x, n): :type x: float :type n: int :rtype: float
- def divide(self, x, n): 分治 :pa... | Implement the Python class `Solution` described below.
Class description:
Implement the Solution class.
Method signatures and docstrings:
- def myPow(self, x, n): 暴力法时间复杂度O(n) :type x: float :type n: int :rtype: float
- def myPow2(self, x, n): :type x: float :type n: int :rtype: float
- def divide(self, x, n): 分治 :pa... | 3b13b36f37eb364410b3b5b4f10a1808d8b1111e | <|skeleton|>
class Solution:
def myPow(self, x, n):
"""暴力法时间复杂度O(n) :type x: float :type n: int :rtype: float"""
<|body_0|>
def myPow2(self, x, n):
""":type x: float :type n: int :rtype: float"""
<|body_1|>
def divide(self, x, n):
"""分治 :param x: :param n: :return:... | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class Solution:
def myPow(self, x, n):
"""暴力法时间复杂度O(n) :type x: float :type n: int :rtype: float"""
j = n
if n < 0:
j = -n
res = float(1)
for i in range(j):
res = res * x
if n < 0:
res = 1 / res
return res
def myPow2(se... | the_stack_v2_python_sparse | leetcode/50.py | yanggelinux/algorithm-data-structure | train | 0 | |
3a1b848ac7a3ab635f3c3e3acce8765bc249a51b | [
"make_test_data()\nurl = reverse('announcement')\npost_data = {'id_subject': ''}\nself.client.login(username='secretary', password='secretary+password')\nr = self.client.post(url, post_data)\nself.assertEqual(r.status_code, 200)\nq = PyQuery(r.content)\nself.assertTrue(len(q('form ul.errorlist')) > 0)",
"make_tes... | <|body_start_0|>
make_test_data()
url = reverse('announcement')
post_data = {'id_subject': ''}
self.client.login(username='secretary', password='secretary+password')
r = self.client.post(url, post_data)
self.assertEqual(r.status_code, 200)
q = PyQuery(r.content)
... | SubmitCase | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | stack_v2_sparse_python_classes_v1 | <|skeleton|>
class SubmitCase:
def test_invalid_submit(self):
"""Invalid Submit"""
<|body_0|>
def test_valid_submit(self):
"""Valid Submit"""
<|body_1|>
<|end_skeleton|>
<|body_start_0|>
make_test_data()
url = reverse('announcement')
post_data = {'id_s... | stack_v2_sparse_classes_36k_train_004499 | 2,419 | permissive | [
{
"docstring": "Invalid Submit",
"name": "test_invalid_submit",
"signature": "def test_invalid_submit(self)"
},
{
"docstring": "Valid Submit",
"name": "test_valid_submit",
"signature": "def test_valid_submit(self)"
}
] | 2 | null | Implement the Python class `SubmitCase` described below.
Class description:
Implement the SubmitCase class.
Method signatures and docstrings:
- def test_invalid_submit(self): Invalid Submit
- def test_valid_submit(self): Valid Submit | Implement the Python class `SubmitCase` described below.
Class description:
Implement the SubmitCase class.
Method signatures and docstrings:
- def test_invalid_submit(self): Invalid Submit
- def test_valid_submit(self): Valid Submit
<|skeleton|>
class SubmitCase:
def test_invalid_submit(self):
"""Inval... | 5af455fbe6b0c7e60b8af360718345ba044597a4 | <|skeleton|>
class SubmitCase:
def test_invalid_submit(self):
"""Invalid Submit"""
<|body_0|>
def test_valid_submit(self):
"""Valid Submit"""
<|body_1|>
<|end_skeleton|> | stack_v2_sparse_classes_36k | data/stack_v2_sparse_classes_30k | class SubmitCase:
def test_invalid_submit(self):
"""Invalid Submit"""
make_test_data()
url = reverse('announcement')
post_data = {'id_subject': ''}
self.client.login(username='secretary', password='secretary+password')
r = self.client.post(url, post_data)
self... | the_stack_v2_python_sparse | ietf/secr/announcement/tests.py | wpjesus/codematch | train | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.