code
stringlengths
75
104k
docstring
stringlengths
1
46.9k
text
stringlengths
164
112k
def checkArgs(args): """Checks the arguments and options. :param args: a :py:class:`argparse.Namespace` object containing the options of the program. :type args: argparse.Namespace :returns: ``True`` if everything was OK. If there is a problem with an option, an exception is rai...
Checks the arguments and options. :param args: a :py:class:`argparse.Namespace` object containing the options of the program. :type args: argparse.Namespace :returns: ``True`` if everything was OK. If there is a problem with an option, an exception is raised using the :py:class:...
Below is the the instruction that describes the task: ### Input: Checks the arguments and options. :param args: a :py:class:`argparse.Namespace` object containing the options of the program. :type args: argparse.Namespace :returns: ``True`` if everything was OK. If there is a pr...
def get_instance(self, payload): """ Build an instance of AvailableAddOnExtensionInstance :param dict payload: Payload response from the API :returns: twilio.rest.preview.marketplace.available_add_on.available_add_on_extension.AvailableAddOnExtensionInstance :rtype: twilio.rest...
Build an instance of AvailableAddOnExtensionInstance :param dict payload: Payload response from the API :returns: twilio.rest.preview.marketplace.available_add_on.available_add_on_extension.AvailableAddOnExtensionInstance :rtype: twilio.rest.preview.marketplace.available_add_on.available_add_o...
Below is the the instruction that describes the task: ### Input: Build an instance of AvailableAddOnExtensionInstance :param dict payload: Payload response from the API :returns: twilio.rest.preview.marketplace.available_add_on.available_add_on_extension.AvailableAddOnExtensionInstance :rt...
def filesfile_string(self): """String with the list of files and prefixes needed to execute ABINIT.""" lines = [] app = lines.append app(self.input_file.path) # 1) Path of the input file app(self.output_file.path) # 2) Path of the output file app(self.dd...
String with the list of files and prefixes needed to execute ABINIT.
Below is the the instruction that describes the task: ### Input: String with the list of files and prefixes needed to execute ABINIT. ### Response: def filesfile_string(self): """String with the list of files and prefixes needed to execute ABINIT.""" lines = [] app = lines.append a...
def frompath(path, accessor=None, ext=None, start=None, stop=None, recursive=False, npartitions=None, dims=None, dtype=None, labels=None, recount=False, engine=None, credentials=None): """ Load images from a path using the given accessor. Supports both local and remote filesystems. Parameters ----...
Load images from a path using the given accessor. Supports both local and remote filesystems. Parameters ---------- accessor : function Apply to each item after loading to yield an image. ext : str, optional, default=None File extension. npartitions : int, optional, default=N...
Below is the the instruction that describes the task: ### Input: Load images from a path using the given accessor. Supports both local and remote filesystems. Parameters ---------- accessor : function Apply to each item after loading to yield an image. ext : str, optional, default=Non...
def _print_pgfplot_libs_message(data): """Prints message to screen indicating the use of PGFPlots and its libraries.""" pgfplotslibs = ",".join(list(data["pgfplots libs"])) tikzlibs = ",".join(list(data["tikz libs"])) print(70 * "=") print("Please add the following lines to your LaTeX preamble:...
Prints message to screen indicating the use of PGFPlots and its libraries.
Below is the the instruction that describes the task: ### Input: Prints message to screen indicating the use of PGFPlots and its libraries. ### Response: def _print_pgfplot_libs_message(data): """Prints message to screen indicating the use of PGFPlots and its libraries.""" pgfplotslibs = ",".join(l...
def delete_group(self, group_id, keep_non_orphans=False, keep_orphans=False): """ Delete a group trigger :param group_id: ID of the group trigger to delete :param keep_non_orphans: if True converts the non-orphan member triggers to standard triggers :param keep_orphans: if True ...
Delete a group trigger :param group_id: ID of the group trigger to delete :param keep_non_orphans: if True converts the non-orphan member triggers to standard triggers :param keep_orphans: if True converts the orphan member triggers to standard triggers
Below is the the instruction that describes the task: ### Input: Delete a group trigger :param group_id: ID of the group trigger to delete :param keep_non_orphans: if True converts the non-orphan member triggers to standard triggers :param keep_orphans: if True converts the orphan member tr...
def valid_path(value): "Validate a cookie path ASCII string" # Generate UnicodeDecodeError if path can't store as ASCII. value.encode("ascii") # Cookies without leading slash will likely be ignored, raise ASAP. if not (value and value[0] == "/"): return False if not Definitions.PATH_RE.m...
Validate a cookie path ASCII string
Below is the the instruction that describes the task: ### Input: Validate a cookie path ASCII string ### Response: def valid_path(value): "Validate a cookie path ASCII string" # Generate UnicodeDecodeError if path can't store as ASCII. value.encode("ascii") # Cookies without leading slash will like...
def obsoleteas(self, to='name_short'): """ Return obsolete countries in the specified classification Parameters ---------- to : str, optional Output classification (valid str for an index of country_data file), default: name_short Returns ...
Return obsolete countries in the specified classification Parameters ---------- to : str, optional Output classification (valid str for an index of country_data file), default: name_short Returns ------- Pandas DataFrame
Below is the the instruction that describes the task: ### Input: Return obsolete countries in the specified classification Parameters ---------- to : str, optional Output classification (valid str for an index of country_data file), default: name_short Retur...
def set_group(self, group): """Set group size of DMatrix (used for ranking). Parameters ---------- group : array like Group size of each group """ _check_call(_LIB.XGDMatrixSetGroup(self.handle, c_array(ctypes.c_uint...
Set group size of DMatrix (used for ranking). Parameters ---------- group : array like Group size of each group
Below is the the instruction that describes the task: ### Input: Set group size of DMatrix (used for ranking). Parameters ---------- group : array like Group size of each group ### Response: def set_group(self, group): """Set group size of DMatrix (used for ranking). ...
def _get_csv_cells_gen(self, line): """Generator of values in a csv line""" digest_types = self.digest_types for j, value in enumerate(line): if self.first_line: digest_key = None digest = lambda x: x.decode(self.encoding) else: ...
Generator of values in a csv line
Below is the the instruction that describes the task: ### Input: Generator of values in a csv line ### Response: def _get_csv_cells_gen(self, line): """Generator of values in a csv line""" digest_types = self.digest_types for j, value in enumerate(line): if self.first_line: ...
def _load_instance(self, instance_id): """ Return instance with the given id. For performance reasons, the instance ID is first searched for in the collection of VM instances started by ElastiCluster (`self._instances`), then in the list of all instances known to the clo...
Return instance with the given id. For performance reasons, the instance ID is first searched for in the collection of VM instances started by ElastiCluster (`self._instances`), then in the list of all instances known to the cloud provider at the time of the last update (`self._...
Below is the the instruction that describes the task: ### Input: Return instance with the given id. For performance reasons, the instance ID is first searched for in the collection of VM instances started by ElastiCluster (`self._instances`), then in the list of all instances known to the ...
def findFilesWithPattern( self, fileName, searchPattern, fillFindData, dokanFileInfo ): """Find files in a certain path that match the search pattern. :param fileName: path to search :type fileName: ctypes.c_wchar_p :param searchPattern: pattern to search for :type s...
Find files in a certain path that match the search pattern. :param fileName: path to search :type fileName: ctypes.c_wchar_p :param searchPattern: pattern to search for :type searchPattern: ctypes.c_wchar_p :param fillFindData: function pointer for populating search results ...
Below is the the instruction that describes the task: ### Input: Find files in a certain path that match the search pattern. :param fileName: path to search :type fileName: ctypes.c_wchar_p :param searchPattern: pattern to search for :type searchPattern: ctypes.c_wchar_p :pa...
def _code(self): """ (internal) generates imports, code and runtime calls to save a pipeline. """ icode, tcode = '', '' # imports, task code icall, pcall = '', '' # imap calls, piper calls tdone, idone = [], [] # task done, imap done for piper in self: ...
(internal) generates imports, code and runtime calls to save a pipeline.
Below is the the instruction that describes the task: ### Input: (internal) generates imports, code and runtime calls to save a pipeline. ### Response: def _code(self): """ (internal) generates imports, code and runtime calls to save a pipeline. """ icode, tcode = '', '' # ...
def request_transfer(subject, recipient, comment): '''Initiate a transfer request''' TransferPermission(subject).test() if recipient == (subject.organization or subject.owner): raise ValueError( 'Recipient should be different than the current owner') transfer = Transfer.objects.creat...
Initiate a transfer request
Below is the the instruction that describes the task: ### Input: Initiate a transfer request ### Response: def request_transfer(subject, recipient, comment): '''Initiate a transfer request''' TransferPermission(subject).test() if recipient == (subject.organization or subject.owner): raise Value...
def _createStatsDict(self, headers, rows): """Utility method that returns database stats as a nested dictionary. @param headers: List of columns in query result. @param rows: List of rows in query result. @return: Nested dictionary of values. Fi...
Utility method that returns database stats as a nested dictionary. @param headers: List of columns in query result. @param rows: List of rows in query result. @return: Nested dictionary of values. First key is the database name and the second key is the...
Below is the the instruction that describes the task: ### Input: Utility method that returns database stats as a nested dictionary. @param headers: List of columns in query result. @param rows: List of rows in query result. @return: Nested dictionary of values. ...
def size(cls, pid): """Return the number of connections in the pool :param str pid: The pool id :rtype int """ with cls._lock: cls._ensure_pool_exists(pid) return len(cls._pools[pid])
Return the number of connections in the pool :param str pid: The pool id :rtype int
Below is the the instruction that describes the task: ### Input: Return the number of connections in the pool :param str pid: The pool id :rtype int ### Response: def size(cls, pid): """Return the number of connections in the pool :param str pid: The pool id :rtype int ...
def is_stale(target, source): """Test whether the target file/directory is stale based on the source file/directory. """ if not os.path.exists(target): return True target_mtime = recursive_mtime(target) or 0 return compare_recursive_mtime(source, cutoff=target_mtime)
Test whether the target file/directory is stale based on the source file/directory.
Below is the the instruction that describes the task: ### Input: Test whether the target file/directory is stale based on the source file/directory. ### Response: def is_stale(target, source): """Test whether the target file/directory is stale based on the source file/directory. """ if no...
def build_vf_node(vf): """ Convert a VulnerabilityFunction object into a Node suitable for XML conversion. """ nodes = [Node('imls', {'imt': vf.imt}, vf.imls), Node('meanLRs', {}, vf.mean_loss_ratios), Node('covLRs', {}, vf.covs)] return Node( 'vulnerabilityFunc...
Convert a VulnerabilityFunction object into a Node suitable for XML conversion.
Below is the the instruction that describes the task: ### Input: Convert a VulnerabilityFunction object into a Node suitable for XML conversion. ### Response: def build_vf_node(vf): """ Convert a VulnerabilityFunction object into a Node suitable for XML conversion. """ nodes = [Node('imls',...
def _process_response(self, request, response): """Convert HttpResponseRedirect to HttpResponse if request is via ajax. This is to allow ajax request to redirect url. """ if request.is_ajax() and hasattr(request, 'horizon'): queued_msgs = request.horizon['async_messages'] ...
Convert HttpResponseRedirect to HttpResponse if request is via ajax. This is to allow ajax request to redirect url.
Below is the the instruction that describes the task: ### Input: Convert HttpResponseRedirect to HttpResponse if request is via ajax. This is to allow ajax request to redirect url. ### Response: def _process_response(self, request, response): """Convert HttpResponseRedirect to HttpResponse if requ...
def device_info(soapy_args=''): """Returns info about selected SoapySDR device""" text = [] try: device = simplesoapy.SoapyDevice(soapy_args) text.append('Selected device: {}'.format(device.hardware)) text.append(' Available RX channels:') text.append(' {}'.format(', '.jo...
Returns info about selected SoapySDR device
Below is the the instruction that describes the task: ### Input: Returns info about selected SoapySDR device ### Response: def device_info(soapy_args=''): """Returns info about selected SoapySDR device""" text = [] try: device = simplesoapy.SoapyDevice(soapy_args) text.append('Selected ...
def generate_command(self): """ Generate a sample command """ example = [] example.append(f"{sys.argv[0]}") for key in sorted(list(self.spec.keys())): if self.spec[key]['type'] == list: value = " ".join(self.spec[key].get('example', '')) el...
Generate a sample command
Below is the the instruction that describes the task: ### Input: Generate a sample command ### Response: def generate_command(self): """ Generate a sample command """ example = [] example.append(f"{sys.argv[0]}") for key in sorted(list(self.spec.keys())): if self...
def alts_columns_used(self): """ Columns from the alternatives table that are used for filtering. """ return list(tz.unique(tz.concatv( util.columns_in_filters(self.alts_predict_filters), util.columns_in_filters(self.alts_fit_filters))))
Columns from the alternatives table that are used for filtering.
Below is the the instruction that describes the task: ### Input: Columns from the alternatives table that are used for filtering. ### Response: def alts_columns_used(self): """ Columns from the alternatives table that are used for filtering. """ return list(tz.unique(tz.concatv( ...
def main(argString=None): """The main function of this module. :param argString: the options. :type argString: list Here are the steps for this function: 1. Prints the options. 2. Uses Plink to extract markers according to LD (:py:func:`selectSNPsAccordingToLD`). 3. Checks if ther...
The main function of this module. :param argString: the options. :type argString: list Here are the steps for this function: 1. Prints the options. 2. Uses Plink to extract markers according to LD (:py:func:`selectSNPsAccordingToLD`). 3. Checks if there is enough markers after pruning...
Below is the the instruction that describes the task: ### Input: The main function of this module. :param argString: the options. :type argString: list Here are the steps for this function: 1. Prints the options. 2. Uses Plink to extract markers according to LD (:py:func:`selectSNPsAc...
def fetch_organization_courses(organization): """ Retrieves the set of courses currently linked to the specified organization """ organization_obj = serializers.deserialize_organization(organization) queryset = internal.OrganizationCourse.objects.filter( organization=organization_obj, ...
Retrieves the set of courses currently linked to the specified organization
Below is the the instruction that describes the task: ### Input: Retrieves the set of courses currently linked to the specified organization ### Response: def fetch_organization_courses(organization): """ Retrieves the set of courses currently linked to the specified organization """ organization_o...
def maps_get_rules_output_rules_groupname(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") maps_get_rules = ET.Element("maps_get_rules") config = maps_get_rules output = ET.SubElement(maps_get_rules, "output") rules = ET.SubElement(output,...
Auto Generated Code
Below is the the instruction that describes the task: ### Input: Auto Generated Code ### Response: def maps_get_rules_output_rules_groupname(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") maps_get_rules = ET.Element("maps_get_rules") config = maps_...
def get_module_environment(env=None, function=None): ''' Get module optional environment. To setup an environment option for a particular module, add either pillar or config at the minion as follows: system-environment: modules: pkg: _: LC_ALL: en_GB.UTF-8 ...
Get module optional environment. To setup an environment option for a particular module, add either pillar or config at the minion as follows: system-environment: modules: pkg: _: LC_ALL: en_GB.UTF-8 FOO: bar install: HELLO: world ...
Below is the the instruction that describes the task: ### Input: Get module optional environment. To setup an environment option for a particular module, add either pillar or config at the minion as follows: system-environment: modules: pkg: _: LC_ALL: en_GB.UTF-8 ...
def killBatchJobs(self, jobIDs): """Kills the given jobs, represented as Job ids, then checks they are dead by checking they are not in the list of issued jobs. """ while True: for jobID in jobIDs: if jobID in self.runningJobs: self.running...
Kills the given jobs, represented as Job ids, then checks they are dead by checking they are not in the list of issued jobs.
Below is the the instruction that describes the task: ### Input: Kills the given jobs, represented as Job ids, then checks they are dead by checking they are not in the list of issued jobs. ### Response: def killBatchJobs(self, jobIDs): """Kills the given jobs, represented as Job ids, then checks t...
def run_filter(vrn_file, align_bam, ref_file, data, items): """Filter and annotate somatic VCFs with damage/bias artifacts on low frequency variants. Moves damage estimation to INFO field, instead of leaving in FILTER. """ if not should_filter(items) or not vcfutils.vcf_has_variants(vrn_file): ...
Filter and annotate somatic VCFs with damage/bias artifacts on low frequency variants. Moves damage estimation to INFO field, instead of leaving in FILTER.
Below is the the instruction that describes the task: ### Input: Filter and annotate somatic VCFs with damage/bias artifacts on low frequency variants. Moves damage estimation to INFO field, instead of leaving in FILTER. ### Response: def run_filter(vrn_file, align_bam, ref_file, data, items): """Filter a...
def FileHashIndexQuery(self, subject, target_prefix, limit=100): """Search the index for matches starting with target_prefix. Args: subject: The index to use. Should be a urn that points to the sha256 namespace. target_prefix: The prefix to match against the index. limit: Either a...
Search the index for matches starting with target_prefix. Args: subject: The index to use. Should be a urn that points to the sha256 namespace. target_prefix: The prefix to match against the index. limit: Either a tuple of (start, limit) or a maximum number of results to retu...
Below is the the instruction that describes the task: ### Input: Search the index for matches starting with target_prefix. Args: subject: The index to use. Should be a urn that points to the sha256 namespace. target_prefix: The prefix to match against the index. limit: Either a tu...
def get_padding_lengths(self) -> Dict[str, Dict[str, int]]: """ Gets the maximum padding lengths from all ``Instances`` in this batch. Each ``Instance`` has multiple ``Fields``, and each ``Field`` could have multiple things that need padding. We look at all fields in all instances, and ...
Gets the maximum padding lengths from all ``Instances`` in this batch. Each ``Instance`` has multiple ``Fields``, and each ``Field`` could have multiple things that need padding. We look at all fields in all instances, and find the max values for each (field_name, padding_key) pair, returning t...
Below is the the instruction that describes the task: ### Input: Gets the maximum padding lengths from all ``Instances`` in this batch. Each ``Instance`` has multiple ``Fields``, and each ``Field`` could have multiple things that need padding. We look at all fields in all instances, and find the ma...
def get_equivalent_qpoints(self, index): """ Returns the list of qpoint indices equivalent (meaning they are the same frac coords) to the given one. Args: index: the qpoint index Returns: a list of equivalent indices TODO: now it uses the label ...
Returns the list of qpoint indices equivalent (meaning they are the same frac coords) to the given one. Args: index: the qpoint index Returns: a list of equivalent indices TODO: now it uses the label we might want to use coordinates instead (in case the...
Below is the the instruction that describes the task: ### Input: Returns the list of qpoint indices equivalent (meaning they are the same frac coords) to the given one. Args: index: the qpoint index Returns: a list of equivalent indices TODO: now it uses th...
def readlines(self, sizehint=-1): """ readlines([size]) -> list of strings, each a line from the file. Call readline() repeatedly and return a list of the lines so read. The optional size argument, if given, is an approximate bound on the total number of bytes in the lines retur...
readlines([size]) -> list of strings, each a line from the file. Call readline() repeatedly and return a list of the lines so read. The optional size argument, if given, is an approximate bound on the total number of bytes in the lines returned.
Below is the the instruction that describes the task: ### Input: readlines([size]) -> list of strings, each a line from the file. Call readline() repeatedly and return a list of the lines so read. The optional size argument, if given, is an approximate bound on the total number of bytes in ...
def _clean_listofcomponents(listofcomponents): """force it to be a list of tuples""" def totuple(item): """return a tuple""" if isinstance(item, (tuple, list)): return item else: return (item, None) return [totuple(item) for item in listofcomponents]
force it to be a list of tuples
Below is the the instruction that describes the task: ### Input: force it to be a list of tuples ### Response: def _clean_listofcomponents(listofcomponents): """force it to be a list of tuples""" def totuple(item): """return a tuple""" if isinstance(item, (tuple, list)): return ...
def t_ATOM(self, t): r'[a-zA-Z_][a-zA-Z_0-9]*' t.type = PLLexer.reserved.get(t.value, 'ATOM') # Check for reserved words return t
r'[a-zA-Z_][a-zA-Z_0-9]*
Below is the the instruction that describes the task: ### Input: r'[a-zA-Z_][a-zA-Z_0-9]* ### Response: def t_ATOM(self, t): r'[a-zA-Z_][a-zA-Z_0-9]*' t.type = PLLexer.reserved.get(t.value, 'ATOM') # Check for reserved words return t
def _read(self, size): """Return size bytes from the stream. """ if self.comptype == "tar": return self.__read(size) c = len(self.dbuf) while c < size: buf = self.__read(self.bufsize) if not buf: break try: ...
Return size bytes from the stream.
Below is the the instruction that describes the task: ### Input: Return size bytes from the stream. ### Response: def _read(self, size): """Return size bytes from the stream. """ if self.comptype == "tar": return self.__read(size) c = len(self.dbuf) while c < si...
def file_put( blockchain_id, hostname, recipient_blockchain_ids, data_name, input_path, passphrase=None, config_path=CONFIG_PATH, wallet_keys=None ): """ Send a file to the given recipient, encrypted and signed with the given blockchain ID. Allow each recipient to receive the data on each of their hosts...
Send a file to the given recipient, encrypted and signed with the given blockchain ID. Allow each recipient to receive the data on each of their hosts. Return {'status': True} on success, and upload to cloud storage Return {'error': ...} on error
Below is the the instruction that describes the task: ### Input: Send a file to the given recipient, encrypted and signed with the given blockchain ID. Allow each recipient to receive the data on each of their hosts. Return {'status': True} on success, and upload to cloud storage Return {'error': .....
def replace_in_files(dirname, replace): """Replace current version with new version in requirements files.""" filepath = os.path.abspath(dirname / "requirements.in") if os.path.isfile(filepath) and header_footer_exists(filepath): replaced = re.sub(Utils.exp, replace, get_file_string(filepath)) ...
Replace current version with new version in requirements files.
Below is the the instruction that describes the task: ### Input: Replace current version with new version in requirements files. ### Response: def replace_in_files(dirname, replace): """Replace current version with new version in requirements files.""" filepath = os.path.abspath(dirname / "requirements.in"...
def _next_non_ff_byte(self, start): """ Return an offset, byte 2-tuple for the next byte in *stream* that is not '\xFF', starting with the byte at offset *start*. If the byte at offset *start* is not '\xFF', *start* and the returned *offset* will be the same. """ ...
Return an offset, byte 2-tuple for the next byte in *stream* that is not '\xFF', starting with the byte at offset *start*. If the byte at offset *start* is not '\xFF', *start* and the returned *offset* will be the same.
Below is the the instruction that describes the task: ### Input: Return an offset, byte 2-tuple for the next byte in *stream* that is not '\xFF', starting with the byte at offset *start*. If the byte at offset *start* is not '\xFF', *start* and the returned *offset* will be the same. ### Res...
def cache_subdirectory( reference_name=None, annotation_name=None, annotation_version=None): """ Which cache subdirectory to use for a given annotation database over a particular reference. All arguments can be omitted to just get the base subdirectory for all pyensembl cached da...
Which cache subdirectory to use for a given annotation database over a particular reference. All arguments can be omitted to just get the base subdirectory for all pyensembl cached datasets.
Below is the the instruction that describes the task: ### Input: Which cache subdirectory to use for a given annotation database over a particular reference. All arguments can be omitted to just get the base subdirectory for all pyensembl cached datasets. ### Response: def cache_subdirectory( refer...
def crypto_pwhash_str_verify(passwd_hash, passwd): """ Verifies the ``passwd`` against a given password hash. Returns True on success, raises InvalidkeyError on failure :param passwd_hash: saved password hash :type passwd_hash: bytes :param passwd: password to be checked :type passwd: bytes...
Verifies the ``passwd`` against a given password hash. Returns True on success, raises InvalidkeyError on failure :param passwd_hash: saved password hash :type passwd_hash: bytes :param passwd: password to be checked :type passwd: bytes :return: success :rtype: boolean
Below is the the instruction that describes the task: ### Input: Verifies the ``passwd`` against a given password hash. Returns True on success, raises InvalidkeyError on failure :param passwd_hash: saved password hash :type passwd_hash: bytes :param passwd: password to be checked :type passwd:...
def add_operation(self, operation_type, operation, mode=None): """Add an operation to the version :param mode: Name of the mode in which the operation is executed :type mode: str :param operation_type: one of 'pre', 'post' :type operation_type: str :param operation: the ...
Add an operation to the version :param mode: Name of the mode in which the operation is executed :type mode: str :param operation_type: one of 'pre', 'post' :type operation_type: str :param operation: the operation to add :type operation: :class:`marabunta.model.Operatio...
Below is the the instruction that describes the task: ### Input: Add an operation to the version :param mode: Name of the mode in which the operation is executed :type mode: str :param operation_type: one of 'pre', 'post' :type operation_type: str :param operation: the opera...
def ingest(self, sources=None, tables=None, stage=None, force=False, load_meta=False): """Ingest a set of sources, specified as source objects, source names, or destination tables. If no stage is specified, execute the sources in groups by stage. Note, however, that when this is called from run...
Ingest a set of sources, specified as source objects, source names, or destination tables. If no stage is specified, execute the sources in groups by stage. Note, however, that when this is called from run_stage, all of the sources have the same stage, so they get grouped together. The result i...
Below is the the instruction that describes the task: ### Input: Ingest a set of sources, specified as source objects, source names, or destination tables. If no stage is specified, execute the sources in groups by stage. Note, however, that when this is called from run_stage, all of the sources ha...
def search(self, start_predictions: torch.Tensor, start_state: StateType, step: StepFunctionType) -> Tuple[torch.Tensor, torch.Tensor]: """ Given a starting state and a step function, apply beam search to find the most likely target sequences. ...
Given a starting state and a step function, apply beam search to find the most likely target sequences. Notes ----- If your step function returns ``-inf`` for some log probabilities (like if you're using a masked log-softmax) then some of the "best" sequences returned ma...
Below is the the instruction that describes the task: ### Input: Given a starting state and a step function, apply beam search to find the most likely target sequences. Notes ----- If your step function returns ``-inf`` for some log probabilities (like if you're using a mask...
def drop(self, **kwargs): """ Removes a collection from the database. **kwargs only because of the optional "writeConcern" field, but does nothing in the TinyDB database. :return: Returns True when successfully drops a collection. Returns False when collection to drop does not ex...
Removes a collection from the database. **kwargs only because of the optional "writeConcern" field, but does nothing in the TinyDB database. :return: Returns True when successfully drops a collection. Returns False when collection to drop does not exist.
Below is the the instruction that describes the task: ### Input: Removes a collection from the database. **kwargs only because of the optional "writeConcern" field, but does nothing in the TinyDB database. :return: Returns True when successfully drops a collection. Returns False when collection to d...
def create_record(self, type, name, data, priority=None, port=None, weight=None, **kwargs): # pylint: disable=redefined-builtin """ Add a new DNS record to the domain :param str type: the type of DNS record to add (``"A"``, ``"CNAME"``, etc.) :p...
Add a new DNS record to the domain :param str type: the type of DNS record to add (``"A"``, ``"CNAME"``, etc.) :param str name: the name (hostname, alias, etc.) of the new record :param str data: the value of the new record :param int priority: the priority of the new record...
Below is the the instruction that describes the task: ### Input: Add a new DNS record to the domain :param str type: the type of DNS record to add (``"A"``, ``"CNAME"``, etc.) :param str name: the name (hostname, alias, etc.) of the new record :param str data: the value of the n...
def build_trees_from_sentence( sentence, syntactic_relations, layer=LAYER_VISLCG3, \ sentence_id=0, **kwargs ): ''' Given a sentence ( a list of EstNLTK's word tokens ), and a list of dependency syntactic relations ( output of normalise_alignments() ), builds trees ( ...
Given a sentence ( a list of EstNLTK's word tokens ), and a list of dependency syntactic relations ( output of normalise_alignments() ), builds trees ( estnltk.syntax.utils.Tree objects ) from the sentence, and returns as a list of Trees (roots of trees). Note that there is ...
Below is the the instruction that describes the task: ### Input: Given a sentence ( a list of EstNLTK's word tokens ), and a list of dependency syntactic relations ( output of normalise_alignments() ), builds trees ( estnltk.syntax.utils.Tree objects ) from the sentence, and returns as a li...
def setup_logging(self): """Setup python logging handler.""" date_format = '%Y-%m-%dT%H:%M:%S' log_format = '%(asctime)s %(levelname)s: %(message)s' if self.opts.verbose: lvl = logging.DEBUG else: lvl = logging.INFO # Requests is a bit chatty ...
Setup python logging handler.
Below is the the instruction that describes the task: ### Input: Setup python logging handler. ### Response: def setup_logging(self): """Setup python logging handler.""" date_format = '%Y-%m-%dT%H:%M:%S' log_format = '%(asctime)s %(levelname)s: %(message)s' if self.opts.verbose: ...
def css(app, env): """ Add bolditalic CSS. :param app: Sphinx application context. :param env: Sphinx environment context. """ srcdir = os.path.abspath(os.path.dirname(__file__)) cssfile = 'bolditalic.css' csspath = os.path.join(srcdir, cssfile) buildpath = os.path.join(app.outdir, ...
Add bolditalic CSS. :param app: Sphinx application context. :param env: Sphinx environment context.
Below is the the instruction that describes the task: ### Input: Add bolditalic CSS. :param app: Sphinx application context. :param env: Sphinx environment context. ### Response: def css(app, env): """ Add bolditalic CSS. :param app: Sphinx application context. :param env: Sphinx environm...
def resolve_tree_i18n_alias(self, alias): """Resolves internationalized tree alias. Verifies whether a separate sitetree is available for currently active language. If so, returns i18n alias. If not, returns the initial alias. :param str|unicode alias: :rtype: str|unicode ...
Resolves internationalized tree alias. Verifies whether a separate sitetree is available for currently active language. If so, returns i18n alias. If not, returns the initial alias. :param str|unicode alias: :rtype: str|unicode
Below is the the instruction that describes the task: ### Input: Resolves internationalized tree alias. Verifies whether a separate sitetree is available for currently active language. If so, returns i18n alias. If not, returns the initial alias. :param str|unicode alias: :rtype: st...
def remove_resources(self, resources): """ Removes resources from the event. *resources* can be a list of email addresses or :class:`ExchangeEventAttendee` objects. """ resources_to_delete = self._build_resource_dictionary(resources) for email in resources_to_delete.keys(): if email in s...
Removes resources from the event. *resources* can be a list of email addresses or :class:`ExchangeEventAttendee` objects.
Below is the the instruction that describes the task: ### Input: Removes resources from the event. *resources* can be a list of email addresses or :class:`ExchangeEventAttendee` objects. ### Response: def remove_resources(self, resources): """ Removes resources from the event. *resources* can be ...
def gradient_list(start, end, steps): """Compute gradient colors""" delta = [end[i] - start[i] for i in range(4)] return [bytearray(start[j] + (delta[j] * i) // steps for j in range(4)) for i in range(steps + 1)]
Compute gradient colors
Below is the the instruction that describes the task: ### Input: Compute gradient colors ### Response: def gradient_list(start, end, steps): """Compute gradient colors""" delta = [end[i] - start[i] for i in range(4)] return [bytearray(start[j] + (delta[j] * i) // steps for j in range(4)) fo...
def p_expr_noin(self, p): """expr_noin : assignment_expr_noin | expr_noin COMMA assignment_expr_noin """ if len(p) == 2: p[0] = p[1] else: p[0] = ast.Comma(left=p[1], right=p[3])
expr_noin : assignment_expr_noin | expr_noin COMMA assignment_expr_noin
Below is the the instruction that describes the task: ### Input: expr_noin : assignment_expr_noin | expr_noin COMMA assignment_expr_noin ### Response: def p_expr_noin(self, p): """expr_noin : assignment_expr_noin | expr_noin COMMA assignment_expr_noin """ ...
def addItem(self, item, message=None): """add a new Item class object""" if message is None: message = 'Adding item %s' % item.path try: v = Version.new(repo=self) v.addItem(item) v.save(message) except VersionError, e: raise Re...
add a new Item class object
Below is the the instruction that describes the task: ### Input: add a new Item class object ### Response: def addItem(self, item, message=None): """add a new Item class object""" if message is None: message = 'Adding item %s' % item.path try: v = Version.new(repo=se...
def __convert_json_to_projects_map(self, json): """ Convert JSON format to the projects map format map[ds][repository] = project If a repository is in several projects assign to leaf Check that all JSON data is in the database :param json: data with the projects to repositories ...
Convert JSON format to the projects map format map[ds][repository] = project If a repository is in several projects assign to leaf Check that all JSON data is in the database :param json: data with the projects to repositories mapping :returns: the repositories to projects mappi...
Below is the the instruction that describes the task: ### Input: Convert JSON format to the projects map format map[ds][repository] = project If a repository is in several projects assign to leaf Check that all JSON data is in the database :param json: data with the projects to repo...
def default_create_thread(callback): """ Default thread creation - used to create threads when the client doesn't want to provide their own thread creation. :param function callback: the callback function provided to threading.Thread """ thread = threading.Thread(None, callback) thread.daem...
Default thread creation - used to create threads when the client doesn't want to provide their own thread creation. :param function callback: the callback function provided to threading.Thread
Below is the the instruction that describes the task: ### Input: Default thread creation - used to create threads when the client doesn't want to provide their own thread creation. :param function callback: the callback function provided to threading.Thread ### Response: def default_create_thread(callback...
def update(self, *args, **kwargs): """ update() method will *recursively* update nested dict: >>> d=Dict({'a':{'b':{'c':3,'d':4},'h':4}}) >>> d.update({'a':{'b':{'c':'888'}}}) >>> d {'a': {'b': {'c': '888', 'd': 4}, 'h': 4}} please use update_dict() ...
update() method will *recursively* update nested dict: >>> d=Dict({'a':{'b':{'c':3,'d':4},'h':4}}) >>> d.update({'a':{'b':{'c':'888'}}}) >>> d {'a': {'b': {'c': '888', 'd': 4}, 'h': 4}} please use update_dict() if you do not want this behaviour
Below is the the instruction that describes the task: ### Input: update() method will *recursively* update nested dict: >>> d=Dict({'a':{'b':{'c':3,'d':4},'h':4}}) >>> d.update({'a':{'b':{'c':'888'}}}) >>> d {'a': {'b': {'c': '888', 'd': 4}, 'h': 4}} ple...
def vcpu_pin(vm_, vcpu, cpus): ''' Set which CPUs a VCPU can use. CLI Example: .. code-block:: bash salt 'foo' virt.vcpu_pin domU-id 2 1 salt 'foo' virt.vcpu_pin domU-id 2 2-6 ''' with _get_xapi_session() as xapi: vm_uuid = _get_label_uuid(xapi, 'VM', vm_) if ...
Set which CPUs a VCPU can use. CLI Example: .. code-block:: bash salt 'foo' virt.vcpu_pin domU-id 2 1 salt 'foo' virt.vcpu_pin domU-id 2 2-6
Below is the the instruction that describes the task: ### Input: Set which CPUs a VCPU can use. CLI Example: .. code-block:: bash salt 'foo' virt.vcpu_pin domU-id 2 1 salt 'foo' virt.vcpu_pin domU-id 2 2-6 ### Response: def vcpu_pin(vm_, vcpu, cpus): ''' Set which CPUs a VCPU can...
def modify(self, pk=None, create_on_missing=False, **kwargs): """Modify an existing notification template. Not all required configuration-related fields (required according to notification_type) should be provided. Fields in the resource's `identity` tuple can be used in lieu of a ...
Modify an existing notification template. Not all required configuration-related fields (required according to notification_type) should be provided. Fields in the resource's `identity` tuple can be used in lieu of a primary key for a lookup; in such a case, only other fields are ...
Below is the the instruction that describes the task: ### Input: Modify an existing notification template. Not all required configuration-related fields (required according to notification_type) should be provided. Fields in the resource's `identity` tuple can be used in lieu of a ...
def sign_metadata(metadata, key, cert, sign_algorithm=OneLogin_Saml2_Constants.RSA_SHA1, digest_algorithm=OneLogin_Saml2_Constants.SHA1): """ Signs the metadata with the key/cert provided :param metadata: SAML Metadata XML :type metadata: string :param key: x509 key :ty...
Signs the metadata with the key/cert provided :param metadata: SAML Metadata XML :type metadata: string :param key: x509 key :type key: string :param cert: x509 cert :type cert: string :returns: Signed Metadata :rtype: string :param sign_algor...
Below is the the instruction that describes the task: ### Input: Signs the metadata with the key/cert provided :param metadata: SAML Metadata XML :type metadata: string :param key: x509 key :type key: string :param cert: x509 cert :type cert: string :retur...
def build_policy(self, name, statements, roles, is_managed_policy=False): """ Generate policy for IAM cloudformation template :param name: Name of the policy :param statements: The "rules" the policy should have :param roles: The roles associated with this policy :param i...
Generate policy for IAM cloudformation template :param name: Name of the policy :param statements: The "rules" the policy should have :param roles: The roles associated with this policy :param is_managed_policy: True if managed policy :return: Ref to new policy
Below is the the instruction that describes the task: ### Input: Generate policy for IAM cloudformation template :param name: Name of the policy :param statements: The "rules" the policy should have :param roles: The roles associated with this policy :param is_managed_policy: True if...
def set_fd_value(tag, value): """ Setters for data that also work with implicit transfersyntax :param value: the value to set on the tag :param tag: the tag to read """ if tag.VR == 'OB' or tag.VR == 'UN': value = struct.pack('d', value) tag.value = value
Setters for data that also work with implicit transfersyntax :param value: the value to set on the tag :param tag: the tag to read
Below is the the instruction that describes the task: ### Input: Setters for data that also work with implicit transfersyntax :param value: the value to set on the tag :param tag: the tag to read ### Response: def set_fd_value(tag, value): """ Setters for data that also work with implicit transfer...
def services(self): """ Gets the services object which will provide the ArcGIS Server's admin information about services and folders. """ if self._resources is None: self.__init() if "services" in self._resources: url = self._url + "/services" ...
Gets the services object which will provide the ArcGIS Server's admin information about services and folders.
Below is the the instruction that describes the task: ### Input: Gets the services object which will provide the ArcGIS Server's admin information about services and folders. ### Response: def services(self): """ Gets the services object which will provide the ArcGIS Server's admin ...
def disconnect_account(self): """ Disconnect current account from the application :return: """ url = self.disconnect_url result = self.get(url) return result
Disconnect current account from the application :return:
Below is the the instruction that describes the task: ### Input: Disconnect current account from the application :return: ### Response: def disconnect_account(self): """ Disconnect current account from the application :return: """ url = self.disconnect_url re...
def copy(self): """ Get a copy of this item but with a new id :return: copy of this object with a new id :rtype: object """ # New dummy item with it's own running properties copied_item = self.__class__({}) # Now, copy the properties for prop in s...
Get a copy of this item but with a new id :return: copy of this object with a new id :rtype: object
Below is the the instruction that describes the task: ### Input: Get a copy of this item but with a new id :return: copy of this object with a new id :rtype: object ### Response: def copy(self): """ Get a copy of this item but with a new id :return: copy of this object wit...
def read_resolv_conf(self, f): """Process f as a file in the /etc/resolv.conf format. If f is a string, it is used as the name of the file to open; otherwise it is treated as the file itself.""" if isinstance(f, basestring): try: f = open(f, 'r') ...
Process f as a file in the /etc/resolv.conf format. If f is a string, it is used as the name of the file to open; otherwise it is treated as the file itself.
Below is the the instruction that describes the task: ### Input: Process f as a file in the /etc/resolv.conf format. If f is a string, it is used as the name of the file to open; otherwise it is treated as the file itself. ### Response: def read_resolv_conf(self, f): """Process f as a file...
def allows_url (self, url_data): """Ask robots.txt allowance.""" roboturl = url_data.get_robots_txt_url() with self.get_lock(roboturl): return self._allows_url(url_data, roboturl)
Ask robots.txt allowance.
Below is the the instruction that describes the task: ### Input: Ask robots.txt allowance. ### Response: def allows_url (self, url_data): """Ask robots.txt allowance.""" roboturl = url_data.get_robots_txt_url() with self.get_lock(roboturl): return self._allows_url(url_data, robo...
def buffer(self, geometries, inSR, distances, units, outSR=None, bufferSR=None, unionResults=True, geodesic=True ): """ The buffer operation is performed on a geometr...
The buffer operation is performed on a geometry service resource The result of this operation is buffered polygons at the specified distances for the input geometry array. Options are available to union buffers and to use geodesic distance. Inputs: geometries - ...
Below is the the instruction that describes the task: ### Input: The buffer operation is performed on a geometry service resource The result of this operation is buffered polygons at the specified distances for the input geometry array. Options are available to union buffers and to ...
def _parse_path_table(self, ptr_size, extent): # type: (int, int) -> Tuple[List[path_table_record.PathTableRecord], Dict[int, path_table_record.PathTableRecord]] ''' An internal method to parse a path table on an ISO. For each path table entry found, a Path Table Record object is create...
An internal method to parse a path table on an ISO. For each path table entry found, a Path Table Record object is created, and the callback is called. Parameters: vd - The volume descriptor that these path table records correspond to. extent - The extent at which this path t...
Below is the the instruction that describes the task: ### Input: An internal method to parse a path table on an ISO. For each path table entry found, a Path Table Record object is created, and the callback is called. Parameters: vd - The volume descriptor that these path table rec...
def merge_fastqs(job, job_vars): """ Unzips input sample and concats the Read1 and Read2 groups together. job_vars: tuple Tuple of dictionaries: input_args and ids """ input_args, ids = job_vars work_dir = job.fileStore.getLocalTempDir() cores = input_args['cpu_count'] single_end_re...
Unzips input sample and concats the Read1 and Read2 groups together. job_vars: tuple Tuple of dictionaries: input_args and ids
Below is the the instruction that describes the task: ### Input: Unzips input sample and concats the Read1 and Read2 groups together. job_vars: tuple Tuple of dictionaries: input_args and ids ### Response: def merge_fastqs(job, job_vars): """ Unzips input sample and concats the Read1 and Read2 gro...
def chat_react(self, msg_id, emoji='smile', **kwargs): """Updates the text of the chat message.""" return self.__call_api_post('chat.react', messageId=msg_id, emoji=emoji, kwargs=kwargs)
Updates the text of the chat message.
Below is the the instruction that describes the task: ### Input: Updates the text of the chat message. ### Response: def chat_react(self, msg_id, emoji='smile', **kwargs): """Updates the text of the chat message.""" return self.__call_api_post('chat.react', messageId=msg_id, emoji=emoji, kwargs=kwa...
def sort(filename, key, outputFile, fields=None, watermark=1024 * 1024 * 100): """Sort a potentially big file filename - the input file (standard File format) key - a list of field names to sort by outputFile - the name of the output file fields - a list of fields that should be included (all fields if None)...
Sort a potentially big file filename - the input file (standard File format) key - a list of field names to sort by outputFile - the name of the output file fields - a list of fields that should be included (all fields if None) watermark - when available memory goes bellow the watermark create a new chunk ...
Below is the the instruction that describes the task: ### Input: Sort a potentially big file filename - the input file (standard File format) key - a list of field names to sort by outputFile - the name of the output file fields - a list of fields that should be included (all fields if None) watermark - ...
def _system_path(self, subdir, basename=''): ''' Gets the full path to the 'subdir/basename' file in the system binwalk directory. @subdir - Subdirectory inside the system binwalk directory. @basename - File name inside the subdirectory. Returns the full path to the 'subdir/b...
Gets the full path to the 'subdir/basename' file in the system binwalk directory. @subdir - Subdirectory inside the system binwalk directory. @basename - File name inside the subdirectory. Returns the full path to the 'subdir/basename' file.
Below is the the instruction that describes the task: ### Input: Gets the full path to the 'subdir/basename' file in the system binwalk directory. @subdir - Subdirectory inside the system binwalk directory. @basename - File name inside the subdirectory. Returns the full path to the 'subd...
async def _find_trigger(self, request: Request, origin: Optional[Text]=None, internal: bool=False) \ -> Tuple[ Optional[BaseTrigger], Optional[Type[BaseState]], Optional[bool],...
Find the best trigger for this request, or go away.
Below is the the instruction that describes the task: ### Input: Find the best trigger for this request, or go away. ### Response: async def _find_trigger(self, request: Request, origin: Optional[Text]=None, internal: bool=False) \...
def _first(self, tag): ''' Returns the first element with required POS-tag. ''' self.getelements() for element in self.elements: if tag in self.pos(element): return element return None
Returns the first element with required POS-tag.
Below is the the instruction that describes the task: ### Input: Returns the first element with required POS-tag. ### Response: def _first(self, tag): ''' Returns the first element with required POS-tag. ''' self.getelements() for element in self.elements: if tag in self.pos(element): return element ...
def _get_desired_deployment_id(self): ''' Helper method to return the deployment id matching the desired deployment label for this Swagger object based on the given api_name, swagger_file ''' deployments = __salt__['boto_apigateway.describe_api_deployments'](restApiId=self.restAp...
Helper method to return the deployment id matching the desired deployment label for this Swagger object based on the given api_name, swagger_file
Below is the the instruction that describes the task: ### Input: Helper method to return the deployment id matching the desired deployment label for this Swagger object based on the given api_name, swagger_file ### Response: def _get_desired_deployment_id(self): ''' Helper method to return ...
def _clone(self, deepcopy=True): """Internal clone helper.""" clone = self._clone_base() values_to_clone = ("spec", "projection", "skip", "limit", "max_time_ms", "max_await_time_ms", "comment", "max", "min", "ordering", "explain", "hint", ...
Internal clone helper.
Below is the the instruction that describes the task: ### Input: Internal clone helper. ### Response: def _clone(self, deepcopy=True): """Internal clone helper.""" clone = self._clone_base() values_to_clone = ("spec", "projection", "skip", "limit", "max_time_ms", ...
def XML(content, source=None): """Parses the XML text using the ET.XML function, but handling the ParseError in a user-friendly way. """ try: tree = ET.XML(content) except ET.ParseError as err: x_parse_error(err, content, source) return tree
Parses the XML text using the ET.XML function, but handling the ParseError in a user-friendly way.
Below is the the instruction that describes the task: ### Input: Parses the XML text using the ET.XML function, but handling the ParseError in a user-friendly way. ### Response: def XML(content, source=None): """Parses the XML text using the ET.XML function, but handling the ParseError in a user-friend...
def readBimFile(basefilename): """ Helper fuinction that reads bim files """ # read bim file bim_fn = basefilename+'.bim' rv = SP.loadtxt(bim_fn,delimiter='\t',usecols = (0,3),dtype=int) return rv
Helper fuinction that reads bim files
Below is the the instruction that describes the task: ### Input: Helper fuinction that reads bim files ### Response: def readBimFile(basefilename): """ Helper fuinction that reads bim files """ # read bim file bim_fn = basefilename+'.bim' rv = SP.loadtxt(bim_fn,delimiter='\t',usecols = (0,3...
def update_consumer_group(self, project, logstore, consumer_group, timeout=None, in_order=None): """ Update consumer group :type project: string :param project: project name :type logstore: string :param logstore: logstore name :type consumer_group: string ...
Update consumer group :type project: string :param project: project name :type logstore: string :param logstore: logstore name :type consumer_group: string :param consumer_group: consumer group name :type timeout: int :param timeout: timeou...
Below is the the instruction that describes the task: ### Input: Update consumer group :type project: string :param project: project name :type logstore: string :param logstore: logstore name :type consumer_group: string :param consumer_group: consumer gro...
def sync(self): """Retrieve panel information from ElkM1""" self._elk.add_handler('VN', self._vn_handler) self._elk.add_handler('XK', self._xk_handler) self._elk.add_handler('RP', self._rp_handler) self._elk.add_handler('IE', self._elk.call_sync_handlers) self._elk.add_ha...
Retrieve panel information from ElkM1
Below is the the instruction that describes the task: ### Input: Retrieve panel information from ElkM1 ### Response: def sync(self): """Retrieve panel information from ElkM1""" self._elk.add_handler('VN', self._vn_handler) self._elk.add_handler('XK', self._xk_handler) self._elk.add_...
def generate_sample_module(module_dir): """Generate skeleton sample module.""" if os.path.isdir(module_dir): LOGGER.error("Error generating sample module -- directory %s " "already exists!", module_dir) sys.exit(1) os.mkdir(module_dir)
Generate skeleton sample module.
Below is the the instruction that describes the task: ### Input: Generate skeleton sample module. ### Response: def generate_sample_module(module_dir): """Generate skeleton sample module.""" if os.path.isdir(module_dir): LOGGER.error("Error generating sample module -- directory %s " ...
def _parse_from_file(self, file_path): """ см. описание _parse_from_text. Только на вход подаётся не текст, а путь к файлу. """ file_path = abspath(file_path) if not isfile(file_path): raise MarkovTextExcept("Передан не файл.") with open(file_path, "rb...
см. описание _parse_from_text. Только на вход подаётся не текст, а путь к файлу.
Below is the the instruction that describes the task: ### Input: см. описание _parse_from_text. Только на вход подаётся не текст, а путь к файлу. ### Response: def _parse_from_file(self, file_path): """ см. описание _parse_from_text. Только на вход подаётся не текст, а путь к файлу....
def panel_capacity(panel): """ Returns the panel capacity in MW. Parameters ---------- panel : string Panel name, e.g. "Sunpower" Returns ------- capacity : float In MW """ c = vresutils.reatlas.solarpanelconf_to_solar_panel_config_object(panel) retu...
Returns the panel capacity in MW. Parameters ---------- panel : string Panel name, e.g. "Sunpower" Returns ------- capacity : float In MW
Below is the the instruction that describes the task: ### Input: Returns the panel capacity in MW. Parameters ---------- panel : string Panel name, e.g. "Sunpower" Returns ------- capacity : float In MW ### Response: def panel_capacity(panel): """ Returns t...
def window_lanczos(N): r"""Lanczos window also known as sinc window. :param N: window length .. math:: w(n) = sinc \left( \frac{2n}{N-1} - 1 \right) .. plot:: :width: 80% :include-source: from spectrum import window_visu window_visu(64, 'lanczos') .. seealso:: :...
r"""Lanczos window also known as sinc window. :param N: window length .. math:: w(n) = sinc \left( \frac{2n}{N-1} - 1 \right) .. plot:: :width: 80% :include-source: from spectrum import window_visu window_visu(64, 'lanczos') .. seealso:: :func:`create_window`, :clas...
Below is the the instruction that describes the task: ### Input: r"""Lanczos window also known as sinc window. :param N: window length .. math:: w(n) = sinc \left( \frac{2n}{N-1} - 1 \right) .. plot:: :width: 80% :include-source: from spectrum import window_visu wind...
def create_sdist(self, tag): """Create an sdist and return the full file path of the .tar.gz.""" logger.info("Making tempdir for %s with tag %s...", self.package, tag) self.wrapper.vcs.checkout_from_tag(tag) # checkout_from_tag() chdirs to a temp directory that we nee...
Create an sdist and return the full file path of the .tar.gz.
Below is the the instruction that describes the task: ### Input: Create an sdist and return the full file path of the .tar.gz. ### Response: def create_sdist(self, tag): """Create an sdist and return the full file path of the .tar.gz.""" logger.info("Making tempdir for %s with tag %s...", ...
def poll_output(self): """ Append lines from stdout to self.output. Returns: list: The lines added since last call """ if self.block: return self.output new_list = self.output[self.old_output_size:] self.old_output_size += len(new_list) ...
Append lines from stdout to self.output. Returns: list: The lines added since last call
Below is the the instruction that describes the task: ### Input: Append lines from stdout to self.output. Returns: list: The lines added since last call ### Response: def poll_output(self): """ Append lines from stdout to self.output. Returns: list: The lin...
def remove_comments(tex_source): """Delete latex comments from TeX source. Parameters ---------- tex_source : str TeX source content. Returns ------- tex_source : str TeX source without comments. """ # Expression via http://stackoverflow.com/a/13365453 return re...
Delete latex comments from TeX source. Parameters ---------- tex_source : str TeX source content. Returns ------- tex_source : str TeX source without comments.
Below is the the instruction that describes the task: ### Input: Delete latex comments from TeX source. Parameters ---------- tex_source : str TeX source content. Returns ------- tex_source : str TeX source without comments. ### Response: def remove_comments(tex_source): ...
def _setup_adc(self, flags): '''Initialize ADC ''' self._intf.write(self._base_addr + self.MAX_1239_ADD, array('B', pack('B', flags)))
Initialize ADC
Below is the the instruction that describes the task: ### Input: Initialize ADC ### Response: def _setup_adc(self, flags): '''Initialize ADC ''' self._intf.write(self._base_addr + self.MAX_1239_ADD, array('B', pack('B', flags)))
def _adjust_cwd(self, path): """ Return an adjusted path if we're emulating a "current working directory" for the server. """ path = b(path) if self._cwd is None: return path if len(path) and path[0:1] == b_slash: # absolute path ...
Return an adjusted path if we're emulating a "current working directory" for the server.
Below is the the instruction that describes the task: ### Input: Return an adjusted path if we're emulating a "current working directory" for the server. ### Response: def _adjust_cwd(self, path): """ Return an adjusted path if we're emulating a "current working directory" for the s...
def rename(self, old_table, new_table): """ Rename a table. You must have ALTER and DROP privileges for the original table, and CREATE and INSERT privileges for the new table. """ try: command = 'RENAME TABLE {0} TO {1}'.format(wrap(old_table), wrap(new_table...
Rename a table. You must have ALTER and DROP privileges for the original table, and CREATE and INSERT privileges for the new table.
Below is the the instruction that describes the task: ### Input: Rename a table. You must have ALTER and DROP privileges for the original table, and CREATE and INSERT privileges for the new table. ### Response: def rename(self, old_table, new_table): """ Rename a table. Yo...
def list_folders(location='\\'): r''' List all folders located in a specific location in the task scheduler. :param str location: A string value representing the folder from which you want to list tasks. Default is '\\' which is the root for the task scheduler (C:\Windows\System32\tasks). ...
r''' List all folders located in a specific location in the task scheduler. :param str location: A string value representing the folder from which you want to list tasks. Default is '\\' which is the root for the task scheduler (C:\Windows\System32\tasks). :return: Returns a list of folder...
Below is the the instruction that describes the task: ### Input: r''' List all folders located in a specific location in the task scheduler. :param str location: A string value representing the folder from which you want to list tasks. Default is '\\' which is the root for the task schedule...
def disable_reporters(self): """disable all reporters""" for _reporters in self._reports.values(): for report_id, _, _ in _reporters: self.disable_report(report_id)
disable all reporters
Below is the the instruction that describes the task: ### Input: disable all reporters ### Response: def disable_reporters(self): """disable all reporters""" for _reporters in self._reports.values(): for report_id, _, _ in _reporters: self.disable_report(report_id)
def _set_network(self, v, load=False): """ Setter method for network, mapped from YANG variable /routing_system/interface/ve/ipv6/interface_ospfv3_conf/network (enumeration) If this variable is read-only (config: false) in the source YANG file, then _set_network is considered as a private method. Ba...
Setter method for network, mapped from YANG variable /routing_system/interface/ve/ipv6/interface_ospfv3_conf/network (enumeration) If this variable is read-only (config: false) in the source YANG file, then _set_network is considered as a private method. Backends looking to populate this variable should ...
Below is the the instruction that describes the task: ### Input: Setter method for network, mapped from YANG variable /routing_system/interface/ve/ipv6/interface_ospfv3_conf/network (enumeration) If this variable is read-only (config: false) in the source YANG file, then _set_network is considered as a priv...
def code_binary(item): """ Return a binary 'code' suitable for hashing. """ code_str = code(item) if isinstance(code_str, six.string_types): return code_str.encode('utf-8') return code_str
Return a binary 'code' suitable for hashing.
Below is the the instruction that describes the task: ### Input: Return a binary 'code' suitable for hashing. ### Response: def code_binary(item): """ Return a binary 'code' suitable for hashing. """ code_str = code(item) if isinstance(code_str, six.string_types): return code_str.encode...
def git_clone(target_dir, repo_location, branch_or_tag=None, verbose=True): """Clone repo at repo_location to target_dir and checkout branch_or_tag. If branch_or_tag is not specified, the HEAD of the primary branch of the cloned repo is checked out. """ target_dir = pipes.quote(target_dir) comm...
Clone repo at repo_location to target_dir and checkout branch_or_tag. If branch_or_tag is not specified, the HEAD of the primary branch of the cloned repo is checked out.
Below is the the instruction that describes the task: ### Input: Clone repo at repo_location to target_dir and checkout branch_or_tag. If branch_or_tag is not specified, the HEAD of the primary branch of the cloned repo is checked out. ### Response: def git_clone(target_dir, repo_location, branch_or_tag=N...
def create_new_layer(layer, n_dim): ''' create new layer for the graph ''' input_shape = layer.output.shape dense_deeper_classes = [StubDense, get_dropout_class(n_dim), StubReLU] conv_deeper_classes = [get_conv_class(n_dim), get_batch_norm_class(n_dim), StubReLU] if is_layer(layer, "ReLU"): ...
create new layer for the graph
Below is the the instruction that describes the task: ### Input: create new layer for the graph ### Response: def create_new_layer(layer, n_dim): ''' create new layer for the graph ''' input_shape = layer.output.shape dense_deeper_classes = [StubDense, get_dropout_class(n_dim), StubReLU] con...
def play_Note(self, note, channel=1, velocity=100): """Play a Note object on a channel with a velocity[0-127]. You can either specify the velocity and channel here as arguments or you can set the Note.velocity and Note.channel attributes, which will take presedence over the function arg...
Play a Note object on a channel with a velocity[0-127]. You can either specify the velocity and channel here as arguments or you can set the Note.velocity and Note.channel attributes, which will take presedence over the function arguments.
Below is the the instruction that describes the task: ### Input: Play a Note object on a channel with a velocity[0-127]. You can either specify the velocity and channel here as arguments or you can set the Note.velocity and Note.channel attributes, which will take presedence over the functi...
def obsolete_rename(oldname, newfunc): """ Simple obsolete/removed method decorator Parameters ---------- oldname : str The name of the old obsolete name newfunc : FunctionType Replacement unbound member function. """ newname = newfunc.__name__ def __obsolete(*args, ...
Simple obsolete/removed method decorator Parameters ---------- oldname : str The name of the old obsolete name newfunc : FunctionType Replacement unbound member function.
Below is the the instruction that describes the task: ### Input: Simple obsolete/removed method decorator Parameters ---------- oldname : str The name of the old obsolete name newfunc : FunctionType Replacement unbound member function. ### Response: def obsolete_rename(oldname, new...
def setLocation(self, location): """ Change the upper left-hand corner to a new ``Location`` Doesn't change width or height """ if not location or not isinstance(location, Location): raise ValueError("setLocation expected a Location object") self.x = location.x ...
Change the upper left-hand corner to a new ``Location`` Doesn't change width or height
Below is the the instruction that describes the task: ### Input: Change the upper left-hand corner to a new ``Location`` Doesn't change width or height ### Response: def setLocation(self, location): """ Change the upper left-hand corner to a new ``Location`` Doesn't change width or height...
def get_param_value_from_func_call(param_name, func, call_args, call_kwargs): """ Get the value of a function's parameter based on its signature and the call's args and kwargs. Example: >>> def foo(a, b, c=3, d=4): ... pass ... >>> # what would be the value of "c" whe...
Get the value of a function's parameter based on its signature and the call's args and kwargs. Example: >>> def foo(a, b, c=3, d=4): ... pass ... >>> # what would be the value of "c" when calling foo(1, b=2, c=33) ? >>> get_param_value_from_func_call('c', foo, [1], {'...
Below is the the instruction that describes the task: ### Input: Get the value of a function's parameter based on its signature and the call's args and kwargs. Example: >>> def foo(a, b, c=3, d=4): ... pass ... >>> # what would be the value of "c" when calling foo(1, b=2,...