Calculate the oxum for a given path
355490
def getOxum(dataPath):
    

    fileCount = 0L
    fileSizeTotal = 0L
    for root, dirs, files in os.walk(dataPath):
        for fileName in files:
            fullName = os.path.join(root, fileName)
            stats = os.stat(fullName)
            fileSizeTotal += stats.st_size
            fileCount += 1
    return "%s.%s" % (fileSizeTotal, fileCount)
352638
def get_path(num):
        
        num = int(num)
        dig_len = len(str(num))
        paths = []
        for i in range(dig_len - 2):
            divisor = 10 ** (dig_len - i - 1)
            paths.append(
                "{}-{}".format((num // divisor) * divisor, (((num // divisor) + 1) * divisor) - 1)
            )
        return "/".join(paths)
242009
function findValueByPath(jsonData, path){
    var errorParts = false;
    path.split('.').forEach(function(part){
        if(!errorParts){
            jsonData = jsonData[part];
            if(!jsonData) errorParts = true;
        }
    });
    return errorParts ? 0 : parseFloat(jsonData);
}
1184618
function getPath(path, callback) {
  fs.lstat(path, function(err, stats) {
    if(err) return callback(err);

    // Check if it's a link
    if(stats.isSymbolicLink()) fs.readlink(path, callback);

    callback(err, path);
  });
}
1219678
def _calculate_osdb_hash(self):
        
        log.debug('_calculate_OSDB_hash() of "{path}" ...'.format(path=self._filepath))
        f = self._filepath.open(mode='rb')

        file_size = self.get_size()

        longlong_format = 'Q'  # unsigned long long little endian
        size_longlong = struct.calcsize(longlong_format)

        block_size = min(file_size, 64 << 10)  # 64kiB
        block_size = block_size & ~(size_longlong - 1)  # lower round on multiple of longlong

        nb_longlong = block_size // size_longlong
        fmt = '<{nbll}{member_format}'.format(
            nbll=nb_longlong,
            member_format=longlong_format)

        hash_int = file_size

        buffer = f.read(block_size)
        list_longlong = struct.unpack(fmt, buffer)
        hash_int += sum(list_longlong)

        f.seek(-block_size, os.SEEK_END)
        buffer = f.read(block_size)
        list_longlong = struct.unpack(fmt, buffer)
        hash_int += sum(list_longlong)

        f.close()
        hash_str = '{:016x}'.format(hash_int)[-16:]
        log.debug('hash("{}")={}'.format(self.get_filepath(), hash_str))
        return hash_str
798604
def abspath(self, path):
        """"""
        return os.path.abspath(os.path.join(os.path.dirname(self.path), path))
1298313
def __visit_index_path(self, src, p, k, v):
        
        cp = p + (k,)
        self.path_index[cp] = self.indexed_obj_factory(p, k, v, self.path_index.get(cp))
        if cp in self.path_index:
            # if self.path_index[cp].assert_val_equals(v):
            #     raise ValueError('unexpected value change at path_index[{}]'.format(cp))
            self.path_index[cp].add_src(src)
        else:
            self.path_index[cp] = Flobject(val=v, path=cp, srcs=set([src]))
875208
def path2edges(path):
    """"""
    node_a, node_b = tee(path)
    next(node_b, None)
    return zip(node_a, node_b)
1141202
def recursive_mtime(path, newest=True):
    """"""
    if os.path.isfile(path):
        return mtime(path)
    current_extreme = None
    for dirname, _, filenames in os.walk(path, topdown=False):
        for filename in filenames:
            mt = mtime(os.path.join(dirname, filename))
            if newest:  # Put outside of loop?
                if mt >= (current_extreme or mt):
                    current_extreme = mt
            elif mt <= (current_extreme or mt):
                current_extreme = mt
    return current_extreme
722285
def has_path_sum(root, sum):
    
    if root is None:
        return False
    if root.left is None and root.right is None and root.val == sum:
        return True
    sum -= root.val
    return has_path_sum(root.left, sum) or has_path_sum(root.right, sum)
214502
def path_join(*args):
    """"""
    return SEP.join((x for x in args if x not in (None, ''))).strip(SEP)
467214
def relpath(path, start=posixpath.curdir):
    """"""
    if not path:
        raise ValueError("no path specified")

    start_list = posixpath.abspath(start).split(posixpath.sep)
    path_list = posixpath.abspath(path).split(posixpath.sep)

    # Work out how much of the filepath is shared by start and path.
    i = len(posixpath.commonprefix([start_list, path_list]))

    rel_list = [posixpath.pardir] * (len(start_list) - i) + path_list[i:]
    if not rel_list:
        return posixpath.curdir
    return posixpath.join(*rel_list)
153885
function getValueByPath(o, path) {
        for (var i = 0, len = path.length; o !== undefined && i < len; i++) {
            o = o[path[i]];
        }
        return o;
    }
168206
def display_path(path):
    """"""
    path = os.path.normcase(os.path.abspath(path))
    if path.startswith(os.getcwd() + os.path.sep):
        path = '.' + path[len(os.getcwd()):]
    return path
174471
def get_disk_usage(path):
    
    cmd = 'du -sh --block-size=1 {0}'.format(path)
    total = getoutput(cmd).split()[0]
    return int(total)
792411
def load(cls, path):
        
        data = json.load(open(path))

        weights = data['weights']
        weights = np.asarray(weights, dtype=np.float64)

        s = cls(data['map_dimensions'],
                data['params']['lr']['orig'],
                data['data_dimensionality'],
                influence=data['params']['infl']['orig'],
                lr_lambda=data['params']['lr']['factor'],
                infl_lambda=data['params']['infl']['factor'])

        s.weights = weights
        s.trained = True

        return s
905320
def _calculateXi(self, r):
        
        a = self._a
        return  (r - a)/(r + a)