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
99405d29c65e4bc9b51461d58353efbec1e3489a
[ "super().__init__('watchd-cfg:watchdog')\nif is_not_none(threshold_memory):\n self.append(threshold_memory)\nif is_not_none(disk_limit):\n self.append(disk_limit)", "overload_notification_ = SubElement(self, 'watchd-cfg:overload-notification')\nif is_not_none(operation):\n overload_notification_.set('xc:...
<|body_start_0|> super().__init__('watchd-cfg:watchdog') if is_not_none(threshold_memory): self.append(threshold_memory) if is_not_none(disk_limit): self.append(disk_limit) <|end_body_0|> <|body_start_1|> overload_notification_ = SubElement(self, 'watchd-cfg:over...
WatchdogCfg
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WatchdogCfg: def __init__(self, threshold_memory: ThresholdMemory=None, disk_limit: DiskLimit=None): """module: Cisco-IOS-XR-watchd-cfg. Watchdog configuration commands.""" <|body_0|> def overload_notification(self, operation: OperationEnum.Operation=None): """Disabl...
stack_v2_sparse_classes_36k_train_000900
10,023
no_license
[ { "docstring": "module: Cisco-IOS-XR-watchd-cfg. Watchdog configuration commands.", "name": "__init__", "signature": "def __init__(self, threshold_memory: ThresholdMemory=None, disk_limit: DiskLimit=None)" }, { "docstring": "Disable critical event notification.", "name": "overload_notificati...
5
stack_v2_sparse_classes_30k_train_015478
Implement the Python class `WatchdogCfg` described below. Class description: Implement the WatchdogCfg class. Method signatures and docstrings: - def __init__(self, threshold_memory: ThresholdMemory=None, disk_limit: DiskLimit=None): module: Cisco-IOS-XR-watchd-cfg. Watchdog configuration commands. - def overload_not...
Implement the Python class `WatchdogCfg` described below. Class description: Implement the WatchdogCfg class. Method signatures and docstrings: - def __init__(self, threshold_memory: ThresholdMemory=None, disk_limit: DiskLimit=None): module: Cisco-IOS-XR-watchd-cfg. Watchdog configuration commands. - def overload_not...
9b02bbed95de373df4c31f6c157afe43263bde0a
<|skeleton|> class WatchdogCfg: def __init__(self, threshold_memory: ThresholdMemory=None, disk_limit: DiskLimit=None): """module: Cisco-IOS-XR-watchd-cfg. Watchdog configuration commands.""" <|body_0|> def overload_notification(self, operation: OperationEnum.Operation=None): """Disabl...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WatchdogCfg: def __init__(self, threshold_memory: ThresholdMemory=None, disk_limit: DiskLimit=None): """module: Cisco-IOS-XR-watchd-cfg. Watchdog configuration commands.""" super().__init__('watchd-cfg:watchdog') if is_not_none(threshold_memory): self.append(threshold_memor...
the_stack_v2_python_sparse
citrino/cisco/xr/resources/watchdog_cfg.py
johneandredejesus/Citrino
train
1
bec1bea47957fa8706724c3fc3d6578a2f692a87
[ "self.arch_id = None\nself.netlist_id = None\nself.name = None\nself.instance = None\nself.ports = {'inputs': [], 'outputs': [], 'clocks': []}\nself.blocks = {}", "assert root.tag == 'block', root.tag\nnetlist = PackedNetlist()\nnetlist.name = root.attrib['name']\nnetlist.instance = root.attrib['instance']\nnetli...
<|body_start_0|> self.arch_id = None self.netlist_id = None self.name = None self.instance = None self.ports = {'inputs': [], 'outputs': [], 'clocks': []} self.blocks = {} <|end_body_0|> <|body_start_1|> assert root.tag == 'block', root.tag netlist = Pack...
A VPR Packed netlist representation. The packed netlist is organized as one huge block representing the whole FPGA with all placeable blocks (CLBs) as its children. Here we store the top-level block implicitly so all blocks mentioned in a PackedNetlist instance refer to individual placeable CLBs.
PackedNetlist
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PackedNetlist: """A VPR Packed netlist representation. The packed netlist is organized as one huge block representing the whole FPGA with all placeable blocks (CLBs) as its children. Here we store the top-level block implicitly so all blocks mentioned in a PackedNetlist instance refer to individu...
stack_v2_sparse_classes_36k_train_000901
21,179
permissive
[ { "docstring": "Basic constructor", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Reads the packed netlist from the given element tree", "name": "from_etree", "signature": "def from_etree(root)" }, { "docstring": "Builds an element tree (XML) that repre...
3
stack_v2_sparse_classes_30k_train_021085
Implement the Python class `PackedNetlist` described below. Class description: A VPR Packed netlist representation. The packed netlist is organized as one huge block representing the whole FPGA with all placeable blocks (CLBs) as its children. Here we store the top-level block implicitly so all blocks mentioned in a P...
Implement the Python class `PackedNetlist` described below. Class description: A VPR Packed netlist representation. The packed netlist is organized as one huge block representing the whole FPGA with all placeable blocks (CLBs) as its children. Here we store the top-level block implicitly so all blocks mentioned in a P...
835a40534f9efd70770d74f56f25fef6cfc6ebc6
<|skeleton|> class PackedNetlist: """A VPR Packed netlist representation. The packed netlist is organized as one huge block representing the whole FPGA with all placeable blocks (CLBs) as its children. Here we store the top-level block implicitly so all blocks mentioned in a PackedNetlist instance refer to individu...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PackedNetlist: """A VPR Packed netlist representation. The packed netlist is organized as one huge block representing the whole FPGA with all placeable blocks (CLBs) as its children. Here we store the top-level block implicitly so all blocks mentioned in a PackedNetlist instance refer to individual placeable ...
the_stack_v2_python_sparse
f4pga/utils/quicklogic/repacker/packed_netlist.py
f4pga/f4pga
train
19
6d1166eb71c49e2afa4e4cb9d2374abc2276cc61
[ "super().fit(dataset)\ndataset = dataset.to_numpy()\ndata = dataset.data\nself.means = np.nanmean(data, axis=0)\nself.stds = np.nanstd(data, axis=0)\nself.stds[(self.stds == 0) | np.isnan(self.stds)] = 1\nreturn self", "super().transform(dataset)\ndataset = dataset.to_numpy()\ndata = dataset.data\ndata = (data - ...
<|body_start_0|> super().fit(dataset) dataset = dataset.to_numpy() data = dataset.data self.means = np.nanmean(data, axis=0) self.stds = np.nanstd(data, axis=0) self.stds[(self.stds == 0) | np.isnan(self.stds)] = 1 return self <|end_body_0|> <|body_start_1|> ...
Classic StandardScaler.
StandardScaler
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StandardScaler: """Classic StandardScaler.""" def fit(self, dataset: NumpyTransformable): """Estimate means and stds. Args: dataset: Pandas or Numpy dataset of categorical features. Returns: self.""" <|body_0|> def transform(self, dataset: NumpyTransformable) -> NumpyDat...
stack_v2_sparse_classes_36k_train_000902
9,262
permissive
[ { "docstring": "Estimate means and stds. Args: dataset: Pandas or Numpy dataset of categorical features. Returns: self.", "name": "fit", "signature": "def fit(self, dataset: NumpyTransformable)" }, { "docstring": "Scale test data. Args: dataset: Pandas or Numpy dataset of numeric features. Retur...
2
null
Implement the Python class `StandardScaler` described below. Class description: Classic StandardScaler. Method signatures and docstrings: - def fit(self, dataset: NumpyTransformable): Estimate means and stds. Args: dataset: Pandas or Numpy dataset of categorical features. Returns: self. - def transform(self, dataset:...
Implement the Python class `StandardScaler` described below. Class description: Classic StandardScaler. Method signatures and docstrings: - def fit(self, dataset: NumpyTransformable): Estimate means and stds. Args: dataset: Pandas or Numpy dataset of categorical features. Returns: self. - def transform(self, dataset:...
a4c3bfb4f1239d05c5d5d36a386c507c6f561324
<|skeleton|> class StandardScaler: """Classic StandardScaler.""" def fit(self, dataset: NumpyTransformable): """Estimate means and stds. Args: dataset: Pandas or Numpy dataset of categorical features. Returns: self.""" <|body_0|> def transform(self, dataset: NumpyTransformable) -> NumpyDat...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class StandardScaler: """Classic StandardScaler.""" def fit(self, dataset: NumpyTransformable): """Estimate means and stds. Args: dataset: Pandas or Numpy dataset of categorical features. Returns: self.""" super().fit(dataset) dataset = dataset.to_numpy() data = dataset.data ...
the_stack_v2_python_sparse
lightautoml/transformers/numeric.py
sberbank-ai-lab/LightAutoML
train
851
b086ff106deb5c7a92d5a32ff39423214fabfa86
[ "a0 = -4.1236\na1 = 13.788\na2 = -26.068\na3 = 26.272\na4 = -14.663\na5 = 4.4954\na6 = -0.6905\na7 = 0.0397\nlog_t = math.log10(temperature)\nf_exp = a0 + a1 * log_t + a2 * log_t ** 2.0 + a3 * log_t ** 3.0 + a4 * log_t ** 4.0 + a5 * log_t ** 5.0 + a6 * log_t ** 6.0 + a7 * log_t ** 7\ng10_thermal_conductivity = 10.0...
<|body_start_0|> a0 = -4.1236 a1 = 13.788 a2 = -26.068 a3 = 26.272 a4 = -14.663 a5 = 4.4954 a6 = -0.6905 a7 = 0.0397 log_t = math.log10(temperature) f_exp = a0 + a1 * log_t + a2 * log_t ** 2.0 + a3 * log_t ** 3.0 + a4 * log_t ** 4.0 + a5 * ...
G10NISTMaterialProperties
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class G10NISTMaterialProperties: def thermal_conductivity(temperature): """Calculates thermal conductivity of G10 according to NIST standards :param temperature: temperature as float :return: thermal conductivity as float""" <|body_0|> def volumetric_heat_capacity(temperature): ...
stack_v2_sparse_classes_36k_train_000903
1,623
no_license
[ { "docstring": "Calculates thermal conductivity of G10 according to NIST standards :param temperature: temperature as float :return: thermal conductivity as float", "name": "thermal_conductivity", "signature": "def thermal_conductivity(temperature)" }, { "docstring": "Calculates volumetric heat ...
2
stack_v2_sparse_classes_30k_train_008423
Implement the Python class `G10NISTMaterialProperties` described below. Class description: Implement the G10NISTMaterialProperties class. Method signatures and docstrings: - def thermal_conductivity(temperature): Calculates thermal conductivity of G10 according to NIST standards :param temperature: temperature as flo...
Implement the Python class `G10NISTMaterialProperties` described below. Class description: Implement the G10NISTMaterialProperties class. Method signatures and docstrings: - def thermal_conductivity(temperature): Calculates thermal conductivity of G10 according to NIST standards :param temperature: temperature as flo...
3872a62c01b6d0f7dca97042bbd26b95a2ecc952
<|skeleton|> class G10NISTMaterialProperties: def thermal_conductivity(temperature): """Calculates thermal conductivity of G10 according to NIST standards :param temperature: temperature as float :return: thermal conductivity as float""" <|body_0|> def volumetric_heat_capacity(temperature): ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class G10NISTMaterialProperties: def thermal_conductivity(temperature): """Calculates thermal conductivity of G10 according to NIST standards :param temperature: temperature as float :return: thermal conductivity as float""" a0 = -4.1236 a1 = 13.788 a2 = -26.068 a3 = 26.272 ...
the_stack_v2_python_sparse
source/materials/g10_nist_material_properties.py
MichalWilczek/steam-ansys-modelling
train
1
4a9cf49521b1d5efb99f675eb5a7431c06f342fc
[ "super().__init__()\nself.dropout = nn.Dropout(p=dropout)\nself.layers = numlayers\nself.hsz = hiddensize\nself.esz = embeddingsize\nself.lt = nn.Embedding(num_features, embeddingsize, padding_idx=padding_idx, sparse=sparse)\nself.rnn = rnn_class(embeddingsize, hiddensize, numlayers, dropout=dropout if numlayers > ...
<|body_start_0|> super().__init__() self.dropout = nn.Dropout(p=dropout) self.layers = numlayers self.hsz = hiddensize self.esz = embeddingsize self.lt = nn.Embedding(num_features, embeddingsize, padding_idx=padding_idx, sparse=sparse) self.rnn = rnn_class(embeddi...
Recurrent decoder module. Can be used as a standalone language model or paired with an encoder.
RNNDecoder
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RNNDecoder: """Recurrent decoder module. Can be used as a standalone language model or paired with an encoder.""" def __init__(self, num_features, embeddingsize, hiddensize, padding_idx=0, rnn_class='lstm', numlayers=2, dropout=0.1, bidir_input=False, attn_type='none', attn_time='pre', attn_...
stack_v2_sparse_classes_36k_train_000904
24,820
permissive
[ { "docstring": "Initialize recurrent decoder.", "name": "__init__", "signature": "def __init__(self, num_features, embeddingsize, hiddensize, padding_idx=0, rnn_class='lstm', numlayers=2, dropout=0.1, bidir_input=False, attn_type='none', attn_time='pre', attn_length=-1, sparse=False)" }, { "docs...
2
null
Implement the Python class `RNNDecoder` described below. Class description: Recurrent decoder module. Can be used as a standalone language model or paired with an encoder. Method signatures and docstrings: - def __init__(self, num_features, embeddingsize, hiddensize, padding_idx=0, rnn_class='lstm', numlayers=2, drop...
Implement the Python class `RNNDecoder` described below. Class description: Recurrent decoder module. Can be used as a standalone language model or paired with an encoder. Method signatures and docstrings: - def __init__(self, num_features, embeddingsize, hiddensize, padding_idx=0, rnn_class='lstm', numlayers=2, drop...
e1d899edfb92471552bae153f59ad30aa7fca468
<|skeleton|> class RNNDecoder: """Recurrent decoder module. Can be used as a standalone language model or paired with an encoder.""" def __init__(self, num_features, embeddingsize, hiddensize, padding_idx=0, rnn_class='lstm', numlayers=2, dropout=0.1, bidir_input=False, attn_type='none', attn_time='pre', attn_...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RNNDecoder: """Recurrent decoder module. Can be used as a standalone language model or paired with an encoder.""" def __init__(self, num_features, embeddingsize, hiddensize, padding_idx=0, rnn_class='lstm', numlayers=2, dropout=0.1, bidir_input=False, attn_type='none', attn_time='pre', attn_length=-1, sp...
the_stack_v2_python_sparse
parlai/agents/seq2seq/modules.py
facebookresearch/ParlAI
train
10,943
9ad1f5f42c6118578b47c7c484af87f4c645de9d
[ "super(colorFrame, self).__init__(parent)\nself.kind = number\nself.hexadecimal = QLabel('', self)\nself.color = QColor(red, green, blue)\nself.update_color(self.color)\nvertical_layout = QVBoxLayout()\nvertical_layout.addWidget(self.hexadecimal)\nvertical_layout.setAlignment(QtCore.Qt.AlignCenter)\nself.setFrameSt...
<|body_start_0|> super(colorFrame, self).__init__(parent) self.kind = number self.hexadecimal = QLabel('', self) self.color = QColor(red, green, blue) self.update_color(self.color) vertical_layout = QVBoxLayout() vertical_layout.addWidget(self.hexadecimal) ...
colorFrame
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class colorFrame: def __init__(self, parent, number, red, green, blue): """Create a customizable QFrame that reacts to a click by opening a QColorDialog :param parent: Widget parent of this frame :param number: 1 if it's Color Light, 2 if it's Shadow Color :param red: Red value to set on a new...
stack_v2_sparse_classes_36k_train_000905
21,305
no_license
[ { "docstring": "Create a customizable QFrame that reacts to a click by opening a QColorDialog :param parent: Widget parent of this frame :param number: 1 if it's Color Light, 2 if it's Shadow Color :param red: Red value to set on a new QColor :param green: Green value to set on a new QColor :param blue: Blue va...
2
null
Implement the Python class `colorFrame` described below. Class description: Implement the colorFrame class. Method signatures and docstrings: - def __init__(self, parent, number, red, green, blue): Create a customizable QFrame that reacts to a click by opening a QColorDialog :param parent: Widget parent of this frame...
Implement the Python class `colorFrame` described below. Class description: Implement the colorFrame class. Method signatures and docstrings: - def __init__(self, parent, number, red, green, blue): Create a customizable QFrame that reacts to a click by opening a QColorDialog :param parent: Widget parent of this frame...
45301c31814e87a6e5a28d857e9b2ef6421b5c16
<|skeleton|> class colorFrame: def __init__(self, parent, number, red, green, blue): """Create a customizable QFrame that reacts to a click by opening a QColorDialog :param parent: Widget parent of this frame :param number: 1 if it's Color Light, 2 if it's Shadow Color :param red: Red value to set on a new...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class colorFrame: def __init__(self, parent, number, red, green, blue): """Create a customizable QFrame that reacts to a click by opening a QColorDialog :param parent: Widget parent of this frame :param number: 1 if it's Color Light, 2 if it's Shadow Color :param red: Red value to set on a new QColor :param...
the_stack_v2_python_sparse
recipies/python/LightInterface_recreation.py
igor-si/shared
train
1
cd12156a6e7f73c286c45431e767df6dd0b40b10
[ "self.url = url\nself.proxy = Http(cache=self.cache, timeout=self.timeout)\nself.proxy.disable_ssl_certificate_validation = not validate_ssl\nif isinstance(credential, UsernamePassword):\n self.proxy.add_credentials(credential.username, credential.password)", "if url is None:\n url = self.url\nstatus, respo...
<|body_start_0|> self.url = url self.proxy = Http(cache=self.cache, timeout=self.timeout) self.proxy.disable_ssl_certificate_validation = not validate_ssl if isinstance(credential, UsernamePassword): self.proxy.add_credentials(credential.username, credential.password) <|end_b...
@summary: implements REST driver to fetch using http GET @cvar timeout: timeout of connection @type timeout: float @cvar cache: a cache directory @type cache: str @ivar url: a default document locator to be reused @type url: str @ivar proxy: an interface to the http server @type proxy: httplib2.Http
RESTDriver
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RESTDriver: """@summary: implements REST driver to fetch using http GET @cvar timeout: timeout of connection @type timeout: float @cvar cache: a cache directory @type cache: str @ivar url: a default document locator to be reused @type url: str @ivar proxy: an interface to the http server @type pr...
stack_v2_sparse_classes_36k_train_000906
2,251
no_license
[ { "docstring": "@summary: initializes a proxy to the http service and saves a default document locator @param url: the default document locator @type url: str @param credential: an authentication secret @type credential: L{Credential} or None @param validate_ssl: whether to apply strick certificate validation, ...
2
stack_v2_sparse_classes_30k_train_002101
Implement the Python class `RESTDriver` described below. Class description: @summary: implements REST driver to fetch using http GET @cvar timeout: timeout of connection @type timeout: float @cvar cache: a cache directory @type cache: str @ivar url: a default document locator to be reused @type url: str @ivar proxy: a...
Implement the Python class `RESTDriver` described below. Class description: @summary: implements REST driver to fetch using http GET @cvar timeout: timeout of connection @type timeout: float @cvar cache: a cache directory @type cache: str @ivar url: a default document locator to be reused @type url: str @ivar proxy: a...
0932550a42ba1ca634225ccb3a4748336e69e022
<|skeleton|> class RESTDriver: """@summary: implements REST driver to fetch using http GET @cvar timeout: timeout of connection @type timeout: float @cvar cache: a cache directory @type cache: str @ivar url: a default document locator to be reused @type url: str @ivar proxy: an interface to the http server @type pr...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RESTDriver: """@summary: implements REST driver to fetch using http GET @cvar timeout: timeout of connection @type timeout: float @cvar cache: a cache directory @type cache: str @ivar url: a default document locator to be reused @type url: str @ivar proxy: an interface to the http server @type proxy: httplib2...
the_stack_v2_python_sparse
Monitoring/MonitoringService/Driver/REST.py
vitorsfarias/novi-public
train
0
d99a8113e20a32a9462a09a070a92e09a11dec56
[ "self.tfidf_features = {}\nself.category = None\nself.referers = []\nself.named_entities = defaultdict(int)", "representation = 'Category: ' + self.category + '\\n'\nrepresentation += 'Named Entities:\\n'\nfor ent in self.named_entities:\n if self.named_entities[ent] > 0:\n representation += '\\t' + ent...
<|body_start_0|> self.tfidf_features = {} self.category = None self.referers = [] self.named_entities = defaultdict(int) <|end_body_0|> <|body_start_1|> representation = 'Category: ' + self.category + '\n' representation += 'Named Entities:\n' for ent in self.nam...
Object that contains the feature representation of a given clue.
FeatureRepresentation
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FeatureRepresentation: """Object that contains the feature representation of a given clue.""" def __init__(self): """Constructor""" <|body_0|> def __str__(self): """Returns a string representation of this object""" <|body_1|> <|end_skeleton|> <|body_sta...
stack_v2_sparse_classes_36k_train_000907
10,222
no_license
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Returns a string representation of this object", "name": "__str__", "signature": "def __str__(self)" } ]
2
stack_v2_sparse_classes_30k_train_009737
Implement the Python class `FeatureRepresentation` described below. Class description: Object that contains the feature representation of a given clue. Method signatures and docstrings: - def __init__(self): Constructor - def __str__(self): Returns a string representation of this object
Implement the Python class `FeatureRepresentation` described below. Class description: Object that contains the feature representation of a given clue. Method signatures and docstrings: - def __init__(self): Constructor - def __str__(self): Returns a string representation of this object <|skeleton|> class FeatureRep...
8399c88ab0fdc7736dddcf5239eea655d613c61d
<|skeleton|> class FeatureRepresentation: """Object that contains the feature representation of a given clue.""" def __init__(self): """Constructor""" <|body_0|> def __str__(self): """Returns a string representation of this object""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FeatureRepresentation: """Object that contains the feature representation of a given clue.""" def __init__(self): """Constructor""" self.tfidf_features = {} self.category = None self.referers = [] self.named_entities = defaultdict(int) def __str__(self): ...
the_stack_v2_python_sparse
featurespace.py
timdestan/quiz-bowl-entity-resolution
train
1
b1fe2b73b7bf45f7fd84998c05214da302e328e9
[ "_url_path = '/InsuranceCentre/PortalLandingPage'\n_query_builder = Configuration.get_base_uri()\n_query_builder += _url_path\n_query_parameters = {'id': id}\n_query_builder = APIHelper.append_url_with_query_parameters(_query_builder, _query_parameters, Configuration.array_serialization)\n_query_url = APIHelper.cle...
<|body_start_0|> _url_path = '/InsuranceCentre/PortalLandingPage' _query_builder = Configuration.get_base_uri() _query_builder += _url_path _query_parameters = {'id': id} _query_builder = APIHelper.append_url_with_query_parameters(_query_builder, _query_parameters, Configuration....
A Controller to access Endpoints in the easybimehlanding API.
MainController
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MainController: """A Controller to access Endpoints in the easybimehlanding API.""" def get_portal_landing_page(self, id, x_api_key): """Does a GET request to /InsuranceCentre/PortalLandingPage. در یافت اطلاعات لندینگ مراکز بیمه Args: id (string): دامنه یا زیر دامنه ی مرکز بیمه x_api...
stack_v2_sparse_classes_36k_train_000908
4,330
permissive
[ { "docstring": "Does a GET request to /InsuranceCentre/PortalLandingPage. در یافت اطلاعات لندینگ مراکز بیمه Args: id (string): دامنه یا زیر دامنه ی مرکز بیمه x_api_key (string): کلید اختصاصی ارتباط با سرور Returns: BaseModelPortalLandingPage: Response from the API. Raises: APIException: When an error occurs whi...
2
stack_v2_sparse_classes_30k_train_010995
Implement the Python class `MainController` described below. Class description: A Controller to access Endpoints in the easybimehlanding API. Method signatures and docstrings: - def get_portal_landing_page(self, id, x_api_key): Does a GET request to /InsuranceCentre/PortalLandingPage. در یافت اطلاعات لندینگ مراکز بیم...
Implement the Python class `MainController` described below. Class description: A Controller to access Endpoints in the easybimehlanding API. Method signatures and docstrings: - def get_portal_landing_page(self, id, x_api_key): Does a GET request to /InsuranceCentre/PortalLandingPage. در یافت اطلاعات لندینگ مراکز بیم...
b574a76a8805b306a423229b572c36dae0159def
<|skeleton|> class MainController: """A Controller to access Endpoints in the easybimehlanding API.""" def get_portal_landing_page(self, id, x_api_key): """Does a GET request to /InsuranceCentre/PortalLandingPage. در یافت اطلاعات لندینگ مراکز بیمه Args: id (string): دامنه یا زیر دامنه ی مرکز بیمه x_api...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MainController: """A Controller to access Endpoints in the easybimehlanding API.""" def get_portal_landing_page(self, id, x_api_key): """Does a GET request to /InsuranceCentre/PortalLandingPage. در یافت اطلاعات لندینگ مراکز بیمه Args: id (string): دامنه یا زیر دامنه ی مرکز بیمه x_api_key (string)...
the_stack_v2_python_sparse
easybimehlanding/controllers/main_controller.py
kmelodi/EasyBimehLanding_Python
train
0
e4f7163b275f899bd445f54d239ca163b369b31e
[ "self.ua_number = int(ua_number)\nif self.ua_number <= 0:\n raise ValueError(\"'ua_number' should be a postive int.\")\nif savepath is None:\n savepath = os.path.join(os.getcwd(), 'UAList.txt')\nplatform = sys.platform\nif platform == 'linux' or platform == 'linux2':\n self.ua_url = UA_address['UA_Linux']\...
<|body_start_0|> self.ua_number = int(ua_number) if self.ua_number <= 0: raise ValueError("'ua_number' should be a postive int.") if savepath is None: savepath = os.path.join(os.getcwd(), 'UAList.txt') platform = sys.platform if platform == 'linux' or plat...
BuildUAPool
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BuildUAPool: def __init__(self, ua_number=10, savepath=None): """Get ua from predefined url, and saved into file. Parameters ---------- ua_number: the number of getting ua, default is 10. savepath: file path that saves ua_list into, default is default is None, means saving into 'UAList.t...
stack_v2_sparse_classes_36k_train_000909
4,011
no_license
[ { "docstring": "Get ua from predefined url, and saved into file. Parameters ---------- ua_number: the number of getting ua, default is 10. savepath: file path that saves ua_list into, default is default is None, means saving into 'UAList.txt' under current working dir.", "name": "__init__", "signature":...
5
stack_v2_sparse_classes_30k_train_005012
Implement the Python class `BuildUAPool` described below. Class description: Implement the BuildUAPool class. Method signatures and docstrings: - def __init__(self, ua_number=10, savepath=None): Get ua from predefined url, and saved into file. Parameters ---------- ua_number: the number of getting ua, default is 10. ...
Implement the Python class `BuildUAPool` described below. Class description: Implement the BuildUAPool class. Method signatures and docstrings: - def __init__(self, ua_number=10, savepath=None): Get ua from predefined url, and saved into file. Parameters ---------- ua_number: the number of getting ua, default is 10. ...
127a7a47c8afea812a3fa89dddc693ed22e58c23
<|skeleton|> class BuildUAPool: def __init__(self, ua_number=10, savepath=None): """Get ua from predefined url, and saved into file. Parameters ---------- ua_number: the number of getting ua, default is 10. savepath: file path that saves ua_list into, default is default is None, means saving into 'UAList.t...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BuildUAPool: def __init__(self, ua_number=10, savepath=None): """Get ua from predefined url, and saved into file. Parameters ---------- ua_number: the number of getting ua, default is 10. savepath: file path that saves ua_list into, default is default is None, means saving into 'UAList.txt' under curr...
the_stack_v2_python_sparse
NetworkTools/requestUA.py
Stuming/Harbor
train
0
7960f4a31f2291c23eafedbfcdf76f44e58dbe79
[ "try:\n return [x.to_dict() for x in SctParser.from_bytes(data=self.EXT.children[2].contents)]\nexcept Exception:\n self.LOG.debug(f'Failed to parse SCT data from {self.EXT}', exc_info=True)\n return []", "def handle(item):\n \"\"\"Pass.\"\"\"\n operator = item.pop('log_operator')\n ret = {f'ope...
<|body_start_0|> try: return [x.to_dict() for x in SctParser.from_bytes(data=self.EXT.children[2].contents)] except Exception: self.LOG.debug(f'Failed to parse SCT data from {self.EXT}', exc_info=True) return [] <|end_body_0|> <|body_start_1|> def handle(item...
Pass.
SignedCertificateTimestampList
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SignedCertificateTimestampList: """Pass.""" def value(self) -> List[dict]: """Pass.""" <|body_0|> def value_for_str(self) -> Any: """Pass.""" <|body_1|> <|end_skeleton|> <|body_start_0|> try: return [x.to_dict() for x in SctParser.fr...
stack_v2_sparse_classes_36k_train_000910
13,328
permissive
[ { "docstring": "Pass.", "name": "value", "signature": "def value(self) -> List[dict]" }, { "docstring": "Pass.", "name": "value_for_str", "signature": "def value_for_str(self) -> Any" } ]
2
null
Implement the Python class `SignedCertificateTimestampList` described below. Class description: Pass. Method signatures and docstrings: - def value(self) -> List[dict]: Pass. - def value_for_str(self) -> Any: Pass.
Implement the Python class `SignedCertificateTimestampList` described below. Class description: Pass. Method signatures and docstrings: - def value(self) -> List[dict]: Pass. - def value_for_str(self) -> Any: Pass. <|skeleton|> class SignedCertificateTimestampList: """Pass.""" def value(self) -> List[dict]:...
be49566e590834df1b46494c8588651fa029b8c5
<|skeleton|> class SignedCertificateTimestampList: """Pass.""" def value(self) -> List[dict]: """Pass.""" <|body_0|> def value_for_str(self) -> Any: """Pass.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SignedCertificateTimestampList: """Pass.""" def value(self) -> List[dict]: """Pass.""" try: return [x.to_dict() for x in SctParser.from_bytes(data=self.EXT.children[2].contents)] except Exception: self.LOG.debug(f'Failed to parse SCT data from {self.EXT}', ...
the_stack_v2_python_sparse
axonius_api_client/projects/cert_human/ssl_extensions.py
Axonius/axonius_api_client
train
17
fbbfb6de8fbd4df96b45ee534353a30aff34d5da
[ "super().__init__(api, coordinator, description)\nself._previous_uptime: str | None = None\nself._last_boot: str | None = None", "attr = getattr(self._api.information, self.entity_description.key)\nif attr is None:\n return None\nif self.entity_description.key == 'uptime':\n if self._previous_uptime is None...
<|body_start_0|> super().__init__(api, coordinator, description) self._previous_uptime: str | None = None self._last_boot: str | None = None <|end_body_0|> <|body_start_1|> attr = getattr(self._api.information, self.entity_description.key) if attr is None: return Non...
Representation a Synology information sensor.
SynoDSMInfoSensor
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SynoDSMInfoSensor: """Representation a Synology information sensor.""" def __init__(self, api: SynoApi, coordinator: DataUpdateCoordinator[dict[str, dict[str, Any]]], description: SynologyDSMSensorEntityDescription) -> None: """Initialize the Synology SynoDSMInfoSensor entity.""" ...
stack_v2_sparse_classes_36k_train_000911
5,756
permissive
[ { "docstring": "Initialize the Synology SynoDSMInfoSensor entity.", "name": "__init__", "signature": "def __init__(self, api: SynoApi, coordinator: DataUpdateCoordinator[dict[str, dict[str, Any]]], description: SynologyDSMSensorEntityDescription) -> None" }, { "docstring": "Return the state.", ...
2
null
Implement the Python class `SynoDSMInfoSensor` described below. Class description: Representation a Synology information sensor. Method signatures and docstrings: - def __init__(self, api: SynoApi, coordinator: DataUpdateCoordinator[dict[str, dict[str, Any]]], description: SynologyDSMSensorEntityDescription) -> None:...
Implement the Python class `SynoDSMInfoSensor` described below. Class description: Representation a Synology information sensor. Method signatures and docstrings: - def __init__(self, api: SynoApi, coordinator: DataUpdateCoordinator[dict[str, dict[str, Any]]], description: SynologyDSMSensorEntityDescription) -> None:...
8de7966104911bca6f855a1755a6d71a07afb9de
<|skeleton|> class SynoDSMInfoSensor: """Representation a Synology information sensor.""" def __init__(self, api: SynoApi, coordinator: DataUpdateCoordinator[dict[str, dict[str, Any]]], description: SynologyDSMSensorEntityDescription) -> None: """Initialize the Synology SynoDSMInfoSensor entity.""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SynoDSMInfoSensor: """Representation a Synology information sensor.""" def __init__(self, api: SynoApi, coordinator: DataUpdateCoordinator[dict[str, dict[str, Any]]], description: SynologyDSMSensorEntityDescription) -> None: """Initialize the Synology SynoDSMInfoSensor entity.""" super()....
the_stack_v2_python_sparse
homeassistant/components/synology_dsm/sensor.py
AlexxIT/home-assistant
train
9
846705e24ccbbbf4a3fa54e5e36c41dbfb4dfd9a
[ "res = super(ResConfigSettings, self).get_values()\nres.update(generate_payslip=self.env['ir.config_parameter'].sudo().get_param('generate_payslip'), generate_day=int(self.env['ir.config_parameter'].sudo().get_param('generate_day') or 1), option=self.env['ir.config_parameter'].sudo().get_param('option') or 'first')...
<|body_start_0|> res = super(ResConfigSettings, self).get_values() res.update(generate_payslip=self.env['ir.config_parameter'].sudo().get_param('generate_payslip'), generate_day=int(self.env['ir.config_parameter'].sudo().get_param('generate_day') or 1), option=self.env['ir.config_parameter'].sudo().get_...
ResConfigSettings
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ResConfigSettings: def get_values(self): """get values from the fields""" <|body_0|> def set_values(self): """Set values in the fields""" <|body_1|> <|end_skeleton|> <|body_start_0|> res = super(ResConfigSettings, self).get_values() res.upda...
stack_v2_sparse_classes_36k_train_000912
1,536
no_license
[ { "docstring": "get values from the fields", "name": "get_values", "signature": "def get_values(self)" }, { "docstring": "Set values in the fields", "name": "set_values", "signature": "def set_values(self)" } ]
2
null
Implement the Python class `ResConfigSettings` described below. Class description: Implement the ResConfigSettings class. Method signatures and docstrings: - def get_values(self): get values from the fields - def set_values(self): Set values in the fields
Implement the Python class `ResConfigSettings` described below. Class description: Implement the ResConfigSettings class. Method signatures and docstrings: - def get_values(self): get values from the fields - def set_values(self): Set values in the fields <|skeleton|> class ResConfigSettings: def get_values(sel...
4b1bcb8f17aad44fe9c80a8180eb0128e6bb2c14
<|skeleton|> class ResConfigSettings: def get_values(self): """get values from the fields""" <|body_0|> def set_values(self): """Set values in the fields""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ResConfigSettings: def get_values(self): """get values from the fields""" res = super(ResConfigSettings, self).get_values() res.update(generate_payslip=self.env['ir.config_parameter'].sudo().get_param('generate_payslip'), generate_day=int(self.env['ir.config_parameter'].sudo().get_para...
the_stack_v2_python_sparse
automatic_payroll/models/res_config_settings.py
CybroOdoo/CybroAddons
train
209
9e2fb424f2d1622e94310ea94e12a4bfbc2cb94e
[ "if root == None:\n return 0\nelse:\n return self.pathSumVer2(root, sum, False)", "num = 0\nif root.val == sum:\n num += 1\nif ifStart == False:\n if root.left:\n num += self.pathSumVer2(root.left, sum, False)\n num += self.pathSumVer2(root.left, sum - root.val, True)\n if root.right:...
<|body_start_0|> if root == None: return 0 else: return self.pathSumVer2(root, sum, False) <|end_body_0|> <|body_start_1|> num = 0 if root.val == sum: num += 1 if ifStart == False: if root.left: num += self.pathSumV...
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 pathSumVer2(self, root, sum, ifStart): """ifStart=True说明之前已经选了某个点了,就必须选到底了""" <|body_1|> <|end_skeleton|> <|body_start_0|> if root == None: ...
stack_v2_sparse_classes_36k_train_000913
1,361
no_license
[ { "docstring": ":type root: TreeNode :type sum: int :rtype: int", "name": "pathSum", "signature": "def pathSum(self, root, sum)" }, { "docstring": "ifStart=True说明之前已经选了某个点了,就必须选到底了", "name": "pathSumVer2", "signature": "def pathSumVer2(self, root, sum, ifStart)" } ]
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 pathSumVer2(self, root, sum, ifStart): ifStart=True说明之前已经选了某个点了,就必须选到底了
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 pathSumVer2(self, root, sum, ifStart): ifStart=True说明之前已经选了某个点了,就必须选到底了 <|skeleton|> class So...
f1a3930c571a6d062208ee1c1aadfe93a5684c40
<|skeleton|> class Solution: def pathSum(self, root, sum): """:type root: TreeNode :type sum: int :rtype: int""" <|body_0|> def pathSumVer2(self, root, sum, ifStart): """ifStart=True说明之前已经选了某个点了,就必须选到底了""" <|body_1|> <|end_skeleton|>
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""" if root == None: return 0 else: return self.pathSumVer2(root, sum, False) def pathSumVer2(self, root, sum, ifStart): """ifStart=True说明之前已经选了某个点了,就必须选到底了"""...
the_stack_v2_python_sparse
solution/problem 76.py
Fay321/leetcode-exercise
train
0
045900bf89057e4fae9a7a2120d5c3e602de28d0
[ "super().__init__()\nself.left = left\nself.right = right\nself.op = op", "right = self.right.make_il(il_code, symbol_table, c)\nlvalue = self.left.lvalue(il_code, symbol_table, c)\nif not lvalue or not lvalue.modable():\n err = f\"expression on left of '{str(self.op)}' is not assignable\"\n raise CompilerE...
<|body_start_0|> super().__init__() self.left = left self.right = right self.op = op <|end_body_0|> <|body_start_1|> right = self.right.make_il(il_code, symbol_table, c) lvalue = self.left.lvalue(il_code, symbol_table, c) if not lvalue or not lvalue.modable(): ...
Expression that is += or -=.
_CompoundPlusMinus
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _CompoundPlusMinus: """Expression that is += or -=.""" def __init__(self, left, right, op): """Initialize node.""" <|body_0|> def make_il(self, il_code, symbol_table, c): """Make code for this node.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_36k_train_000914
45,651
permissive
[ { "docstring": "Initialize node.", "name": "__init__", "signature": "def __init__(self, left, right, op)" }, { "docstring": "Make code for this node.", "name": "make_il", "signature": "def make_il(self, il_code, symbol_table, c)" } ]
2
stack_v2_sparse_classes_30k_train_007931
Implement the Python class `_CompoundPlusMinus` described below. Class description: Expression that is += or -=. Method signatures and docstrings: - def __init__(self, left, right, op): Initialize node. - def make_il(self, il_code, symbol_table, c): Make code for this node.
Implement the Python class `_CompoundPlusMinus` described below. Class description: Expression that is += or -=. Method signatures and docstrings: - def __init__(self, left, right, op): Initialize node. - def make_il(self, il_code, symbol_table, c): Make code for this node. <|skeleton|> class _CompoundPlusMinus: ...
6232136be38a29e8c18beae3d23e49ecfb7906fd
<|skeleton|> class _CompoundPlusMinus: """Expression that is += or -=.""" def __init__(self, left, right, op): """Initialize node.""" <|body_0|> def make_il(self, il_code, symbol_table, c): """Make code for this node.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class _CompoundPlusMinus: """Expression that is += or -=.""" def __init__(self, left, right, op): """Initialize node.""" super().__init__() self.left = left self.right = right self.op = op def make_il(self, il_code, symbol_table, c): """Make code for this no...
the_stack_v2_python_sparse
shivyc/tree/expr_nodes.py
ShivamSarodia/ShivyC
train
1,072
94876b1dde609ad32965fee9597bd933fb084861
[ "def doit(node):\n if node:\n vals.append(str(node.val))\n doit(node.left)\n doit(node.right)\n else:\n vals.append('#')\nvals = []\ndoit(root)\nreturn ' '.join(vals)", "def doit():\n val = next(vals)\n if val == '#':\n return None\n node = TreeNode(int(val))\n ...
<|body_start_0|> def doit(node): if node: vals.append(str(node.val)) doit(node.left) doit(node.right) else: vals.append('#') vals = [] doit(root) return ' '.join(vals) <|end_body_0|> <|body_start_1|>...
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_000915
4,578
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...
e2fecd266bfced6208694b19a2d81182b13dacd6
<|skeleton|> class Codec2: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec2: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" def doit(node): if node: vals.append(str(node.val)) doit(node.left) doit(node.right) else: vals.a...
the_stack_v2_python_sparse
Codec.py
HuipengXu/leetcode
train
0
892cbc07a1524f47caaf9eddeb1e1485bb79c915
[ "data = form.cleaned_data\nself.success_url = reverse('course_result', kwargs={'course': int(data['course'].id)})\nreturn super().form_valid(form)", "context = super().get_context_data(**kwargs)\ncontext['title_text'] = 'Choose Course Result To Display'\ncontext['detail_text'] = 'Please select the <strong>Course\...
<|body_start_0|> data = form.cleaned_data self.success_url = reverse('course_result', kwargs={'course': int(data['course'].id)}) return super().form_valid(form) <|end_body_0|> <|body_start_1|> context = super().get_context_data(**kwargs) context['title_text'] = 'Choose Course Re...
View for choosing which course result to display. Check that the user's account is still active. Redirects to course_result view on form valid.
ShowCourseResultView
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ShowCourseResultView: """View for choosing which course result to display. Check that the user's account is still active. Redirects to course_result view on form valid.""" def form_valid(self, form): """Compute the success URL and call super.form_valid()""" <|body_0|> de...
stack_v2_sparse_classes_36k_train_000916
29,759
no_license
[ { "docstring": "Compute the success URL and call super.form_valid()", "name": "form_valid", "signature": "def form_valid(self, form)" }, { "docstring": "Return the data used in the templates rendering.", "name": "get_context_data", "signature": "def get_context_data(self, **kwargs)" } ...
2
stack_v2_sparse_classes_30k_train_005386
Implement the Python class `ShowCourseResultView` described below. Class description: View for choosing which course result to display. Check that the user's account is still active. Redirects to course_result view on form valid. Method signatures and docstrings: - def form_valid(self, form): Compute the success URL ...
Implement the Python class `ShowCourseResultView` described below. Class description: View for choosing which course result to display. Check that the user's account is still active. Redirects to course_result view on form valid. Method signatures and docstrings: - def form_valid(self, form): Compute the success URL ...
06bc577d01d3dbf6c425e03dcb903977a38e377c
<|skeleton|> class ShowCourseResultView: """View for choosing which course result to display. Check that the user's account is still active. Redirects to course_result view on form valid.""" def form_valid(self, form): """Compute the success URL and call super.form_valid()""" <|body_0|> de...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ShowCourseResultView: """View for choosing which course result to display. Check that the user's account is still active. Redirects to course_result view on form valid.""" def form_valid(self, form): """Compute the success URL and call super.form_valid()""" data = form.cleaned_data ...
the_stack_v2_python_sparse
cbt/views.py
Festusali/CBTest
train
6
7e413261c060b0c54fab878b41f699400c5c6609
[ "super().__init__(methodname)\nself.ntrain, self.ntest = (50, 100)\nself.nclass = 5\nself.ndim = 10\nself.train_data = np.random.rand(self.ntrain, self.ndim)\nself.test_data = np.random.rand(self.ntest, self.ndim)\nself.train_labels = np.random.randint(self.nclass, size=self.ntrain)\nself.test_labels = np.random.ra...
<|body_start_0|> super().__init__(methodname) self.ntrain, self.ntest = (50, 100) self.nclass = 5 self.ndim = 10 self.train_data = np.random.rand(self.ntrain, self.ndim) self.test_data = np.random.rand(self.ntest, self.ndim) self.train_labels = np.random.randint(s...
UtilsTest
[ "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UtilsTest: def __init__(self, methodname): """Initialize the test class.""" <|body_0|> def test_calculate_losses(self): """Test calculating the loss.""" <|body_1|> def test_run_attack_helper(self): """Test the attack.""" <|body_2|> d...
stack_v2_sparse_classes_36k_train_000917
6,871
permissive
[ { "docstring": "Initialize the test class.", "name": "__init__", "signature": "def __init__(self, methodname)" }, { "docstring": "Test calculating the loss.", "name": "test_calculate_losses", "signature": "def test_calculate_losses(self)" }, { "docstring": "Test the attack.", ...
6
null
Implement the Python class `UtilsTest` described below. Class description: Implement the UtilsTest class. Method signatures and docstrings: - def __init__(self, methodname): Initialize the test class. - def test_calculate_losses(self): Test calculating the loss. - def test_run_attack_helper(self): Test the attack. - ...
Implement the Python class `UtilsTest` described below. Class description: Implement the UtilsTest class. Method signatures and docstrings: - def __init__(self, methodname): Initialize the test class. - def test_calculate_losses(self): Test calculating the loss. - def test_run_attack_helper(self): Test the attack. - ...
c92610e37aa340932ed2d963813e0890035a22bc
<|skeleton|> class UtilsTest: def __init__(self, methodname): """Initialize the test class.""" <|body_0|> def test_calculate_losses(self): """Test calculating the loss.""" <|body_1|> def test_run_attack_helper(self): """Test the attack.""" <|body_2|> d...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UtilsTest: def __init__(self, methodname): """Initialize the test class.""" super().__init__(methodname) self.ntrain, self.ntest = (50, 100) self.nclass = 5 self.ndim = 10 self.train_data = np.random.rand(self.ntrain, self.ndim) self.test_data = np.rando...
the_stack_v2_python_sparse
tensorflow_privacy/privacy/privacy_tests/membership_inference_attack/tf_estimator_evaluation_test.py
tensorflow/privacy
train
1,881
2639e78b4a554c3d0793b581bc816f465ff0c57b
[ "self.file = file\nself.id = id\nself.type = type\nself.state = state\nself.title = title\nself.purpose = purpose\nself.groups = groups\nself.modes = modes\nself.classname = classname\nself.module = module\nself.input = input\nself.output = output\nself.reference = reference\nself.traceability = traceability", "s...
<|body_start_0|> self.file = file self.id = id self.type = type self.state = state self.title = title self.purpose = purpose self.groups = groups self.modes = modes self.classname = classname self.module = module self.input = input ...
Holder class for the contents of a testcase descriptor.
XMLDescriptorContainer
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class XMLDescriptorContainer: """Holder class for the contents of a testcase descriptor.""" def __init__(self, file, id, type, state, title, purpose, groups, modes, classname, module, input, output, reference, traceability): """Create an instance of the XMLDescriptorContainer class. @param...
stack_v2_sparse_classes_36k_train_000918
12,973
no_license
[ { "docstring": "Create an instance of the XMLDescriptorContainer class. @param id: The testcase identifier @param type: The type of the testcase (automated or manual) @param state: The state of the testcase (runable, deprecated or skipped) @param title: The title of the testcase @param purpose: The purpose of t...
2
stack_v2_sparse_classes_30k_train_003657
Implement the Python class `XMLDescriptorContainer` described below. Class description: Holder class for the contents of a testcase descriptor. Method signatures and docstrings: - def __init__(self, file, id, type, state, title, purpose, groups, modes, classname, module, input, output, reference, traceability): Creat...
Implement the Python class `XMLDescriptorContainer` described below. Class description: Holder class for the contents of a testcase descriptor. Method signatures and docstrings: - def __init__(self, file, id, type, state, title, purpose, groups, modes, classname, module, input, output, reference, traceability): Creat...
3f93cbedbb806b6c53de89358025f93c740ebdc3
<|skeleton|> class XMLDescriptorContainer: """Holder class for the contents of a testcase descriptor.""" def __init__(self, file, id, type, state, title, purpose, groups, modes, classname, module, input, output, reference, traceability): """Create an instance of the XMLDescriptorContainer class. @param...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class XMLDescriptorContainer: """Holder class for the contents of a testcase descriptor.""" def __init__(self, file, id, type, state, title, purpose, groups, modes, classname, module, input, output, reference, traceability): """Create an instance of the XMLDescriptorContainer class. @param id: The test...
the_stack_v2_python_sparse
pysys/xml/descriptor.py
moraygrieve/pysys
train
0
3bd58e0409fc500e81a85348c1413c3dbbf89680
[ "@lru_cache(None)\ndef lcs(i, j):\n if i == -1 or j == -1:\n return 0\n m = 0\n if word1[i] == word2[j]:\n m = max([m, lcs(i - 1, j - 1) + 1])\n else:\n m = max([lcs(i - 1, j), lcs(i, j - 1)])\n return m\nlcs_length = lcs(len(word1) - 1, len(word2) - 1)\nreturn len(word1) + len(w...
<|body_start_0|> @lru_cache(None) def lcs(i, j): if i == -1 or j == -1: return 0 m = 0 if word1[i] == word2[j]: m = max([m, lcs(i - 1, j - 1) + 1]) else: m = max([lcs(i - 1, j), lcs(i, j - 1)]) re...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def minDistance(self, word1: str, word2: str) -> int: """06/13/2020 10:44""" <|body_0|> def minDistance(self, word1: str, word2: str) -> int: """Top-down DP (recursion) Time complexity: O(n^2) Space complexity: O(n^2)""" <|body_1|> def minDista...
stack_v2_sparse_classes_36k_train_000919
3,799
no_license
[ { "docstring": "06/13/2020 10:44", "name": "minDistance", "signature": "def minDistance(self, word1: str, word2: str) -> int" }, { "docstring": "Top-down DP (recursion) Time complexity: O(n^2) Space complexity: O(n^2)", "name": "minDistance", "signature": "def minDistance(self, word1: st...
5
stack_v2_sparse_classes_30k_test_000703
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minDistance(self, word1: str, word2: str) -> int: 06/13/2020 10:44 - def minDistance(self, word1: str, word2: str) -> int: Top-down DP (recursion) Time complexity: O(n^2) Spa...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def minDistance(self, word1: str, word2: str) -> int: 06/13/2020 10:44 - def minDistance(self, word1: str, word2: str) -> int: Top-down DP (recursion) Time complexity: O(n^2) Spa...
1389a009a02e90e8700a7a00e0b7f797c129cdf4
<|skeleton|> class Solution: def minDistance(self, word1: str, word2: str) -> int: """06/13/2020 10:44""" <|body_0|> def minDistance(self, word1: str, word2: str) -> int: """Top-down DP (recursion) Time complexity: O(n^2) Space complexity: O(n^2)""" <|body_1|> def minDista...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def minDistance(self, word1: str, word2: str) -> int: """06/13/2020 10:44""" @lru_cache(None) def lcs(i, j): if i == -1 or j == -1: return 0 m = 0 if word1[i] == word2[j]: m = max([m, lcs(i - 1, j - 1) + 1]) ...
the_stack_v2_python_sparse
leetcode/solved/583_Delete_Operation_for_Two_Strings/solution.py
sungminoh/algorithms
train
0
c176bab87b2b24dd18ff0fa9072fb09fe04f5514
[ "self._data = {}\nself._lock = threading.Lock()\nself._max_size = max_size\nself._lru = None\nself._mru = None", "with self._lock:\n node = self._data.get(key)\n to_return = node.value if node else None\n if node is None:\n node = SimpleLruCache._Node(key, value, None, None)\n node = self._bubb...
<|body_start_0|> self._data = {} self._lock = threading.Lock() self._max_size = max_size self._lru = None self._mru = None <|end_body_0|> <|body_start_1|> with self._lock: node = self._data.get(key) to_return = node.value if node else None ...
Key/Value local memory cache. with expiration & LRU eviction. LRU double-linked-list format: { 'key1'--------------------------------------------------------------- 'key2'------------------------------------ | 'key3'------------ | | } | | | V V V || MRU || -previous-> || X || ... -previous-> || LRU || -previous-> None ...
SimpleLruCache
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SimpleLruCache: """Key/Value local memory cache. with expiration & LRU eviction. LRU double-linked-list format: { 'key1'--------------------------------------------------------------- 'key2'------------------------------------ | 'key3'------------ | | } | | | V V V || MRU || -previous-> || X || ....
stack_v2_sparse_classes_36k_train_000920
3,926
permissive
[ { "docstring": "Class constructor.", "name": "__init__", "signature": "def __init__(self, max_size=DEFAULT_MAX_SIZE)" }, { "docstring": "Set an item in the cache and return the previous value. :param key: object key :type args: object :param value: object value :type kwargs: object :return: prev...
6
stack_v2_sparse_classes_30k_train_016061
Implement the Python class `SimpleLruCache` described below. Class description: Key/Value local memory cache. with expiration & LRU eviction. LRU double-linked-list format: { 'key1'--------------------------------------------------------------- 'key2'------------------------------------ | 'key3'------------ | | } | | ...
Implement the Python class `SimpleLruCache` described below. Class description: Key/Value local memory cache. with expiration & LRU eviction. LRU double-linked-list format: { 'key1'--------------------------------------------------------------- 'key2'------------------------------------ | 'key3'------------ | | } | | ...
523d2395d39d189772b1db1c944db0cf4ca5769a
<|skeleton|> class SimpleLruCache: """Key/Value local memory cache. with expiration & LRU eviction. LRU double-linked-list format: { 'key1'--------------------------------------------------------------- 'key2'------------------------------------ | 'key3'------------ | | } | | | V V V || MRU || -previous-> || X || ....
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SimpleLruCache: """Key/Value local memory cache. with expiration & LRU eviction. LRU double-linked-list format: { 'key1'--------------------------------------------------------------- 'key2'------------------------------------ | 'key3'------------ | | } | | | V V V || MRU || -previous-> || X || ... -previous-...
the_stack_v2_python_sparse
splitio/engine/cache/lru.py
splitio/python-client
train
17
a5fdf182d391ef1b00713fabb23dc8abbc048892
[ "resp = get_model_list_method(*get_method_args, **get_method_kwargs)\nif not resp.ok:\n raise DatasetGeneratorError('Request for list of {0} during data-driven-test setup failed with an HTTP {1} ERROR'.format(model_type_name, resp.status_code))\nif resp.entity is None:\n raise DatasetGeneratorError('Unable to...
<|body_start_0|> resp = get_model_list_method(*get_method_args, **get_method_kwargs) if not resp.ok: raise DatasetGeneratorError('Request for list of {0} during data-driven-test setup failed with an HTTP {1} ERROR'.format(model_type_name, resp.status_code)) if resp.entity is None: ...
Collection of dataset generators and helper methods for developing data driven tests
ModelBasedDatasetToolkit
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ModelBasedDatasetToolkit: """Collection of dataset generators and helper methods for developing data driven tests""" def _get_model_list(cls, get_model_list_method, model_type_name, *get_method_args, **get_method_kwargs): """Gets list of all models in the environment.""" <|bo...
stack_v2_sparse_classes_36k_train_000921
3,872
permissive
[ { "docstring": "Gets list of all models in the environment.", "name": "_get_model_list", "signature": "def _get_model_list(cls, get_model_list_method, model_type_name, *get_method_args, **get_method_kwargs)" }, { "docstring": "Filters should be dictionaries with model attributes as keys and list...
3
stack_v2_sparse_classes_30k_train_018834
Implement the Python class `ModelBasedDatasetToolkit` described below. Class description: Collection of dataset generators and helper methods for developing data driven tests Method signatures and docstrings: - def _get_model_list(cls, get_model_list_method, model_type_name, *get_method_args, **get_method_kwargs): Ge...
Implement the Python class `ModelBasedDatasetToolkit` described below. Class description: Collection of dataset generators and helper methods for developing data driven tests Method signatures and docstrings: - def _get_model_list(cls, get_model_list_method, model_type_name, *get_method_args, **get_method_kwargs): Ge...
7d49cf6bfd7e1a6e5b739e7de52f2e18e5ccf924
<|skeleton|> class ModelBasedDatasetToolkit: """Collection of dataset generators and helper methods for developing data driven tests""" def _get_model_list(cls, get_model_list_method, model_type_name, *get_method_args, **get_method_kwargs): """Gets list of all models in the environment.""" <|bo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ModelBasedDatasetToolkit: """Collection of dataset generators and helper methods for developing data driven tests""" def _get_model_list(cls, get_model_list_method, model_type_name, *get_method_args, **get_method_kwargs): """Gets list of all models in the environment.""" resp = get_model_...
the_stack_v2_python_sparse
cloudcafe/common/datasets.py
kurhula/cloudcafe
train
0
828d9763d6e0abdf026eaae73155494c70397ddc
[ "super(self.__class__, self).__init__(parent)\nself.setupUi(self)\nself.treeWidget.setColumnWidth(0, 400)\nrootItem = self.treeWidget.invisibleRootItem()\ndbItem = self.createItem(rootItem, 'database')\nself.createChildrenItems(dbItem, permissionsDict)\nself.treeWidget.sortByColumn(0, QtCore.Qt.AscendingOrder)\nsel...
<|body_start_0|> super(self.__class__, self).__init__(parent) self.setupUi(self) self.treeWidget.setColumnWidth(0, 400) rootItem = self.treeWidget.invisibleRootItem() dbItem = self.createItem(rootItem, 'database') self.createChildrenItems(dbItem, permissionsDict) ...
PermissionProperties
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PermissionProperties: def __init__(self, permissionsDict, parent=None): """Constructor""" <|body_0|> def createItem(self, parent, text): """Creates a tree widget item parent: parent item text: item text""" <|body_1|> def createChildrenItems(self, parent,...
stack_v2_sparse_classes_36k_train_000922
3,693
no_license
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self, permissionsDict, parent=None)" }, { "docstring": "Creates a tree widget item parent: parent item text: item text", "name": "createItem", "signature": "def createItem(self, parent, text)" }, { "docs...
4
null
Implement the Python class `PermissionProperties` described below. Class description: Implement the PermissionProperties class. Method signatures and docstrings: - def __init__(self, permissionsDict, parent=None): Constructor - def createItem(self, parent, text): Creates a tree widget item parent: parent item text: i...
Implement the Python class `PermissionProperties` described below. Class description: Implement the PermissionProperties class. Method signatures and docstrings: - def __init__(self, permissionsDict, parent=None): Constructor - def createItem(self, parent, text): Creates a tree widget item parent: parent item text: i...
edff378f356db3c0577ce34e618c5ae493d296ba
<|skeleton|> class PermissionProperties: def __init__(self, permissionsDict, parent=None): """Constructor""" <|body_0|> def createItem(self, parent, text): """Creates a tree widget item parent: parent item text: item text""" <|body_1|> def createChildrenItems(self, parent,...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PermissionProperties: def __init__(self, permissionsDict, parent=None): """Constructor""" super(self.__class__, self).__init__(parent) self.setupUi(self) self.treeWidget.setColumnWidth(0, 400) rootItem = self.treeWidget.invisibleRootItem() dbItem = self.createIt...
the_stack_v2_python_sparse
UserTools/permission_properties.py
euriconicacio/DsgTools
train
0
b1d87e445e67c953078d22c2f059a49f67b39851
[ "\"\"\":field\n The name of the visual material associated with this cloth material.\n \"\"\"\nself.visual_material: str = visual_material\n':field\\n The texture scale of the visual material.\\n '\nself.texture_scale: Dict[str, float] = texture_scale\n':field\\n The smoothness va...
<|body_start_0|> """:field The name of the visual material associated with this cloth material. """ self.visual_material: str = visual_material ':field\n The texture scale of the visual material.\n ' self.texture_scale: Dict[str, float] = tex...
An Obi cloth material. For more information, [read this](http://obi.virtualmethodstudio.com/tutorials/clothsetup.html).
ClothMaterial
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ClothMaterial: """An Obi cloth material. For more information, [read this](http://obi.virtualmethodstudio.com/tutorials/clothsetup.html).""" def __init__(self, visual_material: str, texture_scale: Dict[str, float], visual_smoothness: float=0, stretching_scale: float=1.0, stretch_compliance: ...
stack_v2_sparse_classes_36k_train_000923
4,062
permissive
[ { "docstring": ":param visual_material: The name of the visual material associated with this cloth material. :param texture_scale: The texture scale of the visual material. :param visual_smoothness: The smoothness value of the visual material. :param stretching_scale: The scale factor for the rest length of eac...
2
stack_v2_sparse_classes_30k_train_000282
Implement the Python class `ClothMaterial` described below. Class description: An Obi cloth material. For more information, [read this](http://obi.virtualmethodstudio.com/tutorials/clothsetup.html). Method signatures and docstrings: - def __init__(self, visual_material: str, texture_scale: Dict[str, float], visual_sm...
Implement the Python class `ClothMaterial` described below. Class description: An Obi cloth material. For more information, [read this](http://obi.virtualmethodstudio.com/tutorials/clothsetup.html). Method signatures and docstrings: - def __init__(self, visual_material: str, texture_scale: Dict[str, float], visual_sm...
9df96fba455b327bb360d8dd5886d8754046c690
<|skeleton|> class ClothMaterial: """An Obi cloth material. For more information, [read this](http://obi.virtualmethodstudio.com/tutorials/clothsetup.html).""" def __init__(self, visual_material: str, texture_scale: Dict[str, float], visual_smoothness: float=0, stretching_scale: float=1.0, stretch_compliance: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ClothMaterial: """An Obi cloth material. For more information, [read this](http://obi.virtualmethodstudio.com/tutorials/clothsetup.html).""" def __init__(self, visual_material: str, texture_scale: Dict[str, float], visual_smoothness: float=0, stretching_scale: float=1.0, stretch_compliance: float=0, max_...
the_stack_v2_python_sparse
Python/tdw/obi_data/cloth/cloth_material.py
threedworld-mit/tdw
train
427
d2a6df517d92fb32c42df662b7c251d550d5176b
[ "_LOGGER.debug('KiraRemote device init started for: %s', name)\nself._attr_name = name\nself._kira = kira", "for single_command in command:\n code_tuple = (single_command, kwargs.get(remote.ATTR_DEVICE))\n _LOGGER.info('Sending Command: %s to %s', *code_tuple)\n self._kira.sendCode(code_tuple)" ]
<|body_start_0|> _LOGGER.debug('KiraRemote device init started for: %s', name) self._attr_name = name self._kira = kira <|end_body_0|> <|body_start_1|> for single_command in command: code_tuple = (single_command, kwargs.get(remote.ATTR_DEVICE)) _LOGGER.info('Send...
Remote representation used to send commands to a Kira device.
KiraRemote
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KiraRemote: """Remote representation used to send commands to a Kira device.""" def __init__(self, name, kira): """Initialize KiraRemote class.""" <|body_0|> def send_command(self, command: Iterable[str], **kwargs: Any) -> None: """Send a command to one device.""...
stack_v2_sparse_classes_36k_train_000924
1,615
permissive
[ { "docstring": "Initialize KiraRemote class.", "name": "__init__", "signature": "def __init__(self, name, kira)" }, { "docstring": "Send a command to one device.", "name": "send_command", "signature": "def send_command(self, command: Iterable[str], **kwargs: Any) -> None" } ]
2
null
Implement the Python class `KiraRemote` described below. Class description: Remote representation used to send commands to a Kira device. Method signatures and docstrings: - def __init__(self, name, kira): Initialize KiraRemote class. - def send_command(self, command: Iterable[str], **kwargs: Any) -> None: Send a com...
Implement the Python class `KiraRemote` described below. Class description: Remote representation used to send commands to a Kira device. Method signatures and docstrings: - def __init__(self, name, kira): Initialize KiraRemote class. - def send_command(self, command: Iterable[str], **kwargs: Any) -> None: Send a com...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class KiraRemote: """Remote representation used to send commands to a Kira device.""" def __init__(self, name, kira): """Initialize KiraRemote class.""" <|body_0|> def send_command(self, command: Iterable[str], **kwargs: Any) -> None: """Send a command to one device.""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KiraRemote: """Remote representation used to send commands to a Kira device.""" def __init__(self, name, kira): """Initialize KiraRemote class.""" _LOGGER.debug('KiraRemote device init started for: %s', name) self._attr_name = name self._kira = kira def send_command(s...
the_stack_v2_python_sparse
homeassistant/components/kira/remote.py
home-assistant/core
train
35,501
aa535cf73827caf07d6571a183251aab0b26f916
[ "Log().info('======开始考前资料核查======')\nsleep(2)\nself.find_element(*self.Editer).click()\nsleep(2)\nself.switch_to_frame(self.find_element(*self.iframe1))\nself.implicity_wait(5)\nLog().info('======审核附件======')\nself.find_element(*self.AdoptOne).click()\nsleep(2)\nself.find_element(*self.AdoptTwo).click()\nsleep(2)\n...
<|body_start_0|> Log().info('======开始考前资料核查======') sleep(2) self.find_element(*self.Editer).click() sleep(2) self.switch_to_frame(self.find_element(*self.iframe1)) self.implicity_wait(5) Log().info('======审核附件======') self.find_element(*self.AdoptOne).cli...
考前资料核查页面
AdultCheck
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AdultCheck: """考前资料核查页面""" def type_audit_data(self): """考前资料核查通过""" <|body_0|> def type_audit_pass(self): """审核通过断言""" <|body_1|> <|end_skeleton|> <|body_start_0|> Log().info('======开始考前资料核查======') sleep(2) self.find_element(*s...
stack_v2_sparse_classes_36k_train_000925
1,886
no_license
[ { "docstring": "考前资料核查通过", "name": "type_audit_data", "signature": "def type_audit_data(self)" }, { "docstring": "审核通过断言", "name": "type_audit_pass", "signature": "def type_audit_pass(self)" } ]
2
stack_v2_sparse_classes_30k_train_014036
Implement the Python class `AdultCheck` described below. Class description: 考前资料核查页面 Method signatures and docstrings: - def type_audit_data(self): 考前资料核查通过 - def type_audit_pass(self): 审核通过断言
Implement the Python class `AdultCheck` described below. Class description: 考前资料核查页面 Method signatures and docstrings: - def type_audit_data(self): 考前资料核查通过 - def type_audit_pass(self): 审核通过断言 <|skeleton|> class AdultCheck: """考前资料核查页面""" def type_audit_data(self): """考前资料核查通过""" <|body_0|> ...
08d7fab053f6797016d827396fc7b48a3eba9b6e
<|skeleton|> class AdultCheck: """考前资料核查页面""" def type_audit_data(self): """考前资料核查通过""" <|body_0|> def type_audit_pass(self): """审核通过断言""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AdultCheck: """考前资料核查页面""" def type_audit_data(self): """考前资料核查通过""" Log().info('======开始考前资料核查======') sleep(2) self.find_element(*self.Editer).click() sleep(2) self.switch_to_frame(self.find_element(*self.iframe1)) self.implicity_wait(5) L...
the_stack_v2_python_sparse
YZ_AutoTest_Project/Website/test_case/page_object/AdultCheckFilePage.py
MikeDarkCloud/YZ
train
0
7188f4eb39c5c7021e91919d10da159d2f547c47
[ "kw = super(EventTaskView, self).get_form_kwargs()\nkw.update({'organization': self.request.user.organization})\nreturn kw", "context = super(EventTaskView, self).get_context_data(**kwargs)\nevent = get_object_or_404(Event, id=self.kwargs['pk'])\ntasks = event.task_set.all()\ncount = tasks.count()\nidentified_ct ...
<|body_start_0|> kw = super(EventTaskView, self).get_form_kwargs() kw.update({'organization': self.request.user.organization}) return kw <|end_body_0|> <|body_start_1|> context = super(EventTaskView, self).get_context_data(**kwargs) event = get_object_or_404(Event, id=self.kwarg...
Create event task.
EventTaskView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EventTaskView: """Create event task.""" def get_form_kwargs(self): """Pass organization to form.""" <|body_0|> def get_context_data(self, **kwargs): """Return tasks belonging to the story.""" <|body_1|> <|end_skeleton|> <|body_start_0|> kw = sup...
stack_v2_sparse_classes_36k_train_000926
11,257
permissive
[ { "docstring": "Pass organization to form.", "name": "get_form_kwargs", "signature": "def get_form_kwargs(self)" }, { "docstring": "Return tasks belonging to the story.", "name": "get_context_data", "signature": "def get_context_data(self, **kwargs)" } ]
2
stack_v2_sparse_classes_30k_train_010602
Implement the Python class `EventTaskView` described below. Class description: Create event task. Method signatures and docstrings: - def get_form_kwargs(self): Pass organization to form. - def get_context_data(self, **kwargs): Return tasks belonging to the story.
Implement the Python class `EventTaskView` described below. Class description: Create event task. Method signatures and docstrings: - def get_form_kwargs(self): Pass organization to form. - def get_context_data(self, **kwargs): Return tasks belonging to the story. <|skeleton|> class EventTaskView: """Create even...
dc6bc79d450f7e2bdf59cfbcd306d05a736e4db9
<|skeleton|> class EventTaskView: """Create event task.""" def get_form_kwargs(self): """Pass organization to form.""" <|body_0|> def get_context_data(self, **kwargs): """Return tasks belonging to the story.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EventTaskView: """Create event task.""" def get_form_kwargs(self): """Pass organization to form.""" kw = super(EventTaskView, self).get_form_kwargs() kw.update({'organization': self.request.user.organization}) return kw def get_context_data(self, **kwargs): ""...
the_stack_v2_python_sparse
project/editorial/views/tasks.py
ProjectFacet/facet
train
25
c1156d2c7b020d8cdd232c935b449d22ab617acd
[ "domain = self._client.create(domain_name)\nif check:\n self.check_domain_presence(domain)\nreturn domain", "self._client.update(domain, enabled=False)\nself._client.delete(domain.id)\nif check:\n self.check_domain_presence(domain, present=False)", "def predicate():\n try:\n self._client.get(dom...
<|body_start_0|> domain = self._client.create(domain_name) if check: self.check_domain_presence(domain) return domain <|end_body_0|> <|body_start_1|> self._client.update(domain, enabled=False) self._client.delete(domain.id) if check: self.check_do...
Domain steps.
DomainSteps
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DomainSteps: """Domain steps.""" def create_domain(self, domain_name, check=True): """Step to create domain.""" <|body_0|> def delete_domain(self, domain, check=True): """Step to delete domain.""" <|body_1|> def check_domain_presence(self, domain, pr...
stack_v2_sparse_classes_36k_train_000927
1,679
no_license
[ { "docstring": "Step to create domain.", "name": "create_domain", "signature": "def create_domain(self, domain_name, check=True)" }, { "docstring": "Step to delete domain.", "name": "delete_domain", "signature": "def delete_domain(self, domain, check=True)" }, { "docstring": "Ver...
3
stack_v2_sparse_classes_30k_train_015559
Implement the Python class `DomainSteps` described below. Class description: Domain steps. Method signatures and docstrings: - def create_domain(self, domain_name, check=True): Step to create domain. - def delete_domain(self, domain, check=True): Step to delete domain. - def check_domain_presence(self, domain, presen...
Implement the Python class `DomainSteps` described below. Class description: Domain steps. Method signatures and docstrings: - def create_domain(self, domain_name, check=True): Step to create domain. - def delete_domain(self, domain, check=True): Step to delete domain. - def check_domain_presence(self, domain, presen...
380849c3f24d3322caa49f895d0d89cc6c998fa8
<|skeleton|> class DomainSteps: """Domain steps.""" def create_domain(self, domain_name, check=True): """Step to create domain.""" <|body_0|> def delete_domain(self, domain, check=True): """Step to delete domain.""" <|body_1|> def check_domain_presence(self, domain, pr...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DomainSteps: """Domain steps.""" def create_domain(self, domain_name, check=True): """Step to create domain.""" domain = self._client.create(domain_name) if check: self.check_domain_presence(domain) return domain def delete_domain(self, domain, check=True)...
the_stack_v2_python_sparse
stepler/keystone/steps/domains.py
gdyuldin/stepler
train
0
e1c99043eed4bc38ecd1e976655d50a3978eb1f8
[ "if not field_type:\n self.field_type = 'BYTE'\n self.field_name = ''\nelse:\n self.field_type = field_type\n self.field_name = field_name\nself.array_size = array_size\nself.selector_value = selector\nself.conditional_value = conditional_value\nself.run_time_size = run_time_size", "if self.array_size...
<|body_start_0|> if not field_type: self.field_type = 'BYTE' self.field_name = '' else: self.field_type = field_type self.field_name = field_name self.array_size = array_size self.selector_value = selector self.conditional_value = c...
Represents a field in TPM structure or union. This object is used in several not fully overlapping cases, not all attributes apply to all use cases. The 'array_size' and 'run_time_size' attributes below are related to the following code example: struct { int size; byte array[MAX_SIZE] } object. In this structure the ac...
Field
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-tcg-spec-license-v1" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Field: """Represents a field in TPM structure or union. This object is used in several not fully overlapping cases, not all attributes apply to all use cases. The 'array_size' and 'run_time_size' attributes below are related to the following code example: struct { int size; byte array[MAX_SIZE] }...
stack_v2_sparse_classes_36k_train_000928
48,677
permissive
[ { "docstring": "Initializes a Field instance. Args: field_type: Initial value for the field type attribute. field_name: Initial value for the field name attribute. selector: Initial value for the selector attribute. array_size: Initial value for the array_size attribute. conditional_value: Initial value of the ...
3
null
Implement the Python class `Field` described below. Class description: Represents a field in TPM structure or union. This object is used in several not fully overlapping cases, not all attributes apply to all use cases. The 'array_size' and 'run_time_size' attributes below are related to the following code example: st...
Implement the Python class `Field` described below. Class description: Represents a field in TPM structure or union. This object is used in several not fully overlapping cases, not all attributes apply to all use cases. The 'array_size' and 'run_time_size' attributes below are related to the following code example: st...
e2745b756317aac3c7a27a4c10bdfe0921a82a1c
<|skeleton|> class Field: """Represents a field in TPM structure or union. This object is used in several not fully overlapping cases, not all attributes apply to all use cases. The 'array_size' and 'run_time_size' attributes below are related to the following code example: struct { int size; byte array[MAX_SIZE] }...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Field: """Represents a field in TPM structure or union. This object is used in several not fully overlapping cases, not all attributes apply to all use cases. The 'array_size' and 'run_time_size' attributes below are related to the following code example: struct { int size; byte array[MAX_SIZE] } object. In t...
the_stack_v2_python_sparse
app/src/main/java/com/syd/source/aosp/external/tpm2/generator/structure_generator.py
lz-purple/Source
train
4
d1c49b88d4243adf071d4c9c93321227ac8afc30
[ "encoder_output, extra = encoder_state\nextra_output, extra_mask, *_ = extra\nreturn super().forward(input, encoder_output, incr_state, extra_output=extra_output, extra_mask=extra_mask, **kwargs)", "new_incr_state = {}\nif getattr(self.layers, 'is_model_parallel', False):\n tensor, new_incr_state = self._apply...
<|body_start_0|> encoder_output, extra = encoder_state extra_output, extra_mask, *_ = extra return super().forward(input, encoder_output, incr_state, extra_output=extra_output, extra_mask=extra_mask, **kwargs) <|end_body_0|> <|body_start_1|> new_incr_state = {} if getattr(self.l...
TransformerExpandedDecoder
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TransformerExpandedDecoder: def forward(self, input: torch.Tensor, encoder_state, incr_state: Optional[DecoderIncrState]=None, **kwargs) -> Tuple[torch.Tensor, DecoderIncrState]: """Override TD.Forward to include extra encoder outputs.""" <|body_0|> def forward_layers(self, ...
stack_v2_sparse_classes_36k_train_000929
43,118
permissive
[ { "docstring": "Override TD.Forward to include extra encoder outputs.", "name": "forward", "signature": "def forward(self, input: torch.Tensor, encoder_state, incr_state: Optional[DecoderIncrState]=None, **kwargs) -> Tuple[torch.Tensor, DecoderIncrState]" }, { "docstring": "Override to pass more...
3
null
Implement the Python class `TransformerExpandedDecoder` described below. Class description: Implement the TransformerExpandedDecoder class. Method signatures and docstrings: - def forward(self, input: torch.Tensor, encoder_state, incr_state: Optional[DecoderIncrState]=None, **kwargs) -> Tuple[torch.Tensor, DecoderInc...
Implement the Python class `TransformerExpandedDecoder` described below. Class description: Implement the TransformerExpandedDecoder class. Method signatures and docstrings: - def forward(self, input: torch.Tensor, encoder_state, incr_state: Optional[DecoderIncrState]=None, **kwargs) -> Tuple[torch.Tensor, DecoderInc...
e1d899edfb92471552bae153f59ad30aa7fca468
<|skeleton|> class TransformerExpandedDecoder: def forward(self, input: torch.Tensor, encoder_state, incr_state: Optional[DecoderIncrState]=None, **kwargs) -> Tuple[torch.Tensor, DecoderIncrState]: """Override TD.Forward to include extra encoder outputs.""" <|body_0|> def forward_layers(self, ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TransformerExpandedDecoder: def forward(self, input: torch.Tensor, encoder_state, incr_state: Optional[DecoderIncrState]=None, **kwargs) -> Tuple[torch.Tensor, DecoderIncrState]: """Override TD.Forward to include extra encoder outputs.""" encoder_output, extra = encoder_state extra_out...
the_stack_v2_python_sparse
projects/light_whoami/agents/expanded_attention.py
facebookresearch/ParlAI
train
10,943
43a73ef0257f028502cbd0db1109cb91a9c7a96b
[ "node = Node(value)\nif not self.root:\n self.root = node\n return\n\ndef walk(root, new_node):\n if not root:\n return\n if new_node.value < root.value:\n if not root.left:\n root.left = new_node\n else:\n walk(root.left, new_node)\n elif not root.right:\n ...
<|body_start_0|> node = Node(value) if not self.root: self.root = node return def walk(root, new_node): if not root: return if new_node.value < root.value: if not root.left: root.left = new_node ...
BinarySearchTree
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BinarySearchTree: def add(self, value): """This will add a new element to the tree, based on a tradtional binary search tree condtional. If value is smaller than the root it will be added to the left, else add to the right.""" <|body_0|> def contains(self, value): ""...
stack_v2_sparse_classes_36k_train_000930
3,622
permissive
[ { "docstring": "This will add a new element to the tree, based on a tradtional binary search tree condtional. If value is smaller than the root it will be added to the left, else add to the right.", "name": "add", "signature": "def add(self, value)" }, { "docstring": "This searches the tree in o...
2
stack_v2_sparse_classes_30k_test_000939
Implement the Python class `BinarySearchTree` described below. Class description: Implement the BinarySearchTree class. Method signatures and docstrings: - def add(self, value): This will add a new element to the tree, based on a tradtional binary search tree condtional. If value is smaller than the root it will be a...
Implement the Python class `BinarySearchTree` described below. Class description: Implement the BinarySearchTree class. Method signatures and docstrings: - def add(self, value): This will add a new element to the tree, based on a tradtional binary search tree condtional. If value is smaller than the root it will be a...
b11b5ef50f52e3d505474fe5fffe4357933da251
<|skeleton|> class BinarySearchTree: def add(self, value): """This will add a new element to the tree, based on a tradtional binary search tree condtional. If value is smaller than the root it will be added to the left, else add to the right.""" <|body_0|> def contains(self, value): ""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BinarySearchTree: def add(self, value): """This will add a new element to the tree, based on a tradtional binary search tree condtional. If value is smaller than the root it will be added to the left, else add to the right.""" node = Node(value) if not self.root: self.root ...
the_stack_v2_python_sparse
dsa/data_structures/tree/tree.py
401-python-joseph-zabaleta/401-python-data-structures-and-algorithms
train
0
14c4bc9375274d83f0d9cdd9799505ba24934674
[ "assert isinstance(return_tensor, bool)\nassert isinstance(channel_first, bool)\nself.return_tensor = return_tensor\nself.channel_first = channel_first", "assert isinstance(frames, (np.ndarray, torch.Tensor)), 'Array must be a numpy.ndarray or torch.Tensor instance.'\nassert len(frames) > 0, 'Array must contain a...
<|body_start_0|> assert isinstance(return_tensor, bool) assert isinstance(channel_first, bool) self.return_tensor = return_tensor self.channel_first = channel_first <|end_body_0|> <|body_start_1|> assert isinstance(frames, (np.ndarray, torch.Tensor)), 'Array must be a numpy.ndar...
Normalizes the color dimension, on a collection of images, to have zero mean and unit standard deviation.
BatchNormalizeRGB
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BatchNormalizeRGB: """Normalizes the color dimension, on a collection of images, to have zero mean and unit standard deviation.""" def __init__(self, return_tensor=True, channel_first=True): """Instantiates a new NormalizeRGB object. Parameters ---------- return_tensor : {True, False...
stack_v2_sparse_classes_36k_train_000931
14,169
no_license
[ { "docstring": "Instantiates a new NormalizeRGB object. Parameters ---------- return_tensor : {True, False}, bool, optional If True then the output is returned as a torch.Tensor instance, by default True. Otherwise the output is returned as a numpy.ndarray instance. channel_first : {True, False}, bool, optional...
2
stack_v2_sparse_classes_30k_train_013765
Implement the Python class `BatchNormalizeRGB` described below. Class description: Normalizes the color dimension, on a collection of images, to have zero mean and unit standard deviation. Method signatures and docstrings: - def __init__(self, return_tensor=True, channel_first=True): Instantiates a new NormalizeRGB o...
Implement the Python class `BatchNormalizeRGB` described below. Class description: Normalizes the color dimension, on a collection of images, to have zero mean and unit standard deviation. Method signatures and docstrings: - def __init__(self, return_tensor=True, channel_first=True): Instantiates a new NormalizeRGB o...
a7c30481822ecb945e3ff6ad184d104361a40ed1
<|skeleton|> class BatchNormalizeRGB: """Normalizes the color dimension, on a collection of images, to have zero mean and unit standard deviation.""" def __init__(self, return_tensor=True, channel_first=True): """Instantiates a new NormalizeRGB object. Parameters ---------- return_tensor : {True, False...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BatchNormalizeRGB: """Normalizes the color dimension, on a collection of images, to have zero mean and unit standard deviation.""" def __init__(self, return_tensor=True, channel_first=True): """Instantiates a new NormalizeRGB object. Parameters ---------- return_tensor : {True, False}, bool, opti...
the_stack_v2_python_sparse
cheapfake/contrib/transforms.py
hu-simon/cheapfake
train
0
3b391a9388ddcb7cf3f8a579b9c93da096767dd6
[ "try:\n super(UserManagementVmmSide, self).__init__(guest_obj, args)\n self.logger.info('function: UserManagementVmmSide::__init__')\n self.window_id = None\nexcept Exception as e:\n raise Exception(lineno() + ' Error: UserManagementHostSide::__init__ ' + self.guest_obj.guestname + ' ' + str(e))", "tr...
<|body_start_0|> try: super(UserManagementVmmSide, self).__init__(guest_obj, args) self.logger.info('function: UserManagementVmmSide::__init__') self.window_id = None except Exception as e: raise Exception(lineno() + ' Error: UserManagementHostSide::__init...
This class is a remote control on the host-side to control a real <userManagement> running on a guest.
UserManagementVmmSide
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserManagementVmmSide: """This class is a remote control on the host-side to control a real <userManagement> running on a guest.""" def __init__(self, guest_obj, args): """Set default attribute values only. @param guest_obj: The guest on which this application is running. (will be in...
stack_v2_sparse_classes_36k_train_000932
13,147
no_license
[ { "docstring": "Set default attribute values only. @param guest_obj: The guest on which this application is running. (will be inserted from guest::application()) @param args: containing logger: Logger name for logging.", "name": "__init__", "signature": "def __init__(self, guest_obj, args)" }, { ...
4
stack_v2_sparse_classes_30k_train_009299
Implement the Python class `UserManagementVmmSide` described below. Class description: This class is a remote control on the host-side to control a real <userManagement> running on a guest. Method signatures and docstrings: - def __init__(self, guest_obj, args): Set default attribute values only. @param guest_obj: Th...
Implement the Python class `UserManagementVmmSide` described below. Class description: This class is a remote control on the host-side to control a real <userManagement> running on a guest. Method signatures and docstrings: - def __init__(self, guest_obj, args): Set default attribute values only. @param guest_obj: Th...
925ff53eb0c7a750ae784e3a2c059ed5e8b140e3
<|skeleton|> class UserManagementVmmSide: """This class is a remote control on the host-side to control a real <userManagement> running on a guest.""" def __init__(self, guest_obj, args): """Set default attribute values only. @param guest_obj: The guest on which this application is running. (will be in...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserManagementVmmSide: """This class is a remote control on the host-side to control a real <userManagement> running on a guest.""" def __init__(self, guest_obj, args): """Set default attribute values only. @param guest_obj: The guest on which this application is running. (will be inserted from g...
the_stack_v2_python_sparse
install_tools/build/lib.linux-x86_64-2.7/hystck/application/userManagement.py
dasec/hystck
train
5
6f78ce95b339a5ffc2f02ac2baa1760da9c3a903
[ "self.opt_filename = None\nself.scanner = None\nself.scan_source = None\nself.scan_mode = None\nself.is_multi_scan = False\nself.is_preview = False\nself.page_size = None\nself.scan_area = None\nself.scan_dir = None\nself.scan_filename = None\nself.scan_filetype = None\nself.depth = None\nself.ext_scan_cmd = None\n...
<|body_start_0|> self.opt_filename = None self.scanner = None self.scan_source = None self.scan_mode = None self.is_multi_scan = False self.is_preview = False self.page_size = None self.scan_area = None self.scan_dir = None self.scan_filena...
Scan options management class.
iqScanOptions
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class iqScanOptions: """Scan options management class.""" def __init__(self): """Constructor.""" <|body_0|> def genOptFileName(self): """Generating a parameter file name.""" <|body_1|> def loadOptions(self, filename=None): """Load scan settings fro...
stack_v2_sparse_classes_36k_train_000933
28,795
no_license
[ { "docstring": "Constructor.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Generating a parameter file name.", "name": "genOptFileName", "signature": "def genOptFileName(self)" }, { "docstring": "Load scan settings from the configuration file. :param ...
5
null
Implement the Python class `iqScanOptions` described below. Class description: Scan options management class. Method signatures and docstrings: - def __init__(self): Constructor. - def genOptFileName(self): Generating a parameter file name. - def loadOptions(self, filename=None): Load scan settings from the configura...
Implement the Python class `iqScanOptions` described below. Class description: Scan options management class. Method signatures and docstrings: - def __init__(self): Constructor. - def genOptFileName(self): Generating a parameter file name. - def loadOptions(self, filename=None): Load scan settings from the configura...
7550e242746cb2fb1219474463f8db21f8e3e114
<|skeleton|> class iqScanOptions: """Scan options management class.""" def __init__(self): """Constructor.""" <|body_0|> def genOptFileName(self): """Generating a parameter file name.""" <|body_1|> def loadOptions(self, filename=None): """Load scan settings fro...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class iqScanOptions: """Scan options management class.""" def __init__(self): """Constructor.""" self.opt_filename = None self.scanner = None self.scan_source = None self.scan_mode = None self.is_multi_scan = False self.is_preview = False self.pag...
the_stack_v2_python_sparse
iq_scanner/scanner/scanner_dlg.py
XHermitOne/iq_framework
train
1
9192d05768c17a08011946c8b55794d195f22761
[ "self.root = Node()\nfor i, word in enumerate(words):\n longw = word + '#' + word\n for j in range(len(word)):\n cur = self.root\n cur.index = i\n for c in longw[j:]:\n cur = cur[c]\n cur.index = i", "word = suffix + '#' + prefix\ncur = self.root\nfor c in word:\n ...
<|body_start_0|> self.root = Node() for i, word in enumerate(words): longw = word + '#' + word for j in range(len(word)): cur = self.root cur.index = i for c in longw[j:]: cur = cur[c] cur.ind...
WordFilter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class WordFilter: def __init__(self, words): """:type words: List[str]""" <|body_0|> def f(self, prefix, suffix): """:type prefix: str :type suffix: str :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.root = Node() for i, word in ...
stack_v2_sparse_classes_36k_train_000934
2,614
no_license
[ { "docstring": ":type words: List[str]", "name": "__init__", "signature": "def __init__(self, words)" }, { "docstring": ":type prefix: str :type suffix: str :rtype: int", "name": "f", "signature": "def f(self, prefix, suffix)" } ]
2
stack_v2_sparse_classes_30k_train_002244
Implement the Python class `WordFilter` described below. Class description: Implement the WordFilter class. Method signatures and docstrings: - def __init__(self, words): :type words: List[str] - def f(self, prefix, suffix): :type prefix: str :type suffix: str :rtype: int
Implement the Python class `WordFilter` described below. Class description: Implement the WordFilter class. Method signatures and docstrings: - def __init__(self, words): :type words: List[str] - def f(self, prefix, suffix): :type prefix: str :type suffix: str :rtype: int <|skeleton|> class WordFilter: def __in...
810575368ecffa97677bdb51744d1f716140bbb1
<|skeleton|> class WordFilter: def __init__(self, words): """:type words: List[str]""" <|body_0|> def f(self, prefix, suffix): """:type prefix: str :type suffix: str :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class WordFilter: def __init__(self, words): """:type words: List[str]""" self.root = Node() for i, word in enumerate(words): longw = word + '#' + word for j in range(len(word)): cur = self.root cur.index = i for c in lo...
the_stack_v2_python_sparse
P/PrefixandSuffixSearch.py
bssrdf/pyleet
train
2
c3e70a97b5ff3475617ea5fb2bc0534b12341de2
[ "kwc = kwargs.copy()\nAbstractBase.__init__(self, **kwc)\nself._identifier = identifier\nself.label = label or ''\nself.description = description or ''", "if self._identifier is None:\n self._identifier = create_guid()\nreturn self._identifier" ]
<|body_start_0|> kwc = kwargs.copy() AbstractBase.__init__(self, **kwc) self._identifier = identifier self.label = label or '' self.description = description or '' <|end_body_0|> <|body_start_1|> if self._identifier is None: self._identifier = create_guid() ...
Base identifiable class for all coverage model objects Provides identifier, label and description attributes
AbstractIdentifiable
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AbstractIdentifiable: """Base identifiable class for all coverage model objects Provides identifier, label and description attributes""" def __init__(self, identifier=None, label=None, description=None, **kwargs): """Construct a new AbstractIdentifiable object @param identifier The U...
stack_v2_sparse_classes_36k_train_000935
19,016
no_license
[ { "docstring": "Construct a new AbstractIdentifiable object @param identifier The UUID of this 'instance' @param label The short description of the object @param description The full description of the object @param **kwargs Additional keyword arguments are copied and the copy is passed up to AbstractBase; see ...
2
stack_v2_sparse_classes_30k_train_008554
Implement the Python class `AbstractIdentifiable` described below. Class description: Base identifiable class for all coverage model objects Provides identifier, label and description attributes Method signatures and docstrings: - def __init__(self, identifier=None, label=None, description=None, **kwargs): Construct ...
Implement the Python class `AbstractIdentifiable` described below. Class description: Base identifiable class for all coverage model objects Provides identifier, label and description attributes Method signatures and docstrings: - def __init__(self, identifier=None, label=None, description=None, **kwargs): Construct ...
9047b834c645d558e5454843dac26cd8bc971b4a
<|skeleton|> class AbstractIdentifiable: """Base identifiable class for all coverage model objects Provides identifier, label and description attributes""" def __init__(self, identifier=None, label=None, description=None, **kwargs): """Construct a new AbstractIdentifiable object @param identifier The U...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AbstractIdentifiable: """Base identifiable class for all coverage model objects Provides identifier, label and description attributes""" def __init__(self, identifier=None, label=None, description=None, **kwargs): """Construct a new AbstractIdentifiable object @param identifier The UUID of this '...
the_stack_v2_python_sparse
coverage_model/basic_types.py
caseybryant/coverage-model
train
0
57be333b030d1e339f49d4f8fdf063bd3f4587fc
[ "super(UserClearBouncing, self).AssertBasePermission(mr)\nif mr.auth.user_id == mr.viewed_user_auth.user_id:\n return\nif mr.perms.HasPerm(permissions.EDIT_OTHER_USERS, None, None):\n return\nraise permissions.PermissionException('You cannot edit this user.')", "viewed_user = mr.viewed_user_auth.user_pb\nif...
<|body_start_0|> super(UserClearBouncing, self).AssertBasePermission(mr) if mr.auth.user_id == mr.viewed_user_auth.user_id: return if mr.perms.HasPerm(permissions.EDIT_OTHER_USERS, None, None): return raise permissions.PermissionException('You cannot edit this use...
Shows a page that can clear a user's bouncing email timestamp.
UserClearBouncing
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UserClearBouncing: """Shows a page that can clear a user's bouncing email timestamp.""" def AssertBasePermission(self, mr): """Check whether the user has any permission to visit this page. Args: mr: commonly used info parsed from the request.""" <|body_0|> def GatherPage...
stack_v2_sparse_classes_36k_train_000936
2,175
permissive
[ { "docstring": "Check whether the user has any permission to visit this page. Args: mr: commonly used info parsed from the request.", "name": "AssertBasePermission", "signature": "def AssertBasePermission(self, mr)" }, { "docstring": "Build up a dictionary of data values to use when rendering th...
3
null
Implement the Python class `UserClearBouncing` described below. Class description: Shows a page that can clear a user's bouncing email timestamp. Method signatures and docstrings: - def AssertBasePermission(self, mr): Check whether the user has any permission to visit this page. Args: mr: commonly used info parsed fr...
Implement the Python class `UserClearBouncing` described below. Class description: Shows a page that can clear a user's bouncing email timestamp. Method signatures and docstrings: - def AssertBasePermission(self, mr): Check whether the user has any permission to visit this page. Args: mr: commonly used info parsed fr...
b5d4783f99461438ca9e6a477535617fadab6ba3
<|skeleton|> class UserClearBouncing: """Shows a page that can clear a user's bouncing email timestamp.""" def AssertBasePermission(self, mr): """Check whether the user has any permission to visit this page. Args: mr: commonly used info parsed from the request.""" <|body_0|> def GatherPage...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class UserClearBouncing: """Shows a page that can clear a user's bouncing email timestamp.""" def AssertBasePermission(self, mr): """Check whether the user has any permission to visit this page. Args: mr: commonly used info parsed from the request.""" super(UserClearBouncing, self).AssertBasePe...
the_stack_v2_python_sparse
appengine/monorail/sitewide/userclearbouncing.py
xinghun61/infra
train
2
ec8088077279899aaa232eaaed0696e8faeaa525
[ "super(CustomSchedule, self).__init__()\nself.d_model = model\nself.d_model = tf.cast(self.d_model, tf.float32)\nself.warmup_steps = warmup_steps", "p1 = tf.math.rsqrt(step)\np2 = step * self.warmup_steps ** (-1.5)\noutput = tf.math.rsqrt(self.d_model) * tf.math.minimum(p1, p2)\nreturn output" ]
<|body_start_0|> super(CustomSchedule, self).__init__() self.d_model = model self.d_model = tf.cast(self.d_model, tf.float32) self.warmup_steps = warmup_steps <|end_body_0|> <|body_start_1|> p1 = tf.math.rsqrt(step) p2 = step * self.warmup_steps ** (-1.5) output ...
Custom Schedule class
CustomSchedule
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CustomSchedule: """Custom Schedule class""" def __init__(self, model, warmup_steps=4000): """Class Constructor""" <|body_0|> def __call__(self, step): """Method call""" <|body_1|> <|end_skeleton|> <|body_start_0|> super(CustomSchedule, self).__i...
stack_v2_sparse_classes_36k_train_000937
4,824
no_license
[ { "docstring": "Class Constructor", "name": "__init__", "signature": "def __init__(self, model, warmup_steps=4000)" }, { "docstring": "Method call", "name": "__call__", "signature": "def __call__(self, step)" } ]
2
stack_v2_sparse_classes_30k_train_004932
Implement the Python class `CustomSchedule` described below. Class description: Custom Schedule class Method signatures and docstrings: - def __init__(self, model, warmup_steps=4000): Class Constructor - def __call__(self, step): Method call
Implement the Python class `CustomSchedule` described below. Class description: Custom Schedule class Method signatures and docstrings: - def __init__(self, model, warmup_steps=4000): Class Constructor - def __call__(self, step): Method call <|skeleton|> class CustomSchedule: """Custom Schedule class""" def...
fc2cec306961f7ca2448965ddd3a2f656bbe10c7
<|skeleton|> class CustomSchedule: """Custom Schedule class""" def __init__(self, model, warmup_steps=4000): """Class Constructor""" <|body_0|> def __call__(self, step): """Method call""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CustomSchedule: """Custom Schedule class""" def __init__(self, model, warmup_steps=4000): """Class Constructor""" super(CustomSchedule, self).__init__() self.d_model = model self.d_model = tf.cast(self.d_model, tf.float32) self.warmup_steps = warmup_steps def ...
the_stack_v2_python_sparse
supervised_learning/0x12-transformer_apps/5-train.py
dalexach/holbertonschool-machine_learning
train
2
bce79b656e8e110d7fa115aa2818d32579bc3bdb
[ "len1 = len(s1)\nlen2 = len(s2)\nlen3 = len(s3)\nif len1 == 0 and len2 == 0 and (len3 == 0):\n return True\nif len1 > 0 and len2 > 0 and (s1[0] == s2[0]):\n if len3 > 0 and s1[0] == s3[0]:\n return self.isInterleave(s1[1:], s2, s3[1:]) or self.isInterleave(s1, s2[1:], s3[1:])\n else:\n return...
<|body_start_0|> len1 = len(s1) len2 = len(s2) len3 = len(s3) if len1 == 0 and len2 == 0 and (len3 == 0): return True if len1 > 0 and len2 > 0 and (s1[0] == s2[0]): if len3 > 0 and s1[0] == s3[0]: return self.isInterleave(s1[1:], s2, s3[1:]...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def isInterleave_recur(self, s1, s2, s3): """:type s1: str :type s2: str :type s3: str :rtype: bool""" <|body_0|> def isInterleave(self, s1, s2, s3): """:type s1: str :type s2: str :type s3: str :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_s...
stack_v2_sparse_classes_36k_train_000938
2,251
no_license
[ { "docstring": ":type s1: str :type s2: str :type s3: str :rtype: bool", "name": "isInterleave_recur", "signature": "def isInterleave_recur(self, s1, s2, s3)" }, { "docstring": ":type s1: str :type s2: str :type s3: str :rtype: bool", "name": "isInterleave", "signature": "def isInterleav...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isInterleave_recur(self, s1, s2, s3): :type s1: str :type s2: str :type s3: str :rtype: bool - def isInterleave(self, s1, s2, s3): :type s1: str :type s2: str :type s3: str :...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def isInterleave_recur(self, s1, s2, s3): :type s1: str :type s2: str :type s3: str :rtype: bool - def isInterleave(self, s1, s2, s3): :type s1: str :type s2: str :type s3: str :...
e2028eec2f4354a224c15f80d4f0dbd41b7fcd00
<|skeleton|> class Solution: def isInterleave_recur(self, s1, s2, s3): """:type s1: str :type s2: str :type s3: str :rtype: bool""" <|body_0|> def isInterleave(self, s1, s2, s3): """:type s1: str :type s2: str :type s3: str :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def isInterleave_recur(self, s1, s2, s3): """:type s1: str :type s2: str :type s3: str :rtype: bool""" len1 = len(s1) len2 = len(s2) len3 = len(s3) if len1 == 0 and len2 == 0 and (len3 == 0): return True if len1 > 0 and len2 > 0 and (s1[0] ...
the_stack_v2_python_sparse
algorithm/leetcode/97.py
guodafeng/pythondev
train
0
bb015d3127109792e29780dc42142e8daef1725d
[ "arr_sorted = sorted(arr)\nlength = len(arr)\nrepeatNum = []\nfor i in range(1, length):\n if arr_sorted[i] == arr_sorted[i - 1]:\n repeatNum.append(arr_sorted[i])\nreturn repeatNum", "hash_map = dict()\nrepeatNum = []\nfor i, val in enumerate(arr):\n if val in hash_map.keys():\n repeatNum.app...
<|body_start_0|> arr_sorted = sorted(arr) length = len(arr) repeatNum = [] for i in range(1, length): if arr_sorted[i] == arr_sorted[i - 1]: repeatNum.append(arr_sorted[i]) return repeatNum <|end_body_0|> <|body_start_1|> hash_map = dict() ...
思路1:先对数组进行排序,扫描排序后的数组,时间复杂度为O(nlogn); 思路2:利用hash表解决,时间复杂度是O(n),空间复杂度也为O(n); 思路3:利用数组中值和其下标的关系
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: """思路1:先对数组进行排序,扫描排序后的数组,时间复杂度为O(nlogn); 思路2:利用hash表解决,时间复杂度是O(n),空间复杂度也为O(n); 思路3:利用数组中值和其下标的关系""" def duplicate1(self, arr): """排序后查找""" <|body_0|> def duplicate2(self, arr): """hash表""" <|body_1|> def duplicate3(self, arr): """时间...
stack_v2_sparse_classes_36k_train_000939
2,139
no_license
[ { "docstring": "排序后查找", "name": "duplicate1", "signature": "def duplicate1(self, arr)" }, { "docstring": "hash表", "name": "duplicate2", "signature": "def duplicate2(self, arr)" }, { "docstring": "时间换空间", "name": "duplicate3", "signature": "def duplicate3(self, arr)" } ]
3
stack_v2_sparse_classes_30k_train_016139
Implement the Python class `Solution` described below. Class description: 思路1:先对数组进行排序,扫描排序后的数组,时间复杂度为O(nlogn); 思路2:利用hash表解决,时间复杂度是O(n),空间复杂度也为O(n); 思路3:利用数组中值和其下标的关系 Method signatures and docstrings: - def duplicate1(self, arr): 排序后查找 - def duplicate2(self, arr): hash表 - def duplicate3(self, arr): 时间换空间
Implement the Python class `Solution` described below. Class description: 思路1:先对数组进行排序,扫描排序后的数组,时间复杂度为O(nlogn); 思路2:利用hash表解决,时间复杂度是O(n),空间复杂度也为O(n); 思路3:利用数组中值和其下标的关系 Method signatures and docstrings: - def duplicate1(self, arr): 排序后查找 - def duplicate2(self, arr): hash表 - def duplicate3(self, arr): 时间换空间 <|skeleton...
14fb97af36c5fb1d69439585adb0db0ce9eae45d
<|skeleton|> class Solution: """思路1:先对数组进行排序,扫描排序后的数组,时间复杂度为O(nlogn); 思路2:利用hash表解决,时间复杂度是O(n),空间复杂度也为O(n); 思路3:利用数组中值和其下标的关系""" def duplicate1(self, arr): """排序后查找""" <|body_0|> def duplicate2(self, arr): """hash表""" <|body_1|> def duplicate3(self, arr): """时间...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: """思路1:先对数组进行排序,扫描排序后的数组,时间复杂度为O(nlogn); 思路2:利用hash表解决,时间复杂度是O(n),空间复杂度也为O(n); 思路3:利用数组中值和其下标的关系""" def duplicate1(self, arr): """排序后查找""" arr_sorted = sorted(arr) length = len(arr) repeatNum = [] for i in range(1, length): if arr_sorted[i] ==...
the_stack_v2_python_sparse
数组中的重复数字.py
zhanvwei/targetoffer
train
0
80b8a27145294a30172d1616d5b437c084f758de
[ "logger.info('%s initialization' % obj.name)\nsuper(self.__class__, self).__init__(obj, parent)\nself._kuka_armature = None\nfor child in self.robot_parent.blender_obj.children:\n if str(child) == self.blender_obj['KUKAname']:\n self._kuka_armature = child\n break\nif self._kuka_armature:\n logg...
<|body_start_0|> logger.info('%s initialization' % obj.name) super(self.__class__, self).__init__(obj, parent) self._kuka_armature = None for child in self.robot_parent.blender_obj.children: if str(child) == self.blender_obj['KUKAname']: self._kuka_armature = ...
KUKA posture sensor Reads the position of the KUKA LWR arm with respect to the robot, as well as the angles of each of the segments.
KukaPostureClass
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KukaPostureClass: """KUKA posture sensor Reads the position of the KUKA LWR arm with respect to the robot, as well as the angles of each of the segments.""" def __init__(self, obj, parent=None): """Constructor method. Receives the reference to the Blender object. The second parameter...
stack_v2_sparse_classes_36k_train_000940
3,200
permissive
[ { "docstring": "Constructor method. Receives the reference to the Blender object. The second parameter should be the name of the object's parent.", "name": "__init__", "signature": "def __init__(self, obj, parent=None)" }, { "docstring": "Get the x, y, z, yaw, pitch and roll of the KUKA armature...
2
stack_v2_sparse_classes_30k_train_008762
Implement the Python class `KukaPostureClass` described below. Class description: KUKA posture sensor Reads the position of the KUKA LWR arm with respect to the robot, as well as the angles of each of the segments. Method signatures and docstrings: - def __init__(self, obj, parent=None): Constructor method. Receives ...
Implement the Python class `KukaPostureClass` described below. Class description: KUKA posture sensor Reads the position of the KUKA LWR arm with respect to the robot, as well as the angles of each of the segments. Method signatures and docstrings: - def __init__(self, obj, parent=None): Constructor method. Receives ...
07fcb64fea3b58b258e917eb1aed0a585f863418
<|skeleton|> class KukaPostureClass: """KUKA posture sensor Reads the position of the KUKA LWR arm with respect to the robot, as well as the angles of each of the segments.""" def __init__(self, obj, parent=None): """Constructor method. Receives the reference to the Blender object. The second parameter...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class KukaPostureClass: """KUKA posture sensor Reads the position of the KUKA LWR arm with respect to the robot, as well as the angles of each of the segments.""" def __init__(self, obj, parent=None): """Constructor method. Receives the reference to the Blender object. The second parameter should be th...
the_stack_v2_python_sparse
src/morse/sensors/kuka_posture.py
DefaultUser/morse
train
2
a1d8254c5eac458e2824f9d6a472f098b9fcb162
[ "add_furniture('invoice.csv', 'Elisa Miles', 'LR04', 'Leather Sofa', 25)\nadd_furniture('invoice.csv', 'Edward Data', 'KT78', 'Kitchen Table', 10)\nadd_furniture('invoice.csv', 'Alex Gonzales', 'BR02', 'Queen Mattress', 17)\nwith open('invoice.csv', 'r') as csvfile:\n rentals = []\n for row in csvfile:\n ...
<|body_start_0|> add_furniture('invoice.csv', 'Elisa Miles', 'LR04', 'Leather Sofa', 25) add_furniture('invoice.csv', 'Edward Data', 'KT78', 'Kitchen Table', 10) add_furniture('invoice.csv', 'Alex Gonzales', 'BR02', 'Queen Mattress', 17) with open('invoice.csv', 'r') as csvfile: ...
Class to test inventory module.
TestIventory
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestIventory: """Class to test inventory module.""" def test_add_furniture(self): """Function to test add furniture functionality.""" <|body_0|> def test_single_customer(self): """Tests single customer functionality.""" <|body_1|> <|end_skeleton|> <|bod...
stack_v2_sparse_classes_36k_train_000941
1,649
no_license
[ { "docstring": "Function to test add furniture functionality.", "name": "test_add_furniture", "signature": "def test_add_furniture(self)" }, { "docstring": "Tests single customer functionality.", "name": "test_single_customer", "signature": "def test_single_customer(self)" } ]
2
stack_v2_sparse_classes_30k_train_001264
Implement the Python class `TestIventory` described below. Class description: Class to test inventory module. Method signatures and docstrings: - def test_add_furniture(self): Function to test add furniture functionality. - def test_single_customer(self): Tests single customer functionality.
Implement the Python class `TestIventory` described below. Class description: Class to test inventory module. Method signatures and docstrings: - def test_add_furniture(self): Function to test add furniture functionality. - def test_single_customer(self): Tests single customer functionality. <|skeleton|> class TestI...
5dac60f39e3909ff05b26721d602ed20f14d6be3
<|skeleton|> class TestIventory: """Class to test inventory module.""" def test_add_furniture(self): """Function to test add furniture functionality.""" <|body_0|> def test_single_customer(self): """Tests single customer functionality.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestIventory: """Class to test inventory module.""" def test_add_furniture(self): """Function to test add furniture functionality.""" add_furniture('invoice.csv', 'Elisa Miles', 'LR04', 'Leather Sofa', 25) add_furniture('invoice.csv', 'Edward Data', 'KT78', 'Kitchen Table', 10) ...
the_stack_v2_python_sparse
students/N0vA/lesson08/assignment/test_inventory.py
JavaRod/SP_Python220B_2019
train
1
ec33a05dbb323ad494cc41199be616575efe12d6
[ "result = {}\nfor i in nums:\n result[i] = result.get(i, 0) + 1\nfor k, v in result.items():\n if v == 1:\n return k", "res = 0\nfor i in range(3):\n for num in nums:\n res ^= num\nreturn res" ]
<|body_start_0|> result = {} for i in nums: result[i] = result.get(i, 0) + 1 for k, v in result.items(): if v == 1: return k <|end_body_0|> <|body_start_1|> res = 0 for i in range(3): for num in nums: res ^= num...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def singleNumber_1(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def singleNumber_2(self, nums): """:type nums: List[int] :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> result = {} for i in nums: ...
stack_v2_sparse_classes_36k_train_000942
582
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "singleNumber_1", "signature": "def singleNumber_1(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int", "name": "singleNumber_2", "signature": "def singleNumber_2(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_020821
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def singleNumber_1(self, nums): :type nums: List[int] :rtype: int - def singleNumber_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 singleNumber_1(self, nums): :type nums: List[int] :rtype: int - def singleNumber_2(self, nums): :type nums: List[int] :rtype: int <|skeleton|> class Solution: def singl...
8a62b397a5fa107c70efc8ea65d0edfb74f8baa7
<|skeleton|> class Solution: def singleNumber_1(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def singleNumber_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 singleNumber_1(self, nums): """:type nums: List[int] :rtype: int""" result = {} for i in nums: result[i] = result.get(i, 0) + 1 for k, v in result.items(): if v == 1: return k def singleNumber_2(self, nums): """...
the_stack_v2_python_sparse
LeetCode-Solution/Algorithms/Single-Number-II.py
LFYG/leetcode-acm-euler-other
train
0
744b85f377a0d84048fbf5c614a594194706623f
[ "processed = 0\nfor base in queryset:\n base.ResetNames()\n processed += 1\nself.message_user(request, '%s reset.' % GetMessageBit(processed))", "processed = 0\nfor base in queryset:\n base.stateManaged = 'new'\n base.ResetNames()\n processed += 1\nself.message_user(request, '%s reset and marked as...
<|body_start_0|> processed = 0 for base in queryset: base.ResetNames() processed += 1 self.message_user(request, '%s reset.' % GetMessageBit(processed)) <|end_body_0|> <|body_start_1|> processed = 0 for base in queryset: base.stateManaged = 'n...
XrumerBaseRawAdmin
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class XrumerBaseRawAdmin: def ResetNames(self, request, queryset): """Сбрасываем имена""" <|body_0|> def ResetNamesAndNew(self, request, queryset): """Сбрасываем имена и помечаем как новые""" <|body_1|> <|end_skeleton|> <|body_start_0|> processed = 0 ...
stack_v2_sparse_classes_36k_train_000943
29,849
no_license
[ { "docstring": "Сбрасываем имена", "name": "ResetNames", "signature": "def ResetNames(self, request, queryset)" }, { "docstring": "Сбрасываем имена и помечаем как новые", "name": "ResetNamesAndNew", "signature": "def ResetNamesAndNew(self, request, queryset)" } ]
2
stack_v2_sparse_classes_30k_train_015610
Implement the Python class `XrumerBaseRawAdmin` described below. Class description: Implement the XrumerBaseRawAdmin class. Method signatures and docstrings: - def ResetNames(self, request, queryset): Сбрасываем имена - def ResetNamesAndNew(self, request, queryset): Сбрасываем имена и помечаем как новые
Implement the Python class `XrumerBaseRawAdmin` described below. Class description: Implement the XrumerBaseRawAdmin class. Method signatures and docstrings: - def ResetNames(self, request, queryset): Сбрасываем имена - def ResetNamesAndNew(self, request, queryset): Сбрасываем имена и помечаем как новые <|skeleton|>...
d2771bf04aa187dda6d468883a5a167237589369
<|skeleton|> class XrumerBaseRawAdmin: def ResetNames(self, request, queryset): """Сбрасываем имена""" <|body_0|> def ResetNamesAndNew(self, request, queryset): """Сбрасываем имена и помечаем как новые""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class XrumerBaseRawAdmin: def ResetNames(self, request, queryset): """Сбрасываем имена""" processed = 0 for base in queryset: base.ResetNames() processed += 1 self.message_user(request, '%s reset.' % GetMessageBit(processed)) def ResetNamesAndNew(self, re...
the_stack_v2_python_sparse
doorsadmin/admin.py
cash2one/doorscenter
train
0
936171128a03de9b1c3fb1b3ceefea5cd224a70e
[ "super(FastGradientMethod, self).__init__(model, sess, dtypestr, **kwargs)\nself.feedable_kwargs = ('eps', 'y', 'y_target', 'clip_min', 'clip_max')\nself.structural_kwargs = ['ord', 'sanity_checks']", "assert self.parse_params(**kwargs)\nlabels, _nb_classes = self.get_or_guess_labels(x, kwargs)\nreturn fgm(x, sel...
<|body_start_0|> super(FastGradientMethod, self).__init__(model, sess, dtypestr, **kwargs) self.feedable_kwargs = ('eps', 'y', 'y_target', 'clip_min', 'clip_max') self.structural_kwargs = ['ord', 'sanity_checks'] <|end_body_0|> <|body_start_1|> assert self.parse_params(**kwargs) ...
This attack was originally implemented by Goodfellow et al. (2014) with the infinity norm (and is known as the "Fast Gradient Sign Method"). This implementation extends the attack to other norms, and is therefore called the Fast Gradient Method. Paper link: https://arxiv.org/abs/1412.6572 :param model: cleverhans.model...
FastGradientMethod
[ "MIT", "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FastGradientMethod: """This attack was originally implemented by Goodfellow et al. (2014) with the infinity norm (and is known as the "Fast Gradient Sign Method"). This implementation extends the attack to other norms, and is therefore called the Fast Gradient Method. Paper link: https://arxiv.or...
stack_v2_sparse_classes_36k_train_000944
8,992
permissive
[ { "docstring": "Create a FastGradientMethod instance. Note: the model parameter should be an instance of the cleverhans.model.Model abstraction provided by CleverHans.", "name": "__init__", "signature": "def __init__(self, model, sess=None, dtypestr='float32', **kwargs)" }, { "docstring": "Retur...
3
stack_v2_sparse_classes_30k_val_000287
Implement the Python class `FastGradientMethod` described below. Class description: This attack was originally implemented by Goodfellow et al. (2014) with the infinity norm (and is known as the "Fast Gradient Sign Method"). This implementation extends the attack to other norms, and is therefore called the Fast Gradie...
Implement the Python class `FastGradientMethod` described below. Class description: This attack was originally implemented by Goodfellow et al. (2014) with the infinity norm (and is known as the "Fast Gradient Sign Method"). This implementation extends the attack to other norms, and is therefore called the Fast Gradie...
bbe96757fa7daded0090b1d9a26b9c90d7d87c61
<|skeleton|> class FastGradientMethod: """This attack was originally implemented by Goodfellow et al. (2014) with the infinity norm (and is known as the "Fast Gradient Sign Method"). This implementation extends the attack to other norms, and is therefore called the Fast Gradient Method. Paper link: https://arxiv.or...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FastGradientMethod: """This attack was originally implemented by Goodfellow et al. (2014) with the infinity norm (and is known as the "Fast Gradient Sign Method"). This implementation extends the attack to other norms, and is therefore called the Fast Gradient Method. Paper link: https://arxiv.org/abs/1412.65...
the_stack_v2_python_sparse
cleverhans/attacks/fast_gradient_method.py
yogeshbalaji/InvGAN
train
17
81f3be23bafc0cb0cd1e9c8d2e66e66e8b0cce95
[ "self.filtered_mails = self._get_filtered_mails(mails, code_and_mail)\nself._get_sorted_mails()\nself.mails = sorted(mails, key=lambda x: x.is_ok)", "if isinstance(value, int) or isinstance(value, slice):\n return self.mails[value]\nraise IndexError", "if isinstance(value, Good):\n return self.good_mails\...
<|body_start_0|> self.filtered_mails = self._get_filtered_mails(mails, code_and_mail) self._get_sorted_mails() self.mails = sorted(mails, key=lambda x: x.is_ok) <|end_body_0|> <|body_start_1|> if isinstance(value, int) or isinstance(value, slice): return self.mails[value] ...
MailFilter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MailFilter: def __init__(self, mails, code_and_mail, *args, **kwargs): """The main class for sorting and filtering the list of emails. Accepts a list of emails, filtering conditions. Performs filtering, sorting and storage of the received data. Args: mails (list): list of unsorted, unfil...
stack_v2_sparse_classes_36k_train_000945
3,285
no_license
[ { "docstring": "The main class for sorting and filtering the list of emails. Accepts a list of emails, filtering conditions. Performs filtering, sorting and storage of the received data. Args: mails (list): list of unsorted, unfiltered emails code_and_mail (list): List of emails and codes to filter by.", "n...
5
stack_v2_sparse_classes_30k_train_017794
Implement the Python class `MailFilter` described below. Class description: Implement the MailFilter class. Method signatures and docstrings: - def __init__(self, mails, code_and_mail, *args, **kwargs): The main class for sorting and filtering the list of emails. Accepts a list of emails, filtering conditions. Perfor...
Implement the Python class `MailFilter` described below. Class description: Implement the MailFilter class. Method signatures and docstrings: - def __init__(self, mails, code_and_mail, *args, **kwargs): The main class for sorting and filtering the list of emails. Accepts a list of emails, filtering conditions. Perfor...
65f528d18d7e50ab17eff4fa2abfe8345fda60d1
<|skeleton|> class MailFilter: def __init__(self, mails, code_and_mail, *args, **kwargs): """The main class for sorting and filtering the list of emails. Accepts a list of emails, filtering conditions. Performs filtering, sorting and storage of the received data. Args: mails (list): list of unsorted, unfil...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MailFilter: def __init__(self, mails, code_and_mail, *args, **kwargs): """The main class for sorting and filtering the list of emails. Accepts a list of emails, filtering conditions. Performs filtering, sorting and storage of the received data. Args: mails (list): list of unsorted, unfiltered emails c...
the_stack_v2_python_sparse
search_dead_mail/MailFilter.py
dmitriyVasilievich1986/mail_parser
train
0
1b22e51a104766169a7bf7481defce0a96734664
[ "caseversions = dict(((unicode(x.id), x) for x in model.CaseVersion.objects.filter(pk__in=self.cleaned_data['caseversions'])))\ntry:\n return [caseversions[x] for x in self.cleaned_data['caseversions']]\nexcept KeyError as e:\n raise ValidationError('Not a valid caseversion for this tag.')", "user = user or...
<|body_start_0|> caseversions = dict(((unicode(x.id), x) for x in model.CaseVersion.objects.filter(pk__in=self.cleaned_data['caseversions']))) try: return [caseversions[x] for x in self.cleaned_data['caseversions']] except KeyError as e: raise ValidationError('Not a valid...
Base form for tags.
TagForm
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TagForm: """Base form for tags.""" def clean_caseversions(self): """Make sure all the ids for the cases are valid and populate self.cleaned_data with the real objects.""" <|body_0|> def save(self, user=None): """Save the tag and case associations.""" <|bo...
stack_v2_sparse_classes_36k_train_000946
4,627
permissive
[ { "docstring": "Make sure all the ids for the cases are valid and populate self.cleaned_data with the real objects.", "name": "clean_caseversions", "signature": "def clean_caseversions(self)" }, { "docstring": "Save the tag and case associations.", "name": "save", "signature": "def save(...
2
stack_v2_sparse_classes_30k_train_016886
Implement the Python class `TagForm` described below. Class description: Base form for tags. Method signatures and docstrings: - def clean_caseversions(self): Make sure all the ids for the cases are valid and populate self.cleaned_data with the real objects. - def save(self, user=None): Save the tag and case associat...
Implement the Python class `TagForm` described below. Class description: Base form for tags. Method signatures and docstrings: - def clean_caseversions(self): Make sure all the ids for the cases are valid and populate self.cleaned_data with the real objects. - def save(self, user=None): Save the tag and case associat...
ee54db2fe8ffbf2216d359b7a093b51f2574878e
<|skeleton|> class TagForm: """Base form for tags.""" def clean_caseversions(self): """Make sure all the ids for the cases are valid and populate self.cleaned_data with the real objects.""" <|body_0|> def save(self, user=None): """Save the tag and case associations.""" <|bo...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TagForm: """Base form for tags.""" def clean_caseversions(self): """Make sure all the ids for the cases are valid and populate self.cleaned_data with the real objects.""" caseversions = dict(((unicode(x.id), x) for x in model.CaseVersion.objects.filter(pk__in=self.cleaned_data['caseversio...
the_stack_v2_python_sparse
moztrap/view/manage/tags/forms.py
isakib/moztrap
train
1
52c8bbd470a30b42bb1da00520ae10a00ae7a648
[ "super(SoftwareSpriteRenderSystem, self).__init__()\nif isinstance(window, Window):\n self.window = window.window\nelif isinstance(window, video.SDL_Window):\n self.window = window\nelse:\n raise TypeError('unsupported window type')\nself.target = window\nsfc = video.SDL_GetWindowSurface(self.window)\nif n...
<|body_start_0|> super(SoftwareSpriteRenderSystem, self).__init__() if isinstance(window, Window): self.window = window.window elif isinstance(window, video.SDL_Window): self.window = window else: raise TypeError('unsupported window type') self...
A rendering system for SoftwareSprite components. The SoftwareSpriteRenderSystem class uses a Window as drawing device to display Sprite surfaces. It uses the Window's internal SDL surface as drawing context, so that GL operations, such as texture handling or using SDL renderers is not possible.
SoftwareSpriteRenderSystem
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SoftwareSpriteRenderSystem: """A rendering system for SoftwareSprite components. The SoftwareSpriteRenderSystem class uses a Window as drawing device to display Sprite surfaces. It uses the Window's internal SDL surface as drawing context, so that GL operations, such as texture handling or using ...
stack_v2_sparse_classes_36k_train_000947
14,308
permissive
[ { "docstring": "Creates a new SoftwareSpriteRenderSystem for a specific Window.", "name": "__init__", "signature": "def __init__(self, window)" }, { "docstring": "Draws the passed sprites (or sprite) on the Window's surface. x and y are optional arguments that can be used as relative drawing loc...
2
stack_v2_sparse_classes_30k_train_016285
Implement the Python class `SoftwareSpriteRenderSystem` described below. Class description: A rendering system for SoftwareSprite components. The SoftwareSpriteRenderSystem class uses a Window as drawing device to display Sprite surfaces. It uses the Window's internal SDL surface as drawing context, so that GL operati...
Implement the Python class `SoftwareSpriteRenderSystem` described below. Class description: A rendering system for SoftwareSprite components. The SoftwareSpriteRenderSystem class uses a Window as drawing device to display Sprite surfaces. It uses the Window's internal SDL surface as drawing context, so that GL operati...
29f79c41cfb49ea5b1dd1bec559795727e868558
<|skeleton|> class SoftwareSpriteRenderSystem: """A rendering system for SoftwareSprite components. The SoftwareSpriteRenderSystem class uses a Window as drawing device to display Sprite surfaces. It uses the Window's internal SDL surface as drawing context, so that GL operations, such as texture handling or using ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SoftwareSpriteRenderSystem: """A rendering system for SoftwareSprite components. The SoftwareSpriteRenderSystem class uses a Window as drawing device to display Sprite surfaces. It uses the Window's internal SDL surface as drawing context, so that GL operations, such as texture handling or using SDL renderers...
the_stack_v2_python_sparse
blimgui/dist/sdl2/ext/spritesystem.py
juso40/bl2sdk_Mods
train
42
a3a0f9b0c8bb55c12b2b8985915613ad842347cf
[ "if 'Sub Path' in data_source_dict:\n merged_path = data_source_dict['Path'] + job_id + data_source_dict['Subpath']\n del data_source_dict['Subpath']\nelse:\n merged_path = data_source_dict['Path']\nreturn merged_path", "data_source_args = {}\nservice = service_factory.create_service(data_source_dict)\np...
<|body_start_0|> if 'Sub Path' in data_source_dict: merged_path = data_source_dict['Path'] + job_id + data_source_dict['Subpath'] del data_source_dict['Subpath'] else: merged_path = data_source_dict['Path'] return merged_path <|end_body_0|> <|body_start_1|> ...
A factory for creating data sources
DataSourceFactory
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataSourceFactory: """A factory for creating data sources""" def _merge_path(self, job_id, data_source_dict): """Merges the path, job id, and subpath. Returns it as a string""" <|body_0|> def create_data_source(self, job_id, data_source_dict): """Creates one data...
stack_v2_sparse_classes_36k_train_000948
1,577
no_license
[ { "docstring": "Merges the path, job id, and subpath. Returns it as a string", "name": "_merge_path", "signature": "def _merge_path(self, job_id, data_source_dict)" }, { "docstring": "Creates one data source given a job id, and a data_source_dict (from DataSources.json)", "name": "create_dat...
3
stack_v2_sparse_classes_30k_train_009755
Implement the Python class `DataSourceFactory` described below. Class description: A factory for creating data sources Method signatures and docstrings: - def _merge_path(self, job_id, data_source_dict): Merges the path, job id, and subpath. Returns it as a string - def create_data_source(self, job_id, data_source_di...
Implement the Python class `DataSourceFactory` described below. Class description: A factory for creating data sources Method signatures and docstrings: - def _merge_path(self, job_id, data_source_dict): Merges the path, job id, and subpath. Returns it as a string - def create_data_source(self, job_id, data_source_di...
c69fe121799d72d5239d2da59577e9c1b7a9c51c
<|skeleton|> class DataSourceFactory: """A factory for creating data sources""" def _merge_path(self, job_id, data_source_dict): """Merges the path, job id, and subpath. Returns it as a string""" <|body_0|> def create_data_source(self, job_id, data_source_dict): """Creates one data...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DataSourceFactory: """A factory for creating data sources""" def _merge_path(self, job_id, data_source_dict): """Merges the path, job id, and subpath. Returns it as a string""" if 'Sub Path' in data_source_dict: merged_path = data_source_dict['Path'] + job_id + data_source_dic...
the_stack_v2_python_sparse
Factories/data_source_factory.py
McFunston/PythonScheduleTools
train
1
a6cb4bd1c560abaad1a0deaffc2214891c6453fa
[ "super(TemplateAngleEmbedder, self).__init__()\nself.c_out = c_out\nself.c_in = c_in\nself.linear_1 = Linear(self.c_in, self.c_out, init='relu')\nself.relu = nn.ReLU()\nself.linear_2 = Linear(self.c_out, self.c_out, init='relu')", "x = self.linear_1(x)\nx = self.relu(x)\nx = self.linear_2(x)\nreturn x" ]
<|body_start_0|> super(TemplateAngleEmbedder, self).__init__() self.c_out = c_out self.c_in = c_in self.linear_1 = Linear(self.c_in, self.c_out, init='relu') self.relu = nn.ReLU() self.linear_2 = Linear(self.c_out, self.c_out, init='relu') <|end_body_0|> <|body_start_1|>...
Embeds the "template_angle_feat" feature. Implements Algorithm 2, line 7.
TemplateAngleEmbedder
[ "Apache-2.0", "CC-BY-4.0", "LicenseRef-scancode-other-permissive", "CC-BY-NC-4.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TemplateAngleEmbedder: """Embeds the "template_angle_feat" feature. Implements Algorithm 2, line 7.""" def __init__(self, c_in: int, c_out: int, **kwargs): """Args: c_in: Final dimension of "template_angle_feat" c_out: Output channel dimension""" <|body_0|> def forward(s...
stack_v2_sparse_classes_36k_train_000949
9,577
permissive
[ { "docstring": "Args: c_in: Final dimension of \"template_angle_feat\" c_out: Output channel dimension", "name": "__init__", "signature": "def __init__(self, c_in: int, c_out: int, **kwargs)" }, { "docstring": "Args: x: [*, N_templ, N_res, c_in] \"template_angle_feat\" features Returns: x: [*, N...
2
stack_v2_sparse_classes_30k_train_016109
Implement the Python class `TemplateAngleEmbedder` described below. Class description: Embeds the "template_angle_feat" feature. Implements Algorithm 2, line 7. Method signatures and docstrings: - def __init__(self, c_in: int, c_out: int, **kwargs): Args: c_in: Final dimension of "template_angle_feat" c_out: Output c...
Implement the Python class `TemplateAngleEmbedder` described below. Class description: Embeds the "template_angle_feat" feature. Implements Algorithm 2, line 7. Method signatures and docstrings: - def __init__(self, c_in: int, c_out: int, **kwargs): Args: c_in: Final dimension of "template_angle_feat" c_out: Output c...
2134cc09b3994b6280e6e3c569dd7d761e4da7a0
<|skeleton|> class TemplateAngleEmbedder: """Embeds the "template_angle_feat" feature. Implements Algorithm 2, line 7.""" def __init__(self, c_in: int, c_out: int, **kwargs): """Args: c_in: Final dimension of "template_angle_feat" c_out: Output channel dimension""" <|body_0|> def forward(s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TemplateAngleEmbedder: """Embeds the "template_angle_feat" feature. Implements Algorithm 2, line 7.""" def __init__(self, c_in: int, c_out: int, **kwargs): """Args: c_in: Final dimension of "template_angle_feat" c_out: Output channel dimension""" super(TemplateAngleEmbedder, self).__init_...
the_stack_v2_python_sparse
openfold/model/embedders.py
aqlaboratory/openfold
train
2,033
235bea81a7895dc78c4ca7bd704cd9fc6093faec
[ "def check_supported_spec(spec):\n if spec.is_discrete:\n assert np.min(spec.minimum) == np.max(spec.minimum) == 0\n assert np.min(spec.maximum) == np.max(spec.maximum)\nalf.nest.map_structure(check_supported_spec, action_spec)\nself._action_spec = action_spec\nsuper().__init__(input_tensor_spec=ac...
<|body_start_0|> def check_supported_spec(spec): if spec.is_discrete: assert np.min(spec.minimum) == np.max(spec.minimum) == 0 assert np.min(spec.maximum) == np.max(spec.maximum) alf.nest.map_structure(check_supported_spec, action_spec) self._action_sp...
A simple encoder for action. It encodes discrete action to one hot representation and use the original continous actions. The output is the concat of all of them after flattening.
SimpleActionEncoder
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SimpleActionEncoder: """A simple encoder for action. It encodes discrete action to one hot representation and use the original continous actions. The output is the concat of all of them after flattening.""" def __init__(self, action_spec): """Args: action_spec (nested BoundedTensorSp...
stack_v2_sparse_classes_36k_train_000950
2,719
permissive
[ { "docstring": "Args: action_spec (nested BoundedTensorSpec): spec for actions", "name": "__init__", "signature": "def __init__(self, action_spec)" }, { "docstring": "Generate encoded actions. Args: inputs (nested Tensor): action tensors. Returns: nested Tensor with the same structure as inputs....
2
null
Implement the Python class `SimpleActionEncoder` described below. Class description: A simple encoder for action. It encodes discrete action to one hot representation and use the original continous actions. The output is the concat of all of them after flattening. Method signatures and docstrings: - def __init__(self...
Implement the Python class `SimpleActionEncoder` described below. Class description: A simple encoder for action. It encodes discrete action to one hot representation and use the original continous actions. The output is the concat of all of them after flattening. Method signatures and docstrings: - def __init__(self...
b00ff2fa5e660de31020338ba340263183fbeaa4
<|skeleton|> class SimpleActionEncoder: """A simple encoder for action. It encodes discrete action to one hot representation and use the original continous actions. The output is the concat of all of them after flattening.""" def __init__(self, action_spec): """Args: action_spec (nested BoundedTensorSp...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SimpleActionEncoder: """A simple encoder for action. It encodes discrete action to one hot representation and use the original continous actions. The output is the concat of all of them after flattening.""" def __init__(self, action_spec): """Args: action_spec (nested BoundedTensorSpec): spec for...
the_stack_v2_python_sparse
alf/networks/action_encoder.py
HorizonRobotics/alf
train
288
df5be540ac69cca4a7b4617e13b9ae3d3c9a4950
[ "if show_columns is not None:\n self.all_extra_data_columns = show_columns['extra_data']\nelse:\n self.all_extra_data_columns = all_extra_data_columns\nsuper().__init__(instance=instance, data=data, **kwargs)\nif show_columns is not None:\n for field_name in set(self.fields) - set(show_columns['fields']):\...
<|body_start_0|> if show_columns is not None: self.all_extra_data_columns = show_columns['extra_data'] else: self.all_extra_data_columns = all_extra_data_columns super().__init__(instance=instance, data=data, **kwargs) if show_columns is not None: for ...
PropertyStateSerializer
[ "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PropertyStateSerializer: def __init__(self, instance=None, data=empty, all_extra_data_columns=None, show_columns=None, **kwargs): """If show_columns is passed, then all_extra_data_columns is not needed since the extra_data columns are embedded in the show_columns. TODO: remove the use of...
stack_v2_sparse_classes_36k_train_000951
26,431
permissive
[ { "docstring": "If show_columns is passed, then all_extra_data_columns is not needed since the extra_data columns are embedded in the show_columns. TODO: remove the use of all_extra_data_columns. :param instance: instance to serialize :param data: initial data :param all_extra_data_columns: :param show_columns:...
2
null
Implement the Python class `PropertyStateSerializer` described below. Class description: Implement the PropertyStateSerializer class. Method signatures and docstrings: - def __init__(self, instance=None, data=empty, all_extra_data_columns=None, show_columns=None, **kwargs): If show_columns is passed, then all_extra_d...
Implement the Python class `PropertyStateSerializer` described below. Class description: Implement the PropertyStateSerializer class. Method signatures and docstrings: - def __init__(self, instance=None, data=empty, all_extra_data_columns=None, show_columns=None, **kwargs): If show_columns is passed, then all_extra_d...
680b6a2b45f3c568d779d8ac86553a0b08c384c8
<|skeleton|> class PropertyStateSerializer: def __init__(self, instance=None, data=empty, all_extra_data_columns=None, show_columns=None, **kwargs): """If show_columns is passed, then all_extra_data_columns is not needed since the extra_data columns are embedded in the show_columns. TODO: remove the use of...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PropertyStateSerializer: def __init__(self, instance=None, data=empty, all_extra_data_columns=None, show_columns=None, **kwargs): """If show_columns is passed, then all_extra_data_columns is not needed since the extra_data columns are embedded in the show_columns. TODO: remove the use of all_extra_dat...
the_stack_v2_python_sparse
seed/serializers/properties.py
SEED-platform/seed
train
108
2f567c0151d0bbff6c870e7e35b7da609417104c
[ "try:\n paths = GetPath()\n config_file_path = paths.config_path()\n config = configparser.RawConfigParser()\n config.read(config_file_path)\n return config\nexcept Exception as e:\n self.log.error('Error while reading config.ini file' + str(e))\n return None", "try:\n config = self.get_co...
<|body_start_0|> try: paths = GetPath() config_file_path = paths.config_path() config = configparser.RawConfigParser() config.read(config_file_path) return config except Exception as e: self.log.error('Error while reading config.ini...
ReadConfig
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ReadConfig: def get_config_file(self): """Get config.ini""" <|body_0|> def get_property_value(self, section: str, key: str) -> str: """Returns property value for give key. If key is password first it decrypt the encrypted password and return it""" <|body_1|> ...
stack_v2_sparse_classes_36k_train_000952
1,542
no_license
[ { "docstring": "Get config.ini", "name": "get_config_file", "signature": "def get_config_file(self)" }, { "docstring": "Returns property value for give key. If key is password first it decrypt the encrypted password and return it", "name": "get_property_value", "signature": "def get_prop...
2
stack_v2_sparse_classes_30k_train_008870
Implement the Python class `ReadConfig` described below. Class description: Implement the ReadConfig class. Method signatures and docstrings: - def get_config_file(self): Get config.ini - def get_property_value(self, section: str, key: str) -> str: Returns property value for give key. If key is password first it decr...
Implement the Python class `ReadConfig` described below. Class description: Implement the ReadConfig class. Method signatures and docstrings: - def get_config_file(self): Get config.ini - def get_property_value(self, section: str, key: str) -> str: Returns property value for give key. If key is password first it decr...
282ddcc37659fdd65bd35d8c078bf47cc649f5eb
<|skeleton|> class ReadConfig: def get_config_file(self): """Get config.ini""" <|body_0|> def get_property_value(self, section: str, key: str) -> str: """Returns property value for give key. If key is password first it decrypt the encrypted password and return it""" <|body_1|> ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ReadConfig: def get_config_file(self): """Get config.ini""" try: paths = GetPath() config_file_path = paths.config_path() config = configparser.RawConfigParser() config.read(config_file_path) return config except Exception as ...
the_stack_v2_python_sparse
utilities/read_config.py
halchal14naresh/MyPython_drone_BS_TestRail
train
0
505a5f59f61a0cc2900ea99f1e91de466ac2f96d
[ "def helper(root, ret, cache):\n if not root:\n cache.append('')\n return False\n ret += cache\n ret.append(str(root.val))\n return True\nif not root:\n return ''\nqueue = list([root])\nret = list()\ncache = list()\nwhile queue:\n node = queue.pop(0)\n if helper(node, ret, cache):...
<|body_start_0|> def helper(root, ret, cache): if not root: cache.append('') return False ret += cache ret.append(str(root.val)) return True if not root: return '' queue = list([root]) ret = list(...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|> <|body_...
stack_v2_sparse_classes_36k_train_000953
1,855
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_val_001147
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root): Encodes a tree to a single string. :type root: TreeNode :rtype: str - def deserialize(self, data): Decodes your encoded data to tree. :type data: str :rtype:...
73d65512eef07475b5790864cce1fdf3f6f4277a
<|skeleton|> class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" <|body_0|> def deserialize(self, data): """Decodes your encoded data to tree. :type data: str :rtype: TreeNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" def helper(root, ret, cache): if not root: cache.append('') return False ret += cache ret.append(str(root.val)) ...
the_stack_v2_python_sparse
leetcode/serialize-and-deserialize-binary-tree-bfs.py
Jingwu010/Code-Practice
train
0
1d302630b056840b480fda2d2084d23aac60171e
[ "from .designs_pyx import is_group_divisible_design\nself._lambd = lambd\nIncidenceStructure.__init__(self, points, blocks, copy=copy, check=False, **kwds)\nif groups is None or (copy is False and self._point_to_index is None):\n self._groups = groups\nelif self._point_to_index is None:\n self._groups = [g[:]...
<|body_start_0|> from .designs_pyx import is_group_divisible_design self._lambd = lambd IncidenceStructure.__init__(self, points, blocks, copy=copy, check=False, **kwds) if groups is None or (copy is False and self._point_to_index is None): self._groups = groups elif ...
Group Divisible Design (GDD) Let `K` and `G` be sets of positive integers and let `\\lambda` be a positive integer. A Group Divisible Design of index `\\lambda` and order `v` is a triple `(V,\\mathcal G,\\mathcal B)` where: - `V` is a set of cardinality `v` - `\\mathcal G` is a partition of `V` into groups whose size b...
GroupDivisibleDesign
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GroupDivisibleDesign: """Group Divisible Design (GDD) Let `K` and `G` be sets of positive integers and let `\\lambda` be a positive integer. A Group Divisible Design of index `\\lambda` and order `v` is a triple `(V,\\mathcal G,\\mathcal B)` where: - `V` is a set of cardinality `v` - `\\mathcal G...
stack_v2_sparse_classes_36k_train_000954
13,086
no_license
[ { "docstring": "Constructor function EXAMPLE:: sage: from sage.combinat.designs.group_divisible_designs import GroupDivisibleDesign sage: TD = designs.transversal_design(4,10) sage: groups = [list(range(i*10,(i+1)*10)) for i in range(4)] sage: GDD = GroupDivisibleDesign(40,groups,TD); GDD Group Divisible Design...
3
stack_v2_sparse_classes_30k_train_021348
Implement the Python class `GroupDivisibleDesign` described below. Class description: Group Divisible Design (GDD) Let `K` and `G` be sets of positive integers and let `\\lambda` be a positive integer. A Group Divisible Design of index `\\lambda` and order `v` is a triple `(V,\\mathcal G,\\mathcal B)` where: - `V` is ...
Implement the Python class `GroupDivisibleDesign` described below. Class description: Group Divisible Design (GDD) Let `K` and `G` be sets of positive integers and let `\\lambda` be a positive integer. A Group Divisible Design of index `\\lambda` and order `v` is a triple `(V,\\mathcal G,\\mathcal B)` where: - `V` is ...
0d9eacbf74e2acffefde93e39f8bcbec745cdaba
<|skeleton|> class GroupDivisibleDesign: """Group Divisible Design (GDD) Let `K` and `G` be sets of positive integers and let `\\lambda` be a positive integer. A Group Divisible Design of index `\\lambda` and order `v` is a triple `(V,\\mathcal G,\\mathcal B)` where: - `V` is a set of cardinality `v` - `\\mathcal G...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GroupDivisibleDesign: """Group Divisible Design (GDD) Let `K` and `G` be sets of positive integers and let `\\lambda` be a positive integer. A Group Divisible Design of index `\\lambda` and order `v` is a triple `(V,\\mathcal G,\\mathcal B)` where: - `V` is a set of cardinality `v` - `\\mathcal G` is a partit...
the_stack_v2_python_sparse
sage/src/sage/combinat/designs/group_divisible_designs.py
bopopescu/geosci
train
0
80faf38a113b2b0d7dbaa76430b3edfbe3d40b68
[ "self.label_size = FLAGS.num_classes\nself.batch_size = FLAGS.batch_size\nself.num_sampled = FLAGS.num_sampled\nself.sentence_length = FLAGS.sequence_length\nself.vocab_size = FLAGS.vocab_size\nself.embed_size = FLAGS.embed_size\nself.is_training = FLAGS.is_training\nself.learning_rate = FLAGS.lr\nself.sentence = t...
<|body_start_0|> self.label_size = FLAGS.num_classes self.batch_size = FLAGS.batch_size self.num_sampled = FLAGS.num_sampled self.sentence_length = FLAGS.sequence_length self.vocab_size = FLAGS.vocab_size self.embed_size = FLAGS.embed_size self.is_training = FLAGS...
fastText
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class fastText: def __init__(self): """init all hyperparameter here""" <|body_0|> def instantiate_weights(self): """define all weights here""" <|body_1|> def inference(self): """main computation graph here: 1.embedding-->2.average-->3.linear classifier...
stack_v2_sparse_classes_36k_train_000955
10,416
no_license
[ { "docstring": "init all hyperparameter here", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "define all weights here", "name": "instantiate_weights", "signature": "def instantiate_weights(self)" }, { "docstring": "main computation graph here: 1.embeddin...
5
stack_v2_sparse_classes_30k_train_006800
Implement the Python class `fastText` described below. Class description: Implement the fastText class. Method signatures and docstrings: - def __init__(self): init all hyperparameter here - def instantiate_weights(self): define all weights here - def inference(self): main computation graph here: 1.embedding-->2.aver...
Implement the Python class `fastText` described below. Class description: Implement the fastText class. Method signatures and docstrings: - def __init__(self): init all hyperparameter here - def instantiate_weights(self): define all weights here - def inference(self): main computation graph here: 1.embedding-->2.aver...
26f7df35bf5b0185ce774e5e866618e025b0993e
<|skeleton|> class fastText: def __init__(self): """init all hyperparameter here""" <|body_0|> def instantiate_weights(self): """define all weights here""" <|body_1|> def inference(self): """main computation graph here: 1.embedding-->2.average-->3.linear classifier...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class fastText: def __init__(self): """init all hyperparameter here""" self.label_size = FLAGS.num_classes self.batch_size = FLAGS.batch_size self.num_sampled = FLAGS.num_sampled self.sentence_length = FLAGS.sequence_length self.vocab_size = FLAGS.vocab_size s...
the_stack_v2_python_sparse
text_classification/fasttext.py
learnerzhang/ai_algorithm
train
1
e59a98f363b7bd16c68401ec92bc39925ceeb51e
[ "result = []\nif n < 1:\n return result\nself.bracket_trace(result, '', 0, 0, n)\nreturn result", "if len(s) == 2 * n:\n result.append(s)\nif left < n:\n self.bracket_trace(result, s + '(', left + 1, right, n)\nif right < left:\n self.bracket_trace(result, s + ')', left, right + 1, n)" ]
<|body_start_0|> result = [] if n < 1: return result self.bracket_trace(result, '', 0, 0, n) return result <|end_body_0|> <|body_start_1|> if len(s) == 2 * n: result.append(s) if left < n: self.bracket_trace(result, s + '(', left + 1, ...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def generate_parentheses(self, n: int) -> List[str]: """按照要求生成括号字符串 Args: n: 括号对长度 Returns: 链表""" <|body_0|> def bracket_trace(self, result, s: str, left: int, right: int, n: int): """递归遍历括号 Args: result: 结果集 s: 字符串 left: 左边 right: 右边 n: 长度""" <|bod...
stack_v2_sparse_classes_36k_train_000956
2,020
permissive
[ { "docstring": "按照要求生成括号字符串 Args: n: 括号对长度 Returns: 链表", "name": "generate_parentheses", "signature": "def generate_parentheses(self, n: int) -> List[str]" }, { "docstring": "递归遍历括号 Args: result: 结果集 s: 字符串 left: 左边 right: 右边 n: 长度", "name": "bracket_trace", "signature": "def bracket_tra...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def generate_parentheses(self, n: int) -> List[str]: 按照要求生成括号字符串 Args: n: 括号对长度 Returns: 链表 - def bracket_trace(self, result, s: str, left: int, right: int, n: int): 递归遍历括号 Args:...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def generate_parentheses(self, n: int) -> List[str]: 按照要求生成括号字符串 Args: n: 括号对长度 Returns: 链表 - def bracket_trace(self, result, s: str, left: int, right: int, n: int): 递归遍历括号 Args:...
50f35eef6a0ad63173efed10df3c835b1dceaa3f
<|skeleton|> class Solution: def generate_parentheses(self, n: int) -> List[str]: """按照要求生成括号字符串 Args: n: 括号对长度 Returns: 链表""" <|body_0|> def bracket_trace(self, result, s: str, left: int, right: int, n: int): """递归遍历括号 Args: result: 结果集 s: 字符串 left: 左边 right: 右边 n: 长度""" <|bod...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def generate_parentheses(self, n: int) -> List[str]: """按照要求生成括号字符串 Args: n: 括号对长度 Returns: 链表""" result = [] if n < 1: return result self.bracket_trace(result, '', 0, 0, n) return result def bracket_trace(self, result, s: str, left: int, righ...
the_stack_v2_python_sparse
src/leetcodepython/string/generate_parenthess_22.py
zhangyu345293721/leetcode
train
101
1df3f1004f5ead7a853c0db30af098fb1ca64e8b
[ "self.persistence_factory = PersistenceMechanismFactory(bucket_base=bucket_base, key_base=key_base, object_type=object_type, logger=logger)\nself.object_type = object_type\nself.reference_pruner = reference_pruner\nself.dictionary_converter = dictionary_converter\nself.fallback = SerializationFormats.JSON\nself.log...
<|body_start_0|> self.persistence_factory = PersistenceMechanismFactory(bucket_base=bucket_base, key_base=key_base, object_type=object_type, logger=logger) self.object_type = object_type self.reference_pruner = reference_pruner self.dictionary_converter = dictionary_converter sel...
Factory class for Persistence implementations. Given: 1. a string specifying PersistenceMechanism type 2. a "persist_dir" passed from the caller (which often is experiment name) 3. a "persist_file" passed from the caller (i.e. file name) ... the create_persistence() method will dish out the correct persistence implemen...
PersistenceFactory
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PersistenceFactory: """Factory class for Persistence implementations. Given: 1. a string specifying PersistenceMechanism type 2. a "persist_dir" passed from the caller (which often is experiment name) 3. a "persist_file" passed from the caller (i.e. file name) ... the create_persistence() method ...
stack_v2_sparse_classes_36k_train_000957
9,147
no_license
[ { "docstring": "Constructor. :param bucket_base: The bucket base for S3 storage :param key_base: The key (folder) base for S3 storage :param object_type: A string describing what kind of object is to be persisted. :param reference_pruner: A ReferencePruner implementation to prevent persisting reference data twi...
5
stack_v2_sparse_classes_30k_train_012828
Implement the Python class `PersistenceFactory` described below. Class description: Factory class for Persistence implementations. Given: 1. a string specifying PersistenceMechanism type 2. a "persist_dir" passed from the caller (which often is experiment name) 3. a "persist_file" passed from the caller (i.e. file nam...
Implement the Python class `PersistenceFactory` described below. Class description: Factory class for Persistence implementations. Given: 1. a string specifying PersistenceMechanism type 2. a "persist_dir" passed from the caller (which often is experiment name) 3. a "persist_file" passed from the caller (i.e. file nam...
99c2f401d6c4b203ee439ed607985a918d0c3c7e
<|skeleton|> class PersistenceFactory: """Factory class for Persistence implementations. Given: 1. a string specifying PersistenceMechanism type 2. a "persist_dir" passed from the caller (which often is experiment name) 3. a "persist_file" passed from the caller (i.e. file name) ... the create_persistence() method ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PersistenceFactory: """Factory class for Persistence implementations. Given: 1. a string specifying PersistenceMechanism type 2. a "persist_dir" passed from the caller (which often is experiment name) 3. a "persist_file" passed from the caller (i.e. file name) ... the create_persistence() method will dish out...
the_stack_v2_python_sparse
servicecommon/persistence/factory/persistence_factory.py
Cognizant-CDB-AIA-BAI-AI-OI/LEAF-ENN-Training-V2
train
0
b9cd759af62468851fe6265efc2943203b6b5a86
[ "for i in range(len(numbers)):\n for j in range(len(numbers) - 1, i, -1):\n if target - numbers[i] == numbers[j]:\n return [i, j]", "head, tail = (0, len(numbers) - 1)\nwhile head < tail:\n if numbers[head] + numbers[tail] == target:\n return [head + 1, tail + 1]\n elif numbers[h...
<|body_start_0|> for i in range(len(numbers)): for j in range(len(numbers) - 1, i, -1): if target - numbers[i] == numbers[j]: return [i, j] <|end_body_0|> <|body_start_1|> head, tail = (0, len(numbers) - 1) while head < tail: if number...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def twoSum(self, numbers, target): """:type numbers: List[int] :type target: int :rtype: List[int]""" <|body_0|> def twoSum2(self, numbers, target): """:type numbers: List[int] :type target: int :rtype: List[int]""" <|body_1|> <|end_skeleton|> <|b...
stack_v2_sparse_classes_36k_train_000958
2,149
no_license
[ { "docstring": ":type numbers: List[int] :type target: int :rtype: List[int]", "name": "twoSum", "signature": "def twoSum(self, numbers, target)" }, { "docstring": ":type numbers: List[int] :type target: int :rtype: List[int]", "name": "twoSum2", "signature": "def twoSum2(self, numbers, ...
2
stack_v2_sparse_classes_30k_test_000802
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def twoSum(self, numbers, target): :type numbers: List[int] :type target: int :rtype: List[int] - def twoSum2(self, numbers, target): :type numbers: List[int] :type target: int :...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def twoSum(self, numbers, target): :type numbers: List[int] :type target: int :rtype: List[int] - def twoSum2(self, numbers, target): :type numbers: List[int] :type target: int :...
edccd4b62719c700713e3db78493564e2dc768c4
<|skeleton|> class Solution: def twoSum(self, numbers, target): """:type numbers: List[int] :type target: int :rtype: List[int]""" <|body_0|> def twoSum2(self, numbers, target): """:type numbers: List[int] :type target: int :rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def twoSum(self, numbers, target): """:type numbers: List[int] :type target: int :rtype: List[int]""" for i in range(len(numbers)): for j in range(len(numbers) - 1, i, -1): if target - numbers[i] == numbers[j]: return [i, j] def tw...
the_stack_v2_python_sparse
Array/167.twosum2InputArrayIsSorted.py
moonclearner/leetcode
train
0
d8cb7f29fffb26307813c6a77cb930b4c3e7891d
[ "self.Wf = np.random.normal(size=(i + h, h))\nself.Wu = np.random.normal(size=(i + h, h))\nself.Wc = np.random.normal(size=(i + h, h))\nself.Wo = np.random.normal(size=(i + h, h))\nself.Wy = np.random.normal(size=(h, o))\nself.bf = np.zeros((1, h))\nself.bu = np.zeros((1, h))\nself.bc = np.zeros((1, h))\nself.bo = ...
<|body_start_0|> self.Wf = np.random.normal(size=(i + h, h)) self.Wu = np.random.normal(size=(i + h, h)) self.Wc = np.random.normal(size=(i + h, h)) self.Wo = np.random.normal(size=(i + h, h)) self.Wy = np.random.normal(size=(h, o)) self.bf = np.zeros((1, h)) self...
LSTM cell class
LSTMCell
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LSTMCell: """LSTM cell class""" def __init__(self, i, h, o): """Constructor""" <|body_0|> def forward(self, h_prev, c_prev, x_t): """Method that performs forward propagation for one time step""" <|body_1|> <|end_skeleton|> <|body_start_0|> self....
stack_v2_sparse_classes_36k_train_000959
1,302
no_license
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self, i, h, o)" }, { "docstring": "Method that performs forward propagation for one time step", "name": "forward", "signature": "def forward(self, h_prev, c_prev, x_t)" } ]
2
null
Implement the Python class `LSTMCell` described below. Class description: LSTM cell class Method signatures and docstrings: - def __init__(self, i, h, o): Constructor - def forward(self, h_prev, c_prev, x_t): Method that performs forward propagation for one time step
Implement the Python class `LSTMCell` described below. Class description: LSTM cell class Method signatures and docstrings: - def __init__(self, i, h, o): Constructor - def forward(self, h_prev, c_prev, x_t): Method that performs forward propagation for one time step <|skeleton|> class LSTMCell: """LSTM cell cla...
131be8fcf61aafb5a4ddc0b3853ba625560eb786
<|skeleton|> class LSTMCell: """LSTM cell class""" def __init__(self, i, h, o): """Constructor""" <|body_0|> def forward(self, h_prev, c_prev, x_t): """Method that performs forward propagation for one time step""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LSTMCell: """LSTM cell class""" def __init__(self, i, h, o): """Constructor""" self.Wf = np.random.normal(size=(i + h, h)) self.Wu = np.random.normal(size=(i + h, h)) self.Wc = np.random.normal(size=(i + h, h)) self.Wo = np.random.normal(size=(i + h, h)) se...
the_stack_v2_python_sparse
supervised_learning/0x0D-RNNs/3-lstm_cell.py
zahraaassaad/holbertonschool-machine_learning
train
1
43a9c9d8e3d3b9636750a9b1dcda7b57e388c428
[ "ar = np.array(ar)\nar0 = ar.reshape(1, -1)\nnf, p1 = ar0.shape\nif p == None:\n p = p1 - 1\nff = np.fft.rfft(ar0, n=2 * p + 2).T ** (-1)\nreturn ff", "N = len(x)\ne = np.zeros((N, p + 1))\nb = np.zeros((N, p + 1))\nalphal = np.zeros((p, p))\ne[:, 0] = x\nb[:, 0] = x\nk = np.zeros(p)\nk[0] = np.sum(e[p:p + L, ...
<|body_start_0|> ar = np.array(ar) ar0 = ar.reshape(1, -1) nf, p1 = ar0.shape if p == None: p = p1 - 1 ff = np.fft.rfft(ar0, n=2 * p + 2).T ** (-1) return ff <|end_body_0|> <|body_start_1|> N = len(x) e = np.zeros((N, p + 1)) b = np.ze...
LPC
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LPC: def lpcar2ff(ar, p=None): """Convert AR coefs to complex spectrum FF=(AR,P) :param ar: :param p: :return ff:""" <|body_0|> def latticem(x, L, p): """用几何平均格型法求出线性预测的系数 :param x: 一帧语音数据 (长度大于等于L+p) :param L: 该帧数据中做格型法处理的长度 :param p: 线性预测的系数 :return E: 最小均方误差 :retu...
stack_v2_sparse_classes_36k_train_000960
2,100
permissive
[ { "docstring": "Convert AR coefs to complex spectrum FF=(AR,P) :param ar: :param p: :return ff:", "name": "lpcar2ff", "signature": "def lpcar2ff(ar, p=None)" }, { "docstring": "用几何平均格型法求出线性预测的系数 :param x: 一帧语音数据 (长度大于等于L+p) :param L: 该帧数据中做格型法处理的长度 :param p: 线性预测的系数 :return E: 最小均方误差 :return G: ...
3
null
Implement the Python class `LPC` described below. Class description: Implement the LPC class. Method signatures and docstrings: - def lpcar2ff(ar, p=None): Convert AR coefs to complex spectrum FF=(AR,P) :param ar: :param p: :return ff: - def latticem(x, L, p): 用几何平均格型法求出线性预测的系数 :param x: 一帧语音数据 (长度大于等于L+p) :param L: ...
Implement the Python class `LPC` described below. Class description: Implement the LPC class. Method signatures and docstrings: - def lpcar2ff(ar, p=None): Convert AR coefs to complex spectrum FF=(AR,P) :param ar: :param p: :return ff: - def latticem(x, L, p): 用几何平均格型法求出线性预测的系数 :param x: 一帧语音数据 (长度大于等于L+p) :param L: ...
0074ad1d519387a75d5eca42c77f4d6966eb0a0e
<|skeleton|> class LPC: def lpcar2ff(ar, p=None): """Convert AR coefs to complex spectrum FF=(AR,P) :param ar: :param p: :return ff:""" <|body_0|> def latticem(x, L, p): """用几何平均格型法求出线性预测的系数 :param x: 一帧语音数据 (长度大于等于L+p) :param L: 该帧数据中做格型法处理的长度 :param p: 线性预测的系数 :return E: 最小均方误差 :retu...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LPC: def lpcar2ff(ar, p=None): """Convert AR coefs to complex spectrum FF=(AR,P) :param ar: :param p: :return ff:""" ar = np.array(ar) ar0 = ar.reshape(1, -1) nf, p1 = ar0.shape if p == None: p = p1 - 1 ff = np.fft.rfft(ar0, n=2 * p + 2).T ** (-1) ...
the_stack_v2_python_sparse
Chapter4_LinearPrediction/LPC.py
BarryZM/Python_Speech_SZY
train
0
3bb550a265da82351e272a40875182d9508bee27
[ "self.debug = debug\nself.logger = AntiVirusLogger(__name__, debug=self.debug)\nif config_path:\n self._CONFIG_PATH = config_path\nelse:\n self.logger.log('Configuration file path not found.', logtype='error')\n sys.exit(0)\nself.vt_api_key = vt_api_key\nself.context = Context()\nself.monitor = Monitor.fro...
<|body_start_0|> self.debug = debug self.logger = AntiVirusLogger(__name__, debug=self.debug) if config_path: self._CONFIG_PATH = config_path else: self.logger.log('Configuration file path not found.', logtype='error') sys.exit(0) self.vt_api_k...
USBMonitor class.
USBMonitor
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class USBMonitor: """USBMonitor class.""" def __init__(self, debug=False, config_path=None, vt_api_key=None): """Initialize USBMonitor. Args: debug (bool): Log on terminal or not config_path (str): Configuration JSON file path vt_api_key (str): Virus Total API Key Raises: None Returns: Non...
stack_v2_sparse_classes_36k_train_000961
7,479
permissive
[ { "docstring": "Initialize USBMonitor. Args: debug (bool): Log on terminal or not config_path (str): Configuration JSON file path vt_api_key (str): Virus Total API Key Raises: None Returns: None", "name": "__init__", "signature": "def __init__(self, debug=False, config_path=None, vt_api_key=None)" }, ...
5
null
Implement the Python class `USBMonitor` described below. Class description: USBMonitor class. Method signatures and docstrings: - def __init__(self, debug=False, config_path=None, vt_api_key=None): Initialize USBMonitor. Args: debug (bool): Log on terminal or not config_path (str): Configuration JSON file path vt_api...
Implement the Python class `USBMonitor` described below. Class description: USBMonitor class. Method signatures and docstrings: - def __init__(self, debug=False, config_path=None, vt_api_key=None): Initialize USBMonitor. Args: debug (bool): Log on terminal or not config_path (str): Configuration JSON file path vt_api...
43dec187e5848b9ced8a6b4957b6e9028d4d43cd
<|skeleton|> class USBMonitor: """USBMonitor class.""" def __init__(self, debug=False, config_path=None, vt_api_key=None): """Initialize USBMonitor. Args: debug (bool): Log on terminal or not config_path (str): Configuration JSON file path vt_api_key (str): Virus Total API Key Raises: None Returns: Non...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class USBMonitor: """USBMonitor class.""" def __init__(self, debug=False, config_path=None, vt_api_key=None): """Initialize USBMonitor. Args: debug (bool): Log on terminal or not config_path (str): Configuration JSON file path vt_api_key (str): Virus Total API Key Raises: None Returns: None""" ...
the_stack_v2_python_sparse
securetea/lib/antivirus/monitor/usb_monitor.py
rejahrehim/SecureTea-Project
train
1
ad44a7cc99b477f3de6293372420f97dc0731fe8
[ "if hasattr(obj, 'synContentValues'):\n values = obj.synContentValues()\nelse:\n values = obj.getFolderContents()\nreturn values", "mtool = getToolByName(self, 'portal_membership')\nif not mtool.checkPermission(ManageProperties, obj):\n raise Unauthorized\nBaseTool.enableSyndication(self, obj)", "mtool...
<|body_start_0|> if hasattr(obj, 'synContentValues'): values = obj.synContentValues() else: values = obj.getFolderContents() return values <|end_body_0|> <|body_start_1|> mtool = getToolByName(self, 'portal_membership') if not mtool.checkPermission(Manage...
SyndicationTool
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SyndicationTool: def getSyndicatableContent(self, obj): """Use the getFolderContents script, unless an object (like Topic) overrides it""" <|body_0|> def enableSyndication(self, obj): """Enable syndication for the obj""" <|body_1|> def disableSyndication...
stack_v2_sparse_classes_36k_train_000962
1,729
no_license
[ { "docstring": "Use the getFolderContents script, unless an object (like Topic) overrides it", "name": "getSyndicatableContent", "signature": "def getSyndicatableContent(self, obj)" }, { "docstring": "Enable syndication for the obj", "name": "enableSyndication", "signature": "def enableS...
3
null
Implement the Python class `SyndicationTool` described below. Class description: Implement the SyndicationTool class. Method signatures and docstrings: - def getSyndicatableContent(self, obj): Use the getFolderContents script, unless an object (like Topic) overrides it - def enableSyndication(self, obj): Enable syndi...
Implement the Python class `SyndicationTool` described below. Class description: Implement the SyndicationTool class. Method signatures and docstrings: - def getSyndicatableContent(self, obj): Use the getFolderContents script, unless an object (like Topic) overrides it - def enableSyndication(self, obj): Enable syndi...
e137eb6225cc5e724bee74a892567796166134ac
<|skeleton|> class SyndicationTool: def getSyndicatableContent(self, obj): """Use the getFolderContents script, unless an object (like Topic) overrides it""" <|body_0|> def enableSyndication(self, obj): """Enable syndication for the obj""" <|body_1|> def disableSyndication...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SyndicationTool: def getSyndicatableContent(self, obj): """Use the getFolderContents script, unless an object (like Topic) overrides it""" if hasattr(obj, 'synContentValues'): values = obj.synContentValues() else: values = obj.getFolderContents() return ...
the_stack_v2_python_sparse
eggs/Products.CMFPlone-4.1-py2.7.egg/Products/CMFPlone/SyndicationTool.py
nacho22martin/tesis
train
0
01627473b422a441a17a979212c1f4becc5f189f
[ "mocker.patch.object(client, 'update_entry', return_value=response)\nreturn_value = update_entry_command(client, 'test_collection', filter=filter, update=update, update_one=update_one, upsert=upsert)\nassert return_value[0] == expected", "mocker.patch.object(client, 'update_entry', return_value=response)\ntry:\n ...
<|body_start_0|> mocker.patch.object(client, 'update_entry', return_value=response) return_value = update_entry_command(client, 'test_collection', filter=filter, update=update, update_one=update_one, upsert=upsert) assert return_value[0] == expected <|end_body_0|> <|body_start_1|> mocke...
Class for update_query_command UTs.
TestUpdateQueryCommands
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestUpdateQueryCommands: """Class for update_query_command UTs.""" def test_update_entry_command(self, mocker, filter, update, update_one, upsert, response, expected, client=client): """Given: valid arguments When: running mongodb-update command in XSOAR Then: the expected human read...
stack_v2_sparse_classes_36k_train_000963
17,096
permissive
[ { "docstring": "Given: valid arguments When: running mongodb-update command in XSOAR Then: the expected human readable is returned", "name": "test_update_entry_command", "signature": "def test_update_entry_command(self, mocker, filter, update, update_one, upsert, response, expected, client=client)" },...
2
null
Implement the Python class `TestUpdateQueryCommands` described below. Class description: Class for update_query_command UTs. Method signatures and docstrings: - def test_update_entry_command(self, mocker, filter, update, update_one, upsert, response, expected, client=client): Given: valid arguments When: running mong...
Implement the Python class `TestUpdateQueryCommands` described below. Class description: Class for update_query_command UTs. Method signatures and docstrings: - def test_update_entry_command(self, mocker, filter, update, update_one, upsert, response, expected, client=client): Given: valid arguments When: running mong...
890def5a0e0ae8d6eaa538148249ddbc851dbb6b
<|skeleton|> class TestUpdateQueryCommands: """Class for update_query_command UTs.""" def test_update_entry_command(self, mocker, filter, update, update_one, upsert, response, expected, client=client): """Given: valid arguments When: running mongodb-update command in XSOAR Then: the expected human read...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TestUpdateQueryCommands: """Class for update_query_command UTs.""" def test_update_entry_command(self, mocker, filter, update, update_one, upsert, response, expected, client=client): """Given: valid arguments When: running mongodb-update command in XSOAR Then: the expected human readable is retur...
the_stack_v2_python_sparse
Packs/MongoDB/Integrations/MongoDB/MongoDB_test.py
demisto/content
train
1,023
9891c8db00c56edc38905c41ae0d97ad918a0241
[ "model.preds, score = crf_decode(model.logits, model.transitions, model.input_x_len)\nmodel.score = tf.identity(score, name='score')\nmodel.y_ground_truth = model.input_y\nif model.use_pretrained_model:\n logging.info('initialize_pretrained_model_variables')\n self.initialize_pretrained_model_variables(model....
<|body_start_0|> model.preds, score = crf_decode(model.logits, model.transitions, model.input_x_len) model.score = tf.identity(score, name='score') model.y_ground_truth = model.input_y if model.use_pretrained_model: logging.info('initialize_pretrained_model_variables') ...
Solver for raw tensorflow model.
PretrainRawSeqLabelSolver
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PretrainRawSeqLabelSolver: """Solver for raw tensorflow model.""" def build_output(self, model): """Build the output of the model. `score` and `input_y` are for loss calculation. `preds` and `y_ground_truth` are for metric calculation.""" <|body_0|> def build_export_outp...
stack_v2_sparse_classes_36k_train_000964
4,189
permissive
[ { "docstring": "Build the output of the model. `score` and `input_y` are for loss calculation. `preds` and `y_ground_truth` are for metric calculation.", "name": "build_output", "signature": "def build_output(self, model)" }, { "docstring": "Build the output of the model. `score` and `input_y` a...
5
null
Implement the Python class `PretrainRawSeqLabelSolver` described below. Class description: Solver for raw tensorflow model. Method signatures and docstrings: - def build_output(self, model): Build the output of the model. `score` and `input_y` are for loss calculation. `preds` and `y_ground_truth` are for metric calc...
Implement the Python class `PretrainRawSeqLabelSolver` described below. Class description: Solver for raw tensorflow model. Method signatures and docstrings: - def build_output(self, model): Build the output of the model. `score` and `input_y` are for loss calculation. `preds` and `y_ground_truth` are for metric calc...
7eb4e3be578a680737616efff6858d280595ff48
<|skeleton|> class PretrainRawSeqLabelSolver: """Solver for raw tensorflow model.""" def build_output(self, model): """Build the output of the model. `score` and `input_y` are for loss calculation. `preds` and `y_ground_truth` are for metric calculation.""" <|body_0|> def build_export_outp...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PretrainRawSeqLabelSolver: """Solver for raw tensorflow model.""" def build_output(self, model): """Build the output of the model. `score` and `input_y` are for loss calculation. `preds` and `y_ground_truth` are for metric calculation.""" model.preds, score = crf_decode(model.logits, mode...
the_stack_v2_python_sparse
delta/utils/solver/raw_pretrain_seq_label_solver.py
luffywalf/delta
train
1
7e456e3ec8443663914cdd91a1caa281180dfc18
[ "self.case_sensitive = case_sensitive\nself.is_regex = is_regex\nself.source_filter = source_filter", "if dictionary is None:\n return None\ncase_sensitive = dictionary.get('caseSensitive')\nis_regex = dictionary.get('isRegex')\nsource_filter = dictionary.get('sourceFilter')\nreturn cls(case_sensitive, is_rege...
<|body_start_0|> self.case_sensitive = case_sensitive self.is_regex = is_regex self.source_filter = source_filter <|end_body_0|> <|body_start_1|> if dictionary is None: return None case_sensitive = dictionary.get('caseSensitive') is_regex = dictionary.get('is...
Implementation of the 'SourceFilters_SourceFilter' model. Plain text filter: { source_filter: "TestDatabase", is_regex: false}. Wildcard filter: { source_filter: "Test?Database*", is_regex: false}. Regex filter: { source_filter: "^Test.*Database$", is_regex: true}. Attributes: case_sensitive (bool): Determines if the f...
SourceFilters_SourceFilter
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SourceFilters_SourceFilter: """Implementation of the 'SourceFilters_SourceFilter' model. Plain text filter: { source_filter: "TestDatabase", is_regex: false}. Wildcard filter: { source_filter: "Test?Database*", is_regex: false}. Regex filter: { source_filter: "^Test.*Database$", is_regex: true}. ...
stack_v2_sparse_classes_36k_train_000965
2,428
permissive
[ { "docstring": "Constructor for the SourceFilters_SourceFilter class", "name": "__init__", "signature": "def __init__(self, case_sensitive=None, is_regex=None, source_filter=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary ...
2
null
Implement the Python class `SourceFilters_SourceFilter` described below. Class description: Implementation of the 'SourceFilters_SourceFilter' model. Plain text filter: { source_filter: "TestDatabase", is_regex: false}. Wildcard filter: { source_filter: "Test?Database*", is_regex: false}. Regex filter: { source_filter...
Implement the Python class `SourceFilters_SourceFilter` described below. Class description: Implementation of the 'SourceFilters_SourceFilter' model. Plain text filter: { source_filter: "TestDatabase", is_regex: false}. Wildcard filter: { source_filter: "Test?Database*", is_regex: false}. Regex filter: { source_filter...
e4973dfeb836266904d0369ea845513c7acf261e
<|skeleton|> class SourceFilters_SourceFilter: """Implementation of the 'SourceFilters_SourceFilter' model. Plain text filter: { source_filter: "TestDatabase", is_regex: false}. Wildcard filter: { source_filter: "Test?Database*", is_regex: false}. Regex filter: { source_filter: "^Test.*Database$", is_regex: true}. ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SourceFilters_SourceFilter: """Implementation of the 'SourceFilters_SourceFilter' model. Plain text filter: { source_filter: "TestDatabase", is_regex: false}. Wildcard filter: { source_filter: "Test?Database*", is_regex: false}. Regex filter: { source_filter: "^Test.*Database$", is_regex: true}. Attributes: c...
the_stack_v2_python_sparse
cohesity_management_sdk/models/source_filters_source_filter.py
cohesity/management-sdk-python
train
24
3a38abf1f9be341e3507e9174e8fa6c4dd0e8036
[ "if len(fname) < 4 or fname[-4:] != '.omf':\n fname = fname + '.omf'\nself.fname = fname\nwith open(fname, 'wb') as fopen:\n self.initialize_header(fopen, project.uid)\n self.project_json = project.serialize(open_file=fopen)\n self.update_header(fopen)\n fopen.write(json.dumps(self.project_json).enco...
<|body_start_0|> if len(fname) < 4 or fname[-4:] != '.omf': fname = fname + '.omf' self.fname = fname with open(fname, 'wb') as fopen: self.initialize_header(fopen, project.uid) self.project_json = project.serialize(open_file=fopen) self.update_hea...
OMFWriter serializes a OMF project to a file .. code:: proj = omf.project() ... omf.OMFWriter(proj, 'outfile.omf') The output file starts with a 60 byte header: * 4 byte magic number: :code:`b'\\x81\\x82\\x83\\x84'` * 32 byte version string: :code:`'OMF-v0.9.0'` (other bytes empty) * 16 byte project uid (in little-endi...
OMFWriter
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OMFWriter: """OMFWriter serializes a OMF project to a file .. code:: proj = omf.project() ... omf.OMFWriter(proj, 'outfile.omf') The output file starts with a 60 byte header: * 4 byte magic number: :code:`b'\\x81\\x82\\x83\\x84'` * 32 byte version string: :code:`'OMF-v0.9.0'` (other bytes empty) ...
stack_v2_sparse_classes_36k_train_000966
6,061
permissive
[ { "docstring": "Project serialization is performed on OMFWriter init Binary data is written during project serialization", "name": "__init__", "signature": "def __init__(self, project, fname)" }, { "docstring": "Write magic number, version string, project uid, and zero bytes Total header length ...
3
stack_v2_sparse_classes_30k_val_000368
Implement the Python class `OMFWriter` described below. Class description: OMFWriter serializes a OMF project to a file .. code:: proj = omf.project() ... omf.OMFWriter(proj, 'outfile.omf') The output file starts with a 60 byte header: * 4 byte magic number: :code:`b'\\x81\\x82\\x83\\x84'` * 32 byte version string: :c...
Implement the Python class `OMFWriter` described below. Class description: OMFWriter serializes a OMF project to a file .. code:: proj = omf.project() ... omf.OMFWriter(proj, 'outfile.omf') The output file starts with a 60 byte header: * 4 byte magic number: :code:`b'\\x81\\x82\\x83\\x84'` * 32 byte version string: :c...
d35f04c8ab8f007384a7bea4d4997572daf38553
<|skeleton|> class OMFWriter: """OMFWriter serializes a OMF project to a file .. code:: proj = omf.project() ... omf.OMFWriter(proj, 'outfile.omf') The output file starts with a 60 byte header: * 4 byte magic number: :code:`b'\\x81\\x82\\x83\\x84'` * 32 byte version string: :code:`'OMF-v0.9.0'` (other bytes empty) ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class OMFWriter: """OMFWriter serializes a OMF project to a file .. code:: proj = omf.project() ... omf.OMFWriter(proj, 'outfile.omf') The output file starts with a 60 byte header: * 4 byte magic number: :code:`b'\\x81\\x82\\x83\\x84'` * 32 byte version string: :code:`'OMF-v0.9.0'` (other bytes empty) * 16 byte pro...
the_stack_v2_python_sparse
omf/fileio.py
jmoraga-mines/omf
train
0
9c18ee9ce67227fb788e208810093d626cd3b475
[ "self.maxlength = capacity\nself.array = {}\nself.array_list = []", "value = self.array.get(key)\nif value is not None and self.array_list[0] is not key:\n index = self.array_list.index(key)\n self.array_list.pop(index)\n self.array_list.insert(0, key)\nvalue = value if value is not None else -1\nreturn ...
<|body_start_0|> self.maxlength = capacity self.array = {} self.array_list = [] <|end_body_0|> <|body_start_1|> value = self.array.get(key) if value is not None and self.array_list[0] is not key: index = self.array_list.index(key) self.array_list.pop(inde...
LRUCache
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: void""" <|body_2|> <|end_s...
stack_v2_sparse_classes_36k_train_000967
2,420
no_license
[ { "docstring": ":type capacity: int", "name": "__init__", "signature": "def __init__(self, capacity)" }, { "docstring": ":type key: int :rtype: int", "name": "get", "signature": "def get(self, key)" }, { "docstring": ":type key: int :type value: int :rtype: void", "name": "pu...
3
stack_v2_sparse_classes_30k_train_020775
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: void
Implement the Python class `LRUCache` described below. Class description: Implement the LRUCache class. Method signatures and docstrings: - def __init__(self, capacity): :type capacity: int - def get(self, key): :type key: int :rtype: int - def put(self, key, value): :type key: int :type value: int :rtype: void <|sk...
b613718bf69982535b7c3c9f329a47d5741d8a9e
<|skeleton|> class LRUCache: def __init__(self, capacity): """:type capacity: int""" <|body_0|> def get(self, key): """:type key: int :rtype: int""" <|body_1|> def put(self, key, value): """:type key: int :type value: int :rtype: void""" <|body_2|> <|end_s...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LRUCache: def __init__(self, capacity): """:type capacity: int""" self.maxlength = capacity self.array = {} self.array_list = [] def get(self, key): """:type key: int :rtype: int""" value = self.array.get(key) if value is not None and self.array_lis...
the_stack_v2_python_sparse
Python3/LRU Cache.py
liuyuhang791034063/LeetCode
train
12
4f961ead6cdc2942555f78f1326cb4e396ffce2f
[ "if not s:\n return 0\nres = 0\ncurrent_letters = set()\nleft = 0\nfor right in range(len(s)):\n if not s[right] in current_letters:\n current_letters.add(s[right])\n if len(current_letters) > res:\n res = len(current_letters)\n else:\n while s[left] != s[right]:\n ...
<|body_start_0|> if not s: return 0 res = 0 current_letters = set() left = 0 for right in range(len(s)): if not s[right] in current_letters: current_letters.add(s[right]) if len(current_letters) > res: re...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def len_longest_substring(self, s: str) -> int: """eager storage. current_letters is always accurate.""" <|body_0|> def len_longest_substring_with_dict(self, s: str) -> int: """lazy storage. need to check with current left point when retrieving the index.""...
stack_v2_sparse_classes_36k_train_000968
1,358
no_license
[ { "docstring": "eager storage. current_letters is always accurate.", "name": "len_longest_substring", "signature": "def len_longest_substring(self, s: str) -> int" }, { "docstring": "lazy storage. need to check with current left point when retrieving the index.", "name": "len_longest_substri...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def len_longest_substring(self, s: str) -> int: eager storage. current_letters is always accurate. - def len_longest_substring_with_dict(self, s: str) -> int: lazy storage. need ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def len_longest_substring(self, s: str) -> int: eager storage. current_letters is always accurate. - def len_longest_substring_with_dict(self, s: str) -> int: lazy storage. need ...
5625e6396b746255f3343253c75447ead95879c7
<|skeleton|> class Solution: def len_longest_substring(self, s: str) -> int: """eager storage. current_letters is always accurate.""" <|body_0|> def len_longest_substring_with_dict(self, s: str) -> int: """lazy storage. need to check with current left point when retrieving the index.""...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def len_longest_substring(self, s: str) -> int: """eager storage. current_letters is always accurate.""" if not s: return 0 res = 0 current_letters = set() left = 0 for right in range(len(s)): if not s[right] in current_letters:...
the_stack_v2_python_sparse
3_longest_substring_without_repeating_characters/solution.py
FluffyFu/Leetcode
train
0
12c80f0717d8304b1fb9d3b0466ff9ed0c072302
[ "res = []\nqueue = deque([root])\nwhile queue:\n node = queue.popleft()\n res.append(str(node.val) if node else 'null')\n if node:\n queue.append(node.left)\n queue.append(node.right)\nwhile res and res[-1] == 'null':\n res.pop()\nreturn '[' + ','.join(res) + ']'", "def walk(n, i):\n ...
<|body_start_0|> res = [] queue = deque([root]) while queue: node = queue.popleft() res.append(str(node.val) if node else 'null') if node: queue.append(node.left) queue.append(node.right) while res and res[-1] == 'null':...
Codec1
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec1: 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_000969
2,379
no_license
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_train_005888
Implement the Python class `Codec1` described below. Class description: Implement the Codec1 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 `Codec1` described below. Class description: Implement the Codec1 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...
a08b44323b04fc7d488708b0ffbe94dafc47eb18
<|skeleton|> class Codec1: 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 Codec1: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" res = [] queue = deque([root]) while queue: node = queue.popleft() res.append(str(node.val) if node else 'null') if node: ...
the_stack_v2_python_sparse
Tree/serilizeAndDeserilizeBT.py
DiracSea/LC
train
0
f086918ec178c3c537664642139a4ab3518bd5aa
[ "self.X = X_init\nself.Y = Y_init\nself.l = l\nself.sigma_f = sigma_f\nself.K = self.kernel(X_init, X_init)", "first = np.sum(X1 ** 2, axis=1).reshape(-1, 1)\nsecond = np.sum(X2 ** 2, axis=1)\nthird = -2 * np.dot(X1, X2.T)\nsqdist = first + second + third\nkernel_1 = self.sigma_f ** 2\nkernel_2 = np.exp(-0.5 / se...
<|body_start_0|> self.X = X_init self.Y = Y_init self.l = l self.sigma_f = sigma_f self.K = self.kernel(X_init, X_init) <|end_body_0|> <|body_start_1|> first = np.sum(X1 ** 2, axis=1).reshape(-1, 1) second = np.sum(X2 ** 2, axis=1) third = -2 * np.dot(X1,...
Gaussian Process
GaussianProcess
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GaussianProcess: """Gaussian Process""" def __init__(self, X_init, Y_init, l=1, sigma_f=1): """* X_init is a numpy.ndarray of shape (t, 1) representing the inputs already sampled with the black-box function * Y_init is a numpy.ndarray of shape (t, 1) representing the outputs of the b...
stack_v2_sparse_classes_36k_train_000970
2,959
no_license
[ { "docstring": "* X_init is a numpy.ndarray of shape (t, 1) representing the inputs already sampled with the black-box function * Y_init is a numpy.ndarray of shape (t, 1) representing the outputs of the black-box function for each input in X_init - t is the number of initial samples * l is the length parameter...
3
stack_v2_sparse_classes_30k_train_015746
Implement the Python class `GaussianProcess` described below. Class description: Gaussian Process Method signatures and docstrings: - def __init__(self, X_init, Y_init, l=1, sigma_f=1): * X_init is a numpy.ndarray of shape (t, 1) representing the inputs already sampled with the black-box function * Y_init is a numpy....
Implement the Python class `GaussianProcess` described below. Class description: Gaussian Process Method signatures and docstrings: - def __init__(self, X_init, Y_init, l=1, sigma_f=1): * X_init is a numpy.ndarray of shape (t, 1) representing the inputs already sampled with the black-box function * Y_init is a numpy....
8ad4c2594ff78b345dbd92e9d54d2a143ac4071a
<|skeleton|> class GaussianProcess: """Gaussian Process""" def __init__(self, X_init, Y_init, l=1, sigma_f=1): """* X_init is a numpy.ndarray of shape (t, 1) representing the inputs already sampled with the black-box function * Y_init is a numpy.ndarray of shape (t, 1) representing the outputs of the b...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GaussianProcess: """Gaussian Process""" def __init__(self, X_init, Y_init, l=1, sigma_f=1): """* X_init is a numpy.ndarray of shape (t, 1) representing the inputs already sampled with the black-box function * Y_init is a numpy.ndarray of shape (t, 1) representing the outputs of the black-box func...
the_stack_v2_python_sparse
unsupervised_learning/0x03-hyperparameter_tuning/1-gp.py
jorgezafra94/holbertonschool-machine_learning
train
1
1ff5cf19221fcaf3017c0cc3f48325da8afe2ce5
[ "try:\n db.show_by_id(show_id, session=session)\nexcept NoResultFound:\n raise NotFoundError('show with ID %s not found' % show_id)\ntry:\n db.episode_by_id(ep_id, session)\nexcept NoResultFound:\n raise NotFoundError('episode with ID %s not found' % ep_id)\ntry:\n release = db.episode_release_by_id(...
<|body_start_0|> try: db.show_by_id(show_id, session=session) except NoResultFound: raise NotFoundError('show with ID %s not found' % show_id) try: db.episode_by_id(ep_id, session) except NoResultFound: raise NotFoundError('episode with ID ...
SeriesEpisodeReleaseAPI
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SeriesEpisodeReleaseAPI: def get(self, show_id, ep_id, rel_id, session): """Get episode release by show ID, episode ID and release ID""" <|body_0|> def delete(self, show_id, ep_id, rel_id, session): """Delete episode release by show ID, episode ID and release ID""" ...
stack_v2_sparse_classes_36k_train_000971
47,001
permissive
[ { "docstring": "Get episode release by show ID, episode ID and release ID", "name": "get", "signature": "def get(self, show_id, ep_id, rel_id, session)" }, { "docstring": "Delete episode release by show ID, episode ID and release ID", "name": "delete", "signature": "def delete(self, show...
3
stack_v2_sparse_classes_30k_train_011408
Implement the Python class `SeriesEpisodeReleaseAPI` described below. Class description: Implement the SeriesEpisodeReleaseAPI class. Method signatures and docstrings: - def get(self, show_id, ep_id, rel_id, session): Get episode release by show ID, episode ID and release ID - def delete(self, show_id, ep_id, rel_id,...
Implement the Python class `SeriesEpisodeReleaseAPI` described below. Class description: Implement the SeriesEpisodeReleaseAPI class. Method signatures and docstrings: - def get(self, show_id, ep_id, rel_id, session): Get episode release by show ID, episode ID and release ID - def delete(self, show_id, ep_id, rel_id,...
ea95ff60041beaea9aacbc2d93549e3a6b981dc5
<|skeleton|> class SeriesEpisodeReleaseAPI: def get(self, show_id, ep_id, rel_id, session): """Get episode release by show ID, episode ID and release ID""" <|body_0|> def delete(self, show_id, ep_id, rel_id, session): """Delete episode release by show ID, episode ID and release ID""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SeriesEpisodeReleaseAPI: def get(self, show_id, ep_id, rel_id, session): """Get episode release by show ID, episode ID and release ID""" try: db.show_by_id(show_id, session=session) except NoResultFound: raise NotFoundError('show with ID %s not found' % show_id)...
the_stack_v2_python_sparse
flexget/components/series/api.py
BrutuZ/Flexget
train
1
7aab5d06b9051c5bc2a3c681ac33ecb36fe78273
[ "self.paths = PhenoXPaths(outprefix)\nself.query_str = query_str\nself.email = email", "mesh = MeshSearcher(self.paths.outprefix)\nmesh_entry = mesh.lookup(self.query_str)\nreturn (mesh_entry, [mesh.mesh[c]['name'] for c in mesh_entry['children']])", "sys.stdout.write('Retrieving matching GEO datasets...\\n')\n...
<|body_start_0|> self.paths = PhenoXPaths(outprefix) self.query_str = query_str self.email = email <|end_body_0|> <|body_start_1|> mesh = MeshSearcher(self.paths.outprefix) mesh_entry = mesh.lookup(self.query_str) return (mesh_entry, [mesh.mesh[c]['name'] for c in mesh_e...
PhenoX
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PhenoX: def __init__(self, email: str, query_str: str, outprefix: str) -> None: """Initialize class :param gene_list:""" <|body_0|> def _get_best_mesh_term(self) -> Tuple: """Retrieve the best MeSH term from search query :return:""" <|body_1|> def _get_g...
stack_v2_sparse_classes_36k_train_000972
5,879
permissive
[ { "docstring": "Initialize class :param gene_list:", "name": "__init__", "signature": "def __init__(self, email: str, query_str: str, outprefix: str) -> None" }, { "docstring": "Retrieve the best MeSH term from search query :return:", "name": "_get_best_mesh_term", "signature": "def _get...
6
stack_v2_sparse_classes_30k_train_017165
Implement the Python class `PhenoX` described below. Class description: Implement the PhenoX class. Method signatures and docstrings: - def __init__(self, email: str, query_str: str, outprefix: str) -> None: Initialize class :param gene_list: - def _get_best_mesh_term(self) -> Tuple: Retrieve the best MeSH term from ...
Implement the Python class `PhenoX` described below. Class description: Implement the PhenoX class. Method signatures and docstrings: - def __init__(self, email: str, query_str: str, outprefix: str) -> None: Initialize class :param gene_list: - def _get_best_mesh_term(self) -> Tuple: Retrieve the best MeSH term from ...
a7912e2cf3cc14fa7c6cb666767e0fdb6be78114
<|skeleton|> class PhenoX: def __init__(self, email: str, query_str: str, outprefix: str) -> None: """Initialize class :param gene_list:""" <|body_0|> def _get_best_mesh_term(self) -> Tuple: """Retrieve the best MeSH term from search query :return:""" <|body_1|> def _get_g...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class PhenoX: def __init__(self, email: str, query_str: str, outprefix: str) -> None: """Initialize class :param gene_list:""" self.paths = PhenoXPaths(outprefix) self.query_str = query_str self.email = email def _get_best_mesh_term(self) -> Tuple: """Retrieve the best M...
the_stack_v2_python_sparse
phenox/phenox.py
NCBI-Hackathons/phenotypeXpression
train
13
951508147bd5ffdaf7799bdd1625eaf5a5d81dad
[ "def flip(k):\n arr[:] = arr[:k][::-1] + arr[k:]\n\ndef find_max_num_index(top_index):\n max = float('inf')\n idx = -1\n for i in range(top_index):\n if arr[i] > max:\n max = arr[i]\n idx = i\n return idx\nfor i in range(len(arr), 0, -1):\n biggest = find_max_num_index...
<|body_start_0|> def flip(k): arr[:] = arr[:k][::-1] + arr[k:] def find_max_num_index(top_index): max = float('inf') idx = -1 for i in range(top_index): if arr[i] > max: max = arr[i] idx = i ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def pancakeSort(self, arr): """:type A: List[int] :rtype: List[int]""" <|body_0|> def pancakeSort(self, arr): """:type A: List[int] :rtype: List[int]""" <|body_1|> <|end_skeleton|> <|body_start_0|> def flip(k): arr[:] = arr[:k]...
stack_v2_sparse_classes_36k_train_000973
2,159
no_license
[ { "docstring": ":type A: List[int] :rtype: List[int]", "name": "pancakeSort", "signature": "def pancakeSort(self, arr)" }, { "docstring": ":type A: List[int] :rtype: List[int]", "name": "pancakeSort", "signature": "def pancakeSort(self, arr)" } ]
2
stack_v2_sparse_classes_30k_train_006137
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def pancakeSort(self, arr): :type A: List[int] :rtype: List[int] - def pancakeSort(self, arr): :type A: List[int] :rtype: List[int]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def pancakeSort(self, arr): :type A: List[int] :rtype: List[int] - def pancakeSort(self, arr): :type A: List[int] :rtype: List[int] <|skeleton|> class Solution: def pancake...
844f502da4d6fb9cd69cf0a1ef71da3385a4d2b4
<|skeleton|> class Solution: def pancakeSort(self, arr): """:type A: List[int] :rtype: List[int]""" <|body_0|> def pancakeSort(self, arr): """:type A: List[int] :rtype: List[int]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def pancakeSort(self, arr): """:type A: List[int] :rtype: List[int]""" def flip(k): arr[:] = arr[:k][::-1] + arr[k:] def find_max_num_index(top_index): max = float('inf') idx = -1 for i in range(top_index): if a...
the_stack_v2_python_sparse
969-pancake_sorting.py
stevestar888/leetcode-problems
train
2
5b3fd235aa5fee6d8d90209c226fdf6f45968453
[ "super().__init__(db, version, uuid)\nself.columns = get_table_columns(self.conn, 'ZDETECTEDFACE')\nself.table_name = 'ZDETECTEDFACE'", "conn, cursor = self.db.get_db_connection()\nsql = f' SELECT ZDETECTEDFACE.*\\n FROM ZDETECTEDFACE\\n JOIN {self.asset_table} ON {self.asse...
<|body_start_0|> super().__init__(db, version, uuid) self.columns = get_table_columns(self.conn, 'ZDETECTEDFACE') self.table_name = 'ZDETECTEDFACE' <|end_body_0|> <|body_start_1|> conn, cursor = self.db.get_db_connection() sql = f' SELECT ZDETECTEDFACE.*\n FR...
ZDETECTEDFACE table.
DetectedFaceTable
[ "MIT", "LicenseRef-scancode-public-domain" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DetectedFaceTable: """ZDETECTEDFACE table.""" def __init__(self, db: osxphotos.PhotosDB, version: int, uuid: str): """Create a Table object.""" <|body_0|> def rows(self) -> list[tuple[Any]]: """Return rows for this photo from the ZDETECTEDFACE table.""" <...
stack_v2_sparse_classes_36k_train_000974
8,828
permissive
[ { "docstring": "Create a Table object.", "name": "__init__", "signature": "def __init__(self, db: osxphotos.PhotosDB, version: int, uuid: str)" }, { "docstring": "Return rows for this photo from the ZDETECTEDFACE table.", "name": "rows", "signature": "def rows(self) -> list[tuple[Any]]" ...
3
null
Implement the Python class `DetectedFaceTable` described below. Class description: ZDETECTEDFACE table. Method signatures and docstrings: - def __init__(self, db: osxphotos.PhotosDB, version: int, uuid: str): Create a Table object. - def rows(self) -> list[tuple[Any]]: Return rows for this photo from the ZDETECTEDFAC...
Implement the Python class `DetectedFaceTable` described below. Class description: ZDETECTEDFACE table. Method signatures and docstrings: - def __init__(self, db: osxphotos.PhotosDB, version: int, uuid: str): Create a Table object. - def rows(self) -> list[tuple[Any]]: Return rows for this photo from the ZDETECTEDFAC...
2cb5a4d18a27be6ccf68f5f35abd39418d238016
<|skeleton|> class DetectedFaceTable: """ZDETECTEDFACE table.""" def __init__(self, db: osxphotos.PhotosDB, version: int, uuid: str): """Create a Table object.""" <|body_0|> def rows(self) -> list[tuple[Any]]: """Return rows for this photo from the ZDETECTEDFACE table.""" <...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DetectedFaceTable: """ZDETECTEDFACE table.""" def __init__(self, db: osxphotos.PhotosDB, version: int, uuid: str): """Create a Table object.""" super().__init__(db, version, uuid) self.columns = get_table_columns(self.conn, 'ZDETECTEDFACE') self.table_name = 'ZDETECTEDFACE...
the_stack_v2_python_sparse
osxphotos/phototables.py
RhetTbull/osxphotos
train
1,287
1e6d33b3d2b4bdf7607f156c538ec5bca16e5041
[ "sql = 'INSERT INTO %(tab)s (detract, period, people, amount, time, target_ct_id, target_id)\\n SELECT 1, %(pe)s, SUM(people), SUM(amount), DATE(time), target_ct_id, target_id\\n FROM %(tab)s\\n WHERE time <= %%(li)s and detract = 0\\n GROUP BY target_...
<|body_start_0|> sql = 'INSERT INTO %(tab)s (detract, period, people, amount, time, target_ct_id, target_id)\n SELECT 1, %(pe)s, SUM(people), SUM(amount), DATE(time), target_ct_id, target_id\n FROM %(tab)s\n WHERE time <= %%(li)s and detract = 0\n ...
AggManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AggManager: def copy_agg_to_agg(self, time_limit, time_format, time_period): """Coppy aggregated Agg data to table Agg time_limit: limit for time of transfering data time_format: format for destiny DATE_FORMAT time_period: is a period of aggregation data""" <|body_0|> def ag...
stack_v2_sparse_classes_36k_train_000975
15,410
no_license
[ { "docstring": "Coppy aggregated Agg data to table Agg time_limit: limit for time of transfering data time_format: format for destiny DATE_FORMAT time_period: is a period of aggregation data", "name": "copy_agg_to_agg", "signature": "def copy_agg_to_agg(self, time_limit, time_format, time_period)" }, ...
3
null
Implement the Python class `AggManager` described below. Class description: Implement the AggManager class. Method signatures and docstrings: - def copy_agg_to_agg(self, time_limit, time_format, time_period): Coppy aggregated Agg data to table Agg time_limit: limit for time of transfering data time_format: format for...
Implement the Python class `AggManager` described below. Class description: Implement the AggManager class. Method signatures and docstrings: - def copy_agg_to_agg(self, time_limit, time_format, time_period): Coppy aggregated Agg data to table Agg time_limit: limit for time of transfering data time_format: format for...
edcae8ac03816631cf8fbae98b7730479f4c41b6
<|skeleton|> class AggManager: def copy_agg_to_agg(self, time_limit, time_format, time_period): """Coppy aggregated Agg data to table Agg time_limit: limit for time of transfering data time_format: format for destiny DATE_FORMAT time_period: is a period of aggregation data""" <|body_0|> def ag...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AggManager: def copy_agg_to_agg(self, time_limit, time_format, time_period): """Coppy aggregated Agg data to table Agg time_limit: limit for time of transfering data time_format: format for destiny DATE_FORMAT time_period: is a period of aggregation data""" sql = 'INSERT INTO %(tab)s (detract,...
the_stack_v2_python_sparse
ella/ratings/models.py
majerm/ella
train
1
8b132c2e94fbb59c32a2f6ee9d8f424dce93b12e
[ "ImageProcessor.__init__(self, **kwargs)\nself.sigma = sigma\nself.box_size = box_size\nself.filter_size = filter_size", "from photutils.background import Background2D, MedianBackground\nsigma_clip = SigmaClip(sigma=self.sigma)\nbkg_estimator = MedianBackground()\nbkg = Background2D(image.data, self.box_size, fil...
<|body_start_0|> ImageProcessor.__init__(self, **kwargs) self.sigma = sigma self.box_size = box_size self.filter_size = filter_size <|end_body_0|> <|body_start_1|> from photutils.background import Background2D, MedianBackground sigma_clip = SigmaClip(sigma=self.sigma) ...
Remove background from image.
RemoveBackground
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RemoveBackground: """Remove background from image.""" def __init__(self, sigma: float=3.0, box_size: Tuple[int, int]=(50, 50), filter_size: Tuple[int, int]=(3, 3), **kwargs: Any): """Init an image processor that removes background from image. Args: sigma: Sigma for clipping box_size:...
stack_v2_sparse_classes_36k_train_000976
1,681
permissive
[ { "docstring": "Init an image processor that removes background from image. Args: sigma: Sigma for clipping box_size: Box size for bkg estimation. filter_size: Size of filter.", "name": "__init__", "signature": "def __init__(self, sigma: float=3.0, box_size: Tuple[int, int]=(50, 50), filter_size: Tuple[...
2
null
Implement the Python class `RemoveBackground` described below. Class description: Remove background from image. Method signatures and docstrings: - def __init__(self, sigma: float=3.0, box_size: Tuple[int, int]=(50, 50), filter_size: Tuple[int, int]=(3, 3), **kwargs: Any): Init an image processor that removes backgro...
Implement the Python class `RemoveBackground` described below. Class description: Remove background from image. Method signatures and docstrings: - def __init__(self, sigma: float=3.0, box_size: Tuple[int, int]=(50, 50), filter_size: Tuple[int, int]=(3, 3), **kwargs: Any): Init an image processor that removes backgro...
2d7a06e5485b61b6ca7e51d99b08651ea6021086
<|skeleton|> class RemoveBackground: """Remove background from image.""" def __init__(self, sigma: float=3.0, box_size: Tuple[int, int]=(50, 50), filter_size: Tuple[int, int]=(3, 3), **kwargs: Any): """Init an image processor that removes background from image. Args: sigma: Sigma for clipping box_size:...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RemoveBackground: """Remove background from image.""" def __init__(self, sigma: float=3.0, box_size: Tuple[int, int]=(50, 50), filter_size: Tuple[int, int]=(3, 3), **kwargs: Any): """Init an image processor that removes background from image. Args: sigma: Sigma for clipping box_size: Box size for...
the_stack_v2_python_sparse
pyobs/images/processors/misc/removebackground.py
pyobs/pyobs-core
train
9
042847acb7e926eac9a7c327ae6a4b3bb5af1d8c
[ "super().__init__(grad=False, **kwargs)\nself.key_mapping = key_mapping\nself.props_key = props_key", "props = data[self.props_key]\nfor source, target in self.key_mapping.items():\n data[target] = [p[source] for p in props]\nreturn data" ]
<|body_start_0|> super().__init__(grad=False, **kwargs) self.key_mapping = key_mapping self.props_key = props_key <|end_body_0|> <|body_start_1|> props = data[self.props_key] for source, target in self.key_mapping.items(): data[target] = [p[source] for p in props] ...
AddProps2Data
[ "BSD-3-Clause", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AddProps2Data: def __init__(self, props_key: str, key_mapping: Mapping[str, str], **kwargs): """Move properties from property dict to data dict Args props_key: key where properties and :param:`map_key` key is located; key_mapping: maps properties(key) to new keys in data dict(item)""" ...
stack_v2_sparse_classes_36k_train_000977
2,296
permissive
[ { "docstring": "Move properties from property dict to data dict Args props_key: key where properties and :param:`map_key` key is located; key_mapping: maps properties(key) to new keys in data dict(item)", "name": "__init__", "signature": "def __init__(self, props_key: str, key_mapping: Mapping[str, str]...
2
stack_v2_sparse_classes_30k_train_012597
Implement the Python class `AddProps2Data` described below. Class description: Implement the AddProps2Data class. Method signatures and docstrings: - def __init__(self, props_key: str, key_mapping: Mapping[str, str], **kwargs): Move properties from property dict to data dict Args props_key: key where properties and :...
Implement the Python class `AddProps2Data` described below. Class description: Implement the AddProps2Data class. Method signatures and docstrings: - def __init__(self, props_key: str, key_mapping: Mapping[str, str], **kwargs): Move properties from property dict to data dict Args props_key: key where properties and :...
4f41faa7536dcef8fca7b647dcdca25360e5b58a
<|skeleton|> class AddProps2Data: def __init__(self, props_key: str, key_mapping: Mapping[str, str], **kwargs): """Move properties from property dict to data dict Args props_key: key where properties and :param:`map_key` key is located; key_mapping: maps properties(key) to new keys in data dict(item)""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class AddProps2Data: def __init__(self, props_key: str, key_mapping: Mapping[str, str], **kwargs): """Move properties from property dict to data dict Args props_key: key where properties and :param:`map_key` key is located; key_mapping: maps properties(key) to new keys in data dict(item)""" super()....
the_stack_v2_python_sparse
nndet/io/transforms/utils.py
dboun/nnDetection
train
1
ea9e14053c3cbd5b90c142ceff775c96ba8707ab
[ "i = 0\nfor num in nums:\n if num != val:\n nums[i] = num\n i += 1\nreturn i", "for i in range(len(nums) - 1, -1, -1):\n if nums[i] == val:\n nums.pop(i)\nreturn len(nums)" ]
<|body_start_0|> i = 0 for num in nums: if num != val: nums[i] = num i += 1 return i <|end_body_0|> <|body_start_1|> for i in range(len(nums) - 1, -1, -1): if nums[i] == val: nums.pop(i) return len(nums) <|e...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def removeElement_MK1(self, nums: List[int], val: int) -> int: """双指针法 Approach 1: Two Pointers""" <|body_0|> def removeElement_MK2(self, nums: List[int], val: int) -> int: """改进的双指针法,当要删除的元素很少时,速度更快 Approach 2: Two Pointers - when elements to remove are ra...
stack_v2_sparse_classes_36k_train_000978
692
no_license
[ { "docstring": "双指针法 Approach 1: Two Pointers", "name": "removeElement_MK1", "signature": "def removeElement_MK1(self, nums: List[int], val: int) -> int" }, { "docstring": "改进的双指针法,当要删除的元素很少时,速度更快 Approach 2: Two Pointers - when elements to remove are rare", "name": "removeElement_MK2", ...
2
stack_v2_sparse_classes_30k_train_018657
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeElement_MK1(self, nums: List[int], val: int) -> int: 双指针法 Approach 1: Two Pointers - def removeElement_MK2(self, nums: List[int], val: int) -> int: 改进的双指针法,当要删除的元素很少时,速...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def removeElement_MK1(self, nums: List[int], val: int) -> int: 双指针法 Approach 1: Two Pointers - def removeElement_MK2(self, nums: List[int], val: int) -> int: 改进的双指针法,当要删除的元素很少时,速...
d7ba416d22becfa8f2a2ae4eee04c86617cd9332
<|skeleton|> class Solution: def removeElement_MK1(self, nums: List[int], val: int) -> int: """双指针法 Approach 1: Two Pointers""" <|body_0|> def removeElement_MK2(self, nums: List[int], val: int) -> int: """改进的双指针法,当要删除的元素很少时,速度更快 Approach 2: Two Pointers - when elements to remove are ra...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Solution: def removeElement_MK1(self, nums: List[int], val: int) -> int: """双指针法 Approach 1: Two Pointers""" i = 0 for num in nums: if num != val: nums[i] = num i += 1 return i def removeElement_MK2(self, nums: List[int], val: in...
the_stack_v2_python_sparse
0027. Remove Element/Solution.py
faterazer/LeetCode
train
4
5662a5946d92b0dd126207f65ac366b9433538ce
[ "activation = self.params.get('attentionActivation', None)\nif activation == 'None':\n activation = None\nfeature_vector_size = K.int_shape(merged_input)[-1]\natt_layer = layers.TimeDistributed(layers.Dense(feature_vector_size, activation=activation), name='attention_matrix_score')(merged_input)\natt_layer = lay...
<|body_start_0|> activation = self.params.get('attentionActivation', None) if activation == 'None': activation = None feature_vector_size = K.int_shape(merged_input)[-1] att_layer = layers.TimeDistributed(layers.Dense(feature_vector_size, activation=activation), name='attenti...
Bidirectional RNN with an attention mechanism. The attention is applied timestep wise before the BiLSTM layer.
TimePreAttArgBiLSTM
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TimePreAttArgBiLSTM: """Bidirectional RNN with an attention mechanism. The attention is applied timestep wise before the BiLSTM layer.""" def addPreAttentionLayer(self, merged_input): """Add attention mechanisms to the tensor merged_input. Args: merged_input: 3-dimensional Tensor, wh...
stack_v2_sparse_classes_36k_train_000979
12,548
no_license
[ { "docstring": "Add attention mechanisms to the tensor merged_input. Args: merged_input: 3-dimensional Tensor, where the first dimension corresponds to the batch size, the second to the sequence timesteps and the last one to the concatenation of features. Retruns: 3-dimensional Tensor of the same dimension as m...
4
stack_v2_sparse_classes_30k_val_000244
Implement the Python class `TimePreAttArgBiLSTM` described below. Class description: Bidirectional RNN with an attention mechanism. The attention is applied timestep wise before the BiLSTM layer. Method signatures and docstrings: - def addPreAttentionLayer(self, merged_input): Add attention mechanisms to the tensor m...
Implement the Python class `TimePreAttArgBiLSTM` described below. Class description: Bidirectional RNN with an attention mechanism. The attention is applied timestep wise before the BiLSTM layer. Method signatures and docstrings: - def addPreAttentionLayer(self, merged_input): Add attention mechanisms to the tensor m...
74a9a09194bebefd8581cfee0676ed7d6bceaf14
<|skeleton|> class TimePreAttArgBiLSTM: """Bidirectional RNN with an attention mechanism. The attention is applied timestep wise before the BiLSTM layer.""" def addPreAttentionLayer(self, merged_input): """Add attention mechanisms to the tensor merged_input. Args: merged_input: 3-dimensional Tensor, wh...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class TimePreAttArgBiLSTM: """Bidirectional RNN with an attention mechanism. The attention is applied timestep wise before the BiLSTM layer.""" def addPreAttentionLayer(self, merged_input): """Add attention mechanisms to the tensor merged_input. Args: merged_input: 3-dimensional Tensor, where the first...
the_stack_v2_python_sparse
models/att_arg_bilstm.py
mit0110/argument_mining
train
1
736a9edef206569582a0f1b0c5097a6b87112433
[ "video_idx, frames_idx = self.get_clip_location(idx)\nmask_file = self.mask_paths[video_idx]\nif mask_file == '':\n return None\nframes = self.clips[video_idx][frames_idx]\nvid_masks = np.load(mask_file)\nmasks = np.take(vid_masks, frames, 0)\nreturn masks", "self.video_pts = []\nfor video_path in self.video_p...
<|body_start_0|> video_idx, frames_idx = self.get_clip_location(idx) mask_file = self.mask_paths[video_idx] if mask_file == '': return None frames = self.clips[video_idx][frames_idx] vid_masks = np.load(mask_file) masks = np.take(vid_masks, frames, 0) ...
Clips indexer for the test set of the ShanghaiTech Campus dataset. The train and test subsets of the ShanghaiTech dataset use different file formats, so separate clips indexer implementations are needed.
ShanghaiTechTestClipsIndexer
[ "CC-BY-SA-4.0", "CC-BY-SA-3.0", "CC-BY-NC-SA-4.0", "Python-2.0", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ShanghaiTechTestClipsIndexer: """Clips indexer for the test set of the ShanghaiTech Campus dataset. The train and test subsets of the ShanghaiTech dataset use different file formats, so separate clips indexer implementations are needed.""" def get_mask(self, idx: int) -> Tensor | None: ...
stack_v2_sparse_classes_36k_train_000980
14,449
permissive
[ { "docstring": "Retrieve the masks from the file system.", "name": "get_mask", "signature": "def get_mask(self, idx: int) -> Tensor | None" }, { "docstring": "Retrieve the number of frames in each video.", "name": "_compute_frame_pts", "signature": "def _compute_frame_pts(self) -> None" ...
3
stack_v2_sparse_classes_30k_test_000755
Implement the Python class `ShanghaiTechTestClipsIndexer` described below. Class description: Clips indexer for the test set of the ShanghaiTech Campus dataset. The train and test subsets of the ShanghaiTech dataset use different file formats, so separate clips indexer implementations are needed. Method signatures an...
Implement the Python class `ShanghaiTechTestClipsIndexer` described below. Class description: Clips indexer for the test set of the ShanghaiTech Campus dataset. The train and test subsets of the ShanghaiTech dataset use different file formats, so separate clips indexer implementations are needed. Method signatures an...
4abfa93dcfcb98771bc768b334c929ff9a02ce8b
<|skeleton|> class ShanghaiTechTestClipsIndexer: """Clips indexer for the test set of the ShanghaiTech Campus dataset. The train and test subsets of the ShanghaiTech dataset use different file formats, so separate clips indexer implementations are needed.""" def get_mask(self, idx: int) -> Tensor | None: ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class ShanghaiTechTestClipsIndexer: """Clips indexer for the test set of the ShanghaiTech Campus dataset. The train and test subsets of the ShanghaiTech dataset use different file formats, so separate clips indexer implementations are needed.""" def get_mask(self, idx: int) -> Tensor | None: """Retriev...
the_stack_v2_python_sparse
src/anomalib/data/shanghaitech.py
openvinotoolkit/anomalib
train
2,325
17cbd3eefb6242eb7d1385db4ee44a74404e087b
[ "self.loop = loop_param\nself.sleep = sleep_param\nself.mqttClient = MqttClientConnector.MqttClientConnector()\nself.mqttClient.connectSensorData()\nself.pUtil = PersistenceUtil.PersistenceUtil()\nself.TempSensor = TempSensorAdapterTask.TempSensorAdapterTask(loop_param, sleep_param, self.pUtil, self.mqttClient)", ...
<|body_start_0|> self.loop = loop_param self.sleep = sleep_param self.mqttClient = MqttClientConnector.MqttClientConnector() self.mqttClient.connectSensorData() self.pUtil = PersistenceUtil.PersistenceUtil() self.TempSensor = TempSensorAdapterTask.TempSensorAdapterTask(lo...
Method to run TempSensorAdapterTask takes in sleeptime and looptime in the constructors has a bunch of settings to control the program behavior with
MultiSensorAdapter
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiSensorAdapter: """Method to run TempSensorAdapterTask takes in sleeptime and looptime in the constructors has a bunch of settings to control the program behavior with""" def __init__(self, loop_param=10, sleep_param=1): """Constructor Initializing both the sensor tasks and a dat...
stack_v2_sparse_classes_36k_train_000981
3,006
no_license
[ { "docstring": "Constructor Initializing both the sensor tasks and a data manager.", "name": "__init__", "signature": "def __init__(self, loop_param=10, sleep_param=1)" }, { "docstring": "Initialize threads", "name": "__init_threads__", "signature": "def __init_threads__(self)" }, { ...
3
null
Implement the Python class `MultiSensorAdapter` described below. Class description: Method to run TempSensorAdapterTask takes in sleeptime and looptime in the constructors has a bunch of settings to control the program behavior with Method signatures and docstrings: - def __init__(self, loop_param=10, sleep_param=1):...
Implement the Python class `MultiSensorAdapter` described below. Class description: Method to run TempSensorAdapterTask takes in sleeptime and looptime in the constructors has a bunch of settings to control the program behavior with Method signatures and docstrings: - def __init__(self, loop_param=10, sleep_param=1):...
dfd5fd8c757cae8b1306ae3e4eb2cfc9bf124fee
<|skeleton|> class MultiSensorAdapter: """Method to run TempSensorAdapterTask takes in sleeptime and looptime in the constructors has a bunch of settings to control the program behavior with""" def __init__(self, loop_param=10, sleep_param=1): """Constructor Initializing both the sensor tasks and a dat...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class MultiSensorAdapter: """Method to run TempSensorAdapterTask takes in sleeptime and looptime in the constructors has a bunch of settings to control the program behavior with""" def __init__(self, loop_param=10, sleep_param=1): """Constructor Initializing both the sensor tasks and a data manager."""...
the_stack_v2_python_sparse
apps/labs/module06/MultiSensorAdapter.py
mnk400/iot-device
train
0
6973e814e8bd0ed9c172ed148e16416b9727b213
[ "output_json = dict()\noutput_json['AuthenticationDetails'] = request.data['AuthenticationDetails']\noutput_json['SessionDetails'] = request.data['SessionDetails']\noutput_json['Payload'] = dict(zip(['user_ip'], [None]))\nreturn Response(output_json)", "try:\n input_json = request.data\n if 'APIParams' not ...
<|body_start_0|> output_json = dict() output_json['AuthenticationDetails'] = request.data['AuthenticationDetails'] output_json['SessionDetails'] = request.data['SessionDetails'] output_json['Payload'] = dict(zip(['user_ip'], [None])) return Response(output_json) <|end_body_0|> <...
This API gets user's ip
GetUserIPAPI
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GetUserIPAPI: """This API gets user's ip""" def post(self, request): """Post function to get user's ip""" <|body_0|> def get_user_ip_json(self, request): """json function to get user's ip. This is an unusual json function as it takes request object (request) inst...
stack_v2_sparse_classes_36k_train_000982
2,283
no_license
[ { "docstring": "Post function to get user's ip", "name": "post", "signature": "def post(self, request)" }, { "docstring": "json function to get user's ip. This is an unusual json function as it takes request object (request) instead of json object (request.data) as input", "name": "get_user_...
2
null
Implement the Python class `GetUserIPAPI` described below. Class description: This API gets user's ip Method signatures and docstrings: - def post(self, request): Post function to get user's ip - def get_user_ip_json(self, request): json function to get user's ip. This is an unusual json function as it takes request ...
Implement the Python class `GetUserIPAPI` described below. Class description: This API gets user's ip Method signatures and docstrings: - def post(self, request): Post function to get user's ip - def get_user_ip_json(self, request): json function to get user's ip. This is an unusual json function as it takes request ...
36eb9931f330e64902354c6fc471be2adf4b7049
<|skeleton|> class GetUserIPAPI: """This API gets user's ip""" def post(self, request): """Post function to get user's ip""" <|body_0|> def get_user_ip_json(self, request): """json function to get user's ip. This is an unusual json function as it takes request object (request) inst...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class GetUserIPAPI: """This API gets user's ip""" def post(self, request): """Post function to get user's ip""" output_json = dict() output_json['AuthenticationDetails'] = request.data['AuthenticationDetails'] output_json['SessionDetails'] = request.data['SessionDetails'] ...
the_stack_v2_python_sparse
Generic/common/location/api/get_user_ip/views_get_user_ip.py
archiemb303/common_backend_django
train
0
91a8bd58b62134b8b25b058b92931d651fcc1c80
[ "if Projection.projection is None:\n sys.stderr.write('Warning: Projection.getProjection() called before Projection.initProjection()\\n')\nreturn Projection.projection", "if Projection.projection is None:\n sys.stderr.write('Warning: Projection.getProjection() called before Projection.initProjection()\\n')\...
<|body_start_0|> if Projection.projection is None: sys.stderr.write('Warning: Projection.getProjection() called before Projection.initProjection()\n') return Projection.projection <|end_body_0|> <|body_start_1|> if Projection.projection is None: sys.stderr.write('Warning...
Class defining the projection used.
Projection
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Projection: """Class defining the projection used.""" def getProjection(): """Return the projection used.""" <|body_0|> def getProjectionString(): """Return the projection used as a string.""" <|body_1|> def project(long, lat): """Return a pr...
stack_v2_sparse_classes_36k_train_000983
2,522
permissive
[ { "docstring": "Return the projection used.", "name": "getProjection", "signature": "def getProjection()" }, { "docstring": "Return the projection used as a string.", "name": "getProjectionString", "signature": "def getProjectionString()" }, { "docstring": "Return a projected coo...
4
stack_v2_sparse_classes_30k_train_020699
Implement the Python class `Projection` described below. Class description: Class defining the projection used. Method signatures and docstrings: - def getProjection(): Return the projection used. - def getProjectionString(): Return the projection used as a string. - def project(long, lat): Return a projected coordin...
Implement the Python class `Projection` described below. Class description: Class defining the projection used. Method signatures and docstrings: - def getProjection(): Return the projection used. - def getProjectionString(): Return the projection used as a string. - def project(long, lat): Return a projected coordin...
8aba6eaae76989facf3442305c8089d3cc366bcf
<|skeleton|> class Projection: """Class defining the projection used.""" def getProjection(): """Return the projection used.""" <|body_0|> def getProjectionString(): """Return the projection used as a string.""" <|body_1|> def project(long, lat): """Return a pr...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Projection: """Class defining the projection used.""" def getProjection(): """Return the projection used.""" if Projection.projection is None: sys.stderr.write('Warning: Projection.getProjection() called before Projection.initProjection()\n') return Projection.projecti...
the_stack_v2_python_sparse
resources/osm_importer/projection.py
cyberbotics/webots
train
2,495
6b2c4143a80df5931e14f92675e9c4bdb2ab2741
[ "super(Transformer, self).__init__()\nself.embedding = fc_block(input_dim, output_dim, activation=activation)\nself.act = activation\nlayers = []\ndims = [output_dim] + [output_dim] * layer_num\nself.dropout = nn.Dropout(dropout_ratio)\nfor i in range(layer_num):\n layers.append(TransformerLayer(dims[i], head_di...
<|body_start_0|> super(Transformer, self).__init__() self.embedding = fc_block(input_dim, output_dim, activation=activation) self.act = activation layers = [] dims = [output_dim] + [output_dim] * layer_num self.dropout = nn.Dropout(dropout_ratio) for i in range(la...
Overview: Transformer implementation .. note:: For details refer to Attention is all you need: http://arxiv.org/abs/1706.03762
Transformer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Transformer: """Overview: Transformer implementation .. note:: For details refer to Attention is all you need: http://arxiv.org/abs/1706.03762""" def __init__(self, input_dim: int, head_dim: int=128, hidden_dim: int=1024, output_dim: int=256, head_num: int=2, mlp_num: int=2, layer_num: int=3...
stack_v2_sparse_classes_36k_train_000984
8,556
permissive
[ { "docstring": "Overview: Init transformer Arguments: - input_dim (:obj:`int`): dimension of input - head_dim (:obj:`int`): dimension of each head - hidden_dim (:obj:`int`): dimension of hidden layer in mlp - output_dim (:obj:`int`): dimension of output - head_num (:obj:`int`): number of heads for multihead att...
2
null
Implement the Python class `Transformer` described below. Class description: Overview: Transformer implementation .. note:: For details refer to Attention is all you need: http://arxiv.org/abs/1706.03762 Method signatures and docstrings: - def __init__(self, input_dim: int, head_dim: int=128, hidden_dim: int=1024, ou...
Implement the Python class `Transformer` described below. Class description: Overview: Transformer implementation .. note:: For details refer to Attention is all you need: http://arxiv.org/abs/1706.03762 Method signatures and docstrings: - def __init__(self, input_dim: int, head_dim: int=128, hidden_dim: int=1024, ou...
eb483fa6e46602d58c8e7d2ca1e566adca28e703
<|skeleton|> class Transformer: """Overview: Transformer implementation .. note:: For details refer to Attention is all you need: http://arxiv.org/abs/1706.03762""" def __init__(self, input_dim: int, head_dim: int=128, hidden_dim: int=1024, output_dim: int=256, head_num: int=2, mlp_num: int=2, layer_num: int=3...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Transformer: """Overview: Transformer implementation .. note:: For details refer to Attention is all you need: http://arxiv.org/abs/1706.03762""" def __init__(self, input_dim: int, head_dim: int=128, hidden_dim: int=1024, output_dim: int=256, head_num: int=2, mlp_num: int=2, layer_num: int=3, dropout_rat...
the_stack_v2_python_sparse
ding/torch_utils/network/transformer.py
shengxuesun/DI-engine
train
1
eec1fe6596707cec2607002c0eaefec805e6f255
[ "self.config = config_\nself.logger = logging.getLogger('cuda_logger')\ndata_provider = DataProvider(self.config)\nfilename = self.config['city_state_creator'].get('filename', 'city_states.dill')\nself.city_states = data_provider.read_city_states(filename)\nself.reg_models = data_provider.read_regression_models()",...
<|body_start_0|> self.config = config_ self.logger = logging.getLogger('cuda_logger') data_provider = DataProvider(self.config) filename = self.config['city_state_creator'].get('filename', 'city_states.dill') self.city_states = data_provider.read_city_states(filename) sel...
Fills up sparse city state matrices
SparseMatrixFiller
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SparseMatrixFiller: """Fills up sparse city state matrices""" def __init__(self, config_): """Constructor :param config_: :return:""" <|body_0|> def fill_matrices(self): """Fills up sparse matrices :param: :return:""" <|body_1|> def fill_rewards_matr...
stack_v2_sparse_classes_36k_train_000985
5,073
no_license
[ { "docstring": "Constructor :param config_: :return:", "name": "__init__", "signature": "def __init__(self, config_)" }, { "docstring": "Fills up sparse matrices :param: :return:", "name": "fill_matrices", "signature": "def fill_matrices(self)" }, { "docstring": "Fills missing en...
6
null
Implement the Python class `SparseMatrixFiller` described below. Class description: Fills up sparse city state matrices Method signatures and docstrings: - def __init__(self, config_): Constructor :param config_: :return: - def fill_matrices(self): Fills up sparse matrices :param: :return: - def fill_rewards_matrix(s...
Implement the Python class `SparseMatrixFiller` described below. Class description: Fills up sparse city state matrices Method signatures and docstrings: - def __init__(self, config_): Constructor :param config_: :return: - def fill_matrices(self): Fills up sparse matrices :param: :return: - def fill_rewards_matrix(s...
f7fcd2cc1d6ba18b199d176d4d39193f025ee281
<|skeleton|> class SparseMatrixFiller: """Fills up sparse city state matrices""" def __init__(self, config_): """Constructor :param config_: :return:""" <|body_0|> def fill_matrices(self): """Fills up sparse matrices :param: :return:""" <|body_1|> def fill_rewards_matr...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class SparseMatrixFiller: """Fills up sparse city state matrices""" def __init__(self, config_): """Constructor :param config_: :return:""" self.config = config_ self.logger = logging.getLogger('cuda_logger') data_provider = DataProvider(self.config) filename = self.conf...
the_stack_v2_python_sparse
learn_to_earn_framework/sparse_matrices/fill_sparse_matrices.py
transparent-framework/optimize-ride-sharing-earnings
train
7
5672a433858beb1d00ae7120d445c84f9a949de8
[ "self.maze = maze\nself.x1 = x1\nself.x2 = x2\nself.y1 = y1\nself.y2 = y2\nself.queue = deque()\nself.position = [lambda x, y: (x + 1, y), lambda x, y: (x - 1, y), lambda x, y: (x, y + 1), lambda x, y: (x, y - 1)]", "self.queue.append((self.x1, self.y1, -1))\npath = []\nwhile len(self.queue) > 0:\n cur_node = ...
<|body_start_0|> self.maze = maze self.x1 = x1 self.x2 = x2 self.y1 = y1 self.y2 = y2 self.queue = deque() self.position = [lambda x, y: (x + 1, y), lambda x, y: (x - 1, y), lambda x, y: (x, y + 1), lambda x, y: (x, y - 1)] <|end_body_0|> <|body_start_1|> ...
队列实现 广度优先
QueueMazePath
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QueueMazePath: """队列实现 广度优先""" def __init__(self, maze, x1, y1, x2, y2): """初始化数据 :param maze: 二维列表 :param x1: 起始坐标x :param y1: 起始坐标y :param x2: 终点坐标x :param y2: 终点坐标y""" <|body_0|> def maze_alt(self): """实现算法 :return:""" <|body_1|> <|end_skeleton|> <|b...
stack_v2_sparse_classes_36k_train_000986
4,700
no_license
[ { "docstring": "初始化数据 :param maze: 二维列表 :param x1: 起始坐标x :param y1: 起始坐标y :param x2: 终点坐标x :param y2: 终点坐标y", "name": "__init__", "signature": "def __init__(self, maze, x1, y1, x2, y2)" }, { "docstring": "实现算法 :return:", "name": "maze_alt", "signature": "def maze_alt(self)" } ]
2
stack_v2_sparse_classes_30k_train_018877
Implement the Python class `QueueMazePath` described below. Class description: 队列实现 广度优先 Method signatures and docstrings: - def __init__(self, maze, x1, y1, x2, y2): 初始化数据 :param maze: 二维列表 :param x1: 起始坐标x :param y1: 起始坐标y :param x2: 终点坐标x :param y2: 终点坐标y - def maze_alt(self): 实现算法 :return:
Implement the Python class `QueueMazePath` described below. Class description: 队列实现 广度优先 Method signatures and docstrings: - def __init__(self, maze, x1, y1, x2, y2): 初始化数据 :param maze: 二维列表 :param x1: 起始坐标x :param y1: 起始坐标y :param x2: 终点坐标x :param y2: 终点坐标y - def maze_alt(self): 实现算法 :return: <|skeleton|> class Que...
894137bacf0305b8afdd74302f416b2715e216fd
<|skeleton|> class QueueMazePath: """队列实现 广度优先""" def __init__(self, maze, x1, y1, x2, y2): """初始化数据 :param maze: 二维列表 :param x1: 起始坐标x :param y1: 起始坐标y :param x2: 终点坐标x :param y2: 终点坐标y""" <|body_0|> def maze_alt(self): """实现算法 :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class QueueMazePath: """队列实现 广度优先""" def __init__(self, maze, x1, y1, x2, y2): """初始化数据 :param maze: 二维列表 :param x1: 起始坐标x :param y1: 起始坐标y :param x2: 终点坐标x :param y2: 终点坐标y""" self.maze = maze self.x1 = x1 self.x2 = x2 self.y1 = y1 self.y2 = y2 self.queu...
the_stack_v2_python_sparse
data_struct/stack_queue_demo.py
dxc13762525628/concurrent
train
0
aeb8478cc684637b28720155b71014c7b9b81c1d
[ "self.nums = nums\nN = len(nums)\nBIT = [0] * (N + 1)\nfor i in range(N + 1):\n BIT[i] = sum(nums[i - (i & -i):i])\nself.BIT = BIT", "if not self.nums:\n return\nd = val - self.nums[i]\nself.nums[i] = val\nx = i + 1\nwhile x < len(self.BIT):\n self.BIT[x] += d\n x += x & -x", "if not self.nums or i ...
<|body_start_0|> self.nums = nums N = len(nums) BIT = [0] * (N + 1) for i in range(N + 1): BIT[i] = sum(nums[i - (i & -i):i]) self.BIT = BIT <|end_body_0|> <|body_start_1|> if not self.nums: return d = val - self.nums[i] self.nums[...
NumArray
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NumArray: def __init__(self, nums): """:type nums: List[int]""" <|body_0|> def update(self, i, val): """:type i: int :type val: int :rtype: void""" <|body_1|> def sumRange(self, i, j): """:type i: int :type j: int :rtype: int""" <|body_2|...
stack_v2_sparse_classes_36k_train_000987
3,955
permissive
[ { "docstring": ":type nums: List[int]", "name": "__init__", "signature": "def __init__(self, nums)" }, { "docstring": ":type i: int :type val: int :rtype: void", "name": "update", "signature": "def update(self, i, val)" }, { "docstring": ":type i: int :type j: int :rtype: int", ...
3
null
Implement the Python class `NumArray` described below. Class description: Implement the NumArray class. Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] - def update(self, i, val): :type i: int :type val: int :rtype: void - def sumRange(self, i, j): :type i: int :type j: int :rtype:...
Implement the Python class `NumArray` described below. Class description: Implement the NumArray class. Method signatures and docstrings: - def __init__(self, nums): :type nums: List[int] - def update(self, i, val): :type i: int :type val: int :rtype: void - def sumRange(self, i, j): :type i: int :type j: int :rtype:...
2830c7e2ada8dfd3dcdda7c06846116d4f944a27
<|skeleton|> class NumArray: def __init__(self, nums): """:type nums: List[int]""" <|body_0|> def update(self, i, val): """:type i: int :type val: int :rtype: void""" <|body_1|> def sumRange(self, i, j): """:type i: int :type j: int :rtype: int""" <|body_2|...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class NumArray: def __init__(self, nums): """:type nums: List[int]""" self.nums = nums N = len(nums) BIT = [0] * (N + 1) for i in range(N + 1): BIT[i] = sum(nums[i - (i & -i):i]) self.BIT = BIT def update(self, i, val): """:type i: int :type v...
the_stack_v2_python_sparse
leetcode/medium/Range_Sum_Query_Mutable.py
shhuan/algorithms
train
0
b891a1d58d4a863f443a35cd5c3803828e8b3b29
[ "self.ebvs = {}\nself.ebvs['young'] = float(self.parameters['E_BVs_young'])\nself.ebvs_old_factor = float(self.parameters['E_BVs_old_factor'])\nself.ebvs['old'] = self.ebvs_old_factor * self.ebvs['young']\nself.uv_bump_wavelength = float(self.parameters['uv_bump_wavelength'])\nself.uv_bump_width = float(self.parame...
<|body_start_0|> self.ebvs = {} self.ebvs['young'] = float(self.parameters['E_BVs_young']) self.ebvs_old_factor = float(self.parameters['E_BVs_old_factor']) self.ebvs['old'] = self.ebvs_old_factor * self.ebvs['young'] self.uv_bump_wavelength = float(self.parameters['uv_bump_wavel...
Calzetti + Leitherer attenuation module This module computes the dust attenuation using the formulae from Calzetti et al. (2000) and Leitherer et al. (2002). The attenuation can be computed on the whole spectrum or on a specific contribution and is added to the SED as a negative contribution.
CalzLeit
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CalzLeit: """Calzetti + Leitherer attenuation module This module computes the dust attenuation using the formulae from Calzetti et al. (2000) and Leitherer et al. (2002). The attenuation can be computed on the whole spectrum or on a specific contribution and is added to the SED as a negative cont...
stack_v2_sparse_classes_36k_train_000988
11,143
no_license
[ { "docstring": "Get the filters from the database", "name": "_init_code", "signature": "def _init_code(self)" }, { "docstring": "Add the CCM dust attenuation to the SED. Parameters ---------- sed: pcigale.sed.SED object", "name": "process", "signature": "def process(self, sed)" } ]
2
stack_v2_sparse_classes_30k_train_016517
Implement the Python class `CalzLeit` described below. Class description: Calzetti + Leitherer attenuation module This module computes the dust attenuation using the formulae from Calzetti et al. (2000) and Leitherer et al. (2002). The attenuation can be computed on the whole spectrum or on a specific contribution and...
Implement the Python class `CalzLeit` described below. Class description: Calzetti + Leitherer attenuation module This module computes the dust attenuation using the formulae from Calzetti et al. (2000) and Leitherer et al. (2002). The attenuation can be computed on the whole spectrum or on a specific contribution and...
9ef9b99425537350b8706fddfe90ed47301107a5
<|skeleton|> class CalzLeit: """Calzetti + Leitherer attenuation module This module computes the dust attenuation using the formulae from Calzetti et al. (2000) and Leitherer et al. (2002). The attenuation can be computed on the whole spectrum or on a specific contribution and is added to the SED as a negative cont...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class CalzLeit: """Calzetti + Leitherer attenuation module This module computes the dust attenuation using the formulae from Calzetti et al. (2000) and Leitherer et al. (2002). The attenuation can be computed on the whole spectrum or on a specific contribution and is added to the SED as a negative contribution.""" ...
the_stack_v2_python_sparse
pcigale/sed_modules/dustatt_calzleit.py
JohannesBuchner/cigale
train
5
1116992dc5dd5909f642ee759e3b607fa8a21d41
[ "assert textcoords.startswith('offset '), \"*textcoords* must be 'offset points' or 'offset pixels'\"\nself.line = line\nself.xytext = xytext\nxs, ys = line.get_data()\nif type(xs) == au.quantity.Quantity:\n xs = xs.value\nif type(ys) == au.quantity.Quantity:\n ys = ys.value\n\ndef neighbours(x, xs, ys, try_i...
<|body_start_0|> assert textcoords.startswith('offset '), "*textcoords* must be 'offset points' or 'offset pixels'" self.line = line self.xytext = xytext xs, ys = line.get_data() if type(xs) == au.quantity.Quantity: xs = xs.value if type(ys) == au.quantity.Qua...
A sloped annotation to *line* at position *x* with *text* Optionally an arrow pointing from the text to the graph at *x* can be drawn. Usage ----- fig, ax = plt.subplots() x = np.linspace(0, 2*pi) line, = ax.plot(x, sin(x)) ax.add_artist(LineAnnotation("text", line, 1.5))
LineAnnotation
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LineAnnotation: """A sloped annotation to *line* at position *x* with *text* Optionally an arrow pointing from the text to the graph at *x* can be drawn. Usage ----- fig, ax = plt.subplots() x = np.linspace(0, 2*pi) line, = ax.plot(x, sin(x)) ax.add_artist(LineAnnotation("text", line, 1.5))""" ...
stack_v2_sparse_classes_36k_train_000989
4,212
permissive
[ { "docstring": "Annotate the point at *x* of the graph *line* with text *text*. By default, the text is displayed with the same rotation as the slope of the graph at a relative position *xytext* above it (perpendicularly above). An arrow pointing from the text to the annotated point *xy* can be added by definin...
3
null
Implement the Python class `LineAnnotation` described below. Class description: A sloped annotation to *line* at position *x* with *text* Optionally an arrow pointing from the text to the graph at *x* can be drawn. Usage ----- fig, ax = plt.subplots() x = np.linspace(0, 2*pi) line, = ax.plot(x, sin(x)) ax.add_artist(L...
Implement the Python class `LineAnnotation` described below. Class description: A sloped annotation to *line* at position *x* with *text* Optionally an arrow pointing from the text to the graph at *x* can be drawn. Usage ----- fig, ax = plt.subplots() x = np.linspace(0, 2*pi) line, = ax.plot(x, sin(x)) ax.add_artist(L...
000631c0e643cc3d68a7c97658573a931ea745cb
<|skeleton|> class LineAnnotation: """A sloped annotation to *line* at position *x* with *text* Optionally an arrow pointing from the text to the graph at *x* can be drawn. Usage ----- fig, ax = plt.subplots() x = np.linspace(0, 2*pi) line, = ax.plot(x, sin(x)) ax.add_artist(LineAnnotation("text", line, 1.5))""" ...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LineAnnotation: """A sloped annotation to *line* at position *x* with *text* Optionally an arrow pointing from the text to the graph at *x* can be drawn. Usage ----- fig, ax = plt.subplots() x = np.linspace(0, 2*pi) line, = ax.plot(x, sin(x)) ax.add_artist(LineAnnotation("text", line, 1.5))""" def __init...
the_stack_v2_python_sparse
pyathena/plt_tools/line_annotation.py
jeonggyukim/pyathena
train
3
c41fc58f338093078e3aa771f9a7fa301d4955c4
[ "self.drive.find_element_by_xpath(\".//*[@id='app']/div[3]/div[2]/div/div[2]/div/div/div[3]/form/div[1]/div/div/label[2]/span[1]/span\").click()\nusername = self.drive.find_element_by_xpath(\".//*[@id='app']/div[3]/div[2]/div/div[2]/div/div/div[3]/form/div[2]/div/div/input\")\npassword = self.drive.find_element_by_...
<|body_start_0|> self.drive.find_element_by_xpath(".//*[@id='app']/div[3]/div[2]/div/div[2]/div/div/div[3]/form/div[1]/div/div/label[2]/span[1]/span").click() username = self.drive.find_element_by_xpath(".//*[@id='app']/div[3]/div[2]/div/div[2]/div/div/div[3]/form/div[2]/div/div/input") password...
portal_fabu_001
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class portal_fabu_001: def test_login_001(self): """登录""" <|body_0|> def test_fabu_001(self): """流转发布第一步""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.drive.find_element_by_xpath(".//*[@id='app']/div[3]/div[2]/div/div[2]/div/div/div[3]/form/div[1]/...
stack_v2_sparse_classes_36k_train_000990
3,377
no_license
[ { "docstring": "登录", "name": "test_login_001", "signature": "def test_login_001(self)" }, { "docstring": "流转发布第一步", "name": "test_fabu_001", "signature": "def test_fabu_001(self)" } ]
2
stack_v2_sparse_classes_30k_train_017252
Implement the Python class `portal_fabu_001` described below. Class description: Implement the portal_fabu_001 class. Method signatures and docstrings: - def test_login_001(self): 登录 - def test_fabu_001(self): 流转发布第一步
Implement the Python class `portal_fabu_001` described below. Class description: Implement the portal_fabu_001 class. Method signatures and docstrings: - def test_login_001(self): 登录 - def test_fabu_001(self): 流转发布第一步 <|skeleton|> class portal_fabu_001: def test_login_001(self): """登录""" <|body_...
87d713a5c8d3763b3dfa191cd7a00933899679b9
<|skeleton|> class portal_fabu_001: def test_login_001(self): """登录""" <|body_0|> def test_fabu_001(self): """流转发布第一步""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class portal_fabu_001: def test_login_001(self): """登录""" self.drive.find_element_by_xpath(".//*[@id='app']/div[3]/div[2]/div/div[2]/div/div/div[3]/form/div[1]/div/div/label[2]/span[1]/span").click() username = self.drive.find_element_by_xpath(".//*[@id='app']/div[3]/div[2]/div/div[2]/div/di...
the_stack_v2_python_sparse
por/portalA.py
Zhaokun-max/workspaces
train
0
bb0c5155111e0c6ad0be0dcc95af68e9fde7e24b
[ "response = self.client.get(reverse('education:demographic_detail', args=('XYZ',)))\nself.assertEqual(response.status_code, 200)\nself.assertEqual(response.context.get('json_rate_data'), None)\nself.assertNotEqual(response.context.get('message'), None)\nself.assertContains(response, 'Home')\nself.assertContains(res...
<|body_start_0|> response = self.client.get(reverse('education:demographic_detail', args=('XYZ',))) self.assertEqual(response.status_code, 200) self.assertEqual(response.context.get('json_rate_data'), None) self.assertNotEqual(response.context.get('message'), None) self.assertCon...
EducationDemographicDetailsViewTest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EducationDemographicDetailsViewTest: def test_fake_group(self): """Make sure the page gives an error message if a group is specified that does not actually exist.""" <|body_0|> def test_no_data(self): """Make sure all demographic pages render even when there is no da...
stack_v2_sparse_classes_36k_train_000991
9,266
no_license
[ { "docstring": "Make sure the page gives an error message if a group is specified that does not actually exist.", "name": "test_fake_group", "signature": "def test_fake_group(self)" }, { "docstring": "Make sure all demographic pages render even when there is no data in the database.", "name"...
3
stack_v2_sparse_classes_30k_train_017010
Implement the Python class `EducationDemographicDetailsViewTest` described below. Class description: Implement the EducationDemographicDetailsViewTest class. Method signatures and docstrings: - def test_fake_group(self): Make sure the page gives an error message if a group is specified that does not actually exist. -...
Implement the Python class `EducationDemographicDetailsViewTest` described below. Class description: Implement the EducationDemographicDetailsViewTest class. Method signatures and docstrings: - def test_fake_group(self): Make sure the page gives an error message if a group is specified that does not actually exist. -...
2a8e2dc4e9b3cb92d4d437b37e61940a9486b81f
<|skeleton|> class EducationDemographicDetailsViewTest: def test_fake_group(self): """Make sure the page gives an error message if a group is specified that does not actually exist.""" <|body_0|> def test_no_data(self): """Make sure all demographic pages render even when there is no da...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class EducationDemographicDetailsViewTest: def test_fake_group(self): """Make sure the page gives an error message if a group is specified that does not actually exist.""" response = self.client.get(reverse('education:demographic_detail', args=('XYZ',))) self.assertEqual(response.status_code...
the_stack_v2_python_sparse
education/tests.py
smeds1/mysite
train
1
ba5a4e19bc1af156ac0e7caf39cf21953f8089f7
[ "super().__init__()\nself._encoder = FCNNEncoder(layer_spec_input_res, layer_spec_target_res, kernel_size, initial_filters, filters_cap, encoding_dimension)\nself._decoder = FCNNDecoder(layer_spec_target_res, layer_spec_input_res, kernel_size, filters_cap, initial_filters, channels)", "encoding = self._encoder(in...
<|body_start_0|> super().__init__() self._encoder = FCNNEncoder(layer_spec_input_res, layer_spec_target_res, kernel_size, initial_filters, filters_cap, encoding_dimension) self._decoder = FCNNDecoder(layer_spec_target_res, layer_spec_input_res, kernel_size, filters_cap, initial_filters, channels...
Primitive Model for all fully convolutional autoencoders. Examples: * Direct Usage: .. testcode:: autoencoder = FCNNAutoencoder( layer_spec_input_res=(64, 64), layer_spec_target_res=(8, 8), kernel_size=5, initial_filters=32, filters_cap=128, encoding_dimension=100, channels=3, ) encoding, reconstruction = autoencoder(t...
FCNNAutoencoder
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FCNNAutoencoder: """Primitive Model for all fully convolutional autoencoders. Examples: * Direct Usage: .. testcode:: autoencoder = FCNNAutoencoder( layer_spec_input_res=(64, 64), layer_spec_target_res=(8, 8), kernel_size=5, initial_filters=32, filters_cap=128, encoding_dimension=100, channels=3,...
stack_v2_sparse_classes_36k_train_000992
6,511
permissive
[ { "docstring": "Instantiate the :py:class:`FCNNBaseAutoEncoder`. Args: layer_spec_input_res (:obj:`tuple` of (:obj:`int`, :obj:`int`)): Shape of the input tensors. layer_spec_target_res: (:obj:`tuple` of (:obj:`int`, :obj:`int`)): Shape of tensor desired as output of :func:`_get_layer_spec`. kernel_size (int): ...
2
stack_v2_sparse_classes_30k_val_000904
Implement the Python class `FCNNAutoencoder` described below. Class description: Primitive Model for all fully convolutional autoencoders. Examples: * Direct Usage: .. testcode:: autoencoder = FCNNAutoencoder( layer_spec_input_res=(64, 64), layer_spec_target_res=(8, 8), kernel_size=5, initial_filters=32, filters_cap=1...
Implement the Python class `FCNNAutoencoder` described below. Class description: Primitive Model for all fully convolutional autoencoders. Examples: * Direct Usage: .. testcode:: autoencoder = FCNNAutoencoder( layer_spec_input_res=(64, 64), layer_spec_target_res=(8, 8), kernel_size=5, initial_filters=32, filters_cap=1...
92ac86fb0c962854e0d80c44165e0e7ff126b3c1
<|skeleton|> class FCNNAutoencoder: """Primitive Model for all fully convolutional autoencoders. Examples: * Direct Usage: .. testcode:: autoencoder = FCNNAutoencoder( layer_spec_input_res=(64, 64), layer_spec_target_res=(8, 8), kernel_size=5, initial_filters=32, filters_cap=128, encoding_dimension=100, channels=3,...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class FCNNAutoencoder: """Primitive Model for all fully convolutional autoencoders. Examples: * Direct Usage: .. testcode:: autoencoder = FCNNAutoencoder( layer_spec_input_res=(64, 64), layer_spec_target_res=(8, 8), kernel_size=5, initial_filters=32, filters_cap=128, encoding_dimension=100, channels=3, ) encoding, ...
the_stack_v2_python_sparse
src/ashpy/models/convolutional/autoencoders.py
zurutech/ashpy
train
89
4c5950ddf6f2c8b2bd1b805712ea1fb4d0c9fb83
[ "for key, val in cls.param.items():\n if not isinstance(val, (list, Quantity)):\n cls.param[key] = [val]\n elif isinstance(val, Quantity) and val.size == 1:\n try:\n iter(val.value)\n except:\n cls.param[key] = [val.value] * val.unit\ncombos = tuple((dict(zip(cls.par...
<|body_start_0|> for key, val in cls.param.items(): if not isinstance(val, (list, Quantity)): cls.param[key] = [val] elif isinstance(val, Quantity) and val.size == 1: try: iter(val.value) except: cls....
Base class for supernova model classes that initialise from physics parameters.
_RegistryModel
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _RegistryModel: """Base class for supernova model classes that initialise from physics parameters.""" def get_param_combinations(cls): """Returns all valid combinations of parameters for a given SNEWPY register model. Subclasses can provide a Callable `cls._param_validator` that take...
stack_v2_sparse_classes_36k_train_000993
18,095
permissive
[ { "docstring": "Returns all valid combinations of parameters for a given SNEWPY register model. Subclasses can provide a Callable `cls._param_validator` that takes a combination of parameters as an argument and returns True if a particular combinations of parameters is valid. If None is provided, all combinatio...
2
stack_v2_sparse_classes_30k_train_000207
Implement the Python class `_RegistryModel` described below. Class description: Base class for supernova model classes that initialise from physics parameters. Method signatures and docstrings: - def get_param_combinations(cls): Returns all valid combinations of parameters for a given SNEWPY register model. Subclasse...
Implement the Python class `_RegistryModel` described below. Class description: Base class for supernova model classes that initialise from physics parameters. Method signatures and docstrings: - def get_param_combinations(cls): Returns all valid combinations of parameters for a given SNEWPY register model. Subclasse...
feb3a6c46d7dc4e999446994025001de77768e1d
<|skeleton|> class _RegistryModel: """Base class for supernova model classes that initialise from physics parameters.""" def get_param_combinations(cls): """Returns all valid combinations of parameters for a given SNEWPY register model. Subclasses can provide a Callable `cls._param_validator` that take...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class _RegistryModel: """Base class for supernova model classes that initialise from physics parameters.""" def get_param_combinations(cls): """Returns all valid combinations of parameters for a given SNEWPY register model. Subclasses can provide a Callable `cls._param_validator` that takes a combinati...
the_stack_v2_python_sparse
python/snewpy/models/base.py
SNEWS2/snewpy
train
22
2b9790055970f0e55c898e7d0da41adc6e3a16d6
[ "curent_file_path = os.path.realpath(__file__)\ndir_name = os.path.dirname(curent_file_path)\ndir_name = os.path.dirname(dir_name)\nreturn dir_name + '\\\\'", "real_file_path = self.get_project_path() + file_path\nconfig = configparser.ConfigParser()\nconfig.read(real_file_path)\nvalue = config.get('env', key)\nr...
<|body_start_0|> curent_file_path = os.path.realpath(__file__) dir_name = os.path.dirname(curent_file_path) dir_name = os.path.dirname(dir_name) return dir_name + '\\' <|end_body_0|> <|body_start_1|> real_file_path = self.get_project_path() + file_path config = configpar...
DataRead
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DataRead: def get_project_path(self): """获取当前工程路径 :return:""" <|body_0|> def read_ini(self, file_path, key): """读取ini文件,返回key 返回的value :param file_path: 文件路径 :param key: :return: key 对应的value""" <|body_1|> def read_yaml(self, file_path): """读取yam...
stack_v2_sparse_classes_36k_train_000994
1,600
no_license
[ { "docstring": "获取当前工程路径 :return:", "name": "get_project_path", "signature": "def get_project_path(self)" }, { "docstring": "读取ini文件,返回key 返回的value :param file_path: 文件路径 :param key: :return: key 对应的value", "name": "read_ini", "signature": "def read_ini(self, file_path, key)" }, { ...
3
stack_v2_sparse_classes_30k_train_004265
Implement the Python class `DataRead` described below. Class description: Implement the DataRead class. Method signatures and docstrings: - def get_project_path(self): 获取当前工程路径 :return: - def read_ini(self, file_path, key): 读取ini文件,返回key 返回的value :param file_path: 文件路径 :param key: :return: key 对应的value - def read_yam...
Implement the Python class `DataRead` described below. Class description: Implement the DataRead class. Method signatures and docstrings: - def get_project_path(self): 获取当前工程路径 :return: - def read_ini(self, file_path, key): 读取ini文件,返回key 返回的value :param file_path: 文件路径 :param key: :return: key 对应的value - def read_yam...
d281e1438260746d27627326b76f5e4f10b74a5b
<|skeleton|> class DataRead: def get_project_path(self): """获取当前工程路径 :return:""" <|body_0|> def read_ini(self, file_path, key): """读取ini文件,返回key 返回的value :param file_path: 文件路径 :param key: :return: key 对应的value""" <|body_1|> def read_yaml(self, file_path): """读取yam...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class DataRead: def get_project_path(self): """获取当前工程路径 :return:""" curent_file_path = os.path.realpath(__file__) dir_name = os.path.dirname(curent_file_path) dir_name = os.path.dirname(dir_name) return dir_name + '\\' def read_ini(self, file_path, key): """读取ini...
the_stack_v2_python_sparse
jinrongxiangmuzonghe/caw/DataRead.py
dA123Ea/ApiAutoTest
train
0
cf91167ae80ee39a766aa708cf7e50c09b485a1c
[ "wmin = 2.0 * fmin / sr\nwmax = 2.0 * fmax / sr\nite = np.arange(-(win_size // 2), (win_size + 1) // 2)\nself.filter = wmin * np.sinc(wmin * ite) - wmax * np.sinc(wmax * ite)\nself.filter[win_size // 2] += 1.0\nself.filter *= np.hamming(win_size)\nself.status = np.zeros(win_size)\nself.win_size = win_size", "if i...
<|body_start_0|> wmin = 2.0 * fmin / sr wmax = 2.0 * fmax / sr ite = np.arange(-(win_size // 2), (win_size + 1) // 2) self.filter = wmin * np.sinc(wmin * ite) - wmax * np.sinc(wmax * ite) self.filter[win_size // 2] += 1.0 self.filter *= np.hamming(win_size) self.s...
BSF
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BSF: def __init__(self, fmin, fmax, win_size, sr): """Args: fmin (int):the lowest frequency of the band stopped fmax (int):the highest frequency of the band stopped win_size(int):sizeof window applied to filter sr (int):sampling rate of the signal""" <|body_0|> def __call__(...
stack_v2_sparse_classes_36k_train_000995
5,321
no_license
[ { "docstring": "Args: fmin (int):the lowest frequency of the band stopped fmax (int):the highest frequency of the band stopped win_size(int):sizeof window applied to filter sr (int):sampling rate of the signal", "name": "__init__", "signature": "def __init__(self, fmin, fmax, win_size, sr)" }, { ...
2
null
Implement the Python class `BSF` described below. Class description: Implement the BSF class. Method signatures and docstrings: - def __init__(self, fmin, fmax, win_size, sr): Args: fmin (int):the lowest frequency of the band stopped fmax (int):the highest frequency of the band stopped win_size(int):sizeof window app...
Implement the Python class `BSF` described below. Class description: Implement the BSF class. Method signatures and docstrings: - def __init__(self, fmin, fmax, win_size, sr): Args: fmin (int):the lowest frequency of the band stopped fmax (int):the highest frequency of the band stopped win_size(int):sizeof window app...
11edb5540f57429019ece8ddd60ed439f337b186
<|skeleton|> class BSF: def __init__(self, fmin, fmax, win_size, sr): """Args: fmin (int):the lowest frequency of the band stopped fmax (int):the highest frequency of the band stopped win_size(int):sizeof window applied to filter sr (int):sampling rate of the signal""" <|body_0|> def __call__(...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class BSF: def __init__(self, fmin, fmax, win_size, sr): """Args: fmin (int):the lowest frequency of the band stopped fmax (int):the highest frequency of the band stopped win_size(int):sizeof window applied to filter sr (int):sampling rate of the signal""" wmin = 2.0 * fmin / sr wmax = 2.0 *...
the_stack_v2_python_sparse
ex_2/a_miyashita/main.py
shin04/B4Lecture-2021
train
0
df43e17021f7ff51c390f323ea8afa2d08784064
[ "if not attrs['password'] == attrs['password2']:\n raise ValidationError({'password': \"Password fields didn't match.\"})\nreturn attrs", "user = User.objects.create(username=validated_data['username'], email=validated_data['email'], name=validated_data['name'])\nuser.set_password(validated_data['password'])\n...
<|body_start_0|> if not attrs['password'] == attrs['password2']: raise ValidationError({'password': "Password fields didn't match."}) return attrs <|end_body_0|> <|body_start_1|> user = User.objects.create(username=validated_data['username'], email=validated_data['email'], name=vali...
--Register Serializer--
RegisterSerializer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RegisterSerializer: """--Register Serializer--""" def validate(self, attrs): """--Validate override-- 1) Checks to make sure both passwords match. Returns attribute dict or ValidationError.""" <|body_0|> def create(self, validated_data): """--Create function over...
stack_v2_sparse_classes_36k_train_000996
9,847
permissive
[ { "docstring": "--Validate override-- 1) Checks to make sure both passwords match. Returns attribute dict or ValidationError.", "name": "validate", "signature": "def validate(self, attrs)" }, { "docstring": "--Create function override-- :returns: User object. 1) Creates new user with validated d...
2
stack_v2_sparse_classes_30k_train_003361
Implement the Python class `RegisterSerializer` described below. Class description: --Register Serializer-- Method signatures and docstrings: - def validate(self, attrs): --Validate override-- 1) Checks to make sure both passwords match. Returns attribute dict or ValidationError. - def create(self, validated_data): -...
Implement the Python class `RegisterSerializer` described below. Class description: --Register Serializer-- Method signatures and docstrings: - def validate(self, attrs): --Validate override-- 1) Checks to make sure both passwords match. Returns attribute dict or ValidationError. - def create(self, validated_data): -...
8d984ee3f9b2b7ea35a847013743f236a1a67fdb
<|skeleton|> class RegisterSerializer: """--Register Serializer--""" def validate(self, attrs): """--Validate override-- 1) Checks to make sure both passwords match. Returns attribute dict or ValidationError.""" <|body_0|> def create(self, validated_data): """--Create function over...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class RegisterSerializer: """--Register Serializer--""" def validate(self, attrs): """--Validate override-- 1) Checks to make sure both passwords match. Returns attribute dict or ValidationError.""" if not attrs['password'] == attrs['password2']: raise ValidationError({'password': "...
the_stack_v2_python_sparse
blog_api/users/api/serializers.py
beasyx0/blog_api
train
0
b698ac2e1cdb958c5f3ad6fe55f31909450611e5
[ "http_method = str(request_raw['method']).lower()\ntemp_url = str(request_raw['url']).strip()\ntemp_headers = header_to_lowercase(json.loads(request_raw['headers']))\nif http_method == HttpMethod.GET:\n parameters = self.get_parser_class(request_raw).get_parameter(url=temp_url, data=None, http_method=HttpMethod....
<|body_start_0|> http_method = str(request_raw['method']).lower() temp_url = str(request_raw['url']).strip() temp_headers = header_to_lowercase(json.loads(request_raw['headers'])) if http_method == HttpMethod.GET: parameters = self.get_parser_class(request_raw).get_parameter(...
Checker
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Checker: def check_logic(self, request_raw): """检测逻辑,jsonp 水坑攻击只会存在于GET请求中,检测方式,看能否自定义设置CALLBACK :param request_raw: :return:""" <|body_0|> def init_plugin_info(self): """初插件始化信息 :return:""" <|body_1|> <|end_skeleton|> <|body_start_0|> http_method =...
stack_v2_sparse_classes_36k_train_000997
3,308
permissive
[ { "docstring": "检测逻辑,jsonp 水坑攻击只会存在于GET请求中,检测方式,看能否自定义设置CALLBACK :param request_raw: :return:", "name": "check_logic", "signature": "def check_logic(self, request_raw)" }, { "docstring": "初插件始化信息 :return:", "name": "init_plugin_info", "signature": "def init_plugin_info(self)" } ]
2
stack_v2_sparse_classes_30k_train_013793
Implement the Python class `Checker` described below. Class description: Implement the Checker class. Method signatures and docstrings: - def check_logic(self, request_raw): 检测逻辑,jsonp 水坑攻击只会存在于GET请求中,检测方式,看能否自定义设置CALLBACK :param request_raw: :return: - def init_plugin_info(self): 初插件始化信息 :return:
Implement the Python class `Checker` described below. Class description: Implement the Checker class. Method signatures and docstrings: - def check_logic(self, request_raw): 检测逻辑,jsonp 水坑攻击只会存在于GET请求中,检测方式,看能否自定义设置CALLBACK :param request_raw: :return: - def init_plugin_info(self): 初插件始化信息 :return: <|skeleton|> class...
4ee5cca8dc5fc5d7e631e935517bd0f493c30a37
<|skeleton|> class Checker: def check_logic(self, request_raw): """检测逻辑,jsonp 水坑攻击只会存在于GET请求中,检测方式,看能否自定义设置CALLBACK :param request_raw: :return:""" <|body_0|> def init_plugin_info(self): """初插件始化信息 :return:""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Checker: def check_logic(self, request_raw): """检测逻辑,jsonp 水坑攻击只会存在于GET请求中,检测方式,看能否自定义设置CALLBACK :param request_raw: :return:""" http_method = str(request_raw['method']).lower() temp_url = str(request_raw['url']).strip() temp_headers = header_to_lowercase(json.loads(request_raw...
the_stack_v2_python_sparse
HunterAdminApi/plugins/owasp/jsonp_hijacking.py
a1kaid/hunter
train
0
89a228e893e87b20035e03a43537bcf5d1fcf929
[ "super(Masker, self).__init__()\nself.rnn_enc = _rnn_enc.RNNEnc(input_dim=rnn_enc_input_dim, context_length=context_length)\nself.rnn_dec = _rnn_dec.RNNDec(input_dim=rnn_dec_input_dim)\nself.fnn = _fnn.FNNMasker(input_dim=rnn_dec_input_dim, output_dim=original_input_dim, context_length=context_length)\nself.output ...
<|body_start_0|> super(Masker, self).__init__() self.rnn_enc = _rnn_enc.RNNEnc(input_dim=rnn_enc_input_dim, context_length=context_length) self.rnn_dec = _rnn_dec.RNNDec(input_dim=rnn_dec_input_dim) self.fnn = _fnn.FNNMasker(input_dim=rnn_dec_input_dim, output_dim=original_input_dim, con...
Masker
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Masker: def __init__(self, rnn_enc_input_dim, rnn_dec_input_dim, context_length, original_input_dim): """The Masker module of the MaD TwinNet. :param rnn_enc_input_dim: The input dimensionality for the RNN encoder. :type rnn_enc_input_dim: int :param rnn_dec_input_dim: The input dimensio...
stack_v2_sparse_classes_36k_train_000998
16,858
no_license
[ { "docstring": "The Masker module of the MaD TwinNet. :param rnn_enc_input_dim: The input dimensionality for the RNN encoder. :type rnn_enc_input_dim: int :param rnn_dec_input_dim: The input dimensionality for the RNN decoder. :type rnn_dec_input_dim: int :param context_length: The amount of time steps used for...
2
null
Implement the Python class `Masker` described below. Class description: Implement the Masker class. Method signatures and docstrings: - def __init__(self, rnn_enc_input_dim, rnn_dec_input_dim, context_length, original_input_dim): The Masker module of the MaD TwinNet. :param rnn_enc_input_dim: The input dimensionality...
Implement the Python class `Masker` described below. Class description: Implement the Masker class. Method signatures and docstrings: - def __init__(self, rnn_enc_input_dim, rnn_dec_input_dim, context_length, original_input_dim): The Masker module of the MaD TwinNet. :param rnn_enc_input_dim: The input dimensionality...
7e55a422588c1d1e00f35a3d3a3ff896cce59e18
<|skeleton|> class Masker: def __init__(self, rnn_enc_input_dim, rnn_dec_input_dim, context_length, original_input_dim): """The Masker module of the MaD TwinNet. :param rnn_enc_input_dim: The input dimensionality for the RNN encoder. :type rnn_enc_input_dim: int :param rnn_dec_input_dim: The input dimensio...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class Masker: def __init__(self, rnn_enc_input_dim, rnn_dec_input_dim, context_length, original_input_dim): """The Masker module of the MaD TwinNet. :param rnn_enc_input_dim: The input dimensionality for the RNN encoder. :type rnn_enc_input_dim: int :param rnn_dec_input_dim: The input dimensionality for the...
the_stack_v2_python_sparse
generated/test_dr_costas_mad_twinnet.py
jansel/pytorch-jit-paritybench
train
35
8d46ebc4d5c8160b8f352f3d26cd960d0422e4fe
[ "if file_resources is None:\n file_resources = {}\n file_resources['data_v2017.txt'] = 'data_v2017.txt'\nself.species = species\nsuper().__init__(path, file_resources, col_rename=col_rename, **kwargs)", "df = pd.read_csv(self.file_resources['data_v2017.txt'], header=None, sep='\\t', encoding='unicode_escape...
<|body_start_0|> if file_resources is None: file_resources = {} file_resources['data_v2017.txt'] = 'data_v2017.txt' self.species = species super().__init__(path, file_resources, col_rename=col_rename, **kwargs) <|end_body_0|> <|body_start_1|> df = pd.read_csv(sel...
LncRNADisease
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LncRNADisease: def __init__(self, path='http://www.cuilab.cn/files/images/ldd/', file_resources=None, species='Human', col_rename=COLUMNS_RENAME_DICT, **kwargs): """Args: path: file_resources: species: col_rename: **kwargs:""" <|body_0|> def load_dataframe(self, file_resourc...
stack_v2_sparse_classes_36k_train_000999
6,117
permissive
[ { "docstring": "Args: path: file_resources: species: col_rename: **kwargs:", "name": "__init__", "signature": "def __init__(self, path='http://www.cuilab.cn/files/images/ldd/', file_resources=None, species='Human', col_rename=COLUMNS_RENAME_DICT, **kwargs)" }, { "docstring": "Args: file_resource...
2
stack_v2_sparse_classes_30k_test_000822
Implement the Python class `LncRNADisease` described below. Class description: Implement the LncRNADisease class. Method signatures and docstrings: - def __init__(self, path='http://www.cuilab.cn/files/images/ldd/', file_resources=None, species='Human', col_rename=COLUMNS_RENAME_DICT, **kwargs): Args: path: file_reso...
Implement the Python class `LncRNADisease` described below. Class description: Implement the LncRNADisease class. Method signatures and docstrings: - def __init__(self, path='http://www.cuilab.cn/files/images/ldd/', file_resources=None, species='Human', col_rename=COLUMNS_RENAME_DICT, **kwargs): Args: path: file_reso...
35a0e00964c9b308f831263936f9507a69f52613
<|skeleton|> class LncRNADisease: def __init__(self, path='http://www.cuilab.cn/files/images/ldd/', file_resources=None, species='Human', col_rename=COLUMNS_RENAME_DICT, **kwargs): """Args: path: file_resources: species: col_rename: **kwargs:""" <|body_0|> def load_dataframe(self, file_resourc...
stack_v2_sparse_classes_36k
data/stack_v2_sparse_classes_30k
class LncRNADisease: def __init__(self, path='http://www.cuilab.cn/files/images/ldd/', file_resources=None, species='Human', col_rename=COLUMNS_RENAME_DICT, **kwargs): """Args: path: file_resources: species: col_rename: **kwargs:""" if file_resources is None: file_resources = {} ...
the_stack_v2_python_sparse
openomics/database/disease.py
JonnyTran/OpenOmics
train
8