Code
stringlengths
103
85.9k
Summary
listlengths
0
94
Please provide a description of the function:def _open_interface(self, client, uuid, iface, key): conn_id = self._validate_connection('open_interface', uuid, key) if conn_id is None: return conn_data = self._connections[uuid] conn_data['last_touch'] = monotonic() ...
[ "Open an interface on a connected device.\n\n Args:\n client (string): The client id who is requesting this operation\n uuid (int): The id of the device we're opening the interface on\n iface (string): The name of the interface that we're opening\n key (string): Th...
Please provide a description of the function:def _disconnect_hanging_devices(self): now = monotonic() for uuid, data in self._connections.items(): if (now - data['last_touch']) > self.client_timeout: self._logger.info("Disconnect inactive client %s from device 0x%X"...
[ "Periodic callback that checks for devices that haven't been used and disconnects them." ]
Please provide a description of the function:def _disconnect_from_device(self, uuid, key, client, unsolicited=False): conn_id = self._validate_connection('disconnect', uuid, key) if conn_id is None: return conn_data = self._connections[uuid] slug = self._build_dev...
[ "Disconnect from a device that we have previously connected to.\n\n Args:\n uuid (int): The unique id of the device\n key (string): A 64 byte string used to secure this connection\n client (string): The client id for who is trying to connect\n to the device.\n ...
Please provide a description of the function:def _connect_to_device(self, uuid, key, client): slug = self._build_device_slug(uuid) message = {'client': client, 'type': 'response', 'operation': 'connect'} self._logger.info("Connection attempt for device %d", uuid) # If someone...
[ "Connect to a device given its uuid\n\n Args:\n uuid (int): The unique id of the device\n key (string): A 64 byte string used to secure this connection\n client (string): The client id for who is trying to connect\n to the device.\n " ]
Please provide a description of the function:def _notify_report(self, device_uuid, event_name, report): if device_uuid not in self._connections: self._logger.debug("Dropping report for device without an active connection, uuid=0x%X", device_uuid) return slug = self._bu...
[ "Notify that a report has been received from a device.\n\n This routine is called synchronously in the event loop by the DeviceManager\n " ]
Please provide a description of the function:def _notify_trace(self, device_uuid, event_name, trace): if device_uuid not in self._connections: self._logger.debug("Dropping trace data for device without an active connection, uuid=0x%X", device_uuid) return conn_data = s...
[ "Notify that we have received tracing data from a device.\n\n This routine is called synchronously in the event loop by the DeviceManager\n " ]
Please provide a description of the function:def _send_accum_trace(self, device_uuid): if device_uuid not in self._connections: self._logger.debug("Dropping trace data for device without an active connection, uuid=0x%X", device_uuid) return conn_data = self._connection...
[ "Send whatever accumulated tracing data we have for the device." ]
Please provide a description of the function:def _on_scan_request(self, sequence, topic, message): if messages.ProbeCommand.matches(message): self._logger.debug("Received probe message on topic %s, message=%s", topic, message) self._loop.add_callback(self._publish_scan_response...
[ "Process a request for scanning information\n\n Args:\n sequence (int:) The sequence number of the packet received\n topic (string): The topic this message was received on\n message_type (string): The type of the packet received\n message (dict): The message itself...
Please provide a description of the function:def _publish_scan_response(self, client): devices = self._manager.scanned_devices converted_devs = [] for uuid, info in devices.items(): slug = self._build_device_slug(uuid) message = {} message['uuid'] ...
[ "Publish a scan response message\n\n The message contains all of the devices that are currently known\n to this agent. Connection strings for direct connections are\n translated to what is appropriate for this agent.\n\n Args:\n client (string): A unique id for the client tha...
Please provide a description of the function:def _versioned_lib_name(env, libnode, version, prefix, suffix, prefix_generator, suffix_generator, **kw): Verbose = False if Verbose: print("_versioned_lib_name: libnode={:r}".format(libnode.get_path())) print("_versioned_lib_name: version={:r}"...
[ "For libnode='/optional/dir/libfoo.so.X.Y.Z' it returns 'libfoo.so'" ]
Please provide a description of the function:def _versioned_lib_suffix(env, suffix, version): Verbose = False if Verbose: print("_versioned_lib_suffix: suffix={:r}".format(suffix)) print("_versioned_lib_suffix: version={:r}".format(version)) if not suffix.endswith(version): suff...
[ "For suffix='.so' and version='0.1.2' it returns '.so.0.1.2'" ]
Please provide a description of the function:def _versioned_lib_soname(env, libnode, version, prefix, suffix, name_func): Verbose = False if Verbose: print("_versioned_lib_soname: version={:r}".format(version)) name = name_func(env, libnode, version, prefix, suffix) if Verbose: prin...
[ "For libnode='/optional/dir/libfoo.so.X.Y.Z' it returns 'libfoo.so.X'" ]
Please provide a description of the function:def _versioned_lib_symlinks(env, libnode, version, prefix, suffix, name_func, soname_func): Verbose = False if Verbose: print("_versioned_lib_symlinks: libnode={:r}".format(libnode.get_path())) print("_versioned_lib_symlinks: version={:r}".forma...
[ "Generate link names that should be created for a versioned shared lirbrary.\n Returns a dictionary in the form { linkname : linktarget }\n " ]
Please provide a description of the function:def _setup_versioned_lib_variables(env, **kw): tool = None try: tool = kw['tool'] except KeyError: pass use_soname = False try: use_soname = kw['use_soname'] except KeyError: pass # The $_SHLIBVERSIONFLAGS define extra commandline flags us...
[ "\n Setup all variables required by the versioning machinery\n " ]
Please provide a description of the function:def generate(env): SCons.Tool.createSharedLibBuilder(env) SCons.Tool.createProgBuilder(env) env['SHLINK'] = '$LINK' env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS -shared') env['SHLINKCOM'] = '$SHLINK -o $TARGET $SHLINKFLAGS $__SHLIBVERSIO...
[ "Add Builders and construction variables for gnulink to an Environment." ]
Please provide a description of the function:def main(argv=None, loop=SharedLoop, max_time=None): should_raise = argv is not None if argv is None: argv = sys.argv[1:] parser = build_parser() cmd_args = parser.parse_args(argv) configure_logging(cmd_args.verbose) logger = logging.g...
[ "Main entry point for iotile-gateway." ]
Please provide a description of the function:def verify(self, obj): if obj is not None: raise ValidationError("Object is not None", reason='%s is not None' % str(obj), object=obj) return obj
[ "Verify that the object conforms to this verifier's schema\n\n Args:\n obj (object): A python object to verify\n\n Raises:\n ValidationError: If there is a problem verifying the dictionary, a\n ValidationError is thrown with at least the reason key set indicating\n...
Please provide a description of the function:def copy(self): return _TimeAnchor(self.reading_id, self.uptime, self.utc, self.is_break, self.exact)
[ "Return a copy of this _TimeAnchor." ]
Please provide a description of the function:def anchor_stream(self, stream_id, converter="rtc"): if isinstance(converter, str): converter = self._known_converters.get(converter) if converter is None: raise ArgumentError("Unknown anchor converter string: %s" % ...
[ "Mark a stream as containing anchor points." ]
Please provide a description of the function:def id_range(self): if len(self._anchor_points) == 0: return (0, 0) return (self._anchor_points[0].reading_id, self._anchor_points[-1].reading_id)
[ "Get the range of archor reading_ids.\n\n Returns:\n (int, int): The lowest and highest reading ids.\n\n If no reading ids have been loaded, (0, 0) is returned.\n " ]
Please provide a description of the function:def convert_rtc(cls, timestamp): if timestamp & (1 << 31): timestamp &= ~(1 << 31) delta = datetime.timedelta(seconds=timestamp) return cls._Y2KReference + delta
[ "Convert a number of seconds since 1/1/2000 to UTC time." ]
Please provide a description of the function:def _convert_epoch_anchor(cls, reading): delta = datetime.timedelta(seconds=reading.value) return cls._EpochReference + delta
[ "Convert a reading containing an epoch timestamp to datetime." ]
Please provide a description of the function:def add_point(self, reading_id, uptime=None, utc=None, is_break=False): if reading_id == 0: return if uptime is None and utc is None: return if uptime is not None and uptime & (1 << 31): if utc is not No...
[ "Add a time point that could be used as a UTC reference." ]
Please provide a description of the function:def add_reading(self, reading): is_break = False utc = None if reading.stream in self._break_streams: is_break = True if reading.stream in self._anchor_streams: utc = self._anchor_streams[reading.stream](rea...
[ "Add an IOTileReading." ]
Please provide a description of the function:def add_report(self, report, ignore_errors=False): if not isinstance(report, SignedListReport): if ignore_errors: return raise ArgumentError("You can only add SignedListReports to a UTCAssigner", report=report) ...
[ "Add all anchors from a report." ]
Please provide a description of the function:def assign_utc(self, reading_id, uptime=None, prefer="before"): if prefer not in ("before", "after"): raise ArgumentError("Invalid prefer parameter: {}, must be 'before' or 'after'".format(prefer)) if len(self._anchor_points) == 0: ...
[ "Assign a utc datetime to a reading id.\n\n This method will return an object with assignment information or None\n if a utc value cannot be assigned. The assignment object returned\n contains a utc property that has the asssigned UTC as well as other\n properties describing how reliabl...
Please provide a description of the function:def ensure_prepared(self): if self._prepared: return exact_count = 0 fixed_count = 0 inexact_count = 0 self._logger.debug("Preparing UTCAssigner (%d total anchors)", len(self._anchor_points)) for curr i...
[ "Calculate and cache UTC values for all exactly known anchor points." ]
Please provide a description of the function:def fix_report(self, report, errors="drop", prefer="before"): if not isinstance(report, SignedListReport): raise ArgumentError("Report must be a SignedListReport", report=report) if errors not in ('drop',): raise ArgumentErr...
[ "Perform utc assignment on all readings in a report.\n\n The returned report will have all reading timestamps in UTC. This only\n works on SignedListReport objects. Note that the report should\n typically have previously been added to the UTC assigner using\n add_report or no reference ...
Please provide a description of the function:def _fix_left(self, reading_id, last, start, found_id): accum_delta = 0 exact = True crossed_break = False if start == 0: return None for curr in self._anchor_points.islice(None, start - 1, reverse=True): ...
[ "Fix a reading by looking for the nearest anchor point before it." ]
Please provide a description of the function:def sconsign_dir(node): if not node._sconsign: import SCons.SConsign node._sconsign = SCons.SConsign.ForDirectory(node) return node._sconsign
[ "Return the .sconsign file info for this directory,\n creating it first if necessary." ]
Please provide a description of the function:def invalidate_node_memos(targets): from traceback import extract_stack # First check if the cache really needs to be flushed. Only # actions run in the SConscript with Execute() seem to be # affected. XXX The way to check if Execute() is in the stacktr...
[ "\n Invalidate the memoized values of all Nodes (files or directories)\n that are associated with the given entries. Has been added to\n clear the cache of nodes affected by a direct execution of an\n action (e.g. Delete/Copy/Chmod). Existing Node caches become\n inconsistent if the action is run th...
Please provide a description of the function:def __get_base_path(self): entry = self.get() return SCons.Subst.SpecialAttrWrapper(SCons.Util.splitext(entry.get_path())[0], entry.name + "_base")
[ "Return the file's directory and file name, with the\n suffix stripped." ]
Please provide a description of the function:def __get_posix_path(self): if os_sep_is_slash: return self else: entry = self.get() r = entry.get_path().replace(OS_SEP, '/') return SCons.Subst.SpecialAttrWrapper(r, entry.name + "_posix")
[ "Return the path with / as the path separator,\n regardless of platform." ]
Please provide a description of the function:def __get_windows_path(self): if OS_SEP == '\\': return self else: entry = self.get() r = entry.get_path().replace(OS_SEP, '\\') return SCons.Subst.SpecialAttrWrapper(r, entry.name + "_windows")
[ "Return the path with \\ as the path separator,\n regardless of platform." ]
Please provide a description of the function:def must_be_same(self, klass): if isinstance(self, klass) or klass is Entry: return raise TypeError("Tried to lookup %s '%s' as a %s." %\ (self.__class__.__name__, self.get_internal_path(), klass.__name__))
[ "\n This node, which already existed, is being looked up as the\n specified klass. Raise an exception if it isn't.\n " ]
Please provide a description of the function:def srcnode(self): srcdir_list = self.dir.srcdir_list() if srcdir_list: srcnode = srcdir_list[0].Entry(self.name) srcnode.must_be_same(self.__class__) return srcnode return self
[ "If this node is in a build path, return the node\n corresponding to its source file. Otherwise, return\n ourself.\n " ]
Please provide a description of the function:def get_path(self, dir=None): if not dir: dir = self.fs.getcwd() if self == dir: return '.' path_elems = self.get_path_elements() pathname = '' try: i = path_elems.index(dir) except ValueError: ...
[ "Return path relative to the current working directory of the\n Node.FS.Base object that owns us." ]
Please provide a description of the function:def set_src_builder(self, builder): self.sbuilder = builder if not self.has_builder(): self.builder_set(builder)
[ "Set the source code builder for this node." ]
Please provide a description of the function:def src_builder(self): try: scb = self.sbuilder except AttributeError: scb = self.dir.src_builder() self.sbuilder = scb return scb
[ "Fetch the source code builder for this node.\n\n If there isn't one, we cache the source code builder specified\n for the directory (which in turn will cache the value from its\n parent directory, and so on up to the file system root).\n " ]
Please provide a description of the function:def Rfindalldirs(self, pathlist): try: memo_dict = self._memo['Rfindalldirs'] except KeyError: memo_dict = {} self._memo['Rfindalldirs'] = memo_dict else: try: return memo_dict[p...
[ "\n Return all of the directories for a given path list, including\n corresponding \"backing\" directories in any repositories.\n\n The Node lookups are relative to this Node (typically a\n directory), so memoizing result saves cycles from looking\n up the same path for each targe...
Please provide a description of the function:def RDirs(self, pathlist): cwd = self.cwd or self.fs._cwd return cwd.Rfindalldirs(pathlist)
[ "Search for a list of directories in the Repository list." ]
Please provide a description of the function:def rfile(self): self.__class__ = File self._morph() self.clear() return File.rfile(self)
[ "We're a generic Entry, but the caller is actually looking for\n a File at this point, so morph into one." ]
Please provide a description of the function:def get_text_contents(self): try: self = self.disambiguate(must_exist=1) except SCons.Errors.UserError: # There was nothing on disk with which to disambiguate # this entry. Leave it as an Entry, but return a null ...
[ "Fetch the decoded text contents of a Unicode encoded Entry.\n\n Since this should return the text contents from the file\n system, we check to see into what sort of subclass we should\n morph this Entry." ]
Please provide a description of the function:def must_be_same(self, klass): if self.__class__ is not klass: self.__class__ = klass self._morph() self.clear()
[ "Called to make sure a Node is a Dir. Since we're an\n Entry, we can morph into one." ]
Please provide a description of the function:def chdir(self, dir, change_os_dir=0): curr=self._cwd try: if dir is not None: self._cwd = dir if change_os_dir: os.chdir(dir.get_abspath()) except OSError: self._cwd...
[ "Change the current working directory for lookups.\n If change_os_dir is true, we will also change the \"real\" cwd\n to match.\n " ]
Please provide a description of the function:def get_root(self, drive): drive = _my_normcase(drive) try: return self.Root[drive] except KeyError: root = RootDir(drive, self) self.Root[drive] = root if not drive: self.Root[s...
[ "\n Returns the root directory for the specified drive, creating\n it if necessary.\n " ]
Please provide a description of the function:def _lookup(self, p, directory, fsclass, create=1): if isinstance(p, Base): # It's already a Node.FS object. Make sure it's the right # class and return. p.must_be_same(fsclass) return p # str(p) in ca...
[ "\n The generic entry point for Node lookup with user-supplied data.\n\n This translates arbitrary input into a canonical Node.FS object\n of the specified fsclass. The general approach for strings is\n to turn it into a fully normalized absolute path and then call\n the root dir...
Please provide a description of the function:def Entry(self, name, directory = None, create = 1): return self._lookup(name, directory, Entry, create)
[ "Look up or create a generic Entry node with the specified name.\n If the name is a relative path (begins with ./, ../, or a file\n name), then it is looked up relative to the supplied directory\n node, or to the top level directory of the FS (supplied at\n construction time) if no direc...
Please provide a description of the function:def File(self, name, directory = None, create = 1): return self._lookup(name, directory, File, create)
[ "Look up or create a File node with the specified name. If\n the name is a relative path (begins with ./, ../, or a file name),\n then it is looked up relative to the supplied directory node,\n or to the top level directory of the FS (supplied at construction\n time) if no directory is ...
Please provide a description of the function:def Dir(self, name, directory = None, create = True): return self._lookup(name, directory, Dir, create)
[ "Look up or create a Dir node with the specified name. If\n the name is a relative path (begins with ./, ../, or a file name),\n then it is looked up relative to the supplied directory node,\n or to the top level directory of the FS (supplied at construction\n time) if no directory is s...
Please provide a description of the function:def VariantDir(self, variant_dir, src_dir, duplicate=1): if not isinstance(src_dir, SCons.Node.Node): src_dir = self.Dir(src_dir) if not isinstance(variant_dir, SCons.Node.Node): variant_dir = self.Dir(variant_dir) if...
[ "Link the supplied variant directory to the source directory\n for purposes of building files." ]
Please provide a description of the function:def Repository(self, *dirs): for d in dirs: if not isinstance(d, SCons.Node.Node): d = self.Dir(d) self.Top.addRepository(d)
[ "Specify Repository directories to search." ]
Please provide a description of the function:def PyPackageDir(self, modulename): dirpath = '' if sys.version_info[0] < 3 or (sys.version_info[0] == 3 and sys.version_info[1] in (0,1,2,3,4)): # Python2 Code import imp splitname = modulename.split('.') ...
[ "Locate the directory of a given python module name\n\t\t\n For example scons might resolve to\n Windows: C:\\Python27\\Lib\\site-packages\\scons-2.5.1\n Linux: /usr/lib/scons\n\n This can be useful when we want to determine a toolpath based on a python module name" ]
Please provide a description of the function:def variant_dir_target_climb(self, orig, dir, tail): targets = [] message = None fmt = "building associated VariantDir targets: %s" start_dir = dir while dir: for bd in dir.variant_dirs: if start_di...
[ "Create targets in corresponding variant directories\n\n Climb the directory tree, and look up path names\n relative to any linked variant directories we find.\n\n Even though this loops and walks up the tree, we don't memoize\n the return value because this is really only used to proces...
Please provide a description of the function:def Glob(self, pathname, ondisk=True, source=True, strings=False, exclude=None, cwd=None): if cwd is None: cwd = self.getcwd() return cwd.glob(pathname, ondisk, source, strings, exclude)
[ "\n Globs\n\n This is mainly a shim layer\n " ]
Please provide a description of the function:def _morph(self): self.repositories = [] self.srcdir = None self.entries = {} self.entries['.'] = self self.entries['..'] = self.dir self.cwd = self self.searched = 0 self._sconsign = None sel...
[ "Turn a file system Node (either a freshly initialized directory\n object or a separate Entry object) into a proper directory object.\n\n Set up this directory's entries and hook it into the file\n system tree. Specify that directories (this Node) don't use\n signatures for calculating ...
Please provide a description of the function:def __clearRepositoryCache(self, duplicate=None): for node in list(self.entries.values()): if node != self.dir: if node != self and isinstance(node, Dir): node.__clearRepositoryCache(duplicate) ...
[ "Called when we change the repository(ies) for a directory.\n This clears any cached information that is invalidated by changing\n the repository." ]
Please provide a description of the function:def Dir(self, name, create=True): return self.fs.Dir(name, self, create)
[ "\n Looks up or creates a directory node named 'name' relative to\n this directory.\n " ]
Please provide a description of the function:def link(self, srcdir, duplicate): self.srcdir = srcdir self.duplicate = duplicate self.__clearRepositoryCache(duplicate) srcdir.variant_dirs.append(self)
[ "Set this directory as the variant directory for the\n supplied source directory." ]
Please provide a description of the function:def getRepositories(self): if self.srcdir and not self.duplicate: return self.srcdir.get_all_rdirs() + self.repositories return self.repositories
[ "Returns a list of repositories for this directory.\n " ]
Please provide a description of the function:def rel_path(self, other): # This complicated and expensive method, which constructs relative # paths between arbitrary Node.FS objects, is no longer used # by SCons itself. It was introduced to store dependency paths # in .sconsign...
[ "Return a path to \"other\" relative to this directory.\n " ]
Please provide a description of the function:def get_found_includes(self, env, scanner, path): if not scanner: return [] # Clear cached info for this Dir. If we already visited this # directory on our walk down the tree (because we didn't know at # that point it was...
[ "Return this directory's implicit dependencies.\n\n We don't bother caching the results because the scan typically\n shouldn't be requested more than once (as opposed to scanning\n .h file contents, which can be requested as many times as the\n files is #included by other files).\n ...
Please provide a description of the function:def build(self, **kw): global MkdirBuilder if self.builder is not MkdirBuilder: SCons.Node.Node.build(self, **kw)
[ "A null \"builder\" for directories." ]
Please provide a description of the function:def _create(self): listDirs = [] parent = self while parent: if parent.exists(): break listDirs.append(parent) p = parent.up() if p is None: # Don't use while: - ...
[ "Create this directory, silently and without worrying about\n whether the builder is the default or not." ]
Please provide a description of the function:def is_up_to_date(self): if self.builder is not MkdirBuilder and not self.exists(): return 0 up_to_date = SCons.Node.up_to_date for kid in self.children(): if kid.get_state() > up_to_date: return 0 ...
[ "If any child is not up-to-date, then this directory isn't,\n either." ]
Please provide a description of the function:def get_timestamp(self): stamp = 0 for kid in self.children(): if kid.get_timestamp() > stamp: stamp = kid.get_timestamp() return stamp
[ "Return the latest timestamp from among our children" ]
Please provide a description of the function:def entry_exists_on_disk(self, name): try: d = self.on_disk_entries except AttributeError: d = {} try: entries = os.listdir(self._abspath) except OSError: pass ...
[ " Searches through the file/dir entries of the current\n directory, and returns True if a physical entry with the given\n name could be found.\n\n @see rentry_exists_on_disk\n " ]
Please provide a description of the function:def rentry_exists_on_disk(self, name): rentry_exists = self.entry_exists_on_disk(name) if not rentry_exists: # Search through the repository folders norm_name = _my_normcase(name) for rdir in self.get_all_rdirs():...
[ " Searches through the file/dir entries of the current\n *and* all its remote directories (repos), and returns\n True if a physical entry with the given name could be found.\n The local directory (self) gets searched first, so\n repositories take a lower precedence regard...
Please provide a description of the function:def walk(self, func, arg): entries = self.entries names = list(entries.keys()) names.remove('.') names.remove('..') func(arg, self, names) for dirname in [n for n in names if isinstance(entries[n], Dir)]: e...
[ "\n Walk this directory tree by calling the specified function\n for each directory in the tree.\n\n This behaves like the os.path.walk() function, but for in-memory\n Node.FS.Dir objects. The function takes the same arguments as\n the functions passed to os.path.walk():\n\n ...
Please provide a description of the function:def glob(self, pathname, ondisk=True, source=False, strings=False, exclude=None): dirname, basename = os.path.split(pathname) if not dirname: result = self._glob1(basename, ondisk, source, strings) else: if has_glob_ma...
[ "\n Returns a list of Nodes (or strings) matching a specified\n pathname pattern.\n\n Pathname patterns follow UNIX shell semantics: * matches\n any-length strings of any characters, ? matches any character,\n and [] can enclose lists or ranges of characters. Matches do\n ...
Please provide a description of the function:def _glob1(self, pattern, ondisk=True, source=False, strings=False): search_dir_list = self.get_all_rdirs() for srcdir in self.srcdir_list(): search_dir_list.extend(srcdir.get_all_rdirs()) selfEntry = self.Entry names = [...
[ "\n Globs for and returns a list of entry names matching a single\n pattern in this directory.\n\n This searches any repositories and source directories for\n corresponding entries and returns a Node (or string) relative\n to the current directory if an entry is found anywhere.\n\...
Please provide a description of the function:def _morph(self): self.repositories = [] self.srcdir = None self.entries = {} self.entries['.'] = self self.entries['..'] = self.dir self.cwd = self self.searched = 0 self._sconsign = None sel...
[ "Turn a file system Node (either a freshly initialized directory\n object or a separate Entry object) into a proper directory object.\n\n Set up this directory's entries and hook it into the file\n system tree. Specify that directories (this Node) don't use\n signatures for calculating ...
Please provide a description of the function:def _lookup_abs(self, p, klass, create=1): k = _my_normcase(p) try: result = self._lookupDict[k] except KeyError: if not create: msg = "No such file or directory: '%s' in '%s' (and create is False)" % (...
[ "\n Fast (?) lookup of a *normalized* absolute path.\n\n This method is intended for use by internal lookups with\n already-normalized path data. For general-purpose lookups,\n use the FS.Entry(), FS.Dir() or FS.File() methods.\n\n The caller is responsible for making sure we're ...
Please provide a description of the function:def convert_to_sconsign(self): if os_sep_is_slash: node_to_str = str else: def node_to_str(n): try: s = n.get_internal_path() except AttributeError: s = s...
[ "\n Converts this FileBuildInfo object for writing to a .sconsign file\n\n This replaces each Node in our various dependency lists with its\n usual string representation: relative to the top-level SConstruct\n directory, or an absolute path if it's outside.\n " ]
Please provide a description of the function:def prepare_dependencies(self): attrs = [ ('bsources', 'bsourcesigs'), ('bdepends', 'bdependsigs'), ('bimplicit', 'bimplicitsigs'), ] for (nattr, sattr) in attrs: try: strings = ...
[ "\n Prepares a FileBuildInfo object for explaining what changed\n\n The bsources, bdepends and bimplicit lists have all been\n stored on disk as paths relative to the top-level SConstruct\n directory. Convert the strings to actual Nodes (for use by the\n --debug=explain code and ...
Please provide a description of the function:def Dir(self, name, create=True): return self.dir.Dir(name, create=create)
[ "Create a directory node named 'name' relative to\n the directory of this file." ]
Please provide a description of the function:def _morph(self): self.scanner_paths = {} if not hasattr(self, '_local'): self._local = 0 if not hasattr(self, 'released_target_info'): self.released_target_info = False self.store_info = 1 self._func_...
[ "Turn a file system node into a File object." ]
Please provide a description of the function:def get_content_hash(self): if not self.rexists(): return SCons.Util.MD5signature('') fname = self.rfile().get_abspath() try: cs = SCons.Util.MD5filesignature(fname, chunksize=SCons.Node.FS.File.md5_chu...
[ "\n Compute and return the MD5 hash for this file.\n " ]
Please provide a description of the function:def get_found_includes(self, env, scanner, path): memo_key = (id(env), id(scanner), path) try: memo_dict = self._memo['get_found_includes'] except KeyError: memo_dict = {} self._memo['get_found_includes'] =...
[ "Return the included implicit dependencies in this file.\n Cache results so we only scan the file once per path\n regardless of how many times this information is requested.\n " ]
Please provide a description of the function:def push_to_cache(self): # This should get called before the Nodes' .built() method is # called, which would clear the build signature if the file has # a source scanner. # # We have to clear the local memoized values *before*...
[ "Try to push the node into a cache\n " ]
Please provide a description of the function:def retrieve_from_cache(self): if self.nocache: return None if not self.is_derived(): return None return self.get_build_env().get_CacheDir().retrieve(self)
[ "Try to retrieve the node's content from a cache\n\n This method is called from multiple threads in a parallel build,\n so only do thread safe stuff here. Do thread unsafe stuff in\n built().\n\n Returns true if the node was successfully retrieved.\n " ]
Please provide a description of the function:def release_target_info(self): if (self.released_target_info or SCons.Node.interactive): return if not hasattr(self.attributes, 'keep_targetinfo'): # Cache some required values, before releasing # stuff like env, ...
[ "Called just after this node has been marked\n up-to-date or was built completely.\n\n This is where we try to release as many target node infos\n as possible for clean builds and update runs, in order\n to minimize the overall memory consumption.\n\n We'd like to remove a lo...
Please provide a description of the function:def has_src_builder(self): try: scb = self.sbuilder except AttributeError: scb = self.sbuilder = self.find_src_builder() return scb is not None
[ "Return whether this Node has a source builder or not.\n\n If this Node doesn't have an explicit source code builder, this\n is where we figure out, on the fly, if there's a transparent\n source code builder for it.\n\n Note that if we found a source builder, we also set the\n sel...
Please provide a description of the function:def alter_targets(self): if self.is_derived(): return [], None return self.fs.variant_dir_target_climb(self, self.dir, [self.name])
[ "Return any corresponding targets in a variant directory.\n " ]
Please provide a description of the function:def prepare(self): SCons.Node.Node.prepare(self) if self.get_state() != SCons.Node.up_to_date: if self.exists(): if self.is_derived() and not self.precious: self._rmv_existing() else: ...
[ "Prepare for this file to be created." ]
Please provide a description of the function:def remove(self): if self.exists() or self.islink(): self.fs.unlink(self.get_internal_path()) return 1 return None
[ "Remove this file." ]
Please provide a description of the function:def get_max_drift_csig(self): old = self.get_stored_info() mtime = self.get_timestamp() max_drift = self.fs.max_drift if max_drift > 0: if (time.time() - mtime) > max_drift: try: n = ol...
[ "\n Returns the content signature currently stored for this node\n if it's been unmodified longer than the max_drift value, or the\n max_drift value is 0. Returns None otherwise.\n " ]
Please provide a description of the function:def get_csig(self): ninfo = self.get_ninfo() try: return ninfo.csig except AttributeError: pass csig = self.get_max_drift_csig() if csig is None: try: if self.get_size() < ...
[ "\n Generate a node's content signature, the digested signature\n of its content.\n\n node - the node\n cache - alternate node to use for the signature cache\n returns - the content signature\n " ]
Please provide a description of the function:def built(self): SCons.Node.Node.built(self) if (not SCons.Node.interactive and not hasattr(self.attributes, 'keep_targetinfo')): # Ensure that the build infos get computed and cached... SCons.Node.store_info_map...
[ "Called just after this File node is successfully built.\n\n Just like for 'release_target_info' we try to release\n some more target node attributes in order to minimize the\n overall memory consumption.\n\n @see: release_target_info\n " ]
Please provide a description of the function:def changed(self, node=None, allowcache=False): if node is None: try: return self._memo['changed'] except KeyError: pass has_changed = SCons.Node.Node.changed(self, node) if allowcache:...
[ "\n Returns if the node is up-to-date with respect to the BuildInfo\n stored last time it was built.\n\n For File nodes this is basically a wrapper around Node.changed(),\n but we allow the return value to get cached after the reference\n to the Executor got released in release_ta...
Please provide a description of the function:def get_cachedir_csig(self): try: return self.cachedir_csig except AttributeError: pass cachedir, cachefile = self.get_build_env().get_CacheDir().cachepath(self) if not self.exists() and cachefile and os.path....
[ "\n Fetch a Node's content signature for purposes of computing\n another Node's cachesig.\n\n This is a wrapper around the normal get_csig() method that handles\n the somewhat obscure case of using CacheDir with the -n option.\n Any files that don't exist would normally be \"built...
Please provide a description of the function:def get_contents_sig(self): try: return self.contentsig except AttributeError: pass executor = self.get_executor() result = self.contentsig = SCons.Util.MD5signature(executor.get_contents()) return r...
[ "\n A helper method for get_cachedir_bsig.\n\n It computes and returns the signature for this\n node's contents.\n " ]
Please provide a description of the function:def get_cachedir_bsig(self): try: return self.cachesig except AttributeError: pass # Collect signatures for all children children = self.children() sigs = [n.get_cachedir_csig() for n in children] ...
[ "\n Return the signature for a cached file, including\n its children.\n\n It adds the path of the cached file to the cache signature,\n because multiple targets built by the same action will all\n have the same build signature, and we have to differentiate\n them somehow.\n...
Please provide a description of the function:def filedir_lookup(self, p, fd=None): if fd is None: fd = self.default_filedir dir, name = os.path.split(fd) drive, d = _my_splitdrive(dir) if not name and d[:1] in ('/', OS_SEP): #return p.fs.get_root(drive).d...
[ "\n A helper method for find_file() that looks up a directory for\n a file we're trying to find. This only creates the Dir Node if\n it exists on-disk, since if the directory doesn't exist we know\n we won't find any files in it... :-)\n\n It would be more compact to just use th...
Please provide a description of the function:def find_file(self, filename, paths, verbose=None): memo_key = self._find_file_key(filename, paths) try: memo_dict = self._memo['find_file'] except KeyError: memo_dict = {} self._memo['find_file'] = memo_di...
[ "\n Find a node corresponding to either a derived file or a file that exists already.\n\n Only the first file found is returned, and none is returned if no file is found.\n\n filename: A filename to find\n paths: A list of directory path *nodes* to search in. Can be represented as a lis...
Please provide a description of the function:def run(self, resources): hwman = resources['connection'] updater = hwman.hwman.app(name='device_updater') updater.run_script(self._script, no_reboot=self._no_reboot)
[ "Actually send the trub script.\n\n Args:\n resources (dict): A dictionary containing the required resources that\n we needed access to in order to perform this step.\n " ]
Please provide a description of the function:def process_gatt_service(services, event): length = len(event.payload) - 5 handle, start, end, uuid = unpack('<BHH%ds' % length, event.payload) uuid = process_uuid(uuid) services[uuid] = {'uuid_raw': uuid, 'start_handle': start, 'end_handle': end}
[ "Process a BGAPI event containing a GATT service description and add it to a dictionary\n\n Args:\n services (dict): A dictionary of discovered services that is updated with this event\n event (BGAPIPacket): An event containing a GATT service\n\n " ]
Please provide a description of the function:def handle_to_uuid(handle, services): for service in services.values(): for char_uuid, char_def in service['characteristics'].items(): if char_def['handle'] == handle: return char_uuid raise ValueError("Handle not found in G...
[ "Find the corresponding UUID for an attribute handle" ]
Please provide a description of the function:def _text2bool(val): lval = val.lower() if lval in __true_strings: return True if lval in __false_strings: return False raise ValueError("Invalid value for boolean option: %s" % val)
[ "\n Converts strings to True/False depending on the 'truth' expressed by\n the string. If the string can't be converted, the original value\n will be returned.\n\n See '__true_strings' and '__false_strings' for values considered\n 'true' or 'false respectively.\n\n This is usable as 'converter' fo...
Please provide a description of the function:def _validator(key, val, env): if not env[key] in (True, False): raise SCons.Errors.UserError( 'Invalid value for boolean option %s: %s' % (key, env[key]))
[ "\n Validates the given value to be either '0' or '1'.\n \n This is usable as 'validator' for SCons' Variables.\n " ]