function
stringlengths
11
56k
repo_name
stringlengths
5
60
features
list
def name(self): # The name of the section on a proxy is read-only. return self._name
ArcherSys/ArcherSys
[ 3, 2, 3, 16, 1412356452 ]
def __init__(self, msg=''): self.message = msg Exception.__init__(self, msg)
ArcherSys/ArcherSys
[ 3, 2, 3, 16, 1412356452 ]
def __init__(self, section): Error.__init__(self, 'No section: %r' % (section,)) self.section = section self.args = (section, )
ArcherSys/ArcherSys
[ 3, 2, 3, 16, 1412356452 ]
def __init__(self, section, source=None, lineno=None): msg = [repr(section), " already exists"] if source is not None: message = ["While reading from ", repr(source)] if lineno is not None: message.append(" [line {0:2d}]".format(lineno)) message.append...
ArcherSys/ArcherSys
[ 3, 2, 3, 16, 1412356452 ]
def __init__(self, section, option, source=None, lineno=None): msg = [repr(option), " in section ", repr(section), " already exists"] if source is not None: message = ["While reading from ", repr(source)] if lineno is not None: message.append(" [lin...
ArcherSys/ArcherSys
[ 3, 2, 3, 16, 1412356452 ]
def __init__(self, option, section): Error.__init__(self, "No option %r in section: %r" % (option, section)) self.option = option self.section = section self.args = (option, section)
ArcherSys/ArcherSys
[ 3, 2, 3, 16, 1412356452 ]
def __init__(self, option, section, msg): Error.__init__(self, msg) self.option = option self.section = section self.args = (option, section, msg)
ArcherSys/ArcherSys
[ 3, 2, 3, 16, 1412356452 ]
def __init__(self, option, section, rawval, reference): msg = ("Bad value substitution:\n" "\tsection: [%s]\n" "\toption : %s\n" "\tkey : %s\n" "\trawval : %s\n" % (section, option, reference, rawval)) InterpolationError.__ini...
ArcherSys/ArcherSys
[ 3, 2, 3, 16, 1412356452 ]
def __init__(self, option, section, rawval): msg = ("Value interpolation too deeply recursive:\n" "\tsection: [%s]\n" "\toption : %s\n" "\trawval : %s\n" % (section, option, rawval)) InterpolationError.__init__(self, option, section, msg) ...
ArcherSys/ArcherSys
[ 3, 2, 3, 16, 1412356452 ]
def __init__(self, source=None, filename=None): # Exactly one of `source'/`filename' arguments has to be given. # `filename' kept for compatibility. if filename and source: raise ValueError("Cannot specify both `filename' and `source'. " "Use `source'.") ...
ArcherSys/ArcherSys
[ 3, 2, 3, 16, 1412356452 ]
def filename(self): """Deprecated, use `source'.""" warnings.warn( "The 'filename' attribute will be removed in future versions. " "Use 'source' instead.", DeprecationWarning, stacklevel=2 ) return self.source
ArcherSys/ArcherSys
[ 3, 2, 3, 16, 1412356452 ]
def filename(self, value): """Deprecated, user `source'.""" warnings.warn( "The 'filename' attribute will be removed in future versions. " "Use 'source' instead.", DeprecationWarning, stacklevel=2 ) self.source = value
ArcherSys/ArcherSys
[ 3, 2, 3, 16, 1412356452 ]
def __init__(self, filename, lineno, line): Error.__init__( self, 'File contains no section headers.\nfile: %r, line: %d\n%r' % (filename, lineno, line)) self.source = filename self.lineno = lineno self.line = line self.args = (filename, lineno...
ArcherSys/ArcherSys
[ 3, 2, 3, 16, 1412356452 ]
def before_get(self, parser, section, option, value, defaults): return value
ArcherSys/ArcherSys
[ 3, 2, 3, 16, 1412356452 ]
def before_read(self, parser, section, option, value): return value
ArcherSys/ArcherSys
[ 3, 2, 3, 16, 1412356452 ]
def before_get(self, parser, section, option, value, defaults): L = [] self._interpolate_some(parser, option, L, value, section, defaults, 1) return ''.join(L)
ArcherSys/ArcherSys
[ 3, 2, 3, 16, 1412356452 ]
def _interpolate_some(self, parser, option, accum, rest, section, map, depth): if depth > MAX_INTERPOLATION_DEPTH: raise InterpolationDepthError(option, section, rest) while rest: p = rest.find("%") if p < 0: accum.append(rest...
ArcherSys/ArcherSys
[ 3, 2, 3, 16, 1412356452 ]
def before_get(self, parser, section, option, value, defaults): L = [] self._interpolate_some(parser, option, L, value, section, defaults, 1) return ''.join(L)
ArcherSys/ArcherSys
[ 3, 2, 3, 16, 1412356452 ]
def _interpolate_some(self, parser, option, accum, rest, section, map, depth): if depth > MAX_INTERPOLATION_DEPTH: raise InterpolationDepthError(option, section, rest) while rest: p = rest.find("$") if p < 0: accum.append(rest...
ArcherSys/ArcherSys
[ 3, 2, 3, 16, 1412356452 ]
def before_get(self, parser, section, option, value, vars): rawval = value depth = MAX_INTERPOLATION_DEPTH while depth: # Loop through this until it's done depth -= 1 if value and "%(" in value: replace = functools.partial(self._interpol...
ArcherSys/ArcherSys
[ 3, 2, 3, 16, 1412356452 ]
def _interpolation_replace(match, parser): s = match.group(1) if s is None: return match.group() else: return "%%(%s)s" % parser.optionxform(s)
ArcherSys/ArcherSys
[ 3, 2, 3, 16, 1412356452 ]
def __init__(self, defaults=None, dict_type=_default_dict, allow_no_value=False, *, delimiters=('=', ':'), comment_prefixes=('#', ';'), inline_comment_prefixes=None, strict=True, empty_lines_in_values=True, default_section=DEFAULTSECT, ...
ArcherSys/ArcherSys
[ 3, 2, 3, 16, 1412356452 ]
def sections(self): """Return a list of section names, excluding [DEFAULT]""" # self._sections will never have [DEFAULT] in it return list(self._sections.keys())
ArcherSys/ArcherSys
[ 3, 2, 3, 16, 1412356452 ]
def has_section(self, section): """Indicate whether the named section is present in the configuration. The DEFAULT section is not acknowledged. """ return section in self._sections
ArcherSys/ArcherSys
[ 3, 2, 3, 16, 1412356452 ]
def read(self, filenames, encoding=None): """Read and parse a filename or a list of filenames. Files that cannot be opened are silently ignored; this is designed so that you can specify a list of potential configuration file locations (e.g. current directory, user's home directo...
ArcherSys/ArcherSys
[ 3, 2, 3, 16, 1412356452 ]
def read_string(self, string, source='<string>'): """Read configuration from a given string.""" sfile = io.StringIO(string) self.read_file(sfile, source)
ArcherSys/ArcherSys
[ 3, 2, 3, 16, 1412356452 ]
def readfp(self, fp, filename=None): """Deprecated, use read_file instead.""" warnings.warn( "This method will be removed in future versions. " "Use 'parser.read_file()' instead.", DeprecationWarning, stacklevel=2 ) self.read_file(fp, source=filename)
ArcherSys/ArcherSys
[ 3, 2, 3, 16, 1412356452 ]
def _get(self, section, conv, option, **kwargs): return conv(self.get(section, option, **kwargs))
ArcherSys/ArcherSys
[ 3, 2, 3, 16, 1412356452 ]
def getfloat(self, section, option, *, raw=False, vars=None, fallback=_UNSET): try: return self._get(section, float, option, raw=raw, vars=vars) except (NoSectionError, NoOptionError): if fallback is _UNSET: raise else: ...
ArcherSys/ArcherSys
[ 3, 2, 3, 16, 1412356452 ]
def items(self, section=_UNSET, raw=False, vars=None): """Return a list of (name, value) tuples for each option in a section. All % interpolations are expanded in the return values, based on the defaults passed into the constructor, unless the optional argument `raw' is true. Additiona...
ArcherSys/ArcherSys
[ 3, 2, 3, 16, 1412356452 ]
def optionxform(self, optionstr): return optionstr.lower()
ArcherSys/ArcherSys
[ 3, 2, 3, 16, 1412356452 ]
def set(self, section, option, value=None): """Set an option.""" if value: value = self._interpolation.before_set(self, section, option, value) if not section or section == self.default_section: sectdict = self._defaults ...
ArcherSys/ArcherSys
[ 3, 2, 3, 16, 1412356452 ]
def _write_section(self, fp, section_name, section_items, delimiter): """Write a single section to the specified `fp'.""" fp.write("[{}]\n".format(section_name)) for key, value in section_items: value = self._interpolation.before_write(self, section_name, key, ...
ArcherSys/ArcherSys
[ 3, 2, 3, 16, 1412356452 ]
def remove_section(self, section): """Remove a file section.""" existed = section in self._sections if existed: del self._sections[section] del self._proxies[section] return existed
ArcherSys/ArcherSys
[ 3, 2, 3, 16, 1412356452 ]
def __setitem__(self, key, value): # To conform with the mapping protocol, overwrites existing values in # the section. # XXX this is not atomic if read_dict fails at any point. Then again, # no update method in configparser is atomic in this implementation. if key == self.defau...
ArcherSys/ArcherSys
[ 3, 2, 3, 16, 1412356452 ]
def __contains__(self, key): return key == self.default_section or self.has_section(key)
ArcherSys/ArcherSys
[ 3, 2, 3, 16, 1412356452 ]
def __iter__(self): # XXX does it break when underlying container state changed? return itertools.chain((self.default_section,), self._sections.keys())
ArcherSys/ArcherSys
[ 3, 2, 3, 16, 1412356452 ]
def _join_multiline_values(self): defaults = self.default_section, self._defaults all_sections = itertools.chain((defaults,), self._sections.items()) for section, options in all_sections: for name, val in options.items(): if isin...
ArcherSys/ArcherSys
[ 3, 2, 3, 16, 1412356452 ]
def _unify_values(self, section, vars): """Create a sequence of lookups with 'vars' taking priority over the 'section' which takes priority over the DEFAULTSECT. """ sectiondict = {} try: sectiondict = self._sections[section] except KeyError: if s...
ArcherSys/ArcherSys
[ 3, 2, 3, 16, 1412356452 ]
def _validate_value_types(self, *, section="", option="", value=""): """Raises a TypeError for non-string values. The only legal non-string value if we allow valueless options is None, so we need to check if the value is a string if: - we do not allow valueless options, or ...
ArcherSys/ArcherSys
[ 3, 2, 3, 16, 1412356452 ]
def set(self, section, option, value=None): """Set an option. Extends RawConfigParser.set by validating type and interpolation syntax on the value.""" self._validate_value_types(option=option, value=value) super().set(section, option, value)
ArcherSys/ArcherSys
[ 3, 2, 3, 16, 1412356452 ]
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) warnings.warn( "The SafeConfigParser class has been renamed to ConfigParser " "in Python 3.2. This alias will be removed in future versions." " Use ConfigParser directly instead.", Depr...
ArcherSys/ArcherSys
[ 3, 2, 3, 16, 1412356452 ]
def __init__(self, parser, name): """Creates a view on a section of the specified `name` in `parser`.""" self._parser = parser self._name = name
ArcherSys/ArcherSys
[ 3, 2, 3, 16, 1412356452 ]
def __getitem__(self, key): if not self._parser.has_option(self._name, key): raise KeyError(key) return self._parser.get(self._name, key)
ArcherSys/ArcherSys
[ 3, 2, 3, 16, 1412356452 ]
def __delitem__(self, key): if not (self._parser.has_option(self._name, key) and self._parser.remove_option(self._name, key)): raise KeyError(key)
ArcherSys/ArcherSys
[ 3, 2, 3, 16, 1412356452 ]
def __len__(self): return len(self._options())
ArcherSys/ArcherSys
[ 3, 2, 3, 16, 1412356452 ]
def _options(self): if self._name != self._parser.default_section: return self._parser.options(self._name) else: return self._parser.defaults()
ArcherSys/ArcherSys
[ 3, 2, 3, 16, 1412356452 ]
def getint(self, option, fallback=None, *, raw=False, vars=None): return self._parser.getint(self._name, option, raw=raw, vars=vars, fallback=fallback)
ArcherSys/ArcherSys
[ 3, 2, 3, 16, 1412356452 ]
def getboolean(self, option, fallback=None, *, raw=False, vars=None): return self._parser.getboolean(self._name, option, raw=raw, vars=vars, fallback=fallback)
ArcherSys/ArcherSys
[ 3, 2, 3, 16, 1412356452 ]
def parser(self): # The parser object of the proxy is read-only. return self._parser
ArcherSys/ArcherSys
[ 3, 2, 3, 16, 1412356452 ]
def name(self): # The name of the section on a proxy is read-only. return self._name
ArcherSys/ArcherSys
[ 3, 2, 3, 16, 1412356452 ]
def __init__(self, config): self.printer = config.get_printer() self.reactor = self.printer.get_reactor() self.name = config.get_name().split()[1] self.gcode = self.printer.lookup_object('gcode') gcode_macro = self.printer.load_object(config, 'gcode_macro') self.timer_gco...
KevinOConnor/klipper
[ 6307, 4329, 6307, 57, 1464190926 ]
def _gcode_timer_event(self, eventtime): self.inside_timer = True try: self.gcode.run_script(self.timer_gcode.render()) except Exception: logging.exception("Script running error") nextwake = self.reactor.NEVER if self.repeat: nextwake = eventti...
KevinOConnor/klipper
[ 6307, 4329, 6307, 57, 1464190926 ]
def cmd_UPDATE_DELAYED_GCODE(self, gcmd): self.duration = gcmd.get_float('DURATION', minval=0.) if self.inside_timer: self.repeat = (self.duration != 0.) else: waketime = self.reactor.NEVER if self.duration: waketime = self.reactor.monotonic() ...
KevinOConnor/klipper
[ 6307, 4329, 6307, 57, 1464190926 ]
def __init__(self, default, values=None, type=None, on_change=None, doc=None): self.default = default self.values = values self.type = type self.on_change = on_change self.doc = doc self.__doc__ = self._docstring()
wmayner/pyphi
[ 320, 79, 320, 8, 1396935070 ]
def _docstring(self): default = "``default={}``".format(repr(self.default)) values = ( ", ``values={}``".format(repr(self.values)) if self.values is not None else "" ) on_change = ( ", ``on_change={}``".format(self.on_change.__name__) ...
wmayner/pyphi
[ 320, 79, 320, 8, 1396935070 ]
def __set__(self, obj, value): self._validate(value) obj._values[self.name] = value self._callback(obj)
wmayner/pyphi
[ 320, 79, 320, 8, 1396935070 ]
def _callback(self, obj): """Trigger any callbacks.""" if self.on_change is not None: self.on_change(obj)
wmayner/pyphi
[ 320, 79, 320, 8, 1396935070 ]
def __init__(self): self._values = {} self._loaded_files = [] # Set the default value of each ``Option`` for name, opt in self.options().items(): opt._validate(opt.default) self._values[name] = opt.default # Call hooks for each Option # (This mus...
wmayner/pyphi
[ 320, 79, 320, 8, 1396935070 ]
def __setattr__(self, name, value): if name.startswith("_") or name in self.options().keys(): super().__setattr__(name, value) else: raise ValueError("{} is not a valid config option".format(name))
wmayner/pyphi
[ 320, 79, 320, 8, 1396935070 ]
def options(cls): """Return a dictionary of the ``Option`` objects for this config.""" return {k: v for k, v in cls.__dict__.items() if isinstance(v, Option)}
wmayner/pyphi
[ 320, 79, 320, 8, 1396935070 ]
def load_dict(self, dct): """Load a dictionary of configuration values.""" for k, v in dct.items(): setattr(self, k, v)
wmayner/pyphi
[ 320, 79, 320, 8, 1396935070 ]
def snapshot(self): """Return a snapshot of the current values of this configuration.""" return copy(self._values)
wmayner/pyphi
[ 320, 79, 320, 8, 1396935070 ]
def __init__(self, conf, **new_values): self.conf = conf self.new_values = new_values self.initial_values = conf.snapshot()
wmayner/pyphi
[ 320, 79, 320, 8, 1396935070 ]
def __exit__(self, *exc): """Reset config to initial values; reraise any exceptions.""" self.conf.load_dict(self.initial_values) return False
wmayner/pyphi
[ 320, 79, 320, 8, 1396935070 ]
def configure_joblib(conf): constants.joblib_memory = joblib.Memory( location=conf.FS_CACHE_DIRECTORY, verbose=conf.FS_CACHE_VERBOSITY )
wmayner/pyphi
[ 320, 79, 320, 8, 1396935070 ]
def always_zero(a, b): return 0
wmayner/pyphi
[ 320, 79, 320, 8, 1396935070 ]
def single_node_partitions(mechanism, purview, node_labels=None): for element in mechanism: element = tuple([element]) others = tuple(sorted(set(mechanism) - set(element))) part1 = Part(mechanism=element, purview=()) part2 = Part(mechanism=others, ...
wmayner/pyphi
[ 320, 79, 320, 8, 1396935070 ]
def log(self): """Log current settings.""" log.info("PyPhi v%s", __about__.__version__) if self._loaded_files: log.info("Loaded configuration from %s", self._loaded_files) else: log.info("Using default configuration (no configuration file " "provided)") lo...
wmayner/pyphi
[ 320, 79, 320, 8, 1396935070 ]
def setUp(self): self.oFile = vhdlFile.vhdlFile(lFile) self.assertIsNone(eError)
jeremiah-c-leary/vhdl-style-guide
[ 129, 31, 129, 57, 1499106283 ]
def test_rule_500_upper(self): oRule = ieee.rule_500() oRule.case = 'upper' self.assertTrue(oRule) self.assertEqual(oRule.name, 'ieee') self.assertEqual(oRule.identifier, '500') lExpected = [] lExpected.extend(range(5, 10)) lExpected.extend([12, 13, 15, 1...
jeremiah-c-leary/vhdl-style-guide
[ 129, 31, 129, 57, 1499106283 ]
def test_lva(db_session, client): lva = clubs.lva(owner=users.john()) add_fixtures(db_session, lva) res = client.get("/clubs/{id}".format(id=lva.id)) assert res.status_code == 200 assert res.json == { "id": lva.id, "name": "LV Aachen", "timeCreated": "2015-12-24T12:34:56+00:...
skylines-project/skylines
[ 367, 102, 367, 81, 1324989203 ]
def test_writable(db_session, client): lva = clubs.lva() john = users.john(club=lva) add_fixtures(db_session, lva, john) res = client.get("/clubs/{id}".format(id=lva.id), headers=auth_for(john)) assert res.status_code == 200 assert res.json == { "id": lva.id, "name": "LV Aachen"...
skylines-project/skylines
[ 367, 102, 367, 81, 1324989203 ]
def copy_file(source, destination): """ :param source: The source of the folder for copying :param destination: The destination folder for the file :return: """ destination_folder = os.path.join(settings.BASE_DIR, os.path.dirname(destination)) if not os.path.exists(destination_folder): ...
BirkbeckCTP/janeway
[ 143, 55, 143, 533, 1499695733 ]
def mycb(so_far, total): print('{0} kb transferred out of {1}'.format(so_far / 1024, total / 1024))
BirkbeckCTP/janeway
[ 143, 55, 143, 533, 1499695733 ]
def handle_directory(tmp_path, start_time): print("Copying to backup dir") file_name = '{0}.zip'.format(start_time) copy_file('files/temp/{0}'.format(file_name), settings.BACKUP_DIR)
BirkbeckCTP/janeway
[ 143, 55, 143, 533, 1499695733 ]
def send_email(start_time, e, success=False): admins = models.Account.objects.filter(is_superuser=True) message = '' if not success: message = 'There was an error during the backup process.\n\n ' send_mail( 'Backup', '{0}{1}.'.format(message, e), 'backup@janeway', ...
BirkbeckCTP/janeway
[ 143, 55, 143, 533, 1499695733 ]
def setUpClass(cls): super().setUpClass() cls.account_obj = cls.env["account.account"] cls.model_obj = cls.env["ir.model"] cls.field_obj = cls.env["ir.model.fields"] cls.invoice = cls.env["account.move"].create( {"journal_id": cls.journal.id, "partner_id": cls.partner...
OCA/account-analytic
[ 78, 321, 78, 47, 1402916118 ]
def test_invoice_line_dimension_by_sequence(self): """If dimension is by sequence, I expect, - No duplicated sequence - Selection allowed by sequence, i.e., Concept then Type """ invoice_line_obj = self.env["account.move.line"] # Test no dimension with any sequence ...
OCA/account-analytic
[ 78, 321, 78, 47, 1402916118 ]
def setUpClass(cls): super().setUpClass()
bitmovin/bitmovin-python
[ 40, 21, 40, 3, 1478271716 ]
def tearDownClass(cls): super().tearDownClass()
bitmovin/bitmovin-python
[ 40, 21, 40, 3, 1478271716 ]
def tearDown(self): super().tearDown()
bitmovin/bitmovin-python
[ 40, 21, 40, 3, 1478271716 ]
def test_create_sftp_input_without_name(self): (sample_input, sample_files) = self._get_sample_sftp_input() sample_input.name = None input_resource_response = self.bitmovin.inputs.SFTP.create(sample_input) self.assertIsNotNone(input_resource_response) self.assertIsNotNone(input_r...
bitmovin/bitmovin-python
[ 40, 21, 40, 3, 1478271716 ]
def test_retrieve_sftp_input(self): (sample_input, sample_files) = self._get_sample_sftp_input() created_input_response = self.bitmovin.inputs.SFTP.create(sample_input) self.assertIsNotNone(created_input_response) self.assertIsNotNone(created_input_response.resource) self.assertI...
bitmovin/bitmovin-python
[ 40, 21, 40, 3, 1478271716 ]
def test_list_sftp_inputs(self): (sample_input, sample_files) = self._get_sample_sftp_input() created_input_response = self.bitmovin.inputs.SFTP.create(sample_input) self.assertIsNotNone(created_input_response) self.assertIsNotNone(created_input_response.resource) self.assertIsNo...
bitmovin/bitmovin-python
[ 40, 21, 40, 3, 1478271716 ]
def _compare_sftp_inputs(self, first: SFTPInput, second: SFTPInput): """ :param first: SFTPInput :param second: SFTPInput :return: bool """ self.assertEqual(first.host, second.host) self.assertEqual(first.name, second.name) self.assertEqual(first.descript...
bitmovin/bitmovin-python
[ 40, 21, 40, 3, 1478271716 ]
def __virtual__(): """ Only works on Windows systems with PyWin32 """ if not salt.utils.platform.is_windows(): return False, "WUA: Only available on Windows systems" if not HAS_PYWIN32: return False, "WUA: Requires PyWin32 libraries" if not salt.utils.win_update.HAS_PYWIN32: ...
saltstack/salt
[ 13089, 5388, 13089, 3074, 1298233016 ]
def get(name, download=False, install=False, online=True): """ .. versionadded:: 2017.7.0 Returns details for the named update Args: name (str): The name of the update you're searching for. This can be the GUID, a KB number, or any part of the name of the update. GUIDs...
saltstack/salt
[ 13089, 5388, 13089, 3074, 1298233016 ]
def installed(summary=False, kbs_only=False): """ .. versionadded:: 3001 Get a list of all updates that are currently installed on the system. .. note:: This list may not necessarily match the Update History on the machine. This will only show the updates that apply to the current bui...
saltstack/salt
[ 13089, 5388, 13089, 3074, 1298233016 ]
def install(names): """ .. versionadded:: 2017.7.0 Installs updates that match the list of identifiers. It may be easier to use the list_updates function and set ``install=True``. Args: names (str, list): A single update or a list of updates to install. This can be any ...
saltstack/salt
[ 13089, 5388, 13089, 3074, 1298233016 ]
def set_wu_settings( level=None, recommended=None, featured=None, elevated=None, msupdate=None, day=None, time=None,
saltstack/salt
[ 13089, 5388, 13089, 3074, 1298233016 ]
def get_wu_settings(): """ Get current Windows Update settings. Returns: dict: A dictionary of Windows Update settings: Featured Updates: Boolean value that indicates whether to display notifications for featured updates. Group Policy Required (Read-only):...
saltstack/salt
[ 13089, 5388, 13089, 3074, 1298233016 ]
def get_allowed_auths(self, username): return "publickey,password"
yaybu/touchdown
[ 11, 4, 11, 17, 1410353271 ]
def check_auth_publickey(self, username, key): return paramiko.AUTH_SUCCESSFUL
yaybu/touchdown
[ 11, 4, 11, 17, 1410353271 ]
def check_channel_exec_request(self, channel, command): return True
yaybu/touchdown
[ 11, 4, 11, 17, 1410353271 ]
def check_channel_pty_request( self, channel, term, width, height, pixelwidth, pixelheight, modes
yaybu/touchdown
[ 11, 4, 11, 17, 1410353271 ]
def __enter__(self): self.listen_socket = socket.socket() self.listen_socket.bind(("0.0.0.0", 0)) self.listen_socket.listen(1) self.address, self.port = self.listen_socket.getsockname() self.fixtures.push(lambda *exc_info: self.listen_socket.close()) self.event = threadin...
yaybu/touchdown
[ 11, 4, 11, 17, 1410353271 ]
def update(self, prediction_probs, eviction_mask, oracle_scores): """Updates the value of the metric based on a batch of data. Args: prediction_probs (torch.FloatTensor): batch of probability distributions over cache lines of shape (batch_size, num_cache_lines), each corresponding to a ca...
google-research/google-research
[ 27788, 6881, 27788, 944, 1538678568 ]
def write_to_tensorboard(self, tb_writer, tb_tag, step): """Writes the value of the tracked metric(s) to tensorboard. Args: tb_writer (tf.Writer): tensorboard writer to write to. tb_tag (str): metrics are written to tb_tag/metric_name(s). step (int): the step to use when writing to tensorboar...
google-research/google-research
[ 27788, 6881, 27788, 944, 1538678568 ]
def __init__(self, k): """Sets the value of k to track up to. Args: k (int): metric tracks top-1 to top-k. """ self._k = k self._num_top_i_successes = {"total": [0] * k, "eviction": [0] * k} self._num_accesses = {"total": 0, "eviction": 0}
google-research/google-research
[ 27788, 6881, 27788, 944, 1538678568 ]