blob_id
stringlengths
40
40
bodies
listlengths
2
6
bodies_text
stringlengths
196
7.73k
class_docstring
stringlengths
0
700
class_name
stringlengths
1
86
detected_licenses
listlengths
0
45
format_version
stringclasses
1 value
full_text
stringlengths
467
8.64k
id
stringlengths
40
40
length_bytes
int64
515
49.7k
license_type
stringclasses
2 values
methods
listlengths
2
6
n_methods
int64
2
6
original_id
stringlengths
38
40
prompt
stringlengths
160
3.93k
prompted_full_text
stringlengths
681
10.7k
revision_id
stringlengths
40
40
skeleton
stringlengths
162
4.09k
snapshot_name
stringclasses
1 value
snapshot_source_dir
stringclasses
1 value
solution
stringlengths
331
8.3k
source
stringclasses
1 value
source_path
stringlengths
5
177
source_repo
stringlengths
6
88
split
stringclasses
1 value
star_events_count
int64
0
209k
b3a6eac109954d03992f938dc52c1c7431ba60a8
[ "ret_head = head.next if head and head.next else head\npp_head = None\nwhile head:\n if not head.next:\n break\n pre_head = head\n cur_head = head.next\n next_head = cur_head.next\n cur_head.next = pre_head\n pre_head.next = next_head\n if pp_head:\n pp_head.next = cur_head\n p...
<|body_start_0|> ret_head = head.next if head and head.next else head pp_head = None while head: if not head.next: break pre_head = head cur_head = head.next next_head = cur_head.next cur_head.next = pre_head ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def swapPairs(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def rewrite(self, head): """:type head: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|> <|body_start_0|> ret_head = head.next if head and head.next ...
stack_v2_sparse_classes_10k_train_003200
2,173
no_license
[ { "docstring": ":type head: ListNode :rtype: ListNode", "name": "swapPairs", "signature": "def swapPairs(self, head)" }, { "docstring": ":type head: ListNode :rtype: ListNode", "name": "rewrite", "signature": "def rewrite(self, head)" } ]
2
stack_v2_sparse_classes_30k_train_000953
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def swapPairs(self, head): :type head: ListNode :rtype: ListNode - def rewrite(self, head): :type head: ListNode :rtype: ListNode
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def swapPairs(self, head): :type head: ListNode :rtype: ListNode - def rewrite(self, head): :type head: ListNode :rtype: ListNode <|skeleton|> class Solution: def swapPairs...
6350568d16b0f8c49a020f055bb6d72e2705ea56
<|skeleton|> class Solution: def swapPairs(self, head): """:type head: ListNode :rtype: ListNode""" <|body_0|> def rewrite(self, head): """:type head: ListNode :rtype: ListNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def swapPairs(self, head): """:type head: ListNode :rtype: ListNode""" ret_head = head.next if head and head.next else head pp_head = None while head: if not head.next: break pre_head = head cur_head = head.next ...
the_stack_v2_python_sparse
co_ms/24_Swap_Nodes_in_Pairs.py
vsdrun/lc_public
train
6
fbe6330197adcf0c74bd6917a81d1e4de6597b7d
[ "skeinforge_profile.addListsToCraftTypeRepository('skeinforge_application.skeinforge.html', self)\nself.fileNameInput = settings.FileNameInput().getFromFileName(fabmetheus_interpret.getGNUTranslatorGcodeFileTypeTuples(), 'Open File for Skeinforge', self, '')\nself.profileType = settings.MenuButtonDisplay().getFromN...
<|body_start_0|> skeinforge_profile.addListsToCraftTypeRepository('skeinforge_application.skeinforge.html', self) self.fileNameInput = settings.FileNameInput().getFromFileName(fabmetheus_interpret.getGNUTranslatorGcodeFileTypeTuples(), 'Open File for Skeinforge', self, '') self.profileType = set...
A class to handle the skeinforge settings.
SkeinforgeRepository
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SkeinforgeRepository: """A class to handle the skeinforge settings.""" def __init__(self): """Set the default settings, execute title & settings fileName.""" <|body_0|> def execute(self): """Skeinforge button has been clicked.""" <|body_1|> def save(...
stack_v2_sparse_classes_10k_train_003201
29,747
no_license
[ { "docstring": "Set the default settings, execute title & settings fileName.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Skeinforge button has been clicked.", "name": "execute", "signature": "def execute(self)" }, { "docstring": "Profile has been sa...
3
stack_v2_sparse_classes_30k_train_003816
Implement the Python class `SkeinforgeRepository` described below. Class description: A class to handle the skeinforge settings. Method signatures and docstrings: - def __init__(self): Set the default settings, execute title & settings fileName. - def execute(self): Skeinforge button has been clicked. - def save(self...
Implement the Python class `SkeinforgeRepository` described below. Class description: A class to handle the skeinforge settings. Method signatures and docstrings: - def __init__(self): Set the default settings, execute title & settings fileName. - def execute(self): Skeinforge button has been clicked. - def save(self...
c1b00a76f1550df2cbb457248205159e51fd4308
<|skeleton|> class SkeinforgeRepository: """A class to handle the skeinforge settings.""" def __init__(self): """Set the default settings, execute title & settings fileName.""" <|body_0|> def execute(self): """Skeinforge button has been clicked.""" <|body_1|> def save(...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SkeinforgeRepository: """A class to handle the skeinforge settings.""" def __init__(self): """Set the default settings, execute title & settings fileName.""" skeinforge_profile.addListsToCraftTypeRepository('skeinforge_application.skeinforge.html', self) self.fileNameInput = setti...
the_stack_v2_python_sparse
skeinforge_application/skeinforge.py
amsler/skeinforge
train
10
267e2d41e316ca9da35178d18f9b95b644442539
[ "if not self.base:\n raise AttributeError('Factory.base must be set to a Component')\nsuper().__init__(config=config, parent=tool, **kwargs)\nself.kwargs = copy(kwargs)", "if self.product:\n return self.product\nelse:\n raise AttributeError('The user has not specified a product for {}'.format(self.__clas...
<|body_start_0|> if not self.base: raise AttributeError('Factory.base must be set to a Component') super().__init__(config=config, parent=tool, **kwargs) self.kwargs = copy(kwargs) <|end_body_0|> <|body_start_1|> if self.product: return self.product else:...
A base class for all class factories that exist in the `Tools`/`Components` frameworks. To create a Factory, inherit this class and set `base` to the base-class of the Factory. The traits of the sub-classes are automatically added to the Factory (and are included in the help message). The traits and kwargsthat correctl...
Factory
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Factory: """A base class for all class factories that exist in the `Tools`/`Components` frameworks. To create a Factory, inherit this class and set `base` to the base-class of the Factory. The traits of the sub-classes are automatically added to the Factory (and are included in the help message)....
stack_v2_sparse_classes_10k_train_003202
8,843
no_license
[ { "docstring": "Base Factory class Parameters ---------- config : traitlets.loader.Config Configuration specified by config file or cmdline arguments. Used to set traitlet values. Set to None if no configuration to pass. tool : ctapipe.core.Tool Tool executable that is calling this component. Passes the correct...
5
stack_v2_sparse_classes_30k_train_007114
Implement the Python class `Factory` described below. Class description: A base class for all class factories that exist in the `Tools`/`Components` frameworks. To create a Factory, inherit this class and set `base` to the base-class of the Factory. The traits of the sub-classes are automatically added to the Factory ...
Implement the Python class `Factory` described below. Class description: A base class for all class factories that exist in the `Tools`/`Components` frameworks. To create a Factory, inherit this class and set `base` to the base-class of the Factory. The traits of the sub-classes are automatically added to the Factory ...
1cb6f215f3a9c34e18f2d49bd36bbf9e757f5847
<|skeleton|> class Factory: """A base class for all class factories that exist in the `Tools`/`Components` frameworks. To create a Factory, inherit this class and set `base` to the base-class of the Factory. The traits of the sub-classes are automatically added to the Factory (and are included in the help message)....
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Factory: """A base class for all class factories that exist in the `Tools`/`Components` frameworks. To create a Factory, inherit this class and set `base` to the base-class of the Factory. The traits of the sub-classes are automatically added to the Factory (and are included in the help message). The traits a...
the_stack_v2_python_sparse
ctapipe/core/factory.py
18333/ctapipe
train
1
2093a28f0be7675b204dab7f6fa01d38bb512cc3
[ "self.inletNode = inletNode\nself.idealinletNode = idealinletNode\nself.outletNode = outletNode", "\"\"\"the cycle based on compressor inlet\"\"\"\n'node outelt = state 1'\n'Exp'\n'State 1, P1,T1 known'\n'pressure loss and heat exchange parameters'\nself.dp = node[self.inletNode].p - node[self.idealinletNode].p\n...
<|body_start_0|> self.inletNode = inletNode self.idealinletNode = idealinletNode self.outletNode = outletNode <|end_body_0|> <|body_start_1|> """the cycle based on compressor inlet""" 'node outelt = state 1' 'Exp' 'State 1, P1,T1 known' 'pressure loss and...
evaporator component
Evaporator
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Evaporator: """evaporator component""" def __init__(self, inletNode, outletNode, idealinletNode): """init evaporator node""" <|body_0|> def simulate(self, node, mdot_a, cp, Ta_in, Ta_out): """ideal""" <|body_1|> <|end_skeleton|> <|body_start_0|> ...
stack_v2_sparse_classes_10k_train_003203
3,605
no_license
[ { "docstring": "init evaporator node", "name": "__init__", "signature": "def __init__(self, inletNode, outletNode, idealinletNode)" }, { "docstring": "ideal", "name": "simulate", "signature": "def simulate(self, node, mdot_a, cp, Ta_in, Ta_out)" } ]
2
stack_v2_sparse_classes_30k_test_000029
Implement the Python class `Evaporator` described below. Class description: evaporator component Method signatures and docstrings: - def __init__(self, inletNode, outletNode, idealinletNode): init evaporator node - def simulate(self, node, mdot_a, cp, Ta_in, Ta_out): ideal
Implement the Python class `Evaporator` described below. Class description: evaporator component Method signatures and docstrings: - def __init__(self, inletNode, outletNode, idealinletNode): init evaporator node - def simulate(self, node, mdot_a, cp, Ta_in, Ta_out): ideal <|skeleton|> class Evaporator: """evapo...
6843fd139ff2355b98eac0ac9cf09aee6fede7cd
<|skeleton|> class Evaporator: """evaporator component""" def __init__(self, inletNode, outletNode, idealinletNode): """init evaporator node""" <|body_0|> def simulate(self, node, mdot_a, cp, Ta_in, Ta_out): """ideal""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Evaporator: """evaporator component""" def __init__(self, inletNode, outletNode, idealinletNode): """init evaporator node""" self.inletNode = inletNode self.idealinletNode = idealinletNode self.outletNode = outletNode def simulate(self, node, mdot_a, cp, Ta_in, Ta_out...
the_stack_v2_python_sparse
original/component.py
Nathanzhn/GA4
train
0
f0d84f8bd3334c01e032974b70b19aa3fc15485f
[ "self.files_downloaded = 0\nself.files_processed = 0\nself.exception_count = 0\nself.now = time_utils.get_utc_now()\nself.grib_processor = GribFileProcessor(station_source)\nself.model_type: ModelEnum = model_type\nif self.model_type == ModelEnum.GDPS:\n self.projection = ProjectionEnum.LATLON_15X_15\nelif self....
<|body_start_0|> self.files_downloaded = 0 self.files_processed = 0 self.exception_count = 0 self.now = time_utils.get_utc_now() self.grib_processor = GribFileProcessor(station_source) self.model_type: ModelEnum = model_type if self.model_type == ModelEnum.GDPS: ...
Class that orchestrates downloading and processing of weather model grib files from environment Canada.
EnvCanada
[ "Apache-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EnvCanada: """Class that orchestrates downloading and processing of weather model grib files from environment Canada.""" def __init__(self, model_type: ModelEnum, station_source: StationSourceEnum=StationSourceEnum.UNSPECIFIED): """Prep variables""" <|body_0|> def proces...
stack_v2_sparse_classes_10k_train_003204
17,429
permissive
[ { "docstring": "Prep variables", "name": "__init__", "signature": "def __init__(self, model_type: ModelEnum, station_source: StationSourceEnum=StationSourceEnum.UNSPECIFIED)" }, { "docstring": "Process the urls for a model run.", "name": "process_model_run_urls", "signature": "def proces...
4
null
Implement the Python class `EnvCanada` described below. Class description: Class that orchestrates downloading and processing of weather model grib files from environment Canada. Method signatures and docstrings: - def __init__(self, model_type: ModelEnum, station_source: StationSourceEnum=StationSourceEnum.UNSPECIFI...
Implement the Python class `EnvCanada` described below. Class description: Class that orchestrates downloading and processing of weather model grib files from environment Canada. Method signatures and docstrings: - def __init__(self, model_type: ModelEnum, station_source: StationSourceEnum=StationSourceEnum.UNSPECIFI...
0ba707b0eddc280240964efa481988df92046e6a
<|skeleton|> class EnvCanada: """Class that orchestrates downloading and processing of weather model grib files from environment Canada.""" def __init__(self, model_type: ModelEnum, station_source: StationSourceEnum=StationSourceEnum.UNSPECIFIED): """Prep variables""" <|body_0|> def proces...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class EnvCanada: """Class that orchestrates downloading and processing of weather model grib files from environment Canada.""" def __init__(self, model_type: ModelEnum, station_source: StationSourceEnum=StationSourceEnum.UNSPECIFIED): """Prep variables""" self.files_downloaded = 0 self....
the_stack_v2_python_sparse
api/app/jobs/env_canada.py
bcgov/wps
train
35
f1a40cb215256b2e6979a718ebf614e2bb2a7611
[ "self.config_map = config_map\nself.events = events\nself._test = None\nself._commands = None\nreturn", "if self._commands is None:\n self._commands = IperfCommandBuilder(config_map=self.config_map)\nreturn self._commands", "if self._test is None:\n self._test = iperftest.IperfTest(receiver_command=self.c...
<|body_start_0|> self.config_map = config_map self.events = events self._test = None self._commands = None return <|end_body_0|> <|body_start_1|> if self._commands is None: self._commands = IperfCommandBuilder(config_map=self.config_map) return self._...
A builder of iperf tests
IperfTestBuilder
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IperfTestBuilder: """A builder of iperf tests""" def __init__(self, config_map, events=None): """:param: - `config_map`: a pre-loaded configuration map - `events`: a list of events to wait for""" <|body_0|> def commands(self): """:return: an iperf command builder...
stack_v2_sparse_classes_10k_train_003205
1,538
permissive
[ { "docstring": ":param: - `config_map`: a pre-loaded configuration map - `events`: a list of events to wait for", "name": "__init__", "signature": "def __init__(self, config_map, events=None)" }, { "docstring": ":return: an iperf command builder", "name": "commands", "signature": "def co...
3
stack_v2_sparse_classes_30k_train_003649
Implement the Python class `IperfTestBuilder` described below. Class description: A builder of iperf tests Method signatures and docstrings: - def __init__(self, config_map, events=None): :param: - `config_map`: a pre-loaded configuration map - `events`: a list of events to wait for - def commands(self): :return: an ...
Implement the Python class `IperfTestBuilder` described below. Class description: A builder of iperf tests Method signatures and docstrings: - def __init__(self, config_map, events=None): :param: - `config_map`: a pre-loaded configuration map - `events`: a list of events to wait for - def commands(self): :return: an ...
b4d1c77e1d611fe2b30768b42bdc7493afb0ea95
<|skeleton|> class IperfTestBuilder: """A builder of iperf tests""" def __init__(self, config_map, events=None): """:param: - `config_map`: a pre-loaded configuration map - `events`: a list of events to wait for""" <|body_0|> def commands(self): """:return: an iperf command builder...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class IperfTestBuilder: """A builder of iperf tests""" def __init__(self, config_map, events=None): """:param: - `config_map`: a pre-loaded configuration map - `events`: a list of events to wait for""" self.config_map = config_map self.events = events self._test = None s...
the_stack_v2_python_sparse
apetools/builders/subbuilders/iperftestbuilder.py
russell-n/oldape
train
0
70a62820f27c2fc4d322d550e02390e60d5ec830
[ "try:\n return phonenumbers.formatnumber(obj, phonenumbers.PhoneNumberFormat.NATIONAL)\nexcept Exception as e:\n return None", "try:\n obj = phonenumbers.parse(text, 'CA')\n return phonenumbers.formatnumber(obj, phonenumbers.PhoneNumberFormat.NATIONAL)\nexcept Exception as e:\n return None" ]
<|body_start_0|> try: return phonenumbers.formatnumber(obj, phonenumbers.PhoneNumberFormat.NATIONAL) except Exception as e: return None <|end_body_0|> <|body_start_1|> try: obj = phonenumbers.parse(text, 'CA') return phonenumbers.formatnumber(obj,...
Class used to convert the "PhoneNumber" objects "to" and "from" strings. This objects is from the "python-phonenumbers" library.
PhoneNumberField
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class PhoneNumberField: """Class used to convert the "PhoneNumber" objects "to" and "from" strings. This objects is from the "python-phonenumbers" library.""" def to_representation(self, obj): """Function used to convert the PhoneNumber object to text string representation.""" <|bo...
stack_v2_sparse_classes_10k_train_003206
1,103
permissive
[ { "docstring": "Function used to convert the PhoneNumber object to text string representation.", "name": "to_representation", "signature": "def to_representation(self, obj)" }, { "docstring": "Function used to conver the text into the PhoneNumber object representation.", "name": "to_internal...
2
stack_v2_sparse_classes_30k_train_005102
Implement the Python class `PhoneNumberField` described below. Class description: Class used to convert the "PhoneNumber" objects "to" and "from" strings. This objects is from the "python-phonenumbers" library. Method signatures and docstrings: - def to_representation(self, obj): Function used to convert the PhoneNum...
Implement the Python class `PhoneNumberField` described below. Class description: Class used to convert the "PhoneNumber" objects "to" and "from" strings. This objects is from the "python-phonenumbers" library. Method signatures and docstrings: - def to_representation(self, obj): Function used to convert the PhoneNum...
cf58cf216d377ea97a2676cd594f96fb9d602a46
<|skeleton|> class PhoneNumberField: """Class used to convert the "PhoneNumber" objects "to" and "from" strings. This objects is from the "python-phonenumbers" library.""" def to_representation(self, obj): """Function used to convert the PhoneNumber object to text string representation.""" <|bo...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class PhoneNumberField: """Class used to convert the "PhoneNumber" objects "to" and "from" strings. This objects is from the "python-phonenumbers" library.""" def to_representation(self, obj): """Function used to convert the PhoneNumber object to text string representation.""" try: ...
the_stack_v2_python_sparse
academicstoday/shared_api/custom_fields.py
abhijitdalavi/Django-paas
train
0
dfbbaf512e227a1294b7175591d6e7f421c44fd6
[ "self.cleaned.barcode = room.barcode\nself.cleaned.title = room.title\nself.cleaned.x = room.x\nself.cleaned.y = room.y\nself.cleaned.z = room.z\nself.cleaned.description = room.description.text\nself.cleaned.exits = []\nfor exit in room.exits:\n definition = {}\n definition['name'] = exit.name_for(room)\n ...
<|body_start_0|> self.cleaned.barcode = room.barcode self.cleaned.title = room.title self.cleaned.x = room.x self.cleaned.y = room.y self.cleaned.z = room.z self.cleaned.description = room.description.text self.cleaned.exits = [] for exit in room.exits: ...
Room document to add rooms in blueprints.
RoomDocument
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RoomDocument: """Room document to add rooms in blueprints.""" def fill_from_object(self, room): """Draw the document from an object.""" <|body_0|> def add_neighbor(self, barcode: str, title: str, x: Optional[int]=None, y: Optional[int]=None, z: Optional[int]=None, descri...
stack_v2_sparse_classes_10k_train_003207
8,190
permissive
[ { "docstring": "Draw the document from an object.", "name": "fill_from_object", "signature": "def fill_from_object(self, room)" }, { "docstring": "Add a room, optionally connected to the current room. Args: barcode (str): the new room's barcode. title (str): the new room's title. x (int, optiona...
4
stack_v2_sparse_classes_30k_train_006181
Implement the Python class `RoomDocument` described below. Class description: Room document to add rooms in blueprints. Method signatures and docstrings: - def fill_from_object(self, room): Draw the document from an object. - def add_neighbor(self, barcode: str, title: str, x: Optional[int]=None, y: Optional[int]=Non...
Implement the Python class `RoomDocument` described below. Class description: Room document to add rooms in blueprints. Method signatures and docstrings: - def fill_from_object(self, room): Draw the document from an object. - def add_neighbor(self, barcode: str, title: str, x: Optional[int]=None, y: Optional[int]=Non...
fb7f98d331e47e2032ee1e51bf3e4b2592807fdf
<|skeleton|> class RoomDocument: """Room document to add rooms in blueprints.""" def fill_from_object(self, room): """Draw the document from an object.""" <|body_0|> def add_neighbor(self, barcode: str, title: str, x: Optional[int]=None, y: Optional[int]=None, z: Optional[int]=None, descri...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RoomDocument: """Room document to add rooms in blueprints.""" def fill_from_object(self, room): """Draw the document from an object.""" self.cleaned.barcode = room.barcode self.cleaned.title = room.title self.cleaned.x = room.x self.cleaned.y = room.y self....
the_stack_v2_python_sparse
src/data/blueprints/room.py
vincent-lg/avenew.one
train
0
ad1eb218fbcc53177f2804fdd0dcd615b10debc5
[ "if 'w' not in self.mode:\n raise IOError('FileStoreImage %s is not in write mode.', self.urn)\npredicate = ('index:target:%s' % target).lower()\ndata_store.DB.MultiSet(self.urn, {predicate: target}, token=self.token, replace=True, sync=False)", "regex = ['index:target:.*%s.*' % target_regex.lower()]\nif isins...
<|body_start_0|> if 'w' not in self.mode: raise IOError('FileStoreImage %s is not in write mode.', self.urn) predicate = ('index:target:%s' % target).lower() data_store.DB.MultiSet(self.urn, {predicate: target}, token=self.token, replace=True, sync=False) <|end_body_0|> <|body_start...
The AFF4 files that are stored in the file store area. Files in the file store are essentially blob images, containing indexes to the client files which matches their hash. It is possible to query for all clients which match a specific hash or a regular expression of the aff4 path to the files on these clients. e.g. on...
FileStoreImage
[ "Apache-2.0", "DOC" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FileStoreImage: """The AFF4 files that are stored in the file store area. Files in the file store are essentially blob images, containing indexes to the client files which matches their hash. It is possible to query for all clients which match a specific hash or a regular expression of the aff4 p...
stack_v2_sparse_classes_10k_train_003208
24,878
permissive
[ { "docstring": "Adds an indexed reference to the target URN.", "name": "AddIndex", "signature": "def AddIndex(self, target)" }, { "docstring": "Search the index for matches to the file specified by the regex. Args: target_regex: The regular expression to match against the index. limit: Either a ...
2
stack_v2_sparse_classes_30k_train_004851
Implement the Python class `FileStoreImage` described below. Class description: The AFF4 files that are stored in the file store area. Files in the file store are essentially blob images, containing indexes to the client files which matches their hash. It is possible to query for all clients which match a specific has...
Implement the Python class `FileStoreImage` described below. Class description: The AFF4 files that are stored in the file store area. Files in the file store are essentially blob images, containing indexes to the client files which matches their hash. It is possible to query for all clients which match a specific has...
ba1648b97a76f844ffb8e1891cc9e2680f9b1c6e
<|skeleton|> class FileStoreImage: """The AFF4 files that are stored in the file store area. Files in the file store are essentially blob images, containing indexes to the client files which matches their hash. It is possible to query for all clients which match a specific hash or a regular expression of the aff4 p...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FileStoreImage: """The AFF4 files that are stored in the file store area. Files in the file store are essentially blob images, containing indexes to the client files which matches their hash. It is possible to query for all clients which match a specific hash or a regular expression of the aff4 path to the fi...
the_stack_v2_python_sparse
lib/aff4_objects/filestore.py
defaultnamehere/grr
train
3
7f32d1a6f18eab2d7c3d505ed61740b43e6b7ca7
[ "import build.api\nimport company.api\nimport order.api\nimport part.api\nimport stock.api\nreturn {'build': build.api.BuildList, 'company': company.api.CompanyList, 'manufacturerpart': company.api.ManufacturerPartList, 'supplierpart': company.api.SupplierPartList, 'part': part.api.PartList, 'partcategory': part.ap...
<|body_start_0|> import build.api import company.api import order.api import part.api import stock.api return {'build': build.api.BuildList, 'company': company.api.CompanyList, 'manufacturerpart': company.api.ManufacturerPartList, 'supplierpart': company.api.SupplierPartL...
A general-purpose 'search' API endpoint Returns hits against a number of different models simultaneously, to consolidate multiple API requests into a single query. Is much more efficient and simplifies code!
APISearchView
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class APISearchView: """A general-purpose 'search' API endpoint Returns hits against a number of different models simultaneously, to consolidate multiple API requests into a single query. Is much more efficient and simplifies code!""" def get_result_types(self): """Construct a list of sear...
stack_v2_sparse_classes_10k_train_003209
11,757
permissive
[ { "docstring": "Construct a list of search types we can return", "name": "get_result_types", "signature": "def get_result_types(self)" }, { "docstring": "Perform search query against available models", "name": "post", "signature": "def post(self, request, *args, **kwargs)" } ]
2
null
Implement the Python class `APISearchView` described below. Class description: A general-purpose 'search' API endpoint Returns hits against a number of different models simultaneously, to consolidate multiple API requests into a single query. Is much more efficient and simplifies code! Method signatures and docstring...
Implement the Python class `APISearchView` described below. Class description: A general-purpose 'search' API endpoint Returns hits against a number of different models simultaneously, to consolidate multiple API requests into a single query. Is much more efficient and simplifies code! Method signatures and docstring...
e88a8e99a5f0b201c67a95cba097c729f090d5e2
<|skeleton|> class APISearchView: """A general-purpose 'search' API endpoint Returns hits against a number of different models simultaneously, to consolidate multiple API requests into a single query. Is much more efficient and simplifies code!""" def get_result_types(self): """Construct a list of sear...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class APISearchView: """A general-purpose 'search' API endpoint Returns hits against a number of different models simultaneously, to consolidate multiple API requests into a single query. Is much more efficient and simplifies code!""" def get_result_types(self): """Construct a list of search types we c...
the_stack_v2_python_sparse
InvenTree/InvenTree/api.py
inventree/InvenTree
train
3,077
971bd0c1781199c4c3585355cfefe61a4bc02c9a
[ "try:\n group = await get_data_from_req(self.request).groups.get(group_id)\nexcept ResourceNotFoundError:\n raise NotFound()\nreturn json_response(GroupResponse.parse_obj(group))", "try:\n group = await get_data_from_req(self.request).groups.update(group_id, data)\nexcept ResourceNotFoundError:\n rais...
<|body_start_0|> try: group = await get_data_from_req(self.request).groups.get(group_id) except ResourceNotFoundError: raise NotFound() return json_response(GroupResponse.parse_obj(group)) <|end_body_0|> <|body_start_1|> try: group = await get_data_fr...
GroupView
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GroupView: async def get(self, group_id: str, /) -> Union[r200[GroupResponse], r404]: """Get a group. Fetches the complete representation of a single user group including its permissions. Status Codes: 200: Successful operation 404: Group not found""" <|body_0|> async def pa...
stack_v2_sparse_classes_10k_train_003210
3,996
permissive
[ { "docstring": "Get a group. Fetches the complete representation of a single user group including its permissions. Status Codes: 200: Successful operation 404: Group not found", "name": "get", "signature": "async def get(self, group_id: str, /) -> Union[r200[GroupResponse], r404]" }, { "docstrin...
3
stack_v2_sparse_classes_30k_train_003036
Implement the Python class `GroupView` described below. Class description: Implement the GroupView class. Method signatures and docstrings: - async def get(self, group_id: str, /) -> Union[r200[GroupResponse], r404]: Get a group. Fetches the complete representation of a single user group including its permissions. St...
Implement the Python class `GroupView` described below. Class description: Implement the GroupView class. Method signatures and docstrings: - async def get(self, group_id: str, /) -> Union[r200[GroupResponse], r404]: Get a group. Fetches the complete representation of a single user group including its permissions. St...
1d17d2ba570cf5487e7514bec29250a5b368bb0a
<|skeleton|> class GroupView: async def get(self, group_id: str, /) -> Union[r200[GroupResponse], r404]: """Get a group. Fetches the complete representation of a single user group including its permissions. Status Codes: 200: Successful operation 404: Group not found""" <|body_0|> async def pa...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class GroupView: async def get(self, group_id: str, /) -> Union[r200[GroupResponse], r404]: """Get a group. Fetches the complete representation of a single user group including its permissions. Status Codes: 200: Successful operation 404: Group not found""" try: group = await get_data_fr...
the_stack_v2_python_sparse
virtool/groups/api.py
virtool/virtool
train
45
48c4f3611ffc55cdc3a205da40acae304b5aa69e
[ "if os.path.isfile(path):\n with open(path, 'rb') as file:\n return (file.read(), True)\nif save:\n return (cls.fetch_and_save(url, path), False)\nreturn (cls.fetch_with_retry(url), False)", "content = cls.fetch_with_retry(url)\nif not content:\n return False\nwith open(path, 'wb') as file:\n f...
<|body_start_0|> if os.path.isfile(path): with open(path, 'rb') as file: return (file.read(), True) if save: return (cls.fetch_and_save(url, path), False) return (cls.fetch_with_retry(url), False) <|end_body_0|> <|body_start_1|> content = cls.fetc...
Fetcher
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Fetcher: def fetch_maybe(cls, url, path, save=False): """Fetch from url or from file if it has been cached previously""" <|body_0|> def fetch_and_save(cls, url, path): """Fetch file and save to disk""" <|body_1|> def fetch_with_retry(cls, url): "...
stack_v2_sparse_classes_10k_train_003211
2,471
no_license
[ { "docstring": "Fetch from url or from file if it has been cached previously", "name": "fetch_maybe", "signature": "def fetch_maybe(cls, url, path, save=False)" }, { "docstring": "Fetch file and save to disk", "name": "fetch_and_save", "signature": "def fetch_and_save(cls, url, path)" ...
4
stack_v2_sparse_classes_30k_train_006649
Implement the Python class `Fetcher` described below. Class description: Implement the Fetcher class. Method signatures and docstrings: - def fetch_maybe(cls, url, path, save=False): Fetch from url or from file if it has been cached previously - def fetch_and_save(cls, url, path): Fetch file and save to disk - def fe...
Implement the Python class `Fetcher` described below. Class description: Implement the Fetcher class. Method signatures and docstrings: - def fetch_maybe(cls, url, path, save=False): Fetch from url or from file if it has been cached previously - def fetch_and_save(cls, url, path): Fetch file and save to disk - def fe...
31f29e374d8668c92f1b1c48b2d38c967f5e145f
<|skeleton|> class Fetcher: def fetch_maybe(cls, url, path, save=False): """Fetch from url or from file if it has been cached previously""" <|body_0|> def fetch_and_save(cls, url, path): """Fetch file and save to disk""" <|body_1|> def fetch_with_retry(cls, url): "...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Fetcher: def fetch_maybe(cls, url, path, save=False): """Fetch from url or from file if it has been cached previously""" if os.path.isfile(path): with open(path, 'rb') as file: return (file.read(), True) if save: return (cls.fetch_and_save(url, p...
the_stack_v2_python_sparse
fetcher.py
mideind/thesis-corpus
train
0
c3e876561c8e5375d108e5ecc706a11f192da1c6
[ "try:\n x = cls.get_list_val(x)\nexcept AssertionError:\n return False\nreturn x == cls.OK", "try:\n x = cls.get_list_val(x)\nexcept AssertionError:\n return False\nreturn cls.has(x) and x != cls.OK", "val1 = cls.get_list_val(val1)\nval2 = cls.get_list_val(val2)\nreturn cls.has(val1) and cls.has(val...
<|body_start_0|> try: x = cls.get_list_val(x) except AssertionError: return False return x == cls.OK <|end_body_0|> <|body_start_1|> try: x = cls.get_list_val(x) except AssertionError: return False return cls.has(x) and x !...
Error codes generated by instrument drivers and agents
InstErrorCode
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference", "BSD-2-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InstErrorCode: """Error codes generated by instrument drivers and agents""" def is_ok(cls, x): """Success test functional synonym. Will need iterable type checking if success codes get additional info in the future. @param x a str, tuple or list to match to an error code success valu...
stack_v2_sparse_classes_10k_train_003212
9,909
permissive
[ { "docstring": "Success test functional synonym. Will need iterable type checking if success codes get additional info in the future. @param x a str, tuple or list to match to an error code success value. @retval True if x is a success value, False otherwise.", "name": "is_ok", "signature": "def is_ok(c...
5
stack_v2_sparse_classes_30k_train_002418
Implement the Python class `InstErrorCode` described below. Class description: Error codes generated by instrument drivers and agents Method signatures and docstrings: - def is_ok(cls, x): Success test functional synonym. Will need iterable type checking if success codes get additional info in the future. @param x a ...
Implement the Python class `InstErrorCode` described below. Class description: Error codes generated by instrument drivers and agents Method signatures and docstrings: - def is_ok(cls, x): Success test functional synonym. Will need iterable type checking if success codes get additional info in the future. @param x a ...
122c629290d27f32f2f41dafd5c12469295e8acf
<|skeleton|> class InstErrorCode: """Error codes generated by instrument drivers and agents""" def is_ok(cls, x): """Success test functional synonym. Will need iterable type checking if success codes get additional info in the future. @param x a str, tuple or list to match to an error code success valu...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class InstErrorCode: """Error codes generated by instrument drivers and agents""" def is_ok(cls, x): """Success test functional synonym. Will need iterable type checking if success codes get additional info in the future. @param x a str, tuple or list to match to an error code success value. @retval Tr...
the_stack_v2_python_sparse
pyon/agent/common.py
ooici/pyon
train
9
366f3f0d1f986e2295e98e43040a59f550e8ce43
[ "path = urls.TRAIL_LOG['GET_ALL']\nparams = {'limit': limit, 'offset': offset}\nif username:\n params['username'] = username\nif start_time:\n params['start_time'] = start_time\nif end_time:\n params['end_time'] = end_time\nif description:\n params['description'] = description\nif target:\n params['t...
<|body_start_0|> path = urls.TRAIL_LOG['GET_ALL'] params = {'limit': limit, 'offset': offset} if username: params['username'] = username if start_time: params['start_time'] = start_time if end_time: params['end_time'] = end_time if desc...
Get the audit logs and event logs with the functions in this class.
Audit
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Audit: """Get the audit logs and event logs with the functions in this class.""" def get_traillogs(self, conn, limit=100, offset=0, username=None, start_time=None, end_time=None, description=None, target=None, classification=None, customer_name=None, ip_address=None, app_id=None): ""...
stack_v2_sparse_classes_10k_train_003213
7,915
permissive
[ { "docstring": "Get audit logs, sort by time in in reverse chronological order. This API returns the first 10,000 results only. Please use filter in the API for more relevant results. MSP Customer Would see logs of MSP's and tenants as well. :param conn: Instance of class:`pycentral.ArubaCentralBase` to make an...
4
stack_v2_sparse_classes_30k_val_000209
Implement the Python class `Audit` described below. Class description: Get the audit logs and event logs with the functions in this class. Method signatures and docstrings: - def get_traillogs(self, conn, limit=100, offset=0, username=None, start_time=None, end_time=None, description=None, target=None, classification...
Implement the Python class `Audit` described below. Class description: Get the audit logs and event logs with the functions in this class. Method signatures and docstrings: - def get_traillogs(self, conn, limit=100, offset=0, username=None, start_time=None, end_time=None, description=None, target=None, classification...
d938396a18193473afbe54e6cc6697d2bd4954a7
<|skeleton|> class Audit: """Get the audit logs and event logs with the functions in this class.""" def get_traillogs(self, conn, limit=100, offset=0, username=None, start_time=None, end_time=None, description=None, target=None, classification=None, customer_name=None, ip_address=None, app_id=None): ""...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Audit: """Get the audit logs and event logs with the functions in this class.""" def get_traillogs(self, conn, limit=100, offset=0, username=None, start_time=None, end_time=None, description=None, target=None, classification=None, customer_name=None, ip_address=None, app_id=None): """Get audit lo...
the_stack_v2_python_sparse
pycentral/audit_logs.py
jayp193/pycentral
train
0
b12f3ded460bd861d96e6c39c5e81eed204ef662
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn MacOSGeneralDeviceConfiguration()", "from .app_list_item import AppListItem\nfrom .app_list_type import AppListType\nfrom .device_configuration import DeviceConfiguration\nfrom .required_password_type import RequiredPasswordType\nfrom ...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return MacOSGeneralDeviceConfiguration() <|end_body_0|> <|body_start_1|> from .app_list_item import AppListItem from .app_list_type import AppListType from .device_configuration import ...
This topic provides descriptions of the declared methods, properties and relationships exposed by the macOSGeneralDeviceConfiguration resource.
MacOSGeneralDeviceConfiguration
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MacOSGeneralDeviceConfiguration: """This topic provides descriptions of the declared methods, properties and relationships exposed by the macOSGeneralDeviceConfiguration resource.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> MacOSGeneralDeviceConfiguration:...
stack_v2_sparse_classes_10k_train_003214
6,806
permissive
[ { "docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: MacOSGeneralDeviceConfiguration", "name": "create_from_discriminator_value", "signature": "def create_from_d...
3
stack_v2_sparse_classes_30k_train_005982
Implement the Python class `MacOSGeneralDeviceConfiguration` described below. Class description: This topic provides descriptions of the declared methods, properties and relationships exposed by the macOSGeneralDeviceConfiguration resource. Method signatures and docstrings: - def create_from_discriminator_value(parse...
Implement the Python class `MacOSGeneralDeviceConfiguration` described below. Class description: This topic provides descriptions of the declared methods, properties and relationships exposed by the macOSGeneralDeviceConfiguration resource. Method signatures and docstrings: - def create_from_discriminator_value(parse...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class MacOSGeneralDeviceConfiguration: """This topic provides descriptions of the declared methods, properties and relationships exposed by the macOSGeneralDeviceConfiguration resource.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> MacOSGeneralDeviceConfiguration:...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MacOSGeneralDeviceConfiguration: """This topic provides descriptions of the declared methods, properties and relationships exposed by the macOSGeneralDeviceConfiguration resource.""" def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> MacOSGeneralDeviceConfiguration: """C...
the_stack_v2_python_sparse
msgraph/generated/models/mac_o_s_general_device_configuration.py
microsoftgraph/msgraph-sdk-python
train
135
641545540bcfb7496d5a8ce06bae2ef61738eee0
[ "tp = type(e)\ntb = e.__traceback__\ntraceback_str = 'Traceback (most recent call last):\\n' + ''.join(traceback.format_tb(tb))\ntry:\n attributes = e.get_attributes()\nexcept AttributeError:\n attributes = {}\nreturn (tp.__name__, traceback_str, sy.serde.msgpack.serde._simplify(worker, attributes))", "erro...
<|body_start_0|> tp = type(e) tb = e.__traceback__ traceback_str = 'Traceback (most recent call last):\n' + ''.join(traceback.format_tb(tb)) try: attributes = e.get_attributes() except AttributeError: attributes = {} return (tp.__name__, traceback_...
Raised when calling send on a tensor which does not allow send to be called on it. This can happen do to sensitivity being too high
SendNotPermittedError
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SendNotPermittedError: """Raised when calling send on a tensor which does not allow send to be called on it. This can happen do to sensitivity being too high""" def simplify(worker: 'sy.workers.AbstractWorker', e): """Serialize information about an Exception which was raised to forwa...
stack_v2_sparse_classes_10k_train_003215
15,166
permissive
[ { "docstring": "Serialize information about an Exception which was raised to forward it", "name": "simplify", "signature": "def simplify(worker: 'sy.workers.AbstractWorker', e)" }, { "docstring": "Detail and re-raise an Exception forwarded by another worker", "name": "detail", "signature...
2
stack_v2_sparse_classes_30k_train_006424
Implement the Python class `SendNotPermittedError` described below. Class description: Raised when calling send on a tensor which does not allow send to be called on it. This can happen do to sensitivity being too high Method signatures and docstrings: - def simplify(worker: 'sy.workers.AbstractWorker', e): Serialize...
Implement the Python class `SendNotPermittedError` described below. Class description: Raised when calling send on a tensor which does not allow send to be called on it. This can happen do to sensitivity being too high Method signatures and docstrings: - def simplify(worker: 'sy.workers.AbstractWorker', e): Serialize...
cc4765bed880ad38a02505834f63df39e0815328
<|skeleton|> class SendNotPermittedError: """Raised when calling send on a tensor which does not allow send to be called on it. This can happen do to sensitivity being too high""" def simplify(worker: 'sy.workers.AbstractWorker', e): """Serialize information about an Exception which was raised to forwa...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SendNotPermittedError: """Raised when calling send on a tensor which does not allow send to be called on it. This can happen do to sensitivity being too high""" def simplify(worker: 'sy.workers.AbstractWorker', e): """Serialize information about an Exception which was raised to forward it""" ...
the_stack_v2_python_sparse
syft/exceptions.py
tudorcebere/PySyft
train
2
472ff4ef152cd76d3430fd4f7f11710d92ca1950
[ "self.width = width\nself.height = height\nself.board = []\nfor i in range(height):\n row = []\n for j in range(width):\n row.append('.')\n self.board.append(row)", "random.seed(seed_number)\nfor i in range(self.height):\n for j in range(self.width):\n random_number = random.randint(0, 1...
<|body_start_0|> self.width = width self.height = height self.board = [] for i in range(height): row = [] for j in range(width): row.append('.') self.board.append(row) <|end_body_0|> <|body_start_1|> random.seed(seed_number) ...
Describes the world of Conway's Game of Life. Attribute width: the width of the game world in number of cells. Invariant: width is a non-negative integer. Attribute height: the height of the game world in number of cells. Invariant: height is a non-negative integer. Attribute board: the board of the game world. Invaria...
Life
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Life: """Describes the world of Conway's Game of Life. Attribute width: the width of the game world in number of cells. Invariant: width is a non-negative integer. Attribute height: the height of the game world in number of cells. Invariant: height is a non-negative integer. Attribute board: the ...
stack_v2_sparse_classes_10k_train_003216
4,872
no_license
[ { "docstring": "Initializes the Game of Life with the given width and height. Also initializes the attribute board to be of the right size, and with all cells dead. Precondition: width and height are nonnegative integers.", "name": "__init__", "signature": "def __init__(self, width, height)" }, { ...
5
stack_v2_sparse_classes_30k_train_004484
Implement the Python class `Life` described below. Class description: Describes the world of Conway's Game of Life. Attribute width: the width of the game world in number of cells. Invariant: width is a non-negative integer. Attribute height: the height of the game world in number of cells. Invariant: height is a non-...
Implement the Python class `Life` described below. Class description: Describes the world of Conway's Game of Life. Attribute width: the width of the game world in number of cells. Invariant: width is a non-negative integer. Attribute height: the height of the game world in number of cells. Invariant: height is a non-...
0b4b957720710d7ace0c12dffda5331fadbe2653
<|skeleton|> class Life: """Describes the world of Conway's Game of Life. Attribute width: the width of the game world in number of cells. Invariant: width is a non-negative integer. Attribute height: the height of the game world in number of cells. Invariant: height is a non-negative integer. Attribute board: the ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Life: """Describes the world of Conway's Game of Life. Attribute width: the width of the game world in number of cells. Invariant: width is a non-negative integer. Attribute height: the height of the game world in number of cells. Invariant: height is a non-negative integer. Attribute board: the board of the ...
the_stack_v2_python_sparse
Assignments/a5/skeleton/a5.py
futuregoogle/CS1110
train
0
3f43c8f6d08095bb6513e38db8d0828238a58008
[ "super(STFTLoss, self).__init__()\nself.fft_size = fft_size\nself.hop_size = hop_size\nself.win_length = win_length\nself.window = getattr(torch, window)(win_length).cuda()\nself.amp_floor = 1e-05\nself.mse_loss = torch.nn.MSELoss()", "x_stft = torch.stft(x, self.fft_size, self.hop_size, self.win_length, window=s...
<|body_start_0|> super(STFTLoss, self).__init__() self.fft_size = fft_size self.hop_size = hop_size self.win_length = win_length self.window = getattr(torch, window)(win_length).cuda() self.amp_floor = 1e-05 self.mse_loss = torch.nn.MSELoss() <|end_body_0|> <|bod...
STFT loss module.
STFTLoss
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class STFTLoss: """STFT loss module.""" def __init__(self, fft_size, hop_size, win_length, window): """Initialize STFT loss module.""" <|body_0|> def forward(self, x, y): """Calculate forward propagation. Args: x (Tensor): Predicted signal (B, T). y (Tensor): Groundtru...
stack_v2_sparse_classes_10k_train_003217
2,811
permissive
[ { "docstring": "Initialize STFT loss module.", "name": "__init__", "signature": "def __init__(self, fft_size, hop_size, win_length, window)" }, { "docstring": "Calculate forward propagation. Args: x (Tensor): Predicted signal (B, T). y (Tensor): Groundtruth signal (B, T). Returns: Tensor: Logari...
2
stack_v2_sparse_classes_30k_train_003499
Implement the Python class `STFTLoss` described below. Class description: STFT loss module. Method signatures and docstrings: - def __init__(self, fft_size, hop_size, win_length, window): Initialize STFT loss module. - def forward(self, x, y): Calculate forward propagation. Args: x (Tensor): Predicted signal (B, T). ...
Implement the Python class `STFTLoss` described below. Class description: STFT loss module. Method signatures and docstrings: - def __init__(self, fft_size, hop_size, win_length, window): Initialize STFT loss module. - def forward(self, x, y): Calculate forward propagation. Args: x (Tensor): Predicted signal (B, T). ...
67331ddb5d6a7227120818842c61b6e07de52ba7
<|skeleton|> class STFTLoss: """STFT loss module.""" def __init__(self, fft_size, hop_size, win_length, window): """Initialize STFT loss module.""" <|body_0|> def forward(self, x, y): """Calculate forward propagation. Args: x (Tensor): Predicted signal (B, T). y (Tensor): Groundtru...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class STFTLoss: """STFT loss module.""" def __init__(self, fft_size, hop_size, win_length, window): """Initialize STFT loss module.""" super(STFTLoss, self).__init__() self.fft_size = fft_size self.hop_size = hop_size self.win_length = win_length self.window = ge...
the_stack_v2_python_sparse
usfgan/losses/stft_loss.py
hendrikTpl/UnifiedSourceFilterGAN
train
0
e8df151a2ee23dee3e567e2be58f85352d6ffcc7
[ "if opt_options is None:\n opt_options = {'maxiter': 100, 'disp': True, 'iprint': 2, 'ftol': 1e-12, 'eps': 0.1}\nsuper().__init__(fi=fi, minimum_yaw_angle=minimum_yaw_angle, maximum_yaw_angle=maximum_yaw_angle, yaw_angles_baseline=yaw_angles_baseline, x0=x0, turbine_weights=turbine_weights, normalize_control_var...
<|body_start_0|> if opt_options is None: opt_options = {'maxiter': 100, 'disp': True, 'iprint': 2, 'ftol': 1e-12, 'eps': 0.1} super().__init__(fi=fi, minimum_yaw_angle=minimum_yaw_angle, maximum_yaw_angle=maximum_yaw_angle, yaw_angles_baseline=yaw_angles_baseline, x0=x0, turbine_weights=turb...
YawOptimizationScipy is a subclass of :py:class:`floris.tools.optimization.general_library.YawOptimization` that is used to optimize the yaw angles of all turbines in a Floris Farm for a single set of inflow conditions using the SciPy optimize package.
YawOptimizationScipy
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class YawOptimizationScipy: """YawOptimizationScipy is a subclass of :py:class:`floris.tools.optimization.general_library.YawOptimization` that is used to optimize the yaw angles of all turbines in a Floris Farm for a single set of inflow conditions using the SciPy optimize package.""" def __init_...
stack_v2_sparse_classes_10k_train_003218
5,455
permissive
[ { "docstring": "Instantiate YawOptimizationScipy object with a FlorisInterface object and assign parameter values.", "name": "__init__", "signature": "def __init__(self, fi, minimum_yaw_angle=0.0, maximum_yaw_angle=25.0, yaw_angles_baseline=None, x0=None, opt_method='SLSQP', opt_options=None, turbine_we...
2
stack_v2_sparse_classes_30k_train_000348
Implement the Python class `YawOptimizationScipy` described below. Class description: YawOptimizationScipy is a subclass of :py:class:`floris.tools.optimization.general_library.YawOptimization` that is used to optimize the yaw angles of all turbines in a Floris Farm for a single set of inflow conditions using the SciP...
Implement the Python class `YawOptimizationScipy` described below. Class description: YawOptimizationScipy is a subclass of :py:class:`floris.tools.optimization.general_library.YawOptimization` that is used to optimize the yaw angles of all turbines in a Floris Farm for a single set of inflow conditions using the SciP...
59e53a66aef134a3c9e912f9468ca667b599d4e5
<|skeleton|> class YawOptimizationScipy: """YawOptimizationScipy is a subclass of :py:class:`floris.tools.optimization.general_library.YawOptimization` that is used to optimize the yaw angles of all turbines in a Floris Farm for a single set of inflow conditions using the SciPy optimize package.""" def __init_...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class YawOptimizationScipy: """YawOptimizationScipy is a subclass of :py:class:`floris.tools.optimization.general_library.YawOptimization` that is used to optimize the yaw angles of all turbines in a Floris Farm for a single set of inflow conditions using the SciPy optimize package.""" def __init__(self, fi, m...
the_stack_v2_python_sparse
floris/tools/optimization/yaw_optimization/yaw_optimizer_scipy.py
NREL/floris
train
151
7901472b6deb477ea926f86f2b9ab766476ea1ae
[ "super(Machines, self).__init__(url=url, gis=gis, portaladmin=portaladmin)\ninitialize = kwargs.pop('initialize', False)\nself._url = url\nself._pa = portaladmin\nif initialize:\n self._init()", "machines = []\nfor m in self.properties.machines:\n machines.append(Machine(name=m['machineName'], url=self._url...
<|body_start_0|> super(Machines, self).__init__(url=url, gis=gis, portaladmin=portaladmin) initialize = kwargs.pop('initialize', False) self._url = url self._pa = portaladmin if initialize: self._init() <|end_body_0|> <|body_start_1|> machines = [] fo...
This resource lists all the portal machines in a site. Each portal machine has a status that indicates whether the machine is ready to accept requests.
Machines
[ "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Machines: """This resource lists all the portal machines in a site. Each portal machine has a status that indicates whether the machine is ready to accept requests.""" def __init__(self, url, gis, portaladmin, **kwargs): """Constructor""" <|body_0|> def list(self): ...
stack_v2_sparse_classes_10k_train_003219
4,901
permissive
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self, url, gis, portaladmin, **kwargs)" }, { "docstring": "provides a list of all registered machines with the local GIS", "name": "list", "signature": "def list(self)" }, { "docstring": "allows for retr...
3
null
Implement the Python class `Machines` described below. Class description: This resource lists all the portal machines in a site. Each portal machine has a status that indicates whether the machine is ready to accept requests. Method signatures and docstrings: - def __init__(self, url, gis, portaladmin, **kwargs): Con...
Implement the Python class `Machines` described below. Class description: This resource lists all the portal machines in a site. Each portal machine has a status that indicates whether the machine is ready to accept requests. Method signatures and docstrings: - def __init__(self, url, gis, portaladmin, **kwargs): Con...
a874fe7e5c95196e4de68db2da0e2a05eb70e5d8
<|skeleton|> class Machines: """This resource lists all the portal machines in a site. Each portal machine has a status that indicates whether the machine is ready to accept requests.""" def __init__(self, url, gis, portaladmin, **kwargs): """Constructor""" <|body_0|> def list(self): ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Machines: """This resource lists all the portal machines in a site. Each portal machine has a status that indicates whether the machine is ready to accept requests.""" def __init__(self, url, gis, portaladmin, **kwargs): """Constructor""" super(Machines, self).__init__(url=url, gis=gis, p...
the_stack_v2_python_sparse
arcpyenv/arcgispro-py3-clone/Lib/site-packages/arcgis/gis/admin/_machines.py
SherbazHashmi/HackathonServer
train
3
fdf52c53e8c01d13ae12d342deb658977903b435
[ "self.host = host\nself.username = username\nself.password = password\nself.port = port\nself.phonebook_id = phonebook_id\nself.phonebook_dict = None\nself.number_dict = None\nself.prefixes = prefixes or []\nself.fph = FritzPhonebook(address=self.host, user=self.username, password=self.password)\nif self.phonebook_...
<|body_start_0|> self.host = host self.username = username self.password = password self.port = port self.phonebook_id = phonebook_id self.phonebook_dict = None self.number_dict = None self.prefixes = prefixes or [] self.fph = FritzPhonebook(addres...
This connects to a FritzBox router and downloads its phone book.
FritzBoxPhonebook
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FritzBoxPhonebook: """This connects to a FritzBox router and downloads its phone book.""" def __init__(self, host, port, username, password, phonebook_id=0, prefixes=None): """Initialize the class.""" <|body_0|> def update_phonebook(self): """Update the phone boo...
stack_v2_sparse_classes_10k_train_003220
9,842
permissive
[ { "docstring": "Initialize the class.", "name": "__init__", "signature": "def __init__(self, host, port, username, password, phonebook_id=0, prefixes=None)" }, { "docstring": "Update the phone book dictionary.", "name": "update_phonebook", "signature": "def update_phonebook(self)" }, ...
3
null
Implement the Python class `FritzBoxPhonebook` described below. Class description: This connects to a FritzBox router and downloads its phone book. Method signatures and docstrings: - def __init__(self, host, port, username, password, phonebook_id=0, prefixes=None): Initialize the class. - def update_phonebook(self):...
Implement the Python class `FritzBoxPhonebook` described below. Class description: This connects to a FritzBox router and downloads its phone book. Method signatures and docstrings: - def __init__(self, host, port, username, password, phonebook_id=0, prefixes=None): Initialize the class. - def update_phonebook(self):...
ed4ab403deaed9e8c95e0db728477fcb012bf4fa
<|skeleton|> class FritzBoxPhonebook: """This connects to a FritzBox router and downloads its phone book.""" def __init__(self, host, port, username, password, phonebook_id=0, prefixes=None): """Initialize the class.""" <|body_0|> def update_phonebook(self): """Update the phone boo...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FritzBoxPhonebook: """This connects to a FritzBox router and downloads its phone book.""" def __init__(self, host, port, username, password, phonebook_id=0, prefixes=None): """Initialize the class.""" self.host = host self.username = username self.password = password ...
the_stack_v2_python_sparse
homeassistant/components/fritzbox_callmonitor/sensor.py
tchellomello/home-assistant
train
8
2ff5b6ee6db9c2697aad5021343f01c1469c48cc
[ "f = open(os.path.join(self.path, filename), 'rb')\nlines = f.readlines()\nf.close()\nreturn lines", "if filename not in self.db_config:\n f = open(os.path.join(self.path, 'db', filename), 'rb')\n self.db_config[filename] = f.readlines()\n f.close()\nreturn self.db_config[filename]", "if name is None:\...
<|body_start_0|> f = open(os.path.join(self.path, filename), 'rb') lines = f.readlines() f.close() return lines <|end_body_0|> <|body_start_1|> if filename not in self.db_config: f = open(os.path.join(self.path, 'db', filename), 'rb') self.db_config[filen...
Encapsulates key information of a repository: its NAME, PATH, SHARD_SIZE, HEAD revision and MIN_UNPACKED_REV.
Repository
[ "BSD-3-Clause", "LicenseRef-scancode-generic-cla", "LicenseRef-scancode-other-permissive", "X11", "BSD-2-Clause", "LicenseRef-scancode-unknown-license-reference", "MIT", "HPND-Markus-Kuhn", "LicenseRef-scancode-unicode", "Apache-2.0", "FSFAP" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Repository: """Encapsulates key information of a repository: its NAME, PATH, SHARD_SIZE, HEAD revision and MIN_UNPACKED_REV.""" def _read_repo_file(self, filename): """Read and return all lines from FILENAME in REPO.""" <|body_0|> def _read_config(self, filename): ...
stack_v2_sparse_classes_10k_train_003221
6,496
permissive
[ { "docstring": "Read and return all lines from FILENAME in REPO.", "name": "_read_repo_file", "signature": "def _read_repo_file(self, filename)" }, { "docstring": "Read and return all lines from FILENAME. This will be used to read 'format', 'current' etc. .", "name": "_read_config", "sig...
5
stack_v2_sparse_classes_30k_train_004394
Implement the Python class `Repository` described below. Class description: Encapsulates key information of a repository: its NAME, PATH, SHARD_SIZE, HEAD revision and MIN_UNPACKED_REV. Method signatures and docstrings: - def _read_repo_file(self, filename): Read and return all lines from FILENAME in REPO. - def _rea...
Implement the Python class `Repository` described below. Class description: Encapsulates key information of a repository: its NAME, PATH, SHARD_SIZE, HEAD revision and MIN_UNPACKED_REV. Method signatures and docstrings: - def _read_repo_file(self, filename): Read and return all lines from FILENAME in REPO. - def _rea...
dd957c4991e61bde23cc60d13449ea8b65f80c43
<|skeleton|> class Repository: """Encapsulates key information of a repository: its NAME, PATH, SHARD_SIZE, HEAD revision and MIN_UNPACKED_REV.""" def _read_repo_file(self, filename): """Read and return all lines from FILENAME in REPO.""" <|body_0|> def _read_config(self, filename): ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Repository: """Encapsulates key information of a repository: its NAME, PATH, SHARD_SIZE, HEAD revision and MIN_UNPACKED_REV.""" def _read_repo_file(self, filename): """Read and return all lines from FILENAME in REPO.""" f = open(os.path.join(self.path, filename), 'rb') lines = f.r...
the_stack_v2_python_sparse
contrib/server-side/fsfsfixer/fixer/find_good_id.py
apache/subversion
train
520
d81b0b3aa6a3e97f4112567e8547e45c97af5634
[ "SinglePanelPlot.__init__(self)\nself.__triggername = triggername\nself.__triggereff = triggerefficiency", "self._OpenCanvas('trgEffSumm', 'Summed trigger efficiency')\npad = self._GetFramedPad()\npad.DrawFrame(TriggerEfficiencyFrame('tframe'))\npad.DrawGraphicsObject(GraphicsObject(self.__triggereff.GetEfficienc...
<|body_start_0|> SinglePanelPlot.__init__(self) self.__triggername = triggername self.__triggereff = triggerefficiency <|end_body_0|> <|body_start_1|> self._OpenCanvas('trgEffSumm', 'Summed trigger efficiency') pad = self._GetFramedPad() pad.DrawFrame(TriggerEfficiencyFr...
Plot the summed trigger efficiency from different pt-hard bins
TriggerEfficiencySumPlot
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TriggerEfficiencySumPlot: """Plot the summed trigger efficiency from different pt-hard bins""" def __init__(self, triggername, triggerefficiency): """Constructor""" <|body_0|> def Create(self): """Create the plot""" <|body_1|> <|end_skeleton|> <|body_st...
stack_v2_sparse_classes_10k_train_003222
5,978
permissive
[ { "docstring": "Constructor", "name": "__init__", "signature": "def __init__(self, triggername, triggerefficiency)" }, { "docstring": "Create the plot", "name": "Create", "signature": "def Create(self)" } ]
2
stack_v2_sparse_classes_30k_test_000316
Implement the Python class `TriggerEfficiencySumPlot` described below. Class description: Plot the summed trigger efficiency from different pt-hard bins Method signatures and docstrings: - def __init__(self, triggername, triggerefficiency): Constructor - def Create(self): Create the plot
Implement the Python class `TriggerEfficiencySumPlot` described below. Class description: Plot the summed trigger efficiency from different pt-hard bins Method signatures and docstrings: - def __init__(self, triggername, triggerefficiency): Constructor - def Create(self): Create the plot <|skeleton|> class TriggerEf...
5df28b2b415e78e81273b0d9bf5c1b99feda3348
<|skeleton|> class TriggerEfficiencySumPlot: """Plot the summed trigger efficiency from different pt-hard bins""" def __init__(self, triggername, triggerefficiency): """Constructor""" <|body_0|> def Create(self): """Create the plot""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TriggerEfficiencySumPlot: """Plot the summed trigger efficiency from different pt-hard bins""" def __init__(self, triggername, triggerefficiency): """Constructor""" SinglePanelPlot.__init__(self) self.__triggername = triggername self.__triggereff = triggerefficiency d...
the_stack_v2_python_sparse
PWGJE/EMCALJetTasks/Tracks/analysis/plots/TriggerEfficiencyPlotMC.py
alisw/AliPhysics
train
129
437da607e5e27f70750f22b4e1fbb1a8614e60f0
[ "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "context.set_code(grpc.StatusCode.UNIMPLEMENTED)\ncontext.set_details('Method not implemented!')\nraise NotImplementedError('Method not implemented!')", "conte...
<|body_start_0|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') <|end_body_0|> <|body_start_1|> context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not im...
Manages knowledge bases. Allows users to setup and maintain knowledge bases with their knowledge data.
KnowledgeBasesServicer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KnowledgeBasesServicer: """Manages knowledge bases. Allows users to setup and maintain knowledge bases with their knowledge data.""" def ListKnowledgeBases(self, request, context): """Returns the list of all knowledge bases of the specified agent.""" <|body_0|> def GetKn...
stack_v2_sparse_classes_10k_train_003223
5,251
permissive
[ { "docstring": "Returns the list of all knowledge bases of the specified agent.", "name": "ListKnowledgeBases", "signature": "def ListKnowledgeBases(self, request, context)" }, { "docstring": "Retrieves the specified knowledge base.", "name": "GetKnowledgeBase", "signature": "def GetKnow...
4
stack_v2_sparse_classes_30k_train_007257
Implement the Python class `KnowledgeBasesServicer` described below. Class description: Manages knowledge bases. Allows users to setup and maintain knowledge bases with their knowledge data. Method signatures and docstrings: - def ListKnowledgeBases(self, request, context): Returns the list of all knowledge bases of ...
Implement the Python class `KnowledgeBasesServicer` described below. Class description: Manages knowledge bases. Allows users to setup and maintain knowledge bases with their knowledge data. Method signatures and docstrings: - def ListKnowledgeBases(self, request, context): Returns the list of all knowledge bases of ...
c9c830feb6b66c2e362f8fb5d147ef0c4f4a08cf
<|skeleton|> class KnowledgeBasesServicer: """Manages knowledge bases. Allows users to setup and maintain knowledge bases with their knowledge data.""" def ListKnowledgeBases(self, request, context): """Returns the list of all knowledge bases of the specified agent.""" <|body_0|> def GetKn...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class KnowledgeBasesServicer: """Manages knowledge bases. Allows users to setup and maintain knowledge bases with their knowledge data.""" def ListKnowledgeBases(self, request, context): """Returns the list of all knowledge bases of the specified agent.""" context.set_code(grpc.StatusCode.UNIMP...
the_stack_v2_python_sparse
pyenv/lib/python3.6/site-packages/dialogflow_v2beta1/proto/knowledge_base_pb2_grpc.py
ronald-rgr/ai-chatbot-smartguide
train
0
04c9e321302ed20e361babd26f733f857436c8c1
[ "if len(matrix) == 0 or len(matrix[0]) == 0:\n return 0\nmaxSide = 0\nrows, columns = (len(matrix), len(matrix[0]))\ndp = [[0] * columns for _ in range(rows)]\nfor i in range(rows):\n for j in range(columns):\n if matrix[i][j] == '1':\n if i == 0 or j == 0:\n dp[i][j] = 1\n ...
<|body_start_0|> if len(matrix) == 0 or len(matrix[0]) == 0: return 0 maxSide = 0 rows, columns = (len(matrix), len(matrix[0])) dp = [[0] * columns for _ in range(rows)] for i in range(rows): for j in range(columns): if matrix[i][j] == '1':...
Solution
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def maximalSquare(self, matrix: List[List[str]]) -> int: """方法二:动态规划 时间复杂度:O(mn) 空间复杂度:O(mn) :param matrix: :return:""" <|body_0|> def maximalSquare_optimize(self, matrix: List[List[str]]) -> int: """方法二:动态规划 时间复杂度:O(mn) 空间复杂度:O(0) :param matrix: :return:""...
stack_v2_sparse_classes_10k_train_003224
2,226
permissive
[ { "docstring": "方法二:动态规划 时间复杂度:O(mn) 空间复杂度:O(mn) :param matrix: :return:", "name": "maximalSquare", "signature": "def maximalSquare(self, matrix: List[List[str]]) -> int" }, { "docstring": "方法二:动态规划 时间复杂度:O(mn) 空间复杂度:O(0) :param matrix: :return:", "name": "maximalSquare_optimize", "signa...
2
stack_v2_sparse_classes_30k_train_005322
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maximalSquare(self, matrix: List[List[str]]) -> int: 方法二:动态规划 时间复杂度:O(mn) 空间复杂度:O(mn) :param matrix: :return: - def maximalSquare_optimize(self, matrix: List[List[str]]) -> i...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def maximalSquare(self, matrix: List[List[str]]) -> int: 方法二:动态规划 时间复杂度:O(mn) 空间复杂度:O(mn) :param matrix: :return: - def maximalSquare_optimize(self, matrix: List[List[str]]) -> i...
62419b49000e79962bcdc99cd98afd2fb82ea345
<|skeleton|> class Solution: def maximalSquare(self, matrix: List[List[str]]) -> int: """方法二:动态规划 时间复杂度:O(mn) 空间复杂度:O(mn) :param matrix: :return:""" <|body_0|> def maximalSquare_optimize(self, matrix: List[List[str]]) -> int: """方法二:动态规划 时间复杂度:O(mn) 空间复杂度:O(0) :param matrix: :return:""...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def maximalSquare(self, matrix: List[List[str]]) -> int: """方法二:动态规划 时间复杂度:O(mn) 空间复杂度:O(mn) :param matrix: :return:""" if len(matrix) == 0 or len(matrix[0]) == 0: return 0 maxSide = 0 rows, columns = (len(matrix), len(matrix[0])) dp = [[0] * colum...
the_stack_v2_python_sparse
LeetCode 热题 HOT 100/maximalSquare.py
MaoningGuan/LeetCode
train
3
037d5658e5e85f09b18e9b0cab84902de5aed6fe
[ "super().__init__()\nself.average_by_layers = average_by_layers\nself.average_by_discriminators = average_by_discriminators\nself.include_final_outputs = include_final_outputs", "feat_match_loss = 0.0\nfor i, (feats_hat_, feats_) in enumerate(zip(feats_hat, feats)):\n feat_match_loss_ = 0.0\n if not self.in...
<|body_start_0|> super().__init__() self.average_by_layers = average_by_layers self.average_by_discriminators = average_by_discriminators self.include_final_outputs = include_final_outputs <|end_body_0|> <|body_start_1|> feat_match_loss = 0.0 for i, (feats_hat_, feats_) ...
Feature matching loss module.
FeatureMatchLoss
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class FeatureMatchLoss: """Feature matching loss module.""" def __init__(self, average_by_layers=True, average_by_discriminators=True, include_final_outputs=False): """Initialize FeatureMatchLoss module.""" <|body_0|> def forward(self, feats_hat, feats): """Calcualate ...
stack_v2_sparse_classes_10k_train_003225
46,210
permissive
[ { "docstring": "Initialize FeatureMatchLoss module.", "name": "__init__", "signature": "def __init__(self, average_by_layers=True, average_by_discriminators=True, include_final_outputs=False)" }, { "docstring": "Calcualate feature matching loss. Args: feats_hat(list): List of list of discriminat...
2
stack_v2_sparse_classes_30k_train_002752
Implement the Python class `FeatureMatchLoss` described below. Class description: Feature matching loss module. Method signatures and docstrings: - def __init__(self, average_by_layers=True, average_by_discriminators=True, include_final_outputs=False): Initialize FeatureMatchLoss module. - def forward(self, feats_hat...
Implement the Python class `FeatureMatchLoss` described below. Class description: Feature matching loss module. Method signatures and docstrings: - def __init__(self, average_by_layers=True, average_by_discriminators=True, include_final_outputs=False): Initialize FeatureMatchLoss module. - def forward(self, feats_hat...
17854a04d43c231eff66bfed9d6aa55e94a29e79
<|skeleton|> class FeatureMatchLoss: """Feature matching loss module.""" def __init__(self, average_by_layers=True, average_by_discriminators=True, include_final_outputs=False): """Initialize FeatureMatchLoss module.""" <|body_0|> def forward(self, feats_hat, feats): """Calcualate ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class FeatureMatchLoss: """Feature matching loss module.""" def __init__(self, average_by_layers=True, average_by_discriminators=True, include_final_outputs=False): """Initialize FeatureMatchLoss module.""" super().__init__() self.average_by_layers = average_by_layers self.avera...
the_stack_v2_python_sparse
paddlespeech/t2s/modules/losses.py
anniyanvr/DeepSpeech-1
train
0
01d74009f652435a584d412cb72f39071a096ce0
[ "self._targets_and_priorities = targets_and_priorities\nself._queue_name = queue_name\nsuper(NotificationPikaPoller, self).__init__(pika_engine, batch_size, batch_timeout, prefetch_count, pika_drv_msg.PikaIncomingMessage)", "queues_to_consume = []\nfor target, priority in self._targets_and_priorities:\n routin...
<|body_start_0|> self._targets_and_priorities = targets_and_priorities self._queue_name = queue_name super(NotificationPikaPoller, self).__init__(pika_engine, batch_size, batch_timeout, prefetch_count, pika_drv_msg.PikaIncomingMessage) <|end_body_0|> <|body_start_1|> queues_to_consume =...
PikaPoller implementation for polling Notification messages. Overrides base functionality according to Notification specific
NotificationPikaPoller
[ "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NotificationPikaPoller: """PikaPoller implementation for polling Notification messages. Overrides base functionality according to Notification specific""" def __init__(self, pika_engine, targets_and_priorities, batch_size, batch_timeout, prefetch_count, queue_name=None): """Adds targ...
stack_v2_sparse_classes_10k_train_003226
22,231
permissive
[ { "docstring": "Adds targets_and_priorities and queue_name parameter for declaring exchanges and queues used for notification delivery :param pika_engine: PikaEngine, shared object with configuration and shared driver functionality :param targets_and_priorities: list of (target, priority), defines default queue...
2
stack_v2_sparse_classes_30k_test_000361
Implement the Python class `NotificationPikaPoller` described below. Class description: PikaPoller implementation for polling Notification messages. Overrides base functionality according to Notification specific Method signatures and docstrings: - def __init__(self, pika_engine, targets_and_priorities, batch_size, b...
Implement the Python class `NotificationPikaPoller` described below. Class description: PikaPoller implementation for polling Notification messages. Overrides base functionality according to Notification specific Method signatures and docstrings: - def __init__(self, pika_engine, targets_and_priorities, batch_size, b...
c01951b33e278de9e769c2d0609c0be61d2cb26b
<|skeleton|> class NotificationPikaPoller: """PikaPoller implementation for polling Notification messages. Overrides base functionality according to Notification specific""" def __init__(self, pika_engine, targets_and_priorities, batch_size, batch_timeout, prefetch_count, queue_name=None): """Adds targ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class NotificationPikaPoller: """PikaPoller implementation for polling Notification messages. Overrides base functionality according to Notification specific""" def __init__(self, pika_engine, targets_and_priorities, batch_size, batch_timeout, prefetch_count, queue_name=None): """Adds targets_and_prior...
the_stack_v2_python_sparse
filesystems/vnx_rootfs_lxc_ubuntu64-16.04-v025-openstack-compute/rootfs/usr/lib/python2.7/dist-packages/oslo_messaging/_drivers/pika_driver/pika_poller.py
juancarlosdiaztorres/Ansible-OpenStack
train
0
4cbb13cea2166ce462e8ddd8c8520c6fb94f7974
[ "self.max_width = max_width\nself.closed = False\nsuper().__init__(visible=False, vsync=False, resizable=True)", "assert isinstance(x, np.ndarray), f'expected numpy array dtype, got {type(x)}'\nassert x.ndim == 3, f'expected ndim=3, got {x.ndim}'\nassert x.shape[-1] == 3, f'expected 3 color channel, got {x.shape[...
<|body_start_0|> self.max_width = max_width self.closed = False super().__init__(visible=False, vsync=False, resizable=True) <|end_body_0|> <|body_start_1|> assert isinstance(x, np.ndarray), f'expected numpy array dtype, got {type(x)}' assert x.ndim == 3, f'expected ndim=3, got ...
Display an image from an RGB array in an OpenGL window. Example:: imageviewer = ImageViewer(max_width=500) image = np.asarray(Image.open('x.jpg')) imageviewer(image)
ImageViewer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ImageViewer: """Display an image from an RGB array in an OpenGL window. Example:: imageviewer = ImageViewer(max_width=500) image = np.asarray(Image.open('x.jpg')) imageviewer(image)""" def __init__(self, max_width=500): """Initialize the OpenGL window. Args: max_width (int): maximum ...
stack_v2_sparse_classes_10k_train_003227
3,097
permissive
[ { "docstring": "Initialize the OpenGL window. Args: max_width (int): maximum width of the window.", "name": "__init__", "signature": "def __init__(self, max_width=500)" }, { "docstring": "Create an image from the given RGB array and display to the window. Args: x (ndarray): RGB array", "name...
3
stack_v2_sparse_classes_30k_train_002761
Implement the Python class `ImageViewer` described below. Class description: Display an image from an RGB array in an OpenGL window. Example:: imageviewer = ImageViewer(max_width=500) image = np.asarray(Image.open('x.jpg')) imageviewer(image) Method signatures and docstrings: - def __init__(self, max_width=500): Init...
Implement the Python class `ImageViewer` described below. Class description: Display an image from an RGB array in an OpenGL window. Example:: imageviewer = ImageViewer(max_width=500) image = np.asarray(Image.open('x.jpg')) imageviewer(image) Method signatures and docstrings: - def __init__(self, max_width=500): Init...
273bb7f5babb1f250f6dba0b5f62c6614f301719
<|skeleton|> class ImageViewer: """Display an image from an RGB array in an OpenGL window. Example:: imageviewer = ImageViewer(max_width=500) image = np.asarray(Image.open('x.jpg')) imageviewer(image)""" def __init__(self, max_width=500): """Initialize the OpenGL window. Args: max_width (int): maximum ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ImageViewer: """Display an image from an RGB array in an OpenGL window. Example:: imageviewer = ImageViewer(max_width=500) image = np.asarray(Image.open('x.jpg')) imageviewer(image)""" def __init__(self, max_width=500): """Initialize the OpenGL window. Args: max_width (int): maximum width of the ...
the_stack_v2_python_sparse
lagom/vis/image_viewer.py
LorinChen/lagom
train
1
8dec117412f8275c66f7246110daf7d506cf2fcf
[ "DataMatrixGuiXYProbe.__init__(self, plot_title=plot_title, id_is_strain=id_is_strain)\nself.app1.set_title(plot_title)\nself.id2NA_mismatch_rate = id2NA_mismatch_rate\nself.plot_title = plot_title\nself.id2info = id2info\nself.id2index = id2index\nself.id_is_strain = id_is_strain\nself.header = header\nself.strain...
<|body_start_0|> DataMatrixGuiXYProbe.__init__(self, plot_title=plot_title, id_is_strain=id_is_strain) self.app1.set_title(plot_title) self.id2NA_mismatch_rate = id2NA_mismatch_rate self.plot_title = plot_title self.id2info = id2info self.id2index = id2index self....
2009-3-24 trunk moved to indepedent DataMatrixGuiXYProbe.py and inherits from it 2008-02-05 embed it into a bigger gnome app, add more buttons, and change the __init__() 2008-01-01 class to visualize the results from QualityControl.py
QCVisualize
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QCVisualize: """2009-3-24 trunk moved to indepedent DataMatrixGuiXYProbe.py and inherits from it 2008-02-05 embed it into a bigger gnome app, add more buttons, and change the __init__() 2008-01-01 class to visualize the results from QualityControl.py""" def __init__(self, id2NA_mismatch_rate...
stack_v2_sparse_classes_10k_train_003228
3,098
no_license
[ { "docstring": "2008-01-10 use a paned window to wrap the scrolledwindow and the canvas so that the relative size of canvas to the scrolledwindow could be adjusted by the user.", "name": "__init__", "signature": "def __init__(self, id2NA_mismatch_rate, plot_title='', id2info={}, id2index={}, id_is_strai...
2
stack_v2_sparse_classes_30k_train_003423
Implement the Python class `QCVisualize` described below. Class description: 2009-3-24 trunk moved to indepedent DataMatrixGuiXYProbe.py and inherits from it 2008-02-05 embed it into a bigger gnome app, add more buttons, and change the __init__() 2008-01-01 class to visualize the results from QualityControl.py Method...
Implement the Python class `QCVisualize` described below. Class description: 2009-3-24 trunk moved to indepedent DataMatrixGuiXYProbe.py and inherits from it 2008-02-05 embed it into a bigger gnome app, add more buttons, and change the __init__() 2008-01-01 class to visualize the results from QualityControl.py Method...
7b402496aae81665e6a915b5021b94d56e034c9d
<|skeleton|> class QCVisualize: """2009-3-24 trunk moved to indepedent DataMatrixGuiXYProbe.py and inherits from it 2008-02-05 embed it into a bigger gnome app, add more buttons, and change the __init__() 2008-01-01 class to visualize the results from QualityControl.py""" def __init__(self, id2NA_mismatch_rate...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class QCVisualize: """2009-3-24 trunk moved to indepedent DataMatrixGuiXYProbe.py and inherits from it 2008-02-05 embed it into a bigger gnome app, add more buttons, and change the __init__() 2008-01-01 class to visualize the results from QualityControl.py""" def __init__(self, id2NA_mismatch_rate, plot_title=...
the_stack_v2_python_sparse
pymodule/trunk/QCVisualize.py
polyactis/repos
train
1
8f08a3634154cb2bc8caada8c7b81685d16f84bf
[ "provinces = 0\nvisited = set()\nq = deque()\nfor left in range(len(is_connected)):\n if left not in visited:\n q.append(left)\n while q:\n curr = q.popleft()\n if curr not in visited:\n visited.add(curr)\n for neighbor in range(len(is_connected)):\n ...
<|body_start_0|> provinces = 0 visited = set() q = deque() for left in range(len(is_connected)): if left not in visited: q.append(left) while q: curr = q.popleft() if curr not in visited: ...
City
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class City: def number_of_provinces_bfs(self, is_connected: List[List[int]]) -> int: """Approach: BFS Time Complexity: O(N^2) Space Complexity: O(N) :param is_connected: :return:""" <|body_0|> def number_of_provinces_dfs(self, is_connected: List[List[int]]) -> int: """Appr...
stack_v2_sparse_classes_10k_train_003229
2,443
no_license
[ { "docstring": "Approach: BFS Time Complexity: O(N^2) Space Complexity: O(N) :param is_connected: :return:", "name": "number_of_provinces_bfs", "signature": "def number_of_provinces_bfs(self, is_connected: List[List[int]]) -> int" }, { "docstring": "Approach: DFS Time Complexity: O(N^2) Space Co...
2
null
Implement the Python class `City` described below. Class description: Implement the City class. Method signatures and docstrings: - def number_of_provinces_bfs(self, is_connected: List[List[int]]) -> int: Approach: BFS Time Complexity: O(N^2) Space Complexity: O(N) :param is_connected: :return: - def number_of_provin...
Implement the Python class `City` described below. Class description: Implement the City class. Method signatures and docstrings: - def number_of_provinces_bfs(self, is_connected: List[List[int]]) -> int: Approach: BFS Time Complexity: O(N^2) Space Complexity: O(N) :param is_connected: :return: - def number_of_provin...
65cc78b5afa0db064f9fe8f06597e3e120f7363d
<|skeleton|> class City: def number_of_provinces_bfs(self, is_connected: List[List[int]]) -> int: """Approach: BFS Time Complexity: O(N^2) Space Complexity: O(N) :param is_connected: :return:""" <|body_0|> def number_of_provinces_dfs(self, is_connected: List[List[int]]) -> int: """Appr...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class City: def number_of_provinces_bfs(self, is_connected: List[List[int]]) -> int: """Approach: BFS Time Complexity: O(N^2) Space Complexity: O(N) :param is_connected: :return:""" provinces = 0 visited = set() q = deque() for left in range(len(is_connected)): if...
the_stack_v2_python_sparse
goldman_sachs/number_of_provinces.py
Shiv2157k/leet_code
train
1
2d9b5a2a11b4b00364cf6b322e06001133bc0c98
[ "qe = Queue.Queue(maxsize=0)\nqe.put(root)\ndata = []\nwhile not qe.empty():\n node = qe.get()\n if node:\n data.append(str(node.val))\n qe.put(node.left)\n qe.put(node.right)\n else:\n data.append('null')\nreturn ' '.join(data)", "myiter = iter(data.split())\nqe = Queue.Queue...
<|body_start_0|> qe = Queue.Queue(maxsize=0) qe.put(root) data = [] while not qe.empty(): node = qe.get() if node: data.append(str(node.val)) qe.put(node.left) qe.put(node.right) else: dat...
Codec
[ "MIT" ]
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_10k_train_003230
1,528
permissive
[ { "docstring": "Encodes a tree to a single string. :type root: TreeNode :rtype: str", "name": "serialize", "signature": "def serialize(self, root)" }, { "docstring": "Decodes your encoded data to tree. :type data: str :rtype: TreeNode", "name": "deserialize", "signature": "def deserializ...
2
stack_v2_sparse_classes_30k_train_001505
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:...
c8bf33af30569177c5276ffcd72a8d93ba4c402a
<|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_10k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root): """Encodes a tree to a single string. :type root: TreeNode :rtype: str""" qe = Queue.Queue(maxsize=0) qe.put(root) data = [] while not qe.empty(): node = qe.get() if node: data.append(str(node.val...
the_stack_v2_python_sparse
201-300/291-300/297-serializeAndDeserializeBinaryTree/serializeAndDeserializeBinaryTree.py
xuychen/Leetcode
train
0
f8bcf9c38da426f45171d975250c44d716df0c5f
[ "super().__init__()\nself.label_arr = np.asarray(['NULL'] + classes)\npath_to_ckpt = inference_graph\nself.detection_graph = tf.Graph()\nwith self.detection_graph.as_default():\n od_graph_def = tf.GraphDef()\n with tf.gfile.GFile(path_to_ckpt, 'rb') as fid:\n serialized_graph = fid.read()\n od_g...
<|body_start_0|> super().__init__() self.label_arr = np.asarray(['NULL'] + classes) path_to_ckpt = inference_graph self.detection_graph = tf.Graph() with self.detection_graph.as_default(): od_graph_def = tf.GraphDef() with tf.gfile.GFile(path_to_ckpt, 'rb'...
TFDetector
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TFDetector: def __init__(self, classes, inference_graph='frozen_graph.pb'): """Initialize Detector Object""" <|body_0|> def predict(self, images_data, batch_size=10, min_confidence=0.7): """Predict results from list of images to list of boxes""" <|body_1|> <...
stack_v2_sparse_classes_10k_train_003231
2,196
permissive
[ { "docstring": "Initialize Detector Object", "name": "__init__", "signature": "def __init__(self, classes, inference_graph='frozen_graph.pb')" }, { "docstring": "Predict results from list of images to list of boxes", "name": "predict", "signature": "def predict(self, images_data, batch_s...
2
stack_v2_sparse_classes_30k_train_002781
Implement the Python class `TFDetector` described below. Class description: Implement the TFDetector class. Method signatures and docstrings: - def __init__(self, classes, inference_graph='frozen_graph.pb'): Initialize Detector Object - def predict(self, images_data, batch_size=10, min_confidence=0.7): Predict result...
Implement the Python class `TFDetector` described below. Class description: Implement the TFDetector class. Method signatures and docstrings: - def __init__(self, classes, inference_graph='frozen_graph.pb'): Initialize Detector Object - def predict(self, images_data, batch_size=10, min_confidence=0.7): Predict result...
7a20d4350c630017d11f964a4996dce8b9a8251b
<|skeleton|> class TFDetector: def __init__(self, classes, inference_graph='frozen_graph.pb'): """Initialize Detector Object""" <|body_0|> def predict(self, images_data, batch_size=10, min_confidence=0.7): """Predict results from list of images to list of boxes""" <|body_1|> <...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TFDetector: def __init__(self, classes, inference_graph='frozen_graph.pb'): """Initialize Detector Object""" super().__init__() self.label_arr = np.asarray(['NULL'] + classes) path_to_ckpt = inference_graph self.detection_graph = tf.Graph() with self.detection_g...
the_stack_v2_python_sparse
train/tf_detector.py
CatalystCode/active-learning-detect
train
5
f58c08ea38b41ddea754e06fbbbcca2488828904
[ "for k in list(orig_dict.keys()):\n if k not in keys_whitelist:\n del orig_dict[k]\nfor v in orig_dict.values():\n if isinstance(v, dict):\n self.delete_keys_from_dict(v, keys_whitelist)\nreturn orig_dict", "if not self.fields:\n raise ImproperlyConfigured('fields attribute must be specifie...
<|body_start_0|> for k in list(orig_dict.keys()): if k not in keys_whitelist: del orig_dict[k] for v in orig_dict.values(): if isinstance(v, dict): self.delete_keys_from_dict(v, keys_whitelist) return orig_dict <|end_body_0|> <|body_start_...
GenericCSVRenderer
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GenericCSVRenderer: def delete_keys_from_dict(self, orig_dict, keys_whitelist): """recursively delete keys which are not in whitelist from dict""" <|body_0|> def render(self, data, media_type=None, renderer_context=None, writer_opts=None): """extract the array from r...
stack_v2_sparse_classes_10k_train_003232
1,211
permissive
[ { "docstring": "recursively delete keys which are not in whitelist from dict", "name": "delete_keys_from_dict", "signature": "def delete_keys_from_dict(self, orig_dict, keys_whitelist)" }, { "docstring": "extract the array from results field & remove fields which were not specified in whitelist"...
2
stack_v2_sparse_classes_30k_train_004872
Implement the Python class `GenericCSVRenderer` described below. Class description: Implement the GenericCSVRenderer class. Method signatures and docstrings: - def delete_keys_from_dict(self, orig_dict, keys_whitelist): recursively delete keys which are not in whitelist from dict - def render(self, data, media_type=N...
Implement the Python class `GenericCSVRenderer` described below. Class description: Implement the GenericCSVRenderer class. Method signatures and docstrings: - def delete_keys_from_dict(self, orig_dict, keys_whitelist): recursively delete keys which are not in whitelist from dict - def render(self, data, media_type=N...
cf9ab30c67523062e1a3e0b8ff1b7b5ba4c8586f
<|skeleton|> class GenericCSVRenderer: def delete_keys_from_dict(self, orig_dict, keys_whitelist): """recursively delete keys which are not in whitelist from dict""" <|body_0|> def render(self, data, media_type=None, renderer_context=None, writer_opts=None): """extract the array from r...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class GenericCSVRenderer: def delete_keys_from_dict(self, orig_dict, keys_whitelist): """recursively delete keys which are not in whitelist from dict""" for k in list(orig_dict.keys()): if k not in keys_whitelist: del orig_dict[k] for v in orig_dict.values(): ...
the_stack_v2_python_sparse
server/server/utils/renderers.py
jeremyhakoune/connective
train
0
ee310356b759caa9cd866ebc52212b8533a0dc33
[ "if not parse_node:\n raise TypeError('parse_node cannot be null.')\nreturn Reminder()", "from .date_time_time_zone import DateTimeTimeZone\nfrom .location import Location\nfrom .date_time_time_zone import DateTimeTimeZone\nfrom .location import Location\nfields: Dict[str, Callable[[Any], None]] = {'changeKey'...
<|body_start_0|> if not parse_node: raise TypeError('parse_node cannot be null.') return Reminder() <|end_body_0|> <|body_start_1|> from .date_time_time_zone import DateTimeTimeZone from .location import Location from .date_time_time_zone import DateTimeTimeZone ...
Reminder
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Reminder: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Reminder: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: Reminder...
stack_v2_sparse_classes_10k_train_003233
4,994
permissive
[ { "docstring": "Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: Reminder", "name": "create_from_discriminator_value", "signature": "def create_from_discriminator_value(pars...
3
stack_v2_sparse_classes_30k_train_006280
Implement the Python class `Reminder` described below. Class description: Implement the Reminder class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Reminder: Creates a new instance of the appropriate class based on discriminator value Args: parse_no...
Implement the Python class `Reminder` described below. Class description: Implement the Reminder class. Method signatures and docstrings: - def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Reminder: Creates a new instance of the appropriate class based on discriminator value Args: parse_no...
27de7ccbe688d7614b2f6bde0fdbcda4bc5cc949
<|skeleton|> class Reminder: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Reminder: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: Reminder...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Reminder: def create_from_discriminator_value(parse_node: Optional[ParseNode]=None) -> Reminder: """Creates a new instance of the appropriate class based on discriminator value Args: parse_node: The parse node to use to read the discriminator value and create the object Returns: Reminder""" if...
the_stack_v2_python_sparse
msgraph/generated/models/reminder.py
microsoftgraph/msgraph-sdk-python
train
135
89aff1c7f830d2af2833704660c9d395c210f07c
[ "super().__init__()\nself.yaml_file_path = yaml_file_path\nself.key = key\nself.expected = expected", "base_message = self.base_message.format(filename=self.yaml_file_path)\nerror_message = ERROR_MESSAGE.format(key=self.key, expected=self.expected)\nreturn base_message + error_message" ]
<|body_start_0|> super().__init__() self.yaml_file_path = yaml_file_path self.key = key self.expected = expected <|end_body_0|> <|body_start_1|> base_message = self.base_message.format(filename=self.yaml_file_path) error_message = ERROR_MESSAGE.format(key=self.key, expec...
Custom error for invalid config file value.
InvalidYAMLValueError
[ "CC-BY-NC-SA-4.0", "BSD-3-Clause", "CC0-1.0", "ISC", "Unlicense", "LicenseRef-scancode-secret-labs-2011", "WTFPL", "Apache-2.0", "LGPL-3.0-only", "MIT", "CC-BY-SA-4.0", "LicenseRef-scancode-public-domain", "CC-BY-NC-2.5", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-unknown...
stack_v2_sparse_python_classes_v1
<|skeleton|> class InvalidYAMLValueError: """Custom error for invalid config file value.""" def __init__(self, yaml_file_path, key, expected): """Create error for invalid config file value.""" <|body_0|> def __str__(self): """Override default error string. Returns: Error message fo...
stack_v2_sparse_classes_10k_train_003234
859
permissive
[ { "docstring": "Create error for invalid config file value.", "name": "__init__", "signature": "def __init__(self, yaml_file_path, key, expected)" }, { "docstring": "Override default error string. Returns: Error message for invalid config file value.", "name": "__str__", "signature": "de...
2
stack_v2_sparse_classes_30k_train_000773
Implement the Python class `InvalidYAMLValueError` described below. Class description: Custom error for invalid config file value. Method signatures and docstrings: - def __init__(self, yaml_file_path, key, expected): Create error for invalid config file value. - def __str__(self): Override default error string. Retu...
Implement the Python class `InvalidYAMLValueError` described below. Class description: Custom error for invalid config file value. Method signatures and docstrings: - def __init__(self, yaml_file_path, key, expected): Create error for invalid config file value. - def __str__(self): Override default error string. Retu...
ea3281ec6f4d17538f6d3cf6f88d74fa54581b34
<|skeleton|> class InvalidYAMLValueError: """Custom error for invalid config file value.""" def __init__(self, yaml_file_path, key, expected): """Create error for invalid config file value.""" <|body_0|> def __str__(self): """Override default error string. Returns: Error message fo...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class InvalidYAMLValueError: """Custom error for invalid config file value.""" def __init__(self, yaml_file_path, key, expected): """Create error for invalid config file value.""" super().__init__() self.yaml_file_path = yaml_file_path self.key = key self.expected = expe...
the_stack_v2_python_sparse
csfieldguide/utils/errors/InvalidYAMLValueError.py
uccser/cs-field-guide
train
364
be76ad3d413e402df7e6ac137d0d26a444ef98f9
[ "super().__init__(max_number=max_number, min_number=min_number, seed=seed)\nself.stamp_size = stamp_size\nself.max_shift = max_shift if max_shift is not None else self.stamp_size / 10.0\nself.min_mag, self.max_mag = (min_mag, max_mag)\nself.mag_name = mag_name", "if self.mag_name not in table.colnames:\n raise...
<|body_start_0|> super().__init__(max_number=max_number, min_number=min_number, seed=seed) self.stamp_size = stamp_size self.max_shift = max_shift if max_shift is not None else self.stamp_size / 10.0 self.min_mag, self.max_mag = (min_mag, max_mag) self.mag_name = mag_name <|end_b...
Default sampling function used for producing blend catalogs.
DefaultSampling
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DefaultSampling: """Default sampling function used for producing blend catalogs.""" def __init__(self, max_number: int=2, min_number: int=1, stamp_size: float=24.0, max_shift: Optional[float]=None, seed: int=DEFAULT_SEED, max_mag: float=25.3, min_mag: float=-np.inf, mag_name: str='i_ab'): ...
stack_v2_sparse_classes_10k_train_003235
12,943
permissive
[ { "docstring": "Initializes default sampling function. Args: max_number: Defined in parent class min_number: Defined in parent class stamp_size: Size of the desired stamp. max_shift: Magnitude of maximum value of shift. If None then it is set as one-tenth the stamp size. (in arcseconds) seed: Seed to initialize...
2
stack_v2_sparse_classes_30k_train_005306
Implement the Python class `DefaultSampling` described below. Class description: Default sampling function used for producing blend catalogs. Method signatures and docstrings: - def __init__(self, max_number: int=2, min_number: int=1, stamp_size: float=24.0, max_shift: Optional[float]=None, seed: int=DEFAULT_SEED, ma...
Implement the Python class `DefaultSampling` described below. Class description: Default sampling function used for producing blend catalogs. Method signatures and docstrings: - def __init__(self, max_number: int=2, min_number: int=1, stamp_size: float=24.0, max_shift: Optional[float]=None, seed: int=DEFAULT_SEED, ma...
f5b716a373f130238100db8980aa0d282822983a
<|skeleton|> class DefaultSampling: """Default sampling function used for producing blend catalogs.""" def __init__(self, max_number: int=2, min_number: int=1, stamp_size: float=24.0, max_shift: Optional[float]=None, seed: int=DEFAULT_SEED, max_mag: float=25.3, min_mag: float=-np.inf, mag_name: str='i_ab'): ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DefaultSampling: """Default sampling function used for producing blend catalogs.""" def __init__(self, max_number: int=2, min_number: int=1, stamp_size: float=24.0, max_shift: Optional[float]=None, seed: int=DEFAULT_SEED, max_mag: float=25.3, min_mag: float=-np.inf, mag_name: str='i_ab'): """Init...
the_stack_v2_python_sparse
btk/sampling_functions.py
LSSTDESC/BlendingToolKit
train
22
87ba21ab4977176f06a9a27646d4a9ccd241fdf8
[ "layer = QgsMapLayerRegistry.instance().mapLayersByName(layerName)[0]\nlayer.setCustomProperty('labeling', 'pal')\nlayer.setCustomProperty('labeling/enabled', 'True')\nlayer.setCustomProperty('labeling/fieldName', fieldName)\nlayer.setCustomProperty('labeling/fontFamily', fontFamily)\nlayer.setCustomProperty('label...
<|body_start_0|> layer = QgsMapLayerRegistry.instance().mapLayersByName(layerName)[0] layer.setCustomProperty('labeling', 'pal') layer.setCustomProperty('labeling/enabled', 'True') layer.setCustomProperty('labeling/fieldName', fieldName) layer.setCustomProperty('labeling/fontFami...
Class that deals with vector layer labels
Label
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Label: """Class that deals with vector layer labels""" def nameLabel(self, layerName, fieldName, fontFamily='Arial', fontSize=8, fontWeight=50, fontItalic=False, fontUnderline=False, fontStrikeout=False): """Set label and format based on the parameters passed""" <|body_0|> ...
stack_v2_sparse_classes_10k_train_003236
2,279
no_license
[ { "docstring": "Set label and format based on the parameters passed", "name": "nameLabel", "signature": "def nameLabel(self, layerName, fieldName, fontFamily='Arial', fontSize=8, fontWeight=50, fontItalic=False, fontUnderline=False, fontStrikeout=False)" }, { "docstring": "Show font dialog and p...
3
stack_v2_sparse_classes_30k_train_006215
Implement the Python class `Label` described below. Class description: Class that deals with vector layer labels Method signatures and docstrings: - def nameLabel(self, layerName, fieldName, fontFamily='Arial', fontSize=8, fontWeight=50, fontItalic=False, fontUnderline=False, fontStrikeout=False): Set label and forma...
Implement the Python class `Label` described below. Class description: Class that deals with vector layer labels Method signatures and docstrings: - def nameLabel(self, layerName, fieldName, fontFamily='Arial', fontSize=8, fontWeight=50, fontItalic=False, fontUnderline=False, fontStrikeout=False): Set label and forma...
ba1fd3a139580e00eca4aa87ad8e49f46718d58a
<|skeleton|> class Label: """Class that deals with vector layer labels""" def nameLabel(self, layerName, fieldName, fontFamily='Arial', fontSize=8, fontWeight=50, fontItalic=False, fontUnderline=False, fontStrikeout=False): """Set label and format based on the parameters passed""" <|body_0|> ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Label: """Class that deals with vector layer labels""" def nameLabel(self, layerName, fieldName, fontFamily='Arial', fontSize=8, fontWeight=50, fontItalic=False, fontUnderline=False, fontStrikeout=False): """Set label and format based on the parameters passed""" layer = QgsMapLayerRegistr...
the_stack_v2_python_sparse
labels.py
Charlotteg/QGISforSchools
train
1
605f20002a174659c4cf9f6defb33d98d55a291e
[ "super().__init__(order=CallbackOrder.external, node=CallbackNode.all)\nself.best_score = None\nself.metric = metric\nself.patience = patience\nself.num_bad_epochs = 0\nself.is_better = None\nif minimize:\n self.is_better = lambda score, best: score <= best - min_delta\nelse:\n self.is_better = lambda score, ...
<|body_start_0|> super().__init__(order=CallbackOrder.external, node=CallbackNode.all) self.best_score = None self.metric = metric self.patience = patience self.num_bad_epochs = 0 self.is_better = None if minimize: self.is_better = lambda score, best: ...
Early exit based on metric. Minimal working example (Notebook API): .. code-block:: python import torch from torch.utils.data import DataLoader, TensorDataset from catalyst import dl # data num_samples, num_features = int(1e4), int(1e1) X, y = torch.rand(num_samples, num_features), torch.rand(num_samples) dataset = Ten...
EarlyStoppingCallback
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EarlyStoppingCallback: """Early exit based on metric. Minimal working example (Notebook API): .. code-block:: python import torch from torch.utils.data import DataLoader, TensorDataset from catalyst import dl # data num_samples, num_features = int(1e4), int(1e1) X, y = torch.rand(num_samples, num...
stack_v2_sparse_classes_10k_train_003237
6,187
permissive
[ { "docstring": "Args: patience: number of epochs with no improvement after which training will be stopped. metric: metric name to use for early stopping, default is ``\"loss\"``. minimize: if ``True`` then expected that metric should decrease and early stopping will be performed only when metric stops decreasin...
2
stack_v2_sparse_classes_30k_train_006277
Implement the Python class `EarlyStoppingCallback` described below. Class description: Early exit based on metric. Minimal working example (Notebook API): .. code-block:: python import torch from torch.utils.data import DataLoader, TensorDataset from catalyst import dl # data num_samples, num_features = int(1e4), int(...
Implement the Python class `EarlyStoppingCallback` described below. Class description: Early exit based on metric. Minimal working example (Notebook API): .. code-block:: python import torch from torch.utils.data import DataLoader, TensorDataset from catalyst import dl # data num_samples, num_features = int(1e4), int(...
8ce39fc31635eabc348b055a2df8ec8bc5700dce
<|skeleton|> class EarlyStoppingCallback: """Early exit based on metric. Minimal working example (Notebook API): .. code-block:: python import torch from torch.utils.data import DataLoader, TensorDataset from catalyst import dl # data num_samples, num_features = int(1e4), int(1e1) X, y = torch.rand(num_samples, num...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class EarlyStoppingCallback: """Early exit based on metric. Minimal working example (Notebook API): .. code-block:: python import torch from torch.utils.data import DataLoader, TensorDataset from catalyst import dl # data num_samples, num_features = int(1e4), int(1e1) X, y = torch.rand(num_samples, num_features), t...
the_stack_v2_python_sparse
catalyst/callbacks/early_stop.py
418sec/catalyst
train
0
68e64a0b50e48ffba72ec442b8031f578f210cea
[ "params = dict(((key, val) for key, val in request.QUERY_PARAMS.iteritems()))\nparams['image_id'] = image_id\nparams['tag_group_id'] = tag_group_id\nparams['tag_id'] = tag_id\nform = MultiGetForm(params)\nif not form.is_valid():\n raise BadRequestException()\nreturn Response(form.submit(request))", "params = d...
<|body_start_0|> params = dict(((key, val) for key, val in request.QUERY_PARAMS.iteritems())) params['image_id'] = image_id params['tag_group_id'] = tag_group_id params['tag_id'] = tag_id form = MultiGetForm(params) if not form.is_valid(): raise BadRequestExce...
Class for rendering the view for creating GeneLinks and searching through the GeneLinks.
GeneLinkList
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GeneLinkList: """Class for rendering the view for creating GeneLinks and searching through the GeneLinks.""" def get(self, request, image_id, tag_group_id, tag_id): """Method for getting multiple GeneLinks either through search or general listing.""" <|body_0|> def post(...
stack_v2_sparse_classes_10k_train_003238
2,768
no_license
[ { "docstring": "Method for getting multiple GeneLinks either through search or general listing.", "name": "get", "signature": "def get(self, request, image_id, tag_group_id, tag_id)" }, { "docstring": "Method for creating a new GeneLink.", "name": "post", "signature": "def post(self, req...
2
stack_v2_sparse_classes_30k_train_006137
Implement the Python class `GeneLinkList` described below. Class description: Class for rendering the view for creating GeneLinks and searching through the GeneLinks. Method signatures and docstrings: - def get(self, request, image_id, tag_group_id, tag_id): Method for getting multiple GeneLinks either through search...
Implement the Python class `GeneLinkList` described below. Class description: Class for rendering the view for creating GeneLinks and searching through the GeneLinks. Method signatures and docstrings: - def get(self, request, image_id, tag_group_id, tag_id): Method for getting multiple GeneLinks either through search...
22c1ce3c5a8e4ed99c2f014672d60ad3c5a4003c
<|skeleton|> class GeneLinkList: """Class for rendering the view for creating GeneLinks and searching through the GeneLinks.""" def get(self, request, image_id, tag_group_id, tag_id): """Method for getting multiple GeneLinks either through search or general listing.""" <|body_0|> def post(...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class GeneLinkList: """Class for rendering the view for creating GeneLinks and searching through the GeneLinks.""" def get(self, request, image_id, tag_group_id, tag_id): """Method for getting multiple GeneLinks either through search or general listing.""" params = dict(((key, val) for key, val...
the_stack_v2_python_sparse
biodig/rest/v2/GeneLinks/views.py
asmariyaz23/BioDIG
train
0
5c6d1ecab9c2806da2262d58ed9ffa15499e9708
[ "super().__init__()\nself.args = quant_arc_interface.args\nself.q_params = nn.Parameter(self.args.q_delta * torch.randn(self.args.q_depth * self.args.n_qubits))\nself.qai = quant_arc_interface", "q_in = torch.tanh(input_features) * np.pi / 2.0\nq_in = q_in.to(self.args.device)\nq_out = torch.Tensor(0, self.qai.se...
<|body_start_0|> super().__init__() self.args = quant_arc_interface.args self.q_params = nn.Parameter(self.args.q_delta * torch.randn(self.args.q_depth * self.args.n_qubits)) self.qai = quant_arc_interface <|end_body_0|> <|body_start_1|> q_in = torch.tanh(input_features) * np.pi...
Torch module implementing the *dressed* quantum net.
QNet_1
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class QNet_1: """Torch module implementing the *dressed* quantum net.""" def __init__(self, quant_arc_interface): """Definition of the *dressed* layout.""" <|body_0|> def forward(self, input_features): """Defining how tensors are supposed to move through the *dressed* ...
stack_v2_sparse_classes_10k_train_003239
2,951
permissive
[ { "docstring": "Definition of the *dressed* layout.", "name": "__init__", "signature": "def __init__(self, quant_arc_interface)" }, { "docstring": "Defining how tensors are supposed to move through the *dressed* quantum net.", "name": "forward", "signature": "def forward(self, input_feat...
2
stack_v2_sparse_classes_30k_train_005501
Implement the Python class `QNet_1` described below. Class description: Torch module implementing the *dressed* quantum net. Method signatures and docstrings: - def __init__(self, quant_arc_interface): Definition of the *dressed* layout. - def forward(self, input_features): Defining how tensors are supposed to move t...
Implement the Python class `QNet_1` described below. Class description: Torch module implementing the *dressed* quantum net. Method signatures and docstrings: - def __init__(self, quant_arc_interface): Definition of the *dressed* layout. - def forward(self, input_features): Defining how tensors are supposed to move t...
8126691b43bddc2b1a96f73ab35d04d1af200d7a
<|skeleton|> class QNet_1: """Torch module implementing the *dressed* quantum net.""" def __init__(self, quant_arc_interface): """Definition of the *dressed* layout.""" <|body_0|> def forward(self, input_features): """Defining how tensors are supposed to move through the *dressed* ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class QNet_1: """Torch module implementing the *dressed* quantum net.""" def __init__(self, quant_arc_interface): """Definition of the *dressed* layout.""" super().__init__() self.args = quant_arc_interface.args self.q_params = nn.Parameter(self.args.q_delta * torch.randn(self.a...
the_stack_v2_python_sparse
model/dvqc_layers.py
zzh237/quanthmc
train
0
2723fb1ad8050a2b1f8a90964f12661e0e0ca92a
[ "super(EncoderBlock, self).__init__()\nself.mha = MultiHeadAttention(dm, h)\nself.dense_hidden = tf.keras.layers.Dense(units=hidden, activation='relu')\nself.dense_output = tf.keras.layers.Dense(units=dm)\nself.layernorm1 = tf.keras.layers.LayerNormalization(epsilon=1e-06)\nself.layernorm2 = tf.keras.layers.LayerNo...
<|body_start_0|> super(EncoderBlock, self).__init__() self.mha = MultiHeadAttention(dm, h) self.dense_hidden = tf.keras.layers.Dense(units=hidden, activation='relu') self.dense_output = tf.keras.layers.Dense(units=dm) self.layernorm1 = tf.keras.layers.LayerNormalization(epsilon=1...
Class MultiHeadAttention
EncoderBlock
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class EncoderBlock: """Class MultiHeadAttention""" def __init__(self, dm, h, hidden, drop_rate=0.1): """Constructor Class constructor dm - the dimensionality of the model h - the number of heads hidden - the number of hidden units in the fully connected layer drop_rate - the dropout rate S...
stack_v2_sparse_classes_10k_train_003240
2,302
permissive
[ { "docstring": "Constructor Class constructor dm - the dimensionality of the model h - the number of heads hidden - the number of hidden units in the fully connected layer drop_rate - the dropout rate Sets the following public instance attributes: mha - a MultiHeadAttention layer dense_hidden - the hidden dense...
2
stack_v2_sparse_classes_30k_train_003766
Implement the Python class `EncoderBlock` described below. Class description: Class MultiHeadAttention Method signatures and docstrings: - def __init__(self, dm, h, hidden, drop_rate=0.1): Constructor Class constructor dm - the dimensionality of the model h - the number of heads hidden - the number of hidden units in...
Implement the Python class `EncoderBlock` described below. Class description: Class MultiHeadAttention Method signatures and docstrings: - def __init__(self, dm, h, hidden, drop_rate=0.1): Constructor Class constructor dm - the dimensionality of the model h - the number of heads hidden - the number of hidden units in...
eaf23423ec0f412f103f5931d6610fdd67bcc5be
<|skeleton|> class EncoderBlock: """Class MultiHeadAttention""" def __init__(self, dm, h, hidden, drop_rate=0.1): """Constructor Class constructor dm - the dimensionality of the model h - the number of heads hidden - the number of hidden units in the fully connected layer drop_rate - the dropout rate S...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class EncoderBlock: """Class MultiHeadAttention""" def __init__(self, dm, h, hidden, drop_rate=0.1): """Constructor Class constructor dm - the dimensionality of the model h - the number of heads hidden - the number of hidden units in the fully connected layer drop_rate - the dropout rate Sets the follo...
the_stack_v2_python_sparse
supervised_learning/0x11-attention/7-transformer_encoder_block.py
ledbagholberton/holbertonschool-machine_learning
train
1
b6a22bbc93ed7230e59269637a75b0a0a3282fae
[ "if mode == Mode.PLAYER:\n return True\nreturn False", "if mode == Mode.RANDOM_AI or mode == Mode.AI_WITHOUT_FLAGS or mode == Mode.AI_WITH_FLAGS or (mode == Mode.AI_WITH_FLAGS2):\n return True\nreturn False" ]
<|body_start_0|> if mode == Mode.PLAYER: return True return False <|end_body_0|> <|body_start_1|> if mode == Mode.RANDOM_AI or mode == Mode.AI_WITHOUT_FLAGS or mode == Mode.AI_WITH_FLAGS or (mode == Mode.AI_WITH_FLAGS2): return True return False <|end_body_1|>
Mode
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Mode: def is_player_mode(cls, mode): """Allow to know if a mode is a player mode or not. :mode: The mode. :return: True if the mode is a player mode, False otherwise.""" <|body_0|> def is_ai_mode(cls, mode): """Allow to know if a mode is an artificial intelligence mo...
stack_v2_sparse_classes_10k_train_003241
5,674
no_license
[ { "docstring": "Allow to know if a mode is a player mode or not. :mode: The mode. :return: True if the mode is a player mode, False otherwise.", "name": "is_player_mode", "signature": "def is_player_mode(cls, mode)" }, { "docstring": "Allow to know if a mode is an artificial intelligence mode or...
2
stack_v2_sparse_classes_30k_train_005877
Implement the Python class `Mode` described below. Class description: Implement the Mode class. Method signatures and docstrings: - def is_player_mode(cls, mode): Allow to know if a mode is a player mode or not. :mode: The mode. :return: True if the mode is a player mode, False otherwise. - def is_ai_mode(cls, mode):...
Implement the Python class `Mode` described below. Class description: Implement the Mode class. Method signatures and docstrings: - def is_player_mode(cls, mode): Allow to know if a mode is a player mode or not. :mode: The mode. :return: True if the mode is a player mode, False otherwise. - def is_ai_mode(cls, mode):...
e4601fbdd9f7cfdef6774f26c2850ec8cf3c562e
<|skeleton|> class Mode: def is_player_mode(cls, mode): """Allow to know if a mode is a player mode or not. :mode: The mode. :return: True if the mode is a player mode, False otherwise.""" <|body_0|> def is_ai_mode(cls, mode): """Allow to know if a mode is an artificial intelligence mo...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Mode: def is_player_mode(cls, mode): """Allow to know if a mode is a player mode or not. :mode: The mode. :return: True if the mode is a player mode, False otherwise.""" if mode == Mode.PLAYER: return True return False def is_ai_mode(cls, mode): """Allow to kno...
the_stack_v2_python_sparse
source/main.py
roundsace/Minesweeper_deep_learning
train
0
311a746fe3d5b3743c6fa746747ff0b0b40aa907
[ "self.wifi_mac = wifi_mac\nself.id = id\nself.serial = serial\nself.device_fields = device_fields", "if dictionary is None:\n return None\ndevice_fields = meraki_sdk.models.device_fields_model.DeviceFieldsModel.from_dictionary(dictionary.get('deviceFields')) if dictionary.get('deviceFields') else None\nwifi_ma...
<|body_start_0|> self.wifi_mac = wifi_mac self.id = id self.serial = serial self.device_fields = device_fields <|end_body_0|> <|body_start_1|> if dictionary is None: return None device_fields = meraki_sdk.models.device_fields_model.DeviceFieldsModel.from_dict...
Implementation of the 'updateNetworkSmDeviceFields' model. TODO: type model description here. Attributes: wifi_mac (string): The wifiMac of the device to be modified. id (string): The id of the device to be modified. serial (string): The serial of the device to be modified. device_fields (DeviceFieldsModel): The new fi...
UpdateNetworkSmDeviceFieldsModel
[ "MIT", "Python-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class UpdateNetworkSmDeviceFieldsModel: """Implementation of the 'updateNetworkSmDeviceFields' model. TODO: type model description here. Attributes: wifi_mac (string): The wifiMac of the device to be modified. id (string): The id of the device to be modified. serial (string): The serial of the device t...
stack_v2_sparse_classes_10k_train_003242
2,396
permissive
[ { "docstring": "Constructor for the UpdateNetworkSmDeviceFieldsModel class", "name": "__init__", "signature": "def __init__(self, device_fields=None, wifi_mac=None, id=None, serial=None)" }, { "docstring": "Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dict...
2
null
Implement the Python class `UpdateNetworkSmDeviceFieldsModel` described below. Class description: Implementation of the 'updateNetworkSmDeviceFields' model. TODO: type model description here. Attributes: wifi_mac (string): The wifiMac of the device to be modified. id (string): The id of the device to be modified. seri...
Implement the Python class `UpdateNetworkSmDeviceFieldsModel` described below. Class description: Implementation of the 'updateNetworkSmDeviceFields' model. TODO: type model description here. Attributes: wifi_mac (string): The wifiMac of the device to be modified. id (string): The id of the device to be modified. seri...
9894089eb013318243ae48869cc5130eb37f80c0
<|skeleton|> class UpdateNetworkSmDeviceFieldsModel: """Implementation of the 'updateNetworkSmDeviceFields' model. TODO: type model description here. Attributes: wifi_mac (string): The wifiMac of the device to be modified. id (string): The id of the device to be modified. serial (string): The serial of the device t...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class UpdateNetworkSmDeviceFieldsModel: """Implementation of the 'updateNetworkSmDeviceFields' model. TODO: type model description here. Attributes: wifi_mac (string): The wifiMac of the device to be modified. id (string): The id of the device to be modified. serial (string): The serial of the device to be modified...
the_stack_v2_python_sparse
meraki_sdk/models/update_network_sm_device_fields_model.py
RaulCatalano/meraki-python-sdk
train
1
d9ef052d16d7b36802860900ca45255b0f81bc5b
[ "values = np.random.choice(trade_rets, scenarios_length * num_of_scenarios)\nvalues = np.reshape(values, (scenarios_length, num_of_scenarios))\nreturn SimpleReturnsDataFrame(values)", "assert 0.0 <= time_in_the_market <= 1.0, 'time_in_the_market should belong to the [0.0, 1.0] range'\ndates_index = date_range(sta...
<|body_start_0|> values = np.random.choice(trade_rets, scenarios_length * num_of_scenarios) values = np.reshape(values, (scenarios_length, num_of_scenarios)) return SimpleReturnsDataFrame(values) <|end_body_0|> <|body_start_1|> assert 0.0 <= time_in_the_market <= 1.0, 'time_in_the_marke...
Class used for generating different scenarios for Trades.
ScenariosGenerator
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ScenariosGenerator: """Class used for generating different scenarios for Trades.""" def make_scenarios(self, trade_rets: Sequence[float], scenarios_length: int=100, num_of_scenarios: int=10000) -> SimpleReturnsDataFrame: """Utility function to generate different trades scenarios, whe...
stack_v2_sparse_classes_10k_train_003243
7,119
permissive
[ { "docstring": "Utility function to generate different trades scenarios, where each scenario is a series of returns for a given investment strategy. The scenarios of a given length are created by randomly choosing (with replacement) returns from the original sequence of a Trade's returns. The result is the Simp...
3
stack_v2_sparse_classes_30k_train_003983
Implement the Python class `ScenariosGenerator` described below. Class description: Class used for generating different scenarios for Trades. Method signatures and docstrings: - def make_scenarios(self, trade_rets: Sequence[float], scenarios_length: int=100, num_of_scenarios: int=10000) -> SimpleReturnsDataFrame: Uti...
Implement the Python class `ScenariosGenerator` described below. Class description: Class used for generating different scenarios for Trades. Method signatures and docstrings: - def make_scenarios(self, trade_rets: Sequence[float], scenarios_length: int=100, num_of_scenarios: int=10000) -> SimpleReturnsDataFrame: Uti...
f707e51bc2ff45f6e46dcdd24d59d83ce7dc4f94
<|skeleton|> class ScenariosGenerator: """Class used for generating different scenarios for Trades.""" def make_scenarios(self, trade_rets: Sequence[float], scenarios_length: int=100, num_of_scenarios: int=10000) -> SimpleReturnsDataFrame: """Utility function to generate different trades scenarios, whe...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ScenariosGenerator: """Class used for generating different scenarios for Trades.""" def make_scenarios(self, trade_rets: Sequence[float], scenarios_length: int=100, num_of_scenarios: int=10000) -> SimpleReturnsDataFrame: """Utility function to generate different trades scenarios, where each scena...
the_stack_v2_python_sparse
qf_lib/backtesting/fast_alpha_model_tester/scenarios_generator.py
quarkfin/qf-lib
train
379
3ff7e70aa485703fae7a45994d389a1748ee8250
[ "ret = []\n\ndef preorder(node):\n if node:\n ret.append(str(node.val))\n preorder(node.left)\n preorder(node.right)\npreorder(root)\nreturn ' '.join(ret)", "tree = collections.deque(map(int, data.split()))\n\ndef construct(lower, upper):\n if tree and lower <= tree[0] <= upper:\n ...
<|body_start_0|> ret = [] def preorder(node): if node: ret.append(str(node.val)) preorder(node.left) preorder(node.right) preorder(root) return ' '.join(ret) <|end_body_0|> <|body_start_1|> tree = collections.deque(map...
Codec
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" <|body_0|> def deserialize(self, data: str) -> TreeNode: """Decodes your encoded data to tree.""" <|body_1|> <|end_skeleton|> <|body_start_0|> ret = [] ...
stack_v2_sparse_classes_10k_train_003244
1,354
permissive
[ { "docstring": "Encodes a tree to a single string.", "name": "serialize", "signature": "def serialize(self, root: TreeNode) -> str" }, { "docstring": "Decodes your encoded data to tree.", "name": "deserialize", "signature": "def deserialize(self, data: str) -> TreeNode" } ]
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string. - def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree.
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def serialize(self, root: TreeNode) -> str: Encodes a tree to a single string. - def deserialize(self, data: str) -> TreeNode: Decodes your encoded data to tree. <|skeleton|> class Co...
2419a7d720bea1fd6ff3b75c38342a0ace18b205
<|skeleton|> class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" <|body_0|> def deserialize(self, data: str) -> TreeNode: """Decodes your encoded data to tree.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Codec: def serialize(self, root: TreeNode) -> str: """Encodes a tree to a single string.""" ret = [] def preorder(node): if node: ret.append(str(node.val)) preorder(node.left) preorder(node.right) preorder(root) ...
the_stack_v2_python_sparse
LeetCode/0449. Serialize and Deserialize BST/solution.py
InnoFang/algo-set
train
23
2309190c4f5e0fa139b10ed7a0d76c461bd5a1a8
[ "self.sensor = Sensor('127.0.0.1', '1111')\nself.pump = Pump('127.0.0.1', '2222')\nself.decider = Decider(100, 0.05)\nself.controller = Controller(self.sensor, self.pump, self.decider)\nself.actions = {'PUMP_IN': self.pump.PUMP_IN, 'PUMP_OUT': self.pump.PUMP_OUT, 'PUMP_OFF': self.pump.PUMP_OFF}", "cur_height = 50...
<|body_start_0|> self.sensor = Sensor('127.0.0.1', '1111') self.pump = Pump('127.0.0.1', '2222') self.decider = Decider(100, 0.05) self.controller = Controller(self.sensor, self.pump, self.decider) self.actions = {'PUMP_IN': self.pump.PUMP_IN, 'PUMP_OUT': self.pump.PUMP_OUT, 'PUM...
Module tests for the water-regulation module
ModuleTests
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ModuleTests: """Module tests for the water-regulation module""" def setUp(self): """Create Dummy instance""" <|body_0|> def test_module(self): """Basic integration test for waterregulation module""" <|body_1|> <|end_skeleton|> <|body_start_0|> s...
stack_v2_sparse_classes_10k_train_003245
1,354
no_license
[ { "docstring": "Create Dummy instance", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "Basic integration test for waterregulation module", "name": "test_module", "signature": "def test_module(self)" } ]
2
null
Implement the Python class `ModuleTests` described below. Class description: Module tests for the water-regulation module Method signatures and docstrings: - def setUp(self): Create Dummy instance - def test_module(self): Basic integration test for waterregulation module
Implement the Python class `ModuleTests` described below. Class description: Module tests for the water-regulation module Method signatures and docstrings: - def setUp(self): Create Dummy instance - def test_module(self): Basic integration test for waterregulation module <|skeleton|> class ModuleTests: """Module...
b1fea0309b3495b3e1dc167d7029bc9e4b6f00f1
<|skeleton|> class ModuleTests: """Module tests for the water-regulation module""" def setUp(self): """Create Dummy instance""" <|body_0|> def test_module(self): """Basic integration test for waterregulation module""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ModuleTests: """Module tests for the water-regulation module""" def setUp(self): """Create Dummy instance""" self.sensor = Sensor('127.0.0.1', '1111') self.pump = Pump('127.0.0.1', '2222') self.decider = Decider(100, 0.05) self.controller = Controller(self.sensor, ...
the_stack_v2_python_sparse
students/tbrackney/Lesson6/water-regulation/waterregulation/integrationtest.py
UWPCE-PythonCert-ClassRepos/SP_Online_Course2_2018
train
4
7b3c781f4f856c73ed66f12062d410f8e51b69dc
[ "size = len(nums)\ndp = [1] * size\nfor x in range(size):\n for y in range(x):\n if nums[x] > nums[y]:\n dp[x] = max(dp[x], dp[y] + 1)\nreturn max(dp) if dp else 0", "size = len(nums)\nl = 0\ndp = []\nfor x in range(size):\n low, high = (0, len(dp) - 1)\n while low <= high:\n mid...
<|body_start_0|> size = len(nums) dp = [1] * size for x in range(size): for y in range(x): if nums[x] > nums[y]: dp[x] = max(dp[x], dp[y] + 1) return max(dp) if dp else 0 <|end_body_0|> <|body_start_1|> size = len(nums) l =...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def lengthOfLIS1(self, nums): """:type nums: List[int] :rtype: int 时间复杂度O(N^2) dp状态方程: dp[0] = 1 dp[i] = max(dp[i], dp[j]+biger(nums[i], nums[j])) 其中0 <= j < i, biger函数返回1/0""" <|body_0|> def lengthOfLIS(self, nums): """:type nums: List[int] :rtype: int 时间复...
stack_v2_sparse_classes_10k_train_003246
1,814
no_license
[ { "docstring": ":type nums: List[int] :rtype: int 时间复杂度O(N^2) dp状态方程: dp[0] = 1 dp[i] = max(dp[i], dp[j]+biger(nums[i], nums[j])) 其中0 <= j < i, biger函数返回1/0", "name": "lengthOfLIS1", "signature": "def lengthOfLIS1(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: int 时间复杂度O(NlogN) dp...
2
stack_v2_sparse_classes_30k_train_001161
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lengthOfLIS1(self, nums): :type nums: List[int] :rtype: int 时间复杂度O(N^2) dp状态方程: dp[0] = 1 dp[i] = max(dp[i], dp[j]+biger(nums[i], nums[j])) 其中0 <= j < i, biger函数返回1/0 - def l...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lengthOfLIS1(self, nums): :type nums: List[int] :rtype: int 时间复杂度O(N^2) dp状态方程: dp[0] = 1 dp[i] = max(dp[i], dp[j]+biger(nums[i], nums[j])) 其中0 <= j < i, biger函数返回1/0 - def l...
9687f8e743a8b6396fff192f22b5256d1025f86b
<|skeleton|> class Solution: def lengthOfLIS1(self, nums): """:type nums: List[int] :rtype: int 时间复杂度O(N^2) dp状态方程: dp[0] = 1 dp[i] = max(dp[i], dp[j]+biger(nums[i], nums[j])) 其中0 <= j < i, biger函数返回1/0""" <|body_0|> def lengthOfLIS(self, nums): """:type nums: List[int] :rtype: int 时间复...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def lengthOfLIS1(self, nums): """:type nums: List[int] :rtype: int 时间复杂度O(N^2) dp状态方程: dp[0] = 1 dp[i] = max(dp[i], dp[j]+biger(nums[i], nums[j])) 其中0 <= j < i, biger函数返回1/0""" size = len(nums) dp = [1] * size for x in range(size): for y in range(x): ...
the_stack_v2_python_sparse
2017/dp/Longest_Increasing_Subsequence.py
buhuipao/LeetCode
train
5
6cfc05d815b3101fc3193c8137ffc2066cbbd215
[ "if l1 or l2:\n if l1 is None:\n return l2\n if l2 is None:\n return l1\nhead = ListNode()\nnode = head\nwhile l1 or l2:\n if l1 and l2:\n if l1.val <= l2.val:\n node.next = l1\n l1 = l1.next\n else:\n node.next = l2\n l2 = l2.next\n ...
<|body_start_0|> if l1 or l2: if l1 is None: return l2 if l2 is None: return l1 head = ListNode() node = head while l1 or l2: if l1 and l2: if l1.val <= l2.val: node.next = l1 ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def mergeTwoLists(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_0|> def mergeKLists(self, lists): """:type lists: List[ListNode] :rtype: ListNode""" <|body_1|> <|end_skeleton|> <|body_start_0|> if l1 or...
stack_v2_sparse_classes_10k_train_003247
2,364
no_license
[ { "docstring": ":type l1: ListNode :type l2: ListNode :rtype: ListNode", "name": "mergeTwoLists", "signature": "def mergeTwoLists(self, l1, l2)" }, { "docstring": ":type lists: List[ListNode] :rtype: ListNode", "name": "mergeKLists", "signature": "def mergeKLists(self, lists)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeTwoLists(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode - def mergeKLists(self, lists): :type lists: List[ListNode] :rtype: ListNode
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mergeTwoLists(self, l1, l2): :type l1: ListNode :type l2: ListNode :rtype: ListNode - def mergeKLists(self, lists): :type lists: List[ListNode] :rtype: ListNode <|skeleton|>...
df7d2229c50aa5134d297cc5599f7df9e64780c1
<|skeleton|> class Solution: def mergeTwoLists(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" <|body_0|> def mergeKLists(self, lists): """:type lists: List[ListNode] :rtype: ListNode""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def mergeTwoLists(self, l1, l2): """:type l1: ListNode :type l2: ListNode :rtype: ListNode""" if l1 or l2: if l1 is None: return l2 if l2 is None: return l1 head = ListNode() node = head while l1 or l2: ...
the_stack_v2_python_sparse
23.合并k个升序链表.py
libowei1213/LeetCode
train
0
7ab4c02a258c75c71d36646af7990d9d92d6a655
[ "gtk.Fixed.__init__(self)\nself._lst_labels = [u'λ<sub>b</sub>:', u'π<sub>Q</sub>:', u'π<sub>E</sub>:']\nself._dtc_data_controller = controller\nself._hardware_id = kwargs['hardware_id']\nself._subcategory_id = kwargs['subcategory_id']\nself._lblModel = ramstk.RAMSTKLabel('', tooltip=_(u'The assessment model used t...
<|body_start_0|> gtk.Fixed.__init__(self) self._lst_labels = [u'λ<sub>b</sub>:', u'π<sub>Q</sub>:', u'π<sub>E</sub>:'] self._dtc_data_controller = controller self._hardware_id = kwargs['hardware_id'] self._subcategory_id = kwargs['subcategory_id'] self._lblModel = ramstk....
Display Hardware assessment results attribute data in the RAMSTK Work Book. The Hardware assessment result view displays all the assessment results for the selected hardware item. This includes, currently, results for MIL-HDBK-217FN2 parts count and MIL-HDBK-217FN2 part stress methods. The attributes of a Hardware asse...
AssessmentResults
[ "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class AssessmentResults: """Display Hardware assessment results attribute data in the RAMSTK Work Book. The Hardware assessment result view displays all the assessment results for the selected hardware item. This includes, currently, results for MIL-HDBK-217FN2 parts count and MIL-HDBK-217FN2 part stre...
stack_v2_sparse_classes_10k_train_003248
35,514
permissive
[ { "docstring": "Initialize an instance of the Hardware assessment result view. :param controller: the hardware data controller instance. :type controller: :class:`ramstk.hardware.Controller.HardwareBoMDataController` :param int hardware_id: the hardware ID of the currently selected hardware item. :param int sub...
4
stack_v2_sparse_classes_30k_train_000473
Implement the Python class `AssessmentResults` described below. Class description: Display Hardware assessment results attribute data in the RAMSTK Work Book. The Hardware assessment result view displays all the assessment results for the selected hardware item. This includes, currently, results for MIL-HDBK-217FN2 pa...
Implement the Python class `AssessmentResults` described below. Class description: Display Hardware assessment results attribute data in the RAMSTK Work Book. The Hardware assessment result view displays all the assessment results for the selected hardware item. This includes, currently, results for MIL-HDBK-217FN2 pa...
488ffed8b842399ddcae93007de6c6f1dda23d05
<|skeleton|> class AssessmentResults: """Display Hardware assessment results attribute data in the RAMSTK Work Book. The Hardware assessment result view displays all the assessment results for the selected hardware item. This includes, currently, results for MIL-HDBK-217FN2 parts count and MIL-HDBK-217FN2 part stre...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class AssessmentResults: """Display Hardware assessment results attribute data in the RAMSTK Work Book. The Hardware assessment result view displays all the assessment results for the selected hardware item. This includes, currently, results for MIL-HDBK-217FN2 parts count and MIL-HDBK-217FN2 part stress methods. T...
the_stack_v2_python_sparse
src/ramstk/gui/gtk/workviews/components/Component.py
JmiXIII/ramstk
train
0
a90e539c2706efb69424b6cce74bc0ff28e522ca
[ "if not configs_file:\n dir_path = os.path.dirname(os.path.realpath(__file__))\n configs_file = os.path.join(dir_path, 'my_bb_configs.ini')\nprint('Loading configs: ' + configs_file)", "if io.is_file(f_configs) is False:\n warn.warn('configs (INI) file does not exist: ' + f_configs)\n return None", ...
<|body_start_0|> if not configs_file: dir_path = os.path.dirname(os.path.realpath(__file__)) configs_file = os.path.join(dir_path, 'my_bb_configs.ini') print('Loading configs: ' + configs_file) <|end_body_0|> <|body_start_1|> if io.is_file(f_configs) is False: ...
Simple class made-up of static methods for handling INI configuration files used in LOKI API.
Configurations
[ "MIT", "LicenseRef-scancode-proprietary-license" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Configurations: """Simple class made-up of static methods for handling INI configuration files used in LOKI API.""" def parse(configs_file): """Instantiates parser for INI (config) file :param cfconfigs_fileile: absolute path to config INI file :return: ConfigParser object with confi...
stack_v2_sparse_classes_10k_train_003249
6,802
permissive
[ { "docstring": "Instantiates parser for INI (config) file :param cfconfigs_fileile: absolute path to config INI file :return: ConfigParser object with configurations loaded", "name": "parse", "signature": "def parse(configs_file)" }, { "docstring": "Top-level function that reads & stores all (or...
4
stack_v2_sparse_classes_30k_train_002022
Implement the Python class `Configurations` described below. Class description: Simple class made-up of static methods for handling INI configuration files used in LOKI API. Method signatures and docstrings: - def parse(configs_file): Instantiates parser for INI (config) file :param cfconfigs_fileile: absolute path t...
Implement the Python class `Configurations` described below. Class description: Simple class made-up of static methods for handling INI configuration files used in LOKI API. Method signatures and docstrings: - def parse(configs_file): Instantiates parser for INI (config) file :param cfconfigs_fileile: absolute path t...
bc07ba242ccaf762a55c80204d7da05d55847ec5
<|skeleton|> class Configurations: """Simple class made-up of static methods for handling INI configuration files used in LOKI API.""" def parse(configs_file): """Instantiates parser for INI (config) file :param cfconfigs_fileile: absolute path to config INI file :return: ConfigParser object with confi...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Configurations: """Simple class made-up of static methods for handling INI configuration files used in LOKI API.""" def parse(configs_file): """Instantiates parser for INI (config) file :param cfconfigs_fileile: absolute path to config INI file :return: ConfigParser object with configurations loa...
the_stack_v2_python_sparse
src/fiwtools/utils/common.py
visionjo/FIW_KRT
train
28
f3a1af44d78f155a2bb836d7c6e6df5183895472
[ "if platform.platform().lower().startswith('windows'):\n cmd = 'ping -n 1 -w 1 '\nelse:\n cmd = 'ping -c 1 -W 1 '\nprocess = subprocess.Popen(cmd + ip_address, shell=True, stdout=subprocess.PIPE)\ntime.sleep(1.2)\nprocess.stdout.close()\nprocess.wait()\nreturn process.returncode", "if ip_address in Ping.unr...
<|body_start_0|> if platform.platform().lower().startswith('windows'): cmd = 'ping -n 1 -w 1 ' else: cmd = 'ping -c 1 -W 1 ' process = subprocess.Popen(cmd + ip_address, shell=True, stdout=subprocess.PIPE) time.sleep(1.2) process.stdout.close() pro...
Platform-independent ping support.
Ping
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Ping: """Platform-independent ping support.""" def ping(ip_address): """Send a ping (ICMP ECHO request) to the given host. SpiNNaker boards support ICMP ECHO when booted. :param str ip_address: The IP address to ping. Hostnames can be used, but are not recommended. :return: return co...
stack_v2_sparse_classes_10k_train_003250
2,321
permissive
[ { "docstring": "Send a ping (ICMP ECHO request) to the given host. SpiNNaker boards support ICMP ECHO when booted. :param str ip_address: The IP address to ping. Hostnames can be used, but are not recommended. :return: return code of subprocess; 0 for success, anything else for failure :rtype: int", "name":...
2
stack_v2_sparse_classes_30k_train_006151
Implement the Python class `Ping` described below. Class description: Platform-independent ping support. Method signatures and docstrings: - def ping(ip_address): Send a ping (ICMP ECHO request) to the given host. SpiNNaker boards support ICMP ECHO when booted. :param str ip_address: The IP address to ping. Hostnames...
Implement the Python class `Ping` described below. Class description: Platform-independent ping support. Method signatures and docstrings: - def ping(ip_address): Send a ping (ICMP ECHO request) to the given host. SpiNNaker boards support ICMP ECHO when booted. :param str ip_address: The IP address to ping. Hostnames...
9d87f324f91eb49795825f77d663f6ac46a1c5f4
<|skeleton|> class Ping: """Platform-independent ping support.""" def ping(ip_address): """Send a ping (ICMP ECHO request) to the given host. SpiNNaker boards support ICMP ECHO when booted. :param str ip_address: The IP address to ping. Hostnames can be used, but are not recommended. :return: return co...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Ping: """Platform-independent ping support.""" def ping(ip_address): """Send a ping (ICMP ECHO request) to the given host. SpiNNaker boards support ICMP ECHO when booted. :param str ip_address: The IP address to ping. Hostnames can be used, but are not recommended. :return: return code of subproc...
the_stack_v2_python_sparse
spinn_utilities/ping.py
SpiNNakerManchester/SpiNNUtils
train
1
defce6771f3c747bb26af5b3e0de29b0f1874a5e
[ "cross = tensor([[[0, 1, 0], [1, 1, 1], [0, 1, 0]]])\nbound = tensor([[[0, 0, 0], [0, 1, 0], [0, 0, 0]]])\nkernel = stack([bound, cross, bound], 1) * (1 / 7)\nreturn kernel[None]", "if pred.dim() != 5:\n raise ValueError(f'Only 3D images supported. Got {pred.dim()}.')\nreturn super().forward(pred, target)" ]
<|body_start_0|> cross = tensor([[[0, 1, 0], [1, 1, 1], [0, 1, 0]]]) bound = tensor([[[0, 0, 0], [0, 1, 0], [0, 0, 0]]]) kernel = stack([bound, cross, bound], 1) * (1 / 7) return kernel[None] <|end_body_0|> <|body_start_1|> if pred.dim() != 5: raise ValueError(f'Only...
Binary 3D Hausdorff loss based on morphological erosion. Hausdorff Distance loss measures the maximum distance of a predicted segmentation boundary to the nearest ground-truth edge pixel. For two segmentation point sets X and Y , the one-sided HD from X to Y is defined as: .. math:: hd(X,Y) = \\max_{x \\in X} \\min_{y ...
HausdorffERLoss3D
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class HausdorffERLoss3D: """Binary 3D Hausdorff loss based on morphological erosion. Hausdorff Distance loss measures the maximum distance of a predicted segmentation boundary to the nearest ground-truth edge pixel. For two segmentation point sets X and Y , the one-sided HD from X to Y is defined as: ....
stack_v2_sparse_classes_10k_train_003251
9,826
permissive
[ { "docstring": "Get kernel for image morphology convolution.", "name": "get_kernel", "signature": "def get_kernel(self) -> Tensor" }, { "docstring": "Compute 3D Hausdorff loss. Args: pred: predicted tensor with a shape of :math:`(B, C, D, H, W)`. Each channel is as binary as: 1 -> fg, 0 -> bg. t...
2
null
Implement the Python class `HausdorffERLoss3D` described below. Class description: Binary 3D Hausdorff loss based on morphological erosion. Hausdorff Distance loss measures the maximum distance of a predicted segmentation boundary to the nearest ground-truth edge pixel. For two segmentation point sets X and Y , the on...
Implement the Python class `HausdorffERLoss3D` described below. Class description: Binary 3D Hausdorff loss based on morphological erosion. Hausdorff Distance loss measures the maximum distance of a predicted segmentation boundary to the nearest ground-truth edge pixel. For two segmentation point sets X and Y , the on...
1e0f8baa7318c05b17ea6dbb48605691bca8972f
<|skeleton|> class HausdorffERLoss3D: """Binary 3D Hausdorff loss based on morphological erosion. Hausdorff Distance loss measures the maximum distance of a predicted segmentation boundary to the nearest ground-truth edge pixel. For two segmentation point sets X and Y , the one-sided HD from X to Y is defined as: ....
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class HausdorffERLoss3D: """Binary 3D Hausdorff loss based on morphological erosion. Hausdorff Distance loss measures the maximum distance of a predicted segmentation boundary to the nearest ground-truth edge pixel. For two segmentation point sets X and Y , the one-sided HD from X to Y is defined as: .. math:: hd(X...
the_stack_v2_python_sparse
kornia/losses/hausdorff.py
kornia/kornia
train
7,351
27e590d51b42eab4a3c102ba3912e4e14c95447d
[ "A = []\nB = []\nfor k in range(len(guess)):\n if k not in A and guess[k] == secret[k]:\n A.append(k)\n B.append(k)\nal = len(A)\nfor k, s in enumerate(secret):\n if k not in B:\n for _k, g in enumerate(guess):\n if _k not in A and k not in B and (s == g):\n B.ap...
<|body_start_0|> A = [] B = [] for k in range(len(guess)): if k not in A and guess[k] == secret[k]: A.append(k) B.append(k) al = len(A) for k, s in enumerate(secret): if k not in B: for _k, g in enumerate(gue...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def getHint1(self, secret, guess): """:type secret: str :type guess: str :rtype: str""" <|body_0|> def getHint2(self, secret, guess): """:type secret: str :type guess: str :rtype: str""" <|body_1|> def getHint(self, secret, guess): """:...
stack_v2_sparse_classes_10k_train_003252
1,974
no_license
[ { "docstring": ":type secret: str :type guess: str :rtype: str", "name": "getHint1", "signature": "def getHint1(self, secret, guess)" }, { "docstring": ":type secret: str :type guess: str :rtype: str", "name": "getHint2", "signature": "def getHint2(self, secret, guess)" }, { "doc...
3
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def getHint1(self, secret, guess): :type secret: str :type guess: str :rtype: str - def getHint2(self, secret, guess): :type secret: str :type guess: str :rtype: str - def getHin...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def getHint1(self, secret, guess): :type secret: str :type guess: str :rtype: str - def getHint2(self, secret, guess): :type secret: str :type guess: str :rtype: str - def getHin...
e5b018493bbd12edcdcd0434f35d9c358106d391
<|skeleton|> class Solution: def getHint1(self, secret, guess): """:type secret: str :type guess: str :rtype: str""" <|body_0|> def getHint2(self, secret, guess): """:type secret: str :type guess: str :rtype: str""" <|body_1|> def getHint(self, secret, guess): """:...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def getHint1(self, secret, guess): """:type secret: str :type guess: str :rtype: str""" A = [] B = [] for k in range(len(guess)): if k not in A and guess[k] == secret[k]: A.append(k) B.append(k) al = len(A) f...
the_stack_v2_python_sparse
py/leetcode/299.py
wfeng1991/learnpy
train
0
7c2685859a31cb7cb635fb74b4549625d5749252
[ "if user.is_government_user and user.has_perm('DOCUMENTS_GOVERNMENT_REVIEW') and (document.status.status in ['Received', 'Submitted']):\n return True\nif not user.is_government_user and (not privileged) and (document.status.status in ['Draft', 'Submitted']):\n return True\nreturn False", "current_status = c...
<|body_start_0|> if user.is_government_user and user.has_perm('DOCUMENTS_GOVERNMENT_REVIEW') and (document.status.status in ['Received', 'Submitted']): return True if not user.is_government_user and (not privileged) and (document.status.status in ['Draft', 'Submitted']): return T...
Used by Viewset to check permissions for API requests
DocumentCommentPermissions
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DocumentCommentPermissions: """Used by Viewset to check permissions for API requests""" def user_can_comment(user, document, privileged): """Check whether the user should have authority to add a comment. Government Users with abilities to review the documents should always have autho...
stack_v2_sparse_classes_10k_train_003253
4,753
permissive
[ { "docstring": "Check whether the user should have authority to add a comment. Government Users with abilities to review the documents should always have authority to add a comment, unless it's archived. Fuel Suppliers with abilities to add or submit can add a comment if the document is either in draft or submi...
4
stack_v2_sparse_classes_30k_train_005767
Implement the Python class `DocumentCommentPermissions` described below. Class description: Used by Viewset to check permissions for API requests Method signatures and docstrings: - def user_can_comment(user, document, privileged): Check whether the user should have authority to add a comment. Government Users with a...
Implement the Python class `DocumentCommentPermissions` described below. Class description: Used by Viewset to check permissions for API requests Method signatures and docstrings: - def user_can_comment(user, document, privileged): Check whether the user should have authority to add a comment. Government Users with a...
80ae1ef5938ef5e580128ed0c622071b307fc7e1
<|skeleton|> class DocumentCommentPermissions: """Used by Viewset to check permissions for API requests""" def user_can_comment(user, document, privileged): """Check whether the user should have authority to add a comment. Government Users with abilities to review the documents should always have autho...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DocumentCommentPermissions: """Used by Viewset to check permissions for API requests""" def user_can_comment(user, document, privileged): """Check whether the user should have authority to add a comment. Government Users with abilities to review the documents should always have authority to add a...
the_stack_v2_python_sparse
backend/api/permissions/DocumentComment.py
kuanfandevops/tfrs
train
0
7a2b1549ea151dd40cdd291b77560b516a478ab2
[ "context = {}\ntry:\n build = Build.objects.get(id=self.kwargs['pk'])\n context['build'] = build\n context['allocations'] = build.getAutoAllocations()\nexcept Build.DoesNotExist:\n context['error'] = _('No matching build found')\nreturn context", "build = self.get_object()\nform = self.get_form()\ncon...
<|body_start_0|> context = {} try: build = Build.objects.get(id=self.kwargs['pk']) context['build'] = build context['allocations'] = build.getAutoAllocations() except Build.DoesNotExist: context['error'] = _('No matching build found') retur...
View to auto-allocate parts for a build. Follows a simple set of rules to automatically allocate StockItem objects. Ref: build.models.Build.getAutoAllocations()
BuildAutoAllocate
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BuildAutoAllocate: """View to auto-allocate parts for a build. Follows a simple set of rules to automatically allocate StockItem objects. Ref: build.models.Build.getAutoAllocations()""" def get_context_data(self, *args, **kwargs): """Get the context data for form rendering.""" ...
stack_v2_sparse_classes_10k_train_003254
19,285
permissive
[ { "docstring": "Get the context data for form rendering.", "name": "get_context_data", "signature": "def get_context_data(self, *args, **kwargs)" }, { "docstring": "Handle POST request. Perform auto allocations. - If the form validation passes, perform allocations - Otherwise, the form is passed...
2
stack_v2_sparse_classes_30k_train_002282
Implement the Python class `BuildAutoAllocate` described below. Class description: View to auto-allocate parts for a build. Follows a simple set of rules to automatically allocate StockItem objects. Ref: build.models.Build.getAutoAllocations() Method signatures and docstrings: - def get_context_data(self, *args, **kw...
Implement the Python class `BuildAutoAllocate` described below. Class description: View to auto-allocate parts for a build. Follows a simple set of rules to automatically allocate StockItem objects. Ref: build.models.Build.getAutoAllocations() Method signatures and docstrings: - def get_context_data(self, *args, **kw...
daab81fa2cf6f3ce1760e31d8cd94951c6dffdd2
<|skeleton|> class BuildAutoAllocate: """View to auto-allocate parts for a build. Follows a simple set of rules to automatically allocate StockItem objects. Ref: build.models.Build.getAutoAllocations()""" def get_context_data(self, *args, **kwargs): """Get the context data for form rendering.""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BuildAutoAllocate: """View to auto-allocate parts for a build. Follows a simple set of rules to automatically allocate StockItem objects. Ref: build.models.Build.getAutoAllocations()""" def get_context_data(self, *args, **kwargs): """Get the context data for form rendering.""" context = {...
the_stack_v2_python_sparse
InvenTree/build/views.py
fritzlim/InvenTree
train
1
84ae46d51a4f49aef9c34b60b4fc4206fb1a16a5
[ "self._hardware_api = hardware_api\nself._state_store = state_store\nself._thermocycler_plate_lifter = thermocycler_plate_lifter or ThermocyclerPlateLifter(state_store=self._state_store, equipment=equipment, movement=movement)\nself._tc_movement_flagger = thermocycler_movement_flagger or ThermocyclerMovementFlagger...
<|body_start_0|> self._hardware_api = hardware_api self._state_store = state_store self._thermocycler_plate_lifter = thermocycler_plate_lifter or ThermocyclerPlateLifter(state_store=self._state_store, equipment=equipment, movement=movement) self._tc_movement_flagger = thermocycler_moveme...
Implementation logic for labware movement.
LabwareMovementHandler
[ "LicenseRef-scancode-warranty-disclaimer", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LabwareMovementHandler: """Implementation logic for labware movement.""" def __init__(self, hardware_api: HardwareControlAPI, state_store: StateStore, equipment: EquipmentHandler, movement: MovementHandler, thermocycler_plate_lifter: Optional[ThermocyclerPlateLifter]=None, thermocycler_movem...
stack_v2_sparse_classes_10k_train_003255
7,087
permissive
[ { "docstring": "Initialize a LabwareMovementHandler instance.", "name": "__init__", "signature": "def __init__(self, hardware_api: HardwareControlAPI, state_store: StateStore, equipment: EquipmentHandler, movement: MovementHandler, thermocycler_plate_lifter: Optional[ThermocyclerPlateLifter]=None, therm...
3
stack_v2_sparse_classes_30k_train_003723
Implement the Python class `LabwareMovementHandler` described below. Class description: Implementation logic for labware movement. Method signatures and docstrings: - def __init__(self, hardware_api: HardwareControlAPI, state_store: StateStore, equipment: EquipmentHandler, movement: MovementHandler, thermocycler_plat...
Implement the Python class `LabwareMovementHandler` described below. Class description: Implementation logic for labware movement. Method signatures and docstrings: - def __init__(self, hardware_api: HardwareControlAPI, state_store: StateStore, equipment: EquipmentHandler, movement: MovementHandler, thermocycler_plat...
026b523c8c9e5d45910c490efb89194d72595be9
<|skeleton|> class LabwareMovementHandler: """Implementation logic for labware movement.""" def __init__(self, hardware_api: HardwareControlAPI, state_store: StateStore, equipment: EquipmentHandler, movement: MovementHandler, thermocycler_plate_lifter: Optional[ThermocyclerPlateLifter]=None, thermocycler_movem...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LabwareMovementHandler: """Implementation logic for labware movement.""" def __init__(self, hardware_api: HardwareControlAPI, state_store: StateStore, equipment: EquipmentHandler, movement: MovementHandler, thermocycler_plate_lifter: Optional[ThermocyclerPlateLifter]=None, thermocycler_movement_flagger: ...
the_stack_v2_python_sparse
api/src/opentrons/protocol_engine/execution/labware_movement.py
Opentrons/opentrons
train
326
6fb8102d093237d7fae68bf6523a4e94eb2c7044
[ "self.k = k\nself.kheap = []\nheapq.heapify(self.kheap)\nfor i in nums:\n self.add(i)", "heapq.heappush(self.kheap, val)\nif len(self.kheap) > self.k:\n heapq.heappop(self.kheap)\nreturn self.kheap[0]" ]
<|body_start_0|> self.k = k self.kheap = [] heapq.heapify(self.kheap) for i in nums: self.add(i) <|end_body_0|> <|body_start_1|> heapq.heappush(self.kheap, val) if len(self.kheap) > self.k: heapq.heappop(self.kheap) return self.kheap[0] <|...
KthLargest
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" <|body_0|> def add(self, val): """:type val: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> self.k = k self.kheap = [] heapq.heapify(s...
stack_v2_sparse_classes_10k_train_003256
650
no_license
[ { "docstring": ":type k: int :type nums: List[int]", "name": "__init__", "signature": "def __init__(self, k, nums)" }, { "docstring": ":type val: int :rtype: int", "name": "add", "signature": "def add(self, val)" } ]
2
stack_v2_sparse_classes_30k_test_000232
Implement the Python class `KthLargest` described below. Class description: Implement the KthLargest class. Method signatures and docstrings: - def __init__(self, k, nums): :type k: int :type nums: List[int] - def add(self, val): :type val: int :rtype: int
Implement the Python class `KthLargest` described below. Class description: Implement the KthLargest class. Method signatures and docstrings: - def __init__(self, k, nums): :type k: int :type nums: List[int] - def add(self, val): :type val: int :rtype: int <|skeleton|> class KthLargest: def __init__(self, k, nu...
70d8827f430b484fd3407001e02107b2545ef787
<|skeleton|> class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" <|body_0|> def add(self, val): """:type val: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class KthLargest: def __init__(self, k, nums): """:type k: int :type nums: List[int]""" self.k = k self.kheap = [] heapq.heapify(self.kheap) for i in nums: self.add(i) def add(self, val): """:type val: int :rtype: int""" heapq.heappush(self.kh...
the_stack_v2_python_sparse
leetcode/algorithms/heap/kth-largest-element-in-a-stream.py
AnujPancholi/codingQuestionSolutions
train
1
a98739f7c75f284ac2417610ba5fda18d9fea6e5
[ "category_id = request.query_params['category_id']\nsearch = request.query_params['search']\nqueryset = self.get_queryset().filter(category_id=category_id)\nif search != '':\n queryset = queryset.filter(name__contains=search)\npagination_queryset = self.paginate_queryset(queryset)\nserializer = self.get_serializ...
<|body_start_0|> category_id = request.query_params['category_id'] search = request.query_params['search'] queryset = self.get_queryset().filter(category_id=category_id) if search != '': queryset = queryset.filter(name__contains=search) pagination_queryset = self.pagi...
API操作视图
ApiViewSet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class ApiViewSet: """API操作视图""" def list(self, request): """接口列表 { classify_id: int, }""" <|body_0|> def add(self, request): """新增一个接口""" <|body_1|> def update(self, request, **kwargs): """更新接口""" <|body_2|> <|end_skeleton|> <|body_start_...
stack_v2_sparse_classes_10k_train_003257
6,485
no_license
[ { "docstring": "接口列表 { classify_id: int, }", "name": "list", "signature": "def list(self, request)" }, { "docstring": "新增一个接口", "name": "add", "signature": "def add(self, request)" }, { "docstring": "更新接口", "name": "update", "signature": "def update(self, request, **kwarg...
3
stack_v2_sparse_classes_30k_train_003461
Implement the Python class `ApiViewSet` described below. Class description: API操作视图 Method signatures and docstrings: - def list(self, request): 接口列表 { classify_id: int, } - def add(self, request): 新增一个接口 - def update(self, request, **kwargs): 更新接口
Implement the Python class `ApiViewSet` described below. Class description: API操作视图 Method signatures and docstrings: - def list(self, request): 接口列表 { classify_id: int, } - def add(self, request): 新增一个接口 - def update(self, request, **kwargs): 更新接口 <|skeleton|> class ApiViewSet: """API操作视图""" def list(self,...
e8407fdd97e821779f2abb4c2debfb246f44e4ed
<|skeleton|> class ApiViewSet: """API操作视图""" def list(self, request): """接口列表 { classify_id: int, }""" <|body_0|> def add(self, request): """新增一个接口""" <|body_1|> def update(self, request, **kwargs): """更新接口""" <|body_2|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class ApiViewSet: """API操作视图""" def list(self, request): """接口列表 { classify_id: int, }""" category_id = request.query_params['category_id'] search = request.query_params['search'] queryset = self.get_queryset().filter(category_id=category_id) if search != '': ...
the_stack_v2_python_sparse
begin/views1/api.py
aaas19920513/ApiDemo
train
0
792244baeaa9e7bccfc5bf7e7dde918344244f09
[ "easy = set()\nfor i in nums:\n easy.add(i)\nfor i in xrange(len(nums)):\n if i not in easy:\n return i\nreturn len(nums)", "missing = len(nums)\nfor i, num in enumerate(nums):\n missing ^= i ^ num\nreturn missing" ]
<|body_start_0|> easy = set() for i in nums: easy.add(i) for i in xrange(len(nums)): if i not in easy: return i return len(nums) <|end_body_0|> <|body_start_1|> missing = len(nums) for i, num in enumerate(nums): missing...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def missingNumber(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def missingNumberConstantMemory(self, nums): """if we initialize an integer to nn and XOR it with every index and value, we will be left with the missing number. :type nums: L...
stack_v2_sparse_classes_10k_train_003258
881
no_license
[ { "docstring": ":type nums: List[int] :rtype: int", "name": "missingNumber", "signature": "def missingNumber(self, nums)" }, { "docstring": "if we initialize an integer to nn and XOR it with every index and value, we will be left with the missing number. :type nums: List[int] :rtype: int", "...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def missingNumber(self, nums): :type nums: List[int] :rtype: int - def missingNumberConstantMemory(self, nums): if we initialize an integer to nn and XOR it with every index and ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def missingNumber(self, nums): :type nums: List[int] :rtype: int - def missingNumberConstantMemory(self, nums): if we initialize an integer to nn and XOR it with every index and ...
2f7df25d0d735f726b7012e4aa2417dee50526d9
<|skeleton|> class Solution: def missingNumber(self, nums): """:type nums: List[int] :rtype: int""" <|body_0|> def missingNumberConstantMemory(self, nums): """if we initialize an integer to nn and XOR it with every index and value, we will be left with the missing number. :type nums: L...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def missingNumber(self, nums): """:type nums: List[int] :rtype: int""" easy = set() for i in nums: easy.add(i) for i in xrange(len(nums)): if i not in easy: return i return len(nums) def missingNumberConstantMemory(...
the_stack_v2_python_sparse
leetcode/arrays/missing_number.py
marquesarthur/programming_problems
train
2
bdde02442a5825b7a207dbde5f7aa11518d34df6
[ "super().__init__(surepetcare_id, coordinator)\nself._attr_name = f'{self._device_name} Battery Level'\nself._attr_unique_id = f'{self._device_id}-battery'", "state = surepy_entity.raw_data()['status']\ntry:\n per_battery_voltage = state['battery'] / 4\n voltage_diff = per_battery_voltage - SURE_BATT_VOLTAG...
<|body_start_0|> super().__init__(surepetcare_id, coordinator) self._attr_name = f'{self._device_name} Battery Level' self._attr_unique_id = f'{self._device_id}-battery' <|end_body_0|> <|body_start_1|> state = surepy_entity.raw_data()['status'] try: per_battery_volta...
A sensor implementation for Sure Petcare batteries.
SureBattery
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class SureBattery: """A sensor implementation for Sure Petcare batteries.""" def __init__(self, surepetcare_id: int, coordinator: SurePetcareDataCoordinator) -> None: """Initialize a Sure Petcare battery sensor.""" <|body_0|> def _update_attr(self, surepy_entity: SurepyEntity)...
stack_v2_sparse_classes_10k_train_003259
3,867
permissive
[ { "docstring": "Initialize a Sure Petcare battery sensor.", "name": "__init__", "signature": "def __init__(self, surepetcare_id: int, coordinator: SurePetcareDataCoordinator) -> None" }, { "docstring": "Update the state and attributes.", "name": "_update_attr", "signature": "def _update_...
2
null
Implement the Python class `SureBattery` described below. Class description: A sensor implementation for Sure Petcare batteries. Method signatures and docstrings: - def __init__(self, surepetcare_id: int, coordinator: SurePetcareDataCoordinator) -> None: Initialize a Sure Petcare battery sensor. - def _update_attr(se...
Implement the Python class `SureBattery` described below. Class description: A sensor implementation for Sure Petcare batteries. Method signatures and docstrings: - def __init__(self, surepetcare_id: int, coordinator: SurePetcareDataCoordinator) -> None: Initialize a Sure Petcare battery sensor. - def _update_attr(se...
80caeafcb5b6e2f9da192d0ea6dd1a5b8244b743
<|skeleton|> class SureBattery: """A sensor implementation for Sure Petcare batteries.""" def __init__(self, surepetcare_id: int, coordinator: SurePetcareDataCoordinator) -> None: """Initialize a Sure Petcare battery sensor.""" <|body_0|> def _update_attr(self, surepy_entity: SurepyEntity)...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class SureBattery: """A sensor implementation for Sure Petcare batteries.""" def __init__(self, surepetcare_id: int, coordinator: SurePetcareDataCoordinator) -> None: """Initialize a Sure Petcare battery sensor.""" super().__init__(surepetcare_id, coordinator) self._attr_name = f'{self....
the_stack_v2_python_sparse
homeassistant/components/surepetcare/sensor.py
home-assistant/core
train
35,501
07e2da94704646ac1328a6ad17e5dded1f02556c
[ "R1 = array([[1, 4, 5], [-4, 2, 6], [-5, -6, 3]], float64)\nR2 = array([[0, 1, 0], [0, 0, 0], [0, 0, 0]], float64)\neR1 = array([[-1.242955024379687, -3.178944439554645, 6.804083368075889], [-6.545353831891249, -2.604941866769356, 1.228233941393001], [0.975355249080821, -7.711099455690256, -3.318642157729292]], flo...
<|body_start_0|> R1 = array([[1, 4, 5], [-4, 2, 6], [-5, -6, 3]], float64) R2 = array([[0, 1, 0], [0, 0, 0], [0, 0, 0]], float64) eR1 = array([[-1.242955024379687, -3.178944439554645, 6.804083368075889], [-6.545353831891249, -2.604941866769356, 1.228233941393001], [0.975355249080821, -7.71109945...
Unit tests for the lib.linear_algebra.matrix_exponential relax module.
Test_matrix_exponential
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Test_matrix_exponential: """Unit tests for the lib.linear_algebra.matrix_exponential relax module.""" def test_matrix_exponential(self): """Test the matrix exponential function matrix_exponential() with real matrices.""" <|body_0|> def test_matrix_exponential2(self): ...
stack_v2_sparse_classes_10k_train_003260
4,601
no_license
[ { "docstring": "Test the matrix exponential function matrix_exponential() with real matrices.", "name": "test_matrix_exponential", "signature": "def test_matrix_exponential(self)" }, { "docstring": "Test the matrix exponential function matrix_exponential() with complex matrices.", "name": "t...
2
null
Implement the Python class `Test_matrix_exponential` described below. Class description: Unit tests for the lib.linear_algebra.matrix_exponential relax module. Method signatures and docstrings: - def test_matrix_exponential(self): Test the matrix exponential function matrix_exponential() with real matrices. - def tes...
Implement the Python class `Test_matrix_exponential` described below. Class description: Unit tests for the lib.linear_algebra.matrix_exponential relax module. Method signatures and docstrings: - def test_matrix_exponential(self): Test the matrix exponential function matrix_exponential() with real matrices. - def tes...
c317326ddeacd1a1c608128769676899daeae531
<|skeleton|> class Test_matrix_exponential: """Unit tests for the lib.linear_algebra.matrix_exponential relax module.""" def test_matrix_exponential(self): """Test the matrix exponential function matrix_exponential() with real matrices.""" <|body_0|> def test_matrix_exponential2(self): ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Test_matrix_exponential: """Unit tests for the lib.linear_algebra.matrix_exponential relax module.""" def test_matrix_exponential(self): """Test the matrix exponential function matrix_exponential() with real matrices.""" R1 = array([[1, 4, 5], [-4, 2, 6], [-5, -6, 3]], float64) R2...
the_stack_v2_python_sparse
test_suite/unit_tests/_lib/_linear_algebra/test_matrix_exponential.py
jlec/relax
train
4
d33f5928e4414fbed5d4a09ae32baa2c6f413c19
[ "super(Decoder, self).__init__()\nself.input_size = input_size\nself.hidden_size = hidden_size\nself.num_layers = num_layers\nself.proba_output = proba_output\nif rnn_type == 'LSTM':\n self.model = nn.LSTM(input_size=self.input_size, hidden_size=self.hidden_size, num_layers=self.num_layers, batch_first=batch_fir...
<|body_start_0|> super(Decoder, self).__init__() self.input_size = input_size self.hidden_size = hidden_size self.num_layers = num_layers self.proba_output = proba_output if rnn_type == 'LSTM': self.model = nn.LSTM(input_size=self.input_size, hidden_size=self....
Decoder Network
Decoder
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Decoder: """Decoder Network""" def __init__(self, input_size, hidden_size, num_layers, dropout=0, batch_first=True, rnn_type='LSTM', proba_output=False): """Create Encoder Args: input_size (int): number of features per time step hidden_size (int): number of hidden nodes per time step...
stack_v2_sparse_classes_10k_train_003261
14,969
permissive
[ { "docstring": "Create Encoder Args: input_size (int): number of features per time step hidden_size (int): number of hidden nodes per time step num_layers (int): number of layers dropout (float, optional): percentage of nodes that should switched out at any term. Defaults to 0. batch_first (bool, optional): if ...
2
stack_v2_sparse_classes_30k_train_004200
Implement the Python class `Decoder` described below. Class description: Decoder Network Method signatures and docstrings: - def __init__(self, input_size, hidden_size, num_layers, dropout=0, batch_first=True, rnn_type='LSTM', proba_output=False): Create Encoder Args: input_size (int): number of features per time ste...
Implement the Python class `Decoder` described below. Class description: Decoder Network Method signatures and docstrings: - def __init__(self, input_size, hidden_size, num_layers, dropout=0, batch_first=True, rnn_type='LSTM', proba_output=False): Create Encoder Args: input_size (int): number of features per time ste...
5b4a61b5dd0bc259ffe68223877949ef4ebfa5e3
<|skeleton|> class Decoder: """Decoder Network""" def __init__(self, input_size, hidden_size, num_layers, dropout=0, batch_first=True, rnn_type='LSTM', proba_output=False): """Create Encoder Args: input_size (int): number of features per time step hidden_size (int): number of hidden nodes per time step...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Decoder: """Decoder Network""" def __init__(self, input_size, hidden_size, num_layers, dropout=0, batch_first=True, rnn_type='LSTM', proba_output=False): """Create Encoder Args: input_size (int): number of features per time step hidden_size (int): number of hidden nodes per time step num_layers (...
the_stack_v2_python_sparse
src/models/anomalia/layers.py
maurony/ts-vrae
train
1
e4e0075fd82a9e6b5e0310956b9b5406ba7681b5
[ "del mock_cloud_build, mock_google_auth\nmock_upload_log.return_value = True\nbuilds = [{'build_id': '1', 'finishTime': 'test_time', 'status': 'SUCCESS'}]\nmock_get_build = MockGetBuild(builds)\nupdate_build_status.BuildGetter.get_build = mock_get_build.get_build\nexpected_projects = {'history': [{'build_id': '1', ...
<|body_start_0|> del mock_cloud_build, mock_google_auth mock_upload_log.return_value = True builds = [{'build_id': '1', 'finishTime': 'test_time', 'status': 'SUCCESS'}] mock_get_build = MockGetBuild(builds) update_build_status.BuildGetter.get_build = mock_get_build.get_build ...
Unit tests for get_build_history.
TestGetBuildHistory
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TestGetBuildHistory: """Unit tests for get_build_history.""" def test_get_build_history(self, mock_upload_log, mock_cloud_build, mock_google_auth): """Test for get_build_steps.""" <|body_0|> def test_get_build_history_no_last_success(self, mock_upload_log, mock_cloud_bui...
stack_v2_sparse_classes_10k_train_003262
10,717
permissive
[ { "docstring": "Test for get_build_steps.", "name": "test_get_build_history", "signature": "def test_get_build_history(self, mock_upload_log, mock_cloud_build, mock_google_auth)" }, { "docstring": "Test when there is no last successful build.", "name": "test_get_build_history_no_last_success...
2
null
Implement the Python class `TestGetBuildHistory` described below. Class description: Unit tests for get_build_history. Method signatures and docstrings: - def test_get_build_history(self, mock_upload_log, mock_cloud_build, mock_google_auth): Test for get_build_steps. - def test_get_build_history_no_last_success(self,...
Implement the Python class `TestGetBuildHistory` described below. Class description: Unit tests for get_build_history. Method signatures and docstrings: - def test_get_build_history(self, mock_upload_log, mock_cloud_build, mock_google_auth): Test for get_build_steps. - def test_get_build_history_no_last_success(self,...
f0275421f84b8f80ee767fb9230134ac97cb687b
<|skeleton|> class TestGetBuildHistory: """Unit tests for get_build_history.""" def test_get_build_history(self, mock_upload_log, mock_cloud_build, mock_google_auth): """Test for get_build_steps.""" <|body_0|> def test_get_build_history_no_last_success(self, mock_upload_log, mock_cloud_bui...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TestGetBuildHistory: """Unit tests for get_build_history.""" def test_get_build_history(self, mock_upload_log, mock_cloud_build, mock_google_auth): """Test for get_build_steps.""" del mock_cloud_build, mock_google_auth mock_upload_log.return_value = True builds = [{'build_...
the_stack_v2_python_sparse
infra/build/build_status/update_build_status_test.py
google/oss-fuzz
train
9,438
6205c91bb619671c31dc660dc46228a7e40313e4
[ "super().__init__()\nself.recorder = recorder\nself.params = MethodParameters(recorder=recorder)\nself.rval = MethodReturn(recorder=recorder)\nself.exception = MethodException(recorder=recorder)\nself.repository = MethodRepository(recorder=recorder)\nself.pass_recorder = MethodPassRecorder(recorder=recorder)\nself....
<|body_start_0|> super().__init__() self.recorder = recorder self.params = MethodParameters(recorder=recorder) self.rval = MethodReturn(recorder=recorder) self.exception = MethodException(recorder=recorder) self.repository = MethodRepository(recorder=recorder) sel...
Record interesting things about methods. Usage: @rekorder.method.param(when=When.AROUND) @rekorder.method.rval @rekorder.method.exception @rekorder.method.repository(paths=['some/path']) def some_func(...) Alternate Usage: Method can also be used as a decorator. This usage delegates to the param, rval and exception Dev...
Method
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Method: """Record interesting things about methods. Usage: @rekorder.method.param(when=When.AROUND) @rekorder.method.rval @rekorder.method.exception @rekorder.method.repository(paths=['some/path']) def some_func(...) Alternate Usage: Method can also be used as a decorator. This usage delegates to...
stack_v2_sparse_classes_10k_train_003263
2,717
no_license
[ { "docstring": "Construct the Method with a reference to the Recorder capable of recording the tunes created by our Recordable devices. Args: recorder (Recorder): Recorder instance.", "name": "__init__", "signature": "def __init__(self, recorder)" }, { "docstring": "Use this decorator to pass th...
3
stack_v2_sparse_classes_30k_train_006448
Implement the Python class `Method` described below. Class description: Record interesting things about methods. Usage: @rekorder.method.param(when=When.AROUND) @rekorder.method.rval @rekorder.method.exception @rekorder.method.repository(paths=['some/path']) def some_func(...) Alternate Usage: Method can also be used ...
Implement the Python class `Method` described below. Class description: Record interesting things about methods. Usage: @rekorder.method.param(when=When.AROUND) @rekorder.method.rval @rekorder.method.exception @rekorder.method.repository(paths=['some/path']) def some_func(...) Alternate Usage: Method can also be used ...
8135438b5785e1e9f23b44f5b93130b73196ea8f
<|skeleton|> class Method: """Record interesting things about methods. Usage: @rekorder.method.param(when=When.AROUND) @rekorder.method.rval @rekorder.method.exception @rekorder.method.repository(paths=['some/path']) def some_func(...) Alternate Usage: Method can also be used as a decorator. This usage delegates to...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Method: """Record interesting things about methods. Usage: @rekorder.method.param(when=When.AROUND) @rekorder.method.rval @rekorder.method.exception @rekorder.method.repository(paths=['some/path']) def some_func(...) Alternate Usage: Method can also be used as a decorator. This usage delegates to the param, r...
the_stack_v2_python_sparse
rekorder/lib/method/method.py
jcejohnson/rekorder
train
0
b503371719c19983f130de0cad10ad51b0deb2c8
[ "rules = [['(?i)(quiz)$', '\\\\1zes'], ['^(?i)(ox)$', '\\\\1en'], ['(?i)([m|l])ouse$', '\\\\1ice'], ['(?i)(matr|vert|ind)ix|ex$', '\\\\1ices'], ['(?i)(x|ch|ss|sh)$', '\\\\1es'], ['(?i)([^aeiouy]|qu)ies$', '\\\\1y'], ['(?i)([^aeiouy]|qu)y$', '\\\\1ies'], ['(?i)(hive)$', '\\\\1s'], ['(?i)(?:([^f])fe|([lr])f)$', '\\\\...
<|body_start_0|> rules = [['(?i)(quiz)$', '\\1zes'], ['^(?i)(ox)$', '\\1en'], ['(?i)([m|l])ouse$', '\\1ice'], ['(?i)(matr|vert|ind)ix|ex$', '\\1ices'], ['(?i)(x|ch|ss|sh)$', '\\1es'], ['(?i)([^aeiouy]|qu)ies$', '\\1y'], ['(?i)([^aeiouy]|qu)y$', '\\1ies'], ['(?i)(hive)$', '\\1s'], ['(?i)(?:([^f])fe|([lr])f)$', '...
Inflector for pluralize and singularize English nouns. This is the default Inflector for the Inflector obj
English
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class English: """Inflector for pluralize and singularize English nouns. This is the default Inflector for the Inflector obj""" def pluralize(self, word): """Pluralizes English nouns.""" <|body_0|> def singularize(self, word): """Singularizes English nouns.""" ...
stack_v2_sparse_classes_10k_train_003264
36,915
no_license
[ { "docstring": "Pluralizes English nouns.", "name": "pluralize", "signature": "def pluralize(self, word)" }, { "docstring": "Singularizes English nouns.", "name": "singularize", "signature": "def singularize(self, word)" } ]
2
stack_v2_sparse_classes_30k_train_000506
Implement the Python class `English` described below. Class description: Inflector for pluralize and singularize English nouns. This is the default Inflector for the Inflector obj Method signatures and docstrings: - def pluralize(self, word): Pluralizes English nouns. - def singularize(self, word): Singularizes Engli...
Implement the Python class `English` described below. Class description: Inflector for pluralize and singularize English nouns. This is the default Inflector for the Inflector obj Method signatures and docstrings: - def pluralize(self, word): Pluralizes English nouns. - def singularize(self, word): Singularizes Engli...
0ac6653219c2701c13c508c5c4fc9bc3437eea06
<|skeleton|> class English: """Inflector for pluralize and singularize English nouns. This is the default Inflector for the Inflector obj""" def pluralize(self, word): """Pluralizes English nouns.""" <|body_0|> def singularize(self, word): """Singularizes English nouns.""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class English: """Inflector for pluralize and singularize English nouns. This is the default Inflector for the Inflector obj""" def pluralize(self, word): """Pluralizes English nouns.""" rules = [['(?i)(quiz)$', '\\1zes'], ['^(?i)(ox)$', '\\1en'], ['(?i)([m|l])ouse$', '\\1ice'], ['(?i)(matr|ver...
the_stack_v2_python_sparse
repoData/noklesta-SublimeRailsNav/allPythonContent.py
aCoffeeYin/pyreco
train
0
a845898fa5edfc140140448855f78767fd63d1d0
[ "assert start <= end\nif array[start] != target:\n return -1\nelif start == end:\n return start\ni = start\nstep = 1\nwhile True:\n if i == end:\n return i\n j = i + step\n step *= 2\n if j > end or array[j] != target:\n candidate = self.lastIndexOf(array, target, i + 1, end)\n ...
<|body_start_0|> assert start <= end if array[start] != target: return -1 elif start == end: return start i = start step = 1 while True: if i == end: return i j = i + step step *= 2 if...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def lastIndexOf(self, array, target, start, end): """Finds the last index of target in range [start...end] of array. Returns -1 if the target does not exist. The array is expected to be sorted in ascending order and array[start] must be the target for the search to continue."""...
stack_v2_sparse_classes_10k_train_003265
2,903
permissive
[ { "docstring": "Finds the last index of target in range [start...end] of array. Returns -1 if the target does not exist. The array is expected to be sorted in ascending order and array[start] must be the target for the search to continue.", "name": "lastIndexOf", "signature": "def lastIndexOf(self, arra...
2
stack_v2_sparse_classes_30k_train_001287
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lastIndexOf(self, array, target, start, end): Finds the last index of target in range [start...end] of array. Returns -1 if the target does not exist. The array is expected t...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def lastIndexOf(self, array, target, start, end): Finds the last index of target in range [start...end] of array. Returns -1 if the target does not exist. The array is expected t...
363848b7870c8d90f5be0d345204c0bf8eb45daa
<|skeleton|> class Solution: def lastIndexOf(self, array, target, start, end): """Finds the last index of target in range [start...end] of array. Returns -1 if the target does not exist. The array is expected to be sorted in ascending order and array[start] must be the target for the search to continue."""...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def lastIndexOf(self, array, target, start, end): """Finds the last index of target in range [start...end] of array. Returns -1 if the target does not exist. The array is expected to be sorted in ascending order and array[start] must be the target for the search to continue.""" asser...
the_stack_v2_python_sparse
leetcode/algorithms/remove-duplicates-from-sorted-array-ii/solution.py
kgashok/algorithms
train
1
cbb68f037ae229abc9c7ed04ac115f7dc54e1a4d
[ "def help(root):\n if not root:\n res.append('#')\n return ','.join(res)\n res.append(str(root.val))\n help(root.left)\n help(root.right)\n return ','.join(res)\nres = []\nreturn help(root)", "def help(nodes):\n value = nodes.pop(0)\n if value == '#':\n return None\n r...
<|body_start_0|> def help(root): if not root: res.append('#') return ','.join(res) res.append(str(root.val)) help(root.left) help(root.right) return ','.join(res) res = [] return help(root) <|end_body_0|>...
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_10k_train_003266
1,378
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_007190
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:...
7f4917bd2c0581d02f68a6407fdb5d3a5926fd4e
<|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_10k
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 help(root): if not root: res.append('#') return ','.join(res) res.append(str(root.val)) help(root.left) ...
the_stack_v2_python_sparse
297.二叉树的序列化与反序列化.py
icevivian/Hello_offer
train
0
c052853d0526608f97cfc4e2e0129cf21672b283
[ "super(GeneralizedMLP, self).__init__(name=name)\nif layers is not None:\n self._layers = layers\nelse:\n self._layers = [64, 64, 1]\nif regularizer_weight:\n self._regularizers = {'w': tf.contrib.layers.l2_regularizer(scale=regularizer_weight)}\nelse:\n self._regularizers = None\nself._use_batchnorm = ...
<|body_start_0|> super(GeneralizedMLP, self).__init__(name=name) if layers is not None: self._layers = layers else: self._layers = [64, 64, 1] if regularizer_weight: self._regularizers = {'w': tf.contrib.layers.l2_regularizer(scale=regularizer_weight)}...
A multilayer, fully-connected discriminator.
GeneralizedMLP
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class GeneralizedMLP: """A multilayer, fully-connected discriminator.""" def __init__(self, name='fc_discriminator', regularizer_weight=0.0, use_batchnorm=False, layers=None, final_activation=None): """Constructs a GeneralizedMLP.""" <|body_0|> def _build(self, input, is_train...
stack_v2_sparse_classes_10k_train_003267
2,866
no_license
[ { "docstring": "Constructs a GeneralizedMLP.", "name": "__init__", "signature": "def __init__(self, name='fc_discriminator', regularizer_weight=0.0, use_batchnorm=False, layers=None, final_activation=None)" }, { "docstring": "Adds the network into the graph.", "name": "_build", "signatur...
2
stack_v2_sparse_classes_30k_train_000462
Implement the Python class `GeneralizedMLP` described below. Class description: A multilayer, fully-connected discriminator. Method signatures and docstrings: - def __init__(self, name='fc_discriminator', regularizer_weight=0.0, use_batchnorm=False, layers=None, final_activation=None): Constructs a GeneralizedMLP. - ...
Implement the Python class `GeneralizedMLP` described below. Class description: A multilayer, fully-connected discriminator. Method signatures and docstrings: - def __init__(self, name='fc_discriminator', regularizer_weight=0.0, use_batchnorm=False, layers=None, final_activation=None): Constructs a GeneralizedMLP. - ...
358a09d491aab0794df9cc7f3f8064430a78fbc3
<|skeleton|> class GeneralizedMLP: """A multilayer, fully-connected discriminator.""" def __init__(self, name='fc_discriminator', regularizer_weight=0.0, use_batchnorm=False, layers=None, final_activation=None): """Constructs a GeneralizedMLP.""" <|body_0|> def _build(self, input, is_train...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class GeneralizedMLP: """A multilayer, fully-connected discriminator.""" def __init__(self, name='fc_discriminator', regularizer_weight=0.0, use_batchnorm=False, layers=None, final_activation=None): """Constructs a GeneralizedMLP.""" super(GeneralizedMLP, self).__init__(name=name) if la...
the_stack_v2_python_sparse
architectures/mlp_architectures.py
zwbgood6/temporal-hierarchy
train
0
0b51bdfc86a1777bcfb0a20b37203f295e515230
[ "left = 0\nright = x\nmid = (left + right) / 2\nwhile left <= right:\n if mid ** 2 > x:\n right = mid - 1\n else:\n left = mid + 1\n mid = (left + right) / 2\nreturn mid", "left = 0\nright = x\nmid = (left + right) // 2\nwhile left <= right:\n if mid ** 2 == x:\n return mid\n e...
<|body_start_0|> left = 0 right = x mid = (left + right) / 2 while left <= right: if mid ** 2 > x: right = mid - 1 else: left = mid + 1 mid = (left + right) / 2 return mid <|end_body_0|> <|body_start_1|> ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def mySqrt(self, x): """:type x: int :rtype: int""" <|body_0|> def yourSqrt(self, x): """:type x: int :rtype: int""" <|body_1|> <|end_skeleton|> <|body_start_0|> left = 0 right = x mid = (left + right) / 2 while lef...
stack_v2_sparse_classes_10k_train_003268
1,501
no_license
[ { "docstring": ":type x: int :rtype: int", "name": "mySqrt", "signature": "def mySqrt(self, x)" }, { "docstring": ":type x: int :rtype: int", "name": "yourSqrt", "signature": "def yourSqrt(self, x)" } ]
2
stack_v2_sparse_classes_30k_train_005136
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mySqrt(self, x): :type x: int :rtype: int - def yourSqrt(self, x): :type x: int :rtype: int
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def mySqrt(self, x): :type x: int :rtype: int - def yourSqrt(self, x): :type x: int :rtype: int <|skeleton|> class Solution: def mySqrt(self, x): """:type x: int :r...
2d5fa4cd696d5035ea8859befeadc5cc436959c9
<|skeleton|> class Solution: def mySqrt(self, x): """:type x: int :rtype: int""" <|body_0|> def yourSqrt(self, x): """:type x: int :rtype: int""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def mySqrt(self, x): """:type x: int :rtype: int""" left = 0 right = x mid = (left + right) / 2 while left <= right: if mid ** 2 > x: right = mid - 1 else: left = mid + 1 mid = (left + right) ...
the_stack_v2_python_sparse
SourceCode/Python/Problem/00069.Sqrt x.py
roger6blog/LeetCode
train
0
0eadfbfa1e83c474a949ac72b99f3851e324c0f4
[ "is_app_engine_target_set = app_engine_http_queue is not None and app_engine_http_queue.appEngineRoutingOverride is not None\nis_http_target_set = http_target is not None\nif is_app_engine_target_set and is_http_target_set:\n raise CreatingHttpAndAppEngineQueueError('Attempting to send multiple queue target type...
<|body_start_0|> is_app_engine_target_set = app_engine_http_queue is not None and app_engine_http_queue.appEngineRoutingOverride is not None is_http_target_set = http_target is not None if is_app_engine_target_set and is_http_target_set: raise CreatingHttpAndAppEngineQueueError('Atte...
Client for queues service in the Cloud Tasks API.
BetaQueues
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class BetaQueues: """Client for queues service in the Cloud Tasks API.""" def Create(self, parent_ref, queue_ref, retry_config=None, rate_limits=None, app_engine_http_queue=None, stackdriver_logging_config=None, queue_type=None, http_target=None): """Prepares and sends a Create request for...
stack_v2_sparse_classes_10k_train_003269
19,528
permissive
[ { "docstring": "Prepares and sends a Create request for creating a queue.", "name": "Create", "signature": "def Create(self, parent_ref, queue_ref, retry_config=None, rate_limits=None, app_engine_http_queue=None, stackdriver_logging_config=None, queue_type=None, http_target=None)" }, { "docstrin...
2
null
Implement the Python class `BetaQueues` described below. Class description: Client for queues service in the Cloud Tasks API. Method signatures and docstrings: - def Create(self, parent_ref, queue_ref, retry_config=None, rate_limits=None, app_engine_http_queue=None, stackdriver_logging_config=None, queue_type=None, h...
Implement the Python class `BetaQueues` described below. Class description: Client for queues service in the Cloud Tasks API. Method signatures and docstrings: - def Create(self, parent_ref, queue_ref, retry_config=None, rate_limits=None, app_engine_http_queue=None, stackdriver_logging_config=None, queue_type=None, h...
392abf004b16203030e6efd2f0af24db7c8d669e
<|skeleton|> class BetaQueues: """Client for queues service in the Cloud Tasks API.""" def Create(self, parent_ref, queue_ref, retry_config=None, rate_limits=None, app_engine_http_queue=None, stackdriver_logging_config=None, queue_type=None, http_target=None): """Prepares and sends a Create request for...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class BetaQueues: """Client for queues service in the Cloud Tasks API.""" def Create(self, parent_ref, queue_ref, retry_config=None, rate_limits=None, app_engine_http_queue=None, stackdriver_logging_config=None, queue_type=None, http_target=None): """Prepares and sends a Create request for creating a q...
the_stack_v2_python_sparse
lib/googlecloudsdk/api_lib/tasks/queues.py
google-cloud-sdk-unofficial/google-cloud-sdk
train
9
54d6176378b1eb8ffbaccc3418d212a6be389e56
[ "def backtrack(nums, temp_list, result):\n if len(temp_list) == len(nums):\n result.append(list(temp_list))\n else:\n for num in nums:\n if num not in temp_list:\n temp_list.append(num)\n backtrack(nums, temp_list, result)\n temp_list.pop()...
<|body_start_0|> def backtrack(nums, temp_list, result): if len(temp_list) == len(nums): result.append(list(temp_list)) else: for num in nums: if num not in temp_list: temp_list.append(num) ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def permute(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_0|> def permute_2(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|> <|body_start_0|> def backtrack(nums, temp_li...
stack_v2_sparse_classes_10k_train_003270
1,439
no_license
[ { "docstring": ":type nums: List[int] :rtype: List[List[int]]", "name": "permute", "signature": "def permute(self, nums)" }, { "docstring": ":type nums: List[int] :rtype: List[List[int]]", "name": "permute_2", "signature": "def permute_2(self, nums)" } ]
2
stack_v2_sparse_classes_30k_train_002106
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def permute(self, nums): :type nums: List[int] :rtype: List[List[int]] - def permute_2(self, nums): :type nums: List[int] :rtype: List[List[int]]
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def permute(self, nums): :type nums: List[int] :rtype: List[List[int]] - def permute_2(self, nums): :type nums: List[int] :rtype: List[List[int]] <|skeleton|> class Solution: ...
9d9e0c08992ef7dbd9ac517821faa9de17f49b0e
<|skeleton|> class Solution: def permute(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_0|> def permute_2(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def permute(self, nums): """:type nums: List[int] :rtype: List[List[int]]""" def backtrack(nums, temp_list, result): if len(temp_list) == len(nums): result.append(list(temp_list)) else: for num in nums: if nu...
the_stack_v2_python_sparse
046-permutations.py
floydchenchen/leetcode
train
0
10c7f89af6aa692e7519621ce91e1cb7cc1a66a8
[ "import heapq\nh1 = QueueNode(3)\nh2 = QueueNode(5)\nh3 = QueueNode(7)\nheap = [h1, h2, h3]\nheapq.heapify(heap)\nfor cnt in xrange(k - 1):\n h = heapq.heappop(heap)\n if h == h1:\n h1.q.append(h1.val * 3)\n h2.q.append(h1.val * 5)\n h3.q.append(h1.val * 7)\n elif h == h2:\n h2....
<|body_start_0|> import heapq h1 = QueueNode(3) h2 = QueueNode(5) h3 = QueueNode(7) heap = [h1, h2, h3] heapq.heapify(heap) for cnt in xrange(k - 1): h = heapq.heappop(heap) if h == h1: h1.q.append(h1.val * 3) ...
Solution
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def kthPrimeNumber(self, k): """heap and queue :param k: :return:""" <|body_0|> def kthPrimeNumber_error(self, k): """heap and queue Erroneous on re-appending the next items on the same queue Example of errors: 45 is repeated, 45 = 3*3*5 and 45 = 3*5*3 :par...
stack_v2_sparse_classes_10k_train_003271
2,413
permissive
[ { "docstring": "heap and queue :param k: :return:", "name": "kthPrimeNumber", "signature": "def kthPrimeNumber(self, k)" }, { "docstring": "heap and queue Erroneous on re-appending the next items on the same queue Example of errors: 45 is repeated, 45 = 3*3*5 and 45 = 3*5*3 :param k: :return:", ...
2
stack_v2_sparse_classes_30k_train_000877
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def kthPrimeNumber(self, k): heap and queue :param k: :return: - def kthPrimeNumber_error(self, k): heap and queue Erroneous on re-appending the next items on the same queue Exam...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def kthPrimeNumber(self, k): heap and queue :param k: :return: - def kthPrimeNumber_error(self, k): heap and queue Erroneous on re-appending the next items on the same queue Exam...
4629a3857b2c57418b86a3b3a7180ecb15e763e3
<|skeleton|> class Solution: def kthPrimeNumber(self, k): """heap and queue :param k: :return:""" <|body_0|> def kthPrimeNumber_error(self, k): """heap and queue Erroneous on re-appending the next items on the same queue Example of errors: 45 is repeated, 45 = 3*3*5 and 45 = 3*5*3 :par...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def kthPrimeNumber(self, k): """heap and queue :param k: :return:""" import heapq h1 = QueueNode(3) h2 = QueueNode(5) h3 = QueueNode(7) heap = [h1, h2, h3] heapq.heapify(heap) for cnt in xrange(k - 1): h = heapq.heappop(heap...
the_stack_v2_python_sparse
Kth Prime Number.py
RijuDasgupta9116/LintCode
train
0
f3853432fb03d2156f017c26e3788b82d4517541
[ "self.res = 0\nvisited = [[False for _ in range(n)] for _ in range(m)]\nself.dfs(m, n, k, 0, 0, visited)\nreturn self.res", "if row < 0 or row >= m or col < 0 or (col >= n) or visited[row][col] or (not self.valid(row, col, k)):\n return\nvisited[row][col] = True\nself.res += 1\nself.dfs(m, n, k, row + 1, col, ...
<|body_start_0|> self.res = 0 visited = [[False for _ in range(n)] for _ in range(m)] self.dfs(m, n, k, 0, 0, visited) return self.res <|end_body_0|> <|body_start_1|> if row < 0 or row >= m or col < 0 or (col >= n) or visited[row][col] or (not self.valid(row, col, k)): ...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def movingCount(self, m, n, k): """Args: m: int n: int k: int Return: int""" <|body_0|> def dfs(self, m, n, k, row, col, visited): """Args: m: int n: int k: int row: int col: int visited: list[bool]""" <|body_1|> def valid(self, row, col, k): ...
stack_v2_sparse_classes_10k_train_003272
1,346
no_license
[ { "docstring": "Args: m: int n: int k: int Return: int", "name": "movingCount", "signature": "def movingCount(self, m, n, k)" }, { "docstring": "Args: m: int n: int k: int row: int col: int visited: list[bool]", "name": "dfs", "signature": "def dfs(self, m, n, k, row, col, visited)" },...
3
stack_v2_sparse_classes_30k_train_001737
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def movingCount(self, m, n, k): Args: m: int n: int k: int Return: int - def dfs(self, m, n, k, row, col, visited): Args: m: int n: int k: int row: int col: int visited: list[boo...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def movingCount(self, m, n, k): Args: m: int n: int k: int Return: int - def dfs(self, m, n, k, row, col, visited): Args: m: int n: int k: int row: int col: int visited: list[boo...
101bce2fac8b188a4eb2f5e017293d21ad0ecb21
<|skeleton|> class Solution: def movingCount(self, m, n, k): """Args: m: int n: int k: int Return: int""" <|body_0|> def dfs(self, m, n, k, row, col, visited): """Args: m: int n: int k: int row: int col: int visited: list[bool]""" <|body_1|> def valid(self, row, col, k): ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def movingCount(self, m, n, k): """Args: m: int n: int k: int Return: int""" self.res = 0 visited = [[False for _ in range(n)] for _ in range(m)] self.dfs(m, n, k, 0, 0, visited) return self.res def dfs(self, m, n, k, row, col, visited): """Args: ...
the_stack_v2_python_sparse
剑指offer/剑指 Offer 13. 机器人的运动范围.py
AiZhanghan/Leetcode
train
0
7845a3d22d173f515479e3b4513b816c29be1400
[ "if not arr:\n return True\nif arr.count(0) > 1:\n return True\nfor item in arr:\n if item == 0:\n continue\n if 2 * item in arr:\n return True\nreturn False", "for i, a in enumerate(arr):\n for j, b in enumerate(arr):\n if i != j and a == b:\n return True\nreturn Fa...
<|body_start_0|> if not arr: return True if arr.count(0) > 1: return True for item in arr: if item == 0: continue if 2 * item in arr: return True return False <|end_body_0|> <|body_start_1|> for i, a...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def checkIfExist(self, arr): """:type arr: List[int] :rtype: bool""" <|body_0|> def checkIfExist2(self, arr): """:type arr: List[int] :rtype: bool""" <|body_1|> <|end_skeleton|> <|body_start_0|> if not arr: return True ...
stack_v2_sparse_classes_10k_train_003273
1,116
no_license
[ { "docstring": ":type arr: List[int] :rtype: bool", "name": "checkIfExist", "signature": "def checkIfExist(self, arr)" }, { "docstring": ":type arr: List[int] :rtype: bool", "name": "checkIfExist2", "signature": "def checkIfExist2(self, arr)" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def checkIfExist(self, arr): :type arr: List[int] :rtype: bool - def checkIfExist2(self, arr): :type arr: List[int] :rtype: bool
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def checkIfExist(self, arr): :type arr: List[int] :rtype: bool - def checkIfExist2(self, arr): :type arr: List[int] :rtype: bool <|skeleton|> class Solution: def checkIfExi...
690b685048c8e89d26047b6bc48b5f9af7d59cbb
<|skeleton|> class Solution: def checkIfExist(self, arr): """:type arr: List[int] :rtype: bool""" <|body_0|> def checkIfExist2(self, arr): """:type arr: List[int] :rtype: bool""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def checkIfExist(self, arr): """:type arr: List[int] :rtype: bool""" if not arr: return True if arr.count(0) > 1: return True for item in arr: if item == 0: continue if 2 * item in arr: re...
the_stack_v2_python_sparse
数组/1346. 检查整数及其两倍数是否存在.py
SimmonsChen/LeetCode
train
0
759af17b3cec5520d59c86c400b7b48220a404d0
[ "count = 0\nwhile head:\n count += 1\n head = head.next\nreturn count", "if headA is None or headB is None:\n return None\nlength1 = self.length(headA)\nlength2 = self.length(headB)\nif length1 > length2:\n steps = length1 - length2\n slower = headB\n faster = headA\nelse:\n steps = length2 -...
<|body_start_0|> count = 0 while head: count += 1 head = head.next return count <|end_body_0|> <|body_start_1|> if headA is None or headB is None: return None length1 = self.length(headA) length2 = self.length(headB) if length1...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def length(self, head): """>>> s = Solution() >>> s.length(None) 0 >>> head = LinkedList.fromList([1]) >>> s.length(head) 1 >>> head = LinkedList.fromList([1, 2, 3]) >>> s.length(head) 3""" <|body_0|> def getIntersectionNode(self, headA, headB): """:type he...
stack_v2_sparse_classes_10k_train_003274
1,786
no_license
[ { "docstring": ">>> s = Solution() >>> s.length(None) 0 >>> head = LinkedList.fromList([1]) >>> s.length(head) 1 >>> head = LinkedList.fromList([1, 2, 3]) >>> s.length(head) 3", "name": "length", "signature": "def length(self, head)" }, { "docstring": ":type head1, head1: ListNode :rtype: ListNo...
2
stack_v2_sparse_classes_30k_train_006170
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def length(self, head): >>> s = Solution() >>> s.length(None) 0 >>> head = LinkedList.fromList([1]) >>> s.length(head) 1 >>> head = LinkedList.fromList([1, 2, 3]) >>> s.length(he...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def length(self, head): >>> s = Solution() >>> s.length(None) 0 >>> head = LinkedList.fromList([1]) >>> s.length(head) 1 >>> head = LinkedList.fromList([1, 2, 3]) >>> s.length(he...
3b13a02f9c8273f9794a57b948d2655792707f37
<|skeleton|> class Solution: def length(self, head): """>>> s = Solution() >>> s.length(None) 0 >>> head = LinkedList.fromList([1]) >>> s.length(head) 1 >>> head = LinkedList.fromList([1, 2, 3]) >>> s.length(head) 3""" <|body_0|> def getIntersectionNode(self, headA, headB): """:type he...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def length(self, head): """>>> s = Solution() >>> s.length(None) 0 >>> head = LinkedList.fromList([1]) >>> s.length(head) 1 >>> head = LinkedList.fromList([1, 2, 3]) >>> s.length(head) 3""" count = 0 while head: count += 1 head = head.next retu...
the_stack_v2_python_sparse
insection_of_lists.py
gsy/leetcode
train
1
5f40abcf24075df92de65ecfda0a9ccd20c87bd4
[ "def inorder(node):\n if node:\n yield from inorder(node.left)\n yield node.val\n yield from inorder(node.right)\nfor i in inorder(root):\n if k > 1:\n k -= 1\n else:\n return i", "cnt = 0\nstack = []\ntmp = root\nwhile tmp is not None or len(stack) > 0:\n if tmp is ...
<|body_start_0|> def inorder(node): if node: yield from inorder(node.left) yield node.val yield from inorder(node.right) for i in inorder(root): if k > 1: k -= 1 else: return i <|end_body_...
Solution
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def kthSmallest2(self, root: Optional[TreeNode], k: int) -> int: """Runtime: 44 ms, faster than 98.45% Memory Usage: 18 MB, less than 48.12% The number of nodes in the tree is n. 1 <= k <= n <= 10^4 0 <= Node.val <= 10^4""" <|body_0|> def kthSmallest(self, root: Op...
stack_v2_sparse_classes_10k_train_003275
2,102
permissive
[ { "docstring": "Runtime: 44 ms, faster than 98.45% Memory Usage: 18 MB, less than 48.12% The number of nodes in the tree is n. 1 <= k <= n <= 10^4 0 <= Node.val <= 10^4", "name": "kthSmallest2", "signature": "def kthSmallest2(self, root: Optional[TreeNode], k: int) -> int" }, { "docstring": "93 ...
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def kthSmallest2(self, root: Optional[TreeNode], k: int) -> int: Runtime: 44 ms, faster than 98.45% Memory Usage: 18 MB, less than 48.12% The number of nodes in the tree is n. 1 ...
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def kthSmallest2(self, root: Optional[TreeNode], k: int) -> int: Runtime: 44 ms, faster than 98.45% Memory Usage: 18 MB, less than 48.12% The number of nodes in the tree is n. 1 ...
4dd1e54d8d08f7e6590bc76abd08ecaacaf775e5
<|skeleton|> class Solution: def kthSmallest2(self, root: Optional[TreeNode], k: int) -> int: """Runtime: 44 ms, faster than 98.45% Memory Usage: 18 MB, less than 48.12% The number of nodes in the tree is n. 1 <= k <= n <= 10^4 0 <= Node.val <= 10^4""" <|body_0|> def kthSmallest(self, root: Op...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def kthSmallest2(self, root: Optional[TreeNode], k: int) -> int: """Runtime: 44 ms, faster than 98.45% Memory Usage: 18 MB, less than 48.12% The number of nodes in the tree is n. 1 <= k <= n <= 10^4 0 <= Node.val <= 10^4""" def inorder(node): if node: yiel...
the_stack_v2_python_sparse
src/230-KthSmallestElementinaBST.py
Jiezhi/myleetcode
train
1
2db7ed8951cad880e828dbb04b7ad6d53582d307
[ "super(Head, self).__init__()\nself.action_dim = squeeze(action_dim)\nself.dueling = dueling\nhead_fn = partial(DuelingHead, a_layer_num=a_layer_num, v_layer_num=v_layer_num) if dueling else nn.Linear\nif isinstance(self.action_dim, tuple):\n self.pred = nn.ModuleList()\n for dim in self.action_dim:\n ...
<|body_start_0|> super(Head, self).__init__() self.action_dim = squeeze(action_dim) self.dueling = dueling head_fn = partial(DuelingHead, a_layer_num=a_layer_num, v_layer_num=v_layer_num) if dueling else nn.Linear if isinstance(self.action_dim, tuple): self.pred = nn....
Overview: The Head used in DQN models. Receive encoded embedding tensor and use it to predict the action. Interfaces: __init__, forward
Head
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Head: """Overview: The Head used in DQN models. Receive encoded embedding tensor and use it to predict the action. Interfaces: __init__, forward""" def __init__(self, action_dim: tuple, input_dim: int, dueling: bool=True, a_layer_num: int=1, v_layer_num: int=1) -> None: """Overview: ...
stack_v2_sparse_classes_10k_train_003276
9,851
permissive
[ { "docstring": "Overview: Init the Head according to arguments. Arguments: - action_dim (:obj:`tuple`): the num of action dim, \\\\ note that it can be a tuple containing more than one element - input_dim (:obj:`int`): input tensor dim of the head - dueling (:obj:`bool`): whether to use ``DuelingHead`` or ``nn....
2
stack_v2_sparse_classes_30k_train_007331
Implement the Python class `Head` described below. Class description: Overview: The Head used in DQN models. Receive encoded embedding tensor and use it to predict the action. Interfaces: __init__, forward Method signatures and docstrings: - def __init__(self, action_dim: tuple, input_dim: int, dueling: bool=True, a_...
Implement the Python class `Head` described below. Class description: Overview: The Head used in DQN models. Receive encoded embedding tensor and use it to predict the action. Interfaces: __init__, forward Method signatures and docstrings: - def __init__(self, action_dim: tuple, input_dim: int, dueling: bool=True, a_...
09d507c412235a2f0cf9c0b3485ec9ed15fb6421
<|skeleton|> class Head: """Overview: The Head used in DQN models. Receive encoded embedding tensor and use it to predict the action. Interfaces: __init__, forward""" def __init__(self, action_dim: tuple, input_dim: int, dueling: bool=True, a_layer_num: int=1, v_layer_num: int=1) -> None: """Overview: ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Head: """Overview: The Head used in DQN models. Receive encoded embedding tensor and use it to predict the action. Interfaces: __init__, forward""" def __init__(self, action_dim: tuple, input_dim: int, dueling: bool=True, a_layer_num: int=1, v_layer_num: int=1) -> None: """Overview: Init the Head...
the_stack_v2_python_sparse
ctools/model/dqn/dqn_network.py
LFhase/DI-star
train
1
5f1fbb979033a14e2c58e2833ab1d2a1ccccc4aa
[ "inv_obj = self.pool.get('account.invoice').browse(cr, uid, invoice_id)\nres = super(account_invoice_tax, self).move_line_get(cr, uid, invoice_id)\nfor r in res:\n if inv_obj.budget_confirm_id:\n if r['price'] > 0 and r['account_id'] == inv_obj.budget_confirm_id.general_account_id.id:\n r.updat...
<|body_start_0|> inv_obj = self.pool.get('account.invoice').browse(cr, uid, invoice_id) res = super(account_invoice_tax, self).move_line_get(cr, uid, invoice_id) for r in res: if inv_obj.budget_confirm_id: if r['price'] > 0 and r['account_id'] == inv_obj.budget_confir...
account_invoice_tax
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class account_invoice_tax: def move_line_get(self, cr, uid, invoice_id): """Check the budget_confermation_id in particular invoice and update tax line move by it or set False. @param invoice_id : id for invoice @return: dictionary of values to be updated""" <|body_0|> def compute(...
stack_v2_sparse_classes_10k_train_003277
6,435
no_license
[ { "docstring": "Check the budget_confermation_id in particular invoice and update tax line move by it or set False. @param invoice_id : id for invoice @return: dictionary of values to be updated", "name": "move_line_get", "signature": "def move_line_get(self, cr, uid, invoice_id)" }, { "docstrin...
2
null
Implement the Python class `account_invoice_tax` described below. Class description: Implement the account_invoice_tax class. Method signatures and docstrings: - def move_line_get(self, cr, uid, invoice_id): Check the budget_confermation_id in particular invoice and update tax line move by it or set False. @param inv...
Implement the Python class `account_invoice_tax` described below. Class description: Implement the account_invoice_tax class. Method signatures and docstrings: - def move_line_get(self, cr, uid, invoice_id): Check the budget_confermation_id in particular invoice and update tax line move by it or set False. @param inv...
0b997095c260d58b026440967fea3a202bef7efb
<|skeleton|> class account_invoice_tax: def move_line_get(self, cr, uid, invoice_id): """Check the budget_confermation_id in particular invoice and update tax line move by it or set False. @param invoice_id : id for invoice @return: dictionary of values to be updated""" <|body_0|> def compute(...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class account_invoice_tax: def move_line_get(self, cr, uid, invoice_id): """Check the budget_confermation_id in particular invoice and update tax line move by it or set False. @param invoice_id : id for invoice @return: dictionary of values to be updated""" inv_obj = self.pool.get('account.invoice')...
the_stack_v2_python_sparse
v_7/Dongola/common/account_invoice_confirmation/invoice.py
musabahmed/baba
train
0
7b05857373af0795a2cddb278e3a79c607fafa69
[ "bsz = ys.size(0)\nseqlen = ys.size(1)\ninputs = ys.narrow(1, 0, seqlen - 1)\nif (ys[:, 0] == self.START_IDX).any():\n raise AssertionError('The Beginning of Sentence token is automatically added to the label in decode_forced, but you included it in the label. This means your model will have a double BOS token, ...
<|body_start_0|> bsz = ys.size(0) seqlen = ys.size(1) inputs = ys.narrow(1, 0, seqlen - 1) if (ys[:, 0] == self.START_IDX).any(): raise AssertionError('The Beginning of Sentence token is automatically added to the label in decode_forced, but you included it in the label. This...
Returns the latent representations in the forward pass. We need the latent representations for the multi-objective computations
TransformerGeneratorReturnLatentModel
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TransformerGeneratorReturnLatentModel: """Returns the latent representations in the forward pass. We need the latent representations for the multi-objective computations""" def decode_forced(self, encoder_states: Tuple[Any], ys: torch.LongTensor) -> Tuple[torch.Tensor, torch.LongTensor, torc...
stack_v2_sparse_classes_10k_train_003278
37,138
permissive
[ { "docstring": "Override TGM.decode_forced to return latent states. Nearly copied verbatim, except for return type.", "name": "decode_forced", "signature": "def decode_forced(self, encoder_states: Tuple[Any], ys: torch.LongTensor) -> Tuple[torch.Tensor, torch.LongTensor, torch.Tensor, torch.BoolTensor]"...
2
null
Implement the Python class `TransformerGeneratorReturnLatentModel` described below. Class description: Returns the latent representations in the forward pass. We need the latent representations for the multi-objective computations Method signatures and docstrings: - def decode_forced(self, encoder_states: Tuple[Any],...
Implement the Python class `TransformerGeneratorReturnLatentModel` described below. Class description: Returns the latent representations in the forward pass. We need the latent representations for the multi-objective computations Method signatures and docstrings: - def decode_forced(self, encoder_states: Tuple[Any],...
e1d899edfb92471552bae153f59ad30aa7fca468
<|skeleton|> class TransformerGeneratorReturnLatentModel: """Returns the latent representations in the forward pass. We need the latent representations for the multi-objective computations""" def decode_forced(self, encoder_states: Tuple[Any], ys: torch.LongTensor) -> Tuple[torch.Tensor, torch.LongTensor, torc...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TransformerGeneratorReturnLatentModel: """Returns the latent representations in the forward pass. We need the latent representations for the multi-objective computations""" def decode_forced(self, encoder_states: Tuple[Any], ys: torch.LongTensor) -> Tuple[torch.Tensor, torch.LongTensor, torch.Tensor, tor...
the_stack_v2_python_sparse
projects/light_whoami/agents/multi_objective.py
facebookresearch/ParlAI
train
10,943
14ee4c15847b4a84087dda703f0040f94a844ab9
[ "transformed_input = []\ntokenized_string = nltk.word_tokenize(input_string)\npos_tagged_tokens = nltk.pos_tag(tokenized_string)\nwordnet_lemmatizer = WordNetLemmatizer()\nfor pos_tagged_token in pos_tagged_tokens:\n word, part_of_speech = pos_tagged_token\n if str(part_of_speech).startswith('N'):\n tr...
<|body_start_0|> transformed_input = [] tokenized_string = nltk.word_tokenize(input_string) pos_tagged_tokens = nltk.pos_tag(tokenized_string) wordnet_lemmatizer = WordNetLemmatizer() for pos_tagged_token in pos_tagged_tokens: word, part_of_speech = pos_tagged_token ...
This class implements lemmatization and is based on an abstract method.
LemmatizationFilePreprocessing
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class LemmatizationFilePreprocessing: """This class implements lemmatization and is based on an abstract method.""" def string_transformation(input_string): """This method returns a string array with the words of the document. It needs to be used for query preprocessing as well.""" ...
stack_v2_sparse_classes_10k_train_003279
6,719
no_license
[ { "docstring": "This method returns a string array with the words of the document. It needs to be used for query preprocessing as well.", "name": "string_transformation", "signature": "def string_transformation(input_string)" }, { "docstring": "This method reads the 20 newsgroup corpus, processe...
3
stack_v2_sparse_classes_30k_train_004702
Implement the Python class `LemmatizationFilePreprocessing` described below. Class description: This class implements lemmatization and is based on an abstract method. Method signatures and docstrings: - def string_transformation(input_string): This method returns a string array with the words of the document. It nee...
Implement the Python class `LemmatizationFilePreprocessing` described below. Class description: This class implements lemmatization and is based on an abstract method. Method signatures and docstrings: - def string_transformation(input_string): This method returns a string array with the words of the document. It nee...
3192cdb4b969e461d389d2cff2063a33d79fa9e2
<|skeleton|> class LemmatizationFilePreprocessing: """This class implements lemmatization and is based on an abstract method.""" def string_transformation(input_string): """This method returns a string array with the words of the document. It needs to be used for query preprocessing as well.""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class LemmatizationFilePreprocessing: """This class implements lemmatization and is based on an abstract method.""" def string_transformation(input_string): """This method returns a string array with the words of the document. It needs to be used for query preprocessing as well.""" transformed_...
the_stack_v2_python_sparse
src/preprocessing/LemmatizationFilePreprocessing.py
IR-WS-TeamProject/LatentSemanticIndexing
train
1
ed94486254899116b94770c0259e0fb6dc50c06d
[ "data_list = []\nresults = self.query.all()\nformatter = date.getLocaleFormatter(self.request, 'date', 'long')\nfor result in results:\n data = {}\n data['qid'] = 'i-' + str(result.parliamentary_item_id)\n if type(result) == domain.AgendaItem:\n g = u' ' + result.group.type + u' ' + result.group.sho...
<|body_start_0|> data_list = [] results = self.query.all() formatter = date.getLocaleFormatter(self.request, 'date', 'long') for result in results: data = {} data['qid'] = 'i-' + str(result.parliamentary_item_id) if type(result) == domain.AgendaItem: ...
Group parliamentary items per stage e.g. action required, in progress, answered/debated, "dead" (withdrawn, elapsed, inadmissible, dropped).
OwnedItemsInStageViewlet
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class OwnedItemsInStageViewlet: """Group parliamentary items per stage e.g. action required, in progress, answered/debated, "dead" (withdrawn, elapsed, inadmissible, dropped).""" def _setData(self): """Return the data of the query.""" <|body_0|> def update(self): """Re...
stack_v2_sparse_classes_10k_train_003280
27,657
no_license
[ { "docstring": "Return the data of the query.", "name": "_setData", "signature": "def _setData(self)" }, { "docstring": "Refresh the query.", "name": "update", "signature": "def update(self)" } ]
2
stack_v2_sparse_classes_30k_train_005449
Implement the Python class `OwnedItemsInStageViewlet` described below. Class description: Group parliamentary items per stage e.g. action required, in progress, answered/debated, "dead" (withdrawn, elapsed, inadmissible, dropped). Method signatures and docstrings: - def _setData(self): Return the data of the query. -...
Implement the Python class `OwnedItemsInStageViewlet` described below. Class description: Group parliamentary items per stage e.g. action required, in progress, answered/debated, "dead" (withdrawn, elapsed, inadmissible, dropped). Method signatures and docstrings: - def _setData(self): Return the data of the query. -...
5cf0ba31dfbff8d2c1b4aa8ab6f69c7a0ae9870d
<|skeleton|> class OwnedItemsInStageViewlet: """Group parliamentary items per stage e.g. action required, in progress, answered/debated, "dead" (withdrawn, elapsed, inadmissible, dropped).""" def _setData(self): """Return the data of the query.""" <|body_0|> def update(self): """Re...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class OwnedItemsInStageViewlet: """Group parliamentary items per stage e.g. action required, in progress, answered/debated, "dead" (withdrawn, elapsed, inadmissible, dropped).""" def _setData(self): """Return the data of the query.""" data_list = [] results = self.query.all() fo...
the_stack_v2_python_sparse
bungeni.main/branches/mr/bungeni/ui/viewlets/workspace.py
malangalanga/bungeni-portal
train
0
d289e5547441ca375772b60e966cb0cf439913fb
[ "super().__init__()\nself.layer_norm = nn.LayerNorm(size, eps=1e-06)\nself.src_src_att = MultiHeadedAttention(num_heads, size, dropout=dropout)\nself.feed_forward = PositionwiseFeedForward(size, ff_size=ff_size, dropout=dropout, alpha=alpha, layer_norm=layer_norm, activation=activation)\nself.dropout = nn.Dropout(d...
<|body_start_0|> super().__init__() self.layer_norm = nn.LayerNorm(size, eps=1e-06) self.src_src_att = MultiHeadedAttention(num_heads, size, dropout=dropout) self.feed_forward = PositionwiseFeedForward(size, ff_size=ff_size, dropout=dropout, alpha=alpha, layer_norm=layer_norm, activation...
One Transformer encoder layer has a Multi-head attention layer plus a position-wise feed-forward layer.
TransformerEncoderLayer
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class TransformerEncoderLayer: """One Transformer encoder layer has a Multi-head attention layer plus a position-wise feed-forward layer.""" def __init__(self, size: int=0, ff_size: int=0, num_heads: int=0, dropout: float=0.1, alpha: float=1.0, layer_norm: str='post', activation: str='relu') -> No...
stack_v2_sparse_classes_10k_train_003281
13,169
permissive
[ { "docstring": "A single Transformer encoder layer. Note: don't change the name or the order of members! otherwise pretrained models cannot be loaded correctly. :param size: model dimensionality :param ff_size: size of the feed-forward intermediate layer :param num_heads: number of heads :param dropout: dropout...
2
stack_v2_sparse_classes_30k_train_005195
Implement the Python class `TransformerEncoderLayer` described below. Class description: One Transformer encoder layer has a Multi-head attention layer plus a position-wise feed-forward layer. Method signatures and docstrings: - def __init__(self, size: int=0, ff_size: int=0, num_heads: int=0, dropout: float=0.1, alp...
Implement the Python class `TransformerEncoderLayer` described below. Class description: One Transformer encoder layer has a Multi-head attention layer plus a position-wise feed-forward layer. Method signatures and docstrings: - def __init__(self, size: int=0, ff_size: int=0, num_heads: int=0, dropout: float=0.1, alp...
0968187ac0968007cabebed5e5cb6587c08dff78
<|skeleton|> class TransformerEncoderLayer: """One Transformer encoder layer has a Multi-head attention layer plus a position-wise feed-forward layer.""" def __init__(self, size: int=0, ff_size: int=0, num_heads: int=0, dropout: float=0.1, alpha: float=1.0, layer_norm: str='post', activation: str='relu') -> No...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class TransformerEncoderLayer: """One Transformer encoder layer has a Multi-head attention layer plus a position-wise feed-forward layer.""" def __init__(self, size: int=0, ff_size: int=0, num_heads: int=0, dropout: float=0.1, alpha: float=1.0, layer_norm: str='post', activation: str='relu') -> None: "...
the_stack_v2_python_sparse
joeynmt/transformer_layers.py
joeynmt/joeynmt
train
668
fa560333820b24d62886d62643e19cecd46f93d3
[ "if root is None:\n return None\nbroot = TreeNode(root.val)\nnode = broot\nfor i, child in enumerate(root.children):\n new_node = self.encode(child)\n if i == 0:\n broot.left = new_node\n node = broot.left\n else:\n node.right = new_node\n node = node.right\nreturn broot", ...
<|body_start_0|> if root is None: return None broot = TreeNode(root.val) node = broot for i, child in enumerate(root.children): new_node = self.encode(child) if i == 0: broot.left = new_node node = broot.left ...
Codec
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Codec: def encode(self, root): """Encodes an n-ary tree to a binary tree. :type root: Node :rtype: TreeNode""" <|body_0|> def decode(self, data): """Decodes your binary tree to an n-ary tree. :type data: TreeNode :rtype: Node""" <|body_1|> <|end_skeleton|> ...
stack_v2_sparse_classes_10k_train_003282
2,836
no_license
[ { "docstring": "Encodes an n-ary tree to a binary tree. :type root: Node :rtype: TreeNode", "name": "encode", "signature": "def encode(self, root)" }, { "docstring": "Decodes your binary tree to an n-ary tree. :type data: TreeNode :rtype: Node", "name": "decode", "signature": "def decode...
2
null
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def encode(self, root): Encodes an n-ary tree to a binary tree. :type root: Node :rtype: TreeNode - def decode(self, data): Decodes your binary tree to an n-ary tree. :type data: TreeN...
Implement the Python class `Codec` described below. Class description: Implement the Codec class. Method signatures and docstrings: - def encode(self, root): Encodes an n-ary tree to a binary tree. :type root: Node :rtype: TreeNode - def decode(self, data): Decodes your binary tree to an n-ary tree. :type data: TreeN...
a5cb862f0c5a3cfd21468141800568c2dedded0a
<|skeleton|> class Codec: def encode(self, root): """Encodes an n-ary tree to a binary tree. :type root: Node :rtype: TreeNode""" <|body_0|> def decode(self, data): """Decodes your binary tree to an n-ary tree. :type data: TreeNode :rtype: Node""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Codec: def encode(self, root): """Encodes an n-ary tree to a binary tree. :type root: Node :rtype: TreeNode""" if root is None: return None broot = TreeNode(root.val) node = broot for i, child in enumerate(root.children): new_node = self.encode(c...
the_stack_v2_python_sparse
python/leetcode/tree/431_nary_bin_tree.py
Levintsky/topcoder
train
0
8848485f64fe45a228b309280e6f28c046356aec
[ "self.table = DBFetcher(dot_t_system_dir, 'db', 'admin').fetch()\nself.ssid_hash = None\nself.password_hash = None\nself.private_key = None\nself.get_keys()", "ssid_hash = hashlib.sha256(ssid.encode()).hexdigest()\npassword_hash = hashlib.sha256(password.encode()).hexdigest()\npublic_key = hashlib.sha256((ssid + ...
<|body_start_0|> self.table = DBFetcher(dot_t_system_dir, 'db', 'admin').fetch() self.ssid_hash = None self.password_hash = None self.private_key = None self.get_keys() <|end_body_0|> <|body_start_1|> ssid_hash = hashlib.sha256(ssid.encode()).hexdigest() password...
Class to define an administrator for managing admin authentication keys of tracking system. This class provides necessary initiations and functions named :func:`t_system.administration.Administrator.change_keys` for changing admin entry keys.
Administrator
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Administrator: """Class to define an administrator for managing admin authentication keys of tracking system. This class provides necessary initiations and functions named :func:`t_system.administration.Administrator.change_keys` for changing admin entry keys.""" def __init__(self): ...
stack_v2_sparse_classes_10k_train_003283
4,830
permissive
[ { "docstring": "Initialization method of :class:`t_system.administration.Administrator` class.", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "The high-level method to change keys of secret entry point for root authorized. 2 key(ssid and password) authentication uses s...
5
stack_v2_sparse_classes_30k_train_004100
Implement the Python class `Administrator` described below. Class description: Class to define an administrator for managing admin authentication keys of tracking system. This class provides necessary initiations and functions named :func:`t_system.administration.Administrator.change_keys` for changing admin entry key...
Implement the Python class `Administrator` described below. Class description: Class to define an administrator for managing admin authentication keys of tracking system. This class provides necessary initiations and functions named :func:`t_system.administration.Administrator.change_keys` for changing admin entry key...
a9d63fbbdc208c578d6a6153bf2ba13142b3c7a5
<|skeleton|> class Administrator: """Class to define an administrator for managing admin authentication keys of tracking system. This class provides necessary initiations and functions named :func:`t_system.administration.Administrator.change_keys` for changing admin entry keys.""" def __init__(self): ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Administrator: """Class to define an administrator for managing admin authentication keys of tracking system. This class provides necessary initiations and functions named :func:`t_system.administration.Administrator.change_keys` for changing admin entry keys.""" def __init__(self): """Initializa...
the_stack_v2_python_sparse
t_system/administration.py
ahmetishakoglu/T_System
train
0
f1bc9e874854f5453cd4abb36f23f2852c9c966a
[ "dp = [0] * (n - 1)\ndp[0] = 1\nfor i in range(3, n + 1):\n for j in range(1, i):\n if i - j < 2:\n if j * (i - j) > dp[i - 2]:\n dp[i - 2] = j * (i - j)\n elif j * dp[i - j - 2] > dp[i - 2] or j * (i - j) > dp[i - 2]:\n dp[i - 2] = j * max(dp[i - j - 2], i - j)...
<|body_start_0|> dp = [0] * (n - 1) dp[0] = 1 for i in range(3, n + 1): for j in range(1, i): if i - j < 2: if j * (i - j) > dp[i - 2]: dp[i - 2] = j * (i - j) elif j * dp[i - j - 2] > dp[i - 2] or j * (i - j...
Solution
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Solution: def integerBreak(self, n): """:type n: int :rtype: int""" <|body_0|> def integerBreak2(self, n: int) -> int: """dp[i] is the maximum product for number i""" <|body_1|> <|end_skeleton|> <|body_start_0|> dp = [0] * (n - 1) dp[0] = 1 ...
stack_v2_sparse_classes_10k_train_003284
1,299
no_license
[ { "docstring": ":type n: int :rtype: int", "name": "integerBreak", "signature": "def integerBreak(self, n)" }, { "docstring": "dp[i] is the maximum product for number i", "name": "integerBreak2", "signature": "def integerBreak2(self, n: int) -> int" } ]
2
null
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def integerBreak(self, n): :type n: int :rtype: int - def integerBreak2(self, n: int) -> int: dp[i] is the maximum product for number i
Implement the Python class `Solution` described below. Class description: Implement the Solution class. Method signatures and docstrings: - def integerBreak(self, n): :type n: int :rtype: int - def integerBreak2(self, n: int) -> int: dp[i] is the maximum product for number i <|skeleton|> class Solution: def int...
a5b02044ef39154b6a8d32eb57682f447e1632ba
<|skeleton|> class Solution: def integerBreak(self, n): """:type n: int :rtype: int""" <|body_0|> def integerBreak2(self, n: int) -> int: """dp[i] is the maximum product for number i""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Solution: def integerBreak(self, n): """:type n: int :rtype: int""" dp = [0] * (n - 1) dp[0] = 1 for i in range(3, n + 1): for j in range(1, i): if i - j < 2: if j * (i - j) > dp[i - 2]: dp[i - 2] = j * (i ...
the_stack_v2_python_sparse
algo/dp/integer_break.py
xys234/coding-problems
train
0
9565296ffe8b13b3a1d30861232a122b09913af4
[ "super().__init__(x_ref=x_ref, p_val=p_val, x_ref_preprocessed=x_ref_preprocessed, preprocess_at_init=preprocess_at_init, update_x_ref=update_x_ref, preprocess_fn=preprocess_fn, correction=correction, n_features=n_features, input_shape=input_shape, data_type=data_type)\nself._set_config(locals())\nself.alternative ...
<|body_start_0|> super().__init__(x_ref=x_ref, p_val=p_val, x_ref_preprocessed=x_ref_preprocessed, preprocess_at_init=preprocess_at_init, update_x_ref=update_x_ref, preprocess_fn=preprocess_fn, correction=correction, n_features=n_features, input_shape=input_shape, data_type=data_type) self._set_config(l...
KSDrift
[ "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class KSDrift: def __init__(self, x_ref: Union[np.ndarray, list], p_val: float=0.05, x_ref_preprocessed: bool=False, preprocess_at_init: bool=True, update_x_ref: Optional[Dict[str, int]]=None, preprocess_fn: Optional[Callable]=None, correction: str='bonferroni', alternative: str='two-sided', n_feature...
stack_v2_sparse_classes_10k_train_003285
4,384
permissive
[ { "docstring": "Kolmogorov-Smirnov (K-S) data drift detector with Bonferroni or False Discovery Rate (FDR) correction for multivariate data. Parameters ---------- x_ref Data used as reference distribution. p_val p-value used for significance of the K-S test for each feature. If the FDR correction method is used...
2
stack_v2_sparse_classes_30k_train_005056
Implement the Python class `KSDrift` described below. Class description: Implement the KSDrift class. Method signatures and docstrings: - def __init__(self, x_ref: Union[np.ndarray, list], p_val: float=0.05, x_ref_preprocessed: bool=False, preprocess_at_init: bool=True, update_x_ref: Optional[Dict[str, int]]=None, pr...
Implement the Python class `KSDrift` described below. Class description: Implement the KSDrift class. Method signatures and docstrings: - def __init__(self, x_ref: Union[np.ndarray, list], p_val: float=0.05, x_ref_preprocessed: bool=False, preprocess_at_init: bool=True, update_x_ref: Optional[Dict[str, int]]=None, pr...
4a1b4f74a8590117965421e86c2295bff0f33e89
<|skeleton|> class KSDrift: def __init__(self, x_ref: Union[np.ndarray, list], p_val: float=0.05, x_ref_preprocessed: bool=False, preprocess_at_init: bool=True, update_x_ref: Optional[Dict[str, int]]=None, preprocess_fn: Optional[Callable]=None, correction: str='bonferroni', alternative: str='two-sided', n_feature...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class KSDrift: def __init__(self, x_ref: Union[np.ndarray, list], p_val: float=0.05, x_ref_preprocessed: bool=False, preprocess_at_init: bool=True, update_x_ref: Optional[Dict[str, int]]=None, preprocess_fn: Optional[Callable]=None, correction: str='bonferroni', alternative: str='two-sided', n_features: Optional[in...
the_stack_v2_python_sparse
alibi_detect/cd/ks.py
SeldonIO/alibi-detect
train
1,922
403ffb5ab3253633b53379f50780ec39dd120a40
[ "self._AMPLIFIER_CHANNELS = []\nself._AUX_CHANNELS = []\nself._SUPPLY_VOLTAGE_CHANNELS = []\nself._ADC_INPUT_CHANNELS = []\nself._DIGITAL_INPUT_CHANNELS = []\nself._TEMP_SENSORS = 0\nself.rhd = rhd_file\nself.readHead()\nself.readBlocks()", "filesize = self.rhd.tell()\nself.header_identifier = hex(np.uint32(struc...
<|body_start_0|> self._AMPLIFIER_CHANNELS = [] self._AUX_CHANNELS = [] self._SUPPLY_VOLTAGE_CHANNELS = [] self._ADC_INPUT_CHANNELS = [] self._DIGITAL_INPUT_CHANNELS = [] self._TEMP_SENSORS = 0 self.rhd = rhd_file self.readHead() self.readBlocks() <...
RHD
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class RHD: def __init__(self, rhd_file): """Constructor takes in open file object you can use use RHD.openRhd(file_path) to follow python convention""" <|body_0|> def readHead(self): """Reads all header data from the rhd file creates signal group and channel list""" ...
stack_v2_sparse_classes_10k_train_003286
12,179
permissive
[ { "docstring": "Constructor takes in open file object you can use use RHD.openRhd(file_path) to follow python convention", "name": "__init__", "signature": "def __init__(self, rhd_file)" }, { "docstring": "Reads all header data from the rhd file creates signal group and channel list", "name"...
3
stack_v2_sparse_classes_30k_train_005973
Implement the Python class `RHD` described below. Class description: Implement the RHD class. Method signatures and docstrings: - def __init__(self, rhd_file): Constructor takes in open file object you can use use RHD.openRhd(file_path) to follow python convention - def readHead(self): Reads all header data from the ...
Implement the Python class `RHD` described below. Class description: Implement the RHD class. Method signatures and docstrings: - def __init__(self, rhd_file): Constructor takes in open file object you can use use RHD.openRhd(file_path) to follow python convention - def readHead(self): Reads all header data from the ...
0fdbe834442550117dc9d9c8f611989bb600db62
<|skeleton|> class RHD: def __init__(self, rhd_file): """Constructor takes in open file object you can use use RHD.openRhd(file_path) to follow python convention""" <|body_0|> def readHead(self): """Reads all header data from the rhd file creates signal group and channel list""" ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class RHD: def __init__(self, rhd_file): """Constructor takes in open file object you can use use RHD.openRhd(file_path) to follow python convention""" self._AMPLIFIER_CHANNELS = [] self._AUX_CHANNELS = [] self._SUPPLY_VOLTAGE_CHANNELS = [] self._ADC_INPUT_CHANNELS = [] ...
the_stack_v2_python_sparse
pyhfo/io/RHD.py
britodasilva/pyhfo
train
4
0476ae4a3911cdb57dddab65f194e3502cdc11ad
[ "content = '\\n Hi {{ taster_first_name }},\\n\\n {% if verification_code %}\\n To allow you to enjoy all that Vinely has to offer, we have created a new account for you. Follow the following steps to activate your account.\\n <h3>Activate Account:</h3>\\n <table>\\n <tr>\\...
<|body_start_0|> content = '\n Hi {{ taster_first_name }},\n\n {% if verification_code %}\n To allow you to enjoy all that Vinely has to offer, we have created a new account for you. Follow the following steps to activate your account.\n <h3>Activate Account:</h3>\n <table>\n ...
Migration
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class Migration: def forwards(self, orm): """Write your forwards methods here.""" <|body_0|> def backwards(self, orm): """Write your backwards methods here.""" <|body_1|> <|end_skeleton|> <|body_start_0|> content = '\n Hi {{ taster_first_name }},\n...
stack_v2_sparse_classes_10k_train_003287
4,199
no_license
[ { "docstring": "Write your forwards methods here.", "name": "forwards", "signature": "def forwards(self, orm)" }, { "docstring": "Write your backwards methods here.", "name": "backwards", "signature": "def backwards(self, orm)" } ]
2
stack_v2_sparse_classes_30k_train_000404
Implement the Python class `Migration` described below. Class description: Implement the Migration class. Method signatures and docstrings: - def forwards(self, orm): Write your forwards methods here. - def backwards(self, orm): Write your backwards methods here.
Implement the Python class `Migration` described below. Class description: Implement the Migration class. Method signatures and docstrings: - def forwards(self, orm): Write your forwards methods here. - def backwards(self, orm): Write your backwards methods here. <|skeleton|> class Migration: def forwards(self,...
c5c7d8a0b1a297e07302870017d3fb03c5dbb009
<|skeleton|> class Migration: def forwards(self, orm): """Write your forwards methods here.""" <|body_0|> def backwards(self, orm): """Write your backwards methods here.""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class Migration: def forwards(self, orm): """Write your forwards methods here.""" content = '\n Hi {{ taster_first_name }},\n\n {% if verification_code %}\n To allow you to enjoy all that Vinely has to offer, we have created a new account for you. Follow the following steps to a...
the_stack_v2_python_sparse
cms/migrations/0016_add_welcome_email_template.py
RSV3/nuvine
train
0
d0c44c99119ac2e02260ff2f0b0d23a3c6d45be4
[ "super().__init__()\nself.temperature = np.sqrt(input_channels)\nself.key_projection = nn.Linear(input_channels, input_channels, bias=False)\nself.value_projection = nn.Linear(input_channels, input_channels, bias=False)\nnn.init.xavier_normal_(self.key_projection.weight)\nnn.init.xavier_normal_(self.value_projectio...
<|body_start_0|> super().__init__() self.temperature = np.sqrt(input_channels) self.key_projection = nn.Linear(input_channels, input_channels, bias=False) self.value_projection = nn.Linear(input_channels, input_channels, bias=False) nn.init.xavier_normal_(self.key_projection.weig...
The co-attention network for MHCADDI model.
CoAttention
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class CoAttention: """The co-attention network for MHCADDI model.""" def __init__(self, input_channels: int, output_channels: int, dropout: float=0.1): """Instantiate the co-attention network. :param input_channels: The number of atom features. :param output_channels: The number of output ...
stack_v2_sparse_classes_10k_train_003288
25,672
no_license
[ { "docstring": "Instantiate the co-attention network. :param input_channels: The number of atom features. :param output_channels: The number of output features. :param dropout: Dropout probability.", "name": "__init__", "signature": "def __init__(self, input_channels: int, output_channels: int, dropout:...
3
stack_v2_sparse_classes_30k_train_002971
Implement the Python class `CoAttention` described below. Class description: The co-attention network for MHCADDI model. Method signatures and docstrings: - def __init__(self, input_channels: int, output_channels: int, dropout: float=0.1): Instantiate the co-attention network. :param input_channels: The number of ato...
Implement the Python class `CoAttention` described below. Class description: The co-attention network for MHCADDI model. Method signatures and docstrings: - def __init__(self, input_channels: int, output_channels: int, dropout: float=0.1): Instantiate the co-attention network. :param input_channels: The number of ato...
7e55a422588c1d1e00f35a3d3a3ff896cce59e18
<|skeleton|> class CoAttention: """The co-attention network for MHCADDI model.""" def __init__(self, input_channels: int, output_channels: int, dropout: float=0.1): """Instantiate the co-attention network. :param input_channels: The number of atom features. :param output_channels: The number of output ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class CoAttention: """The co-attention network for MHCADDI model.""" def __init__(self, input_channels: int, output_channels: int, dropout: float=0.1): """Instantiate the co-attention network. :param input_channels: The number of atom features. :param output_channels: The number of output features. :pa...
the_stack_v2_python_sparse
generated/test_AstraZeneca_chemicalx.py
jansel/pytorch-jit-paritybench
train
35
c76fba554f512659a11a840dc3882b22a4bd8eef
[ "sizes = list(input.size())\nsizes[0] = total_batch_size\noutput = input.new_zeros(*sizes)\noutput.index_copy_(0, non_pad_indices, input)\nctx.save_for_backward(non_pad_indices)\nreturn output", "non_pad_indices, = ctx.saved_tensors\ngrad_input = output_grads.index_select(0, non_pad_indices)\nreturn (grad_input, ...
<|body_start_0|> sizes = list(input.size()) sizes[0] = total_batch_size output = input.new_zeros(*sizes) output.index_copy_(0, non_pad_indices, input) ctx.save_for_backward(non_pad_indices) return output <|end_body_0|> <|body_start_1|> non_pad_indices, = ctx.save...
This function is kinda similar to rnn pad_packed_sequence It remaps nonpadded values for a (N-1)-d tensor into a (N)-d tensor
IndexCopy
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IndexCopy: """This function is kinda similar to rnn pad_packed_sequence It remaps nonpadded values for a (N-1)-d tensor into a (N)-d tensor""" def forward(ctx, input, non_pad_indices, total_batch_size): """:param ctx: :param input: 2D [bsz x ... ] bsz is the total number of elements ...
stack_v2_sparse_classes_10k_train_003289
45,662
permissive
[ { "docstring": ":param ctx: :param input: 2D [bsz x ... ] bsz is the total number of elements after unpadding :param non_pad_indices: bsz * seq_len :param total_batch_size: (int) bsz * seq_len (before unpadding) > bsz :return: In the forward pass we create a new zero tensor and copy the inputs into it based on ...
2
stack_v2_sparse_classes_30k_train_003667
Implement the Python class `IndexCopy` described below. Class description: This function is kinda similar to rnn pad_packed_sequence It remaps nonpadded values for a (N-1)-d tensor into a (N)-d tensor Method signatures and docstrings: - def forward(ctx, input, non_pad_indices, total_batch_size): :param ctx: :param in...
Implement the Python class `IndexCopy` described below. Class description: This function is kinda similar to rnn pad_packed_sequence It remaps nonpadded values for a (N-1)-d tensor into a (N)-d tensor Method signatures and docstrings: - def forward(ctx, input, non_pad_indices, total_batch_size): :param ctx: :param in...
5e1e424d0d9c2135a456e372a2ea9ee49de5bd2c
<|skeleton|> class IndexCopy: """This function is kinda similar to rnn pad_packed_sequence It remaps nonpadded values for a (N-1)-d tensor into a (N)-d tensor""" def forward(ctx, input, non_pad_indices, total_batch_size): """:param ctx: :param input: 2D [bsz x ... ] bsz is the total number of elements ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class IndexCopy: """This function is kinda similar to rnn pad_packed_sequence It remaps nonpadded values for a (N-1)-d tensor into a (N)-d tensor""" def forward(ctx, input, non_pad_indices, total_batch_size): """:param ctx: :param input: 2D [bsz x ... ] bsz is the total number of elements after unpaddi...
the_stack_v2_python_sparse
pretrain_module/modeling_deltalm.py
quanpn90/NMTGMinor
train
92
e2e02221f82041ec26f92af88c2f8c61deb22fa2
[ "old_namespaced_oligotype = NamespacedOligotypesModel.query.filter((NamespacedOligotypesModel.namespace == namespaced_oligotype.namespace) & (NamespacedOligotypesModel.oligotype == namespaced_oligotype.oligotype)).first()\nif old_namespaced_oligotype:\n return (False, from_dict(NamespacedOligotype, old_namespace...
<|body_start_0|> old_namespaced_oligotype = NamespacedOligotypesModel.query.filter((NamespacedOligotypesModel.namespace == namespaced_oligotype.namespace) & (NamespacedOligotypesModel.oligotype == namespaced_oligotype.oligotype)).first() if old_namespaced_oligotype: return (False, from_dict(...
A manager of Namespaced Oligotypes model.
NamespacesdOligotypeRepositoryManager
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NamespacesdOligotypeRepositoryManager: """A manager of Namespaced Oligotypes model.""" def get_or_create(namespaced_oligotype: NamespacedOligotype) -> Tuple[bool, NamespacedOligotype]: """Insert a single record into database. Args: namespaced_oligotype (NamespacedOligotype): A single...
stack_v2_sparse_classes_10k_train_003290
3,211
no_license
[ { "docstring": "Insert a single record into database. Args: namespaced_oligotype (NamespacedOligotype): A single namespaced oligotype entity. Returns: Tuple[bool, NamespacesdOligotype]: A boolean indicating if the namespace was created (True) or recovered from database (False), and a instance of the created nam...
2
stack_v2_sparse_classes_30k_test_000180
Implement the Python class `NamespacesdOligotypeRepositoryManager` described below. Class description: A manager of Namespaced Oligotypes model. Method signatures and docstrings: - def get_or_create(namespaced_oligotype: NamespacedOligotype) -> Tuple[bool, NamespacedOligotype]: Insert a single record into database. A...
Implement the Python class `NamespacesdOligotypeRepositoryManager` described below. Class description: A manager of Namespaced Oligotypes model. Method signatures and docstrings: - def get_or_create(namespaced_oligotype: NamespacedOligotype) -> Tuple[bool, NamespacedOligotype]: Insert a single record into database. A...
5d240fea783a453137c9a3697b67dae67b08a73d
<|skeleton|> class NamespacesdOligotypeRepositoryManager: """A manager of Namespaced Oligotypes model.""" def get_or_create(namespaced_oligotype: NamespacedOligotype) -> Tuple[bool, NamespacedOligotype]: """Insert a single record into database. Args: namespaced_oligotype (NamespacedOligotype): A single...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class NamespacesdOligotypeRepositoryManager: """A manager of Namespaced Oligotypes model.""" def get_or_create(namespaced_oligotype: NamespacedOligotype) -> Tuple[bool, NamespacedOligotype]: """Insert a single record into database. Args: namespaced_oligotype (NamespacedOligotype): A single namespaced o...
the_stack_v2_python_sparse
src/adapters/repositories/oligotype_link.py
sgelias/blu
train
0
71810d4ab61c3807d87baae1f7679e9739d71cff
[ "test_layer = talking_heads_attention.TalkingHeadsAttention(num_heads=12, key_size=64)\nfrom_tensor = tf.keras.Input(shape=(40, 80))\nto_tensor = tf.keras.Input(shape=(20, 80))\noutput = test_layer([from_tensor, to_tensor])\nself.assertEqual(output.shape.as_list(), [None, 40, 80])", "test_layer = talking_heads_at...
<|body_start_0|> test_layer = talking_heads_attention.TalkingHeadsAttention(num_heads=12, key_size=64) from_tensor = tf.keras.Input(shape=(40, 80)) to_tensor = tf.keras.Input(shape=(20, 80)) output = test_layer([from_tensor, to_tensor]) self.assertEqual(output.shape.as_list(), [N...
MultiHeadAttentionTest
[ "MIT", "Apache-2.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class MultiHeadAttentionTest: def test_non_masked_attention(self): """Test that the attention layer can be created without a mask tensor.""" <|body_0|> def test_non_masked_self_attention(self): """Test with one input (self-attenntion) and no mask tensor.""" <|body_...
stack_v2_sparse_classes_10k_train_003291
4,090
permissive
[ { "docstring": "Test that the attention layer can be created without a mask tensor.", "name": "test_non_masked_attention", "signature": "def test_non_masked_attention(self)" }, { "docstring": "Test with one input (self-attenntion) and no mask tensor.", "name": "test_non_masked_self_attention...
4
null
Implement the Python class `MultiHeadAttentionTest` described below. Class description: Implement the MultiHeadAttentionTest class. Method signatures and docstrings: - def test_non_masked_attention(self): Test that the attention layer can be created without a mask tensor. - def test_non_masked_self_attention(self): T...
Implement the Python class `MultiHeadAttentionTest` described below. Class description: Implement the MultiHeadAttentionTest class. Method signatures and docstrings: - def test_non_masked_attention(self): Test that the attention layer can be created without a mask tensor. - def test_non_masked_self_attention(self): T...
a115d918f6894a69586174653172be0b5d1de952
<|skeleton|> class MultiHeadAttentionTest: def test_non_masked_attention(self): """Test that the attention layer can be created without a mask tensor.""" <|body_0|> def test_non_masked_self_attention(self): """Test with one input (self-attenntion) and no mask tensor.""" <|body_...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class MultiHeadAttentionTest: def test_non_masked_attention(self): """Test that the attention layer can be created without a mask tensor.""" test_layer = talking_heads_attention.TalkingHeadsAttention(num_heads=12, key_size=64) from_tensor = tf.keras.Input(shape=(40, 80)) to_tensor = ...
the_stack_v2_python_sparse
models/official/nlp/modeling/layers/talking_heads_attention_test.py
finnickniu/tensorflow_object_detection_tflite
train
60
fe699ee0cbe2831fdfd71707a98ae51fba00b641
[ "logging.info('## SETUP METHOD ##')\nlogging.info('# Initializing the webdriver.')\nself.ffprofile = self.create_ffprofile()\nself.driver = webdriver.Firefox(self.ffprofile)\nself.driver.maximize_window()\nself.driver.implicitly_wait(5)\nself.driver.get('http://the-internet.herokuapp.com/')", "logging.info('## TE...
<|body_start_0|> logging.info('## SETUP METHOD ##') logging.info('# Initializing the webdriver.') self.ffprofile = self.create_ffprofile() self.driver = webdriver.Firefox(self.ffprofile) self.driver.maximize_window() self.driver.implicitly_wait(5) self.driver.get(...
This class is for instantiating web driver instances.
DriverManagerFirefox
[ "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class DriverManagerFirefox: """This class is for instantiating web driver instances.""" def setUp(self): """This method is to instantiate the web driver instance.""" <|body_0|> def tearDown(self): """This is teardown method. It is to capture the screenshots for failed ...
stack_v2_sparse_classes_10k_train_003292
3,946
permissive
[ { "docstring": "This method is to instantiate the web driver instance.", "name": "setUp", "signature": "def setUp(self)" }, { "docstring": "This is teardown method. It is to capture the screenshots for failed test cases, & to remove web driver object.", "name": "tearDown", "signature": "...
4
stack_v2_sparse_classes_30k_train_003729
Implement the Python class `DriverManagerFirefox` described below. Class description: This class is for instantiating web driver instances. Method signatures and docstrings: - def setUp(self): This method is to instantiate the web driver instance. - def tearDown(self): This is teardown method. It is to capture the sc...
Implement the Python class `DriverManagerFirefox` described below. Class description: This class is for instantiating web driver instances. Method signatures and docstrings: - def setUp(self): This method is to instantiate the web driver instance. - def tearDown(self): This is teardown method. It is to capture the sc...
65513cb85eccb1ae3fae4ac3625d0e6878720ec8
<|skeleton|> class DriverManagerFirefox: """This class is for instantiating web driver instances.""" def setUp(self): """This method is to instantiate the web driver instance.""" <|body_0|> def tearDown(self): """This is teardown method. It is to capture the screenshots for failed ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class DriverManagerFirefox: """This class is for instantiating web driver instances.""" def setUp(self): """This method is to instantiate the web driver instance.""" logging.info('## SETUP METHOD ##') logging.info('# Initializing the webdriver.') self.ffprofile = self.create_ffp...
the_stack_v2_python_sparse
attic/2019/contributions-2019/open/mudaliar-yptu/PWAF/utility/drivermanager.py
Agriad/devops-course
train
0
8fb7a4d6d30caf511926517ede2956aeb46c728c
[ "if not self.caller.location or not self.caller.location.allow_combat:\n self.msg(\"Can't fight here!\")\n raise InterruptCommand()", "self.args = args = self.args.strip()\nself.lhs, self.rhs = ('', '')\nif not args:\n return\nif ' on ' in args:\n lhs, rhs = args.split(' on ', 1)\nelse:\n lhs, *rhs...
<|body_start_0|> if not self.caller.location or not self.caller.location.allow_combat: self.msg("Can't fight here!") raise InterruptCommand() <|end_body_0|> <|body_start_1|> self.args = args = self.args.strip() self.lhs, self.rhs = ('', '') if not args: ...
Parent class for all twitch-combat commnads.
_BaseTwitchCombatCommand
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference", "CC-BY-4.0", "CC-BY-3.0" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _BaseTwitchCombatCommand: """Parent class for all twitch-combat commnads.""" def at_pre_command(self): """Called before parsing.""" <|body_0|> def parse(self): """Handle parsing of most supported combat syntaxes (except stunts). <action> [<target>|<item>] or <act...
stack_v2_sparse_classes_10k_train_003293
18,175
permissive
[ { "docstring": "Called before parsing.", "name": "at_pre_command", "signature": "def at_pre_command(self)" }, { "docstring": "Handle parsing of most supported combat syntaxes (except stunts). <action> [<target>|<item>] or <action> <item> [on] <target> Use 'on' to differentiate if names/items hav...
3
stack_v2_sparse_classes_30k_train_001154
Implement the Python class `_BaseTwitchCombatCommand` described below. Class description: Parent class for all twitch-combat commnads. Method signatures and docstrings: - def at_pre_command(self): Called before parsing. - def parse(self): Handle parsing of most supported combat syntaxes (except stunts). <action> [<ta...
Implement the Python class `_BaseTwitchCombatCommand` described below. Class description: Parent class for all twitch-combat commnads. Method signatures and docstrings: - def at_pre_command(self): Called before parsing. - def parse(self): Handle parsing of most supported combat syntaxes (except stunts). <action> [<ta...
b3ca58b5c1325a3bf57051dfe23560a08d2947b7
<|skeleton|> class _BaseTwitchCombatCommand: """Parent class for all twitch-combat commnads.""" def at_pre_command(self): """Called before parsing.""" <|body_0|> def parse(self): """Handle parsing of most supported combat syntaxes (except stunts). <action> [<target>|<item>] or <act...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class _BaseTwitchCombatCommand: """Parent class for all twitch-combat commnads.""" def at_pre_command(self): """Called before parsing.""" if not self.caller.location or not self.caller.location.allow_combat: self.msg("Can't fight here!") raise InterruptCommand() def...
the_stack_v2_python_sparse
evennia/contrib/tutorials/evadventure/combat_twitch.py
evennia/evennia
train
1,781
eeb63cd79be481d770dd81c851b08af8896b5f78
[ "for i, c in enumerate(self.children):\n if c in ('elif', 'if'):\n yield self.children[i + 1]", "start_pos = node.start_pos\nfor check_node in reversed(list(self.get_test_nodes())):\n if check_node.start_pos < start_pos:\n if start_pos < check_node.end_pos:\n return None\n el...
<|body_start_0|> for i, c in enumerate(self.children): if c in ('elif', 'if'): yield self.children[i + 1] <|end_body_0|> <|body_start_1|> start_pos = node.start_pos for check_node in reversed(list(self.get_test_nodes())): if check_node.start_pos < start_p...
IfStmt
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "Python-2.0", "MIT" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class IfStmt: def get_test_nodes(self): """E.g. returns all the `test` nodes that are named as x, below: if x: pass elif x: pass""" <|body_0|> def get_corresponding_test_node(self, node): """Searches for the branch in which the node is and returns the corresponding test no...
stack_v2_sparse_classes_10k_train_003294
38,111
permissive
[ { "docstring": "E.g. returns all the `test` nodes that are named as x, below: if x: pass elif x: pass", "name": "get_test_nodes", "signature": "def get_test_nodes(self)" }, { "docstring": "Searches for the branch in which the node is and returns the corresponding test node (see function above). ...
3
stack_v2_sparse_classes_30k_train_000784
Implement the Python class `IfStmt` described below. Class description: Implement the IfStmt class. Method signatures and docstrings: - def get_test_nodes(self): E.g. returns all the `test` nodes that are named as x, below: if x: pass elif x: pass - def get_corresponding_test_node(self, node): Searches for the branch...
Implement the Python class `IfStmt` described below. Class description: Implement the IfStmt class. Method signatures and docstrings: - def get_test_nodes(self): E.g. returns all the `test` nodes that are named as x, below: if x: pass elif x: pass - def get_corresponding_test_node(self, node): Searches for the branch...
f5042e35b945aded77b23470ead62d7eacefde92
<|skeleton|> class IfStmt: def get_test_nodes(self): """E.g. returns all the `test` nodes that are named as x, below: if x: pass elif x: pass""" <|body_0|> def get_corresponding_test_node(self, node): """Searches for the branch in which the node is and returns the corresponding test no...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class IfStmt: def get_test_nodes(self): """E.g. returns all the `test` nodes that are named as x, below: if x: pass elif x: pass""" for i, c in enumerate(self.children): if c in ('elif', 'if'): yield self.children[i + 1] def get_corresponding_test_node(self, node): ...
the_stack_v2_python_sparse
contrib/python/parso/py2/parso/python/tree.py
catboost/catboost
train
8,012
3bc51fd4e9886015bddf3648900f7dfb567a5d2c
[ "result = empty_result()\ntry:\n result['data'] = {'interface_status': get_interface_states(hostname)}\nexcept ValueError as e:\n return (empty_result('error', 'Could not get interface states, invalid input: {}'.format(e)), 400)\nexcept Exception as e:\n return (empty_result('error', 'Could not get interfa...
<|body_start_0|> result = empty_result() try: result['data'] = {'interface_status': get_interface_states(hostname)} except ValueError as e: return (empty_result('error', 'Could not get interface states, invalid input: {}'.format(e)), 400) except Exception as e: ...
InterfaceStatusApi
[ "BSD-2-Clause-Views", "BSD-2-Clause", "LicenseRef-scancode-unknown-license-reference" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class InterfaceStatusApi: def get(self, hostname): """List all interfaces status""" <|body_0|> def put(self, hostname): """Bounce selected interfaces by appling bounce-down/bounce-up template""" <|body_1|> <|end_skeleton|> <|body_start_0|> result = empty_...
stack_v2_sparse_classes_10k_train_003295
15,267
permissive
[ { "docstring": "List all interfaces status", "name": "get", "signature": "def get(self, hostname)" }, { "docstring": "Bounce selected interfaces by appling bounce-down/bounce-up template", "name": "put", "signature": "def put(self, hostname)" } ]
2
stack_v2_sparse_classes_30k_train_002931
Implement the Python class `InterfaceStatusApi` described below. Class description: Implement the InterfaceStatusApi class. Method signatures and docstrings: - def get(self, hostname): List all interfaces status - def put(self, hostname): Bounce selected interfaces by appling bounce-down/bounce-up template
Implement the Python class `InterfaceStatusApi` described below. Class description: Implement the InterfaceStatusApi class. Method signatures and docstrings: - def get(self, hostname): List all interfaces status - def put(self, hostname): Bounce selected interfaces by appling bounce-down/bounce-up template <|skeleto...
d755dfed69bebe0c7bea66ad1802cba2cd89fec8
<|skeleton|> class InterfaceStatusApi: def get(self, hostname): """List all interfaces status""" <|body_0|> def put(self, hostname): """Bounce selected interfaces by appling bounce-down/bounce-up template""" <|body_1|> <|end_skeleton|>
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class InterfaceStatusApi: def get(self, hostname): """List all interfaces status""" result = empty_result() try: result['data'] = {'interface_status': get_interface_states(hostname)} except ValueError as e: return (empty_result('error', 'Could not get interfac...
the_stack_v2_python_sparse
src/cnaas_nms/api/interface.py
SUNET/cnaas-nms
train
67
29f3e0e062ddc3c18932731cc60e0b00375b22bf
[ "res = super(cost_revaluation, self).default_get(cr, uid, fields, context=context)\naccount_data = self.pool.get('account.invoice').browse(cr, uid, context.get('active_id'), context=context)\nresult = []\nfor line in account_data.invoice_line:\n if line.product_id and line.prod_lot_id:\n result.append({'i...
<|body_start_0|> res = super(cost_revaluation, self).default_get(cr, uid, fields, context=context) account_data = self.pool.get('account.invoice').browse(cr, uid, context.get('active_id'), context=context) result = [] for line in account_data.invoice_line: if line.product_id ...
cost_revaluation
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class cost_revaluation: def default_get(self, cr, uid, fields, context=None): """Get the default value from invoice line ---------------------------------------- @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param fields: A List o...
stack_v2_sparse_classes_10k_train_003296
6,683
no_license
[ { "docstring": "Get the default value from invoice line ---------------------------------------- @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param fields: A List of fields @param context: A standard dictionary @return: Return a dictionary which h...
2
stack_v2_sparse_classes_30k_train_005206
Implement the Python class `cost_revaluation` described below. Class description: Implement the cost_revaluation class. Method signatures and docstrings: - def default_get(self, cr, uid, fields, context=None): Get the default value from invoice line ---------------------------------------- @param self: The object poi...
Implement the Python class `cost_revaluation` described below. Class description: Implement the cost_revaluation class. Method signatures and docstrings: - def default_get(self, cr, uid, fields, context=None): Get the default value from invoice line ---------------------------------------- @param self: The object poi...
f2b44a8af0e7bee87d52d258fca012bf44ca876f
<|skeleton|> class cost_revaluation: def default_get(self, cr, uid, fields, context=None): """Get the default value from invoice line ---------------------------------------- @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param fields: A List o...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class cost_revaluation: def default_get(self, cr, uid, fields, context=None): """Get the default value from invoice line ---------------------------------------- @param self: The object pointer. @param cr: A database cursor @param uid: ID of the user currently logged in @param fields: A List of fields @para...
the_stack_v2_python_sparse
via_lot_valuation/wizard/cost_revaluation.py
eksotama/prln-via-custom-addons
train
0
5b393a001338ee30598d34b5fa07ad5a691e7e9b
[ "with SIMPLE_FILE_PATH.open() as auth_file:\n for line in auth_file.readlines():\n match = re.match('(^STEAM_[0,1]{1}:[0,1]{1}:[0-9]+)', line)\n if match:\n self.add(match.group(0))", "if uniqueid in self:\n return True\nreturn False" ]
<|body_start_0|> with SIMPLE_FILE_PATH.open() as auth_file: for line in auth_file.readlines(): match = re.match('(^STEAM_[0,1]{1}:[0,1]{1}:[0-9]+)', line) if match: self.add(match.group(0)) <|end_body_0|> <|body_start_1|> if uniqueid in se...
Class used to determine if a player is authorized
_SimpleAuth
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class _SimpleAuth: """Class used to determine if a player is authorized""" def _parse_admins(self): """Method used to get all uniqueids that are authorized on the server""" <|body_0|> def is_player_authorized(self, uniqueid, level, permission, flag): """Method used to ...
stack_v2_sparse_classes_10k_train_003297
2,351
no_license
[ { "docstring": "Method used to get all uniqueids that are authorized on the server", "name": "_parse_admins", "signature": "def _parse_admins(self)" }, { "docstring": "Method used to check if a player is authorized", "name": "is_player_authorized", "signature": "def is_player_authorized(...
2
stack_v2_sparse_classes_30k_train_006177
Implement the Python class `_SimpleAuth` described below. Class description: Class used to determine if a player is authorized Method signatures and docstrings: - def _parse_admins(self): Method used to get all uniqueids that are authorized on the server - def is_player_authorized(self, uniqueid, level, permission, f...
Implement the Python class `_SimpleAuth` described below. Class description: Class used to determine if a player is authorized Method signatures and docstrings: - def _parse_admins(self): Method used to get all uniqueids that are authorized on the server - def is_player_authorized(self, uniqueid, level, permission, f...
b84df87f67ecb0fb2487e68e8b4b6bee3944f506
<|skeleton|> class _SimpleAuth: """Class used to determine if a player is authorized""" def _parse_admins(self): """Method used to get all uniqueids that are authorized on the server""" <|body_0|> def is_player_authorized(self, uniqueid, level, permission, flag): """Method used to ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class _SimpleAuth: """Class used to determine if a player is authorized""" def _parse_admins(self): """Method used to get all uniqueids that are authorized on the server""" with SIMPLE_FILE_PATH.open() as auth_file: for line in auth_file.readlines(): match = re.match...
the_stack_v2_python_sparse
addons/source-python/packages/source-python/auth/providers/simple.py
aurorapar/Source.Python
train
0
006f8088a3c2309deb57ba249ae1c42861322f12
[ "m = re.search(cls.direction_symbol_regex, s)\nif m:\n symbol = m.group(0)\n if symbol[0] == '<' and symbol[-1] == '>':\n return True\n return False\nelse:\n raise MalformattedReactionDirectionSymbolException('Check the directional symbol')", "m = re.match(cls.symbol_regex, symbol)\nif m is Non...
<|body_start_0|> m = re.search(cls.direction_symbol_regex, s) if m: symbol = m.group(0) if symbol[0] == '<' and symbol[-1] == '>': return True return False else: raise MalformattedReactionDirectionSymbolException('Check the directio...
An implementation of ExpressionParser for reading strings and forming
StringExpressionParser
[]
stack_v2_sparse_python_classes_v1
<|skeleton|> class StringExpressionParser: """An implementation of ExpressionParser for reading strings and forming""" def _is_bidirectional(cls, s): """Determines if a reaction is bi-directional based on the symbol between the reactants and products. :param s: a string which is formatted according to ...
stack_v2_sparse_classes_10k_train_003298
8,250
no_license
[ { "docstring": "Determines if a reaction is bi-directional based on the symbol between the reactants and products. :param s: a string which is formatted according to our conventions :return: True or False", "name": "_is_bidirectional", "signature": "def _is_bidirectional(cls, s)" }, { "docstring...
5
stack_v2_sparse_classes_30k_train_000057
Implement the Python class `StringExpressionParser` described below. Class description: An implementation of ExpressionParser for reading strings and forming Method signatures and docstrings: - def _is_bidirectional(cls, s): Determines if a reaction is bi-directional based on the symbol between the reactants and prod...
Implement the Python class `StringExpressionParser` described below. Class description: An implementation of ExpressionParser for reading strings and forming Method signatures and docstrings: - def _is_bidirectional(cls, s): Determines if a reaction is bi-directional based on the symbol between the reactants and prod...
4a625b0b00040a06f2b52ac74d60c636012f1dd4
<|skeleton|> class StringExpressionParser: """An implementation of ExpressionParser for reading strings and forming""" def _is_bidirectional(cls, s): """Determines if a reaction is bi-directional based on the symbol between the reactants and products. :param s: a string which is formatted according to ...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class StringExpressionParser: """An implementation of ExpressionParser for reading strings and forming""" def _is_bidirectional(cls, s): """Determines if a reaction is bi-directional based on the symbol between the reactants and products. :param s: a string which is formatted according to our conventio...
the_stack_v2_python_sparse
src/parsers.py
blawney/mycalc
train
0
01e8bea3c5104e64f7901f6e7a0a6688bb959d12
[ "super().__init__()\nimport sklearn\nimport sklearn.svm\nself.model = sklearn.svm.NuSVC", "specs = super(NuSVC, cls).getInputSpecification()\nspecs.description = 'The \\\\xmlNode{NuSVC} \\\\textit{Nu-Support Vector Classification} is an Nu-Support Vector Classification.\\n It is very si...
<|body_start_0|> super().__init__() import sklearn import sklearn.svm self.model = sklearn.svm.NuSVC <|end_body_0|> <|body_start_1|> specs = super(NuSVC, cls).getInputSpecification() specs.description = 'The \\xmlNode{NuSVC} \\textit{Nu-Support Vector Classification} is ...
Support Vector Classifier
NuSVC
[ "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer", "BSD-2-Clause", "BSD-3-Clause" ]
stack_v2_sparse_python_classes_v1
<|skeleton|> class NuSVC: """Support Vector Classifier""" def __init__(self): """Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None""" <|body_0|> def getInputSpecification(cls): """Method to get a reference to a class that specifies t...
stack_v2_sparse_classes_10k_train_003299
9,261
permissive
[ { "docstring": "Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None", "name": "__init__", "signature": "def __init__(self)" }, { "docstring": "Method to get a reference to a class that specifies the input data for class cls. @ In, cls, the class for...
3
null
Implement the Python class `NuSVC` described below. Class description: Support Vector Classifier Method signatures and docstrings: - def __init__(self): Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None - def getInputSpecification(cls): Method to get a reference to a c...
Implement the Python class `NuSVC` described below. Class description: Support Vector Classifier Method signatures and docstrings: - def __init__(self): Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None - def getInputSpecification(cls): Method to get a reference to a c...
2b16e7aa3325fe84cab2477947a951414c635381
<|skeleton|> class NuSVC: """Support Vector Classifier""" def __init__(self): """Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None""" <|body_0|> def getInputSpecification(cls): """Method to get a reference to a class that specifies t...
stack_v2_sparse_classes_10k
data/stack_v2_sparse_classes_30k
class NuSVC: """Support Vector Classifier""" def __init__(self): """Constructor that will appropriately initialize a supervised learning object @ In, None @ Out, None""" super().__init__() import sklearn import sklearn.svm self.model = sklearn.svm.NuSVC def getInput...
the_stack_v2_python_sparse
ravenframework/SupervisedLearning/ScikitLearn/SVM/NuSVC.py
idaholab/raven
train
201