sequence
stringlengths
1.19k
35k
code
stringlengths
75
8.58k
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'Debounce'}, {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'default_parameter', 'children': ['5', '6']}, {'...
def Debounce(threshold=100): threshold *= 1000 max_tick = 0xFFFFFFFF class _decorated(object): def __init__(self, pigpio_cb): self._fn = pigpio_cb self.last = 0 self.is_method = False def __call__(self, *args, **kwargs): if self.is_method: ...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '16']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'fit'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '10', '13']}; {'id': '4', 'type': 'identifier', 'children':...
def fit(self, target_type, target, adjust_thickness=False, adjust_site_atten=False, adjust_source_vel=False): density = self.profile.density nl = len(density) slowness = self.profile.slowness thickness = self.profile.thickness ...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'build_recipe_input'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': []...
def build_recipe_input(self, ob, dal): result = {} ob_query_skip = False ob_query_field = 'obresult' if isinstance(ob, ObservingBlock): import numina.types.obsresult as obtype for key, req in self.requirements().items(): if isinstance(req.type, obt...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'subsets_of_fileinfo_from_txt'}, {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': []...
def subsets_of_fileinfo_from_txt(filename): if not os.path.isfile(filename): raise ValueError("File " + filename + " not found!") with open(filename) as f: file_content = f.read().splitlines() dict_of_subsets_of_fileinfo = {} label = None sublist_of_fileinfo = [] idict = 0 if...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'verify_refresh'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value'...
def verify_refresh(self, request): if not self.allow_refresh: raise InvalidTokenError('Token refresh is disabled') token = self.get_jwt(request) if token is None: raise InvalidTokenError('Token not found') try: claims_set = self.decode_jwt( ...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '10']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_default_terminal'}, {'id': '3', 'type': 'parameters', 'children': ['4', '7']}; {'id': '4', 'type': 'default_parameter', 'children...
def get_default_terminal(environ=None, fallback=_UNSPECIFIED): if environ is None: environ = os.environ if "PIAS_OPT_TERMINAL" in environ: return environ["PIAS_OPT_TERMINAL"] terminals = [] colorterm = environ.get("COLORTERM") for filename in (colorterm, "gnome-terminal", "konsole", ...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '17']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'bitset'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '11', '14']}; {'id': '4', 'type': 'identifier', 'children': [...
def bitset(name, members, base=bases.BitSet, list=False, tuple=False): if not name: raise ValueError('empty bitset name: %r' % name) if not hasattr(members, '__getitem__') or not hasattr(members, '__len__'): raise ValueError('non-sequence bitset members: %r' % members) if not len(members): ...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_split_refextract_authors_str'}, {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [...
def _split_refextract_authors_str(authors_str): author_seq = (x.strip() for x in RE_SPLIT_AUTH.split(authors_str) if x) res = [] current = '' for author in author_seq: if not isinstance(author, six.text_type): author = six.text_type(author.decode('utf8', 'ignore')) author = r...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '30']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'query'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '9', '12', '15', '18', '21', '24', '27']}; {'id': '4', 'type':...
def query(pattern_path, dict_, max_length=None, strip=False, case_sensitive=False, unique=False, deduplicate=False, string_transformations=None, hyperlink=False, return_multiple_columns=False): if string_transformations is None: string_transformations = [] if max_length: ...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '15']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_reactions'}, {'id': '3', 'type': 'parameters', 'children': ['4', '7', '10', '13']}; {'id': '4', 'type': 'default_parameter', 'chi...
def get_reactions(columns='all', n_results=20, write_db=False, **kwargs): if write_db or columns == 'all': columns = all_columns['reactions'] queries = {} for key, value in kwargs.items(): key = map_column_names(key) if key == 'distinct': if value in [True, 'True', 'true'...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'extract_atoms'}, {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'mol...
def extract_atoms(molecule): if molecule == '': return molecule try: return float(molecule) except BaseException: pass atoms = '' if not molecule[0].isalpha(): i = 0 while not molecule[i].isalpha(): i += 1 prefactor = float(molecule[:i]) ...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'check_reaction'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value'...
def check_reaction(reactants, products): reactant_list = [reactant.split('@')[0].strip( 'star').strip('gas') for reactant in reactants] product_list = [product.split('@')[0].strip( 'star').strip('gas') for product in products] reactant_atoms = [extract_atoms(reactant) for reactant in reactan...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '32']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'fowler_array'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8', '11', '14', '17', '20', '23', '26', '29']}; {'id': '4',...
def fowler_array(fowlerdata, ti=0.0, ts=0.0, gain=1.0, ron=1.0, badpixels=None, dtype='float64', saturation=65631, blank=0, normalize=False): import numina.array._nirproc as _nirproc if gain <= 0: raise ValueError("invalid parameter, gain <= 0.0") if ron <= 0: ...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'reactions'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7']}; {'id': '4', 'type': 'identifier', 'children': [], 'v...
def reactions(columns, n_results, write_db, queries): if not isinstance(queries, dict): query_dict = {} for q in queries: key, value = q.split('=') if key == 'distinct': if value in ['True', 'true']: query_dict.update({key: True}) ...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'publications'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'val...
def publications(columns, n_results, queries): if not isinstance(queries, dict): query_dict = {} for q in queries: key, value = q.split('=') if key == 'distinct': if value in ['True', 'true']: query_dict.update({key: True}) ...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'make_folders'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': ...
def make_folders(template, custom_base): def dict_representer(dumper, data): return dumper.represent_dict(data.items()) Dumper.add_representer(collections.OrderedDict, dict_representer) if custom_base is None: custom_base = os.path.abspath(os.path.curdir) template = custom_base + '/' + t...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '13']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'opensignals_hierarchy'}, {'id': '3', 'type': 'parameters', 'children': ['4', '7', '10']}; {'id': '4', 'type': 'default_parameter', 'c...
def opensignals_hierarchy(root=None, update=False, clone=False): if root is None: root = os.getcwd() categories = list(NOTEBOOK_KEYS.keys()) current_dir = root + "\\opensignalstools_environment" if not os.path.isdir(current_dir): os.makedirs(current_dir) for var in ["images", "styles...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_generate_notebook_by_tag_body'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'childr...
def _generate_notebook_by_tag_body(notebook_object, dict_by_tag): tag_keys = list(dict_by_tag.keys()) tag_keys.sort() for tag in tag_keys: if tag.lower() not in SIGNAL_TYPE_LIST: markdown_cell = group_tag_code.TAG_TABLE_HEADER markdown_cell = markdown_cell.replace("Tag i", ta...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_preprocess_params'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'va...
def _preprocess_params(cls, kwargs): for attr, val in kwargs.items(): if cls.is_the_primary_key(attr) and cls._prevent_primary_key_initialization_: del kwargs[attr] continue if val == "": kwargs[attr] = None continue ...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '12']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'add_all'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '9']}; {'id': '4', 'type': 'identifier', 'children': [], 'va...
def add_all(cls, models, commit=True, check_type=False): if check_type: for model in models: if not isinstance(model, cls): raise ValueError('%s is not of type %s' (model, cls)) if None in models: cls.session.add_all([m for m in models if m is ...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'peakdelta'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value'...
def peakdelta(v, delta, x=None): maxtab = [] mintab = [] if x is None: x = arange(len(v)) v = asarray(v) if len(v) != len(x): sys.exit('Input vectors v and x must have same length') if not isscalar(delta): sys.exit('Input argument delta must be a scalar') if delta <=...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'parse_datetime'}, {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'va...
def parse_datetime(value): if value is None: return None def _get_fixed_timezone(offset): if isinstance(offset, timedelta): offset = offset.seconds // 60 sign = '-' if offset < 0 else '+' hhmm = '%02d%02d' % divmod(abs(offset), 60) name = sign + hhmm r...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '18']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'add_property_grid_widget'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '9', '12', '15']}; {'id': '4', 'type': 'ide...
def add_property_grid_widget(self, part_instance, max_height=None, custom_title=False, show_headers=True, show_columns=None): height = max_height if isinstance(part_instance, Part): part_instance_id = part_instance.id elif isinstance(part_instance, te...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_generate_data_for_format'}, {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], '...
def _generate_data_for_format(fmt): data = {} free_size_start = False for literal_text, field_name, format_spec, conversion in formatter.parse(fmt): if literal_text: free_size_start = False if not field_name: free_size_start = False continue if not...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '12']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'relocate_model'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '9']}; {'id': '4', 'type': 'identifier', 'children': ...
def relocate_model(part, target_parent, name=None, include_children=True): if target_parent.id in get_illegal_targets(part, include={part.id}): raise IllegalArgumentError('cannot relocate part "{}" under target parent "{}", because the target is part of ' 'its descendants'...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '12']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'relocate_instance'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '9']}; {'id': '4', 'type': 'identifier', 'children...
def relocate_instance(part, target_parent, name=None, include_children=True): if not name: name = "CLONE - {}".format(part.name) part_model = part.model() target_parent_model = target_parent.model() relocate_model(part=part_model, target_parent=target_parent_model, name=part_model.name, ...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '13']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'move_part_instance'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '10']}; {'id': '4', 'type': 'identifier', 'c...
def move_part_instance(part_instance, target_parent, part_model, name=None, include_children=True): if not name: name = part_instance.name moved_model = get_mapping_dictionary()[part_model.id] if moved_model.multiplicity == Multiplicity.ONE: moved_instance = moved_model.instances(parent_id=t...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'update_part_with_properties'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'chil...
def update_part_with_properties(part_instance, moved_instance, name=None): properties_id_dict = dict() for prop_instance in part_instance.properties: if prop_instance._json_data['property_type'] == PropertyType.ATTACHMENT_VALUE: moved_prop = get_mapping_dictionary()[prop_instance.id] ...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '11']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_checkup'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '8', '9', '10']}; {'id': '4', 'type': 'identifier', 'c...
def _checkup(peaks, ecg_integrated, sample_rate, rr_buffer, spk1, npk1, threshold): peaks_amp = [ecg_integrated[peak] for peak in peaks] definitive_peaks = [] for i, peak in enumerate(peaks): amp = peaks_amp[i] if amp > threshold: definitive_peaks, spk1, rr_buffer = _acceptpeak(p...
{'id': '0', 'type': 'module', 'children': ['1', '175', '182', '197', '206', '213', '220', '237', '291', '305', '309', '317']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'create_napp'}, {'id': '3', 'type': 'parameters', 'childre...
def create_napp(cls, meta_package=False): templates_path = SKEL_PATH / 'napp-structure/username/napp' ui_templates_path = os.path.join(templates_path, 'ui') username = None napp_name = None print('--------------------------------------------------------------') print('Wel...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '17']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'match_app_version'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8', '11', '14']}; {'id': '4', 'type': 'identifier', 'c...
def match_app_version(self, app=None, label=None, version=None, default=False): if not app or not label and not (app and label): target_app = [a for a in self.app_versions if a.get('app') == app or a.get('label') == label] if not target_app and not isinstance(default, bool): ...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '16']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'activities'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8', '11', '14']}; {'id': '4', 'type': 'identifier', 'children...
def activities(self, name=None, pk=None, scope=None, **kwargs): request_params = { 'id': pk, 'name': name, 'scope': scope } if self.match_app_version(label='wim', version='>=2.0.0', default=False): request_params.update(API_EXTRA_PARAMS['activity']...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '36']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'parts'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8', '11', '14', '19', '22', '25', '28', '31', '34']}; {'id': '4', ...
def parts(self, name=None, pk=None, model=None, category=Category.INSTANCE, bucket=None, parent=None, activity=None, limit=None, batch=100, **kwargs): if limit and limit < ...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '24']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'create_property'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '10', '15', '18', '21']}; {'id': '4', 'type': '...
def create_property(self, model, name, description=None, property_type=PropertyType.CHAR_VALUE, default_value=None, unit=None, options=None): if model.category != Category.MODEL: raise IllegalArgumentError("The model should be of category MODEL") if not property_type....
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'set_sort'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'sel...
def set_sort(self, request): sort_request = request.GET.get(self.sort_parameter, self.default_sort) if sort_request.startswith('-'): sort_order = '-' sort_field = sort_request.split('-')[1] else: sort_order = '' sort_field = sort_request if...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_next_sort_string'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], '...
def get_next_sort_string(self, field): if field == self.sort_field: next_sort = self.toggle_sort_order() + field else: default_order_for_field = \ self._allowed_sort_fields[field]['default_direction'] next_sort = default_order_for_field + field ...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_sort_indicator'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'va...
def get_sort_indicator(self, field): indicator = '' if field == self.sort_field: indicator = 'sort-asc' if self.sort_order == '-': indicator = 'sort-desc' return indicator
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_basic_sort_link'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [...
def get_basic_sort_link(self, request, field): query_string = self.get_querystring() sort_string = self.get_next_sort_string(field) if sort_string: sort_link = request.path + '?' + sort_string if query_string: sort_link += '&' + query_string else: ...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '24']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'download_as_pdf'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8', '11', '16', '21']}; {'id': '4', 'type': 'identifier'...
def download_as_pdf(self, target_dir=None, pdf_filename=None, paper_size=PaperSize.A4, paper_orientation=PaperOrientation.PORTRAIT, include_appendices=False): if not pdf_filename: pdf_filename = self.name + '.pdf' if not pdf_filename.endswith('.pdf'): pdf_...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '30']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_project'}, {'id': '3', 'type': 'parameters', 'children': ['4', '7', '10', '13', '16', '19', '22', '25']}; {'id': '4', 'type': 'de...
def get_project(url=None, username=None, password=None, token=None, scope=None, scope_id=None, env_filename=None, status=ScopeStatus.ACTIVE): if env.bool(kecenv.KECHAIN_FORCE_ENV_USE, default=False): if not os.getenv(kecenv.KECHAIN_URL): raise ClientError( "Error:...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'options'}, {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'cls'}, {'...
def options(cls): return sorted((value, name) for (name, value) in cls.__dict__.items() if not name.startswith('__'))
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '16']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'edit'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8', '11', '14']}; {'id': '4', 'type': 'identifier', 'children': [],...
def edit(self, name=None, description=None, version=None, **kwargs): update_dict = {'id': self.id} if name: if not isinstance(name, str): raise IllegalArgumentError("name should be provided as a string") update_dict.update({'name': name}) if description: ...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'children'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'sel...
def children(self, **kwargs): if not kwargs: if not self._cached_children: self._cached_children = list(self._client.parts(parent=self.id, category=self.category)) return self._cached_children else: return self._client.parts(parent=self.id, category=se...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '16']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'update'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8', '11', '14']}; {'id': '4', 'type': 'identifier', 'children': [...
def update(self, name=None, update_dict=None, bulk=True, **kwargs): action = 'bulk_update_properties' request_body = dict() for prop_name_or_id, property_value in update_dict.items(): if is_uuid(prop_name_or_id): request_body[prop_name_or_id] = property_value ...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '17']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'add_with_properties'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '9', '12', '15']}; {'id': '4', 'type': 'identifi...
def add_with_properties(self, model, name=None, update_dict=None, bulk=True, **kwargs): if self.category != Category.INSTANCE: raise APIError("Part should be of category INSTANCE") name = name or model.name action = 'new_instance_with_properties' properties_update_dict = dict...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '15']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'move'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '9', '12']}; {'id': '4', 'type': 'identifier', 'children': [], ...
def move(self, target_parent, name=None, include_children=True, include_instances=True): if not name: name = self.name if self.category == Category.MODEL and target_parent.category == Category.MODEL: moved_model = relocate_model(part=self, target_parent=target_parent, name=name, ...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '69']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'plot'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8', '11', '15', '18', '21', '24', '27', '30', '33', '36', '39', '42...
def plot(self, workflow=None, view=True, depth=-1, name=NONE, comment=NONE, format=NONE, engine=NONE, encoding=NONE, graph_attr=NONE, node_attr=NONE, edge_attr=NONE, body=NONE, node_styles=NONE, node_data=NONE, node_function=NONE, edge_data=NONE, max_lines=NONE, max_w...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '10']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'lookup_url'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7']}; {'id': '4', 'type': 'identifier', 'children': [], ...
def lookup_url(self, url, klass, module=None): ''' Gets a proxy reference to the actor indicated by the URL in the parameters. It can be a local reference or a remote direction to another host. This method can be called remotely synchronously. :param srt. url: address tha...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'prepare_rapid_streamflow'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'childre...
def prepare_rapid_streamflow(self, path_to_rapid_qout, connection_list_file): ihg_filename = '{0}.ihg'.format(self.project_manager.name) with tmp_chdir(self.project_manager.project_directory): time_index_range = [] with RAPIDDataset(path_to_rapid_qout, out_tzinfo=self.tz) as qout...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'stencil'}, {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'dictionary_splat_pattern', 'children': ['5']}, {...
def stencil(**kwargs): alnfile = kwargs.get('alnfile') gtypefile = kwargs.get('gtypefile') grpfile = kwargs.get('grpfile') if grpfile is None: grpfile2chk = os.path.join(DATA_DIR, 'ref.gene2transcripts.tsv') if os.path.exists(grpfile2chk): grpfile = grpfile2chk else: ...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'split_tracks'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'val...
def split_tracks(lat,lon,*args): '''assumes eastward motion''' tracks = [] lt,ln = [lat[0]],[lon[0]] zz = [[z[0]] for z in args] for i in range(1,len(lon)): lt.append(lat[i]) for z,a in zip(zz,args): z.append(a[i]) d1 = abs(lon[...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'find_loaders'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': ...
def find_loaders(scheme, protocols=None): matching_groups = ['plaster.loader_factory'] if protocols: matching_groups += [ 'plaster.{0}_loader_factory'.format(proto) for proto in protocols ] scheme = scheme.lower() parts = scheme.split('+', 1) if len(parts) == ...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '12']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'combine_dicts'}, {'id': '3', 'type': 'parameters', 'children': ['4', '6', '9']}; {'id': '4', 'type': 'list_splat_pattern', 'children'...
def combine_dicts(*dicts, copy=False, base=None): if len(dicts) == 1 and base is None: cd = dicts[0].copy() else: cd = {} if base is None else base for d in dicts: if d: cd.update(d) return {k: _copy.deepcopy(v) for k, v in cd.items()} if copy else cd
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'kk_dict'}, {'id': '3', 'type': 'parameters', 'children': ['4', '6']}; {'id': '4', 'type': 'list_splat_pattern', 'children': ['5']}, {'...
def kk_dict(*kk, **adict): for k in kk: if isinstance(k, dict): if not set(k).isdisjoint(adict): raise ValueError('keyword argument repeated') adict.update(k) elif k in adict: raise ValueError('keyword argument repeated') else: ...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '13']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'map_dict'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '7', '10']}; {'id': '4', 'type': 'identifier', 'children': [], '...
def map_dict(key_map, *dicts, copy=False, base=None): it = combine_dicts(*dicts).items() get = key_map.get return combine_dicts({get(k, k): v for k, v in it}, copy=copy, base=base)
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '13']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'map_list'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '7', '10']}; {'id': '4', 'type': 'identifier', 'children': [], '...
def map_list(key_map, *inputs, copy=False, base=None): d = {} if base is None else base for m, v in zip(key_map, inputs): if isinstance(m, dict): map_dict(m, v, base=d) elif isinstance(m, list): map_list(m, *v, base=d) else: d[m] = v return combine...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '15']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'selector'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '9', '12']}; {'id': '4', 'type': 'identifier', 'children': ...
def selector(keys, dictionary, copy=False, output_type='dict', allow_miss=False): if not allow_miss: def check(key): return True else: def check(key): return key in dictionary if output_type == 'list': res = [dictionary[k] for k in keys if check(k...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'difference'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 's...
def difference(self, *others): r result = self.__copy__() _elements = result._elements _total = result._total for other in map(self._as_multiset, others): for element, multiplicity in other.items(): if element in _elements: old_mult...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'union'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}...
def union(self, *others): r result = self.__copy__() _elements = result._elements _total = result._total for other in map(self._as_mapping, others): for element, multiplicity in other.items(): old_multiplicity = _elements.get(element, 0) ...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'intersection'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': ...
def intersection(self, *others): r result = self.__copy__() _elements = result._elements _total = result._total for other in map(self._as_mapping, others): for element, multiplicity in list(_elements.items()): new_multiplicity = other.get(element, 0) ...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'symmetric_difference'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], '...
def symmetric_difference(self, other): r other = self._as_multiset(other) result = self.__class__() _total = 0 _elements = result._elements self_elements = self._elements other_elements = other._elements dist_elements = set(self_elements.keys()) | set(othe...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'times'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}...
def times(self, factor): if factor == 0: return self.__class__() if factor < 0: raise ValueError('The factor must no be negative.') result = self.__copy__() _elements = result._elements for element in _elements: _elements[element] *= factor ...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'union_update'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': ...
def union_update(self, *others): r _elements = self._elements _total = self._total for other in map(self._as_mapping, others): for element, multiplicity in other.items(): old_multiplicity = _elements.get(element, 0) if multiplicity > old_multip...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'intersection_update'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'v...
def intersection_update(self, *others): r for other in map(self._as_mapping, others): for element, current_count in list(self.items()): multiplicity = other.get(element, 0) if multiplicity < current_count: self[element] = multiplicity
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'difference_update'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'val...
def difference_update(self, *others): r for other in map(self._as_multiset, others): for element, multiplicity in other.items(): self.discard(element, multiplicity)
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'symmetric_difference_update'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children'...
def symmetric_difference_update(self, other): r other = self._as_multiset(other) elements = set(self.distinct_elements()) | set(other.distinct_elements()) for element in elements: multiplicity = self[element] other_count = other[element] self[element] ...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'times_update'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': ...
def times_update(self, factor): if factor < 0: raise ValueError("The factor must not be negative.") elif factor == 0: self.clear() else: _elements = self._elements for element in _elements: _elements[element] *= factor s...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'add'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'sel...
def add(self, element, multiplicity=1): if multiplicity < 1: raise ValueError("Multiplicity must be positive") self._elements[element] += multiplicity self._total += multiplicity
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'remove'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': '...
def remove(self, element, multiplicity=None): _elements = self._elements if element not in _elements: raise KeyError old_multiplicity = _elements.get(element, 0) if multiplicity is None or multiplicity >= old_multiplicity: del _elements[element] self._...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'discard'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': ...
def discard(self, element, multiplicity=None): _elements = self._elements if element in _elements: old_multiplicity = _elements[element] if multiplicity is None or multiplicity >= old_multiplicity: del _elements[element] self._total -= old_multipli...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '12']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'async_thread'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '8', '10']}; {'id': '4', 'type': 'identifier', 'ch...
def async_thread(sol, args, node_attr, node_id, *a, **kw): executor = _get_executor(_executor_name(kw.get('executor', False), sol.dsp)) if not executor: return sol._evaluate_node(args, node_attr, node_id, *a, **kw) futures = args if node_attr['type'] == 'data' and ( node_attr['wait_i...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'pivot'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7']}; {'id': '4', 'type': 'identifier', 'children': [], 'value...
def pivot(table, left, top, value): rs = {} ysort = [] xsort = [] for row in table: yaxis = tuple([row[c] for c in left]) if yaxis not in ysort: ysort.append(yaxis) xaxis = tuple([row[c] for c in top]) if xaxis not in xsort: xsort.append(xaxis) try: rs...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '21']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'download_hrrr_for_gssha'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '11', '14', '17']}; {'id': '4', 'type':...
def download_hrrr_for_gssha(main_directory, forecast_start_date_string, forecast_start_hour_string, leftlon=-180, rightlon=180, toplat=90,bottomlat=-90): out_directory = path.join(main_directory, forecast...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_convert_data_to_hourly'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': []...
def _convert_data_to_hourly(self, gssha_data_var): time_step_hours = np.diff(self.data.time)[0]/np.timedelta64(1, 'h') calc_function = self._get_calc_function(gssha_data_var) resampled_data = None if time_step_hours < 1: resampled_data = self.data.resample('1H', dim='time', ...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_sub_dsp'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'valu...
def get_sub_dsp(self, nodes_bunch, edges_bunch=None): nodes_bunch = [self.get_node(u)[1][0] for u in nodes_bunch] sub_dsp = self.copy_structure( dmap=self.dmap.subgraph(nodes_bunch).copy() ) nodes, dmap_out_degree = sub_dsp.nodes, sub_dsp.dmap.out_degree dmap_dv, dmap...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'blue'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'},...
def blue(self, memo=None): memo = {} if memo is None else memo if self in memo: return memo[self] from .utils.dsp import map_list from .utils.blue import BlueDispatcher, _parent_blue memo[self] = blue = BlueDispatcher( executor=self.executor, name=self.nam...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'findOutlet'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 's...
def findOutlet(self, shapefile_path): check_watershed_boundary_geometry(shapefile_path) shapefile = ogr.Open(shapefile_path) source_layer = shapefile.GetLayer(0) source_lyr_proj = source_layer.GetSpatialRef() osr_geographic_proj = osr.SpatialReference() osr_geographic_pro...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_write'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7']}; {'id': '4', 'type': 'identifier', 'children': [], 'valu...
def _write(self, session, openFile, replaceParamFile): events = self.precipEvents for event in events: openFile.write('EVENT "%s"\nNRGAG %s\nNRPDS %s\n' % (event.description, event.nrGag, event.nrPds)) if event.nrGag > 0: values = event.values valL...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'valueWritePreprocessor'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [],...
def valueWritePreprocessor(valueString, replaceParamsFile=None): if type(valueString) is bool: log.warning("Only numerical variable types can be handled by the valueReadPreprocessor function.") return valueString variableString = valueString if replaceParamsFile is not None: if varia...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '12']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_createGsshaPyObjects'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '8', '9', '10', '11']}; {'id': '4', 'type...
def _createGsshaPyObjects(self, mapTables, indexMaps, replaceParamFile, directory, session, spatial, spatialReferenceID): for mt in mapTables: try: if mt['indexMapName'] is not None: indexMaps[mt['indexMapName']] mapTable = MapTable(name=mt['name']...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_valuePivot'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '8']}; {'id': '4', 'type': 'identifier', 'children':...
def _valuePivot(self, session, mapTable, contaminant, replaceParaFile): indexes = session.query(MTIndex). \ join(MTValue.index). \ filter(MTValue.mapTable == mapTable). \ filter(MTValue.contaminant == contaminant). \ order_by(MTIndex.index). \ all() ...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '14']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'addRoughnessMapFromLandUse'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '8', '11']}; {'id': '4', 'type': 'id...
def addRoughnessMapFromLandUse(self, name, session, land_use_grid, land_use_to_roughness_table=None, land_use_grid_id=None, ...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'result'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'...
def result(self, timeout=None): it, exceptions, future_lists = [], [], [] from concurrent.futures import Future, wait as wait_fut def update(fut, data, key): if isinstance(fut, Future): it.append((fut, data, key)) elif isinstance(fut, AsyncList) and fut no...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '13']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_set_data_node_output'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '8', '11']}; {'id': '4', 'type': 'identif...
def _set_data_node_output(self, node_id, node_attr, no_call, next_nds=None, **kw): est, wait_in = self._get_node_estimations(node_attr, node_id) if not no_call: if node_id is PLOT: est = est.copy() est[PLOT] = {'value': {'obj': se...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '13']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_set_function_node_output'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '8', '11']}; {'id': '4', 'type': 'ide...
def _set_function_node_output(self, node_id, node_attr, no_call, next_nds=None, **kw): o_nds, dist = node_attr['outputs'], self.dist output_nodes = next_nds or set(self._succ[node_id]).difference(dist) if not output_nodes: self.workflow.remove_node(n...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '19']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_add_initial_value'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '10', '13', '16']}; {'id': '4', 'type': 'ide...
def _add_initial_value(self, data_id, value, initial_dist=0.0, fringe=None, check_cutoff=None, no_call=None): nodes, seen, edge_weight = self.nodes, self.seen, self._edge_length wf_remove_edge, check_wait_in = self._wf_remove_edge, self.check_wait_in wf_add_edge, dsp_i...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '11']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_see_node'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '8']}; {'id': '4', 'type': 'identifier', 'children': ...
def _see_node(self, node_id, fringe, dist, w_wait_in=0): seen, dists = self.seen, self.dist wait_in = self.nodes[node_id]['wait_inputs'] self._update_meeting(node_id, dist) if self.check_wait_in(wait_in, node_id): pass elif node_id in dists: if dist < dist...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'tick'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'},...
def tick(self, events): self.add_new_threads() if self.drag_sprite: (mx, my) = self.screen.get_mouse_pos() (ox, oy) = self.drag_offset new_position = (mx + ox, my + oy) if self.drag_sprite.position != new_position: self.has_dragged = True ...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '10']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'evaluate'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7']}; {'id': '4', 'type': 'identifier', 'children': [], 'v...
def evaluate(self, s, value, insert=None): assert not isinstance(value, kurt.Script) if insert and insert.unevaluated: return value if isinstance(value, kurt.Block): if value.type.shape == "hat": return [] if value.type not in self.COMMANDS: ...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_write'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7']}; {'id': '4', 'type': 'identifier', 'children': [], 'valu...
def _write(self, session, openFile, maskMap): FIRST_VALUE_INDEX = 12 openFile.write('DATASET\r\n') if self.type == self.SCALAR_TYPE: openFile.write('OBJTYPE {0}\r\n'.format(self.objectType)) openFile.write('BEGSCL\r\n') elif self.type == self.VECTOR_TYPE: ...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '15']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_batch'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '9', '12']}; {'id': '4', 'type': 'identifier', 'children':...
def get_batch(sentences, token_dict, ignore_case=False, unk_index=1, eos_index=2): batch_size = len(sentences) max_sentence_len = max(map(len, sentences)) inputs = [[0] * max_sentence_len for _ in range(batch_size)] ...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '10']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_gene_info'}, {'id': '3', 'type': 'parameters', 'children': ['4', '7']}; {'id': '4', 'type': 'default_parameter', 'children': ['5'...
def get_gene_info(ensembl_ids=None, hgnc_symbols=None): uniq_ensembl_ids = set(ensembl_id for ensembl_id in (ensembl_ids or [])) uniq_hgnc_symbols = set(hgnc_symbol for hgnc_symbol in (hgnc_symbols or [])) genes = [] gene_data = [] if uniq_ensembl_ids: for ensembl_id in uniq_ensembl_ids: ...
{'id': '0', 'type': 'module', 'children': ['1', '13', '17', '29', '33', '42', '46', '60', '109', '121', '135', '146', '150', '376']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '12']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'parse_mapping'}, {'id': '3', 'type': 'parameters'...
def parse_mapping(self, map_path, source=None, dotfiles=None): include_re = r include_re = re.compile(include_re, re.I) mapping_re = r mapping_re = re.compile(mapping_re) filename = None map_path = path.realpath(path.expanduser(map_path)) if path.isfile(map_path): fil...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_add_compounds'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'v...
def _add_compounds(self, variant_obj, info_dict): compound_list = [] compound_entry = info_dict.get('Compounds') if compound_entry: for family_annotation in compound_entry.split(','): compounds = family_annotation.split(':')[-1].split('|') for compound...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '15']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'dump_xml'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '9', '12']}; {'id': '4', 'type': 'identifier', 'children': ...
def dump_xml(props, fp, comment=None, encoding='UTF-8', sort_keys=False): fp = codecs.lookup(encoding).streamwriter(fp, errors='xmlcharrefreplace') print('<?xml version="1.0" encoding={0} standalone="no"?>' .format(quoteattr(encoding)), file=fp) for s in _stream_xml(props, comment, sort_keys): ...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '11']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'dumps_xml'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8']}; {'id': '4', 'type': 'identifier', 'children': [], 'value...
def dumps_xml(props, comment=None, sort_keys=False): return ''.join(s + '\n' for s in _stream_xml(props, comment, sort_keys))
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'gene_list'}, {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'default_parameter', 'children': ['5', '6']}, {...
def gene_list(list_id=None): all_case_ids = [case.case_id for case in app.db.cases()] if list_id: genelist_obj = app.db.gene_list(list_id) case_ids = [case.case_id for case in app.db.cases() if case not in genelist_obj.cases] if genelist_obj is None: retur...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_functarguments'}, {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value':...
def get_functarguments(func): argspec = inspect.getargspec(func) if argspec.defaults is not None: args = argspec.args[:-len(argspec.defaults)] kwargs = dict( zip(argspec.args[-len(argspec.defaults):], argspec.defaults)) else: args = argspec.args kwargs = {} if...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'load'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '8']}; {'id': '4', 'type': 'identifier', 'children': [], 'v...
def load(ctx, variant_source, family_file, family_type, root): root = root or ctx.obj.get('root') or os.path.expanduser("~/.puzzle") if os.path.isfile(root): logger.error("'root' can't be a file") ctx.abort() logger.info("Root directory is: {}".format(root)) db_path = os.path.join(root, ...
{'id': '0', 'type': 'module', 'children': ['1']}, {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'toposort'}, {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'gra...
def toposort(graph, pick_first='head'): in_deg = {} for node, next_nodes in six.iteritems(graph): for next_node in [next_nodes.head_node, next_nodes.update_node]: if next_node is None: continue in_deg[next_node] = in_deg.get(next_node, 0) + 1 stk = [FIRST] ...