src
stringlengths
75
47.4k
cfg
stringlengths
32
2.5k
ast
stringlengths
78
54.9k
def _replace_scalar(self, scalar): """ Replace scalar name with scalar value """ if not is_arg_scalar(scalar): return scalar name = scalar[1:] return self.get_scalar_value(name)
[2][SEP1][If][Return][Return][SEP2][1,2][][][SEP3][1][0][1]
MODULE_FUNCTIONDEF_ARGUMENTS_ARG_ARG_EXPR_CONSTANT_IF_UNARYOP_NOT_CALL_NAME_LOAD_NAME_LOAD_RETURN_NAME_LOAD_ASSIGN_NAME_STORE_SUBSCRIPT_NAME_LOAD_SLICE_CONSTANT_LOAD_RETURN_CALL_ATTRIBUTE_NAME_LOAD_LOAD_NAME_LOAD
def __get_hosts(self, pattern): """ finds hosts that postively match a particular pattern. Does not take into account negative matches. """ (name, enumeration_details) = self._enumeration_info(pattern) hpat = self._hosts_in_unenumerated_pattern(name) hpat = sor...
[2][SEP1][Return][SEP2][][SEP3][5]
MODULE_FUNCTIONDEF_ARGUMENTS_ARG_ARG_EXPR_CONSTANT_ASSIGN_TUPLE_NAME_STORE_NAME_STORE_STORE_CALL_ATTRIBUTE_NAME_LOAD_LOAD_NAME_LOAD_ASSIGN_NAME_STORE_CALL_ATTRIBUTE_NAME_LOAD_LOAD_NAME_LOAD_ASSIGN_NAME_STORE_CALL_NAME_LOAD_NAME_LOAD_KEYWORD_LAMBDA_ARGUMENTS_ARG_ATTRIBUTE_NAME_LOAD_LOAD_RETURN_CALL_NAME_LOAD_CALL_ATTRIB...
def get_submodule_list(package_path: str) -> Tuple[ModuleDescription, ...]: """Get list of submodules for some package by its path. E.g ``pkg.subpackage``""" pkg = importlib.import_module(package_path) subs = ( ModuleDescription( name=modname, path="{}.{}".format(package_pat...
[1][SEP1][Return][SEP2][][SEP3][5]
MODULE_FUNCTIONDEF_ARGUMENTS_ARG_NAME_LOAD_EXPR_CONSTANT_ASSIGN_NAME_STORE_CALL_ATTRIBUTE_NAME_LOAD_LOAD_NAME_LOAD_ASSIGN_NAME_STORE_GENERATOREXP_CALL_NAME_LOAD_KEYWORD_NAME_LOAD_KEYWORD_CALL_ATTRIBUTE_CONSTANT_LOAD_NAME_LOAD_NAME_LOAD_KEYWORD_NAME_LOAD_COMPREHENSION_TUPLE_NAME_STORE_NAME_STORE_NAME_STORE_STORE_CALL_AT...
def _check_field_changed(instance, old_instance, field_name, update_fields=None): """ Examines update_fields and an attribute of an instance to determine if that attribute has changed prior to the instance being saved. Parameters ---------- field_name : str instance : object old_instanc...
[4][SEP1][If][Return][Return][SEP2][1,2][][][SEP3][0][0][2]
MODULE_FUNCTIONDEF_ARGUMENTS_ARG_ARG_ARG_ARG_CONSTANT_EXPR_CONSTANT_IF_BOOLOP_AND_COMPARE_NAME_LOAD_ISNOT_CONSTANT_COMPARE_NAME_LOAD_NOTIN_NAME_LOAD_RETURN_CONSTANT_RETURN_COMPARE_CALL_NAME_LOAD_NAME_LOAD_NAME_LOAD_NOTEQ_CALL_NAME_LOAD_NAME_LOAD_NAME_LOAD
def get_internal_data(self): """ Get data that is saved in pickle/hickle """ if self.filetype is "pickle": return pickle.load(open(self.location_internal, "rb")) elif self.filetype is "hickle": import hickle return hickle.load(open(self.locatio...
[1][SEP1][If][Return][If][Return][None][SEP2][1,2][][3,4][][][SEP3][0][2][0][2][2]
MODULE_FUNCTIONDEF_ARGUMENTS_ARG_EXPR_CONSTANT_IF_COMPARE_ATTRIBUTE_NAME_LOAD_LOAD_IS_CONSTANT_RETURN_CALL_ATTRIBUTE_NAME_LOAD_LOAD_CALL_NAME_LOAD_ATTRIBUTE_NAME_LOAD_LOAD_CONSTANT_IF_COMPARE_ATTRIBUTE_NAME_LOAD_LOAD_IS_CONSTANT_IMPORT_ALIAS_RETURN_CALL_ATTRIBUTE_NAME_LOAD_LOAD_CALL_NAME_LOAD_ATTRIBUTE_NAME_LOAD_LOAD_C...
def current_reading(self) -> Optional[Union[int, float]]: """Current reading for a special sensor.""" return self._get_field_value(SpecialDevice.PROP_CURRENT_READING)
[1][SEP1][Return][SEP2][][SEP3][1]
MODULE_FUNCTIONDEF_ARGUMENTS_ARG_EXPR_CONSTANT_RETURN_CALL_ATTRIBUTE_NAME_LOAD_LOAD_ATTRIBUTE_NAME_LOAD_LOAD_SUBSCRIPT_NAME_LOAD_SUBSCRIPT_NAME_LOAD_TUPLE_NAME_LOAD_NAME_LOAD_LOAD_LOAD_LOAD
def representCleanOpenAPIOperation(dumper, data): """ Unpack nonstandard attributes while representing an OpenAPIOperation """ dct = _orderedCleanDict(data) if '_extended' in dct: for k, ext in list(data._extended.items()): dct[k] = ext del dct['_extended'] return du...
[2][SEP1][If][For][Return][None][None][SEP2][1,2][3,4][][1][2][SEP3][1][2][1][0][0]
MODULE_FUNCTIONDEF_ARGUMENTS_ARG_ARG_EXPR_CONSTANT_ASSIGN_NAME_STORE_CALL_NAME_LOAD_NAME_LOAD_IF_COMPARE_CONSTANT_IN_NAME_LOAD_FOR_TUPLE_NAME_STORE_NAME_STORE_STORE_CALL_NAME_LOAD_CALL_ATTRIBUTE_ATTRIBUTE_NAME_LOAD_LOAD_LOAD_ASSIGN_SUBSCRIPT_NAME_LOAD_NAME_LOAD_STORE_NAME_LOAD_DELETE_SUBSCRIPT_NAME_LOAD_CONSTANT_DEL_RE...
def getparams(self, result): """Get result parameters. :param result: cached result. :raises: ValueError if result is not cached. :return: args and kwargs registered with input result. :rtype: tuple""" for key in self._cache: if self._cache[key][2] == result...
[2][SEP1][None][For][If][Return][SEP2][1][2][3,1][][SEP3][0][1][0][0]
MODULE_FUNCTIONDEF_ARGUMENTS_ARG_ARG_EXPR_CONSTANT_FOR_NAME_STORE_ATTRIBUTE_NAME_LOAD_LOAD_IF_COMPARE_SUBSCRIPT_SUBSCRIPT_ATTRIBUTE_NAME_LOAD_LOAD_NAME_LOAD_LOAD_CONSTANT_LOAD_EQ_NAME_LOAD_ASSIGN_TUPLE_NAME_STORE_NAME_STORE_NAME_STORE_STORE_SUBSCRIPT_ATTRIBUTE_NAME_LOAD_LOAD_NAME_LOAD_LOAD_RETURN_TUPLE_NAME_LOAD_NAME_L...
def convert_youtube_url(youtube_url, no_controls, autoplay): """Use this function to convert the youtube URL. This function is used for converting the youtube URL so that it can be used correctly with Helium. It means that Helium will know the next video in the playlist. :param youtube_url: the UR...
[3][SEP1][None][For][If][Return][None][SEP2][1][2,3][4,1][][3][SEP3][0][1][0][2][1]
MODULE_FUNCTIONDEF_ARGUMENTS_ARG_ARG_ARG_EXPR_CONSTANT_FOR_NAME_STORE_CALL_ATTRIBUTE_NAME_LOAD_LOAD_CONSTANT_IF_COMPARE_CONSTANT_IN_NAME_LOAD_ASSIGN_NAME_STORE_SUBSCRIPT_CALL_ATTRIBUTE_NAME_LOAD_LOAD_CONSTANT_CONSTANT_LOAD_BREAK_RETURN_CALL_ATTRIBUTE_CONSTANT_LOAD_IFEXP_NAME_LOAD_CONSTANT_CONSTANT_IFEXP_NAME_LOAD_CONST...
def data(self): """Return parsed data structure.""" if self._data is None: # reset after possible parsing failure self.__init__(self.tokens) return self._parse() else: return self._data
[1][SEP1][If][Return][Return][SEP2][1,2][][][SEP3][0][2][0]
MODULE_FUNCTIONDEF_ARGUMENTS_ARG_EXPR_CONSTANT_IF_COMPARE_ATTRIBUTE_NAME_LOAD_LOAD_IS_CONSTANT_EXPR_CALL_ATTRIBUTE_NAME_LOAD_LOAD_ATTRIBUTE_NAME_LOAD_LOAD_RETURN_CALL_ATTRIBUTE_NAME_LOAD_LOAD_RETURN_ATTRIBUTE_NAME_LOAD_LOAD
def md_to_pdf(input_name, output_name): """ Converts an input MarkDown file to a PDF of the given output name. Parameters ========== input_name : String Relative file location of the input file to where this function is being called. output_name : String Relative file location of the o...
[2][SEP1][If][None][None][SEP2][1,2][][][SEP3][0][1][1]
MODULE_FUNCTIONDEF_ARGUMENTS_ARG_ARG_EXPR_CONSTANT_IF_COMPARE_SUBSCRIPT_NAME_LOAD_SLICE_UNARYOP_USUB_CONSTANT_LOAD_EQ_CONSTANT_EXPR_CALL_ATTRIBUTE_NAME_LOAD_LOAD_BINOP_BINOP_BINOP_CONSTANT_ADD_NAME_LOAD_ADD_CONSTANT_ADD_NAME_LOAD_EXPR_CALL_ATTRIBUTE_NAME_LOAD_LOAD_BINOP_BINOP_BINOP_BINOP_CONSTANT_ADD_NAME_LOAD_ADD_CONS...
def center_middle(r, window_size): """ Center a region on its middle and expand it to window_size bases. :return: the new region. """ res = copy.copy(r) mid = res.start + (len(res) / 2) res.start = mid - (window_size / 2) res.end = res.start + window_size return res
[2][SEP1][Return][SEP2][][SEP3][2]
MODULE_FUNCTIONDEF_ARGUMENTS_ARG_ARG_EXPR_CONSTANT_ASSIGN_NAME_STORE_CALL_ATTRIBUTE_NAME_LOAD_LOAD_NAME_LOAD_ASSIGN_NAME_STORE_BINOP_ATTRIBUTE_NAME_LOAD_LOAD_ADD_BINOP_CALL_NAME_LOAD_NAME_LOAD_DIV_CONSTANT_ASSIGN_ATTRIBUTE_NAME_LOAD_STORE_BINOP_NAME_LOAD_SUB_BINOP_NAME_LOAD_DIV_CONSTANT_ASSIGN_ATTRIBUTE_NAME_LOAD_STORE...
def gen_tasks(self, urls): """ according the urls gen {name:'', url:''} dict. :param urls: :type urls: :return: :rtype: """ tasks = [] if isinstance(urls, list): for url in urls: dat = { 'url': url, ...
[2][SEP1][If][For][If][If][Return][For][None][None][None][If][None][None][SEP2][1,2][3,4][5,6][7,8][][9,4][][1][1][10,11][5][5][SEP3][1][0][1][2][0][1][1][0][1][1][0][1]
MODULE_FUNCTIONDEF_ARGUMENTS_ARG_ARG_EXPR_CONSTANT_ASSIGN_NAME_STORE_LIST_LOAD_IF_CALL_NAME_LOAD_NAME_LOAD_NAME_LOAD_FOR_NAME_STORE_NAME_LOAD_ASSIGN_NAME_STORE_DICT_CONSTANT_CONSTANT_NAME_LOAD_SUBSCRIPT_CALL_ATTRIBUTE_NAME_LOAD_LOAD_CONSTANT_UNARYOP_USUB_CONSTANT_LOAD_IF_BOOLOP_AND_UNARYOP_NOT_ATTRIBUTE_NAME_LOAD_LOAD_...
def call_receivers(self, client, clients_list, message): """ Calls receivers callbacks """ # Try to parse JSON try: json_message = json.loads(message) except ValueError: json_message = None for func, to_json in self.receivers: ...
[4][SEP1][Try][None][None][For][If][If][None][None][None][SEP2][1,2][3][3][4][5,6][7,3][8][8][3][SEP3][0][1][0][1][0][0][0][0][1]
MODULE_FUNCTIONDEF_ARGUMENTS_ARG_ARG_ARG_ARG_EXPR_CONSTANT_TRY_ASSIGN_NAME_STORE_CALL_ATTRIBUTE_NAME_LOAD_LOAD_NAME_LOAD_EXCEPTHANDLER_NAME_LOAD_ASSIGN_NAME_STORE_CONSTANT_FOR_TUPLE_NAME_STORE_NAME_STORE_STORE_ATTRIBUTE_NAME_LOAD_LOAD_IF_NAME_LOAD_IF_COMPARE_NAME_LOAD_IS_CONSTANT_CONTINUE_ASSIGN_NAME_STORE_NAME_LOAD_AS...
def _chunk_from_ranges(contents_lines, start_line_index, start_column_index, end_line_index, end_column_index): """Create a _ChunkInfo from a range of lines and columns. :contents_lines: is the raw lines of a file. ...
[5][SEP1][If][None][Return][SEP2][1,2][2][][SEP3][0][0][1]
MODULE_FUNCTIONDEF_ARGUMENTS_ARG_ARG_ARG_ARG_ARG_EXPR_CONSTANT_IF_COMPARE_NAME_LOAD_EQ_NAME_LOAD_AUGASSIGN_NAME_STORE_SUB_NAME_LOAD_ASSIGN_NAME_STORE_SUBSCRIPT_NAME_LOAD_SLICE_NAME_LOAD_BINOP_NAME_LOAD_ADD_CONSTANT_LOAD_ASSIGN_SUBSCRIPT_NAME_LOAD_CONSTANT_STORE_SUBSCRIPT_SUBSCRIPT_NAME_LOAD_CONSTANT_LOAD_SLICE_NAME_LOA...
def select_best_paths(examples): """ Process `examples`, select only paths that works for every example. Select best paths with highest priority. Args: examples (dict): Output from :func:`.read_config`. Returns: list: List of :class:`.PathCall` and :class:`.Chained` objects. ""...
[1][SEP1][None][For][None][For][For][None][None][If][For][For][None][If][None][Return][None][SEP2][1][2,3][4][5,6][7,1][8][9][10,4][11,3][12,13][4][14,8][9][][8][SEP3][0][2][2][3][1][2][3][0][3][1][1][0][3][0][2]
MODULE_FUNCTIONDEF_ARGUMENTS_ARG_EXPR_CONSTANT_ASSIGN_NAME_STORE_DICT_FOR_NAME_STORE_NAME_LOAD_ASSIGN_NAME_STORE_CALL_NAME_LOAD_SUBSCRIPT_NAME_LOAD_CONSTANT_LOAD_ASSIGN_NAME_STORE_CALL_NAME_LOAD_NAME_LOAD_SUBSCRIPT_NAME_LOAD_CONSTANT_LOAD_FOR_TUPLE_NAME_STORE_NAME_STORE_STORE_CALL_ATTRIBUTE_NAME_LOAD_LOAD_IF_COMPARE_NA...
def contribute_to_class(self, model, name): """ Newer versions of Django explicitly prevent managers being accessed from abstract classes, which is behaviour the search API has always relied on. Here we reinstate it. """ super(SearchableManager, self).contribute_to_class(...
[3][SEP1][None][SEP2][][SEP3][4]
MODULE_FUNCTIONDEF_ARGUMENTS_ARG_ARG_ARG_EXPR_CONSTANT_EXPR_CALL_ATTRIBUTE_CALL_NAME_LOAD_NAME_LOAD_NAME_LOAD_LOAD_NAME_LOAD_NAME_LOAD_EXPR_CALL_NAME_LOAD_NAME_LOAD_NAME_LOAD_CALL_NAME_LOAD_NAME_LOAD
def single_value(self, key, ts=None, direction=None): """Return a single value for a series. You can supply a timestamp as the ts argument, otherwise the search defaults to the current time. The direction argument can be one of "exact", "before", "after", or "nearest". ...
[4][SEP1][If][None][None][Return][SEP2][1,2][3][3][][SEP3][2][1][0][3]
MODULE_FUNCTIONDEF_ARGUMENTS_ARG_ARG_ARG_ARG_CONSTANT_CONSTANT_EXPR_CONSTANT_ASSIGN_NAME_STORE_CALL_NAME_LOAD_NAME_LOAD_ASSIGN_NAME_STORE_CALL_ATTRIBUTE_NAME_LOAD_LOAD_BINOP_NAME_LOAD_ADD_CONSTANT_CONSTANT_IF_COMPARE_NAME_LOAD_ISNOT_CONSTANT_ASSIGN_NAME_STORE_CALL_NAME_LOAD_NAME_LOAD_ASSIGN_NAME_STORE_CONSTANT_ASSIGN_N...
def is_valid(self): ''' Validate form. Return True if Django validates the form, the username obeys the parameters, and passwords match. Return False otherwise. ''' if not super(ProfileRequestForm, self).is_valid(): return False validity = True if self...
[1][SEP1][If][Return][If][None][Return][SEP2][1,2][][3,4][4][][SEP3][2][0][0][2][0]
MODULE_FUNCTIONDEF_ARGUMENTS_ARG_EXPR_CONSTANT_IF_UNARYOP_NOT_CALL_ATTRIBUTE_CALL_NAME_LOAD_NAME_LOAD_NAME_LOAD_LOAD_RETURN_CONSTANT_ASSIGN_NAME_STORE_CONSTANT_IF_COMPARE_SUBSCRIPT_ATTRIBUTE_NAME_LOAD_LOAD_CONSTANT_LOAD_NOTEQ_SUBSCRIPT_ATTRIBUTE_NAME_LOAD_LOAD_CONSTANT_LOAD_EXPR_CALL_NAME_LOAD_NAME_LOAD_CONSTANT_CONSTA...
def trimRight(self, amount): """ Trim this fastqSequence in-place by removing <amount> nucleotides from the 3' end (right end). :param amount: the number of nucleotides to trim from the right-side of this sequence. """ if amount == 0: return self.sequenceDat...
[2][SEP1][If][Return][None][SEP2][1,2][][][SEP3][0][0][0]
MODULE_FUNCTIONDEF_ARGUMENTS_ARG_ARG_EXPR_CONSTANT_IF_COMPARE_NAME_LOAD_EQ_CONSTANT_RETURN_ASSIGN_ATTRIBUTE_NAME_LOAD_STORE_SUBSCRIPT_ATTRIBUTE_NAME_LOAD_LOAD_SLICE_UNARYOP_USUB_NAME_LOAD_LOAD_ASSIGN_ATTRIBUTE_NAME_LOAD_STORE_SUBSCRIPT_ATTRIBUTE_NAME_LOAD_LOAD_SLICE_UNARYOP_USUB_NAME_LOAD_LOAD