code
stringlengths
75
104k
docstring
stringlengths
1
46.9k
text
stringlengths
164
112k
def corner_observed(self, **kwargs): """Makes corner plot for each observed node magnitude """ tot_mags = [] names = [] truths = [] rng = [] for n in self.obs.get_obs_nodes(): labels = [l.label for l in n.get_model_nodes()] band = n.band ...
Makes corner plot for each observed node magnitude
Below is the the instruction that describes the task: ### Input: Makes corner plot for each observed node magnitude ### Response: def corner_observed(self, **kwargs): """Makes corner plot for each observed node magnitude """ tot_mags = [] names = [] truths = [] rng =...
def qwarp_epi(dset,align_subbrick=5,suffix='_qwal',prefix=None): '''aligns an EPI time-series using 3dQwarp Very expensive and not efficient at all, but it can produce pretty impressive alignment for EPI time-series with significant distortions due to motion''' info = nl.dset_info(dset) if info==No...
aligns an EPI time-series using 3dQwarp Very expensive and not efficient at all, but it can produce pretty impressive alignment for EPI time-series with significant distortions due to motion
Below is the the instruction that describes the task: ### Input: aligns an EPI time-series using 3dQwarp Very expensive and not efficient at all, but it can produce pretty impressive alignment for EPI time-series with significant distortions due to motion ### Response: def qwarp_epi(dset,align_subbrick=5,...
def fasta(self, loc, mask='mask'): """ Prints a fasta representation of a sequence. Parameters ---------- l : tuple (str, int, int) location chr, start, and end mask : str, optional Either 'upper', 'lower', or 'n'. If 'lower', poor quality...
Prints a fasta representation of a sequence. Parameters ---------- l : tuple (str, int, int) location chr, start, and end mask : str, optional Either 'upper', 'lower', or 'n'. If 'lower', poor quality bases will be converted to lowercase.
Below is the the instruction that describes the task: ### Input: Prints a fasta representation of a sequence. Parameters ---------- l : tuple (str, int, int) location chr, start, and end mask : str, optional Either 'upper', 'lower', or 'n'. If 'lower'...
async def check_permissions(self, action: str, **kwargs): """ Check if the action should be permitted. Raises an appropriate exception if the request is not permitted. """ for permission in await self.get_permissions(action=action, **kwargs): if not await ensure_asyn...
Check if the action should be permitted. Raises an appropriate exception if the request is not permitted.
Below is the the instruction that describes the task: ### Input: Check if the action should be permitted. Raises an appropriate exception if the request is not permitted. ### Response: async def check_permissions(self, action: str, **kwargs): """ Check if the action should be permitted. ...
def get_version(fname): "grab __version__ variable from fname (assuming fname is a python file). parses without importing." assign_stmts = [s for s in ast.parse(open(fname).read()).body if isinstance(s,ast.Assign)] valid_targets = [s for s in assign_stmts if len(s.targets) == 1 and s.targets[0].id == '__versio...
grab __version__ variable from fname (assuming fname is a python file). parses without importing.
Below is the the instruction that describes the task: ### Input: grab __version__ variable from fname (assuming fname is a python file). parses without importing. ### Response: def get_version(fname): "grab __version__ variable from fname (assuming fname is a python file). parses without importing." assign_s...
def run(call_file, ref_file, vrn_files, data): """Run filtering on the input call file, handling SNPs and indels separately. """ algs = [data["config"]["algorithm"]] * len(data.get("vrn_files", [1])) if includes_missingalt(data): logger.info("Removing variants with missing alts from %s." % call_...
Run filtering on the input call file, handling SNPs and indels separately.
Below is the the instruction that describes the task: ### Input: Run filtering on the input call file, handling SNPs and indels separately. ### Response: def run(call_file, ref_file, vrn_files, data): """Run filtering on the input call file, handling SNPs and indels separately. """ algs = [data["config...
def estimate_gas( self, transaction: BaseOrSpoofTransaction, at_header: BlockHeader=None) -> int: """ Returns an estimation of the amount of gas the given transaction will use if executed on top of the block specified by the given header. """ i...
Returns an estimation of the amount of gas the given transaction will use if executed on top of the block specified by the given header.
Below is the the instruction that describes the task: ### Input: Returns an estimation of the amount of gas the given transaction will use if executed on top of the block specified by the given header. ### Response: def estimate_gas( self, transaction: BaseOrSpoofTransaction, ...
def get_fixed_long_line(target, previous_line, original, indent_word=' ', max_line_length=79, aggressive=False, experimental=False, verbose=False): """Break up long line and return result. Do this by generating multiple reformatted candidates and then rank...
Break up long line and return result. Do this by generating multiple reformatted candidates and then ranking the candidates to heuristically select the best option.
Below is the the instruction that describes the task: ### Input: Break up long line and return result. Do this by generating multiple reformatted candidates and then ranking the candidates to heuristically select the best option. ### Response: def get_fixed_long_line(target, previous_line, original, ...
def image_to_string(image, lang=None, boxes=False): ''' Runs tesseract on the specified image. First, the image is written to disk, and then the tesseract command is run on the image. Resseract's result is read, and the temporary files are erased. ''' input_file_name = '%s.bmp' % tempnam() ...
Runs tesseract on the specified image. First, the image is written to disk, and then the tesseract command is run on the image. Resseract's result is read, and the temporary files are erased.
Below is the the instruction that describes the task: ### Input: Runs tesseract on the specified image. First, the image is written to disk, and then the tesseract command is run on the image. Resseract's result is read, and the temporary files are erased. ### Response: def image_to_string(image, lang=None...
def session(self): """Provide access to request session with local cache enabled.""" if self._session is None: self._session = cachecontrol.CacheControl( requests.Session(), cache=caches.FileCache('.tvdb_cache')) return self._session
Provide access to request session with local cache enabled.
Below is the the instruction that describes the task: ### Input: Provide access to request session with local cache enabled. ### Response: def session(self): """Provide access to request session with local cache enabled.""" if self._session is None: self._session = cachecontrol.CacheCon...
def set_policy_strength(zap_helper, policy_ids, strength): """Set the attack strength for policies.""" if not policy_ids: policy_ids = _get_all_policy_ids(zap_helper) with zap_error_handler(): zap_helper.set_policy_attack_strength(policy_ids, strength) console.info('Set attack strength...
Set the attack strength for policies.
Below is the the instruction that describes the task: ### Input: Set the attack strength for policies. ### Response: def set_policy_strength(zap_helper, policy_ids, strength): """Set the attack strength for policies.""" if not policy_ids: policy_ids = _get_all_policy_ids(zap_helper) with zap_e...
def connect(reactor, control_endpoint=None, password_function=None): """ Creates a :class:`txtorcon.Tor` instance by connecting to an already-running tor's control port. For example, a common default tor uses is UNIXClientEndpoint(reactor, '/var/run/tor/control') or TCP4ClientEndpoint(reactor, 'loca...
Creates a :class:`txtorcon.Tor` instance by connecting to an already-running tor's control port. For example, a common default tor uses is UNIXClientEndpoint(reactor, '/var/run/tor/control') or TCP4ClientEndpoint(reactor, 'localhost', 9051) If only password authentication is available in the tor we con...
Below is the the instruction that describes the task: ### Input: Creates a :class:`txtorcon.Tor` instance by connecting to an already-running tor's control port. For example, a common default tor uses is UNIXClientEndpoint(reactor, '/var/run/tor/control') or TCP4ClientEndpoint(reactor, 'localhost', 9051...
def list_pubs(self, buf): """SSH v2 public keys are serialized and returned.""" assert not buf.read() keys = self.conn.parse_public_keys() code = util.pack('B', msg_code('SSH2_AGENT_IDENTITIES_ANSWER')) num = util.pack('L', len(keys)) log.debug('available keys: %s', [k['n...
SSH v2 public keys are serialized and returned.
Below is the the instruction that describes the task: ### Input: SSH v2 public keys are serialized and returned. ### Response: def list_pubs(self, buf): """SSH v2 public keys are serialized and returned.""" assert not buf.read() keys = self.conn.parse_public_keys() code = util.pack(...
def setup_logging(name, prefix="trademanager", cfg=None): """ Create a logger, based on the given configuration. Accepts LOGFILE and LOGLEVEL settings. :param name: the name of the tapp to log :param cfg: The configuration object with logging info. :return: The session and the engine as a list ...
Create a logger, based on the given configuration. Accepts LOGFILE and LOGLEVEL settings. :param name: the name of the tapp to log :param cfg: The configuration object with logging info. :return: The session and the engine as a list (in that order)
Below is the the instruction that describes the task: ### Input: Create a logger, based on the given configuration. Accepts LOGFILE and LOGLEVEL settings. :param name: the name of the tapp to log :param cfg: The configuration object with logging info. :return: The session and the engine as a list (...
def call(self, url, func, data=None, headers=None, return_json=True, stream=False, retry=True, default_headers=True, quiet=False): '''call will issue the cal...
call will issue the call, and issue a refresh token given a 401 response, and if the client has a _update_token function Parameters ========== func: the function (eg, post, get) to call url: the url to send file to headers: if not None, update the client self.headers with dict...
Below is the the instruction that describes the task: ### Input: call will issue the call, and issue a refresh token given a 401 response, and if the client has a _update_token function Parameters ========== func: the function (eg, post, get) to call url: the url to send file to ...
def get_room_id(self, room_alias): """Get room id from its alias. Args: room_alias (str): The room alias name. Returns: Wanted room's id. """ content = self._send("GET", "/directory/room/{}".format(quote(room_alias))) return content.get("room_id"...
Get room id from its alias. Args: room_alias (str): The room alias name. Returns: Wanted room's id.
Below is the the instruction that describes the task: ### Input: Get room id from its alias. Args: room_alias (str): The room alias name. Returns: Wanted room's id. ### Response: def get_room_id(self, room_alias): """Get room id from its alias. Args: ...
def most_frequent(lst): """ Returns the item that appears most frequently in the given list. """ lst = lst[:] highest_freq = 0 most_freq = None for val in unique(lst): if lst.count(val) > highest_freq: most_freq = val highest_freq = lst.count(val) ...
Returns the item that appears most frequently in the given list.
Below is the the instruction that describes the task: ### Input: Returns the item that appears most frequently in the given list. ### Response: def most_frequent(lst): """ Returns the item that appears most frequently in the given list. """ lst = lst[:] highest_freq = 0 most_freq = None ...
def timeout(limit, handler): """A decorator ensuring that the decorated function tun time does not exceeds the argument limit. :args limit: the time limit :type limit: int :args handler: the handler function called when the decorated function times out. :type handler: callable Example...
A decorator ensuring that the decorated function tun time does not exceeds the argument limit. :args limit: the time limit :type limit: int :args handler: the handler function called when the decorated function times out. :type handler: callable Example: >>>def timeout_handler(limit, ...
Below is the the instruction that describes the task: ### Input: A decorator ensuring that the decorated function tun time does not exceeds the argument limit. :args limit: the time limit :type limit: int :args handler: the handler function called when the decorated function times out. :ty...
def plot(shape_records,facecolor='w',edgecolor='k',linewidths=.5, ax=None,xlims=None,ylims=None): """ Plot the geometry of a shapefile :param shape_records: geometry and attributes list :type shape_records: ShapeRecord object (output of a shapeRecords() method) :param facecolor: color to be used to...
Plot the geometry of a shapefile :param shape_records: geometry and attributes list :type shape_records: ShapeRecord object (output of a shapeRecords() method) :param facecolor: color to be used to fill in polygons :param edgecolor: color to be used for lines :param ax: axes to plot on. :type a...
Below is the the instruction that describes the task: ### Input: Plot the geometry of a shapefile :param shape_records: geometry and attributes list :type shape_records: ShapeRecord object (output of a shapeRecords() method) :param facecolor: color to be used to fill in polygons :param edgecolor: c...
def begin(self, user_url, anonymous=False): """Start the OpenID authentication process. See steps 1-2 in the overview at the top of this file. @param user_url: Identity URL given by the user. This method performs a textual transformation of the URL to try and make sure i...
Start the OpenID authentication process. See steps 1-2 in the overview at the top of this file. @param user_url: Identity URL given by the user. This method performs a textual transformation of the URL to try and make sure it is normalized. For example, a user_url of ...
Below is the the instruction that describes the task: ### Input: Start the OpenID authentication process. See steps 1-2 in the overview at the top of this file. @param user_url: Identity URL given by the user. This method performs a textual transformation of the URL to try and ...
def index_exists(index, hosts=None, profile=None): ''' Return a boolean indicating whether given index exists index Index name CLI example:: salt myminion elasticsearch.index_exists testindex ''' es = _get_instance(hosts, profile) try: return es.indices.exists(ind...
Return a boolean indicating whether given index exists index Index name CLI example:: salt myminion elasticsearch.index_exists testindex
Below is the the instruction that describes the task: ### Input: Return a boolean indicating whether given index exists index Index name CLI example:: salt myminion elasticsearch.index_exists testindex ### Response: def index_exists(index, hosts=None, profile=None): ''' Return a ...
def getPrefixFor(self, portal_type): """Return the prefix for a portal_type. If not found, simply uses the portal_type itself """ prefix = [p for p in self.getIDFormatting() if p['portal_type'] == portal_type] if prefix: return prefix[0]['prefix'] else: ...
Return the prefix for a portal_type. If not found, simply uses the portal_type itself
Below is the the instruction that describes the task: ### Input: Return the prefix for a portal_type. If not found, simply uses the portal_type itself ### Response: def getPrefixFor(self, portal_type): """Return the prefix for a portal_type. If not found, simply uses the portal_type i...
def get_number(s, cast=int): """ Try to get a number out of a string, and cast it. """ import string d = "".join(x for x in str(s) if x in string.digits) return cast(d)
Try to get a number out of a string, and cast it.
Below is the the instruction that describes the task: ### Input: Try to get a number out of a string, and cast it. ### Response: def get_number(s, cast=int): """ Try to get a number out of a string, and cast it. """ import string d = "".join(x for x in str(s) if x in string.digits) return c...
def process_twi(self, index=None, do_edges=False, skip_uca_twi=False): """ Processes the TWI, along with any dependencies (like the slope and UCA) Parameters ----------- index : int/slice (optional) Default: None - process all tiles in source directory. Otherwise, ...
Processes the TWI, along with any dependencies (like the slope and UCA) Parameters ----------- index : int/slice (optional) Default: None - process all tiles in source directory. Otherwise, will only process the index/indices of the files as listed in self.el...
Below is the the instruction that describes the task: ### Input: Processes the TWI, along with any dependencies (like the slope and UCA) Parameters ----------- index : int/slice (optional) Default: None - process all tiles in source directory. Otherwise, will only pr...
def set_arg(self, value): """ Set the query param in self.args based on the prefix and arg index and auto increment the arg_index :return: the string placeholder for the arg :rtype: str """ named_arg = '{0}A{1}'.format(self.arg_prefix, self.arg_index) sel...
Set the query param in self.args based on the prefix and arg index and auto increment the arg_index :return: the string placeholder for the arg :rtype: str
Below is the the instruction that describes the task: ### Input: Set the query param in self.args based on the prefix and arg index and auto increment the arg_index :return: the string placeholder for the arg :rtype: str ### Response: def set_arg(self, value): """ Set the q...
def write_lines(self, data): """write lines, one by one, separated by \n to device""" lines = data.replace('\r', '').split('\n') for line in lines: self.__exchange(line)
write lines, one by one, separated by \n to device
Below is the the instruction that describes the task: ### Input: write lines, one by one, separated by \n to device ### Response: def write_lines(self, data): """write lines, one by one, separated by \n to device""" lines = data.replace('\r', '').split('\n') for line in lines: s...
def make_palette(self): """Create the byte sequences for a ``PLTE`` and if necessary a ``tRNS`` chunk. Returned as a pair (*p*, *t*). *t* will be ``None`` if no ``tRNS`` chunk is necessary. """ p = array('B') t = array('B') for x in self.palette: p...
Create the byte sequences for a ``PLTE`` and if necessary a ``tRNS`` chunk. Returned as a pair (*p*, *t*). *t* will be ``None`` if no ``tRNS`` chunk is necessary.
Below is the the instruction that describes the task: ### Input: Create the byte sequences for a ``PLTE`` and if necessary a ``tRNS`` chunk. Returned as a pair (*p*, *t*). *t* will be ``None`` if no ``tRNS`` chunk is necessary. ### Response: def make_palette(self): """Create the byte sequ...
def addCamera(self,camera): """ Add the camera to the internal registry. Each camera name must be unique, or else only the most recent version will be used. This behavior should not be relied on because some objects may cache objects. Additionally, only instances of :py...
Add the camera to the internal registry. Each camera name must be unique, or else only the most recent version will be used. This behavior should not be relied on because some objects may cache objects. Additionally, only instances of :py:class:`Camera() <peng3d.camera.Camera>` may be ...
Below is the the instruction that describes the task: ### Input: Add the camera to the internal registry. Each camera name must be unique, or else only the most recent version will be used. This behavior should not be relied on because some objects may cache objects. Additionally, ...
def add_file(self, filepath, gzip=False, cache_name=None): """Load a static file in the cache. .. note:: Items are stored with the filepath as is (relative or absolute) as the key. :param str|unicode filepath: :param bool gzip: Use gzip compression. :param str|unicode cache_n...
Load a static file in the cache. .. note:: Items are stored with the filepath as is (relative or absolute) as the key. :param str|unicode filepath: :param bool gzip: Use gzip compression. :param str|unicode cache_name: If not set, default will be used.
Below is the the instruction that describes the task: ### Input: Load a static file in the cache. .. note:: Items are stored with the filepath as is (relative or absolute) as the key. :param str|unicode filepath: :param bool gzip: Use gzip compression. :param str|unicode cache_na...
async def delete_lease_async(self, lease): """ Delete the lease info for the given partition from the store. If there is no stored lease for the given partition, that is treated as success. :param lease: The stored lease to be deleted. :type lease: ~azure.eventprocessorhost.leas...
Delete the lease info for the given partition from the store. If there is no stored lease for the given partition, that is treated as success. :param lease: The stored lease to be deleted. :type lease: ~azure.eventprocessorhost.lease.Lease
Below is the the instruction that describes the task: ### Input: Delete the lease info for the given partition from the store. If there is no stored lease for the given partition, that is treated as success. :param lease: The stored lease to be deleted. :type lease: ~azure.eventprocessorhos...
def _insert_job(self, job): """ Insert a new job into the job queue. If the job queue is ordered, this job will be inserted at the correct position. :param job: The job to insert :return: None """ key = self._job_key(job) if self._allow_merging: ...
Insert a new job into the job queue. If the job queue is ordered, this job will be inserted at the correct position. :param job: The job to insert :return: None
Below is the the instruction that describes the task: ### Input: Insert a new job into the job queue. If the job queue is ordered, this job will be inserted at the correct position. :param job: The job to insert :return: None ### Response: def _insert_job(self, job): """ ...
def _dyad_update(y, c): # pylint:disable=too-many-locals # This function has many locals so it can be compared # with the original algorithm. """ Inner function of the fast distance covariance. This function is compiled because otherwise it would become a bottleneck. """ n = y.shape[0...
Inner function of the fast distance covariance. This function is compiled because otherwise it would become a bottleneck.
Below is the the instruction that describes the task: ### Input: Inner function of the fast distance covariance. This function is compiled because otherwise it would become a bottleneck. ### Response: def _dyad_update(y, c): # pylint:disable=too-many-locals # This function has many locals so it can b...
def segment_taper_rates(neurites, neurite_type=NeuriteType.all): '''taper rates of the segments in a collection of neurites The taper rate is defined as the absolute radii differences divided by length of the section ''' def _seg_taper_rates(sec): '''vectorized taper rates''' pts = sec....
taper rates of the segments in a collection of neurites The taper rate is defined as the absolute radii differences divided by length of the section
Below is the the instruction that describes the task: ### Input: taper rates of the segments in a collection of neurites The taper rate is defined as the absolute radii differences divided by length of the section ### Response: def segment_taper_rates(neurites, neurite_type=NeuriteType.all): '''taper rate...
def x_forwarded_for(self): """X-Forwarded-For header value. This is the amended header so that it contains the previous IP address in the forwarding change. """ ip = self._request.META.get('REMOTE_ADDR') current_xff = self.headers.get('X-Forwarded-For') return ...
X-Forwarded-For header value. This is the amended header so that it contains the previous IP address in the forwarding change.
Below is the the instruction that describes the task: ### Input: X-Forwarded-For header value. This is the amended header so that it contains the previous IP address in the forwarding change. ### Response: def x_forwarded_for(self): """X-Forwarded-For header value. This is the ame...
def include_fields(self, *args): r""" Include fields is the fields that you want to be returned when searching. These are in addition to the fields that are always included below. :param args: items passed in will be turned into a list :returns: :clas...
r""" Include fields is the fields that you want to be returned when searching. These are in addition to the fields that are always included below. :param args: items passed in will be turned into a list :returns: :class:`Search` >>> bugzilla.sear...
Below is the the instruction that describes the task: ### Input: r""" Include fields is the fields that you want to be returned when searching. These are in addition to the fields that are always included below. :param args: items passed in will be turned into a list...
def flick_element(self, on_element, xoffset, yoffset, speed): """ Flick starting at on_element, and moving by the xoffset and yoffset with specified speed. :Args: - on_element: Flick will start at center of element. - xoffset: X offset to flick to. - yoffset: ...
Flick starting at on_element, and moving by the xoffset and yoffset with specified speed. :Args: - on_element: Flick will start at center of element. - xoffset: X offset to flick to. - yoffset: Y offset to flick to. - speed: Pixels per second to flick.
Below is the the instruction that describes the task: ### Input: Flick starting at on_element, and moving by the xoffset and yoffset with specified speed. :Args: - on_element: Flick will start at center of element. - xoffset: X offset to flick to. - yoffset: Y offset to f...
def terminate(self, *, force: bool=False, timeout: float=30.0, step: float=1.0) -> None: '''Stop all scheduled and/or executing tasks, first by asking nicely, and then by waiting up to `timeout` seconds before forcefully stopping the asyncio event loop.''' if isinstanc...
Stop all scheduled and/or executing tasks, first by asking nicely, and then by waiting up to `timeout` seconds before forcefully stopping the asyncio event loop.
Below is the the instruction that describes the task: ### Input: Stop all scheduled and/or executing tasks, first by asking nicely, and then by waiting up to `timeout` seconds before forcefully stopping the asyncio event loop. ### Response: def terminate(self, *, force: bool=False, timeout: float=3...
def get_nginx_configuration_spec(port_spec_dict, docker_bridge_ip): """This function will take in a port spec as specified by the port_spec compiler and will output an nginx web proxy config string. This string can then be written to a file and used running nginx """ nginx_http_config, nginx_stream_conf...
This function will take in a port spec as specified by the port_spec compiler and will output an nginx web proxy config string. This string can then be written to a file and used running nginx
Below is the the instruction that describes the task: ### Input: This function will take in a port spec as specified by the port_spec compiler and will output an nginx web proxy config string. This string can then be written to a file and used running nginx ### Response: def get_nginx_configuration_spec(po...
def close(self): """Close the channel if open.""" if self._channel and not self._channel.handler.channel_close: self._channel.close() self._channel_ref = None
Close the channel if open.
Below is the the instruction that describes the task: ### Input: Close the channel if open. ### Response: def close(self): """Close the channel if open.""" if self._channel and not self._channel.handler.channel_close: self._channel.close() self._channel_ref = None
def getLoggerWithConsoleHandler(logger_name=None): """ Gets a logger object with a pre-initialized console handler. """ logger = logging.getLogger(logger_name) logger.setLevel(logging.INFO) if not logger.handlers: handler = logging.StreamHandler(sys.stdout) if sys.platform == 'wi...
Gets a logger object with a pre-initialized console handler.
Below is the the instruction that describes the task: ### Input: Gets a logger object with a pre-initialized console handler. ### Response: def getLoggerWithConsoleHandler(logger_name=None): """ Gets a logger object with a pre-initialized console handler. """ logger = logging.getLogger(logger_name)...
def get_calculation_dependants_for(service): """Collect all services which depend on this service :param service: Analysis Service Object/ZCatalog Brain :returns: List of services that depend on this service """ def calc_dependants_gen(service, collector=None): """Generator for recursive r...
Collect all services which depend on this service :param service: Analysis Service Object/ZCatalog Brain :returns: List of services that depend on this service
Below is the the instruction that describes the task: ### Input: Collect all services which depend on this service :param service: Analysis Service Object/ZCatalog Brain :returns: List of services that depend on this service ### Response: def get_calculation_dependants_for(service): """Collect all ser...
def addTextErr(self, text): """add red text""" self._currentColor = self._red self.addText(text)
add red text
Below is the the instruction that describes the task: ### Input: add red text ### Response: def addTextErr(self, text): """add red text""" self._currentColor = self._red self.addText(text)
def looks_like_url(url): """ Simplified check to see if the text appears to be a URL. Similar to `urlparse` but much more basic. Returns: True if the url str appears to be valid. False otherwise. >>> url = looks_like_url("totalgood.org") >>> bool(url) True """ if not isins...
Simplified check to see if the text appears to be a URL. Similar to `urlparse` but much more basic. Returns: True if the url str appears to be valid. False otherwise. >>> url = looks_like_url("totalgood.org") >>> bool(url) True
Below is the the instruction that describes the task: ### Input: Simplified check to see if the text appears to be a URL. Similar to `urlparse` but much more basic. Returns: True if the url str appears to be valid. False otherwise. >>> url = looks_like_url("totalgood.org") >>> bool(ur...
def image_attachment(*args, **kwargs): """The helper function, decorates raw :func:`~sqlalchemy.orm.relationship()` function, sepcialized for relationships between :class:`Image` subtypes. It takes the same parameters as :func:`~sqlalchemy.orm.relationship()`. If ``uselist`` is :const:`True`, it b...
The helper function, decorates raw :func:`~sqlalchemy.orm.relationship()` function, sepcialized for relationships between :class:`Image` subtypes. It takes the same parameters as :func:`~sqlalchemy.orm.relationship()`. If ``uselist`` is :const:`True`, it becomes possible to attach multiple image s...
Below is the the instruction that describes the task: ### Input: The helper function, decorates raw :func:`~sqlalchemy.orm.relationship()` function, sepcialized for relationships between :class:`Image` subtypes. It takes the same parameters as :func:`~sqlalchemy.orm.relationship()`. If ``uselist``...
def initialize_aggregate_metric(section, aggr_hosts, aggr_metrics, metrics, outdir_default, resource_path, label, ts_start, ts_end, rule_strings, important_sub_metrics, anomaly_detection_metrics, other_options): """ Initialize aggregate metric :param: section: config section name ...
Initialize aggregate metric :param: section: config section name :param: aggr_hosts: list of hostnames to aggregate :param: aggr_metrics: list of metrics to aggregate :param: metrics: list of metric objects associated with the current naarad analysis :param: outdir_default: report location :param: resource_...
Below is the the instruction that describes the task: ### Input: Initialize aggregate metric :param: section: config section name :param: aggr_hosts: list of hostnames to aggregate :param: aggr_metrics: list of metrics to aggregate :param: metrics: list of metric objects associated with the current naarad a...
def accept_publication_license(cursor, publication_id, user_id, document_ids, is_accepted=False): """Accept or deny the document license for the publication (``publication_id``) and user (at ``user_id``) for the documents (listed by id as ``document_ids``). """ cursor...
Accept or deny the document license for the publication (``publication_id``) and user (at ``user_id``) for the documents (listed by id as ``document_ids``).
Below is the the instruction that describes the task: ### Input: Accept or deny the document license for the publication (``publication_id``) and user (at ``user_id``) for the documents (listed by id as ``document_ids``). ### Response: def accept_publication_license(cursor, publication_id, user_id, ...
def collapse(self, function): "Deprecated method to collapse layers in the Overlay." if config.future_deprecations: self.param.warning('Overlay.collapse is deprecated, to' 'collapse multiple elements use a HoloMap.') elements = list(self) types...
Deprecated method to collapse layers in the Overlay.
Below is the the instruction that describes the task: ### Input: Deprecated method to collapse layers in the Overlay. ### Response: def collapse(self, function): "Deprecated method to collapse layers in the Overlay." if config.future_deprecations: self.param.warning('Overlay.collapse is...
def check_cell_boundaries(self, ds): """ Checks the dimensions of cell boundary variables to ensure they are CF compliant. 7.1 To represent cells we add the attribute bounds to the appropriate coordinate variable(s). The value of bounds is the name of the variable that contains the vert...
Checks the dimensions of cell boundary variables to ensure they are CF compliant. 7.1 To represent cells we add the attribute bounds to the appropriate coordinate variable(s). The value of bounds is the name of the variable that contains the vertices of the cell boundaries. We refer to this type of var...
Below is the the instruction that describes the task: ### Input: Checks the dimensions of cell boundary variables to ensure they are CF compliant. 7.1 To represent cells we add the attribute bounds to the appropriate coordinate variable(s). The value of bounds is the name of the variable that conta...
def _update_project_watch(config, task_presenter, results, long_description, tutorial): # pragma: no cover """Update a project in a loop.""" logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(message)s', datefmt='%Y-%m-%d %H...
Update a project in a loop.
Below is the the instruction that describes the task: ### Input: Update a project in a loop. ### Response: def _update_project_watch(config, task_presenter, results, long_description, tutorial): # pragma: no cover """Update a project in a loop.""" logging.basicConfig(level=loggin...
def p_generate_for(self, p): 'generate_for : FOR LPAREN forpre forcond forpost RPAREN generate_forcontent' p[0] = ForStatement(p[3], p[4], p[5], p[7], lineno=p.lineno(1)) p.set_lineno(0, p.lineno(1))
generate_for : FOR LPAREN forpre forcond forpost RPAREN generate_forcontent
Below is the the instruction that describes the task: ### Input: generate_for : FOR LPAREN forpre forcond forpost RPAREN generate_forcontent ### Response: def p_generate_for(self, p): 'generate_for : FOR LPAREN forpre forcond forpost RPAREN generate_forcontent' p[0] = ForStatement(p[3], p[4], p[5],...
def fcoe_fcoe_fabric_map_fcoe_fabric_map_name(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") fcoe = ET.SubElement(config, "fcoe", xmlns="urn:brocade.com:mgmt:brocade-fcoe") fcoe_fabric_map = ET.SubElement(fcoe, "fcoe-fabric-map") fcoe_fabric_map...
Auto Generated Code
Below is the the instruction that describes the task: ### Input: Auto Generated Code ### Response: def fcoe_fcoe_fabric_map_fcoe_fabric_map_name(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") fcoe = ET.SubElement(config, "fcoe", xmlns="urn:brocade.com:mgmt...
def get_service_package_quota_history(self, **kwargs): # noqa: E501 """Service package quota history. # noqa: E501 Get your quota usage history. This API is available for commercial accounts. Aggregator accounts can see own and subtenant quota usage data. History data is ordered in ascending order ba...
Service package quota history. # noqa: E501 Get your quota usage history. This API is available for commercial accounts. Aggregator accounts can see own and subtenant quota usage data. History data is ordered in ascending order based on the added timestamp. **Example usage:** curl -X GET https://api.us-...
Below is the the instruction that describes the task: ### Input: Service package quota history. # noqa: E501 Get your quota usage history. This API is available for commercial accounts. Aggregator accounts can see own and subtenant quota usage data. History data is ordered in ascending order based on the ...
def task_master(self): """A `TaskMaster` object for manipulating work""" if self._task_master is None: self._task_master = build_task_master(self.config) return self._task_master
A `TaskMaster` object for manipulating work
Below is the the instruction that describes the task: ### Input: A `TaskMaster` object for manipulating work ### Response: def task_master(self): """A `TaskMaster` object for manipulating work""" if self._task_master is None: self._task_master = build_task_master(self.config) re...
def get_darker_image(self): """Returns an icon 80% more dark""" icon_pressed = self.icon.copy() for x in range(self.w): for y in range(self.h): r, g, b, *_ = tuple(self.icon.get_at((x, y))) const = 0.8 r = int(const * r) ...
Returns an icon 80% more dark
Below is the the instruction that describes the task: ### Input: Returns an icon 80% more dark ### Response: def get_darker_image(self): """Returns an icon 80% more dark""" icon_pressed = self.icon.copy() for x in range(self.w): for y in range(self.h): r, g, b, ...
def coalign_waveforms(h1, h2, psd=None, low_frequency_cutoff=None, high_frequency_cutoff=None, resize=True): """ Return two time series which are aligned in time and phase. The alignment is only to the nearest sample point and all changes to the...
Return two time series which are aligned in time and phase. The alignment is only to the nearest sample point and all changes to the phase are made to the first input waveform. Waveforms should not be split accross the vector boundary. If it is, please use roll or cyclic time shift to ensure that the e...
Below is the the instruction that describes the task: ### Input: Return two time series which are aligned in time and phase. The alignment is only to the nearest sample point and all changes to the phase are made to the first input waveform. Waveforms should not be split accross the vector boundary. If...
def create_client_from_env(username=None, api_key=None, endpoint_url=None, timeout=None, auth=None, config_file=None, proxy=None, u...
Creates a SoftLayer API client using your environment. Settings are loaded via keyword arguments, environemtal variables and config file. :param username: an optional API username if you wish to bypass the package's built-in username :param api_key: an optional API key if you wish to bypass th...
Below is the the instruction that describes the task: ### Input: Creates a SoftLayer API client using your environment. Settings are loaded via keyword arguments, environemtal variables and config file. :param username: an optional API username if you wish to bypass the package's built-in user...
def add_generator_action(self, action): """ Attach/add one :class:`GeneratorAction`. Warning: The order in which you add :class:`GeneratorAction` objects **is** important in case of conflicting :class:`GeneratorAction` objects: **only** the **first compatible** :class:`G...
Attach/add one :class:`GeneratorAction`. Warning: The order in which you add :class:`GeneratorAction` objects **is** important in case of conflicting :class:`GeneratorAction` objects: **only** the **first compatible** :class:`GeneratorAction` object will be used to generate the (source ...
Below is the the instruction that describes the task: ### Input: Attach/add one :class:`GeneratorAction`. Warning: The order in which you add :class:`GeneratorAction` objects **is** important in case of conflicting :class:`GeneratorAction` objects: **only** the **first compatible** ...
def execute_from_command_line(argv=None): """ Currently the only entrypoint (manage.py, demosys-admin) """ if not argv: argv = sys.argv # prog_name = argv[0] system_commands = find_commands(system_command_dir()) project_commands = find_commands(project_command_dir()) project_pa...
Currently the only entrypoint (manage.py, demosys-admin)
Below is the the instruction that describes the task: ### Input: Currently the only entrypoint (manage.py, demosys-admin) ### Response: def execute_from_command_line(argv=None): """ Currently the only entrypoint (manage.py, demosys-admin) """ if not argv: argv = sys.argv # prog_name = ...
def dump(self, filename): """ Dumps statistics. @param filename: filename where stats will be dumped, filename is created and must not exist prior to this call. @type filename: string """ flags = os.O_WRONLY|os.O_CREAT|os.O_NOFOLLOW|os.O_EXCL ...
Dumps statistics. @param filename: filename where stats will be dumped, filename is created and must not exist prior to this call. @type filename: string
Below is the the instruction that describes the task: ### Input: Dumps statistics. @param filename: filename where stats will be dumped, filename is created and must not exist prior to this call. @type filename: string ### Response: def dump(self, filename): """ ...
def _check_dynamic_acl_support(self): """Log an error if any switches don't support dynamic ACLs""" cmds = ['ip access-list openstack-test dynamic', 'no ip access-list openstack-test'] for switch_ip, switch_client in self._switches.items(): try: self.r...
Log an error if any switches don't support dynamic ACLs
Below is the the instruction that describes the task: ### Input: Log an error if any switches don't support dynamic ACLs ### Response: def _check_dynamic_acl_support(self): """Log an error if any switches don't support dynamic ACLs""" cmds = ['ip access-list openstack-test dynamic', ...
def _make_indices(self, Ns): ''' makes indices for cross validation ''' N_new = int(Ns * self.n_splits) test = [np.full(N_new, False) for i in range(self.n_splits)] for i in range(self.n_splits): test[i][np.arange(Ns * i, Ns * (i + 1))] = True train = [np.logical_not...
makes indices for cross validation
Below is the the instruction that describes the task: ### Input: makes indices for cross validation ### Response: def _make_indices(self, Ns): ''' makes indices for cross validation ''' N_new = int(Ns * self.n_splits) test = [np.full(N_new, False) for i in range(self.n_splits)] for...
def get_flags(self, i, scoped=False): """Get flags.""" if scoped and not _SCOPED_FLAG_SUPPORT: return None index = i.index value = ['('] toggle = False end = ':' if scoped else ')' try: c = next(i) if c != '?': ...
Get flags.
Below is the the instruction that describes the task: ### Input: Get flags. ### Response: def get_flags(self, i, scoped=False): """Get flags.""" if scoped and not _SCOPED_FLAG_SUPPORT: return None index = i.index value = ['('] toggle = False end = ':' i...
def add_widget(self): """ Adds the Component Widget to the engine. :return: Method success. :rtype: bool """ LOGGER.debug("> Adding '{0}' Component Widget.".format(self.__class__.__name__)) self.__engine.addDockWidget(Qt.DockWidgetArea(self.__dock_area), self) ...
Adds the Component Widget to the engine. :return: Method success. :rtype: bool
Below is the the instruction that describes the task: ### Input: Adds the Component Widget to the engine. :return: Method success. :rtype: bool ### Response: def add_widget(self): """ Adds the Component Widget to the engine. :return: Method success. :rtype: bool ...
def cli(env, identifier): """Retrieve credentials used for generating an AWS signature. Max of 2.""" mgr = SoftLayer.ObjectStorageManager(env.client) credential_list = mgr.list_credential(identifier) table = formatting.Table(['id', 'password', 'username', 'type_name']) for credential in credential...
Retrieve credentials used for generating an AWS signature. Max of 2.
Below is the the instruction that describes the task: ### Input: Retrieve credentials used for generating an AWS signature. Max of 2. ### Response: def cli(env, identifier): """Retrieve credentials used for generating an AWS signature. Max of 2.""" mgr = SoftLayer.ObjectStorageManager(env.client) cred...
def int_to_charset(val, charset): """ Turn a non-negative integer into a string. >>> int_to_charset(0, B40_CHARS) '0' >>> int_to_charset(658093, B40_CHARS) 'abcd' >>> int_to_charset(40, B40_CHARS) '10' >>> int_to_charset(149190078205533, B40_CHARS) 'muneeb.id' >>> int_to_charset...
Turn a non-negative integer into a string. >>> int_to_charset(0, B40_CHARS) '0' >>> int_to_charset(658093, B40_CHARS) 'abcd' >>> int_to_charset(40, B40_CHARS) '10' >>> int_to_charset(149190078205533, B40_CHARS) 'muneeb.id' >>> int_to_charset(-1, B40_CHARS) Traceback (most recent...
Below is the the instruction that describes the task: ### Input: Turn a non-negative integer into a string. >>> int_to_charset(0, B40_CHARS) '0' >>> int_to_charset(658093, B40_CHARS) 'abcd' >>> int_to_charset(40, B40_CHARS) '10' >>> int_to_charset(149190078205533, B40_CHARS) 'muneeb...
def render_to_response(self, context, **response_kwargs): """ Overloaded to deal with _format arguments. """ # is this a select2 format response? if self.request.GET.get('_format', 'html') == 'select2': results = [] for obj in context['object_list']: ...
Overloaded to deal with _format arguments.
Below is the the instruction that describes the task: ### Input: Overloaded to deal with _format arguments. ### Response: def render_to_response(self, context, **response_kwargs): """ Overloaded to deal with _format arguments. """ # is this a select2 format response? if self...
def get_token_from_header(request): """ Helper function to extract a token from the request header. :param request: OAuthlib request. :type request: oauthlib.common.Request :return: Return the token or None if the Authorization header is malformed. """ token = None if 'Authorization' i...
Helper function to extract a token from the request header. :param request: OAuthlib request. :type request: oauthlib.common.Request :return: Return the token or None if the Authorization header is malformed.
Below is the the instruction that describes the task: ### Input: Helper function to extract a token from the request header. :param request: OAuthlib request. :type request: oauthlib.common.Request :return: Return the token or None if the Authorization header is malformed. ### Response: def get_token_...
def _dens(self,R,z,phi=0.,t=0.): """ NAME: _dens PURPOSE: evaluate the density for this potential INPUT: R - Galactocentric cylindrical radius z - vertical height phi - azimuth t - time OUTPUT: the densi...
NAME: _dens PURPOSE: evaluate the density for this potential INPUT: R - Galactocentric cylindrical radius z - vertical height phi - azimuth t - time OUTPUT: the density HISTORY: 2015-02-07 - Written -...
Below is the the instruction that describes the task: ### Input: NAME: _dens PURPOSE: evaluate the density for this potential INPUT: R - Galactocentric cylindrical radius z - vertical height phi - azimuth t - time OUTPUT: ...
def table_api_put(self, *paths, **kparams): """ helper to make PUT /api/now/v1/table requests """ url = self.flattened_params_url("/api/now/v1/table", *paths) # json.dumps(kparams) is the body of the put/post rjson = self.req("put", url, json.dumps(kparams)).text return json.loa...
helper to make PUT /api/now/v1/table requests
Below is the the instruction that describes the task: ### Input: helper to make PUT /api/now/v1/table requests ### Response: def table_api_put(self, *paths, **kparams): """ helper to make PUT /api/now/v1/table requests """ url = self.flattened_params_url("/api/now/v1/table", *paths) # json...
def _call(self, x, out=None): """Multiply ``x`` and write to ``out`` if given.""" if out is None: return x * self.multiplicand elif not self.__range_is_field: if self.__domain_is_field: out.lincomb(x, self.multiplicand) else: ou...
Multiply ``x`` and write to ``out`` if given.
Below is the the instruction that describes the task: ### Input: Multiply ``x`` and write to ``out`` if given. ### Response: def _call(self, x, out=None): """Multiply ``x`` and write to ``out`` if given.""" if out is None: return x * self.multiplicand elif not self.__range_is_fi...
def sendCommand(self, **msg): """ Sends a raw command to the Slack server, generating a message ID automatically. """ assert 'type' in msg, 'Message type is required.' msg['id'] = self.next_message_id self.next_message_id += 1 if self.next_message_id >= maxint: self.next_message_id = 1 self.sendMe...
Sends a raw command to the Slack server, generating a message ID automatically.
Below is the the instruction that describes the task: ### Input: Sends a raw command to the Slack server, generating a message ID automatically. ### Response: def sendCommand(self, **msg): """ Sends a raw command to the Slack server, generating a message ID automatically. """ assert 'type' in msg, 'Message...
def get_edge_schema_element_or_raise(self, edge_classname): """Return the schema element with the given name, asserting that it's of edge type.""" schema_element = self.get_element_by_class_name_or_raise(edge_classname) if not schema_element.is_edge: raise InvalidClassError(u'Non-ed...
Return the schema element with the given name, asserting that it's of edge type.
Below is the the instruction that describes the task: ### Input: Return the schema element with the given name, asserting that it's of edge type. ### Response: def get_edge_schema_element_or_raise(self, edge_classname): """Return the schema element with the given name, asserting that it's of edge type.""" ...
def plot_pointings(self, pointings=None): """Plot pointings on canavs""" if pointings is None: pointings = self.pointings i = 0 for pointing in pointings: items = [] i = i + 1 label = {} label['text'] = pointing['label']['text...
Plot pointings on canavs
Below is the the instruction that describes the task: ### Input: Plot pointings on canavs ### Response: def plot_pointings(self, pointings=None): """Plot pointings on canavs""" if pointings is None: pointings = self.pointings i = 0 for pointing in pointings: ...
def get_commits(self, repo, organization='llnl'): """ Retrieves the number of commits to a repo in the organization. If it is the first time getting commits for a repo, it will get all commits and save them to JSON. If there are previous commits saved, it will only get commits th...
Retrieves the number of commits to a repo in the organization. If it is the first time getting commits for a repo, it will get all commits and save them to JSON. If there are previous commits saved, it will only get commits that have not been saved to disk since the last date of commits.
Below is the the instruction that describes the task: ### Input: Retrieves the number of commits to a repo in the organization. If it is the first time getting commits for a repo, it will get all commits and save them to JSON. If there are previous commits saved, it will only get commits tha...
def get_attribute(attribute, instance_name=None, instance_id=None, region=None, key=None, keyid=None, profile=None, filters=None): ''' Get an EC2 instance attribute. CLI Example: .. code-block:: bash salt myminion boto_ec2.get_attribute sourceDestCheck instance_name=my_insta...
Get an EC2 instance attribute. CLI Example: .. code-block:: bash salt myminion boto_ec2.get_attribute sourceDestCheck instance_name=my_instance Available attributes: * instanceType * kernel * ramdisk * userData * disableApiTermination * instanceIni...
Below is the the instruction that describes the task: ### Input: Get an EC2 instance attribute. CLI Example: .. code-block:: bash salt myminion boto_ec2.get_attribute sourceDestCheck instance_name=my_instance Available attributes: * instanceType * kernel * ramdisk ...
def clear_notify(self, messages): """ Clears notification popups. Call this to ged rid of messages that don't time out. :param messages: The popups to remove. This should be exactly what :meth:`notify` returned when creating the popup """ newpile...
Clears notification popups. Call this to ged rid of messages that don't time out. :param messages: The popups to remove. This should be exactly what :meth:`notify` returned when creating the popup
Below is the the instruction that describes the task: ### Input: Clears notification popups. Call this to ged rid of messages that don't time out. :param messages: The popups to remove. This should be exactly what :meth:`notify` returned when creating the popup ### Response...
def tweakback(drzfile, input=None, origwcs = None, newname = None, wcsname = None, extname='SCI', force=False, verbose=False): """ Apply WCS solution recorded in drizzled file to distorted input images (``_flt.fits`` files) used to create the drizzled file. This task relies...
Apply WCS solution recorded in drizzled file to distorted input images (``_flt.fits`` files) used to create the drizzled file. This task relies on the original WCS and updated WCS to be recorded in the drizzled image's header as the last 2 alternate WCSs. Parameters ---------- drzfile : str (D...
Below is the the instruction that describes the task: ### Input: Apply WCS solution recorded in drizzled file to distorted input images (``_flt.fits`` files) used to create the drizzled file. This task relies on the original WCS and updated WCS to be recorded in the drizzled image's header as the last ...
def reorder(self, handle, low_value): """ Move an item, specified by handle, into position in a sorted list. Uses the item comparator, if any, to determine the new location. If low_value is true, starts searching from the start of the list, otherwise searches from the end. """ return lib...
Move an item, specified by handle, into position in a sorted list. Uses the item comparator, if any, to determine the new location. If low_value is true, starts searching from the start of the list, otherwise searches from the end.
Below is the the instruction that describes the task: ### Input: Move an item, specified by handle, into position in a sorted list. Uses the item comparator, if any, to determine the new location. If low_value is true, starts searching from the start of the list, otherwise searches from the end. ### Response: def ...
def load(self): """ Loads the shop details and current inventory Raises parseException """ pg = self.usr.getPage("http://www.neopets.com/browseshop.phtml?owner=" + self.owner) # Checks for valid shop if "doesn't have a shop" in pg.content: ...
Loads the shop details and current inventory Raises parseException
Below is the the instruction that describes the task: ### Input: Loads the shop details and current inventory Raises parseException ### Response: def load(self): """ Loads the shop details and current inventory Raises parseException """ ...
def _validate_dt64_dtype(dtype): """ Check that a dtype, if passed, represents either a numpy datetime64[ns] dtype or a pandas DatetimeTZDtype. Parameters ---------- dtype : object Returns ------- dtype : None, numpy.dtype, or DatetimeTZDtype Raises ------ ValueError :...
Check that a dtype, if passed, represents either a numpy datetime64[ns] dtype or a pandas DatetimeTZDtype. Parameters ---------- dtype : object Returns ------- dtype : None, numpy.dtype, or DatetimeTZDtype Raises ------ ValueError : invalid dtype Notes ----- Unlik...
Below is the the instruction that describes the task: ### Input: Check that a dtype, if passed, represents either a numpy datetime64[ns] dtype or a pandas DatetimeTZDtype. Parameters ---------- dtype : object Returns ------- dtype : None, numpy.dtype, or DatetimeTZDtype Raises ...
def warning(cls, name, message, *args): """ Convenience function to log a message at the WARNING level. :param name: The name of the logger instance in the VSG namespace (VSG.<name>) :param message: A message format string. :param args: The arguments that are are merged in...
Convenience function to log a message at the WARNING level. :param name: The name of the logger instance in the VSG namespace (VSG.<name>) :param message: A message format string. :param args: The arguments that are are merged into msg using the string formatting operator. :..note...
Below is the the instruction that describes the task: ### Input: Convenience function to log a message at the WARNING level. :param name: The name of the logger instance in the VSG namespace (VSG.<name>) :param message: A message format string. :param args: The arguments that are are ...
def _ParseCachedEntryXP(self, value_data, cached_entry_offset): """Parses a Windows XP cached entry. Args: value_data (bytes): value data. cached_entry_offset (int): offset of the first cached entry data relative to the start of the value data. Returns: AppCompatCacheCachedEntr...
Parses a Windows XP cached entry. Args: value_data (bytes): value data. cached_entry_offset (int): offset of the first cached entry data relative to the start of the value data. Returns: AppCompatCacheCachedEntry: cached entry. Raises: ParseError: if the value data could...
Below is the the instruction that describes the task: ### Input: Parses a Windows XP cached entry. Args: value_data (bytes): value data. cached_entry_offset (int): offset of the first cached entry data relative to the start of the value data. Returns: AppCompatCacheCachedEntry:...
def get_newest_possible_languagetool_version(): """Return newest compatible version. >>> version = get_newest_possible_languagetool_version() >>> version in [JAVA_6_COMPATIBLE_VERSION, ... JAVA_7_COMPATIBLE_VERSION, ... LATEST_VERSION] True """ java_path = find_...
Return newest compatible version. >>> version = get_newest_possible_languagetool_version() >>> version in [JAVA_6_COMPATIBLE_VERSION, ... JAVA_7_COMPATIBLE_VERSION, ... LATEST_VERSION] True
Below is the the instruction that describes the task: ### Input: Return newest compatible version. >>> version = get_newest_possible_languagetool_version() >>> version in [JAVA_6_COMPATIBLE_VERSION, ... JAVA_7_COMPATIBLE_VERSION, ... LATEST_VERSION] True ### Response: d...
def get_mode(device_filter): """Determine which beacons the scanner should look for.""" from .device_filters import IBeaconFilter, EddystoneFilter, BtAddrFilter, EstimoteFilter if device_filter is None or len(device_filter) == 0: return ScannerMode.MODE_ALL mode = ScannerMode.MODE_NONE for ...
Determine which beacons the scanner should look for.
Below is the the instruction that describes the task: ### Input: Determine which beacons the scanner should look for. ### Response: def get_mode(device_filter): """Determine which beacons the scanner should look for.""" from .device_filters import IBeaconFilter, EddystoneFilter, BtAddrFilter, EstimoteFilte...
def get_access_id(self): """ Gets the application access id. The value can be stored in parameters "access_id" pr "client_id" :return: the application access id. """ access_id = self.get_as_nullable_string("access_id") access_id = access_id if access_id != None else self...
Gets the application access id. The value can be stored in parameters "access_id" pr "client_id" :return: the application access id.
Below is the the instruction that describes the task: ### Input: Gets the application access id. The value can be stored in parameters "access_id" pr "client_id" :return: the application access id. ### Response: def get_access_id(self): """ Gets the application access id. The value can be ...
def config_merge_diff(source='running', merge_config=None, merge_path=None, saltenv='base'): ''' .. versionadded:: 2019.2.0 Return the merge diff, as text, after merging the merge config into the configuration source requested (without l...
.. versionadded:: 2019.2.0 Return the merge diff, as text, after merging the merge config into the configuration source requested (without loading the config on the device). source: ``running`` The configuration type to retrieve from the network device. Default: ``running``. Available opti...
Below is the the instruction that describes the task: ### Input: .. versionadded:: 2019.2.0 Return the merge diff, as text, after merging the merge config into the configuration source requested (without loading the config on the device). source: ``running`` The configuration type to retrieve ...
def add_variables( self, variables: Union[List["Variable"], "Variable"], index: int = None ) -> None: """ Parameters ---------- variable : list of variables or single variable Add variables as problem variables index : int Location to add vari...
Parameters ---------- variable : list of variables or single variable Add variables as problem variables index : int Location to add variables, if None add to the end
Below is the the instruction that describes the task: ### Input: Parameters ---------- variable : list of variables or single variable Add variables as problem variables index : int Location to add variables, if None add to the end ### Response: def add_variables( ...
def sendToLogbook(self, fileName, logType, location=None): '''Process log information and push to selected logbooks.''' import subprocess success = True if logType == "MCC": fileString = "" if not self.imagePixmap.isNull(): fileString = fi...
Process log information and push to selected logbooks.
Below is the the instruction that describes the task: ### Input: Process log information and push to selected logbooks. ### Response: def sendToLogbook(self, fileName, logType, location=None): '''Process log information and push to selected logbooks.''' import subprocess success = ...
def _seconds_to_section_split(record, sections): """ Finds the seconds to the next section from the datetime of a record. """ next_section = sections[ bisect_right(sections, _find_weektime(record.datetime))] * 60 return next_section - _find_weektime(record.datetime, time_type='sec')
Finds the seconds to the next section from the datetime of a record.
Below is the the instruction that describes the task: ### Input: Finds the seconds to the next section from the datetime of a record. ### Response: def _seconds_to_section_split(record, sections): """ Finds the seconds to the next section from the datetime of a record. """ next_section = sections[...
def _get_ipv6_info(cls, ip_address: str) -> tuple: '''Extract the flow info and control id.''' results = socket.getaddrinfo( ip_address, 0, proto=socket.IPPROTO_TCP, flags=socket.AI_NUMERICHOST) flow_info = results[0][4][2] control_id = results[0][4][3] ...
Extract the flow info and control id.
Below is the the instruction that describes the task: ### Input: Extract the flow info and control id. ### Response: def _get_ipv6_info(cls, ip_address: str) -> tuple: '''Extract the flow info and control id.''' results = socket.getaddrinfo( ip_address, 0, proto=socket.IPPROTO_TCP, ...
def get_last_weeks(number_of_weeks): """Get the last weeks.""" time_now = datetime.now() year = time_now.isocalendar()[0] week = time_now.isocalendar()[1] weeks = [] for i in range(0, number_of_weeks): start = get_week_dates(year, week - i, as_timestamp=True)[0] n_year, n_week = ...
Get the last weeks.
Below is the the instruction that describes the task: ### Input: Get the last weeks. ### Response: def get_last_weeks(number_of_weeks): """Get the last weeks.""" time_now = datetime.now() year = time_now.isocalendar()[0] week = time_now.isocalendar()[1] weeks = [] for i in range(0, number_o...
def plot(self): """ The plot object, see [Pyplot][1]. If one does not exist, it will be created first with [`add_subplot`][2]. [1]: http://matplotlib.org/api/pyplot_api.html [2]: http://matplotlib.org/api/figure_api.html#matplotlib.figure.Figure.add_subplot """ ...
The plot object, see [Pyplot][1]. If one does not exist, it will be created first with [`add_subplot`][2]. [1]: http://matplotlib.org/api/pyplot_api.html [2]: http://matplotlib.org/api/figure_api.html#matplotlib.figure.Figure.add_subplot
Below is the the instruction that describes the task: ### Input: The plot object, see [Pyplot][1]. If one does not exist, it will be created first with [`add_subplot`][2]. [1]: http://matplotlib.org/api/pyplot_api.html [2]: http://matplotlib.org/api/figure_api.html#matplotlib.figure.Figure...
def _call_brew(cmd, failhard=True): ''' Calls the brew command with the user account of brew ''' user = __salt__['file.get_user'](_homebrew_bin()) runas = user if user != __opts__['user'] else None cmd = '{} {}'.format(salt.utils.path.which('brew'), cmd) result = __salt__['cmd.run_all'](cmd,...
Calls the brew command with the user account of brew
Below is the the instruction that describes the task: ### Input: Calls the brew command with the user account of brew ### Response: def _call_brew(cmd, failhard=True): ''' Calls the brew command with the user account of brew ''' user = __salt__['file.get_user'](_homebrew_bin()) runas = user if ...
def _create_from_pandas_with_arrow(self, pdf, schema, timezone): """ Create a DataFrame from a given pandas.DataFrame by slicing it into partitions, converting to Arrow data, then sending to the JVM to parallelize. If a schema is passed in, the data types will be used to coerce the data ...
Create a DataFrame from a given pandas.DataFrame by slicing it into partitions, converting to Arrow data, then sending to the JVM to parallelize. If a schema is passed in, the data types will be used to coerce the data in Pandas to Arrow conversion.
Below is the the instruction that describes the task: ### Input: Create a DataFrame from a given pandas.DataFrame by slicing it into partitions, converting to Arrow data, then sending to the JVM to parallelize. If a schema is passed in, the data types will be used to coerce the data in Pandas to Arr...
def tee(self): """ Produces a new deferred and returns it. If this C{MultiDeferred} has not been fired (callbacked or errbacked) yet, the deferred will not have been fired yet either, but will be fired when and if this C{MultiDeferred} gets fired in the future. If this C{...
Produces a new deferred and returns it. If this C{MultiDeferred} has not been fired (callbacked or errbacked) yet, the deferred will not have been fired yet either, but will be fired when and if this C{MultiDeferred} gets fired in the future. If this C{MultiDeferred} has been fired, retu...
Below is the the instruction that describes the task: ### Input: Produces a new deferred and returns it. If this C{MultiDeferred} has not been fired (callbacked or errbacked) yet, the deferred will not have been fired yet either, but will be fired when and if this C{MultiDeferred} gets fired...
def setdefault(self, key, value): """Atomic store conditional. Stores _value_ into dictionary at _key_, but only if _key_ does not already exist in the dictionary. Returns the old value found or the new value. """ with self.lock: if key in self: retur...
Atomic store conditional. Stores _value_ into dictionary at _key_, but only if _key_ does not already exist in the dictionary. Returns the old value found or the new value.
Below is the the instruction that describes the task: ### Input: Atomic store conditional. Stores _value_ into dictionary at _key_, but only if _key_ does not already exist in the dictionary. Returns the old value found or the new value. ### Response: def setdefault(self, key, value): """A...
def check_requirements_file(req_file, skip_packages): """Return list of outdated requirements. Args: req_file (str): Filename of requirements file skip_packages (list): List of package names to ignore. """ reqs = read_requirements(req_file) if skip_packages is not None: reqs...
Return list of outdated requirements. Args: req_file (str): Filename of requirements file skip_packages (list): List of package names to ignore.
Below is the the instruction that describes the task: ### Input: Return list of outdated requirements. Args: req_file (str): Filename of requirements file skip_packages (list): List of package names to ignore. ### Response: def check_requirements_file(req_file, skip_packages): """Return li...
def _retrieve_html_page(self): """ Download the requested player's stats page. Download the requested page and strip all of the comment tags before returning a pyquery object which will be used to parse the data. Returns ------- PyQuery object The re...
Download the requested player's stats page. Download the requested page and strip all of the comment tags before returning a pyquery object which will be used to parse the data. Returns ------- PyQuery object The requested page is returned as a queriable PyQuery obj...
Below is the the instruction that describes the task: ### Input: Download the requested player's stats page. Download the requested page and strip all of the comment tags before returning a pyquery object which will be used to parse the data. Returns ------- PyQuery object ...
def _get_query_results( self, job_id, retry, project=None, timeout_ms=None, location=None ): """Get the query results object for a query job. Arguments: job_id (str): Name of the query job. retry (google.api_core.retry.Retry): (Optional) How to retry ...
Get the query results object for a query job. Arguments: job_id (str): Name of the query job. retry (google.api_core.retry.Retry): (Optional) How to retry the RPC. project (str): (Optional) project ID for the query job (defaults to the ...
Below is the the instruction that describes the task: ### Input: Get the query results object for a query job. Arguments: job_id (str): Name of the query job. retry (google.api_core.retry.Retry): (Optional) How to retry the RPC. project (str): ...
def get_properties(properties, identifier, namespace='cid', searchtype=None, as_dataframe=False, **kwargs): """Retrieve the specified properties from PubChem. :param identifier: The compound, substance or assay identifier to use as a search query. :param namespace: (optional) The identifier type. :para...
Retrieve the specified properties from PubChem. :param identifier: The compound, substance or assay identifier to use as a search query. :param namespace: (optional) The identifier type. :param searchtype: (optional) The advanced search type, one of substructure, superstructure or similarity. :param as...
Below is the the instruction that describes the task: ### Input: Retrieve the specified properties from PubChem. :param identifier: The compound, substance or assay identifier to use as a search query. :param namespace: (optional) The identifier type. :param searchtype: (optional) The advanced search t...