code
stringlengths
75
104k
docstring
stringlengths
1
46.9k
text
stringlengths
164
112k
def literal_to_dict(value): """ Transform an object value into a dict readable value :param value: Object of a triple which is not a BNode :type value: Literal or URIRef :return: dict or str or list """ if isinstance(value, Literal): if value.language is not None: return {"@...
Transform an object value into a dict readable value :param value: Object of a triple which is not a BNode :type value: Literal or URIRef :return: dict or str or list
Below is the the instruction that describes the task: ### Input: Transform an object value into a dict readable value :param value: Object of a triple which is not a BNode :type value: Literal or URIRef :return: dict or str or list ### Response: def literal_to_dict(value): """ Transform an object ...
def commit_transaction(self): """Commit a multi-statement transaction. .. versionadded:: 3.7 """ self._check_ended() retry = False state = self._transaction.state if state is _TxnState.NONE: raise InvalidOperation("No transaction started") eli...
Commit a multi-statement transaction. .. versionadded:: 3.7
Below is the the instruction that describes the task: ### Input: Commit a multi-statement transaction. .. versionadded:: 3.7 ### Response: def commit_transaction(self): """Commit a multi-statement transaction. .. versionadded:: 3.7 """ self._check_ended() retry = F...
def subjects(self): """ A generator which yields :py:class:`.Subject` objects which are in this subject set. Examples:: for subject in subject_set.subjects: print(subject.id) """ for sms in SetMemberSubject.where(subject_set_id=self.id): ...
A generator which yields :py:class:`.Subject` objects which are in this subject set. Examples:: for subject in subject_set.subjects: print(subject.id)
Below is the the instruction that describes the task: ### Input: A generator which yields :py:class:`.Subject` objects which are in this subject set. Examples:: for subject in subject_set.subjects: print(subject.id) ### Response: def subjects(self): """ ...
def gps_velocity_body(GPS_RAW_INT, ATTITUDE): '''return GPS velocity vector in body frame''' r = rotation(ATTITUDE) return r.transposed() * Vector3(GPS_RAW_INT.vel*0.01*cos(radians(GPS_RAW_INT.cog*0.01)), GPS_RAW_INT.vel*0.01*sin(radians(GPS_RAW_INT.cog*0.01)), ...
return GPS velocity vector in body frame
Below is the the instruction that describes the task: ### Input: return GPS velocity vector in body frame ### Response: def gps_velocity_body(GPS_RAW_INT, ATTITUDE): '''return GPS velocity vector in body frame''' r = rotation(ATTITUDE) return r.transposed() * Vector3(GPS_RAW_INT.vel*0.01*cos(radians(GP...
async def handle_job_closing(self, container_id, retval): """ Handle a closing student container. Do some cleaning, verify memory limits, timeouts, ... and returns data to the backend """ try: self._logger.debug("Closing %s", container_id) try: mes...
Handle a closing student container. Do some cleaning, verify memory limits, timeouts, ... and returns data to the backend
Below is the the instruction that describes the task: ### Input: Handle a closing student container. Do some cleaning, verify memory limits, timeouts, ... and returns data to the backend ### Response: async def handle_job_closing(self, container_id, retval): """ Handle a closing student container. ...
def resize(image, width=None, height=None, crop=False): """ Resize an image and return the resized file. """ # First normalize params to determine which file to get width, height, crop = _normalize_params(image, width, height, crop) try: # Check the image file state for clean close ...
Resize an image and return the resized file.
Below is the the instruction that describes the task: ### Input: Resize an image and return the resized file. ### Response: def resize(image, width=None, height=None, crop=False): """ Resize an image and return the resized file. """ # First normalize params to determine which file to get width,...
def set(self, client_id, code, request, *args, **kwargs): """Creates Grant object with the given params :param client_id: ID of the client :param code: :param request: OAuthlib request object """ expires = datetime.utcnow() + timedelta(seconds=100) grant = self.m...
Creates Grant object with the given params :param client_id: ID of the client :param code: :param request: OAuthlib request object
Below is the the instruction that describes the task: ### Input: Creates Grant object with the given params :param client_id: ID of the client :param code: :param request: OAuthlib request object ### Response: def set(self, client_id, code, request, *args, **kwargs): """Creates Gra...
def find_asm_blocks(asm_lines): """Find blocks probably corresponding to loops in assembly.""" blocks = [] last_labels = OrderedDict() packed_ctr = 0 avx_ctr = 0 xmm_references = [] ymm_references = [] zmm_references = [] gp_references = [] mem_references = [] increments = {...
Find blocks probably corresponding to loops in assembly.
Below is the the instruction that describes the task: ### Input: Find blocks probably corresponding to loops in assembly. ### Response: def find_asm_blocks(asm_lines): """Find blocks probably corresponding to loops in assembly.""" blocks = [] last_labels = OrderedDict() packed_ctr = 0 avx_ctr ...
def get_multiple_data(): """Get data from all the platforms listed in makerlabs.""" # Get data from all the mapped platforms all_labs = {} all_labs["diybio_org"] = diybio_org.get_labs(format="dict") all_labs["fablabs_io"] = fablabs_io.get_labs(format="dict") all_labs["makeinitaly_foundation"] =...
Get data from all the platforms listed in makerlabs.
Below is the the instruction that describes the task: ### Input: Get data from all the platforms listed in makerlabs. ### Response: def get_multiple_data(): """Get data from all the platforms listed in makerlabs.""" # Get data from all the mapped platforms all_labs = {} all_labs["diybio_org"] = di...
def check_physical(self, line): """Run all physical checks on a raw input line.""" self.physical_line = line for name, check, argument_names in self._physical_checks: self.init_checker_state(name, argument_names) result = self.run_check(check, argument_names) ...
Run all physical checks on a raw input line.
Below is the the instruction that describes the task: ### Input: Run all physical checks on a raw input line. ### Response: def check_physical(self, line): """Run all physical checks on a raw input line.""" self.physical_line = line for name, check, argument_names in self._physical_checks: ...
def sign_key(self, keyid, default_key=None, passphrase=None): """ sign (an imported) public key - keyid, with default secret key >>> import gnupg >>> gpg = gnupg.GPG(homedir="doctests") >>> key_input = gpg.gen_key_input() >>> key = gpg.gen_key(key_input) >>> gpg.sign_key...
sign (an imported) public key - keyid, with default secret key >>> import gnupg >>> gpg = gnupg.GPG(homedir="doctests") >>> key_input = gpg.gen_key_input() >>> key = gpg.gen_key(key_input) >>> gpg.sign_key(key['fingerprint']) >>> gpg.list_sigs(key['fingerprint']) ...
Below is the the instruction that describes the task: ### Input: sign (an imported) public key - keyid, with default secret key >>> import gnupg >>> gpg = gnupg.GPG(homedir="doctests") >>> key_input = gpg.gen_key_input() >>> key = gpg.gen_key(key_input) >>> gpg.sign_key(key[...
def steal_docstring_from(obj): """Decorator that lets you steal a docstring from another object Example ------- :: @steal_docstring_from(superclass.meth) def meth(self, arg): "Extra subclass documentation" pass In this case the docstring of the new 'meth' will be copied f...
Decorator that lets you steal a docstring from another object Example ------- :: @steal_docstring_from(superclass.meth) def meth(self, arg): "Extra subclass documentation" pass In this case the docstring of the new 'meth' will be copied from superclass.meth, and if an add...
Below is the the instruction that describes the task: ### Input: Decorator that lets you steal a docstring from another object Example ------- :: @steal_docstring_from(superclass.meth) def meth(self, arg): "Extra subclass documentation" pass In this case the docstring of ...
def add_manager(model): """ Monkey patches the original model to use MultilingualManager instead of default managers (not only ``objects``, but also every manager defined and inherited). Custom managers are merged with MultilingualManager. """ if model._meta.abstract: return # Make ...
Monkey patches the original model to use MultilingualManager instead of default managers (not only ``objects``, but also every manager defined and inherited). Custom managers are merged with MultilingualManager.
Below is the the instruction that describes the task: ### Input: Monkey patches the original model to use MultilingualManager instead of default managers (not only ``objects``, but also every manager defined and inherited). Custom managers are merged with MultilingualManager. ### Response: def add_manager...
def count_relations(graph) -> Counter: """Return a histogram over all relationships in a graph. :param pybel.BELGraph graph: A BEL graph :return: A Counter from {relation type: frequency} """ return Counter( data[RELATION] for _, _, data in graph.edges(data=True) )
Return a histogram over all relationships in a graph. :param pybel.BELGraph graph: A BEL graph :return: A Counter from {relation type: frequency}
Below is the the instruction that describes the task: ### Input: Return a histogram over all relationships in a graph. :param pybel.BELGraph graph: A BEL graph :return: A Counter from {relation type: frequency} ### Response: def count_relations(graph) -> Counter: """Return a histogram over all relatio...
def _get_query_argument(args, cell, env): """ Get a query argument to a cell magic. The query is specified with args['query']. We look that up and if it is a BQ query object, just return it. If it is a string, build a query object out of it and return that Args: args: the dictionary of magic arguments. ...
Get a query argument to a cell magic. The query is specified with args['query']. We look that up and if it is a BQ query object, just return it. If it is a string, build a query object out of it and return that Args: args: the dictionary of magic arguments. cell: the cell contents which can be variabl...
Below is the the instruction that describes the task: ### Input: Get a query argument to a cell magic. The query is specified with args['query']. We look that up and if it is a BQ query object, just return it. If it is a string, build a query object out of it and return that Args: args: the dictionary...
def freqz_cas(sos,w): """ Cascade frequency response Mark Wickert October 2016 """ Ns,Mcol = sos.shape w,Hcas = signal.freqz(sos[0,:3],sos[0,3:],w) for k in range(1,Ns): w,Htemp = signal.freqz(sos[k,:3],sos[k,3:],w) Hcas *= Htemp return w, Hcas
Cascade frequency response Mark Wickert October 2016
Below is the the instruction that describes the task: ### Input: Cascade frequency response Mark Wickert October 2016 ### Response: def freqz_cas(sos,w): """ Cascade frequency response Mark Wickert October 2016 """ Ns,Mcol = sos.shape w,Hcas = signal.freqz(sos[0,:3],s...
def select_labels(self, labels=None): """ Prepare binar segmentation based on input segmentation and labels. :param labels: :return: """ self._resize_if_required() segmentation = self._select_labels(self.resized_segmentation, labels) # logger.debug("select labels...
Prepare binar segmentation based on input segmentation and labels. :param labels: :return:
Below is the the instruction that describes the task: ### Input: Prepare binar segmentation based on input segmentation and labels. :param labels: :return: ### Response: def select_labels(self, labels=None): """ Prepare binar segmentation based on input segmentation and labels. :p...
def family_name(self): """ The name of the typeface family for this font, e.g. 'Arial'. """ def find_first(dict_, keys, default=None): for key in keys: value = dict_.get(key) if value is not None: return value re...
The name of the typeface family for this font, e.g. 'Arial'.
Below is the the instruction that describes the task: ### Input: The name of the typeface family for this font, e.g. 'Arial'. ### Response: def family_name(self): """ The name of the typeface family for this font, e.g. 'Arial'. """ def find_first(dict_, keys, default=None): ...
async def play(self, ctx, *, query): """Plays a file from the local filesystem""" source = discord.PCMVolumeTransformer(discord.FFmpegPCMAudio(query)) ctx.voice_client.play(source, after=lambda e: print('Player error: %s' % e) if e else None) await ctx.send('Now playing: {}'.format(que...
Plays a file from the local filesystem
Below is the the instruction that describes the task: ### Input: Plays a file from the local filesystem ### Response: async def play(self, ctx, *, query): """Plays a file from the local filesystem""" source = discord.PCMVolumeTransformer(discord.FFmpegPCMAudio(query)) ctx.voice_client.play...
def _find_reader_dataset(self, dataset_key, **dfilter): """Attempt to find a `DatasetID` in the available readers. Args: dataset_key (str, float, DatasetID): Dataset name, wavelength, or a combination of `DatasetID` parameters to use in searching for the data...
Attempt to find a `DatasetID` in the available readers. Args: dataset_key (str, float, DatasetID): Dataset name, wavelength, or a combination of `DatasetID` parameters to use in searching for the dataset from the available readers. **dfilt...
Below is the the instruction that describes the task: ### Input: Attempt to find a `DatasetID` in the available readers. Args: dataset_key (str, float, DatasetID): Dataset name, wavelength, or a combination of `DatasetID` parameters to use in searching for the da...
def fetch_points_of_sales(self, ticket=None): """ Fetch all point of sales objects. Fetch all point of sales from the WS and store (or update) them locally. Returns a list of tuples with the format (pos, created,). """ ticket = ticket or self.get_or_create_ticke...
Fetch all point of sales objects. Fetch all point of sales from the WS and store (or update) them locally. Returns a list of tuples with the format (pos, created,).
Below is the the instruction that describes the task: ### Input: Fetch all point of sales objects. Fetch all point of sales from the WS and store (or update) them locally. Returns a list of tuples with the format (pos, created,). ### Response: def fetch_points_of_sales(self, ticket=None):...
def check_basic_auth(self, username, password): """ This function is called to check if a username / password combination is valid via the htpasswd file. """ valid = self.users.check_password( username, password ) if not valid: log.warning(...
This function is called to check if a username / password combination is valid via the htpasswd file.
Below is the the instruction that describes the task: ### Input: This function is called to check if a username / password combination is valid via the htpasswd file. ### Response: def check_basic_auth(self, username, password): """ This function is called to check if a username / p...
def clear_all(self): "Remove all items and column headings" self.clear() for ch in reversed(self.columns): del self[ch.name]
Remove all items and column headings
Below is the the instruction that describes the task: ### Input: Remove all items and column headings ### Response: def clear_all(self): "Remove all items and column headings" self.clear() for ch in reversed(self.columns): del self[ch.name]
def ensure_int64_or_float64(arr, copy=False): """ Ensure that an dtype array of some integer dtype has an int64 dtype if possible If it's not possible, potentially because of overflow, convert the array to float64 instead. Parameters ---------- arr : array-like The array whose...
Ensure that an dtype array of some integer dtype has an int64 dtype if possible If it's not possible, potentially because of overflow, convert the array to float64 instead. Parameters ---------- arr : array-like The array whose data type we want to enforce. copy: boolean ...
Below is the the instruction that describes the task: ### Input: Ensure that an dtype array of some integer dtype has an int64 dtype if possible If it's not possible, potentially because of overflow, convert the array to float64 instead. Parameters ---------- arr : array-like The ...
def _create_with_scope(body, kwargs): ''' Helper function to wrap a block in a scope stack: with ContextScope(context, **kwargs) as context: ... body ... ''' return ast.With( items=[ ast.withitem( context_expr=_a.Call( _a.Name('Context...
Helper function to wrap a block in a scope stack: with ContextScope(context, **kwargs) as context: ... body ...
Below is the the instruction that describes the task: ### Input: Helper function to wrap a block in a scope stack: with ContextScope(context, **kwargs) as context: ... body ... ### Response: def _create_with_scope(body, kwargs): ''' Helper function to wrap a block in a scope stack: with C...
def create_reader(name, *args, format=None, registry=default_registry, **kwargs): """ Create a reader instance, guessing its factory using filename (and eventually format). :param name: :param args: :param format: :param registry: :param kwargs: :return: mixed """ return regist...
Create a reader instance, guessing its factory using filename (and eventually format). :param name: :param args: :param format: :param registry: :param kwargs: :return: mixed
Below is the the instruction that describes the task: ### Input: Create a reader instance, guessing its factory using filename (and eventually format). :param name: :param args: :param format: :param registry: :param kwargs: :return: mixed ### Response: def create_reader(name, *args, form...
def init(FILE): """ Read config file :param FILE: Absolute path to config file (incl. filename) :type FILE: str """ try: cfg.read(FILE) global _loaded _loaded = True except: file_not_found_message(FILE)
Read config file :param FILE: Absolute path to config file (incl. filename) :type FILE: str
Below is the the instruction that describes the task: ### Input: Read config file :param FILE: Absolute path to config file (incl. filename) :type FILE: str ### Response: def init(FILE): """ Read config file :param FILE: Absolute path to config file (incl. filename) :type FILE: str ""...
def after_third_friday(day=None): """ check if day is after month's 3rd friday """ day = day if day is not None else datetime.datetime.now() now = day.replace(day=1, hour=16, minute=0, second=0, microsecond=0) now += relativedelta.relativedelta(weeks=2, weekday=relativedelta.FR) return day > now
check if day is after month's 3rd friday
Below is the the instruction that describes the task: ### Input: check if day is after month's 3rd friday ### Response: def after_third_friday(day=None): """ check if day is after month's 3rd friday """ day = day if day is not None else datetime.datetime.now() now = day.replace(day=1, hour=16, minute=0...
def get_weights(self): """Returns a dictionary containing the weights of the network. Returns: Dictionary mapping variable names to their weights. """ self._check_sess() return { k: v.eval(session=self.sess) for k, v in self.variables.items() ...
Returns a dictionary containing the weights of the network. Returns: Dictionary mapping variable names to their weights.
Below is the the instruction that describes the task: ### Input: Returns a dictionary containing the weights of the network. Returns: Dictionary mapping variable names to their weights. ### Response: def get_weights(self): """Returns a dictionary containing the weights of the network. ...
def join_keys(x, y, by=None): """ Join keys. Given two data frames, create a unique key for each row. Parameters ----------- x : dataframe y : dataframe by : list-like Column names to join by Returns ------- out : dict Dictionary with keys x and y. The valu...
Join keys. Given two data frames, create a unique key for each row. Parameters ----------- x : dataframe y : dataframe by : list-like Column names to join by Returns ------- out : dict Dictionary with keys x and y. The values of both keys are arrays with in...
Below is the the instruction that describes the task: ### Input: Join keys. Given two data frames, create a unique key for each row. Parameters ----------- x : dataframe y : dataframe by : list-like Column names to join by Returns ------- out : dict Dictionary ...
def datagram_received(self, data, addr): """Method run when data is received from the devices This method will unpack the data according to the LIFX protocol. If a new device is found, the Light device will be created and started aa a DatagramProtocol and will be registered with the par...
Method run when data is received from the devices This method will unpack the data according to the LIFX protocol. If a new device is found, the Light device will be created and started aa a DatagramProtocol and will be registered with the parent. :param data: raw data ...
Below is the the instruction that describes the task: ### Input: Method run when data is received from the devices This method will unpack the data according to the LIFX protocol. If a new device is found, the Light device will be created and started aa a DatagramProtocol and will be regist...
def _get_canonical_map(self): """Return a mapping of available command names and aliases to their canonical command name. """ cacheattr = "_token2canonical" if not hasattr(self, cacheattr): # Get the list of commands and their aliases, if any. token2canoni...
Return a mapping of available command names and aliases to their canonical command name.
Below is the the instruction that describes the task: ### Input: Return a mapping of available command names and aliases to their canonical command name. ### Response: def _get_canonical_map(self): """Return a mapping of available command names and aliases to their canonical command name. ...
def iter_symbols(code): """Yield names and strings used by `code` and its nested code objects""" for name in code.co_names: yield name for const in code.co_consts: if isinstance(const, six.string_types): yield const elif isinstance(const, CodeType): for name i...
Yield names and strings used by `code` and its nested code objects
Below is the the instruction that describes the task: ### Input: Yield names and strings used by `code` and its nested code objects ### Response: def iter_symbols(code): """Yield names and strings used by `code` and its nested code objects""" for name in code.co_names: yield name for const in c...
def get_port_chann_detail_request(last_aggregator_id): """ Creates a new Netconf request based on the last received aggregator id when the hasMore flag is true """ port_channel_ns = 'urn:brocade.com:mgmt:brocade-lag' request_port_channel = ET.Element('get-port-channel-detail', ...
Creates a new Netconf request based on the last received aggregator id when the hasMore flag is true
Below is the the instruction that describes the task: ### Input: Creates a new Netconf request based on the last received aggregator id when the hasMore flag is true ### Response: def get_port_chann_detail_request(last_aggregator_id): """ Creates a new Netconf request based on the last received ...
def thermal_conductivity(self, temperature, volume): """ Eq(17) in 10.1103/PhysRevB.90.174107 Args: temperature (float): temperature in K volume (float): in Ang^3 Returns: float: thermal conductivity in W/K/m """ gamma = self.gruneise...
Eq(17) in 10.1103/PhysRevB.90.174107 Args: temperature (float): temperature in K volume (float): in Ang^3 Returns: float: thermal conductivity in W/K/m
Below is the the instruction that describes the task: ### Input: Eq(17) in 10.1103/PhysRevB.90.174107 Args: temperature (float): temperature in K volume (float): in Ang^3 Returns: float: thermal conductivity in W/K/m ### Response: def thermal_conductivity(self,...
def _UnpackGdbVal(self, gdb_value): """Unpacks gdb.Value objects and returns the best-matched python object.""" val_type = gdb_value.type.code if val_type == gdb.TYPE_CODE_INT or val_type == gdb.TYPE_CODE_ENUM: return int(gdb_value) if val_type == gdb.TYPE_CODE_VOID: return None if val_t...
Unpacks gdb.Value objects and returns the best-matched python object.
Below is the the instruction that describes the task: ### Input: Unpacks gdb.Value objects and returns the best-matched python object. ### Response: def _UnpackGdbVal(self, gdb_value): """Unpacks gdb.Value objects and returns the best-matched python object.""" val_type = gdb_value.type.code if val_type...
def pygal_parser(preprocessor, tag, markup): """ Simple pygal parser """ # Find JSON payload data = loads(markup) if tag == 'pygal' and data is not None: # Run generation of chart output = run_pygal(data) # Return embedded SVG image return '<div class="pygal" style="text-...
Simple pygal parser
Below is the the instruction that describes the task: ### Input: Simple pygal parser ### Response: def pygal_parser(preprocessor, tag, markup): """ Simple pygal parser """ # Find JSON payload data = loads(markup) if tag == 'pygal' and data is not None: # Run generation of chart outp...
def remove(self, node, dirty=True): """Remove the given child node. Args: node (gkeepapi.Node): Node to remove. dirty (bool): Whether this node should be marked dirty. """ if node.id in self._children: self._children[node.id].parent = None ...
Remove the given child node. Args: node (gkeepapi.Node): Node to remove. dirty (bool): Whether this node should be marked dirty.
Below is the the instruction that describes the task: ### Input: Remove the given child node. Args: node (gkeepapi.Node): Node to remove. dirty (bool): Whether this node should be marked dirty. ### Response: def remove(self, node, dirty=True): """Remove the given child node...
def compile_template_str(template, renderers, default, blacklist, whitelist): ''' Take template as a string and return the high data structure derived from the template. ''' fn_ = salt.utils.files.mkstemp() with salt.utils.files.fopen(fn_, 'wb') as ofile: ofile.write(SLS_ENCODER(template...
Take template as a string and return the high data structure derived from the template.
Below is the the instruction that describes the task: ### Input: Take template as a string and return the high data structure derived from the template. ### Response: def compile_template_str(template, renderers, default, blacklist, whitelist): ''' Take template as a string and return the high data str...
def _auto_commit(self): """ Check if we have to commit based on number of messages and commit """ # Check if we are supposed to do an auto-commit if not self.auto_commit or self.auto_commit_every_n is None: return if self.count_since_commit >= self.auto_comm...
Check if we have to commit based on number of messages and commit
Below is the the instruction that describes the task: ### Input: Check if we have to commit based on number of messages and commit ### Response: def _auto_commit(self): """ Check if we have to commit based on number of messages and commit """ # Check if we are supposed to do an aut...
def delete_process_behavior(self, process_id, behavior_ref_name): """DeleteProcessBehavior. [Preview API] Removes a behavior in the process. :param str process_id: The ID of the process :param str behavior_ref_name: The reference name of the behavior """ route_values = {}...
DeleteProcessBehavior. [Preview API] Removes a behavior in the process. :param str process_id: The ID of the process :param str behavior_ref_name: The reference name of the behavior
Below is the the instruction that describes the task: ### Input: DeleteProcessBehavior. [Preview API] Removes a behavior in the process. :param str process_id: The ID of the process :param str behavior_ref_name: The reference name of the behavior ### Response: def delete_process_behavior(se...
def match(line, keyword): """ If the first part of line (modulo blanks) matches keyword, returns the end of that line. Otherwise checks if keyword is anywhere in the line and returns that section, else returns None""" line = line.lstrip() length = len(keyword) if line[:length] == keyword: ...
If the first part of line (modulo blanks) matches keyword, returns the end of that line. Otherwise checks if keyword is anywhere in the line and returns that section, else returns None
Below is the the instruction that describes the task: ### Input: If the first part of line (modulo blanks) matches keyword, returns the end of that line. Otherwise checks if keyword is anywhere in the line and returns that section, else returns None ### Response: def match(line, keyword): """ If the fi...
def auth_access(self, auth_code): """ verify the fist authorization response url code response data 返回值字段 字段类型 字段说明 access_token string 用户授权的唯一票据,用于调用微博的开放接口,同时也是第三方应用验证微博用户登录的唯一票据, 第三方应用应该用该票据和自己应用内的用户建立唯一影射关系,来识别登录状态,不能使用本返回值...
verify the fist authorization response url code response data 返回值字段 字段类型 字段说明 access_token string 用户授权的唯一票据,用于调用微博的开放接口,同时也是第三方应用验证微博用户登录的唯一票据, 第三方应用应该用该票据和自己应用内的用户建立唯一影射关系,来识别登录状态,不能使用本返回值里的UID 字段来做登录识别。 ...
Below is the the instruction that describes the task: ### Input: verify the fist authorization response url code response data 返回值字段 字段类型 字段说明 access_token string 用户授权的唯一票据,用于调用微博的开放接口,同时也是第三方应用验证微博用户登录的唯一票据, 第三方应用应该用该票据和自己应用内的用户建立唯一影射关系,来...
def f_get_parent(self): """Returns the parent of the node. Raises a TypeError if current node is root. """ if self.v_is_root: raise TypeError('Root does not have a parent') elif self.v_location == '': return self.v_root else: return s...
Returns the parent of the node. Raises a TypeError if current node is root.
Below is the the instruction that describes the task: ### Input: Returns the parent of the node. Raises a TypeError if current node is root. ### Response: def f_get_parent(self): """Returns the parent of the node. Raises a TypeError if current node is root. """ if self.v_...
def merge_ticket(self, ticket_id, into_id): """ Merge ticket into another (undocumented API feature). :param ticket_id: ID of ticket to be merged :param into: ID of destination ticket :returns: ``True`` Operation was successful ``False`` ...
Merge ticket into another (undocumented API feature). :param ticket_id: ID of ticket to be merged :param into: ID of destination ticket :returns: ``True`` Operation was successful ``False`` Either origin or destination ticket does no...
Below is the the instruction that describes the task: ### Input: Merge ticket into another (undocumented API feature). :param ticket_id: ID of ticket to be merged :param into: ID of destination ticket :returns: ``True`` Operation was successful ``Fals...
def clear_created_date(self): """Removes the created date. raise: NoAccess - ``Metadata.isRequired()`` is ``true`` or ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.* """ # Implemented from template for osid.asse...
Removes the created date. raise: NoAccess - ``Metadata.isRequired()`` is ``true`` or ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.*
Below is the the instruction that describes the task: ### Input: Removes the created date. raise: NoAccess - ``Metadata.isRequired()`` is ``true`` or ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.* ### Response: def clear_created_d...
def fake_chars_or_choice(self, field_name): """ Return fake chars or choice it if the `field_name` has choices. Then, returning random value from it. This specially for `CharField`. Usage: faker.fake_chars_or_choice('field_name') Example for field: ...
Return fake chars or choice it if the `field_name` has choices. Then, returning random value from it. This specially for `CharField`. Usage: faker.fake_chars_or_choice('field_name') Example for field: TYPE_CHOICES = ( ('project', 'I wanna to talk a...
Below is the the instruction that describes the task: ### Input: Return fake chars or choice it if the `field_name` has choices. Then, returning random value from it. This specially for `CharField`. Usage: faker.fake_chars_or_choice('field_name') Example for field: ...
def owned_pre_save(sender, document, **kwargs): ''' Owned mongoengine.pre_save signal handler Need to fetch original owner before the new one erase it. ''' if not isinstance(document, Owned): return changed_fields = getattr(document, '_changed_fields', []) if 'organization' in change...
Owned mongoengine.pre_save signal handler Need to fetch original owner before the new one erase it.
Below is the the instruction that describes the task: ### Input: Owned mongoengine.pre_save signal handler Need to fetch original owner before the new one erase it. ### Response: def owned_pre_save(sender, document, **kwargs): ''' Owned mongoengine.pre_save signal handler Need to fetch original own...
def list_app(self): ''' List the apps. ''' kwd = { 'pager': '', 'title': '' } self.render('user/info_list/list_app.html', kwd=kwd, userinfo=self.userinfo)
List the apps.
Below is the the instruction that describes the task: ### Input: List the apps. ### Response: def list_app(self): ''' List the apps. ''' kwd = { 'pager': '', 'title': '' } self.render('user/info_list/list_app.html', kwd=kwd, ...
def scan_index(index, model): """ Yield all documents of model type in an index. This function calls the elasticsearch.helpers.scan function, and yields all the documents in the index that match the doc_type produced by a specific Django model. Args: index: string, the name of the inde...
Yield all documents of model type in an index. This function calls the elasticsearch.helpers.scan function, and yields all the documents in the index that match the doc_type produced by a specific Django model. Args: index: string, the name of the index to scan, must be a configured ...
Below is the the instruction that describes the task: ### Input: Yield all documents of model type in an index. This function calls the elasticsearch.helpers.scan function, and yields all the documents in the index that match the doc_type produced by a specific Django model. Args: index: s...
def shared_atts(self): """Gets atts shared among all nonzero length component Chunk""" #TODO cache this, could get ugly for large FmtStrs atts = {} first = self.chunks[0] for att in sorted(first.atts): #TODO how to write this without the '???'? if all(fs.a...
Gets atts shared among all nonzero length component Chunk
Below is the the instruction that describes the task: ### Input: Gets atts shared among all nonzero length component Chunk ### Response: def shared_atts(self): """Gets atts shared among all nonzero length component Chunk""" #TODO cache this, could get ugly for large FmtStrs atts = {} ...
def build_srcdict(gta, prop): """Build a dictionary that maps from source name to the value of a source property Parameters ---------- gta : `fermipy.GTAnalysis` The analysis object prop : str The name of the property we are mapping Returns ------- odict : dict ...
Build a dictionary that maps from source name to the value of a source property Parameters ---------- gta : `fermipy.GTAnalysis` The analysis object prop : str The name of the property we are mapping Returns ------- odict : dict Dictionary that maps from source ...
Below is the the instruction that describes the task: ### Input: Build a dictionary that maps from source name to the value of a source property Parameters ---------- gta : `fermipy.GTAnalysis` The analysis object prop : str The name of the property we are mapping Returns ...
def parse_san(self, board: chess.Board, san: str) -> chess.Move: """ When the visitor is used by a parser, this is called to parse a move in standard algebraic notation. You can override the default implementation to work around specific quirks of your input format. """ ...
When the visitor is used by a parser, this is called to parse a move in standard algebraic notation. You can override the default implementation to work around specific quirks of your input format.
Below is the the instruction that describes the task: ### Input: When the visitor is used by a parser, this is called to parse a move in standard algebraic notation. You can override the default implementation to work around specific quirks of your input format. ### Response: def parse_san...
def visit_ifexp(self, node): """return an astroid.IfExp node as string""" return "%s if %s else %s" % ( self._precedence_parens(node, node.body, is_left=True), self._precedence_parens(node, node.test, is_left=True), self._precedence_parens(node, node.orelse, is_left=F...
return an astroid.IfExp node as string
Below is the the instruction that describes the task: ### Input: return an astroid.IfExp node as string ### Response: def visit_ifexp(self, node): """return an astroid.IfExp node as string""" return "%s if %s else %s" % ( self._precedence_parens(node, node.body, is_left=True), ...
def p_if_then_part(p): """ if_then_part : IF expr then """ if is_number(p[2]): api.errmsg.warning_condition_is_always(p.lineno(1), bool(p[2].value)) p[0] = p[2]
if_then_part : IF expr then
Below is the the instruction that describes the task: ### Input: if_then_part : IF expr then ### Response: def p_if_then_part(p): """ if_then_part : IF expr then """ if is_number(p[2]): api.errmsg.warning_condition_is_always(p.lineno(1), bool(p[2].value)) p[0] = p[2]
def validate_model_parameters(self, algo, training_frame, parameters, timeoutSecs=60, **kwargs): ''' Check a dictionary of model builder parameters on the h2o cluster using the given algorithm and model parameters. ''' assert algo is not None, '"algo" parameter is null' # Allow this now: assert...
Check a dictionary of model builder parameters on the h2o cluster using the given algorithm and model parameters.
Below is the the instruction that describes the task: ### Input: Check a dictionary of model builder parameters on the h2o cluster using the given algorithm and model parameters. ### Response: def validate_model_parameters(self, algo, training_frame, parameters, timeoutSecs=60, **kwargs): ''' Check a ...
def is_present(conf, atom): ''' Tell if a given package or DEPEND atom is present in the configuration files tree. Warning: This only works if the configuration files tree is in the correct format (the one enforced by enforce_nice_config) CLI Example: .. code-block:: bash salt '*'...
Tell if a given package or DEPEND atom is present in the configuration files tree. Warning: This only works if the configuration files tree is in the correct format (the one enforced by enforce_nice_config) CLI Example: .. code-block:: bash salt '*' portage_config.is_present unmask salt
Below is the the instruction that describes the task: ### Input: Tell if a given package or DEPEND atom is present in the configuration files tree. Warning: This only works if the configuration files tree is in the correct format (the one enforced by enforce_nice_config) CLI Example: .. code-b...
def _split_comment(lineno, comment): """Return the multiline comment at lineno split into a list of comment line numbers and the accompanying comment line""" return [(lineno + index, line) for index, line in enumerate(comment.splitlines())]
Return the multiline comment at lineno split into a list of comment line numbers and the accompanying comment line
Below is the the instruction that describes the task: ### Input: Return the multiline comment at lineno split into a list of comment line numbers and the accompanying comment line ### Response: def _split_comment(lineno, comment): """Return the multiline comment at lineno split into a list of ...
def get_colorscheme(self, scheme_file): """Return a string object with the colorscheme that is to be inserted.""" scheme = get_yaml_dict(scheme_file) scheme_slug = builder.slugify(scheme_file) builder.format_scheme(scheme, scheme_slug) try: temp_base, temp_su...
Return a string object with the colorscheme that is to be inserted.
Below is the the instruction that describes the task: ### Input: Return a string object with the colorscheme that is to be inserted. ### Response: def get_colorscheme(self, scheme_file): """Return a string object with the colorscheme that is to be inserted.""" scheme = get_yaml_dict...
def in_network(scope, prefixes, destination, default_pfxlen=[24]): """ Returns True if the given destination is in the network range that is defined by the given prefix (e.g. 10.0.0.1/22). If the given prefix does not have a prefix length specified, the given default prefix length is applied. If no ...
Returns True if the given destination is in the network range that is defined by the given prefix (e.g. 10.0.0.1/22). If the given prefix does not have a prefix length specified, the given default prefix length is applied. If no such prefix length is given, the default length is /24. If a list of p...
Below is the the instruction that describes the task: ### Input: Returns True if the given destination is in the network range that is defined by the given prefix (e.g. 10.0.0.1/22). If the given prefix does not have a prefix length specified, the given default prefix length is applied. If no such prefi...
def post_dissection(self, m): """ First we update the client DHParams. Then, we try to update the server DHParams generated during Server*DHParams building, with the shared secret. Finally, we derive the session keys and update the context. """ s = self.tls_session ...
First we update the client DHParams. Then, we try to update the server DHParams generated during Server*DHParams building, with the shared secret. Finally, we derive the session keys and update the context.
Below is the the instruction that describes the task: ### Input: First we update the client DHParams. Then, we try to update the server DHParams generated during Server*DHParams building, with the shared secret. Finally, we derive the session keys and update the context. ### Response: def post_diss...
def I(self): r"""Returns the set of intermediate states """ return list(set(range(self.nstates)) - set(self._A) - set(self._B))
r"""Returns the set of intermediate states
Below is the the instruction that describes the task: ### Input: r"""Returns the set of intermediate states ### Response: def I(self): r"""Returns the set of intermediate states """ return list(set(range(self.nstates)) - set(self._A) - set(self._B))
def time_to_hhmmssmmm(time_value, decimal_separator="."): """ Format the given time value into a ``HH:MM:SS.mmm`` string. Examples: :: 12 => 00:00:12.000 12.345 => 00:00:12.345 12.345432 => 00:00:12.345 12.345678 => 00:00:12.346 83 => 00:01:23.000 ...
Format the given time value into a ``HH:MM:SS.mmm`` string. Examples: :: 12 => 00:00:12.000 12.345 => 00:00:12.345 12.345432 => 00:00:12.345 12.345678 => 00:00:12.346 83 => 00:01:23.000 83.456 => 00:01:23.456 83.456789 => 00:01:23.456 ...
Below is the the instruction that describes the task: ### Input: Format the given time value into a ``HH:MM:SS.mmm`` string. Examples: :: 12 => 00:00:12.000 12.345 => 00:00:12.345 12.345432 => 00:00:12.345 12.345678 => 00:00:12.346 83 => 00:01:23.000 ...
def main(demo=False, aschild=False, targets=[]): """Start the Qt-runtime and show the window Arguments: aschild (bool, optional): Run as child of parent process """ if aschild: print("Starting pyblish-qml") compat.main() app = Application(APP_PATH, targets) app...
Start the Qt-runtime and show the window Arguments: aschild (bool, optional): Run as child of parent process
Below is the the instruction that describes the task: ### Input: Start the Qt-runtime and show the window Arguments: aschild (bool, optional): Run as child of parent process ### Response: def main(demo=False, aschild=False, targets=[]): """Start the Qt-runtime and show the window Arguments: ...
def list_servers(self, datacenter_id, depth=1): """ Retrieves a list of all servers bound to the specified data center. :param datacenter_id: The unique ID of the data center. :type datacenter_id: ``str`` :param depth: The depth of the response data. :ty...
Retrieves a list of all servers bound to the specified data center. :param datacenter_id: The unique ID of the data center. :type datacenter_id: ``str`` :param depth: The depth of the response data. :type depth: ``int``
Below is the the instruction that describes the task: ### Input: Retrieves a list of all servers bound to the specified data center. :param datacenter_id: The unique ID of the data center. :type datacenter_id: ``str`` :param depth: The depth of the response data. :t...
def conv_ast_to_sym(self, math_ast): """ Convert mathematical expressions to a sympy representation. May only contain paranthesis, addition, subtraction and multiplication from AST. """ if type(math_ast) is c_ast.ID: return symbol_pos_int(math_ast.name) elif ...
Convert mathematical expressions to a sympy representation. May only contain paranthesis, addition, subtraction and multiplication from AST.
Below is the the instruction that describes the task: ### Input: Convert mathematical expressions to a sympy representation. May only contain paranthesis, addition, subtraction and multiplication from AST. ### Response: def conv_ast_to_sym(self, math_ast): """ Convert mathematical expressi...
def createSpatialAnchorFromDescriptor(self, pchDescriptor): """ Returns a handle for an spatial anchor described by "descriptor". On success, pHandle will contain a handle valid for this session. Caller can wait for an event or occasionally poll GetSpatialAnchorPose() to find the virtu...
Returns a handle for an spatial anchor described by "descriptor". On success, pHandle will contain a handle valid for this session. Caller can wait for an event or occasionally poll GetSpatialAnchorPose() to find the virtual coordinate associated with this anchor.
Below is the the instruction that describes the task: ### Input: Returns a handle for an spatial anchor described by "descriptor". On success, pHandle will contain a handle valid for this session. Caller can wait for an event or occasionally poll GetSpatialAnchorPose() to find the virtual coordina...
def setStyles(self, styleUpdatesDict): ''' setStyles - Sets one or more style params. This all happens in one shot, so it is much much faster than calling setStyle for every value. To remove a style, set its value to empty string. When all styles are...
setStyles - Sets one or more style params. This all happens in one shot, so it is much much faster than calling setStyle for every value. To remove a style, set its value to empty string. When all styles are removed, the "style" attribute will be nullified. ...
Below is the the instruction that describes the task: ### Input: setStyles - Sets one or more style params. This all happens in one shot, so it is much much faster than calling setStyle for every value. To remove a style, set its value to empty string. When all styl...
def HardwareInput(uMsg: int, param: int = 0) -> INPUT: """Create Win32 struct `HARDWAREINPUT` for `SendInput`.""" return _CreateInput(HARDWAREINPUT(uMsg, param & 0xFFFF, param >> 16 & 0xFFFF))
Create Win32 struct `HARDWAREINPUT` for `SendInput`.
Below is the the instruction that describes the task: ### Input: Create Win32 struct `HARDWAREINPUT` for `SendInput`. ### Response: def HardwareInput(uMsg: int, param: int = 0) -> INPUT: """Create Win32 struct `HARDWAREINPUT` for `SendInput`.""" return _CreateInput(HARDWAREINPUT(uMsg, param & 0xFFFF, param...
def dlafns(handle, descr): """ Find the segment following a specified segment in a DLA file. https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dlafns_c.html :param handle: Handle of open DLA file. :type handle: c_int :param descr: Descriptor of a DLA segment. :type descr: s...
Find the segment following a specified segment in a DLA file. https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dlafns_c.html :param handle: Handle of open DLA file. :type handle: c_int :param descr: Descriptor of a DLA segment. :type descr: spiceypy.utils.support_types.SpiceDLADes...
Below is the the instruction that describes the task: ### Input: Find the segment following a specified segment in a DLA file. https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dlafns_c.html :param handle: Handle of open DLA file. :type handle: c_int :param descr: Descriptor of a D...
def _get_modules_map(self, path=None): ''' Get installed Ansible modules :return: ''' paths = {} root = ansible.modules.__path__[0] if not path: path = root for p_el in os.listdir(path): p_el_path = os.path.join(path, p_el) ...
Get installed Ansible modules :return:
Below is the the instruction that describes the task: ### Input: Get installed Ansible modules :return: ### Response: def _get_modules_map(self, path=None): ''' Get installed Ansible modules :return: ''' paths = {} root = ansible.modules.__path__[0] i...
def authorized_connect_apps(self): """ Access the authorized_connect_apps :returns: twilio.rest.api.v2010.account.authorized_connect_app.AuthorizedConnectAppList :rtype: twilio.rest.api.v2010.account.authorized_connect_app.AuthorizedConnectAppList """ if self._authorized...
Access the authorized_connect_apps :returns: twilio.rest.api.v2010.account.authorized_connect_app.AuthorizedConnectAppList :rtype: twilio.rest.api.v2010.account.authorized_connect_app.AuthorizedConnectAppList
Below is the the instruction that describes the task: ### Input: Access the authorized_connect_apps :returns: twilio.rest.api.v2010.account.authorized_connect_app.AuthorizedConnectAppList :rtype: twilio.rest.api.v2010.account.authorized_connect_app.AuthorizedConnectAppList ### Response: def author...
def get_time_slice(time, z, zdot=None, timeStart=None, timeEnd=None): """ Get slice of time, z and (if provided) zdot from timeStart to timeEnd. Parameters ---------- time : ndarray array of time values z : ndarray array of z values zdot : ndarray, optional array of...
Get slice of time, z and (if provided) zdot from timeStart to timeEnd. Parameters ---------- time : ndarray array of time values z : ndarray array of z values zdot : ndarray, optional array of zdot (velocity) values. timeStart : float, optional time at which to ...
Below is the the instruction that describes the task: ### Input: Get slice of time, z and (if provided) zdot from timeStart to timeEnd. Parameters ---------- time : ndarray array of time values z : ndarray array of z values zdot : ndarray, optional array of zdot (veloci...
def parse_seq(tokens, options): """seq ::= ( atom [ '...' ] )* ;""" result = [] while tokens.current() not in [None, ']', ')', '|']: atom = parse_atom(tokens, options) if tokens.current() == '...': atom = [OneOrMore(*atom)] tokens.move() result += atom ret...
seq ::= ( atom [ '...' ] )* ;
Below is the the instruction that describes the task: ### Input: seq ::= ( atom [ '...' ] )* ; ### Response: def parse_seq(tokens, options): """seq ::= ( atom [ '...' ] )* ;""" result = [] while tokens.current() not in [None, ']', ')', '|']: atom = parse_atom(tokens, options) if tokens....
def load_raw_arrays(self, columns, start_date, end_date, assets): """ Parameters ---------- fields : list of str 'open', 'high', 'low', 'close', or 'volume' start_dt: Timestamp Beginning of the window range. end_dt: Timestamp End of the wi...
Parameters ---------- fields : list of str 'open', 'high', 'low', 'close', or 'volume' start_dt: Timestamp Beginning of the window range. end_dt: Timestamp End of the window range. sids : list of int The asset identifiers in the window....
Below is the the instruction that describes the task: ### Input: Parameters ---------- fields : list of str 'open', 'high', 'low', 'close', or 'volume' start_dt: Timestamp Beginning of the window range. end_dt: Timestamp End of the window range. ...
def process_metric(self, message, **kwargs): """ Handle a prometheus metric message according to the following flow: - search self.metrics_mapper for a prometheus.metric <--> datadog.metric mapping - call check method with the same name as the metric - log some info i...
Handle a prometheus metric message according to the following flow: - search self.metrics_mapper for a prometheus.metric <--> datadog.metric mapping - call check method with the same name as the metric - log some info if none of the above worked `send_histograms_buckets` is ...
Below is the the instruction that describes the task: ### Input: Handle a prometheus metric message according to the following flow: - search self.metrics_mapper for a prometheus.metric <--> datadog.metric mapping - call check method with the same name as the metric - log some in...
def toggle(self, *args): """ If no arguments are specified, toggle the state of all LEDs. If arguments are specified, they must be the indexes of the LEDs you wish to toggle. For example:: from gpiozero import LEDBoard leds = LEDBoard(2, 3, 4, 5) led...
If no arguments are specified, toggle the state of all LEDs. If arguments are specified, they must be the indexes of the LEDs you wish to toggle. For example:: from gpiozero import LEDBoard leds = LEDBoard(2, 3, 4, 5) leds.toggle(0) # turn on the first LED (pin 2)...
Below is the the instruction that describes the task: ### Input: If no arguments are specified, toggle the state of all LEDs. If arguments are specified, they must be the indexes of the LEDs you wish to toggle. For example:: from gpiozero import LEDBoard leds = LEDBoard(2, ...
def get_volume_by_name(self, name): """ Get ScaleIO Volume object by its Name :param name: Name of volume :return: ScaleIO Volume object :raise KeyError: No Volume with specified name found :rtype: ScaleIO Volume object """ for vol in self.conn.volumes: ...
Get ScaleIO Volume object by its Name :param name: Name of volume :return: ScaleIO Volume object :raise KeyError: No Volume with specified name found :rtype: ScaleIO Volume object
Below is the the instruction that describes the task: ### Input: Get ScaleIO Volume object by its Name :param name: Name of volume :return: ScaleIO Volume object :raise KeyError: No Volume with specified name found :rtype: ScaleIO Volume object ### Response: def get_volume_by_name(s...
def get_item(identifier, config=None, config_file=None, archive_session=None, debug=None, http_adapter_kwargs=None, request_kwargs=None): """Get an :class:`Item` object. :type identifier: str :param identifier: The globally uniqu...
Get an :class:`Item` object. :type identifier: str :param identifier: The globally unique Archive.org item identifier. :type config: dict :param config: (optional) A dictionary used to configure your session. :type config_file: str :param config_file: (optional) A path to a config file used t...
Below is the the instruction that describes the task: ### Input: Get an :class:`Item` object. :type identifier: str :param identifier: The globally unique Archive.org item identifier. :type config: dict :param config: (optional) A dictionary used to configure your session. :type config_file: ...
def _parse(self, str): """ Parses the text data from an XML element defined by tag. """ str = replace_entities(str) str = strip_tags(str) str = collapse_spaces(str) return str
Parses the text data from an XML element defined by tag.
Below is the the instruction that describes the task: ### Input: Parses the text data from an XML element defined by tag. ### Response: def _parse(self, str): """ Parses the text data from an XML element defined by tag. """ str = replace_entities(str) str = strip_t...
def build_instruction_coverage_plugin() -> LaserPlugin: """ Creates an instance of the instruction coverage plugin""" from mythril.laser.ethereum.plugins.implementations.coverage import ( InstructionCoveragePlugin, ) return InstructionCoveragePlugin()
Creates an instance of the instruction coverage plugin
Below is the the instruction that describes the task: ### Input: Creates an instance of the instruction coverage plugin ### Response: def build_instruction_coverage_plugin() -> LaserPlugin: """ Creates an instance of the instruction coverage plugin""" from mythril.laser.ethereum.plugins.implementat...
def import_entries(self, items): """ Loops over items and find entry to import, an entry need to have 'post_type' set to 'post' and have content. """ self.write_out(self.style.STEP('- Importing entries\n')) for item_node in items: title = (item_node.f...
Loops over items and find entry to import, an entry need to have 'post_type' set to 'post' and have content.
Below is the the instruction that describes the task: ### Input: Loops over items and find entry to import, an entry need to have 'post_type' set to 'post' and have content. ### Response: def import_entries(self, items): """ Loops over items and find entry to import, an entr...
def mobile_sign(self, id_code, country, phone_nr, language=None, signing_profile='LT_TM'): """ This can be used to add a signature to existing data files WARNING: Must have at least one datafile in the session """ if not (self.container and isinstance(self.container, PreviouslyCrea...
This can be used to add a signature to existing data files WARNING: Must have at least one datafile in the session
Below is the the instruction that describes the task: ### Input: This can be used to add a signature to existing data files WARNING: Must have at least one datafile in the session ### Response: def mobile_sign(self, id_code, country, phone_nr, language=None, signing_profile='LT_TM'): """ This ...
def __display_header(self, stat_display): """Display the firsts lines (header) in the Curses interface. system + ip + uptime (cloud) """ # First line self.new_line() self.space_between_column = 0 l_uptime = (self.get_stats_display_width(stat_display["syst...
Display the firsts lines (header) in the Curses interface. system + ip + uptime (cloud)
Below is the the instruction that describes the task: ### Input: Display the firsts lines (header) in the Curses interface. system + ip + uptime (cloud) ### Response: def __display_header(self, stat_display): """Display the firsts lines (header) in the Curses interface. system + i...
def _step4func(self, samples, force, ipyclient): """ hidden wrapped function to start step 4 """ if self._headers: print("\n Step 4: Joint estimation of error rate and heterozygosity") ## Get sample objects from list of strings samples = _get_samples(self, samples) ...
hidden wrapped function to start step 4
Below is the the instruction that describes the task: ### Input: hidden wrapped function to start step 4 ### Response: def _step4func(self, samples, force, ipyclient): """ hidden wrapped function to start step 4 """ if self._headers: print("\n Step 4: Joint estimation of error rate an...
def _ppf(self, q, left, right, cache): """ Point percentile function. Example: >>> print(chaospy.Uniform().inv([0.1, 0.2, 0.9])) [0.1 0.2 0.9] >>> print(chaospy.Pow(chaospy.Uniform(), 2).inv([0.1, 0.2, 0.9])) [0.01 0.04 0.81] >>> print...
Point percentile function. Example: >>> print(chaospy.Uniform().inv([0.1, 0.2, 0.9])) [0.1 0.2 0.9] >>> print(chaospy.Pow(chaospy.Uniform(), 2).inv([0.1, 0.2, 0.9])) [0.01 0.04 0.81] >>> print(chaospy.Pow(chaospy.Uniform(1, 2), -1).inv([0.1, 0.2, 0.9]...
Below is the the instruction that describes the task: ### Input: Point percentile function. Example: >>> print(chaospy.Uniform().inv([0.1, 0.2, 0.9])) [0.1 0.2 0.9] >>> print(chaospy.Pow(chaospy.Uniform(), 2).inv([0.1, 0.2, 0.9])) [0.01 0.04 0.81] ...
def decode(self, data): """ Decode an armoured string into a chunk. The decoded output is null-terminated, so it may be treated as a string, if that's what it was prior to encoding. """ return Zchunk(lib.zarmour_decode(self._as_parameter_, data), True)
Decode an armoured string into a chunk. The decoded output is null-terminated, so it may be treated as a string, if that's what it was prior to encoding.
Below is the the instruction that describes the task: ### Input: Decode an armoured string into a chunk. The decoded output is null-terminated, so it may be treated as a string, if that's what it was prior to encoding. ### Response: def decode(self, data): """ Decode an armoured string into a chunk...
def inject_basic_program(self, ascii_listing): """ save the given ASCII BASIC program listing into the emulator RAM. """ program_start = self.cpu.memory.read_word( self.machine_api.PROGRAM_START_ADDR ) tokens = self.machine_api.ascii_listing2program_dump(ascii...
save the given ASCII BASIC program listing into the emulator RAM.
Below is the the instruction that describes the task: ### Input: save the given ASCII BASIC program listing into the emulator RAM. ### Response: def inject_basic_program(self, ascii_listing): """ save the given ASCII BASIC program listing into the emulator RAM. """ program_start = s...
def createmergerequest(self, project_id, sourcebranch, targetbranch, title, target_project_id=None, assignee_id=None): """ Create a new merge request. :param project_id: ID of the project originating the merge request :param sourcebranch: name of the branch to...
Create a new merge request. :param project_id: ID of the project originating the merge request :param sourcebranch: name of the branch to merge from :param targetbranch: name of the branch to merge to :param title: Title of the merge request :param assignee_id: Assignee user ID ...
Below is the the instruction that describes the task: ### Input: Create a new merge request. :param project_id: ID of the project originating the merge request :param sourcebranch: name of the branch to merge from :param targetbranch: name of the branch to merge to :param title: Tit...
def pre_save(cls, sender, instance, *args, **kwargs): """Pull constant_contact_id out of data. """ instance.constant_contact_id = str(instance.data['id'])
Pull constant_contact_id out of data.
Below is the the instruction that describes the task: ### Input: Pull constant_contact_id out of data. ### Response: def pre_save(cls, sender, instance, *args, **kwargs): """Pull constant_contact_id out of data. """ instance.constant_contact_id = str(instance.data['id'])
def func_frame(function_index, function_name=None): """ This will return the class_name and function_name of the function traced back two functions. :param function_index: int of how many frames back the program should look (2 will give the parent of the caller) :param f...
This will return the class_name and function_name of the function traced back two functions. :param function_index: int of how many frames back the program should look (2 will give the parent of the caller) :param function_name: str of what function to look for (should ...
Below is the the instruction that describes the task: ### Input: This will return the class_name and function_name of the function traced back two functions. :param function_index: int of how many frames back the program should look (2 will give the parent of the caller) :pa...
def _add_indent(self, val, indent_count): ''' add whitespace to the beginning of each line of val link -- http://code.activestate.com/recipes/66055-changing-the-indentation-of-a-multi-line-string/ val -- string indent -- integer -- how much whitespace we want in front of each l...
add whitespace to the beginning of each line of val link -- http://code.activestate.com/recipes/66055-changing-the-indentation-of-a-multi-line-string/ val -- string indent -- integer -- how much whitespace we want in front of each line of val return -- string -- val with more whitespa...
Below is the the instruction that describes the task: ### Input: add whitespace to the beginning of each line of val link -- http://code.activestate.com/recipes/66055-changing-the-indentation-of-a-multi-line-string/ val -- string indent -- integer -- how much whitespace we want in front of...
async def _notify_event_internal(self, conn_string, name, event): """Notify that an event has occured. This method will send a notification and ensure that all callbacks registered for it have completed by the time it returns. In particular, if the callbacks are awaitable, this method ...
Notify that an event has occured. This method will send a notification and ensure that all callbacks registered for it have completed by the time it returns. In particular, if the callbacks are awaitable, this method will await them before returning. The order in which the callbacks a...
Below is the the instruction that describes the task: ### Input: Notify that an event has occured. This method will send a notification and ensure that all callbacks registered for it have completed by the time it returns. In particular, if the callbacks are awaitable, this method will awa...
def parse_pdb(self): """Extracts additional information from PDB files. I. When reading in a PDB file, OpenBabel numbers ATOMS and HETATOMS continously. In PDB files, TER records are also counted, leading to a different numbering system. This functions reads in a PDB file and provides a ...
Extracts additional information from PDB files. I. When reading in a PDB file, OpenBabel numbers ATOMS and HETATOMS continously. In PDB files, TER records are also counted, leading to a different numbering system. This functions reads in a PDB file and provides a mapping as a dictionary. ...
Below is the the instruction that describes the task: ### Input: Extracts additional information from PDB files. I. When reading in a PDB file, OpenBabel numbers ATOMS and HETATOMS continously. In PDB files, TER records are also counted, leading to a different numbering system. This function...
def set_data(self, data_np, metadata=None, order=None, astype=None): """Use this method to SHARE (not copy) the incoming array. """ if astype: data = data_np.astype(astype, copy=False) else: data = data_np self._data = data self._calc_order(order)...
Use this method to SHARE (not copy) the incoming array.
Below is the the instruction that describes the task: ### Input: Use this method to SHARE (not copy) the incoming array. ### Response: def set_data(self, data_np, metadata=None, order=None, astype=None): """Use this method to SHARE (not copy) the incoming array. """ if astype: d...
def sfs(dac, n=None): """Compute the site frequency spectrum given derived allele counts at a set of biallelic variants. Parameters ---------- dac : array_like, int, shape (n_variants,) Array of derived allele counts. n : int, optional The total number of chromosomes called. ...
Compute the site frequency spectrum given derived allele counts at a set of biallelic variants. Parameters ---------- dac : array_like, int, shape (n_variants,) Array of derived allele counts. n : int, optional The total number of chromosomes called. Returns ------- sfs...
Below is the the instruction that describes the task: ### Input: Compute the site frequency spectrum given derived allele counts at a set of biallelic variants. Parameters ---------- dac : array_like, int, shape (n_variants,) Array of derived allele counts. n : int, optional The...
def load_metadata_from_desc_file(self, desc_file, partition='train', max_duration=16.0,): """ Read metadata from the description file (possibly takes long, depending on the filesize) Params: desc_file (str): Path to a JSON-line file that cont...
Read metadata from the description file (possibly takes long, depending on the filesize) Params: desc_file (str): Path to a JSON-line file that contains labels and paths to the audio files partition (str): One of 'train', 'validation' or 'test' ma...
Below is the the instruction that describes the task: ### Input: Read metadata from the description file (possibly takes long, depending on the filesize) Params: desc_file (str): Path to a JSON-line file that contains labels and paths to the audio files p...
def translate(self, body, params=None): """ `<Translate SQL into Elasticsearch queries>`_ :arg body: Specify the query in the `query` element. """ if body in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'body'.") return self.tran...
`<Translate SQL into Elasticsearch queries>`_ :arg body: Specify the query in the `query` element.
Below is the the instruction that describes the task: ### Input: `<Translate SQL into Elasticsearch queries>`_ :arg body: Specify the query in the `query` element. ### Response: def translate(self, body, params=None): """ `<Translate SQL into Elasticsearch queries>`_ :arg body: Sp...
def copy(self): """ Prepare and paste self templates. """ templates = self.prepare_templates() if self.params.interactive: keys = list(self.parser.default) for key in keys: if key.startswith('_'): continue prompt = "{0} ...
Prepare and paste self templates.
Below is the the instruction that describes the task: ### Input: Prepare and paste self templates. ### Response: def copy(self): """ Prepare and paste self templates. """ templates = self.prepare_templates() if self.params.interactive: keys = list(self.parser.default) ...
def server_call(method, server, timeout=DEFAULT_TIMEOUT, verify_ssl=True, **parameters): """Makes a call to an un-authenticated method on a server :param method: The method name. :type method: str :param server: The MyGeotab server. :type server: str :param timeout: The timeout to make the call...
Makes a call to an un-authenticated method on a server :param method: The method name. :type method: str :param server: The MyGeotab server. :type server: str :param timeout: The timeout to make the call, in seconds. By default, this is 300 seconds (or 5 minutes). :type timeout: float :para...
Below is the the instruction that describes the task: ### Input: Makes a call to an un-authenticated method on a server :param method: The method name. :type method: str :param server: The MyGeotab server. :type server: str :param timeout: The timeout to make the call, in seconds. By default, t...