code
stringlengths
75
104k
docstring
stringlengths
1
46.9k
text
stringlengths
164
112k
def update(self, ipv4s): """ Method to update ipv4's :param ipv4s: List containing ipv4's desired to updated :return: None """ data = {'ips': ipv4s} ipv4s_ids = [str(ipv4.get('id')) for ipv4 in ipv4s] return super(ApiIPv4, self).put('api/v3/ipv4/%s/' % ...
Method to update ipv4's :param ipv4s: List containing ipv4's desired to updated :return: None
Below is the the instruction that describes the task: ### Input: Method to update ipv4's :param ipv4s: List containing ipv4's desired to updated :return: None ### Response: def update(self, ipv4s): """ Method to update ipv4's :param ipv4s: List containing ipv4's desired to...
def first_return_times(dts, c=None, d=0.0): """For an ensemble of time series, return the set of all time intervals between successive returns to value c for all instances in the ensemble. If c is not given, the default is the mean across all times and across all time series in the ensemble. Args: ...
For an ensemble of time series, return the set of all time intervals between successive returns to value c for all instances in the ensemble. If c is not given, the default is the mean across all times and across all time series in the ensemble. Args: dts (DistTimeseries) c (float): Option...
Below is the the instruction that describes the task: ### Input: For an ensemble of time series, return the set of all time intervals between successive returns to value c for all instances in the ensemble. If c is not given, the default is the mean across all times and across all time series in the ens...
def cursor_event(self, x, y, dx, dy): """ The standard mouse movement event method. Can be overriden to add new functionality. By default this feeds the system camera with new values. Args: x: The current mouse x position y: The current mouse y position ...
The standard mouse movement event method. Can be overriden to add new functionality. By default this feeds the system camera with new values. Args: x: The current mouse x position y: The current mouse y position dx: Delta x postion (x position difference from...
Below is the the instruction that describes the task: ### Input: The standard mouse movement event method. Can be overriden to add new functionality. By default this feeds the system camera with new values. Args: x: The current mouse x position y: The current mouse y...
def get_output_content(job_id, max_size=1024, conn=None): """ returns the content buffer for a job_id if that job output exists :param job_id: <str> id for the job :param max_size: <int> truncate after [max_size] bytes :param conn: (optional)<connection> to run on :return: <str> or <bytes> ...
returns the content buffer for a job_id if that job output exists :param job_id: <str> id for the job :param max_size: <int> truncate after [max_size] bytes :param conn: (optional)<connection> to run on :return: <str> or <bytes>
Below is the the instruction that describes the task: ### Input: returns the content buffer for a job_id if that job output exists :param job_id: <str> id for the job :param max_size: <int> truncate after [max_size] bytes :param conn: (optional)<connection> to run on :return: <str> or <bytes> ### R...
def user_activity_stats(self, username, format=None): """ Retrieve the activity stats about a specific user over the last year. Params: username (string): filters the username of the user whose activity you are interested in. format (string): Allows changing the of the d...
Retrieve the activity stats about a specific user over the last year. Params: username (string): filters the username of the user whose activity you are interested in. format (string): Allows changing the of the date/time returned from iso format to unix tim...
Below is the the instruction that describes the task: ### Input: Retrieve the activity stats about a specific user over the last year. Params: username (string): filters the username of the user whose activity you are interested in. format (string): Allows changing the of the date/t...
def identity(ctx, variant_id): """Check how well SVs are working in the database """ if not variant_id: LOG.warning("Please provide a variant id") ctx.abort() adapter = ctx.obj['adapter'] version = ctx.obj['version'] LOG.info("Search variants {0}".format(adapter)) ...
Check how well SVs are working in the database
Below is the the instruction that describes the task: ### Input: Check how well SVs are working in the database ### Response: def identity(ctx, variant_id): """Check how well SVs are working in the database """ if not variant_id: LOG.warning("Please provide a variant id") ctx.a...
def handle(self): """ Executes the command """ database = self.option("database") repository = DatabaseMigrationRepository(self.resolver, "migrations") repository.set_source(database) repository.create_repository() self.info("Migration table created succ...
Executes the command
Below is the the instruction that describes the task: ### Input: Executes the command ### Response: def handle(self): """ Executes the command """ database = self.option("database") repository = DatabaseMigrationRepository(self.resolver, "migrations") repository.set...
def service_status(self, short_name): """Get the current status of a service. Returns information about the service such as the length since the last heartbeat, any status messages that have been posted about the service and whether the heartbeat should be considered out of the ordinary...
Get the current status of a service. Returns information about the service such as the length since the last heartbeat, any status messages that have been posted about the service and whether the heartbeat should be considered out of the ordinary. Args: short_name (string):...
Below is the the instruction that describes the task: ### Input: Get the current status of a service. Returns information about the service such as the length since the last heartbeat, any status messages that have been posted about the service and whether the heartbeat should be considered...
def get_all_allowed_internal_commands(self): """Returns an iterable which includes all allowed commands. This does not mean that a specific command from the result is executable right now in this session state (or that it can be executed at all in this connection). Please note t...
Returns an iterable which includes all allowed commands. This does not mean that a specific command from the result is executable right now in this session state (or that it can be executed at all in this connection). Please note that the returned values are /internal/ commands, not SMT...
Below is the the instruction that describes the task: ### Input: Returns an iterable which includes all allowed commands. This does not mean that a specific command from the result is executable right now in this session state (or that it can be executed at all in this connection). ...
def _syllabify_simplex(word): '''Syllabify the given word.''' word, rules = apply_T1(word) if re.search(r'[^ieAyOauo]*([ieAyOauo]{2})[^ieAyOauo]*', word): word, T2 = apply_T2(word) word, T8 = apply_T8(word) word, T9 = apply_T9(word) rules += T2 + T8 + T9 # T4 produc...
Syllabify the given word.
Below is the the instruction that describes the task: ### Input: Syllabify the given word. ### Response: def _syllabify_simplex(word): '''Syllabify the given word.''' word, rules = apply_T1(word) if re.search(r'[^ieAyOauo]*([ieAyOauo]{2})[^ieAyOauo]*', word): word, T2 = apply_T2(word) ...
def match_field(field_class): """ Iterates the field_classes and returns the first match """ for cls in field_class.mro(): if cls in list(LOOKUP_TABLE.keys()): return cls # could not match the field class raise Exception('{0} None Found '.format(field_class))
Iterates the field_classes and returns the first match
Below is the the instruction that describes the task: ### Input: Iterates the field_classes and returns the first match ### Response: def match_field(field_class): """ Iterates the field_classes and returns the first match """ for cls in field_class.mro(): if cls in list(LOOKUP_TABL...
def get_node(self, path): '''Get a child node of this node, or this node, based on a path. @param path A list of path elements pointing to a node in the tree. For example, ['/', 'localhost', 'dir.host']. The first element in this path should be this node's name. ...
Get a child node of this node, or this node, based on a path. @param path A list of path elements pointing to a node in the tree. For example, ['/', 'localhost', 'dir.host']. The first element in this path should be this node's name. @return The node pointed to b...
Below is the the instruction that describes the task: ### Input: Get a child node of this node, or this node, based on a path. @param path A list of path elements pointing to a node in the tree. For example, ['/', 'localhost', 'dir.host']. The first element in this p...
def get_href(self): """Convert path to a URL that can be passed to XML responses. Byte string, UTF-8 encoded, quoted. See http://www.webdav.org/specs/rfc4918.html#rfc.section.8.3 We are using the path-absolute option. i.e. starting with '/'. URI ; See section 3.2.1 of [RFC2068]...
Convert path to a URL that can be passed to XML responses. Byte string, UTF-8 encoded, quoted. See http://www.webdav.org/specs/rfc4918.html#rfc.section.8.3 We are using the path-absolute option. i.e. starting with '/'. URI ; See section 3.2.1 of [RFC2068]
Below is the the instruction that describes the task: ### Input: Convert path to a URL that can be passed to XML responses. Byte string, UTF-8 encoded, quoted. See http://www.webdav.org/specs/rfc4918.html#rfc.section.8.3 We are using the path-absolute option. i.e. starting with '/'. ...
def to_bag_of_genomes(self, clustering_object): """ Creates a bag of genomes representation for data mining purposes Each document (genome) in the representation is a set of metadata key and value pairs belonging to the same cluster. The bag of genomes are saved under ./bag_of_genomes/ d...
Creates a bag of genomes representation for data mining purposes Each document (genome) in the representation is a set of metadata key and value pairs belonging to the same cluster. The bag of genomes are saved under ./bag_of_genomes/ directory :param clustering_object: The clustering.rst objec...
Below is the the instruction that describes the task: ### Input: Creates a bag of genomes representation for data mining purposes Each document (genome) in the representation is a set of metadata key and value pairs belonging to the same cluster. The bag of genomes are saved under ./bag_of_genomes/ ...
def pick_up_tip(self, location: Union[types.Location, Well] = None, presses: int = 3, increment: float = 1.0) -> 'InstrumentContext': """ Pick up a tip for the pipette to run liquid-handling commands with If no location is passed, the Pipette will pick up...
Pick up a tip for the pipette to run liquid-handling commands with If no location is passed, the Pipette will pick up the next available tip in its :py:attr:`InstrumentContext.tip_racks` list. The tip to pick up can be manually specified with the `location` argument. The `location` arg...
Below is the the instruction that describes the task: ### Input: Pick up a tip for the pipette to run liquid-handling commands with If no location is passed, the Pipette will pick up the next available tip in its :py:attr:`InstrumentContext.tip_racks` list. The tip to pick up can be manual...
def get_tree_from_branch(self, ref): ''' Return a pygit2.Tree object matching a head ref fetched into refs/remotes/origin/ ''' try: return self.peel(self.repo.lookup_reference( 'refs/remotes/origin/{0}'.format(ref))).tree except KeyError: ...
Return a pygit2.Tree object matching a head ref fetched into refs/remotes/origin/
Below is the the instruction that describes the task: ### Input: Return a pygit2.Tree object matching a head ref fetched into refs/remotes/origin/ ### Response: def get_tree_from_branch(self, ref): ''' Return a pygit2.Tree object matching a head ref fetched into refs/remotes/origin/...
def destinations(stop): """Get destination information.""" from pyruter.api import Departures async def get_destinations(): """Get departure information.""" async with aiohttp.ClientSession() as session: data = Departures(LOOP, stop, session=session) result = await d...
Get destination information.
Below is the the instruction that describes the task: ### Input: Get destination information. ### Response: def destinations(stop): """Get destination information.""" from pyruter.api import Departures async def get_destinations(): """Get departure information.""" async with aiohttp.Cl...
def add_column(self, table, name='ID', data_type='int(11)', after_col=None, null=False, primary_key=False): """Add a column to an existing table.""" location = 'AFTER {0}'.format(after_col) if after_col else 'FIRST' null_ = 'NULL' if null else 'NOT NULL' comment = "COMMENT 'Column auto c...
Add a column to an existing table.
Below is the the instruction that describes the task: ### Input: Add a column to an existing table. ### Response: def add_column(self, table, name='ID', data_type='int(11)', after_col=None, null=False, primary_key=False): """Add a column to an existing table.""" location = 'AFTER {0}'.format(after_...
def ASSIGN(self, node): """This is a custom implementation of ASSIGN derived from handleChildren() in pyflakes 1.3.0. The point here is that on module level, there's type aliases that we want to bind eagerly, but defer computation of the values of the assignments (the type alias...
This is a custom implementation of ASSIGN derived from handleChildren() in pyflakes 1.3.0. The point here is that on module level, there's type aliases that we want to bind eagerly, but defer computation of the values of the assignments (the type aliases might have forward references).
Below is the the instruction that describes the task: ### Input: This is a custom implementation of ASSIGN derived from handleChildren() in pyflakes 1.3.0. The point here is that on module level, there's type aliases that we want to bind eagerly, but defer computation of the values of the ...
def table(self, header, body): """Rendering table element. Wrap header and body in it. :param header: header part of the table. :param body: body part of the table. """ table = '\n.. list-table::\n' if header and not header.isspace(): table = (table + self.in...
Rendering table element. Wrap header and body in it. :param header: header part of the table. :param body: body part of the table.
Below is the the instruction that describes the task: ### Input: Rendering table element. Wrap header and body in it. :param header: header part of the table. :param body: body part of the table. ### Response: def table(self, header, body): """Rendering table element. Wrap header and body ...
def help_center_category_translations_missing(self, category_id, **kwargs): "https://developer.zendesk.com/rest_api/docs/help_center/translations#list-missing-translations" api_path = "/api/v2/help_center/categories/{category_id}/translations/missing.json" api_path = api_path.format(category_id=...
https://developer.zendesk.com/rest_api/docs/help_center/translations#list-missing-translations
Below is the the instruction that describes the task: ### Input: https://developer.zendesk.com/rest_api/docs/help_center/translations#list-missing-translations ### Response: def help_center_category_translations_missing(self, category_id, **kwargs): "https://developer.zendesk.com/rest_api/docs/help_center/...
def transform(self, node, results): u""" a,b,c,d,e,f,*g,h,i = range(100) changes to _3to2list = list(range(100)) a,b,c,d,e,f,g,h,i, = _3to2list[:6] + [_3to2list[6:-2]] + _3to2list[-2:] and for a,b,*c,d,e in iter_of_iters: do_stuff changes to for _3to2iter in ite...
u""" a,b,c,d,e,f,*g,h,i = range(100) changes to _3to2list = list(range(100)) a,b,c,d,e,f,g,h,i, = _3to2list[:6] + [_3to2list[6:-2]] + _3to2list[-2:] and for a,b,*c,d,e in iter_of_iters: do_stuff changes to for _3to2iter in iter_of_iters: _3to2list = list(_3t...
Below is the the instruction that describes the task: ### Input: u""" a,b,c,d,e,f,*g,h,i = range(100) changes to _3to2list = list(range(100)) a,b,c,d,e,f,g,h,i, = _3to2list[:6] + [_3to2list[6:-2]] + _3to2list[-2:] and for a,b,*c,d,e in iter_of_iters: do_stuff changes to ...
def from_google(cls, google_x, google_y, zoom): """Creates a tile from Google format X Y and zoom""" max_tile = (2 ** zoom) - 1 assert 0 <= google_x <= max_tile, 'Google X needs to be a value between 0 and (2^zoom) -1.' assert 0 <= google_y <= max_tile, 'Google Y needs to be a value betw...
Creates a tile from Google format X Y and zoom
Below is the the instruction that describes the task: ### Input: Creates a tile from Google format X Y and zoom ### Response: def from_google(cls, google_x, google_y, zoom): """Creates a tile from Google format X Y and zoom""" max_tile = (2 ** zoom) - 1 assert 0 <= google_x <= max_tile, 'Go...
def after_unassign(reference_analysis): """Removes the reference analysis from the system """ analysis_events.after_unassign(reference_analysis) ref_sample = reference_analysis.aq_parent ref_sample.manage_delObjects([reference_analysis.getId()])
Removes the reference analysis from the system
Below is the the instruction that describes the task: ### Input: Removes the reference analysis from the system ### Response: def after_unassign(reference_analysis): """Removes the reference analysis from the system """ analysis_events.after_unassign(reference_analysis) ref_sample = reference_analy...
def advertiseBrokerWorkerDown(exctype, value, traceback): """Hook advertizing the broker if an impromptu shutdown is occuring.""" if not scoop.SHUTDOWN_REQUESTED: execQueue.shutdown() sys.__excepthook__(exctype, value, traceback)
Hook advertizing the broker if an impromptu shutdown is occuring.
Below is the the instruction that describes the task: ### Input: Hook advertizing the broker if an impromptu shutdown is occuring. ### Response: def advertiseBrokerWorkerDown(exctype, value, traceback): """Hook advertizing the broker if an impromptu shutdown is occuring.""" if not scoop.SHUTDOWN_REQUESTED:...
def extend(self, iterable, new_name=False): """ Add further arrays from an iterable to this list Parameters ---------- iterable Any iterable that contains :class:`InteractiveBase` instances %(ArrayList.rename.parameters.new_name)s Raises ----...
Add further arrays from an iterable to this list Parameters ---------- iterable Any iterable that contains :class:`InteractiveBase` instances %(ArrayList.rename.parameters.new_name)s Raises ------ %(ArrayList.rename.raises)s See Also ...
Below is the the instruction that describes the task: ### Input: Add further arrays from an iterable to this list Parameters ---------- iterable Any iterable that contains :class:`InteractiveBase` instances %(ArrayList.rename.parameters.new_name)s Raises ...
def apply_vnc_actions(self, vnc_actions): """ Play a list of vnc_actions forward over the current keysyms state NOTE: Since we are squashing a set of diffs into a single keyboard state, some information may be lost. For example if the Z key is down, then we receive [(Z-up), (Z-down)], t...
Play a list of vnc_actions forward over the current keysyms state NOTE: Since we are squashing a set of diffs into a single keyboard state, some information may be lost. For example if the Z key is down, then we receive [(Z-up), (Z-down)], the output will not reflect any change in Z You can mak...
Below is the the instruction that describes the task: ### Input: Play a list of vnc_actions forward over the current keysyms state NOTE: Since we are squashing a set of diffs into a single keyboard state, some information may be lost. For example if the Z key is down, then we receive [(Z-up), (Z-do...
def save_default_values(dsp, path): """ Write Dispatcher default values in Python pickle format. Pickles are a serialized byte stream of a Python object. This format will preserve Python objects used as nodes or edges. :param dsp: A dispatcher that identifies the model adopted. :type d...
Write Dispatcher default values in Python pickle format. Pickles are a serialized byte stream of a Python object. This format will preserve Python objects used as nodes or edges. :param dsp: A dispatcher that identifies the model adopted. :type dsp: schedula.Dispatcher :param path: ...
Below is the the instruction that describes the task: ### Input: Write Dispatcher default values in Python pickle format. Pickles are a serialized byte stream of a Python object. This format will preserve Python objects used as nodes or edges. :param dsp: A dispatcher that identifies the model...
def mixed(self): """ Returns a dictionary where the values are either single values, or a list of values when a key/value appears more than once in this dictionary. This is similar to the kind of dictionary often used to represent the variables in a web request. ...
Returns a dictionary where the values are either single values, or a list of values when a key/value appears more than once in this dictionary. This is similar to the kind of dictionary often used to represent the variables in a web request.
Below is the the instruction that describes the task: ### Input: Returns a dictionary where the values are either single values, or a list of values when a key/value appears more than once in this dictionary. This is similar to the kind of dictionary often used to represent the variables in...
def next(self): """Next point in iteration """ if self.probability == 1: x, y = next(self.scan) else: while True: x, y = next(self.scan) if random.random() <= self.probability: break return x, y
Next point in iteration
Below is the the instruction that describes the task: ### Input: Next point in iteration ### Response: def next(self): """Next point in iteration """ if self.probability == 1: x, y = next(self.scan) else: while True: x, y = next(self.scan) ...
def set_headers(self, headers): """ Set the headers of our csv writer :param list headers: list of dict with label and name key (label is mandatory : used for the export) """ self.headers = [] if 'order' in self.options: for element in self.options['o...
Set the headers of our csv writer :param list headers: list of dict with label and name key (label is mandatory : used for the export)
Below is the the instruction that describes the task: ### Input: Set the headers of our csv writer :param list headers: list of dict with label and name key (label is mandatory : used for the export) ### Response: def set_headers(self, headers): """ Set the headers of our csv write...
def _get_media(self): """ Construct Media as a dynamic property. .. Note:: For more information visit https://docs.djangoproject.com/en/stable/topics/forms/media/#media-as-a-dynamic-property """ lang = get_language() select2_js = (settings.SELECT2_JS,) if set...
Construct Media as a dynamic property. .. Note:: For more information visit https://docs.djangoproject.com/en/stable/topics/forms/media/#media-as-a-dynamic-property
Below is the the instruction that describes the task: ### Input: Construct Media as a dynamic property. .. Note:: For more information visit https://docs.djangoproject.com/en/stable/topics/forms/media/#media-as-a-dynamic-property ### Response: def _get_media(self): """ Construc...
def get_rich_events(self, item): """ In the events there are some common fields with the task. The name of the field must be the same in the task and in the event so we can filer using it in task and event at the same time. * Fields that don't change: the field does not change w...
In the events there are some common fields with the task. The name of the field must be the same in the task and in the event so we can filer using it in task and event at the same time. * Fields that don't change: the field does not change with the events in a task so the value is alwa...
Below is the the instruction that describes the task: ### Input: In the events there are some common fields with the task. The name of the field must be the same in the task and in the event so we can filer using it in task and event at the same time. * Fields that don't change: the field d...
def spawn_worker(params): """ This method has to be module level function :type params: Params """ setup_logging(params) log.info("Adding worker: idx=%s\tconcurrency=%s\tresults=%s", params.worker_index, params.concurrency, params.report) worker = Worker(params) worker.star...
This method has to be module level function :type params: Params
Below is the the instruction that describes the task: ### Input: This method has to be module level function :type params: Params ### Response: def spawn_worker(params): """ This method has to be module level function :type params: Params """ setup_logging(params) log.info("Adding wor...
def __load_config(self): '''Find and load .scuba.yml ''' # top_path is where .scuba.yml is found, and becomes the top of our bind mount. # top_rel is the relative path from top_path to the current working directory, # and is where we'll set the working directory in the container...
Find and load .scuba.yml
Below is the the instruction that describes the task: ### Input: Find and load .scuba.yml ### Response: def __load_config(self): '''Find and load .scuba.yml ''' # top_path is where .scuba.yml is found, and becomes the top of our bind mount. # top_rel is the relative path from top_p...
def recv(self, message, ref, pos): """ Called when a message is received with decoded JSON content """ # Get action action = message.get('action', None) # Show the message we got if action != 'pingdog': self.debug("{} - Receive: {} (ref:{}) - {}".for...
Called when a message is received with decoded JSON content
Below is the the instruction that describes the task: ### Input: Called when a message is received with decoded JSON content ### Response: def recv(self, message, ref, pos): """ Called when a message is received with decoded JSON content """ # Get action action = message.ge...
def absolute_position(self, x, y): """return the absolute position of x,y in user space w.r.t. default user space""" (a, b, c, d, e, f) = self._currentMatrix xp = a * x + c * y + e yp = b * x + d * y + f return xp, yp
return the absolute position of x,y in user space w.r.t. default user space
Below is the the instruction that describes the task: ### Input: return the absolute position of x,y in user space w.r.t. default user space ### Response: def absolute_position(self, x, y): """return the absolute position of x,y in user space w.r.t. default user space""" (a, b, c, d, e, f) = self._...
def noteon(self, chan, key, vel): """Play a note.""" if key < 0 or key > 128: return False if chan < 0: return False if vel < 0 or vel > 128: return False return fluid_synth_noteon(self.synth, chan, key, vel)
Play a note.
Below is the the instruction that describes the task: ### Input: Play a note. ### Response: def noteon(self, chan, key, vel): """Play a note.""" if key < 0 or key > 128: return False if chan < 0: return False if vel < 0 or vel > 128: return False ...
def is_addable(self, device, automount=True): """Check if device can be added with ``auto_add``.""" if not self.is_automount(device, automount): return False if device.is_filesystem: return not device.is_mounted if device.is_crypto: return self._prompt...
Check if device can be added with ``auto_add``.
Below is the the instruction that describes the task: ### Input: Check if device can be added with ``auto_add``. ### Response: def is_addable(self, device, automount=True): """Check if device can be added with ``auto_add``.""" if not self.is_automount(device, automount): return False ...
def RIBNextHopLimitExceeded_originator_switch_info_switchIdentifier(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") RIBNextHopLimitExceeded = ET.SubElement(config, "RIBNextHopLimitExceeded", xmlns="http://brocade.com/ns/brocade-notification-stream") orig...
Auto Generated Code
Below is the the instruction that describes the task: ### Input: Auto Generated Code ### Response: def RIBNextHopLimitExceeded_originator_switch_info_switchIdentifier(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") RIBNextHopLimitExceeded = ET.SubElement(co...
def fade_speed(self, value): """ Setter for **self.__fade_speed** attribute. :param value: Attribute value. :type value: float """ if value is not None: assert type(value) is float, "'{0}' attribute: '{1}' type is not 'float'!".format("fade_speed", value) ...
Setter for **self.__fade_speed** attribute. :param value: Attribute value. :type value: float
Below is the the instruction that describes the task: ### Input: Setter for **self.__fade_speed** attribute. :param value: Attribute value. :type value: float ### Response: def fade_speed(self, value): """ Setter for **self.__fade_speed** attribute. :param value: Attribute...
def main(argv): """ Main program. @return: none """ global g_script_name g_script_name = os.path.basename(argv[0]) parse_config_file() parse_args(argv) url = 'https://0xdata.atlassian.net/rest/api/2/search?jql=sprint="' + urllib.quote(g_sprint) + '"&maxResults=1000' r = reques...
Main program. @return: none
Below is the the instruction that describes the task: ### Input: Main program. @return: none ### Response: def main(argv): """ Main program. @return: none """ global g_script_name g_script_name = os.path.basename(argv[0]) parse_config_file() parse_args(argv) url = 'https...
def register(self, prefix, viewset, basename, factory=None, permission=None): """ Factory and permission are likely only going to exist until I have enough time to write a permissions module for PRF. :param prefix: the uri route prefix. :param viewset: The ViewSet class to route...
Factory and permission are likely only going to exist until I have enough time to write a permissions module for PRF. :param prefix: the uri route prefix. :param viewset: The ViewSet class to route. :param basename: Used to name the route in pyramid. :param factory: Optional, ro...
Below is the the instruction that describes the task: ### Input: Factory and permission are likely only going to exist until I have enough time to write a permissions module for PRF. :param prefix: the uri route prefix. :param viewset: The ViewSet class to route. :param basename: Us...
def unlocked(self): """ Is the store unlocked so that I can decrypt the content? """ if self.password is not None: return bool(self.password) else: if ( "UNLOCK" in os.environ and os.environ["UNLOCK"] and self.config...
Is the store unlocked so that I can decrypt the content?
Below is the the instruction that describes the task: ### Input: Is the store unlocked so that I can decrypt the content? ### Response: def unlocked(self): """ Is the store unlocked so that I can decrypt the content? """ if self.password is not None: return bool(self.password) ...
def rollback(*args, **kwargs): ''' Restore previous revision of Conda environment according to most recent action in :attr:`MICRODROP_CONDA_ACTIONS`. .. versionchanged:: 0.18 Add support for action revision files compressed using ``bz2``. .. versionchanged:: 0.24 Remove channels ar...
Restore previous revision of Conda environment according to most recent action in :attr:`MICRODROP_CONDA_ACTIONS`. .. versionchanged:: 0.18 Add support for action revision files compressed using ``bz2``. .. versionchanged:: 0.24 Remove channels argument. Use Conda channels as configured i...
Below is the the instruction that describes the task: ### Input: Restore previous revision of Conda environment according to most recent action in :attr:`MICRODROP_CONDA_ACTIONS`. .. versionchanged:: 0.18 Add support for action revision files compressed using ``bz2``. .. versionchanged:: 0.24 ...
def join(self, column_label, other, other_label=None): """Creates a new table with the columns of self and other, containing rows for all values of a column that appear in both tables. Args: ``column_label`` (``str``): label of column in self that is used to join r...
Creates a new table with the columns of self and other, containing rows for all values of a column that appear in both tables. Args: ``column_label`` (``str``): label of column in self that is used to join rows of ``other``. ``other``: Table object to join with...
Below is the the instruction that describes the task: ### Input: Creates a new table with the columns of self and other, containing rows for all values of a column that appear in both tables. Args: ``column_label`` (``str``): label of column in self that is used to join...
def create_table(self, tablename, columns, primary_key=None, force_recreate=False): """ :Parameters: - tablename: string - columns: list or tuples, with each element be a string like 'id INT NOT NULL UNIQUE' - primary_key: list or tuples, with elements be the column names ...
:Parameters: - tablename: string - columns: list or tuples, with each element be a string like 'id INT NOT NULL UNIQUE' - primary_key: list or tuples, with elements be the column names - force_recreate: When table of the same name already exists, if this is True, drop that table; if Fal...
Below is the the instruction that describes the task: ### Input: :Parameters: - tablename: string - columns: list or tuples, with each element be a string like 'id INT NOT NULL UNIQUE' - primary_key: list or tuples, with elements be the column names - force_recreate: When table of t...
def football_data(season='1314', data_set='football_data'): """Football data from English games since 1993. This downloads data from football-data.co.uk for the given season. """ def league2num(string): league_dict = {'E0':0, 'E1':1, 'E2': 2, 'E3': 3, 'EC':4} return league_dict[string] def ...
Football data from English games since 1993. This downloads data from football-data.co.uk for the given season.
Below is the the instruction that describes the task: ### Input: Football data from English games since 1993. This downloads data from football-data.co.uk for the given season. ### Response: def football_data(season='1314', data_set='football_data'): """Football data from English games since 1993. This downloa...
def render_compressed(self, package, package_name, package_type): """Render HTML for the package. If ``PIPELINE_ENABLED`` is ``True``, this will render the package's output file (using :py:meth:`render_compressed_output`). Otherwise, this will render the package's source files (using ...
Render HTML for the package. If ``PIPELINE_ENABLED`` is ``True``, this will render the package's output file (using :py:meth:`render_compressed_output`). Otherwise, this will render the package's source files (using :py:meth:`render_compressed_sources`). Subclasses can override...
Below is the the instruction that describes the task: ### Input: Render HTML for the package. If ``PIPELINE_ENABLED`` is ``True``, this will render the package's output file (using :py:meth:`render_compressed_output`). Otherwise, this will render the package's source files (using :p...
def configure(self, options, conf): """Configure plugin. """ if not self.can_configure: return self.enabled = options.detailedErrors self.conf = conf
Configure plugin.
Below is the the instruction that describes the task: ### Input: Configure plugin. ### Response: def configure(self, options, conf): """Configure plugin. """ if not self.can_configure: return self.enabled = options.detailedErrors self.conf = conf
def _allocated_entries_bitmap(self): '''Creates a generator that returns all allocated entries in the bitmap. Yields: int: The bit index of the allocated entries. ''' for entry_number in range(len(self._bitmap) * 8): if self.entry_allocated(entry_number): yield entry_nu...
Creates a generator that returns all allocated entries in the bitmap. Yields: int: The bit index of the allocated entries.
Below is the the instruction that describes the task: ### Input: Creates a generator that returns all allocated entries in the bitmap. Yields: int: The bit index of the allocated entries. ### Response: def _allocated_entries_bitmap(self): '''Creates a generator that returns all allocated entri...
def detect_Concordia(dat_orig, s_freq, time, opts): """Spindle detection, experimental Concordia method. Similar to Moelle 2011 and Nir2011. Parameters ---------- dat_orig : ndarray (dtype='float') vector with the data for one channel s_freq : float sampling frequency opts :...
Spindle detection, experimental Concordia method. Similar to Moelle 2011 and Nir2011. Parameters ---------- dat_orig : ndarray (dtype='float') vector with the data for one channel s_freq : float sampling frequency opts : instance of 'DetectSpindle' 'det_butter' : dict ...
Below is the the instruction that describes the task: ### Input: Spindle detection, experimental Concordia method. Similar to Moelle 2011 and Nir2011. Parameters ---------- dat_orig : ndarray (dtype='float') vector with the data for one channel s_freq : float sampling frequency ...
def OnTableListToggle(self, event): """Table list toggle event handler""" table_list_panel_info = \ self.main_window._mgr.GetPane("table_list_panel") self._toggle_pane(table_list_panel_info) event.Skip()
Table list toggle event handler
Below is the the instruction that describes the task: ### Input: Table list toggle event handler ### Response: def OnTableListToggle(self, event): """Table list toggle event handler""" table_list_panel_info = \ self.main_window._mgr.GetPane("table_list_panel") self._toggle_pan...
def select_file_ids(db, user_id): """ Get all file ids for a user. """ return list( db.execute( select([files.c.id]) .where(files.c.user_id == user_id) ) )
Get all file ids for a user.
Below is the the instruction that describes the task: ### Input: Get all file ids for a user. ### Response: def select_file_ids(db, user_id): """ Get all file ids for a user. """ return list( db.execute( select([files.c.id]) .where(files.c.user_id == user_id) ...
def load(steps, reload=False): """ safely load steps in place, excluding those that fail Args: steps: the steps to load """ # work on collections by default for fewer isinstance() calls per call to load() if reload: _STEP_CACHE.clear() if callable(steps): steps = ste...
safely load steps in place, excluding those that fail Args: steps: the steps to load
Below is the the instruction that describes the task: ### Input: safely load steps in place, excluding those that fail Args: steps: the steps to load ### Response: def load(steps, reload=False): """ safely load steps in place, excluding those that fail Args: steps: the steps to load...
def transfer_header(self, fw=sys.stdout): """ transfer_header() copies header to a new file. print_header() creates a new header. """ print("\n".join(self.header), file=fw)
transfer_header() copies header to a new file. print_header() creates a new header.
Below is the the instruction that describes the task: ### Input: transfer_header() copies header to a new file. print_header() creates a new header. ### Response: def transfer_header(self, fw=sys.stdout): """ transfer_header() copies header to a new file. print_header() creates a ne...
def load(self): """ Load the object defined by the plugin entry point """ print("[DEBUG] Loading plugin {} from {}".format(self.name, self.source)) import pydoc path, attr = self.source.split(":") module = pydoc.locate(path...
Load the object defined by the plugin entry point
Below is the the instruction that describes the task: ### Input: Load the object defined by the plugin entry point ### Response: def load(self): """ Load the object defined by the plugin entry point """ print("[DEBUG] Loading plugin {} from {}".format(self.name, ...
def update(self, params, ignore_set=False, overwrite=False): """Set instance values from dictionary. :param dict params: Click context params. :param bool ignore_set: Skip already-set values instead of raising AttributeError. :param bool overwrite: Allow overwriting already-set values. ...
Set instance values from dictionary. :param dict params: Click context params. :param bool ignore_set: Skip already-set values instead of raising AttributeError. :param bool overwrite: Allow overwriting already-set values.
Below is the the instruction that describes the task: ### Input: Set instance values from dictionary. :param dict params: Click context params. :param bool ignore_set: Skip already-set values instead of raising AttributeError. :param bool overwrite: Allow overwriting already-set values. ###...
def log_to_file(log_path, log_urllib=False, limit=None): """ Add file_handler to logger""" log_path = log_path file_handler = logging.FileHandler(log_path) if limit: file_handler = RotatingFileHandler( log_path, mode='a', maxBytes=limit * 1024 * 1024, ...
Add file_handler to logger
Below is the the instruction that describes the task: ### Input: Add file_handler to logger ### Response: def log_to_file(log_path, log_urllib=False, limit=None): """ Add file_handler to logger""" log_path = log_path file_handler = logging.FileHandler(log_path) if limit: file_handler = Rota...
def deserialize(self, buffer=bytes(), index=Index(), **options): """ De-serializes the `Pointer` field from the byte *buffer* starting at the begin of the *buffer* or with the given *index* by mapping the bytes to the :attr:`value` of the `Pointer` field in accordance with the decoding *...
De-serializes the `Pointer` field from the byte *buffer* starting at the begin of the *buffer* or with the given *index* by mapping the bytes to the :attr:`value` of the `Pointer` field in accordance with the decoding *byte order* for the de-serialization and the decoding :attr:`byte_ord...
Below is the the instruction that describes the task: ### Input: De-serializes the `Pointer` field from the byte *buffer* starting at the begin of the *buffer* or with the given *index* by mapping the bytes to the :attr:`value` of the `Pointer` field in accordance with the decoding *byte ord...
def to_json_type(self): """ Return a dictionary for the document with values converted to JSON safe types. """ document_dict = self._json_safe(self._document) self._remove_keys(document_dict, self._private_fields) return document_dict
Return a dictionary for the document with values converted to JSON safe types.
Below is the the instruction that describes the task: ### Input: Return a dictionary for the document with values converted to JSON safe types. ### Response: def to_json_type(self): """ Return a dictionary for the document with values converted to JSON safe types. """ ...
def guess_peb_size(path): """Determine the most likely block size Arguments: Str:path -- Path to file. Returns: Int -- PEB size. Searches file for Magic Number, picks most common length between them. """ file_offset = 0 offsets = [] f = open(path, '...
Determine the most likely block size Arguments: Str:path -- Path to file. Returns: Int -- PEB size. Searches file for Magic Number, picks most common length between them.
Below is the the instruction that describes the task: ### Input: Determine the most likely block size Arguments: Str:path -- Path to file. Returns: Int -- PEB size. Searches file for Magic Number, picks most common length between them. ### Response: def guess_peb_...
def run(self): """Train the model on randomly generated batches""" _, test_data = self.data.load(train=False, test=True) try: self.model.fit_generator( self.samples_to_batches(self.generate_samples(), self.args.batch_size), steps_per_epoch=self.args.steps_per_epoch, ...
Train the model on randomly generated batches
Below is the the instruction that describes the task: ### Input: Train the model on randomly generated batches ### Response: def run(self): """Train the model on randomly generated batches""" _, test_data = self.data.load(train=False, test=True) try: self.model.fit_generator( ...
def load_vcoef(filename): """Loads a set of vector coefficients that were saved in MATLAB. The third number on the first line is the directivity calculated within the MATLAB code.""" with open(filename) as f: lines = f.readlines() lst = lines[0].split(',') nmax = int(lst[0]) ...
Loads a set of vector coefficients that were saved in MATLAB. The third number on the first line is the directivity calculated within the MATLAB code.
Below is the the instruction that describes the task: ### Input: Loads a set of vector coefficients that were saved in MATLAB. The third number on the first line is the directivity calculated within the MATLAB code. ### Response: def load_vcoef(filename): """Loads a set of vector coefficients that were...
def get_closest_dt_padded_idx(dt, dt_list, pad=timedelta(days=30)): """Get indices of dt_list that is closest to input dt +/- pad days """ #If pad is in decimal days if not isinstance(pad, timedelta): pad = timedelta(days=pad) from pygeotools.lib import malib dt_list = malib.checkma(dt_l...
Get indices of dt_list that is closest to input dt +/- pad days
Below is the the instruction that describes the task: ### Input: Get indices of dt_list that is closest to input dt +/- pad days ### Response: def get_closest_dt_padded_idx(dt, dt_list, pad=timedelta(days=30)): """Get indices of dt_list that is closest to input dt +/- pad days """ #If pad is in decimal...
def utc2et(utcstr): """ Convert an input time from Calendar or Julian Date format, UTC, to ephemeris seconds past J2000. http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/utc2et_c.html :param utcstr: Input time string, UTC. :type utcstr: str :return: Output epoch, ephemeris seconds ...
Convert an input time from Calendar or Julian Date format, UTC, to ephemeris seconds past J2000. http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/utc2et_c.html :param utcstr: Input time string, UTC. :type utcstr: str :return: Output epoch, ephemeris seconds past J2000. :rtype: float
Below is the the instruction that describes the task: ### Input: Convert an input time from Calendar or Julian Date format, UTC, to ephemeris seconds past J2000. http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/utc2et_c.html :param utcstr: Input time string, UTC. :type utcstr: str :ret...
def _set_alarm_owner(self, v, load=False): """ Setter method for alarm_owner, mapped from YANG variable /rmon/alarm_entry/alarm_owner (owner-string) If this variable is read-only (config: false) in the source YANG file, then _set_alarm_owner is considered as a private method. Backends looking to pop...
Setter method for alarm_owner, mapped from YANG variable /rmon/alarm_entry/alarm_owner (owner-string) If this variable is read-only (config: false) in the source YANG file, then _set_alarm_owner is considered as a private method. Backends looking to populate this variable should do so via calling thisOb...
Below is the the instruction that describes the task: ### Input: Setter method for alarm_owner, mapped from YANG variable /rmon/alarm_entry/alarm_owner (owner-string) If this variable is read-only (config: false) in the source YANG file, then _set_alarm_owner is considered as a private method. Backends ...
def cmd(): """Implementation of time subcommand. Other Parameters: conf.time conf.core """ sdat = StagyyData(conf.core.path) if sdat.tseries is None: return if conf.time.fraction is not None: if not 0 < conf.time.fraction <= 1: raise InvalidTimeFract...
Implementation of time subcommand. Other Parameters: conf.time conf.core
Below is the the instruction that describes the task: ### Input: Implementation of time subcommand. Other Parameters: conf.time conf.core ### Response: def cmd(): """Implementation of time subcommand. Other Parameters: conf.time conf.core """ sdat = StagyyData(...
def get_statistics_by_account(self, account_id, term_id): """ Returns statistics for the given account_id and term_id. https://canvas.instructure.com/doc/api/analytics.html#method.analytics_api.department_statistics """ url = ("/api/v1/accounts/sis_account_id:%s/analytics/" ...
Returns statistics for the given account_id and term_id. https://canvas.instructure.com/doc/api/analytics.html#method.analytics_api.department_statistics
Below is the the instruction that describes the task: ### Input: Returns statistics for the given account_id and term_id. https://canvas.instructure.com/doc/api/analytics.html#method.analytics_api.department_statistics ### Response: def get_statistics_by_account(self, account_id, term_id): """ ...
def detach(self, sync=True): """ Detach this result from its parent session by fetching the remainder of this result from the network into the buffer. :returns: number of records fetched """ if self.attached(): return self._session.detach(self, sync=sync) els...
Detach this result from its parent session by fetching the remainder of this result from the network into the buffer. :returns: number of records fetched
Below is the the instruction that describes the task: ### Input: Detach this result from its parent session by fetching the remainder of this result from the network into the buffer. :returns: number of records fetched ### Response: def detach(self, sync=True): """ Detach this result from ...
def from_prefix(cls, container, prefix): """Create from prefix object.""" if cls._is_gs_folder(prefix): name, suffix, extra = prefix.name.partition(cls._gs_folder_suffix) if (suffix, extra) == (cls._gs_folder_suffix, ''): # Patch GS specific folder to remove suffi...
Create from prefix object.
Below is the the instruction that describes the task: ### Input: Create from prefix object. ### Response: def from_prefix(cls, container, prefix): """Create from prefix object.""" if cls._is_gs_folder(prefix): name, suffix, extra = prefix.name.partition(cls._gs_folder_suffix) ...
def download_url(self, project, file_name, run=None, entity=None): """Generate download urls Args: project (str): The project to download file_name (str): The name of the file to download run (str, optional): The run to upload to entity (str, optional): T...
Generate download urls Args: project (str): The project to download file_name (str): The name of the file to download run (str, optional): The run to upload to entity (str, optional): The entity to scope this project to. Defaults to wandb models Returns...
Below is the the instruction that describes the task: ### Input: Generate download urls Args: project (str): The project to download file_name (str): The name of the file to download run (str, optional): The run to upload to entity (str, optional): The entity...
def put(cont, path=None, local_file=None, profile=None): ''' Create a new container, or upload an object to a container. CLI Example to create a container: .. code-block:: bash salt myminion swift.put mycontainer CLI Example to upload an object to a container: .. code-block:: bash ...
Create a new container, or upload an object to a container. CLI Example to create a container: .. code-block:: bash salt myminion swift.put mycontainer CLI Example to upload an object to a container: .. code-block:: bash salt myminion swift.put mycontainer remotepath local_file=/pa...
Below is the the instruction that describes the task: ### Input: Create a new container, or upload an object to a container. CLI Example to create a container: .. code-block:: bash salt myminion swift.put mycontainer CLI Example to upload an object to a container: .. code-block:: bash ...
def get_project_export(self, project_id): """ Get project info for export """ try: result = self._request('/getprojectexport/', {'projectid': project_id}) return TildaProject(**result) except NetworkError: return []
Get project info for export
Below is the the instruction that describes the task: ### Input: Get project info for export ### Response: def get_project_export(self, project_id): """ Get project info for export """ try: result = self._request('/getprojectexport/', {'projectid': pro...
def remove_fields(layer, fields_to_remove): """Remove fields from a vector layer. :param layer: The vector layer. :type layer: QgsVectorLayer :param fields_to_remove: List of fields to remove. :type fields_to_remove: list """ index_to_remove = [] data_provider = layer.dataProvider() ...
Remove fields from a vector layer. :param layer: The vector layer. :type layer: QgsVectorLayer :param fields_to_remove: List of fields to remove. :type fields_to_remove: list
Below is the the instruction that describes the task: ### Input: Remove fields from a vector layer. :param layer: The vector layer. :type layer: QgsVectorLayer :param fields_to_remove: List of fields to remove. :type fields_to_remove: list ### Response: def remove_fields(layer, fields_to_remove):...
def rgb2gray(rgb): """Convert an RGB image (or images) to grayscale. Parameters ---------- rgb : ndarray RGB image as Nr x Nc x 3 or Nr x Nc x 3 x K array Returns ------- gry : ndarray Grayscale image as Nr x Nc or Nr x Nc x K array """ w = sla.atleast_nd(rgb.ndim, np....
Convert an RGB image (or images) to grayscale. Parameters ---------- rgb : ndarray RGB image as Nr x Nc x 3 or Nr x Nc x 3 x K array Returns ------- gry : ndarray Grayscale image as Nr x Nc or Nr x Nc x K array
Below is the the instruction that describes the task: ### Input: Convert an RGB image (or images) to grayscale. Parameters ---------- rgb : ndarray RGB image as Nr x Nc x 3 or Nr x Nc x 3 x K array Returns ------- gry : ndarray Grayscale image as Nr x Nc or Nr x Nc x K array ##...
def wait_for_complete(queue_name, job_list=None, job_name_prefix=None, poll_interval=10, idle_log_timeout=None, kill_on_log_timeout=False, stash_log_method=None, tag_instances=False, result_record=None): """Return when all jobs in the given list fini...
Return when all jobs in the given list finished. If not job list is given, return when all jobs in queue finished. Parameters ---------- queue_name : str The name of the queue to wait for completion. job_list : Optional[list(dict)] A list of jobID-s in a dict, as returned by the su...
Below is the the instruction that describes the task: ### Input: Return when all jobs in the given list finished. If not job list is given, return when all jobs in queue finished. Parameters ---------- queue_name : str The name of the queue to wait for completion. job_list : Optional[l...
def _check_update_fw(self, tenant_id, drvr_name): """Update the Firewall config by calling the driver. This function calls the device manager routine to update the device with modified FW cfg. """ if self.fwid_attr[tenant_id].is_fw_complete(): fw_dict = self.fwid_att...
Update the Firewall config by calling the driver. This function calls the device manager routine to update the device with modified FW cfg.
Below is the the instruction that describes the task: ### Input: Update the Firewall config by calling the driver. This function calls the device manager routine to update the device with modified FW cfg. ### Response: def _check_update_fw(self, tenant_id, drvr_name): """Update the Firewal...
def run(self): """ For each incoming message, decode the JSON, evaluate expression, encode as JSON and write that to the output file. """ for line in self.incoming: message = loads(line) result = self._evaluate(message) if result is self._SKIP:...
For each incoming message, decode the JSON, evaluate expression, encode as JSON and write that to the output file.
Below is the the instruction that describes the task: ### Input: For each incoming message, decode the JSON, evaluate expression, encode as JSON and write that to the output file. ### Response: def run(self): """ For each incoming message, decode the JSON, evaluate expression, encode ...
def get_tags(self): """ Get all tags and post count of each tag. :return: dict_item(tag_name, Pair(count_all, count_published)) """ posts = self.get_posts(include_draft=True) result = {} for post in posts: for tag_name in set(post.tags): ...
Get all tags and post count of each tag. :return: dict_item(tag_name, Pair(count_all, count_published))
Below is the the instruction that describes the task: ### Input: Get all tags and post count of each tag. :return: dict_item(tag_name, Pair(count_all, count_published)) ### Response: def get_tags(self): """ Get all tags and post count of each tag. :return: dict_item(tag_name, Pair...
def project_interval_forward(self, c_interval): """ project c_interval on the source transcript to the destination transcript :param c_interval: an :class:`hgvs.interval.Interval` object on the source transcript :returns: c_interval: an :class:`hgvs.interval.Interval` object on ...
project c_interval on the source transcript to the destination transcript :param c_interval: an :class:`hgvs.interval.Interval` object on the source transcript :returns: c_interval: an :class:`hgvs.interval.Interval` object on the destination transcript
Below is the the instruction that describes the task: ### Input: project c_interval on the source transcript to the destination transcript :param c_interval: an :class:`hgvs.interval.Interval` object on the source transcript :returns: c_interval: an :class:`hgvs.interval.Interval` object on...
def content(): """Helper method that returns just the content. This method was added so that the text could be reused in the dock_help module. .. versionadded:: 3.2.3 :returns: A message object without brand element. :rtype: safe.messaging.message.Message """ message = m.Message() ...
Helper method that returns just the content. This method was added so that the text could be reused in the dock_help module. .. versionadded:: 3.2.3 :returns: A message object without brand element. :rtype: safe.messaging.message.Message
Below is the the instruction that describes the task: ### Input: Helper method that returns just the content. This method was added so that the text could be reused in the dock_help module. .. versionadded:: 3.2.3 :returns: A message object without brand element. :rtype: safe.messaging.messag...
def run(self, args): """ Gives user permission based on auth_role arg and sends email to that user. :param args Namespace arguments parsed from the command line """ email = args.email # email of person to send email to username = args.username ...
Gives user permission based on auth_role arg and sends email to that user. :param args Namespace arguments parsed from the command line
Below is the the instruction that describes the task: ### Input: Gives user permission based on auth_role arg and sends email to that user. :param args Namespace arguments parsed from the command line ### Response: def run(self, args): """ Gives user permission based on auth_role arg and se...
def show_ntp_input_rbridge_id(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") show_ntp = ET.Element("show_ntp") config = show_ntp input = ET.SubElement(show_ntp, "input") rbridge_id = ET.SubElement(input, "rbridge-id") rbridge_id....
Auto Generated Code
Below is the the instruction that describes the task: ### Input: Auto Generated Code ### Response: def show_ntp_input_rbridge_id(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") show_ntp = ET.Element("show_ntp") config = show_ntp input = ET.S...
def ser_iuwt_recomposition(in1, scale_adjust, smoothed_array): """ This function calls the a trous algorithm code to recompose the input into a single array. This is the implementation of the isotropic undecimated wavelet transform recomposition for a single CPU core. INPUTS: in1 (no de...
This function calls the a trous algorithm code to recompose the input into a single array. This is the implementation of the isotropic undecimated wavelet transform recomposition for a single CPU core. INPUTS: in1 (no default): Array containing wavelet coefficients. scale_adjust (no de...
Below is the the instruction that describes the task: ### Input: This function calls the a trous algorithm code to recompose the input into a single array. This is the implementation of the isotropic undecimated wavelet transform recomposition for a single CPU core. INPUTS: in1 (no default)...
def ustr(text): """ Convert a string to Python 2 unicode or Python 3 string as appropriate to the version of Python in use. """ if text is not None: if sys.version_info >= (3, 0): return str(text) else: return unicode(text) else: return text
Convert a string to Python 2 unicode or Python 3 string as appropriate to the version of Python in use.
Below is the the instruction that describes the task: ### Input: Convert a string to Python 2 unicode or Python 3 string as appropriate to the version of Python in use. ### Response: def ustr(text): """ Convert a string to Python 2 unicode or Python 3 string as appropriate to the version of Python ...
def is_period(arr): """ Check whether an array-like is a periodical index. .. deprecated:: 0.24.0 Parameters ---------- arr : array-like The array-like to check. Returns ------- boolean Whether or not the array-like is a periodical index. Examples --------...
Check whether an array-like is a periodical index. .. deprecated:: 0.24.0 Parameters ---------- arr : array-like The array-like to check. Returns ------- boolean Whether or not the array-like is a periodical index. Examples -------- >>> is_period([1, 2, 3]) ...
Below is the the instruction that describes the task: ### Input: Check whether an array-like is a periodical index. .. deprecated:: 0.24.0 Parameters ---------- arr : array-like The array-like to check. Returns ------- boolean Whether or not the array-like is a periodi...
def Sum(a, axis, keep_dims): """ Sum reduction op. """ return np.sum(a, axis=axis if not isinstance(axis, np.ndarray) else tuple(axis), keepdims=keep_dims),
Sum reduction op.
Below is the the instruction that describes the task: ### Input: Sum reduction op. ### Response: def Sum(a, axis, keep_dims): """ Sum reduction op. """ return np.sum(a, axis=axis if not isinstance(axis, np.ndarray) else tuple(axis), keepdims=keep_dims),
def get_zone_temperature(self, zone_name): """ Get the temperature for a zone """ zone = self.get_zone(zone_name) if zone is None: raise RuntimeError("Unknown zone") return zone['currentTemperature']
Get the temperature for a zone
Below is the the instruction that describes the task: ### Input: Get the temperature for a zone ### Response: def get_zone_temperature(self, zone_name): """ Get the temperature for a zone """ zone = self.get_zone(zone_name) if zone is None: raise RuntimeError("U...
def follow_redirections(self, request): """Follow all redirections of http response.""" log.debug(LOG_CHECK, "follow all redirections") if self.is_redirect(): # run connection plugins for old connection self.aggregate.plugin_manager.run_connection_plugins(self) re...
Follow all redirections of http response.
Below is the the instruction that describes the task: ### Input: Follow all redirections of http response. ### Response: def follow_redirections(self, request): """Follow all redirections of http response.""" log.debug(LOG_CHECK, "follow all redirections") if self.is_redirect(): ...
def check_cuda_devices(): """Output some information on CUDA-enabled devices on your computer, including current memory usage. Modified to only get number of devices. It's a port of https://gist.github.com/f0k/0d6431e3faa60bffc788f8b4daa029b1 from C to Python with ctypes, so it can run without compilin...
Output some information on CUDA-enabled devices on your computer, including current memory usage. Modified to only get number of devices. It's a port of https://gist.github.com/f0k/0d6431e3faa60bffc788f8b4daa029b1 from C to Python with ctypes, so it can run without compiling anything. Note that this is...
Below is the the instruction that describes the task: ### Input: Output some information on CUDA-enabled devices on your computer, including current memory usage. Modified to only get number of devices. It's a port of https://gist.github.com/f0k/0d6431e3faa60bffc788f8b4daa029b1 from C to Python with ct...
def version_from_branch(branch): """ return version information from a git branch name """ try: return tuple( map( int, re.match(r"^.*(?P<version>\d+(\.\d+)+).*$", branch) .groupdict()["version"] .split("."), ...
return version information from a git branch name
Below is the the instruction that describes the task: ### Input: return version information from a git branch name ### Response: def version_from_branch(branch): """ return version information from a git branch name """ try: return tuple( map( int, ...
def set_hostname(self, value=None, default=False, disable=False): """Configures the global system hostname setting EosVersion: 4.13.7M Args: value (str): The hostname value default (bool): Controls use of the default keyword disable (bool): Contr...
Configures the global system hostname setting EosVersion: 4.13.7M Args: value (str): The hostname value default (bool): Controls use of the default keyword disable (bool): Controls the use of the no keyword Returns: bool: True if the...
Below is the the instruction that describes the task: ### Input: Configures the global system hostname setting EosVersion: 4.13.7M Args: value (str): The hostname value default (bool): Controls use of the default keyword disable (bool): Controls the ...
def _step5(self, word): """step5() removes a final -e if m() > 1, and changes -ll to -l if m() > 1. """ if word[-1] == 'e': a = self._m(word, len(word)-1) if a > 1 or (a == 1 and not self._cvc(word, len(word)-2)): word = word[:-1] if word.e...
step5() removes a final -e if m() > 1, and changes -ll to -l if m() > 1.
Below is the the instruction that describes the task: ### Input: step5() removes a final -e if m() > 1, and changes -ll to -l if m() > 1. ### Response: def _step5(self, word): """step5() removes a final -e if m() > 1, and changes -ll to -l if m() > 1. """ if word[-1] == 'e':...
def _get_constrained_labels(self,remove_dimensions=False,**kwargs): """ returns labels which have updated minima and maxima, depending on the kwargs supplied to this """ new_labels = [] for label_no,label in enumerate(self.labels): new_label = LabelDim...
returns labels which have updated minima and maxima, depending on the kwargs supplied to this
Below is the the instruction that describes the task: ### Input: returns labels which have updated minima and maxima, depending on the kwargs supplied to this ### Response: def _get_constrained_labels(self,remove_dimensions=False,**kwargs): """ returns labels which have updated mini...
def get_cds_time(days, msecs): """Get the datetime object of the time since epoch given in days and milliseconds of day """ return datetime(1958, 1, 1) + timedelta(days=float(days), milliseconds=float(msecs))
Get the datetime object of the time since epoch given in days and milliseconds of day
Below is the the instruction that describes the task: ### Input: Get the datetime object of the time since epoch given in days and milliseconds of day ### Response: def get_cds_time(days, msecs): """Get the datetime object of the time since epoch given in days and milliseconds of day """ return...
def authentication_required(function): """Annotation for methods that require auth.""" def wrapped(self, *args, **kwargs): if not (self.token or self.apiKey): msg = "You must be authenticated to use this method" raise AuthenticationError(msg) else:...
Annotation for methods that require auth.
Below is the the instruction that describes the task: ### Input: Annotation for methods that require auth. ### Response: def authentication_required(function): """Annotation for methods that require auth.""" def wrapped(self, *args, **kwargs): if not (self.token or self.apiKey): ...
def notify(msg, msg_type=0, t=None): "Show system notification with duration t (ms)" if platform.system() == 'Darwin': command = notify_command_osx(msg, msg_type, t) else: command = notify_command_linux(msg, t) os.system(command.encode('utf-8'))
Show system notification with duration t (ms)
Below is the the instruction that describes the task: ### Input: Show system notification with duration t (ms) ### Response: def notify(msg, msg_type=0, t=None): "Show system notification with duration t (ms)" if platform.system() == 'Darwin': command = notify_command_osx(msg, msg_type, t) else...
def transitingPlanets(self): """ Returns a list of transiting planet objects """ transitingPlanets = [] for planet in self.planets: try: if planet.isTransiting: transitingPlanets.append(planet) except KeyError: # No 'discover...
Returns a list of transiting planet objects
Below is the the instruction that describes the task: ### Input: Returns a list of transiting planet objects ### Response: def transitingPlanets(self): """ Returns a list of transiting planet objects """ transitingPlanets = [] for planet in self.planets: try: ...
def conjugate(self): """ Obtain the conjugate of the quaternion. This is simply the same quaternion but with the sign of the imaginary (vector) parts reversed. """ new = self.copy() new.x *= -1 new.y *= -1 new.z *= -1 return new
Obtain the conjugate of the quaternion. This is simply the same quaternion but with the sign of the imaginary (vector) parts reversed.
Below is the the instruction that describes the task: ### Input: Obtain the conjugate of the quaternion. This is simply the same quaternion but with the sign of the imaginary (vector) parts reversed. ### Response: def conjugate(self): """ Obtain the conjugate of the quaternion. ...