function
stringlengths
11
56k
repo_name
stringlengths
5
60
features
list
def require_attr(node, attr): """ Checks for the existence of the named attribute on the given node and raises an exception if it's not there.
markgw/jazzparser
[ 5, 1, 5, 1, 1368367354 ]
def display_migration_details(): print "This migration script adds a UUID column to workflows"
mikel-egana-aranguren/SADI-Galaxy-Docker
[ 1, 3, 1, 1, 1417087373 ]
def invert_mapping(mapping): """ Invert a mapping dictionary Parameters ---------- mapping: dict Returns ------- """ inverted_mapping = defaultdict(list) for key, value in mapping.items(): if isinstance(value, (list, set)): for element in value: ...
JuBra/GEMEditor
[ 1, 3, 1, 5, 1493549658 ]
def get_annotation_to_item_map(list_of_items): """ Find model items with overlapping annotations Parameters ---------- item list_of_items Returns ------- """ annotation_to_item = defaultdict(list) for item in list_of_items: for annotation in item.annotation: ...
JuBra/GEMEditor
[ 1, 3, 1, 5, 1493549658 ]
def check_charge_balance(metabolites): """ Check charge balance of the reaction """ # Check that charge is set for all metabolites if not all(x.charge is not None for x in metabolites.keys()): return None else: return sum([metabolite.charge * coefficient for metabolite, coefficient in it...
JuBra/GEMEditor
[ 1, 3, 1, 5, 1493549658 ]
def reaction_string(stoichiometry, use_metabolite_names=True): """Generate the reaction string """ attrib = "id" if use_metabolite_names: attrib = "name" educts = [(str(abs(value)), getattr(key, attrib)) for key, value in iteritems(stoichiometry) if value < 0.] products = [(str(abs(value))...
JuBra/GEMEditor
[ 1, 3, 1, 5, 1493549658 ]
def reaction_balance(metabolites): """ Check the balancing status of the stoichiometry Parameters ---------- metabolites : dict - Dictionary of metabolites with stoichiometric coefficnets Returns ------- charge_str : str or bool element_str : str or bool balanced : str or bool ...
JuBra/GEMEditor
[ 1, 3, 1, 5, 1493549658 ]
def new_location(new_index, n): """ Find new location Iteratively follow pointers to new location. Parameters ---------- new_index: list, Should be initialized from range n: int Returns ------- int """ while new_index[n] != n: n = new_index[n] return n
JuBra/GEMEditor
[ 1, 3, 1, 5, 1493549658 ]
def text_is_different(input, state): """ Check if the input is different from output Test if the input is different to the output while ignoring the difference between None and empty string. Parameters ---------- input: str or None state: str Returns ------- bool """ ...
JuBra/GEMEditor
[ 1, 3, 1, 5, 1493549658 ]
def restore_geometry(object, state): """ Restore the geometry of an object Parameters ---------- object: Object which should be restored state: State from settings Returns ------- """ if state: object.restoreGeometry(state)
JuBra/GEMEditor
[ 1, 3, 1, 5, 1493549658 ]
def __init__(self,age): self.age = age
tuxfux-hlp-notes/python-batches
[ 5, 15, 5, 2, 1481601578 ]
def getMoneyAmount(self, n): """ :type n: int :rtype: int """ self.dp = [[0] * (n + 1) for _ in range(n + 1)] return self.helper(1, n)
dichen001/Go4Jobs
[ 1, 1, 1, 2, 1474399542 ]
def _get_full_queue(q): output = [] while not q.empty(): output.append(q.get_nowait()) return u"\n".join(output)
markgw/pimlico
[ 6, 1, 6, 13, 1475829569 ]
def process_document(worker, archive, filename, doc): interface = worker.interface # Resolve coreference, passing in PTB parse trees as strings coref_result = interface.gateway.entry_point.resolveCoreference(doc) if coref_result is None: # Coref failed, return an invalid doc # Fetch all ...
markgw/pimlico
[ 6, 1, 6, 13, 1475829569 ]
def worker_set_up(worker): worker.interface = start_interface(worker.info)
markgw/pimlico
[ 6, 1, 6, 13, 1475829569 ]
def preprocess(executor): if executor.info.options["timeout"] is not None: executor.log.info("Allow up to %d seconds for each coref job" % executor.info.options["timeout"]) # Don't parse the parse trees, since OpenNLP does that for us, straight from the text executor.input_corpora[0].raw_data = True
markgw/pimlico
[ 6, 1, 6, 13, 1475829569 ]
def _(text): """ A noop underscore function that marks strings for extraction. """ return text
edx-solutions/edx-platform
[ 12, 19, 12, 9, 1391522577 ]
def course_key(self): """ :return: int course id NB: The goal is to move this XBlock out of edx-platform, and so we use scope_ids.usage_id instead of runtime.course_id so that the code will continue to work with workbench-based testing. """ return getattr(self.sc...
edx-solutions/edx-platform
[ 12, 19, 12, 9, 1391522577 ]
def django_user(self): """ Returns django user associated with user currently interacting with the XBlock. """ user_service = self.runtime.service(self, 'user') if not user_service: return None return user_service._django_user # pylint: disable=protec...
edx-solutions/edx-platform
[ 12, 19, 12, 9, 1391522577 ]
def get_translation_content(): try: return 'js/i18n/{lang}/djangojs.js'.format( lang=get_language(), ) except IOError: return 'js/i18n/en/djangojs.js'
edx-solutions/edx-platform
[ 12, 19, 12, 9, 1391522577 ]
def vendor_js_dependencies(): """ Returns list of vendor JS files that this XBlock depends on. The helper function that it uses to obtain the list of vendor JS files works in conjunction with the Django pipeline to ensure that in development mode the files are loaded individuall...
edx-solutions/edx-platform
[ 12, 19, 12, 9, 1391522577 ]
def js_dependencies(): """ Returns list of JS files that this XBlock depends on. The helper function that it uses to obtain the list of JS files works in conjunction with the Django pipeline to ensure that in development mode the files are loaded individually, but in production ...
edx-solutions/edx-platform
[ 12, 19, 12, 9, 1391522577 ]
def css_dependencies(): """ Returns list of CSS files that this XBlock depends on. The helper function that it uses to obtain the list of CSS files works in conjunction with the Django pipeline to ensure that in development mode the files are loaded individually, but in producti...
edx-solutions/edx-platform
[ 12, 19, 12, 9, 1391522577 ]
def has_permission(self, permission): """ Encapsulates lms specific functionality, as `has_permission` is not importable outside of lms context, namely in tests. :param user: :param str permission: Permission :rtype: bool """ # normal import causes the xm...
edx-solutions/edx-platform
[ 12, 19, 12, 9, 1391522577 ]
def author_view(self, context=None): # pylint: disable=unused-argument """ Renders author view for Studio. """ return self.studio_view_fragment()
edx-solutions/edx-platform
[ 12, 19, 12, 9, 1391522577 ]
def studio_view_fragment(self): """ Returns a fragment for rendering this block in Studio. """ fragment = Fragment() fragment.add_content(self.runtime.render_template( 'discussion/_discussion_inline_studio.html', {'discussion_id': self.discussion_id} ...
edx-solutions/edx-platform
[ 12, 19, 12, 9, 1391522577 ]
def parse_xml(cls, node, runtime, keys, id_generator): """ Parses OLX into XBlock. This method is overridden here to allow parsing legacy OLX, coming from discussion XModule. XBlock stores all the associated data, fields and children in a XML element inlined into vertical XML file ...
edx-solutions/edx-platform
[ 12, 19, 12, 9, 1391522577 ]
def _apply_translations_to_node_attributes(cls, block, node): """ Applies metadata translations for attributes stored on an inlined XML element. """ for old_attr, target_attr in six.iteritems(cls.metadata_translations): if old_attr in node.attrib and hasattr(block, target_att...
edx-solutions/edx-platform
[ 12, 19, 12, 9, 1391522577 ]
def lookupCharge(self, people_tree, ds_charge_id, institution=None, moment=None): """ look for the correct open municipio charge, or return None starting from an internal, domain-specific, charge id using the mapping in people_tree (lxml.etree) if the moment parameter is not pass...
openpolis/open_municipio
[ 50, 16, 50, 182, 1305817082 ]
def get_row_dicts(cursor, query, params=()): """ Convert a sequence of row (record) tuples -- as returned by a call to Python DBAPI's ``cursor.connect()`` method -- to a list of row dicts keyed by column names.
openpolis/open_municipio
[ 50, 16, 50, 182, 1305817082 ]
def create_table_schema(table_name, table_schema): """ Generate the SQL statement to execute in order to create a DB table.
openpolis/open_municipio
[ 50, 16, 50, 182, 1305817082 ]
def lookup_person(self, external, provider): return LookupPerson.lookup(external, provider)
openpolis/open_municipio
[ 50, 16, 50, 182, 1305817082 ]
def lookup(external, provider, as_of): if provider in ChargeMapCache.cache: if external in ChargeMapCache.cache[provider]: if as_of in ChargeMapCache.cache[provider][external]: return ChargeMapCache.cache[provider][external][as_of]
openpolis/open_municipio
[ 50, 16, 50, 182, 1305817082 ]
def update(external, provider, as_of, value): if not provider in ChargeMapCache.cache: ChargeMapCache.cache[provider] = {}
openpolis/open_municipio
[ 50, 16, 50, 182, 1305817082 ]
def lookup_charge(self, external, provider, as_of=None): # if already mapped, return the result from the cache
openpolis/open_municipio
[ 50, 16, 50, 182, 1305817082 ]
def __init__(self, msg, *args, **kwargs): Exception.__init__(self, general.warning(msg)) self.generic = "Generic OSRFramework exception."
i3visio/osrframework
[ 751, 229, 751, 66, 1419991203 ]
def __init__(self, platform, *args, **kwargs): msg = """ [*] Warning:\t{}. Details: No valid credentials provided for '{}'. Update the configuration file at: '{}'. """.format( self.__class__.__name__, platform, os.path.join(configur...
i3visio/osrframework
[ 751, 229, 751, 66, 1419991203 ]
def __init__(self, msg, *args, **kwargs): Exception.__init__(self, "{}".format(general.error(msg))) self.generic = "Generic OSRFramework error."
i3visio/osrframework
[ 751, 229, 751, 66, 1419991203 ]
def __init__(self, platform, mode, *args, **kwargs): msg = """ [*] Error:\t{}. Details: The '{}' wrapper has tried to call 'self.do_{}(...)'. The method seems be implemented wrongly or not implemented.""".format( self.__class__.__name__, platform, ...
i3visio/osrframework
[ 751, 229, 751, 66, 1419991203 ]
def _get_paypal_urls(self, cr, uid, environment, context=None): """ Paypal URLS """ if environment == 'prod': return { 'paypal_form_url': 'https://www.paypal.com/cgi-bin/webscr', 'paypal_rest_url': 'https://api.paypal.com/v1/oauth2/token', } ...
funkring/fdoo
[ 1, 5, 1, 8, 1400249085 ]
def _migrate_paypal_account(self, cr, uid, context=None): """ COMPLETE ME """ cr.execute('SELECT id, paypal_account FROM res_company') res = cr.fetchall() for (company_id, company_paypal_account) in res: if company_paypal_account: company_paypal_ids = self.sea...
funkring/fdoo
[ 1, 5, 1, 8, 1400249085 ]
def paypal_form_generate_values(self, cr, uid, id, partner_values, tx_values, context=None): base_url = self.pool['ir.config_parameter'].get_param(cr, SUPERUSER_ID, 'web.base.url') acquirer = self.browse(cr, uid, id, context=context) paypal_tx_values = dict(tx_values) paypal_tx_values.u...
funkring/fdoo
[ 1, 5, 1, 8, 1400249085 ]
def _paypal_s2s_get_access_token(self, cr, uid, ids, context=None): """ Note: see # see http://stackoverflow.com/questions/2407126/python-urllib2-basic-auth-problem for explanation why we use Authorization header instead of urllib2 password manager """ res = dict.fromkeys...
funkring/fdoo
[ 1, 5, 1, 8, 1400249085 ]
def _paypal_form_get_tx_from_data(self, cr, uid, data, context=None): reference, txn_id = data.get('item_number'), data.get('txn_id') if not reference or not txn_id: error_msg = 'Paypal: received data with missing reference (%s) or txn_id (%s)' % (reference, txn_id) _logger.error...
funkring/fdoo
[ 1, 5, 1, 8, 1400249085 ]
def _paypal_form_validate(self, cr, uid, tx, data, context=None): status = data.get('payment_status') data = { 'acquirer_reference': data.get('txn_id'), 'paypal_txn_type': data.get('payment_type'), 'partner_reference': data.get('payer_id') } if status ...
funkring/fdoo
[ 1, 5, 1, 8, 1400249085 ]
def _paypal_try_url(self, request, tries=3, context=None): """ Try to contact Paypal. Due to some issues, internal service errors seem to be quite frequent. Several tries are done before considering the communication as failed. .. versionadded:: pre-v8 saas-3 .. warning:: ...
funkring/fdoo
[ 1, 5, 1, 8, 1400249085 ]
def _paypal_s2s_get_invalid_parameters(self, cr, uid, tx, data, context=None): """ .. versionadded:: pre-v8 saas-3 .. warning:: Experimental code. You should not use it before OpenERP v8 official release. """ invalid_parameters = [] return inval...
funkring/fdoo
[ 1, 5, 1, 8, 1400249085 ]
def __repr__(self): return 'NO_DEFAULT'
frankrousseau/weboob
[ 4, 3, 4, 1, 1381825736 ]
def __init__(self, default=_NO_DEFAULT): self._key = None self._obj = None self.default = default self._creation_counter = _Filter._creation_counter _Filter._creation_counter += 1
frankrousseau/weboob
[ 4, 3, 4, 1, 1381825736 ]
def __and__(self, o): if isinstance(o, type) and issubclass(o, _Filter): o = o() o.selector = self return o
frankrousseau/weboob
[ 4, 3, 4, 1, 1381825736 ]
def __str__(self): return self.__class__.__name__
frankrousseau/weboob
[ 4, 3, 4, 1, 1381825736 ]
def wraper(function): def print_debug(self, value): logger = getLogger('b2filters') result = '' outputvalue = value if isinstance(value, list): from lxml import etree outputvalue = '' first = True for...
frankrousseau/weboob
[ 4, 3, 4, 1, 1381825736 ]
def __init__(self, selector=None, default=_NO_DEFAULT): super(Filter, self).__init__(default=default) self.selector = selector
frankrousseau/weboob
[ 4, 3, 4, 1, 1381825736 ]
def select(cls, selector, item, obj=None, key=None): if isinstance(selector, basestring): return item.xpath(selector) elif isinstance(selector, _Filter): selector._key = key selector._obj = obj return selector(item) elif callable(selector): ...
frankrousseau/weboob
[ 4, 3, 4, 1, 1381825736 ]
def filter(self, value): """ This method have to be overrided by children classes. """ raise NotImplementedError()
frankrousseau/weboob
[ 4, 3, 4, 1, 1381825736 ]
def filter(self, elements): if elements is not None: return elements else: return self.default_or_raise(ParseError('Element %r not found' % self.selector))
frankrousseau/weboob
[ 4, 3, 4, 1, 1381825736 ]
def __call__(self, item): link = self.select(self.selector, item, key=self._key, obj=self._obj) return item.page.browser.async_open(link)
frankrousseau/weboob
[ 4, 3, 4, 1, 1381825736 ]
def __init__(self, name, selector=None): super(Async, self).__init__() self.selector = selector self.name = name
frankrousseau/weboob
[ 4, 3, 4, 1, 1381825736 ]
def __call__(self, item): result = item.loaders[self.name].result() assert result.page is not None, 'The loaded url %s hasn\'t been matched by an URL object' % result.url return self.selector(result.page.doc)
frankrousseau/weboob
[ 4, 3, 4, 1, 1381825736 ]
def __call__(self, item): base = self.select(self.base, item, obj=self._obj, key=self._key) return self.selector(base)
frankrousseau/weboob
[ 4, 3, 4, 1, 1381825736 ]
def __init__(self, name, default=_NO_DEFAULT): super(Env, self).__init__(default) self.name = name
frankrousseau/weboob
[ 4, 3, 4, 1, 1381825736 ]
def __init__(self, *names, **kwargs): super(TableCell, self).__init__(**kwargs) self.names = names
frankrousseau/weboob
[ 4, 3, 4, 1, 1381825736 ]
def filter(self, el): if isinstance(el, (tuple, list)): return u' '.join([self.filter(e) for e in el]) if el.text is None: return self.default else: return unicode(el.text)
frankrousseau/weboob
[ 4, 3, 4, 1, 1381825736 ]
def __init__(self, selector=None, symbols='', replace=[], children=True, newlines=True, normalize='NFC', **kwargs): super(CleanText, self).__init__(selector, **kwargs) self.symbols = symbols self.toreplace = replace self.children = children self.newlines = newlines self.n...
frankrousseau/weboob
[ 4, 3, 4, 1, 1381825736 ]
def filter(self, txt): if isinstance(txt, (tuple, list)): txt = u' '.join([self.clean(item, children=self.children) for item in txt]) txt = self.clean(txt, self.children, self.newlines, self.normalize) txt = self.remove(txt, self.symbols) txt = self.replace(txt, self.torepla...
frankrousseau/weboob
[ 4, 3, 4, 1, 1381825736 ]
def clean(cls, txt, children=True, newlines=True, normalize='NFC'): if not isinstance(txt, basestring): if children: txt = [t.strip() for t in txt.itertext()] else: txt = [txt.text.strip()] txt = u' '.join(txt) # 'foo bar' if newline...
frankrousseau/weboob
[ 4, 3, 4, 1, 1381825736 ]
def remove(cls, txt, symbols): for symbol in symbols: txt = txt.replace(symbol, '') return txt.strip()
frankrousseau/weboob
[ 4, 3, 4, 1, 1381825736 ]
def replace(cls, txt, replace): for before, after in replace: txt = txt.replace(before, after) return txt
frankrousseau/weboob
[ 4, 3, 4, 1, 1381825736 ]
def filter(self, txt): txt = super(Lower, self).filter(txt) return txt.lower()
frankrousseau/weboob
[ 4, 3, 4, 1, 1381825736 ]
def __init__(self, selector=None, replace_dots=False, sign=None, default=_NO_DEFAULT): super(CleanDecimal, self).__init__(selector, default=default) self.replace_dots = replace_dots self.sign = sign
frankrousseau/weboob
[ 4, 3, 4, 1, 1381825736 ]
def filter(self, text): if empty(text): return self.default_or_raise(ParseError('Unable to parse %r' % text)) original_text = text = super(CleanDecimal, self).filter(text) if self.replace_dots: if type(self.replace_dots) is tuple: thousands_sep, decimal_s...
frankrousseau/weboob
[ 4, 3, 4, 1, 1381825736 ]
def filter(self, label): label = re.sub(r'[^A-Za-z0-9]', ' ', label.lower()).strip() label = re.sub(r'\s+', '-', label) return label
frankrousseau/weboob
[ 4, 3, 4, 1, 1381825736 ]
def __init__(self, selector=None, type=None, minlen=0, default=_NO_DEFAULT): super(Type, self).__init__(selector, default=default) self.type_func = type self.minlen = minlen
frankrousseau/weboob
[ 4, 3, 4, 1, 1381825736 ]
def filter(self, txt): if empty(txt): return self.default_or_raise(ParseError('Unable to parse %r' % txt)) if self.minlen is not False and len(txt) <= self.minlen: return self.default_or_raise(ParseError('Unable to parse %r' % txt)) try: return self.type_func(...
frankrousseau/weboob
[ 4, 3, 4, 1, 1381825736 ]
def __init__(self, name): super(Field, self).__init__() self.name = name
frankrousseau/weboob
[ 4, 3, 4, 1, 1381825736 ]
def nth(iterable, n, default=None): "Returns the nth item or a default value, n can be negative, or '*' for all" if n == '*': return iterable if n < 0: iterable = reversed(list(iterable)) n = abs(n) - 1 return next(islice(iterable, n, None), default)
frankrousseau/weboob
[ 4, 3, 4, 1, 1381825736 ]
def __init__(self, selector=None, pattern=None, template=None, nth=0, flags=0, default=_NO_DEFAULT): super(Regexp, self).__init__(selector, default=default) assert pattern is not None self.pattern = pattern self._regex = re.compile(pattern, flags) self.template = template ...
frankrousseau/weboob
[ 4, 3, 4, 1, 1381825736 ]
def filter(self, txt): if isinstance(txt, (tuple, list)): txt = u' '.join([t.strip() for t in txt.itertext()]) m = self._regex.search(txt) if self.nth == 0 else \ nth(self._regex.finditer(txt), self.nth) if not m: msg = 'Unable to find %s %s in %r' % (ordinal...
frankrousseau/weboob
[ 4, 3, 4, 1, 1381825736 ]
def __init__(self, selector, map_dict, default=_NO_DEFAULT): super(Map, self).__init__(selector, default=default) self.map_dict = map_dict
frankrousseau/weboob
[ 4, 3, 4, 1, 1381825736 ]
def filter(self, txt): try: return self.map_dict[txt] except KeyError: return self.default_or_raise(ItemNotFound('Unable to handle %r on %r' % (txt, self.map_dict)))
frankrousseau/weboob
[ 4, 3, 4, 1, 1381825736 ]
def __init__(self, selector=None, default=_NO_DEFAULT, dayfirst=False, translations=None): super(DateTime, self).__init__(selector, default=default) self.dayfirst = dayfirst self.translations = translations
frankrousseau/weboob
[ 4, 3, 4, 1, 1381825736 ]
def filter(self, txt): if empty(txt) or txt == '': return self.default_or_raise(ParseError('Unable to parse %r' % txt)) try: if self.translations: for search, repl in self.translations: txt = search.sub(repl, txt) return parse_date(...
frankrousseau/weboob
[ 4, 3, 4, 1, 1381825736 ]
def __init__(self, selector=None, default=_NO_DEFAULT, dayfirst=False, translations=None): super(Date, self).__init__(selector, default=default, dayfirst=dayfirst, translations=translations)
frankrousseau/weboob
[ 4, 3, 4, 1, 1381825736 ]
def filter(self, txt): datetime = super(Date, self).filter(txt) if hasattr(datetime, 'date'): return datetime.date() else: return datetime
frankrousseau/weboob
[ 4, 3, 4, 1, 1381825736 ]
def __init__(self, selector, date_guesser, **kwargs): super(DateGuesser, self).__init__(selector) self.date_guesser = date_guesser self.kwargs = kwargs
frankrousseau/weboob
[ 4, 3, 4, 1, 1381825736 ]
def __init__(self, selector=None, default=_NO_DEFAULT): super(Time, self).__init__(selector, default=default)
frankrousseau/weboob
[ 4, 3, 4, 1, 1381825736 ]
def filter(self, txt): m = self._regexp.search(txt) if m: kwargs = {} for key, index in self.kwargs.iteritems(): kwargs[key] = int(m.groupdict()[index] or 0) return self.klass(**kwargs) return self.default_or_raise(ParseError('Unable to find t...
frankrousseau/weboob
[ 4, 3, 4, 1, 1381825736 ]
def __init__(self, *args, **kwargs): default = kwargs.pop('default', _NO_DEFAULT) super(MultiFilter, self).__init__(args, default)
frankrousseau/weboob
[ 4, 3, 4, 1, 1381825736 ]
def filter(self, values): raise NotImplementedError()
frankrousseau/weboob
[ 4, 3, 4, 1, 1381825736 ]
def __init__(self, date, time): super(CombineDate, self).__init__(date, time)
frankrousseau/weboob
[ 4, 3, 4, 1, 1381825736 ]
def filter(self, values): return datetime.datetime.combine(values[0], values[1])
frankrousseau/weboob
[ 4, 3, 4, 1, 1381825736 ]
def __init__(self, fmt, *args): super(Format, self).__init__(*args) self.fmt = fmt
frankrousseau/weboob
[ 4, 3, 4, 1, 1381825736 ]
def filter(self, values): return self.fmt % values
frankrousseau/weboob
[ 4, 3, 4, 1, 1381825736 ]
def __init__(self, url_name, **kwargs): super(BrowserURL, self).__init__(*kwargs.values()) self.url_name = url_name self.keys = kwargs.keys()
frankrousseau/weboob
[ 4, 3, 4, 1, 1381825736 ]
def filter(self, values): return values
frankrousseau/weboob
[ 4, 3, 4, 1, 1381825736 ]
def __init__(self, pattern, selector=None, textCleaner=CleanText): super(Join, self).__init__(selector) self.pattern = pattern self.textCleaner = textCleaner
frankrousseau/weboob
[ 4, 3, 4, 1, 1381825736 ]
def filter(self, el): res = u'' for li in el: res += self.pattern % self.textCleaner.clean(li) return res
frankrousseau/weboob
[ 4, 3, 4, 1, 1381825736 ]
def __init__(self, file, **settings): self.file = file self.settings = { "relating_process": None, "related_object": None, } for key, value in settings.items(): self.settings[key] = value
IfcOpenShell/IfcOpenShell
[ 1191, 546, 1191, 377, 1439197394 ]
def apply(self): from absl import flags # pylint: disable=g-import-not-at-top for flag in list(flags.FLAGS): if flag not in ('showprefixforinfo',): delattr(flags.FLAGS, flag)
tensorflow/lingvo
[ 2689, 429, 2689, 115, 1532471428 ]
def test_xavier_wrong_dtype(self): with self.assertRaisesRegexp( TypeError, 'Cannot create initializer for non-floating point type.'): initializers.xavier_initializer(dtype=dtypes.int32) self.assertIsNone(regularizers.l1_regularizer(0.)(None))
google-research/tf-slim
[ 334, 98, 334, 11, 1561681288 ]