code
stringlengths
75
104k
docstring
stringlengths
1
46.9k
text
stringlengths
164
112k
def split_interface_name(interface, ch_grp=0): """Method to split interface type, id from name. Takes an interface name or just interface suffix and returns interface type and number separately. :param interface: interface name or just suffix :param ch_grp: if non-zero, ignore interface ...
Method to split interface type, id from name. Takes an interface name or just interface suffix and returns interface type and number separately. :param interface: interface name or just suffix :param ch_grp: if non-zero, ignore interface name and return 'port-channel' grp :retur...
Below is the the instruction that describes the task: ### Input: Method to split interface type, id from name. Takes an interface name or just interface suffix and returns interface type and number separately. :param interface: interface name or just suffix :param ch_grp: if non-zero, ignore inter...
def get_profiling_stats(self): """ Returns a pstat.Stats instance with profiling results if `run` was called with `should_profile=True`. Otherwise, returns `None`. """ profile_file_path = os.path.join(self.workspace, 'profiling.bin') try: return pstats.Stats(p...
Returns a pstat.Stats instance with profiling results if `run` was called with `should_profile=True`. Otherwise, returns `None`.
Below is the the instruction that describes the task: ### Input: Returns a pstat.Stats instance with profiling results if `run` was called with `should_profile=True`. Otherwise, returns `None`. ### Response: def get_profiling_stats(self): """ Returns a pstat.Stats instance with profiling re...
def compare_list_iter(propval_a, propval_b, fs_a=None, fs_b=None, options=None): """Generator for comparing 'simple' lists when they are encountered. This does not currently recurse further. Arguments are as per other ``compare_``\ *X* functions. """ if fs_a is None: ...
Generator for comparing 'simple' lists when they are encountered. This does not currently recurse further. Arguments are as per other ``compare_``\ *X* functions.
Below is the the instruction that describes the task: ### Input: Generator for comparing 'simple' lists when they are encountered. This does not currently recurse further. Arguments are as per other ``compare_``\ *X* functions. ### Response: def compare_list_iter(propval_a, propval_b, fs_a=None, fs_b=Non...
def set_cluster_fields(self, cluster_fields): ''' Tell the clusterizer the meaning of the field names. The cluster_fields parameter is a dict, e.g., {"new filed name": "standard field name"}. ''' if not cluster_fields: cluster_fields_mapping_inverse = {} cluster_...
Tell the clusterizer the meaning of the field names. The cluster_fields parameter is a dict, e.g., {"new filed name": "standard field name"}.
Below is the the instruction that describes the task: ### Input: Tell the clusterizer the meaning of the field names. The cluster_fields parameter is a dict, e.g., {"new filed name": "standard field name"}. ### Response: def set_cluster_fields(self, cluster_fields): ''' Tell the clusterizer the me...
def addTable(D): """ Add any table type to the given dataset. Use prompts to determine index locations and table type. :param dict D: Metadata (dataset) :param dict dat: Metadata (table) :return dict D: Metadata (dataset) """ _swap = { "1": "measurement", "2": "summary", ...
Add any table type to the given dataset. Use prompts to determine index locations and table type. :param dict D: Metadata (dataset) :param dict dat: Metadata (table) :return dict D: Metadata (dataset)
Below is the the instruction that describes the task: ### Input: Add any table type to the given dataset. Use prompts to determine index locations and table type. :param dict D: Metadata (dataset) :param dict dat: Metadata (table) :return dict D: Metadata (dataset) ### Response: def addTable(D): "...
def start(self, driver=None): """Start audio output driver in separate background thread. Call this function any time after creating the Synth object. If you don't call this function, use get_samples() to generate samples. Optional keyword argument: driver: which audi...
Start audio output driver in separate background thread. Call this function any time after creating the Synth object. If you don't call this function, use get_samples() to generate samples. Optional keyword argument: driver: which audio driver to use for output ...
Below is the the instruction that describes the task: ### Input: Start audio output driver in separate background thread. Call this function any time after creating the Synth object. If you don't call this function, use get_samples() to generate samples. Optional keyword argument: ...
def get_all_services(resource_root, cluster_name="default", view=None): """ Get all services @param resource_root: The root Resource object. @param cluster_name: Cluster name @return: A list of ApiService objects. """ return call(resource_root.get, SERVICES_PATH % (cluster_name,), ApiService, ...
Get all services @param resource_root: The root Resource object. @param cluster_name: Cluster name @return: A list of ApiService objects.
Below is the the instruction that describes the task: ### Input: Get all services @param resource_root: The root Resource object. @param cluster_name: Cluster name @return: A list of ApiService objects. ### Response: def get_all_services(resource_root, cluster_name="default", view=None): """ Get all serv...
def get_analysis_dict( root, pos, form ): ''' Takes *root*, *pos* and *form* from Filosoft's mrf input and reformats as EstNLTK's analysis dict: { "clitic": string, "ending": string, "form": string, "partofspeech": string, ...
Takes *root*, *pos* and *form* from Filosoft's mrf input and reformats as EstNLTK's analysis dict: { "clitic": string, "ending": string, "form": string, "partofspeech": string, "root": string }, ...
Below is the the instruction that describes the task: ### Input: Takes *root*, *pos* and *form* from Filosoft's mrf input and reformats as EstNLTK's analysis dict: { "clitic": string, "ending": string, "form": string, "parto...
def ValidateCertificateHostname(cert, hostname): """Validates that a given hostname is valid for an SSL certificate. Args: cert: A dictionary representing an SSL certificate. hostname: The hostname to test. Returns: bool: Whether or not the hostname is valid for this certificate. """ hosts = GetV...
Validates that a given hostname is valid for an SSL certificate. Args: cert: A dictionary representing an SSL certificate. hostname: The hostname to test. Returns: bool: Whether or not the hostname is valid for this certificate.
Below is the the instruction that describes the task: ### Input: Validates that a given hostname is valid for an SSL certificate. Args: cert: A dictionary representing an SSL certificate. hostname: The hostname to test. Returns: bool: Whether or not the hostname is valid for this certificate. ### R...
def classify(self, gadget): """Classify gadgets. """ typed_gadgets = [] for g_type, g_classifier in self._classifiers.items(): try: typed_gadgets += self._classify(gadget, g_classifier, g_type, self._emu_iters) except: import trace...
Classify gadgets.
Below is the the instruction that describes the task: ### Input: Classify gadgets. ### Response: def classify(self, gadget): """Classify gadgets. """ typed_gadgets = [] for g_type, g_classifier in self._classifiers.items(): try: typed_gadgets += self._cl...
def toggleLongTouchPoint(self): ''' Toggles the long touch point operation. ''' if not self.isLongTouchingPoint: msg = 'Long touching point' self.toast(msg, background=Color.GREEN) self.statusBar.set(msg) self.isLongTouchingPoint = True ...
Toggles the long touch point operation.
Below is the the instruction that describes the task: ### Input: Toggles the long touch point operation. ### Response: def toggleLongTouchPoint(self): ''' Toggles the long touch point operation. ''' if not self.isLongTouchingPoint: msg = 'Long touching point' ...
def get_parameters(self, params, graph=None): """Get the parameters of the model. :param params: dictionary of keys (str names) and values (tensors). :return: evaluated tensors in params """ g = graph if graph is not None else self.tf_graph with g.as_default(): ...
Get the parameters of the model. :param params: dictionary of keys (str names) and values (tensors). :return: evaluated tensors in params
Below is the the instruction that describes the task: ### Input: Get the parameters of the model. :param params: dictionary of keys (str names) and values (tensors). :return: evaluated tensors in params ### Response: def get_parameters(self, params, graph=None): """Get the parameters of th...
def _getAttrMap(self): """Initializes a map representation of this tag's attributes, if not already initialized.""" if not getattr(self, 'attrMap'): self.attrMap = {} for (key, value) in self.attrs: self.attrMap[key] = value return self.attrMap
Initializes a map representation of this tag's attributes, if not already initialized.
Below is the the instruction that describes the task: ### Input: Initializes a map representation of this tag's attributes, if not already initialized. ### Response: def _getAttrMap(self): """Initializes a map representation of this tag's attributes, if not already initialized.""" i...
def get_conf_attr(self, attr, default=None): """ Get the value of a attribute in the configuration :param attr: The attribute :param default: If the attribute doesn't appear in the configuration return this value :return: The value of attribute in the configuration o...
Get the value of a attribute in the configuration :param attr: The attribute :param default: If the attribute doesn't appear in the configuration return this value :return: The value of attribute in the configuration or the default value
Below is the the instruction that describes the task: ### Input: Get the value of a attribute in the configuration :param attr: The attribute :param default: If the attribute doesn't appear in the configuration return this value :return: The value of attribute in the configurati...
def close(self, reply_code=0, reply_text='', class_id=0, method_id=0, disconnect=False): ''' Close this connection. ''' self._close_info = { 'reply_code': reply_code, 'reply_text': reply_text, 'class_id': class_id, 'method_id'...
Close this connection.
Below is the the instruction that describes the task: ### Input: Close this connection. ### Response: def close(self, reply_code=0, reply_text='', class_id=0, method_id=0, disconnect=False): ''' Close this connection. ''' self._close_info = { 'reply_code': ...
def open_file(self, info): """ Handles the open action. """ if not info.initialized: return # Escape. # retval = self.edit_traits(parent=info.ui.control, view="file_view") dlg = FileDialog( action = "open", wildcard = "Graphviz Files (*.dot, *.xdot, *.txt)|" ...
Handles the open action.
Below is the the instruction that describes the task: ### Input: Handles the open action. ### Response: def open_file(self, info): """ Handles the open action. """ if not info.initialized: return # Escape. # retval = self.edit_traits(parent=info.ui.control, view="file_view") dlg =...
def get_all_yep(self): """Cascading style sheet (CSS) extension points. :returns: dict: {yep: [css...], ...} """ yeps = {} for p in self.get_enabled_plugins: for e, v in p["plugin_yep"].items(): yep = yeps.get(e, []) + v yeps[e] = yep ...
Cascading style sheet (CSS) extension points. :returns: dict: {yep: [css...], ...}
Below is the the instruction that describes the task: ### Input: Cascading style sheet (CSS) extension points. :returns: dict: {yep: [css...], ...} ### Response: def get_all_yep(self): """Cascading style sheet (CSS) extension points. :returns: dict: {yep: [css...], ...} """ ...
def addbuilddir(): """Append ./build/lib.<platform> in case we're running in the build dir (especially for Guido :-)""" from distutils.util import get_platform s = "build/lib.%s-%.3s" % (get_platform(), sys.version) if hasattr(sys, 'gettotalrefcount'): s += '-pydebug' s = os.path.join(os...
Append ./build/lib.<platform> in case we're running in the build dir (especially for Guido :-)
Below is the the instruction that describes the task: ### Input: Append ./build/lib.<platform> in case we're running in the build dir (especially for Guido :-) ### Response: def addbuilddir(): """Append ./build/lib.<platform> in case we're running in the build dir (especially for Guido :-)""" from ...
def delete(self, domain, delete_subdomains=False): """ Deletes the specified domain and all of its resource records. If the domain has subdomains, each subdomain will now become a root domain. If you wish to also delete any subdomains, pass True to 'delete_subdomains'. """ ...
Deletes the specified domain and all of its resource records. If the domain has subdomains, each subdomain will now become a root domain. If you wish to also delete any subdomains, pass True to 'delete_subdomains'.
Below is the the instruction that describes the task: ### Input: Deletes the specified domain and all of its resource records. If the domain has subdomains, each subdomain will now become a root domain. If you wish to also delete any subdomains, pass True to 'delete_subdomains'. ### Response: def d...
def isiterable_notstring(value): """ Returns True if the value is iterable but not a string. Otherwise returns False. :param value: Value to check. """ if isinstance(value, str): return False return isinstance(value, Iterable) or isgeneratorfunction(value) or isgenerator(value)
Returns True if the value is iterable but not a string. Otherwise returns False. :param value: Value to check.
Below is the the instruction that describes the task: ### Input: Returns True if the value is iterable but not a string. Otherwise returns False. :param value: Value to check. ### Response: def isiterable_notstring(value): """ Returns True if the value is iterable but not a string. Otherwise returns F...
def sav_to_pandas_savreader(input_file): """ SPSS .sav files to Pandas DataFrame through savreader module :param input_file: string :return: """ from savReaderWriter import SavReader lines = [] with SavReader(input_file, returnHeader=True) as reader: header = next(reader) ...
SPSS .sav files to Pandas DataFrame through savreader module :param input_file: string :return:
Below is the the instruction that describes the task: ### Input: SPSS .sav files to Pandas DataFrame through savreader module :param input_file: string :return: ### Response: def sav_to_pandas_savreader(input_file): """ SPSS .sav files to Pandas DataFrame through savreader module :param inpu...
def search_cloud_integration_entities(self, **kwargs): # noqa: E501 """Search over a customer's non-deleted cloud integrations # noqa: E501 # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True ...
Search over a customer's non-deleted cloud integrations # noqa: E501 # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.search_cloud_integration_entities(async_req=True) >>> r...
Below is the the instruction that describes the task: ### Input: Search over a customer's non-deleted cloud integrations # noqa: E501 # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread ...
def get_category_activities(self, category_id = None): """Return activities for category. If category is not specified, will return activities that have no category""" category_id = category_id or -1 return self._to_dict(('id', 'name', 'category_id', 'category'), self.conn.GetCategoryAct...
Return activities for category. If category is not specified, will return activities that have no category
Below is the the instruction that describes the task: ### Input: Return activities for category. If category is not specified, will return activities that have no category ### Response: def get_category_activities(self, category_id = None): """Return activities for category. If category is not spec...
def download_manylinux_wheels(self, abi, packages, directory): # type: (str, List[str], str) -> None """Download wheel files for manylinux for all the given packages.""" # If any one of these dependencies fails pip will bail out. Since we # are only interested in all the ones we can down...
Download wheel files for manylinux for all the given packages.
Below is the the instruction that describes the task: ### Input: Download wheel files for manylinux for all the given packages. ### Response: def download_manylinux_wheels(self, abi, packages, directory): # type: (str, List[str], str) -> None """Download wheel files for manylinux for all the given ...
def to_timedelta(value): """Converts a string to a timedelta.""" if value is None: return None if isinstance(value, (six.integer_types, float)): return timedelta(microseconds=(float(value) / 10)) match = _TIMESPAN_PATTERN.match(value) if match: if match.group(1) == "-": ...
Converts a string to a timedelta.
Below is the the instruction that describes the task: ### Input: Converts a string to a timedelta. ### Response: def to_timedelta(value): """Converts a string to a timedelta.""" if value is None: return None if isinstance(value, (six.integer_types, float)): return timedelta(microseconds...
def _GetFlagsDefinedByModule(self, module): """Returns the list of flags defined by a module. Args: module: A module object or a module name (a string). Returns: A new list of Flag objects. Caller may update this list as he wishes: none of those changes will affect the internals of this...
Returns the list of flags defined by a module. Args: module: A module object or a module name (a string). Returns: A new list of Flag objects. Caller may update this list as he wishes: none of those changes will affect the internals of this FlagValue object.
Below is the the instruction that describes the task: ### Input: Returns the list of flags defined by a module. Args: module: A module object or a module name (a string). Returns: A new list of Flag objects. Caller may update this list as he wishes: none of those changes will affect the...
def find_globals(code): """walks the byte code to find the variables which are actually globals""" cur_byte = 0 byte_code = code.co_code names = set() while cur_byte < len(byte_code): op = ord(byte_code[cur_byte]) if op >= dis.HAVE_ARGUMENT: ...
walks the byte code to find the variables which are actually globals
Below is the the instruction that describes the task: ### Input: walks the byte code to find the variables which are actually globals ### Response: def find_globals(code): """walks the byte code to find the variables which are actually globals""" cur_byte = 0 byte_code = code.co_code ...
def PushBack(self, string='', **unused_kwargs): """Push the match back on the stream. Args: string: optional data. """ self.buffer = string + self.buffer self.processed_buffer = self.processed_buffer[:-len(string)]
Push the match back on the stream. Args: string: optional data.
Below is the the instruction that describes the task: ### Input: Push the match back on the stream. Args: string: optional data. ### Response: def PushBack(self, string='', **unused_kwargs): """Push the match back on the stream. Args: string: optional data. """ self.buffer = strin...
def to_dict(self): """ Return a dict of the users. """ users = dict(users=list()) for user in self: users['users'].append(user.to_dict()) return users
Return a dict of the users.
Below is the the instruction that describes the task: ### Input: Return a dict of the users. ### Response: def to_dict(self): """ Return a dict of the users. """ users = dict(users=list()) for user in self: users['users'].append(user.to_dict()) return users
def timedelta_div(first: datetime.timedelta, second: datetime.timedelta) -> Optional[float]: """Implement divison for timedelta instances. :param first: First timedelta instance. :param second: Second timedelta instance. """ first_seconds = timedelta_seconds(first) second_seco...
Implement divison for timedelta instances. :param first: First timedelta instance. :param second: Second timedelta instance.
Below is the the instruction that describes the task: ### Input: Implement divison for timedelta instances. :param first: First timedelta instance. :param second: Second timedelta instance. ### Response: def timedelta_div(first: datetime.timedelta, second: datetime.timedelta) -> Optional...
def MTF(self, px_per_mm): ''' px_per_mm = cam_resolution / image_size ''' res = 100 #numeric resolution r = 4 #range +-r*std #size of 1 px: px_size = 1 / px_per_mm #standard deviation of the point-spread-function (PSF) as normal...
px_per_mm = cam_resolution / image_size
Below is the the instruction that describes the task: ### Input: px_per_mm = cam_resolution / image_size ### Response: def MTF(self, px_per_mm): ''' px_per_mm = cam_resolution / image_size ''' res = 100 #numeric resolution r = 4 #range +-r*std #size o...
def _set_lsp_traffic_engineering(self, v, load=False): """ Setter method for lsp_traffic_engineering, mapped from YANG variable /mpls_config/router/mpls/mpls_cmds_holder/lsp/secondary_path/lsp_traffic_engineering (container) If this variable is read-only (config: false) in the source YANG file, then _se...
Setter method for lsp_traffic_engineering, mapped from YANG variable /mpls_config/router/mpls/mpls_cmds_holder/lsp/secondary_path/lsp_traffic_engineering (container) If this variable is read-only (config: false) in the source YANG file, then _set_lsp_traffic_engineering is considered as a private method. Ba...
Below is the the instruction that describes the task: ### Input: Setter method for lsp_traffic_engineering, mapped from YANG variable /mpls_config/router/mpls/mpls_cmds_holder/lsp/secondary_path/lsp_traffic_engineering (container) If this variable is read-only (config: false) in the source YANG file, then _...
def all_optional_fields(self): """ Returns an iterator that traverses optional fields in all super types first, and then for this type. """ def optional_check(f): return is_nullable_type(f.data_type) or f.has_default return self._filter_fields(optional_check)
Returns an iterator that traverses optional fields in all super types first, and then for this type.
Below is the the instruction that describes the task: ### Input: Returns an iterator that traverses optional fields in all super types first, and then for this type. ### Response: def all_optional_fields(self): """ Returns an iterator that traverses optional fields in all super types ...
def fit_transform(self, col): """Prepare the transformer and return processed data. Args: col(pandas.DataFrame): Data to transform. Returns: pandas.DataFrame """ if self.anonymize: col = self.anonymize_column(col) self._fit(col) ...
Prepare the transformer and return processed data. Args: col(pandas.DataFrame): Data to transform. Returns: pandas.DataFrame
Below is the the instruction that describes the task: ### Input: Prepare the transformer and return processed data. Args: col(pandas.DataFrame): Data to transform. Returns: pandas.DataFrame ### Response: def fit_transform(self, col): """Prepare the transformer and ...
def is_page_content_is_already_updated(self, page_id, body): """ Compare content and check is already updated or not :param page_id: Content ID for retrieve storage value :param body: Body for compare it :return: True if the same """ confluence_content = (self.get...
Compare content and check is already updated or not :param page_id: Content ID for retrieve storage value :param body: Body for compare it :return: True if the same
Below is the the instruction that describes the task: ### Input: Compare content and check is already updated or not :param page_id: Content ID for retrieve storage value :param body: Body for compare it :return: True if the same ### Response: def is_page_content_is_already_updated(self, pa...
def _thread(self): """ Thread entry point: does the job once, stored results, and dies. """ # Get args, kwargs = self._jobs.get() # Stop thread when (None, None) comes in if args is None and kwargs is None: return None # Wrappers should exit as well # Work ...
Thread entry point: does the job once, stored results, and dies.
Below is the the instruction that describes the task: ### Input: Thread entry point: does the job once, stored results, and dies. ### Response: def _thread(self): """ Thread entry point: does the job once, stored results, and dies. """ # Get args, kwargs = self._jobs.get() # Stop t...
def QA_fetch_future_min( code, start, end, format='numpy', frequence='1min', collections=DATABASE.future_min): '获取股票分钟线' if frequence in ['1min', '1m']: frequence = '1min' elif frequence in ['5min', '5m']: frequence = '5min' elif frequence in ['15m...
获取股票分钟线
Below is the the instruction that describes the task: ### Input: 获取股票分钟线 ### Response: def QA_fetch_future_min( code, start, end, format='numpy', frequence='1min', collections=DATABASE.future_min): '获取股票分钟线' if frequence in ['1min', '1m']: frequence = '1min' ...
def _pluralize(value, item_key): """"Force the value of a datacite3 key to be a list. >>> _pluralize(xml_input['authors'], 'author') ['Sick, Jonathan', 'Economou, Frossie'] Background ---------- When `xmltodict` proceses metadata, it turns XML tags into new key-value pairs whenever possibl...
Force the value of a datacite3 key to be a list. >>> _pluralize(xml_input['authors'], 'author') ['Sick, Jonathan', 'Economou, Frossie'] Background ---------- When `xmltodict` proceses metadata, it turns XML tags into new key-value pairs whenever possible, even if the value should semantically ...
Below is the the instruction that describes the task: ### Input: Force the value of a datacite3 key to be a list. >>> _pluralize(xml_input['authors'], 'author') ['Sick, Jonathan', 'Economou, Frossie'] Background ---------- When `xmltodict` proceses metadata, it turns XML tags into new key-valu...
def disclaimer_title_header_element(feature, parent): """Retrieve disclaimer title header string from definitions.""" _ = feature, parent # NOQA header = disclaimer_title_header['string_format'] return header.capitalize()
Retrieve disclaimer title header string from definitions.
Below is the the instruction that describes the task: ### Input: Retrieve disclaimer title header string from definitions. ### Response: def disclaimer_title_header_element(feature, parent): """Retrieve disclaimer title header string from definitions.""" _ = feature, parent # NOQA header = disclaimer_...
def subscription_payment_required( function=None, plan=None, pay_page=SUBSCRIPTION_REDIRECT ): """ Decorator for views that require subscription payment. Redirects to `pay_page` if necessary. """ actual_decorator = subscriber_passes_pay_test( subscriber_has_active_subscription, plan=plan, pay_page=pay_page ) ...
Decorator for views that require subscription payment. Redirects to `pay_page` if necessary.
Below is the the instruction that describes the task: ### Input: Decorator for views that require subscription payment. Redirects to `pay_page` if necessary. ### Response: def subscription_payment_required( function=None, plan=None, pay_page=SUBSCRIPTION_REDIRECT ): """ Decorator for views that require subscr...
def write(self, s): """Write string s to the stream. """ if self.comptype == "gz": self.crc = self.zlib.crc32(s, self.crc) self.pos += len(s) if self.comptype != "tar": s = self.cmp.compress(s) self.__write(s)
Write string s to the stream.
Below is the the instruction that describes the task: ### Input: Write string s to the stream. ### Response: def write(self, s): """Write string s to the stream. """ if self.comptype == "gz": self.crc = self.zlib.crc32(s, self.crc) self.pos += len(s) if self.comp...
def _process(self, segments): """sort segments in read order - left to right, up to down""" # sort_f= lambda r: max_line_width*(r[1]/max_line_height)+r[0] # segments= sorted(segments, key=sort_f) # segments= segments_to_numpy( segments ) # return segments mlh, mlw = self....
sort segments in read order - left to right, up to down
Below is the the instruction that describes the task: ### Input: sort segments in read order - left to right, up to down ### Response: def _process(self, segments): """sort segments in read order - left to right, up to down""" # sort_f= lambda r: max_line_width*(r[1]/max_line_height)+r[0] #...
def _auto_scroll(self, *args): """ Scroll to the end of the text view """ adj = self['scrollable'].get_vadjustment() adj.set_value(adj.get_upper() - adj.get_page_size())
Scroll to the end of the text view
Below is the the instruction that describes the task: ### Input: Scroll to the end of the text view ### Response: def _auto_scroll(self, *args): """ Scroll to the end of the text view """ adj = self['scrollable'].get_vadjustment() adj.set_value(adj.get_upper() - adj.get_page_size())
def fast_sync_snapshot_compress( snapshot_dir, export_path ): """ Given the path to a directory, compress it and export it to the given path. Return {'status': True} on success Return {'error': ...} on failure """ snapshot_dir = os.path.abspath(snapshot_dir) export_path = os.path.abspa...
Given the path to a directory, compress it and export it to the given path. Return {'status': True} on success Return {'error': ...} on failure
Below is the the instruction that describes the task: ### Input: Given the path to a directory, compress it and export it to the given path. Return {'status': True} on success Return {'error': ...} on failure ### Response: def fast_sync_snapshot_compress( snapshot_dir, export_path ): """ Given...
def validate_ip_address(ip_address): """Validate the ip_address :param ip_address: (str) IP address :return: (bool) True if the ip_address is valid """ # Validate the IP address log = logging.getLogger(mod_logger + '.validate_ip_address') if not isinstance(ip_address, basestring): l...
Validate the ip_address :param ip_address: (str) IP address :return: (bool) True if the ip_address is valid
Below is the the instruction that describes the task: ### Input: Validate the ip_address :param ip_address: (str) IP address :return: (bool) True if the ip_address is valid ### Response: def validate_ip_address(ip_address): """Validate the ip_address :param ip_address: (str) IP address :retur...
def register_provider(cls, provider): """Register method to keep list of providers.""" def decorator(subclass): """Register as decorator function.""" cls._providers[provider] = subclass subclass.name = provider return subclass return decorator
Register method to keep list of providers.
Below is the the instruction that describes the task: ### Input: Register method to keep list of providers. ### Response: def register_provider(cls, provider): """Register method to keep list of providers.""" def decorator(subclass): """Register as decorator function.""" cls...
def sbo_list(): """Return all SBo packages """ sbo_packages = [] for pkg in os.listdir(_meta_.pkg_path): if pkg.endswith("_SBo"): sbo_packages.append(pkg) return sbo_packages
Return all SBo packages
Below is the the instruction that describes the task: ### Input: Return all SBo packages ### Response: def sbo_list(): """Return all SBo packages """ sbo_packages = [] for pkg in os.listdir(_meta_.pkg_path): if pkg.endswith("_SBo"): sbo_packages.append(pkg) return sbo_packag...
def _hexencode(bytestring, insert_spaces = False): """Convert a byte string to a hex encoded string. For example 'J' will return '4A', and ``'\\x04'`` will return '04'. Args: bytestring (str): Can be for example ``'A\\x01B\\x45'``. insert_spaces (bool): Insert space characters between pair...
Convert a byte string to a hex encoded string. For example 'J' will return '4A', and ``'\\x04'`` will return '04'. Args: bytestring (str): Can be for example ``'A\\x01B\\x45'``. insert_spaces (bool): Insert space characters between pair of characters to increase readability. Returns: ...
Below is the the instruction that describes the task: ### Input: Convert a byte string to a hex encoded string. For example 'J' will return '4A', and ``'\\x04'`` will return '04'. Args: bytestring (str): Can be for example ``'A\\x01B\\x45'``. insert_spaces (bool): Insert space characters b...
def Flemmer_Banks(Re): r'''Calculates drag coefficient of a smooth sphere using the method in [1]_ as described in [2]_. .. math:: C_D = \frac{24}{Re}10^E E = 0.383Re^{0.356}-0.207Re^{0.396} - \frac{0.143}{1+(\log_{10} Re)^2} Parameters ---------- Re : float Reynolds n...
r'''Calculates drag coefficient of a smooth sphere using the method in [1]_ as described in [2]_. .. math:: C_D = \frac{24}{Re}10^E E = 0.383Re^{0.356}-0.207Re^{0.396} - \frac{0.143}{1+(\log_{10} Re)^2} Parameters ---------- Re : float Reynolds number of the sphere, [-] ...
Below is the the instruction that describes the task: ### Input: r'''Calculates drag coefficient of a smooth sphere using the method in [1]_ as described in [2]_. .. math:: C_D = \frac{24}{Re}10^E E = 0.383Re^{0.356}-0.207Re^{0.396} - \frac{0.143}{1+(\log_{10} Re)^2} Parameters --...
def iter_content(self, chunk_size=1024, decode_unicode=False): """Get request body as iterator content (stream). :param int chunk_size: :param bool decode_unicode: """ return self.response.iter_content(chunk_size=chunk_size, decode_unicode=decode_unicode)
Get request body as iterator content (stream). :param int chunk_size: :param bool decode_unicode:
Below is the the instruction that describes the task: ### Input: Get request body as iterator content (stream). :param int chunk_size: :param bool decode_unicode: ### Response: def iter_content(self, chunk_size=1024, decode_unicode=False): """Get request body as iterator content (stream). ...
def mult(self, matrix): """ Multiply this frame, viewed as a matrix, by another matrix. :param matrix: another frame that you want to multiply the current frame by; must be compatible with the current frame (i.e. its number of rows must be the same as number of columns in the curren...
Multiply this frame, viewed as a matrix, by another matrix. :param matrix: another frame that you want to multiply the current frame by; must be compatible with the current frame (i.e. its number of rows must be the same as number of columns in the current frame). :returns: new H2OFrame, wh...
Below is the the instruction that describes the task: ### Input: Multiply this frame, viewed as a matrix, by another matrix. :param matrix: another frame that you want to multiply the current frame by; must be compatible with the current frame (i.e. its number of rows must be the same as number...
def ParseOptions(cls, options, configuration_object): """Parses and validates options. Args: options (argparse.Namespace): parser options. configuration_object (CLITool): object to be configured by the argument helper. Raises: BadConfigObject: when the configuration object is o...
Parses and validates options. Args: options (argparse.Namespace): parser options. configuration_object (CLITool): object to be configured by the argument helper. Raises: BadConfigObject: when the configuration object is of the wrong type.
Below is the the instruction that describes the task: ### Input: Parses and validates options. Args: options (argparse.Namespace): parser options. configuration_object (CLITool): object to be configured by the argument helper. Raises: BadConfigObject: when the configuration obj...
def get(self, variable_path: str, default: t.Optional[t.Any] = None, coerce_type: t.Optional[t.Type] = None, coercer: t.Optional[t.Callable] = None, **kwargs): """ :param variable_path: a delimiter-separated path to a nested value :para...
:param variable_path: a delimiter-separated path to a nested value :param default: default value if there's no object by specified path :param coerce_type: cast a type of a value to a specified one :param coercer: perform a type casting with specified callback :param kwargs: additional a...
Below is the the instruction that describes the task: ### Input: :param variable_path: a delimiter-separated path to a nested value :param default: default value if there's no object by specified path :param coerce_type: cast a type of a value to a specified one :param coercer: perform a typ...
def get_converted_relative_path(path, relative_to=None): """Convert `path` to be relative. Given a vague relative path, return the path relative to the given location. :param str path: The location of a target path :param str relative_to: The starting path to build against, optional :returns: ...
Convert `path` to be relative. Given a vague relative path, return the path relative to the given location. :param str path: The location of a target path :param str relative_to: The starting path to build against, optional :returns: A relative posix-style path with a leading `./` This perfor...
Below is the the instruction that describes the task: ### Input: Convert `path` to be relative. Given a vague relative path, return the path relative to the given location. :param str path: The location of a target path :param str relative_to: The starting path to build against, optional :retu...
def derivative_factory(name): """Create derivative function for some ufuncs.""" if name == 'sin': def derivative(self, point): """Return the derivative operator.""" return MultiplyOperator(cos(self.domain)(point)) elif name == 'cos': def derivative(self, point): ...
Create derivative function for some ufuncs.
Below is the the instruction that describes the task: ### Input: Create derivative function for some ufuncs. ### Response: def derivative_factory(name): """Create derivative function for some ufuncs.""" if name == 'sin': def derivative(self, point): """Return the derivative operator.""...
def decode(self, encoded): """ Decodes a tensor into a sequence. Args: encoded (torch.Tensor): Encoded sequence. Returns: str: Sequence decoded from ``encoded``. """ encoded = super().decode(encoded) return self.tokenizer.decode([self.itos[index]...
Decodes a tensor into a sequence. Args: encoded (torch.Tensor): Encoded sequence. Returns: str: Sequence decoded from ``encoded``.
Below is the the instruction that describes the task: ### Input: Decodes a tensor into a sequence. Args: encoded (torch.Tensor): Encoded sequence. Returns: str: Sequence decoded from ``encoded``. ### Response: def decode(self, encoded): """ Decodes a tensor into a ...
def push_file(self, local_source, remote_dir): ''' Transport a local file to a directory on a remote machine Args: - local_source (string): Path - remote_dir (string): Remote path Returns: - str: Path to copied file on remote machine Raises: ...
Transport a local file to a directory on a remote machine Args: - local_source (string): Path - remote_dir (string): Remote path Returns: - str: Path to copied file on remote machine Raises: - BadScriptPath : if script path on the remote side is...
Below is the the instruction that describes the task: ### Input: Transport a local file to a directory on a remote machine Args: - local_source (string): Path - remote_dir (string): Remote path Returns: - str: Path to copied file on remote machine Raise...
def primary_transcript(entrystream, parenttype='gene', logstream=stderr): """ Select a single transcript as a representative for each gene. This function is a generalization of the `primary_mrna` function that attempts, under certain conditions, to select a single transcript as a representative for...
Select a single transcript as a representative for each gene. This function is a generalization of the `primary_mrna` function that attempts, under certain conditions, to select a single transcript as a representative for each gene. If a gene encodes multiple transcript types, one of those types must b...
Below is the the instruction that describes the task: ### Input: Select a single transcript as a representative for each gene. This function is a generalization of the `primary_mrna` function that attempts, under certain conditions, to select a single transcript as a representative for each gene. If a ...
def get_all_supplier_properties(self, params=None): """ Get all supplier properties This will iterate over all pages until it gets all elements. So if the rate limit exceeded it will throw an Exception and you will get nothing :param params: search params :return: list ...
Get all supplier properties This will iterate over all pages until it gets all elements. So if the rate limit exceeded it will throw an Exception and you will get nothing :param params: search params :return: list
Below is the the instruction that describes the task: ### Input: Get all supplier properties This will iterate over all pages until it gets all elements. So if the rate limit exceeded it will throw an Exception and you will get nothing :param params: search params :return: list ### ...
def get_object_data(obj, fields, safe): """ Given an object and a list of fields, recursively build an object for serialization. Returns a dictionary. """ temp_dict = dict() for field in fields: try: attribute = getattr(obj, str(field)) if isinstance(attribute,...
Given an object and a list of fields, recursively build an object for serialization. Returns a dictionary.
Below is the the instruction that describes the task: ### Input: Given an object and a list of fields, recursively build an object for serialization. Returns a dictionary. ### Response: def get_object_data(obj, fields, safe): """ Given an object and a list of fields, recursively build an object for se...
def WritePathInfos(self, client_id, path_infos): """Writes a collection of path_info records for a client.""" try: self._MultiWritePathInfos({client_id: path_infos}) except MySQLdb.IntegrityError as error: raise db.UnknownClientError(client_id=client_id, cause=error)
Writes a collection of path_info records for a client.
Below is the the instruction that describes the task: ### Input: Writes a collection of path_info records for a client. ### Response: def WritePathInfos(self, client_id, path_infos): """Writes a collection of path_info records for a client.""" try: self._MultiWritePathInfos({client_id: path_infos}) ...
def handle_group(self, text, capture=None, is_format=False): """Handle groups.""" if capture is None: capture = tuple() if self.is_bytes else '' if len(self.result) > 1: self.literal_slots.append("".join(self.result)) if is_format: self.liter...
Handle groups.
Below is the the instruction that describes the task: ### Input: Handle groups. ### Response: def handle_group(self, text, capture=None, is_format=False): """Handle groups.""" if capture is None: capture = tuple() if self.is_bytes else '' if len(self.result) > 1: s...
def preferred_encodings(self): """ The list of user defined encodings, for display in the encodings menu/combobox. """ default_encodings = [ locale.getpreferredencoding().lower().replace('-', '_')] if 'utf_8' not in default_encodings: default_enco...
The list of user defined encodings, for display in the encodings menu/combobox.
Below is the the instruction that describes the task: ### Input: The list of user defined encodings, for display in the encodings menu/combobox. ### Response: def preferred_encodings(self): """ The list of user defined encodings, for display in the encodings menu/combobox. ...
def evaluate(self, dataset, metric='auto', output_type='dict', iou_threshold=None, confidence_threshold=None, verbose=True): """ Evaluate the model by making predictions and comparing these to ground truth bounding box annotations. Parameters ---------- ...
Evaluate the model by making predictions and comparing these to ground truth bounding box annotations. Parameters ---------- dataset : SFrame Dataset of new observations. Must include columns with the same names as the annotations and feature used for model train...
Below is the the instruction that describes the task: ### Input: Evaluate the model by making predictions and comparing these to ground truth bounding box annotations. Parameters ---------- dataset : SFrame Dataset of new observations. Must include columns with the same ...
def c(self): """Caching client for not repeapting checks""" if self._client is None: self._parse_settings() self._client = Rumetr(**self.settings) return self._client
Caching client for not repeapting checks
Below is the the instruction that describes the task: ### Input: Caching client for not repeapting checks ### Response: def c(self): """Caching client for not repeapting checks""" if self._client is None: self._parse_settings() self._client = Rumetr(**self.settings) ...
def _slug_strip(self, value): """ Clean up a slug by removing slug separator characters that occur at the beginning or end of a slug. If an alternate separator is used, it will also replace any instances of the default '-' separator with the new separator. """ re...
Clean up a slug by removing slug separator characters that occur at the beginning or end of a slug. If an alternate separator is used, it will also replace any instances of the default '-' separator with the new separator.
Below is the the instruction that describes the task: ### Input: Clean up a slug by removing slug separator characters that occur at the beginning or end of a slug. If an alternate separator is used, it will also replace any instances of the default '-' separator with the new separator. ###...
def _install_extension(self, addon, unpack=True): """ Installs addon from a filepath, url or directory of addons in the profile. - path: url, absolute path to .xpi, or directory of addons - unpack: whether to unpack unless specified otherwise in the install.rdf ...
Installs addon from a filepath, url or directory of addons in the profile. - path: url, absolute path to .xpi, or directory of addons - unpack: whether to unpack unless specified otherwise in the install.rdf
Below is the the instruction that describes the task: ### Input: Installs addon from a filepath, url or directory of addons in the profile. - path: url, absolute path to .xpi, or directory of addons - unpack: whether to unpack unless specified otherwise in the install.rdf ### Res...
def __get_uri(self, server): """Return the URI for the given server dict.""" # Select the connection mode (with or without password) if server['password'] != "": if server['status'] == 'PROTECTED': # Try with the preconfigure password (only if status is PROTECTED) ...
Return the URI for the given server dict.
Below is the the instruction that describes the task: ### Input: Return the URI for the given server dict. ### Response: def __get_uri(self, server): """Return the URI for the given server dict.""" # Select the connection mode (with or without password) if server['password'] != "": ...
def p_command(p): '''command : simple_command | shell_command | shell_command redirection_list | function_def | coproc''' if isinstance(p[1], ast.node): p[0] = p[1] if len(p) == 3: assert p[0].kind == 'compound' ...
command : simple_command | shell_command | shell_command redirection_list | function_def | coproc
Below is the the instruction that describes the task: ### Input: command : simple_command | shell_command | shell_command redirection_list | function_def | coproc ### Response: def p_command(p): '''command : simple_command | shell_comma...
def update_dict(input_dict,key,value): '''update_dict will update lists in a dictionary. If the key is not included, if will add as new list. If it is, it will append. :param input_dict: the dict to update :param value: the value to update with ''' if key in input_dict: input_dict[key].a...
update_dict will update lists in a dictionary. If the key is not included, if will add as new list. If it is, it will append. :param input_dict: the dict to update :param value: the value to update with
Below is the the instruction that describes the task: ### Input: update_dict will update lists in a dictionary. If the key is not included, if will add as new list. If it is, it will append. :param input_dict: the dict to update :param value: the value to update with ### Response: def update_dict(input...
def setup_multiifo_interval_coinc_inj(workflow, hdfbank, full_data_trig_files, inj_trig_files, stat_files, background_file, veto_file, veto_name, out_dir, pivot_ifo, fixed_ifo, tags=None): """ This function sets up exact match multiifo ...
This function sets up exact match multiifo coincidence for injections
Below is the the instruction that describes the task: ### Input: This function sets up exact match multiifo coincidence for injections ### Response: def setup_multiifo_interval_coinc_inj(workflow, hdfbank, full_data_trig_files, inj_trig_files, stat_files, background_file, veto...
def _get_format_from_filename(file, mode): """Return a format string obtained from file (or file.name). If file already exists (= read mode), an empty string is returned on error. If not, an exception is raised. The return type will always be str or unicode (even if file/file.name is a bytes objec...
Return a format string obtained from file (or file.name). If file already exists (= read mode), an empty string is returned on error. If not, an exception is raised. The return type will always be str or unicode (even if file/file.name is a bytes object).
Below is the the instruction that describes the task: ### Input: Return a format string obtained from file (or file.name). If file already exists (= read mode), an empty string is returned on error. If not, an exception is raised. The return type will always be str or unicode (even if file/file.na...
def create(cls, url, databases): """ If databases is an empty list, all databases present in the server will become accessible via the endpoint, with the _system database being the default database. If databases is non-empty, only the specified databases will become availabl...
If databases is an empty list, all databases present in the server will become accessible via the endpoint, with the _system database being the default database. If databases is non-empty, only the specified databases will become available via the endpoint. The first database name i...
Below is the the instruction that describes the task: ### Input: If databases is an empty list, all databases present in the server will become accessible via the endpoint, with the _system database being the default database. If databases is non-empty, only the specified databases will bec...
def _post(self, *args, **kwargs): """ A wrapper for posting things. It will also json encode your 'data' parameter :returns: The response of your post :rtype: dict """ if 'data' in kwargs: kwargs['data'] = json.dumps(kwargs['data']) response = request...
A wrapper for posting things. It will also json encode your 'data' parameter :returns: The response of your post :rtype: dict
Below is the the instruction that describes the task: ### Input: A wrapper for posting things. It will also json encode your 'data' parameter :returns: The response of your post :rtype: dict ### Response: def _post(self, *args, **kwargs): """ A wrapper for posting things. It will a...
def is_dir(self, remote_path): """Checks is the remote resource directory. More information you can find by link http://webdav.org/specs/rfc4918.html#METHOD_PROPFIND :param remote_path: the path to remote resource. :return: True in case the remote resource is directory and False otherwi...
Checks is the remote resource directory. More information you can find by link http://webdav.org/specs/rfc4918.html#METHOD_PROPFIND :param remote_path: the path to remote resource. :return: True in case the remote resource is directory and False otherwise.
Below is the the instruction that describes the task: ### Input: Checks is the remote resource directory. More information you can find by link http://webdav.org/specs/rfc4918.html#METHOD_PROPFIND :param remote_path: the path to remote resource. :return: True in case the remote resource is ...
def fcoe_networks(self): """ Gets the FcoeNetworks API client. Returns: FcoeNetworks: """ if not self.__fcoe_networks: self.__fcoe_networks = FcoeNetworks(self.__connection) return self.__fcoe_networks
Gets the FcoeNetworks API client. Returns: FcoeNetworks:
Below is the the instruction that describes the task: ### Input: Gets the FcoeNetworks API client. Returns: FcoeNetworks: ### Response: def fcoe_networks(self): """ Gets the FcoeNetworks API client. Returns: FcoeNetworks: """ if not self.__f...
def register_instance(self, instance: Any, allow_dotted_names: bool=False): """注册一个实例用于执行,注意只能注册一个. Parameters: instance (Any): - 将一个类的实例注册到rpc allow_dotted_names (bool): 是否允许带`.`号的名字 """ if self.instance: raise RuntimeError("can only register one in...
注册一个实例用于执行,注意只能注册一个. Parameters: instance (Any): - 将一个类的实例注册到rpc allow_dotted_names (bool): 是否允许带`.`号的名字
Below is the the instruction that describes the task: ### Input: 注册一个实例用于执行,注意只能注册一个. Parameters: instance (Any): - 将一个类的实例注册到rpc allow_dotted_names (bool): 是否允许带`.`号的名字 ### Response: def register_instance(self, instance: Any, allow_dotted_names: bool=False): """注册一个实例用于执行,...
def tag(self, tag): ''' .. seealso:: :attr:`tag` ''' t = self.tag if t: if not tag: tag = t[-1] if tag in t: self._checkout(treeish=tag)
.. seealso:: :attr:`tag`
Below is the the instruction that describes the task: ### Input: .. seealso:: :attr:`tag` ### Response: def tag(self, tag): ''' .. seealso:: :attr:`tag` ''' t = self.tag if t: if not tag: tag = t[-1] if tag in t: self....
def copy(self): """Returns a new :class:`~pyinter.Interval` object with the same bounds and values.""" return Interval(self._lower, self._lower_value, self._upper_value, self._upper)
Returns a new :class:`~pyinter.Interval` object with the same bounds and values.
Below is the the instruction that describes the task: ### Input: Returns a new :class:`~pyinter.Interval` object with the same bounds and values. ### Response: def copy(self): """Returns a new :class:`~pyinter.Interval` object with the same bounds and values.""" return Interval(self._lower, self._l...
def create_relay(self, orgid, data): """Create relay settings""" return self.api_call( ENDPOINTS['relays']['new'], dict(orgid=orgid), body=data)
Create relay settings
Below is the the instruction that describes the task: ### Input: Create relay settings ### Response: def create_relay(self, orgid, data): """Create relay settings""" return self.api_call( ENDPOINTS['relays']['new'], dict(orgid=orgid), body=data)
def _set_label(label, mark, dim, **kwargs): """Helper function to set labels for an axis """ if mark is None: mark = _context['last_mark'] if mark is None: return {} fig = kwargs.get('figure', current_figure()) scales = mark.scales scale_metadata = mark.scales_metadata.get(di...
Helper function to set labels for an axis
Below is the the instruction that describes the task: ### Input: Helper function to set labels for an axis ### Response: def _set_label(label, mark, dim, **kwargs): """Helper function to set labels for an axis """ if mark is None: mark = _context['last_mark'] if mark is None: return...
def addNewTopology(self, state_manager, topologyName): """ Adds a topology in the local cache, and sets a watch on any changes on the topology. """ topology = Topology(topologyName, state_manager.name) Log.info("Adding new topology: %s, state_manager: %s", topologyName, state_manage...
Adds a topology in the local cache, and sets a watch on any changes on the topology.
Below is the the instruction that describes the task: ### Input: Adds a topology in the local cache, and sets a watch on any changes on the topology. ### Response: def addNewTopology(self, state_manager, topologyName): """ Adds a topology in the local cache, and sets a watch on any changes on the t...
def star(args): """ %prog star folder reference Run star on a folder with reads. """ p = OptionParser(star.__doc__) p.add_option("--single", default=False, action="store_true", help="Single end mapping") p.set_fastq_names() p.set_cpus() opts, args = p.parse_args(arg...
%prog star folder reference Run star on a folder with reads.
Below is the the instruction that describes the task: ### Input: %prog star folder reference Run star on a folder with reads. ### Response: def star(args): """ %prog star folder reference Run star on a folder with reads. """ p = OptionParser(star.__doc__) p.add_option("--single", defa...
def make_filled_array(shp, dtype, order, r, g, b, a): """Return a filled array with a color value. order defines the color planes in the array. (r, g, b, a) are expected to be in the range 0..1 and are scaled to the appropriate values. shp can define a 2D or 3D array. """ # TODO: can we make t...
Return a filled array with a color value. order defines the color planes in the array. (r, g, b, a) are expected to be in the range 0..1 and are scaled to the appropriate values. shp can define a 2D or 3D array.
Below is the the instruction that describes the task: ### Input: Return a filled array with a color value. order defines the color planes in the array. (r, g, b, a) are expected to be in the range 0..1 and are scaled to the appropriate values. shp can define a 2D or 3D array. ### Response: def make_f...
def get_timefactor(cls) -> float: """Factor to adjust a new value of a time-dependent parameter. For a time-dependent parameter, its effective value depends on the simulation step size. Method |Parameter.get_timefactor| returns the fraction between the current simulation step size and ...
Factor to adjust a new value of a time-dependent parameter. For a time-dependent parameter, its effective value depends on the simulation step size. Method |Parameter.get_timefactor| returns the fraction between the current simulation step size and the current parameter step size. ...
Below is the the instruction that describes the task: ### Input: Factor to adjust a new value of a time-dependent parameter. For a time-dependent parameter, its effective value depends on the simulation step size. Method |Parameter.get_timefactor| returns the fraction between the current s...
def _build_app_dict(site, request, label=None): """ Builds the app dictionary. Takes an optional label parameters to filter models of a specific app. """ app_dict = {} if label: models = { m: m_a for m, m_a in site._registry.items() if m._meta.app_label == label ...
Builds the app dictionary. Takes an optional label parameters to filter models of a specific app.
Below is the the instruction that describes the task: ### Input: Builds the app dictionary. Takes an optional label parameters to filter models of a specific app. ### Response: def _build_app_dict(site, request, label=None): """ Builds the app dictionary. Takes an optional label parameters to filter ...
def reformat(found_sequences): '''Truncate the FASTA headers so that the first field is a 4-character ID.''' for (pdb_id, chain, file_name), sequence in sorted(found_sequences.iteritems()): header = sequence[0] assert(header[0] == '>') tokens = header.split('|') tokens[0] = token...
Truncate the FASTA headers so that the first field is a 4-character ID.
Below is the the instruction that describes the task: ### Input: Truncate the FASTA headers so that the first field is a 4-character ID. ### Response: def reformat(found_sequences): '''Truncate the FASTA headers so that the first field is a 4-character ID.''' for (pdb_id, chain, file_name), sequence in sor...
def _verify(leniency, numobj, candidate, matcher): """Returns True if number is a verified number according to the leniency.""" if leniency == Leniency.POSSIBLE: return is_possible_number(numobj) elif leniency == Leniency.VALID: if (not is_valid_number(numobj) or not _contain...
Returns True if number is a verified number according to the leniency.
Below is the the instruction that describes the task: ### Input: Returns True if number is a verified number according to the leniency. ### Response: def _verify(leniency, numobj, candidate, matcher): """Returns True if number is a verified number according to the leniency.""" if leniency == Lenien...
def set_inasafe_default_value_qsetting( qsetting, category, inasafe_field_key, value): """Helper method to set inasafe default value to qsetting. :param qsetting: QSettings. :type qsetting: QSettings :param category: Category of the default value. It can be global or recent. Global mea...
Helper method to set inasafe default value to qsetting. :param qsetting: QSettings. :type qsetting: QSettings :param category: Category of the default value. It can be global or recent. Global means the global setting for default value. Recent means the last set custom for default value fr...
Below is the the instruction that describes the task: ### Input: Helper method to set inasafe default value to qsetting. :param qsetting: QSettings. :type qsetting: QSettings :param category: Category of the default value. It can be global or recent. Global means the global setting for default...
def show_as(**mappings): """ Show a set of request and/or response fields in logs using a different key. Example: @show_as(id="foo_id") def create_foo(): return Foo(id=uuid4()) """ def decorator(func): @wraps(func) def wrapper(*args, **kwargs): ...
Show a set of request and/or response fields in logs using a different key. Example: @show_as(id="foo_id") def create_foo(): return Foo(id=uuid4())
Below is the the instruction that describes the task: ### Input: Show a set of request and/or response fields in logs using a different key. Example: @show_as(id="foo_id") def create_foo(): return Foo(id=uuid4()) ### Response: def show_as(**mappings): """ Show a set of req...
def save_data(self, trigger_id, **data): """ let's save the data :param trigger_id: trigger ID from which to save data :param data: the data to check to be used and save :type trigger_id: int :type data: dict :return: the status of the sa...
let's save the data :param trigger_id: trigger ID from which to save data :param data: the data to check to be used and save :type trigger_id: int :type data: dict :return: the status of the save statement :rtype: boolean
Below is the the instruction that describes the task: ### Input: let's save the data :param trigger_id: trigger ID from which to save data :param data: the data to check to be used and save :type trigger_id: int :type data: dict :return: the status of th...
def orderrun_detail(self, kitchen, pdict, return_all_data=False): """ api.add_resource(OrderDetailsV2, '/v2/order/details/<string:kitchenname>', methods=['POST']) :param self: DKCloudAPI :param kitchen: string :param pdict: dict :param return_all_data: boolean :rt...
api.add_resource(OrderDetailsV2, '/v2/order/details/<string:kitchenname>', methods=['POST']) :param self: DKCloudAPI :param kitchen: string :param pdict: dict :param return_all_data: boolean :rtype: DKReturnCode
Below is the the instruction that describes the task: ### Input: api.add_resource(OrderDetailsV2, '/v2/order/details/<string:kitchenname>', methods=['POST']) :param self: DKCloudAPI :param kitchen: string :param pdict: dict :param return_all_data: boolean :rtype: DKReturnCode...
def fill_missing(self, value=np.nan): r"""Replace missing value to "value". Parameters: value: value that missing value is replaced Returns: Result """ return self.__class__( self.mol, [(value if is_missing(v) else v) for v in se...
r"""Replace missing value to "value". Parameters: value: value that missing value is replaced Returns: Result
Below is the the instruction that describes the task: ### Input: r"""Replace missing value to "value". Parameters: value: value that missing value is replaced Returns: Result ### Response: def fill_missing(self, value=np.nan): r"""Replace missing value to "value". ...
def subsets(self): """Subsets that make up each split of the dataset for the language pair.""" source, target = self.builder_config.language_pair filtered_subsets = {} for split, ss_names in self._subsets.items(): filtered_subsets[split] = [] for ss_name in ss_names: ds = DATASET_MAP...
Subsets that make up each split of the dataset for the language pair.
Below is the the instruction that describes the task: ### Input: Subsets that make up each split of the dataset for the language pair. ### Response: def subsets(self): """Subsets that make up each split of the dataset for the language pair.""" source, target = self.builder_config.language_pair filtered...
def competence(s): """ The competence function for MatrixMetropolis """ # MatrixMetropolis handles the Wishart family, which are valued as # _symmetric_ matrices. if any([isinstance(s, cls) for cls in [distributions.Wishart, distributions.WishartCov]]): ...
The competence function for MatrixMetropolis
Below is the the instruction that describes the task: ### Input: The competence function for MatrixMetropolis ### Response: def competence(s): """ The competence function for MatrixMetropolis """ # MatrixMetropolis handles the Wishart family, which are valued as # _symmetric...
def crust_type_at(lat=None, lon=None): """ lat, lon (degrees) """ # Get lon into appropriate format lats = np.array(lat) lons = np.array(lon%360) iVals = ((90.0-lats)%180).astype(np.int) jVals = (lons%360.0).astype(int) # i = int((-lat+90.0)%180) # j = int(lon) t = _c1_cr...
lat, lon (degrees)
Below is the the instruction that describes the task: ### Input: lat, lon (degrees) ### Response: def crust_type_at(lat=None, lon=None): """ lat, lon (degrees) """ # Get lon into appropriate format lats = np.array(lat) lons = np.array(lon%360) iVals = ((90.0-lats)%180).astype(np.int) ...
def process_runner(quantity=1, queue=None, backend=None): ''' Process queued runners quantity number of runners to process queue queue to insert the runner reference into backend backend that to use for the queue CLI Example: .. code-block:: bash salt-ru...
Process queued runners quantity number of runners to process queue queue to insert the runner reference into backend backend that to use for the queue CLI Example: .. code-block:: bash salt-run queue.process_runner salt-run queue.process_runner 5
Below is the the instruction that describes the task: ### Input: Process queued runners quantity number of runners to process queue queue to insert the runner reference into backend backend that to use for the queue CLI Example: .. code-block:: bash salt-run...
def draw_MM0(self): """ Draws the M/M0 plot in the GUI on canvas3 """ self.fig3.clf() self.fig3.text(0.02, 0.96, 'M/M0', {'family': self.font_type, 'fontsize': 10 * self.GUI_RESOLUTION, 'style': 'normal', 'va': 'center', 'ha': 'left'}) ...
Draws the M/M0 plot in the GUI on canvas3
Below is the the instruction that describes the task: ### Input: Draws the M/M0 plot in the GUI on canvas3 ### Response: def draw_MM0(self): """ Draws the M/M0 plot in the GUI on canvas3 """ self.fig3.clf() self.fig3.text(0.02, 0.96, 'M/M0', {'family': self.font_type, 'fonts...
def CMPXCHG8B(cpu, dest): """ Compares and exchanges bytes. Compares the 64-bit value in EDX:EAX (or 128-bit value in RDX:RAX if operand size is 128 bits) with the operand (destination operand). If the values are equal, the 64-bit value in ECX:EBX (or 128-bit value in RC...
Compares and exchanges bytes. Compares the 64-bit value in EDX:EAX (or 128-bit value in RDX:RAX if operand size is 128 bits) with the operand (destination operand). If the values are equal, the 64-bit value in ECX:EBX (or 128-bit value in RCX:RBX) is stored in the destination operand. ...
Below is the the instruction that describes the task: ### Input: Compares and exchanges bytes. Compares the 64-bit value in EDX:EAX (or 128-bit value in RDX:RAX if operand size is 128 bits) with the operand (destination operand). If the values are equal, the 64-bit value in ECX:EBX (or 128-...
def filter_direct(stmts_in, **kwargs): """Filter to statements that are direct interactions Parameters ---------- stmts_in : list[indra.statements.Statement] A list of statements to filter. save : Optional[str] The name of a pickle file to save the results (stmts_out) into. Ret...
Filter to statements that are direct interactions Parameters ---------- stmts_in : list[indra.statements.Statement] A list of statements to filter. save : Optional[str] The name of a pickle file to save the results (stmts_out) into. Returns ------- stmts_out : list[indra.st...
Below is the the instruction that describes the task: ### Input: Filter to statements that are direct interactions Parameters ---------- stmts_in : list[indra.statements.Statement] A list of statements to filter. save : Optional[str] The name of a pickle file to save the results (st...