code
stringlengths
75
104k
docstring
stringlengths
1
46.9k
text
stringlengths
164
112k
def info(self): """ Property for accessing :class:`InfoManager` instance, which is used to general server info. :rtype: yagocd.resources.info.InfoManager """ if self._info_manager is None: self._info_manager = InfoManager(session=self._session) return self._i...
Property for accessing :class:`InfoManager` instance, which is used to general server info. :rtype: yagocd.resources.info.InfoManager
Below is the the instruction that describes the task: ### Input: Property for accessing :class:`InfoManager` instance, which is used to general server info. :rtype: yagocd.resources.info.InfoManager ### Response: def info(self): """ Property for accessing :class:`InfoManager` instance, whi...
def wildcard_allowed_actions(self, pattern=None): """ Find statements which allow wildcard actions. A pattern can be specified for the wildcard action """ wildcard_allowed = [] for statement in self.statements: if statement.wildcard_actions(pattern) and sta...
Find statements which allow wildcard actions. A pattern can be specified for the wildcard action
Below is the the instruction that describes the task: ### Input: Find statements which allow wildcard actions. A pattern can be specified for the wildcard action ### Response: def wildcard_allowed_actions(self, pattern=None): """ Find statements which allow wildcard actions. A pat...
def omnigraffle(self): """ tries to open an export directly in omnigraffle """ temp = self.rdf_source("dot") try: # try to put in the user/tmp folder from os.path import expanduser home = expanduser("~") filename = home + "/tmp/turtle_sketch.dot" f = open(filename, "w") except: filename = "turt...
tries to open an export directly in omnigraffle
Below is the the instruction that describes the task: ### Input: tries to open an export directly in omnigraffle ### Response: def omnigraffle(self): """ tries to open an export directly in omnigraffle """ temp = self.rdf_source("dot") try: # try to put in the user/tmp folder from os.path import expandu...
def Nu_plate_Kumar(Re, Pr, chevron_angle, mu=None, mu_wall=None): r'''Calculates Nusselt number for single-phase flow in a **well-designed** Chevron-style plate heat exchanger according to [1]_. The data is believed to have been developed by APV International Limited, since acquired by SPX Corporation....
r'''Calculates Nusselt number for single-phase flow in a **well-designed** Chevron-style plate heat exchanger according to [1]_. The data is believed to have been developed by APV International Limited, since acquired by SPX Corporation. This uses a curve fit of that data published in [2]_. .....
Below is the the instruction that describes the task: ### Input: r'''Calculates Nusselt number for single-phase flow in a **well-designed** Chevron-style plate heat exchanger according to [1]_. The data is believed to have been developed by APV International Limited, since acquired by SPX Corporation. ...
def step_it_should_fail_with(context): ''' EXAMPLE: ... when I run "behave ..." then it should fail with: """ TEXT """ ''' assert context.text is not None, "ENSURE: multiline text is provided." step_command_output_should_contain(context) ...
EXAMPLE: ... when I run "behave ..." then it should fail with: """ TEXT """
Below is the the instruction that describes the task: ### Input: EXAMPLE: ... when I run "behave ..." then it should fail with: """ TEXT """ ### Response: def step_it_should_fail_with(context): ''' EXAMPLE: ... when I run "behave ....
def _dot_product(self, imgs_to_decode): """ Decoding using the dot product. """ return np.dot(imgs_to_decode.T, self.feature_images).T
Decoding using the dot product.
Below is the the instruction that describes the task: ### Input: Decoding using the dot product. ### Response: def _dot_product(self, imgs_to_decode): """ Decoding using the dot product. """ return np.dot(imgs_to_decode.T, self.feature_images).T
def decode_sent_msg(pref, message, pretty=False): """decode_sent_msg: Return a string of the decoded message """ newline = "\n" if pretty else " " indent = " " if pretty else "" start = newline + indent out = [] out.append("%s%s{%sSEQNUM: %d," % (pref, newline, start, message[Const.W_SEQ...
decode_sent_msg: Return a string of the decoded message
Below is the the instruction that describes the task: ### Input: decode_sent_msg: Return a string of the decoded message ### Response: def decode_sent_msg(pref, message, pretty=False): """decode_sent_msg: Return a string of the decoded message """ newline = "\n" if pretty else " " indent = " " i...
def privateparts(self, domain): """ Return tuple of labels and the private suffix. """ s = self.privatesuffix(domain) if s is None: return None else: # I know the domain is valid and ends with private suffix pre = domain[0:-(len(s)+1)] if p...
Return tuple of labels and the private suffix.
Below is the the instruction that describes the task: ### Input: Return tuple of labels and the private suffix. ### Response: def privateparts(self, domain): """ Return tuple of labels and the private suffix. """ s = self.privatesuffix(domain) if s is None: return None e...
def download(input, filename, representation, overwrite=False, resolvers=None, get3d=False, **kwargs): """Convenience function to save a CIR response as a file. This is just a simple wrapper around the resolve function. :param string input: Chemical identifier to resolve :param string filename: File p...
Convenience function to save a CIR response as a file. This is just a simple wrapper around the resolve function. :param string input: Chemical identifier to resolve :param string filename: File path to save to :param string representation: Desired output representation :param bool overwrite: (Opt...
Below is the the instruction that describes the task: ### Input: Convenience function to save a CIR response as a file. This is just a simple wrapper around the resolve function. :param string input: Chemical identifier to resolve :param string filename: File path to save to :param string represen...
def cwd_decorator(func): """ decorator to change cwd to directory containing rst for this function """ def wrapper(*args, **kw): cur_dir = os.getcwd() found = False for arg in sys.argv: if arg.endswith(".rst"): found = arg break ...
decorator to change cwd to directory containing rst for this function
Below is the the instruction that describes the task: ### Input: decorator to change cwd to directory containing rst for this function ### Response: def cwd_decorator(func): """ decorator to change cwd to directory containing rst for this function """ def wrapper(*args, **kw): cur_dir = os...
def create_top_schema(self): """ (Category --->) Item <---> Module <---> LogEntry <---> is a many-to-many relationship ---> is a foreign key relationship (- Category: represents a group of Items which form a top list) - Item: something that can be played multiple time...
(Category --->) Item <---> Module <---> LogEntry <---> is a many-to-many relationship ---> is a foreign key relationship (- Category: represents a group of Items which form a top list) - Item: something that can be played multiple times and is grouped by to build a top list ...
Below is the the instruction that describes the task: ### Input: (Category --->) Item <---> Module <---> LogEntry <---> is a many-to-many relationship ---> is a foreign key relationship (- Category: represents a group of Items which form a top list) - Item: something that can be ...
def __groupchat_message(self,stanza): """Process a groupchat message from a MUC room. :Parameters: - `stanza`: the stanza received. :Types: - `stanza`: `Message` :return: `True` if the message was properly recognized as directed to one of the managed...
Process a groupchat message from a MUC room. :Parameters: - `stanza`: the stanza received. :Types: - `stanza`: `Message` :return: `True` if the message was properly recognized as directed to one of the managed rooms, `False` otherwise. :returntype: `...
Below is the the instruction that describes the task: ### Input: Process a groupchat message from a MUC room. :Parameters: - `stanza`: the stanza received. :Types: - `stanza`: `Message` :return: `True` if the message was properly recognized as directed to ...
def put(self, key, value): '''Stores the object in all underlying datastores.''' for store in self._stores: store.put(key, value)
Stores the object in all underlying datastores.
Below is the the instruction that describes the task: ### Input: Stores the object in all underlying datastores. ### Response: def put(self, key, value): '''Stores the object in all underlying datastores.''' for store in self._stores: store.put(key, value)
def send_rpc(self, service, routing_id, method, args=None, kwargs=None, broadcast=False): '''Send out an RPC request :param service: the service name (the routing top level) :type service: anything hash-able :param routing_id: The id used for routing within the r...
Send out an RPC request :param service: the service name (the routing top level) :type service: anything hash-able :param routing_id: The id used for routing within the registered handlers of the service. :type routing_id: int :param method: the method na...
Below is the the instruction that describes the task: ### Input: Send out an RPC request :param service: the service name (the routing top level) :type service: anything hash-able :param routing_id: The id used for routing within the registered handlers of the servic...
def to_cfn_resource_name(name): # type: (str) -> str """Transform a name to a valid cfn name. This will convert the provided name to a CamelCase name. It's possible that the conversion to a CFN resource name can result in name collisions. It's up to the caller to handle name collisions appropr...
Transform a name to a valid cfn name. This will convert the provided name to a CamelCase name. It's possible that the conversion to a CFN resource name can result in name collisions. It's up to the caller to handle name collisions appropriately.
Below is the the instruction that describes the task: ### Input: Transform a name to a valid cfn name. This will convert the provided name to a CamelCase name. It's possible that the conversion to a CFN resource name can result in name collisions. It's up to the caller to handle name collisions ap...
def process(self, filename, encoding, **kwargs): """Process ``filename`` and encode byte-string with ``encoding``. This method is called by :func:`textract.parsers.process` and wraps the :meth:`.BaseParser.extract` method in `a delicious unicode sandwich <http://nedbatchelder.com/text/un...
Process ``filename`` and encode byte-string with ``encoding``. This method is called by :func:`textract.parsers.process` and wraps the :meth:`.BaseParser.extract` method in `a delicious unicode sandwich <http://nedbatchelder.com/text/unipain.html>`_.
Below is the the instruction that describes the task: ### Input: Process ``filename`` and encode byte-string with ``encoding``. This method is called by :func:`textract.parsers.process` and wraps the :meth:`.BaseParser.extract` method in `a delicious unicode sandwich <http://nedbatchelder.co...
def get_slot_value(payload, slot_name): """ Return the parsed value of a slot. An intent has the form: { "text": "brew me a cappuccino with 3 sugars tomorrow", "slots": [ {"value": {"slotName": "coffee_type", "value": "cappuccino"}}, ...
Return the parsed value of a slot. An intent has the form: { "text": "brew me a cappuccino with 3 sugars tomorrow", "slots": [ {"value": {"slotName": "coffee_type", "value": "cappuccino"}}, ... ] } ...
Below is the the instruction that describes the task: ### Input: Return the parsed value of a slot. An intent has the form: { "text": "brew me a cappuccino with 3 sugars tomorrow", "slots": [ {"value": {"slotName": "coffee_type", "value": "cappuccino"...
def send_event(self, action, properties, event_severity=EVENT_SEVERITY): """ send css_event and if fails send custom_event instead Args: action (ACTIONS): the action causing the event properties (dict): the action additional properties event_severity (string):...
send css_event and if fails send custom_event instead Args: action (ACTIONS): the action causing the event properties (dict): the action additional properties event_severity (string): the event severity Raises: XCLIError: if the xcli.cmd.custom_event faile...
Below is the the instruction that describes the task: ### Input: send css_event and if fails send custom_event instead Args: action (ACTIONS): the action causing the event properties (dict): the action additional properties event_severity (string): the event severity ...
def values(self): """ in order """ tmp = self while tmp is not None: yield tmp.data tmp = tmp.next
in order
Below is the the instruction that describes the task: ### Input: in order ### Response: def values(self): """ in order """ tmp = self while tmp is not None: yield tmp.data tmp = tmp.next
def _get_url(cls, name, message_model, dispatch_model): """Returns a common pattern sitemessage URL. :param str name: URL name :param Message message_model: :param Dispatch|None dispatch_model: :return: """ global APP_URLS_ATTACHED url = '' if d...
Returns a common pattern sitemessage URL. :param str name: URL name :param Message message_model: :param Dispatch|None dispatch_model: :return:
Below is the the instruction that describes the task: ### Input: Returns a common pattern sitemessage URL. :param str name: URL name :param Message message_model: :param Dispatch|None dispatch_model: :return: ### Response: def _get_url(cls, name, message_model, dispatch_model): ...
def mark_running(self): """Moves the service to the Running state. Raises if the service is not currently in the Paused state. """ with self._lock: self._set_state(self._RUNNING, self._PAUSED)
Moves the service to the Running state. Raises if the service is not currently in the Paused state.
Below is the the instruction that describes the task: ### Input: Moves the service to the Running state. Raises if the service is not currently in the Paused state. ### Response: def mark_running(self): """Moves the service to the Running state. Raises if the service is not currently in the Paused st...
def _persist(self): """ Run the command inside a thread so that we can catch output for each line as it comes in and display it. """ # run the block/command for command in self.commands: try: process = Popen( [command], ...
Run the command inside a thread so that we can catch output for each line as it comes in and display it.
Below is the the instruction that describes the task: ### Input: Run the command inside a thread so that we can catch output for each line as it comes in and display it. ### Response: def _persist(self): """ Run the command inside a thread so that we can catch output for each line a...
def create_article(tree, template, title, language, slug=None, description=None, page_title=None, menu_title=None, meta_description=None, created_by=None, image=None, publication_date=None, publication_end_date=None, published=False, login_required=False, creatio...
Create a CMS Article and it's title for the given language
Below is the the instruction that describes the task: ### Input: Create a CMS Article and it's title for the given language ### Response: def create_article(tree, template, title, language, slug=None, description=None, page_title=None, menu_title=None, meta_description=None, c...
def from_chords(self, chords, duration=1): """Add chords to the Track. The given chords should be a list of shorthand strings or list of list of shorthand strings, etc. Each sublist divides the value by 2. If a tuning is set, chords will be expanded so they have a proper ...
Add chords to the Track. The given chords should be a list of shorthand strings or list of list of shorthand strings, etc. Each sublist divides the value by 2. If a tuning is set, chords will be expanded so they have a proper fingering. Example: >>> t = Track(...
Below is the the instruction that describes the task: ### Input: Add chords to the Track. The given chords should be a list of shorthand strings or list of list of shorthand strings, etc. Each sublist divides the value by 2. If a tuning is set, chords will be expanded so they have...
def cree_widgets(self): """Create widgets and store them in self.widgets""" for t in self.FIELDS: if type(t) is str: attr, kwargs = t, {} else: attr, kwargs = t[0], t[1].copy() self.champs.append(attr) is_editable = kwargs.p...
Create widgets and store them in self.widgets
Below is the the instruction that describes the task: ### Input: Create widgets and store them in self.widgets ### Response: def cree_widgets(self): """Create widgets and store them in self.widgets""" for t in self.FIELDS: if type(t) is str: attr, kwargs = t, {} ...
def init_app(self, app): """Initializes your mail settings from the application settings. You can use this if you want to set up your Mail instance at configuration time. :param app: Flask application instance """ state = self.init_mail(app.config, app.debug, app.testin...
Initializes your mail settings from the application settings. You can use this if you want to set up your Mail instance at configuration time. :param app: Flask application instance
Below is the the instruction that describes the task: ### Input: Initializes your mail settings from the application settings. You can use this if you want to set up your Mail instance at configuration time. :param app: Flask application instance ### Response: def init_app(self, app): ...
def _textOutput(self, gaObjects): """ Prints out the specified Variant objects in a VCF-like form. """ for variant in gaObjects: print( variant.id, variant.variant_set_id, variant.names, variant.reference_name, variant.start, variant.end, ...
Prints out the specified Variant objects in a VCF-like form.
Below is the the instruction that describes the task: ### Input: Prints out the specified Variant objects in a VCF-like form. ### Response: def _textOutput(self, gaObjects): """ Prints out the specified Variant objects in a VCF-like form. """ for variant in gaObjects: pr...
def requires(self): """Additional object or objects required by this object.""" # NOTE: spec says this can also be a list of strings value = self._schema.get("requires", {}) if not isinstance(value, (basestring, dict)): raise SchemaError( "requires value {0!r}...
Additional object or objects required by this object.
Below is the the instruction that describes the task: ### Input: Additional object or objects required by this object. ### Response: def requires(self): """Additional object or objects required by this object.""" # NOTE: spec says this can also be a list of strings value = self._schema.get(...
def Deserialize(self, reader): """ Read serialized data from byte stream Args: reader (neocore.IO.BinaryReader): reader to read byte data from """ self.name = reader.ReadVarString().decode('utf-8') self.symbol = reader.ReadVarString().decode('utf-8') s...
Read serialized data from byte stream Args: reader (neocore.IO.BinaryReader): reader to read byte data from
Below is the the instruction that describes the task: ### Input: Read serialized data from byte stream Args: reader (neocore.IO.BinaryReader): reader to read byte data from ### Response: def Deserialize(self, reader): """ Read serialized data from byte stream Args: ...
def _extract_error(): """ Extracts the last OS error message into a python unicode string :return: A unicode string error message """ error_num = errno() try: error_string = os.strerror(error_num) except (ValueError): return str_cls(error_num) if isinstance(er...
Extracts the last OS error message into a python unicode string :return: A unicode string error message
Below is the the instruction that describes the task: ### Input: Extracts the last OS error message into a python unicode string :return: A unicode string error message ### Response: def _extract_error(): """ Extracts the last OS error message into a python unicode string :return: ...
def getColData(self, attri, fname, numtype='cycNum'): """ In this method a column of data for the associated column attribute is returned. Parameters ---------- attri : string The name of the attribute we are looking for. fname : string Th...
In this method a column of data for the associated column attribute is returned. Parameters ---------- attri : string The name of the attribute we are looking for. fname : string The name of the file we are getting the data from or the cycle n...
Below is the the instruction that describes the task: ### Input: In this method a column of data for the associated column attribute is returned. Parameters ---------- attri : string The name of the attribute we are looking for. fname : string The nam...
def _handle_get_cfn_template_response(self, response, application_id, template_id): """ Handles the response from the SAR service call :param dict response: the response dictionary from the app repo :param string application_id: the ApplicationId :param string template_id: the u...
Handles the response from the SAR service call :param dict response: the response dictionary from the app repo :param string application_id: the ApplicationId :param string template_id: the unique TemplateId for this application
Below is the the instruction that describes the task: ### Input: Handles the response from the SAR service call :param dict response: the response dictionary from the app repo :param string application_id: the ApplicationId :param string template_id: the unique TemplateId for this applicati...
def digit(uni_char, default_value=None): """Returns the digit value assigned to the Unicode character uni_char as integer. If no such value is defined, default is returned, or, if not given, ValueError is raised.""" uni_char = unicod(uni_char) # Force to Unicode. if default_value is not None: ...
Returns the digit value assigned to the Unicode character uni_char as integer. If no such value is defined, default is returned, or, if not given, ValueError is raised.
Below is the the instruction that describes the task: ### Input: Returns the digit value assigned to the Unicode character uni_char as integer. If no such value is defined, default is returned, or, if not given, ValueError is raised. ### Response: def digit(uni_char, default_value=None): """Returns the...
def setRecord( self, record ): """ Sets the record that is linked with this widget. :param record | <orb.Table> """ super(XBasicCardWidget, self).setRecord(record) browser = self.browserWidget() if ( not browser ): retu...
Sets the record that is linked with this widget. :param record | <orb.Table>
Below is the the instruction that describes the task: ### Input: Sets the record that is linked with this widget. :param record | <orb.Table> ### Response: def setRecord( self, record ): """ Sets the record that is linked with this widget. :param re...
def log(self,phrase): """log something that happened. The first time phrase is passed the start time is saved. The second time the phrase is logged, the elapsed time is written Parameters ---------- phrase : str the thing that happened """ ...
log something that happened. The first time phrase is passed the start time is saved. The second time the phrase is logged, the elapsed time is written Parameters ---------- phrase : str the thing that happened
Below is the the instruction that describes the task: ### Input: log something that happened. The first time phrase is passed the start time is saved. The second time the phrase is logged, the elapsed time is written Parameters ---------- phrase : str t...
def _expand_pattern_lists(pattern, **mappings): ''' Expands the pattern for any list-valued mappings, such that for any list of length N in the mappings present in the pattern, N copies of the pattern are returned, each with an element of the list substituted. pattern: A pattern to expand, ...
Expands the pattern for any list-valued mappings, such that for any list of length N in the mappings present in the pattern, N copies of the pattern are returned, each with an element of the list substituted. pattern: A pattern to expand, for example ``by-role/{grains[roles]}`` mappings: ...
Below is the the instruction that describes the task: ### Input: Expands the pattern for any list-valued mappings, such that for any list of length N in the mappings present in the pattern, N copies of the pattern are returned, each with an element of the list substituted. pattern: A pattern to...
def add_file(self, path, yaml): """ Adds given file to the file index """ if is_job_config(yaml): name = self.get_job_name(yaml) file_data = FileData(path=path, yaml=yaml) self.files[path] = file_data self.jobs[name] = file_data e...
Adds given file to the file index
Below is the the instruction that describes the task: ### Input: Adds given file to the file index ### Response: def add_file(self, path, yaml): """ Adds given file to the file index """ if is_job_config(yaml): name = self.get_job_name(yaml) file_data = Fil...
def read_nonblocking(self, size=1, timeout=None): """This reads data from the file descriptor. This is a simple implementation suitable for a regular file. Subclasses using ptys or pipes should override it. The timeout parameter is ignored. """ try: s = os.read(sel...
This reads data from the file descriptor. This is a simple implementation suitable for a regular file. Subclasses using ptys or pipes should override it. The timeout parameter is ignored.
Below is the the instruction that describes the task: ### Input: This reads data from the file descriptor. This is a simple implementation suitable for a regular file. Subclasses using ptys or pipes should override it. The timeout parameter is ignored. ### Response: def read_nonblocking(self, siz...
def get_dependency_walker(): """ Checks if `depends.exe` is in the system PATH. If not, it will be downloaded and extracted to a temporary directory. Note that the file will not be deleted afterwards. Returns the path to the Dependency Walker executable. """ for dirname in os.getenv('PATH', '').split(os...
Checks if `depends.exe` is in the system PATH. If not, it will be downloaded and extracted to a temporary directory. Note that the file will not be deleted afterwards. Returns the path to the Dependency Walker executable.
Below is the the instruction that describes the task: ### Input: Checks if `depends.exe` is in the system PATH. If not, it will be downloaded and extracted to a temporary directory. Note that the file will not be deleted afterwards. Returns the path to the Dependency Walker executable. ### Response: def get...
def list_tags(self, pattern=None): """ List all tags made on this project. :param pattern: filters the starting letters of the return value :return: """ request_url = "{}tags".format(self.create_basic_url()) params = None if pattern: params = ...
List all tags made on this project. :param pattern: filters the starting letters of the return value :return:
Below is the the instruction that describes the task: ### Input: List all tags made on this project. :param pattern: filters the starting letters of the return value :return: ### Response: def list_tags(self, pattern=None): """ List all tags made on this project. :param patt...
def get_labs(format): """Gets Techshop data from techshop.ws.""" techshops_soup = data_from_techshop_ws(techshop_us_url) techshops = {} # Load all the TechShops # By first parsing the html data = techshops_soup.findAll('div', attrs={'id': 'main-content'}) for element in data: link...
Gets Techshop data from techshop.ws.
Below is the the instruction that describes the task: ### Input: Gets Techshop data from techshop.ws. ### Response: def get_labs(format): """Gets Techshop data from techshop.ws.""" techshops_soup = data_from_techshop_ws(techshop_us_url) techshops = {} # Load all the TechShops # By first parsi...
def to_affine(aff, dims=None): ''' to_affine(None) yields None. to_affine(data) yields an affine transformation matrix equivalent to that given in data. Such a matrix may be specified either as (matrix, offset_vector), as an (n+1)x(n+1) matrix, or, as an n x (n+1) matrix. to_affine(data, dim...
to_affine(None) yields None. to_affine(data) yields an affine transformation matrix equivalent to that given in data. Such a matrix may be specified either as (matrix, offset_vector), as an (n+1)x(n+1) matrix, or, as an n x (n+1) matrix. to_affine(data, dims) additionally requires that the dimension...
Below is the the instruction that describes the task: ### Input: to_affine(None) yields None. to_affine(data) yields an affine transformation matrix equivalent to that given in data. Such a matrix may be specified either as (matrix, offset_vector), as an (n+1)x(n+1) matrix, or, as an n x (n+1) matri...
def find_ge(self, item): 'Return first item with a key >= equal to item. Raise ValueError if not found' k = self._key(item) i = bisect_left(self._keys, k) if i != len(self): return self._items[i] raise ValueError('No item found with key at or above: %r' % (k,))
Return first item with a key >= equal to item. Raise ValueError if not found
Below is the the instruction that describes the task: ### Input: Return first item with a key >= equal to item. Raise ValueError if not found ### Response: def find_ge(self, item): 'Return first item with a key >= equal to item. Raise ValueError if not found' k = self._key(item) i = bisec...
def write(self, output_stream, kmip_version=enums.KMIPVersion.KMIP_1_0): """ Write the data encoding the Archive response payload to a stream. Args: output_stream (stream): A data stream in which to encode object data, supporting a write method; usually a BytearraySt...
Write the data encoding the Archive response payload to a stream. Args: output_stream (stream): A data stream in which to encode object data, supporting a write method; usually a BytearrayStream object. kmip_version (KMIPVersion): An enumeration defining ...
Below is the the instruction that describes the task: ### Input: Write the data encoding the Archive response payload to a stream. Args: output_stream (stream): A data stream in which to encode object data, supporting a write method; usually a BytearrayStream obj...
def _Cobject(cls, ctype): """(INTERNAL) New instance from ctypes. """ o = object.__new__(cls) o._as_parameter_ = ctype return o
(INTERNAL) New instance from ctypes.
Below is the the instruction that describes the task: ### Input: (INTERNAL) New instance from ctypes. ### Response: def _Cobject(cls, ctype): """(INTERNAL) New instance from ctypes. """ o = object.__new__(cls) o._as_parameter_ = ctype return o
def radiation_values(self, location, timestep=1): """Lists of driect normal, diffuse horiz, and global horiz rad at each timestep. """ # create sunpath and get altitude at every timestep of the design day sp = Sunpath.from_location(location) altitudes = [] dates = self._g...
Lists of driect normal, diffuse horiz, and global horiz rad at each timestep.
Below is the the instruction that describes the task: ### Input: Lists of driect normal, diffuse horiz, and global horiz rad at each timestep. ### Response: def radiation_values(self, location, timestep=1): """Lists of driect normal, diffuse horiz, and global horiz rad at each timestep. """ ...
def node_indent(elt_name, node_id, fact_term, attribute, highlight_node=None): """ This tag uses a table structure to display indentation of fact terms based on the information contained in the node identifier. This tag and the closing 'node_indent_end' tag must enclose the value to be displaye...
This tag uses a table structure to display indentation of fact terms based on the information contained in the node identifier. This tag and the closing 'node_indent_end' tag must enclose the value to be displayed after the display of the fact term.
Below is the the instruction that describes the task: ### Input: This tag uses a table structure to display indentation of fact terms based on the information contained in the node identifier. This tag and the closing 'node_indent_end' tag must enclose the value to be displayed after the display ...
def jsonHook(encoded): """Custom JSON decoder that allows construction of a new ``Ci`` instance from a decoded JSON object. :param encoded: a JSON decoded object literal (a dict) :returns: "encoded" or one of the these objects: :class:`Ci`, :class:`MzmlProduct`, :class:`Mzm...
Custom JSON decoder that allows construction of a new ``Ci`` instance from a decoded JSON object. :param encoded: a JSON decoded object literal (a dict) :returns: "encoded" or one of the these objects: :class:`Ci`, :class:`MzmlProduct`, :class:`MzmlPrecursor`
Below is the the instruction that describes the task: ### Input: Custom JSON decoder that allows construction of a new ``Ci`` instance from a decoded JSON object. :param encoded: a JSON decoded object literal (a dict) :returns: "encoded" or one of the these objects: :class:`Ci`, ...
def _initialize_context(self, trace_header): """ Create a facade segment based on environment variables set by AWS Lambda and initialize storage for subsegments. """ sampled = None if not global_sdk_config.sdk_enabled(): # Force subsequent subsegments to be di...
Create a facade segment based on environment variables set by AWS Lambda and initialize storage for subsegments.
Below is the the instruction that describes the task: ### Input: Create a facade segment based on environment variables set by AWS Lambda and initialize storage for subsegments. ### Response: def _initialize_context(self, trace_header): """ Create a facade segment based on environment varia...
def revealjs(basedir=None, title=None, subtitle=None, description=None, github_user=None, github_repo=None): '''Set up or update a reveals.js presentation with slides written in markdown. Several reveal.js plugins will be set up, too. More info: Demo: https://theno.github.io/revealjs_te...
Set up or update a reveals.js presentation with slides written in markdown. Several reveal.js plugins will be set up, too. More info: Demo: https://theno.github.io/revealjs_template http://lab.hakim.se/reveal-js/ https://github.com/hakimel/reveal.js plugins: https://github.com/...
Below is the the instruction that describes the task: ### Input: Set up or update a reveals.js presentation with slides written in markdown. Several reveal.js plugins will be set up, too. More info: Demo: https://theno.github.io/revealjs_template http://lab.hakim.se/reveal-js/ https://gi...
def reverse(self): """ Returns a reversed copy of the list. """ colors = ColorList.copy(self) _list.reverse(colors) return colors
Returns a reversed copy of the list.
Below is the the instruction that describes the task: ### Input: Returns a reversed copy of the list. ### Response: def reverse(self): """ Returns a reversed copy of the list. """ colors = ColorList.copy(self) _list.reverse(colors) return colors
def dc(result, reference): r""" Dice coefficient Computes the Dice coefficient (also known as Sorensen index) between the binary objects in two images. The metric is defined as .. math:: DC=\frac{2|A\cap B|}{|A|+|B|} , where :math:`A` is the first and...
r""" Dice coefficient Computes the Dice coefficient (also known as Sorensen index) between the binary objects in two images. The metric is defined as .. math:: DC=\frac{2|A\cap B|}{|A|+|B|} , where :math:`A` is the first and :math:`B` the second set of sa...
Below is the the instruction that describes the task: ### Input: r""" Dice coefficient Computes the Dice coefficient (also known as Sorensen index) between the binary objects in two images. The metric is defined as .. math:: DC=\frac{2|A\cap B|}{|A|+|B|} ...
def stop(name, kill=False, path=None, use_vt=None): ''' Stop the named container path path to the container parent directory default: /var/lib/lxc (system) .. versionadded:: 2015.8.0 kill: False Do not wait for the container to stop, kill all tasks in the container. ...
Stop the named container path path to the container parent directory default: /var/lib/lxc (system) .. versionadded:: 2015.8.0 kill: False Do not wait for the container to stop, kill all tasks in the container. Older LXC versions will stop containers like this irrespec...
Below is the the instruction that describes the task: ### Input: Stop the named container path path to the container parent directory default: /var/lib/lxc (system) .. versionadded:: 2015.8.0 kill: False Do not wait for the container to stop, kill all tasks in the containe...
def destroy(self, blocking=False): """ Destroy all data and metadata related to this broadcast variable. Use this with caution; once a broadcast variable has been destroyed, it cannot be used again. .. versionchanged:: 3.0.0 Added optional argument `blocking` to speci...
Destroy all data and metadata related to this broadcast variable. Use this with caution; once a broadcast variable has been destroyed, it cannot be used again. .. versionchanged:: 3.0.0 Added optional argument `blocking` to specify whether to block until all blocks are del...
Below is the the instruction that describes the task: ### Input: Destroy all data and metadata related to this broadcast variable. Use this with caution; once a broadcast variable has been destroyed, it cannot be used again. .. versionchanged:: 3.0.0 Added optional argument `bloc...
def get_gafvals(self, line): """Convert fields from string to preferred format for GAF ver 2.1 and 2.0.""" flds = line.split('\t') flds[3] = self._get_qualifier(flds[3]) # 3 Qualifier flds[5] = self._get_set(flds[5]) # 5 DB_Reference flds[7] = self._get_set(flds[7]) #...
Convert fields from string to preferred format for GAF ver 2.1 and 2.0.
Below is the the instruction that describes the task: ### Input: Convert fields from string to preferred format for GAF ver 2.1 and 2.0. ### Response: def get_gafvals(self, line): """Convert fields from string to preferred format for GAF ver 2.1 and 2.0.""" flds = line.split('\t') flds[3] ...
def get_or_create_exh_obj(full_cname=False, exclude=None, callables_fname=None): r""" Return global exception handler if set, otherwise create a new one and return it. :param full_cname: Flag that indicates whether fully qualified function/method/class property names are obtained for...
r""" Return global exception handler if set, otherwise create a new one and return it. :param full_cname: Flag that indicates whether fully qualified function/method/class property names are obtained for functions/methods/class properties that use the ...
Below is the the instruction that describes the task: ### Input: r""" Return global exception handler if set, otherwise create a new one and return it. :param full_cname: Flag that indicates whether fully qualified function/method/class property names are obtained for ...
def _init_template(self, cls, base_init_template): '''This would be better as an override for Gtk.Widget''' # TODO: could disallow using a metaclass.. but this is good enough # .. if you disagree, feel free to fix it and issue a PR :) if self.__class__ is not cls: raise TypeError("Inheritance f...
This would be better as an override for Gtk.Widget
Below is the the instruction that describes the task: ### Input: This would be better as an override for Gtk.Widget ### Response: def _init_template(self, cls, base_init_template): '''This would be better as an override for Gtk.Widget''' # TODO: could disallow using a metaclass.. but this is good enough ...
def to_bytes(s, encoding="utf-8"): """ Converts the string to a bytes type, if not already. :s: the string to convert to bytes :returns: `str` on Python2 and `bytes` on Python3. """ if isinstance(s, six.binary_type): return s else: return six.text_type(s).encode(encoding)
Converts the string to a bytes type, if not already. :s: the string to convert to bytes :returns: `str` on Python2 and `bytes` on Python3.
Below is the the instruction that describes the task: ### Input: Converts the string to a bytes type, if not already. :s: the string to convert to bytes :returns: `str` on Python2 and `bytes` on Python3. ### Response: def to_bytes(s, encoding="utf-8"): """ Converts the string to a bytes type, if n...
def get_vmpolicy_macaddr_input_datacenter(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") get_vmpolicy_macaddr = ET.Element("get_vmpolicy_macaddr") config = get_vmpolicy_macaddr input = ET.SubElement(get_vmpolicy_macaddr, "input") datacen...
Auto Generated Code
Below is the the instruction that describes the task: ### Input: Auto Generated Code ### Response: def get_vmpolicy_macaddr_input_datacenter(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") get_vmpolicy_macaddr = ET.Element("get_vmpolicy_macaddr") co...
def find(default='', whole_words=0, case_sensitive=0, parent=None): "Shows a find text dialog" result = dialogs.findDialog(parent, default, whole_words, case_sensitive) return {'text': result.searchText, 'whole_words': result.wholeWordsOnly, 'case_sensitive': result.caseSensitive}
Shows a find text dialog
Below is the the instruction that describes the task: ### Input: Shows a find text dialog ### Response: def find(default='', whole_words=0, case_sensitive=0, parent=None): "Shows a find text dialog" result = dialogs.findDialog(parent, default, whole_words, case_sensitive) return {'text': result.sear...
def offset_overlays(self, text, offset=0, **kw): """ Generate overlays after offset. :param text: The text to be searched. :param offset: Match starting that index. If none just search. :returns: An overlay or None """ # This may be a bit slower but overlayedtext...
Generate overlays after offset. :param text: The text to be searched. :param offset: Match starting that index. If none just search. :returns: An overlay or None
Below is the the instruction that describes the task: ### Input: Generate overlays after offset. :param text: The text to be searched. :param offset: Match starting that index. If none just search. :returns: An overlay or None ### Response: def offset_overlays(self, text, offset=0, **kw): ...
def random_boggle(n=4): """Return a random Boggle board of size n x n. We represent a board as a linear list of letters.""" cubes = [cubes16[i % 16] for i in range(n*n)] random.shuffle(cubes) return map(random.choice, cubes)
Return a random Boggle board of size n x n. We represent a board as a linear list of letters.
Below is the the instruction that describes the task: ### Input: Return a random Boggle board of size n x n. We represent a board as a linear list of letters. ### Response: def random_boggle(n=4): """Return a random Boggle board of size n x n. We represent a board as a linear list of letters.""" cu...
def readQuotes(self, start, end): ''' read quotes ''' rows = self.__hbase.scanTable(self.tableName(HBaseDAM.QUOTE), [HBaseDAM.QUOTE], start, end) return [self.__rowResultToQuote(row) for row in rows]
read quotes
Below is the the instruction that describes the task: ### Input: read quotes ### Response: def readQuotes(self, start, end): ''' read quotes ''' rows = self.__hbase.scanTable(self.tableName(HBaseDAM.QUOTE), [HBaseDAM.QUOTE], start, end) return [self.__rowResultToQuote(row) for row in r...
def _fetch(self, request): """ Fetch using the OkHttpClient """ client = self.client #: Dispatch the async call call = Call(__id__=client.newCall(request.request)) call.enqueue(request.handler) #: Save the call reference request.call = call
Fetch using the OkHttpClient
Below is the the instruction that describes the task: ### Input: Fetch using the OkHttpClient ### Response: def _fetch(self, request): """ Fetch using the OkHttpClient """ client = self.client #: Dispatch the async call call = Call(__id__=client.newCall(request.request)) ca...
def revoke_token(self, token, callback): ''' revoke_token removes the access token from the data_store ''' yield Task(self.data_store.remove, 'tokens', token=token) callback()
revoke_token removes the access token from the data_store
Below is the the instruction that describes the task: ### Input: revoke_token removes the access token from the data_store ### Response: def revoke_token(self, token, callback): ''' revoke_token removes the access token from the data_store ''' yield Task(self.data_store.remove, 'tok...
def _get_domain_id(self, domain): """ Pulls all domains managed by authenticated Hetzner account, extracts their IDs and returns the ID for the current domain, if exists. Otherwise raises error. """ api = self.api[self.account]['domain_id'] qdomain = dns.name.from_text(do...
Pulls all domains managed by authenticated Hetzner account, extracts their IDs and returns the ID for the current domain, if exists. Otherwise raises error.
Below is the the instruction that describes the task: ### Input: Pulls all domains managed by authenticated Hetzner account, extracts their IDs and returns the ID for the current domain, if exists. Otherwise raises error. ### Response: def _get_domain_id(self, domain): """ Pulls all domains...
def choose_plural(amount, variants): """ Choose proper case depending on amount @param amount: amount of objects @type amount: C{integer types} @param variants: variants (forms) of object in such form: (1 object, 2 objects, 5 objects). @type variants: 3-element C{sequence} of C{unicode...
Choose proper case depending on amount @param amount: amount of objects @type amount: C{integer types} @param variants: variants (forms) of object in such form: (1 object, 2 objects, 5 objects). @type variants: 3-element C{sequence} of C{unicode} or C{unicode} (three variants with deli...
Below is the the instruction that describes the task: ### Input: Choose proper case depending on amount @param amount: amount of objects @type amount: C{integer types} @param variants: variants (forms) of object in such form: (1 object, 2 objects, 5 objects). @type variants: 3-element C{se...
def ow_search(self, vid=0xBC, pid=None, name=None): """Search for specific memory id/name and return it""" for m in self.get_mems(MemoryElement.TYPE_1W): if pid and m.pid == pid or name and m.name == name: return m return None
Search for specific memory id/name and return it
Below is the the instruction that describes the task: ### Input: Search for specific memory id/name and return it ### Response: def ow_search(self, vid=0xBC, pid=None, name=None): """Search for specific memory id/name and return it""" for m in self.get_mems(MemoryElement.TYPE_1W): if pi...
def compile_fund(workbook, sheet, row, col): """ Compile funding entries. Iter both rows at the same time. Keep adding entries until both cells are empty. :param obj workbook: :param str sheet: :param int row: :param int col: :return list of dict: l """ logger_excel.info("enter compi...
Compile funding entries. Iter both rows at the same time. Keep adding entries until both cells are empty. :param obj workbook: :param str sheet: :param int row: :param int col: :return list of dict: l
Below is the the instruction that describes the task: ### Input: Compile funding entries. Iter both rows at the same time. Keep adding entries until both cells are empty. :param obj workbook: :param str sheet: :param int row: :param int col: :return list of dict: l ### Response: def compile_fun...
def get(self, key, default=None, type=None): """Returns the first value for a key. If `type` is not None, the value will be converted by calling `type` with the value as argument. If type() raises `ValueError`, it will be treated as if the value didn't exist, and `default` will be ...
Returns the first value for a key. If `type` is not None, the value will be converted by calling `type` with the value as argument. If type() raises `ValueError`, it will be treated as if the value didn't exist, and `default` will be returned instead.
Below is the the instruction that describes the task: ### Input: Returns the first value for a key. If `type` is not None, the value will be converted by calling `type` with the value as argument. If type() raises `ValueError`, it will be treated as if the value didn't exist, and `default` ...
def get_info(self, full=False): " Return printable information about current site. " if full: context = self.as_dict() return "".join("{0:<25} = {1}\n".format( key, context[key]) for key in sorted(context.iterkeys())) return "%s [%s]" % (self.g...
Return printable information about current site.
Below is the the instruction that describes the task: ### Input: Return printable information about current site. ### Response: def get_info(self, full=False): " Return printable information about current site. " if full: context = self.as_dict() return "".join("{0:<25} = {...
def is_indexed(self, partition): """ Returns True if partition is already indexed. Otherwise returns False. """ query = text(""" SELECT vid FROM partition_index WHERE vid = :vid; """) result = self.execute(query, vid=partition.vid) return bool(...
Returns True if partition is already indexed. Otherwise returns False.
Below is the the instruction that describes the task: ### Input: Returns True if partition is already indexed. Otherwise returns False. ### Response: def is_indexed(self, partition): """ Returns True if partition is already indexed. Otherwise returns False. """ query = text(""" SELECT v...
def write_collection_data(self, path, data): """ Write collections rules to disk """ flags = os.O_WRONLY | os.O_CREAT | os.O_TRUNC fd = os.open(path, flags, 0o600) with os.fdopen(fd, 'w') as dyn_conf_file: dyn_conf_file.write(data)
Write collections rules to disk
Below is the the instruction that describes the task: ### Input: Write collections rules to disk ### Response: def write_collection_data(self, path, data): """ Write collections rules to disk """ flags = os.O_WRONLY | os.O_CREAT | os.O_TRUNC fd = os.open(path, flags, 0o600) ...
def _prop_name(self): """ Calculate property name from tag name, e.g. a:schemeClr -> schemeClr. """ if ':' in self._nsptagname: start = self._nsptagname.index(':') + 1 else: start = 0 return self._nsptagname[start:]
Calculate property name from tag name, e.g. a:schemeClr -> schemeClr.
Below is the the instruction that describes the task: ### Input: Calculate property name from tag name, e.g. a:schemeClr -> schemeClr. ### Response: def _prop_name(self): """ Calculate property name from tag name, e.g. a:schemeClr -> schemeClr. """ if ':' in self._nsptagname: ...
def set_entries(self, entries, user_scope): """SetEntries. [Preview API] Set the specified setting entry values for the given user/all-users scope :param {object} entries: The entries to set :param str user_scope: User-Scope at which to set the values. Should be "me" for the current user...
SetEntries. [Preview API] Set the specified setting entry values for the given user/all-users scope :param {object} entries: The entries to set :param str user_scope: User-Scope at which to set the values. Should be "me" for the current user or "host" for all users.
Below is the the instruction that describes the task: ### Input: SetEntries. [Preview API] Set the specified setting entry values for the given user/all-users scope :param {object} entries: The entries to set :param str user_scope: User-Scope at which to set the values. Should be "me" for th...
def gen_key(minion_id, dns_name=None, zone='default', password=None): ''' Generate and return an private_key. If a ``dns_name`` is passed in, the private_key will be cached under that name. The type of key and the parameters used to generate the key are based on the default certificate use policy as...
Generate and return an private_key. If a ``dns_name`` is passed in, the private_key will be cached under that name. The type of key and the parameters used to generate the key are based on the default certificate use policy associated with the specified zone. CLI Example: .. code-block:: bash ...
Below is the the instruction that describes the task: ### Input: Generate and return an private_key. If a ``dns_name`` is passed in, the private_key will be cached under that name. The type of key and the parameters used to generate the key are based on the default certificate use policy associated with...
def _set_port_security(self, v, load=False): """ Setter method for port_security, mapped from YANG variable /interface/ethernet/switchport/port_security (container) If this variable is read-only (config: false) in the source YANG file, then _set_port_security is considered as a private method. Backe...
Setter method for port_security, mapped from YANG variable /interface/ethernet/switchport/port_security (container) If this variable is read-only (config: false) in the source YANG file, then _set_port_security is considered as a private method. Backends looking to populate this variable should do so vi...
Below is the the instruction that describes the task: ### Input: Setter method for port_security, mapped from YANG variable /interface/ethernet/switchport/port_security (container) If this variable is read-only (config: false) in the source YANG file, then _set_port_security is considered as a private m...
def key_rule(self, regex, verifier): """Add a rule with a pattern that should apply to all keys. Any key not explicitly listed in an add_required or add_optional rule must match ONE OF the rules given in a call to key_rule(). So these rules are all OR'ed together. In this case ...
Add a rule with a pattern that should apply to all keys. Any key not explicitly listed in an add_required or add_optional rule must match ONE OF the rules given in a call to key_rule(). So these rules are all OR'ed together. In this case you should pass a raw string specifying a regex ...
Below is the the instruction that describes the task: ### Input: Add a rule with a pattern that should apply to all keys. Any key not explicitly listed in an add_required or add_optional rule must match ONE OF the rules given in a call to key_rule(). So these rules are all OR'ed together. ...
def cudnnCreateConvolutionDescriptor(): """" Create a convolution descriptor. This function creates a convolution descriptor object by allocating the memory needed to hold its opaque structure. Returns ------- convDesc : cudnnConvolutionDescriptor Handle to newly allocated convolut...
Create a convolution descriptor. This function creates a convolution descriptor object by allocating the memory needed to hold its opaque structure. Returns ------- convDesc : cudnnConvolutionDescriptor Handle to newly allocated convolution descriptor.
Below is the the instruction that describes the task: ### Input: Create a convolution descriptor. This function creates a convolution descriptor object by allocating the memory needed to hold its opaque structure. Returns ------- convDesc : cudnnConvolutionDescriptor Handle to newly al...
def git_list_refs(repo_dir): """List references available in the local repo with commit ids. This is similar to ls-remote, but shows the *local* refs. Return format: .. code-block:: python {<ref1>: <commit_hash1>, <ref2>: <commit_hash2>, ..., <refN>: <commit_hashN>...
List references available in the local repo with commit ids. This is similar to ls-remote, but shows the *local* refs. Return format: .. code-block:: python {<ref1>: <commit_hash1>, <ref2>: <commit_hash2>, ..., <refN>: <commit_hashN>, }
Below is the the instruction that describes the task: ### Input: List references available in the local repo with commit ids. This is similar to ls-remote, but shows the *local* refs. Return format: .. code-block:: python {<ref1>: <commit_hash1>, <ref2>: <commit_hash2>, ......
def distortion_score(X, labels, metric='euclidean'): """ Compute the mean distortion of all samples. The distortion is computed as the the sum of the squared distances between each observation and its closest centroid. Logically, this is the metric that K-Means attempts to minimize as it is fitting...
Compute the mean distortion of all samples. The distortion is computed as the the sum of the squared distances between each observation and its closest centroid. Logically, this is the metric that K-Means attempts to minimize as it is fitting the model. .. seealso:: http://kldavenport.com/the-cost-fun...
Below is the the instruction that describes the task: ### Input: Compute the mean distortion of all samples. The distortion is computed as the the sum of the squared distances between each observation and its closest centroid. Logically, this is the metric that K-Means attempts to minimize as it is fit...
def is_virtual_host(endpoint_url, bucket_name): """ Check to see if the ``bucket_name`` can be part of virtual host style. :param endpoint_url: Endpoint url which will be used for virtual host. :param bucket_name: Bucket name to be validated against. """ is_valid_bucket_name(bucket_name) ...
Check to see if the ``bucket_name`` can be part of virtual host style. :param endpoint_url: Endpoint url which will be used for virtual host. :param bucket_name: Bucket name to be validated against.
Below is the the instruction that describes the task: ### Input: Check to see if the ``bucket_name`` can be part of virtual host style. :param endpoint_url: Endpoint url which will be used for virtual host. :param bucket_name: Bucket name to be validated against. ### Response: def is_virtual_host(endp...
def import_lane_element(lane_element, plane_element): """ Method for importing 'laneSet' element from diagram file. :param lane_element: XML document element, :param plane_element: object representing a BPMN XML 'plane' element. """ lane_id = lane_element.getAttribute(co...
Method for importing 'laneSet' element from diagram file. :param lane_element: XML document element, :param plane_element: object representing a BPMN XML 'plane' element.
Below is the the instruction that describes the task: ### Input: Method for importing 'laneSet' element from diagram file. :param lane_element: XML document element, :param plane_element: object representing a BPMN XML 'plane' element. ### Response: def import_lane_element(lane_element, plane_elem...
def get_ancestors(self, obj): """Return a list of all ancestor nodes of the :class:`.Node` *obj*. The list is ordered from the most shallow ancestor (greatest great- grandparent) to the direct parent. The node itself is not included in the list. For example:: >>> text = "{{...
Return a list of all ancestor nodes of the :class:`.Node` *obj*. The list is ordered from the most shallow ancestor (greatest great- grandparent) to the direct parent. The node itself is not included in the list. For example:: >>> text = "{{a|{{b|{{c|{{d}}}}}}}}" >>> co...
Below is the the instruction that describes the task: ### Input: Return a list of all ancestor nodes of the :class:`.Node` *obj*. The list is ordered from the most shallow ancestor (greatest great- grandparent) to the direct parent. The node itself is not included in the list. For example::...
def get_etree_layout_as_dict(layout_tree): """ Convert something that looks like this: <layout> <item> <name>color</name> <value>red</value> </item> <item> <name>shapefile</name> <value>blah.shp</value> </item> </layout> ...
Convert something that looks like this: <layout> <item> <name>color</name> <value>red</value> </item> <item> <name>shapefile</name> <value>blah.shp</value> </item> </layout> Into something that looks like this: { 'co...
Below is the the instruction that describes the task: ### Input: Convert something that looks like this: <layout> <item> <name>color</name> <value>red</value> </item> <item> <name>shapefile</name> <value>blah.shp</value> </item> ...
def guessFormat(self, name): """ :param name: :type name: str """ name = name.lower() generator = self.generator if re.findall(r'^is[_A-Z]', name): return lambda x:generator.boolean() if re.findall(r'(_a|A)t$', name): return lambda x:generator.dateTime() ...
:param name: :type name: str
Below is the the instruction that describes the task: ### Input: :param name: :type name: str ### Response: def guessFormat(self, name): """ :param name: :type name: str """ name = name.lower() generator = self.generator if re.findall(r'^is[_A-Z]', na...
def _CreateConfig(self, project_id): """Create the boto config to support standalone GSUtil. Args: project_id: string, the project ID to use in the config file. """ project_id = project_id or self._GetNumericProjectId() # Our project doesn't support service accounts. if not project_id: ...
Create the boto config to support standalone GSUtil. Args: project_id: string, the project ID to use in the config file.
Below is the the instruction that describes the task: ### Input: Create the boto config to support standalone GSUtil. Args: project_id: string, the project ID to use in the config file. ### Response: def _CreateConfig(self, project_id): """Create the boto config to support standalone GSUtil. Ar...
def rewind(self, position=0): """Set the position of the data buffer cursor to 'position'.""" if position < 0 or position > len(self._data): raise Exception("Invalid position to rewind cursor to: %s." % position) self._position = position
Set the position of the data buffer cursor to 'position'.
Below is the the instruction that describes the task: ### Input: Set the position of the data buffer cursor to 'position'. ### Response: def rewind(self, position=0): """Set the position of the data buffer cursor to 'position'.""" if position < 0 or position > len(self._data): raise Exc...
def calc_path_and_create_folders(folder, import_path): """ calculate the path and create the needed folders """ file_path = abspath(path_join(folder, import_path[:import_path.rfind(".")].replace(".", folder_seperator) + ".py")) mkdir_p(dirname(file_path)) return file_path
calculate the path and create the needed folders
Below is the the instruction that describes the task: ### Input: calculate the path and create the needed folders ### Response: def calc_path_and_create_folders(folder, import_path): """ calculate the path and create the needed folders """ file_path = abspath(path_join(folder, import_path[:import_path.rfin...
def _ExtractPathSpecsFromDirectory(self, file_entry, depth=0): """Extracts path specification from a directory. Args: file_entry (dfvfs.FileEntry): file entry that refers to the directory. depth (Optional[int]): current depth where 0 represents the file system root. Yields: dfv...
Extracts path specification from a directory. Args: file_entry (dfvfs.FileEntry): file entry that refers to the directory. depth (Optional[int]): current depth where 0 represents the file system root. Yields: dfvfs.PathSpec: path specification of a file entry found in the directory...
Below is the the instruction that describes the task: ### Input: Extracts path specification from a directory. Args: file_entry (dfvfs.FileEntry): file entry that refers to the directory. depth (Optional[int]): current depth where 0 represents the file system root. Yields: dfvf...
def service_endpoint_policy_definitions(self): """Instance depends on the API version: * 2018-07-01: :class:`ServiceEndpointPolicyDefinitionsOperations<azure.mgmt.network.v2018_07_01.operations.ServiceEndpointPolicyDefinitionsOperations>` * 2018-08-01: :class:`ServiceEndpointPolicyDefinit...
Instance depends on the API version: * 2018-07-01: :class:`ServiceEndpointPolicyDefinitionsOperations<azure.mgmt.network.v2018_07_01.operations.ServiceEndpointPolicyDefinitionsOperations>` * 2018-08-01: :class:`ServiceEndpointPolicyDefinitionsOperations<azure.mgmt.network.v2018_08_01.operations.S...
Below is the the instruction that describes the task: ### Input: Instance depends on the API version: * 2018-07-01: :class:`ServiceEndpointPolicyDefinitionsOperations<azure.mgmt.network.v2018_07_01.operations.ServiceEndpointPolicyDefinitionsOperations>` * 2018-08-01: :class:`ServiceEndpointPo...
def poke_8(library, session, address, data): """Write an 8-bit value from the specified address. Corresponds to viPoke8 function of the VISA library. :param library: the visa library wrapped by ctypes. :param session: Unique logical identifier to a session. :param address: Source address to read t...
Write an 8-bit value from the specified address. Corresponds to viPoke8 function of the VISA library. :param library: the visa library wrapped by ctypes. :param session: Unique logical identifier to a session. :param address: Source address to read the value. :param data: value to be written to th...
Below is the the instruction that describes the task: ### Input: Write an 8-bit value from the specified address. Corresponds to viPoke8 function of the VISA library. :param library: the visa library wrapped by ctypes. :param session: Unique logical identifier to a session. :param address: Source ...
def pop_value(instance, path, ref=None): """ Pop the value from `instance` at the given `path`. Parameters ---------- instance : dict or list instance from which to retrieve a value path : str path to retrieve a value from ref : str or None reference path if `path` i...
Pop the value from `instance` at the given `path`. Parameters ---------- instance : dict or list instance from which to retrieve a value path : str path to retrieve a value from ref : str or None reference path if `path` is relative Returns ------- value : ...
Below is the the instruction that describes the task: ### Input: Pop the value from `instance` at the given `path`. Parameters ---------- instance : dict or list instance from which to retrieve a value path : str path to retrieve a value from ref : str or None reference ...
def get_monitor_physical_size(monitor): """ Returns the physical size of the monitor. Wrapper for: void glfwGetMonitorPhysicalSize(GLFWmonitor* monitor, int* width, int* height); """ width_value = ctypes.c_int(0) width = ctypes.pointer(width_value) height_value = ctypes.c_int(0) ...
Returns the physical size of the monitor. Wrapper for: void glfwGetMonitorPhysicalSize(GLFWmonitor* monitor, int* width, int* height);
Below is the the instruction that describes the task: ### Input: Returns the physical size of the monitor. Wrapper for: void glfwGetMonitorPhysicalSize(GLFWmonitor* monitor, int* width, int* height); ### Response: def get_monitor_physical_size(monitor): """ Returns the physical size of the mon...
def build(subparsers): """ Build source packages. The mp build program runs all of the resources listed in a Metatab file and produces one or more Metapack packages with those resources localized. It will always try to produce a Filesystem package, and may optionally produce Excel, Zip and CSV ...
Build source packages. The mp build program runs all of the resources listed in a Metatab file and produces one or more Metapack packages with those resources localized. It will always try to produce a Filesystem package, and may optionally produce Excel, Zip and CSV packages. Typical usage is to ...
Below is the the instruction that describes the task: ### Input: Build source packages. The mp build program runs all of the resources listed in a Metatab file and produces one or more Metapack packages with those resources localized. It will always try to produce a Filesystem package, and may optional...
def update(self): """Update current date/time.""" # Had to convert it to string because datetime is not JSON serializable self.stats = datetime.now().strftime('%Y-%m-%d %H:%M:%S') # Add the time zone (issue #1249 and issue #1337) if 'tmzone' in localtime(): self.stats...
Update current date/time.
Below is the the instruction that describes the task: ### Input: Update current date/time. ### Response: def update(self): """Update current date/time.""" # Had to convert it to string because datetime is not JSON serializable self.stats = datetime.now().strftime('%Y-%m-%d %H:%M:%S') ...
def _iter_year_month(year_info): """ Iter the month days in a lunar year. """ # info => month, days, leap leap_month, leap_days = _parse_leap(year_info) months = [(i, 0) for i in range(1, 13)] if leap_month > 0: months.insert(leap_month, (leap_month, 1)) for month, leap in months: ...
Iter the month days in a lunar year.
Below is the the instruction that describes the task: ### Input: Iter the month days in a lunar year. ### Response: def _iter_year_month(year_info): """ Iter the month days in a lunar year. """ # info => month, days, leap leap_month, leap_days = _parse_leap(year_info) months = [(i, 0) for i in...
def _prnt_min_max_val(var, text, verb): r"""Print variable; if more than three, just min/max, unless verb > 3.""" if var.size > 3: print(text, _strvar(var.min()), "-", _strvar(var.max()), ":", _strvar(var.size), " [min-max; #]") if verb > 3: print(" : ...
r"""Print variable; if more than three, just min/max, unless verb > 3.
Below is the the instruction that describes the task: ### Input: r"""Print variable; if more than three, just min/max, unless verb > 3. ### Response: def _prnt_min_max_val(var, text, verb): r"""Print variable; if more than three, just min/max, unless verb > 3.""" if var.size > 3: print(text, _strva...
def results_tc(self, key, value): """Write data to results_tc file in TcEX specified directory. The TcEx platform support persistent values between executions of the App. This method will store the values for TC to read and put into the Database. Args: key (string): The da...
Write data to results_tc file in TcEX specified directory. The TcEx platform support persistent values between executions of the App. This method will store the values for TC to read and put into the Database. Args: key (string): The data key to be stored. value (strin...
Below is the the instruction that describes the task: ### Input: Write data to results_tc file in TcEX specified directory. The TcEx platform support persistent values between executions of the App. This method will store the values for TC to read and put into the Database. Args: ...
def ge(self, value): """Construct a greater than or equal to (``>=``) filter. :param value: Filter value :return: :class:`filters.Field <filters.Field>` object :rtype: filters.Field """ self.op = '>=' self.negate_op = '<' self.value = self._value(value) ...
Construct a greater than or equal to (``>=``) filter. :param value: Filter value :return: :class:`filters.Field <filters.Field>` object :rtype: filters.Field
Below is the the instruction that describes the task: ### Input: Construct a greater than or equal to (``>=``) filter. :param value: Filter value :return: :class:`filters.Field <filters.Field>` object :rtype: filters.Field ### Response: def ge(self, value): """Construct a greater t...