Calculate the length of the path up to a certain position
181030
def length(self, error=ERROR, min_depth=MIN_DEPTH):
        """"""
        start_point = self.point(0)
        end_point = self.point(1)
        return segment_length(self, 0, 1, start_point, end_point, error, min_depth, 0)
388897
def length(self):
        """"""
        return math.sqrt((self.X * self.X) + (self.Y * self.Y))
908230
def path(self):
        """"""
        out = self.datetime.strftime("%Y-%m-%d")
        out += " "
        ssm = (
            self.datetime - self.datetime.replace(hour=0, minute=0, second=0, microsecond=0)
        ).total_seconds()
        out += str(int(ssm)).zfill(5)
        return out
192158
function getPathDirectory(length, parts) {
  if (!parts) {
    return '';
  }
  return parts
    .slice(length)
    .filter(part => part !== '')
    .join(path.sep);
}
338789
def calc(path):
    '''
    
    '''
    total = 0
    err = None
    if os.path.isdir(path):
        try:
            for entry in os.scandir(path):
                try:
                    is_dir = entry.is_dir(follow_symlinks=False)
                except (PermissionError, FileNotFoundError):
                    err = "!"
                    return total, err
                if is_dir:
                    result = calc(entry.path)
                    total += result[0]
                    err = result[1]
                    if err:
                        return total, err
                else:
                    try:
                        total += entry.stat(follow_symlinks=False).st_size
                    except (PermissionError, FileNotFoundError):
                        err = "!"
                        return total, err
        except (PermissionError, FileNotFoundError):
            err = "!"
            return total, err
    else:
        total += os.path.getsize(path)
    return total, err
897108
function pathDataToString(path) {
    var str = [];
    var data = path.data;
    var dataLength = path.len();
    for (var i = 0; i < dataLength;) {
        var cmd = data[i++];
        var cmdStr = '';
        var nData = 0;
        switch (cmd) {
            case CMD.M:
                cmdStr = 'M';
                nData = 2;
                break;
            case CMD.L:
                cmdStr = 'L';
                nData = 2;
                break;
            case CMD.Q:
                cmdStr = 'Q';
                nData = 4;
                break;
            case CMD.C:
                cmdStr = 'C';
                nData = 6;
                break;
            case CMD.A:
                var cx = data[i++];
                var cy = data[i++];
                var rx = data[i++];
                var ry = data[i++];
                var theta = data[i++];
                var dTheta = data[i++];
                var psi = data[i++];
                var clockwise = data[i++];

                var dThetaPositive = Math.abs(dTheta);
                var isCircle = isAroundZero(dThetaPositive - PI2)
                    && !isAroundZero(dThetaPositive);

                var large = false;
                if (dThetaPositive >= PI2) {
                    large = true;
                }
                else if (isAroundZero(dThetaPositive)) {
                    large = false;
                }
                else {
                    large = (dTheta > -PI && dTheta < 0 || dTheta > PI)
                        === !!clockwise;
                }

                var x0 = round4(cx + rx * mathCos(theta));
                var y0 = round4(cy + ry * mathSin(theta));

                // It will not draw if start point and end point are exactly the same
                // We need to shift the end point with a small value
                // FIXME A better way to draw circle ?
                if (isCircle) {
                    if (clockwise) {
                        dTheta = PI2 - 1e-4;
                    }
                    else {
                        dTheta = -PI2 + 1e-4;
                    }

                    large = true;

                    if (i === 9) {
                        // Move to (x0, y0) only when CMD.A comes at the
                        // first position of a shape.
                        // For instance, when drawing a ring, CMD.A comes
                        // after CMD.M, so it's unnecessary to move to
                        // (x0, y0).
                        str.push('M', x0, y0);
                    }
                }

                var x = round4(cx + rx * mathCos(theta + dTheta));
                var y = round4(cy + ry * mathSin(theta + dTheta));

                // FIXME Ellipse
                str.push('A', round4(rx), round4(ry),
                    mathRound(psi * degree), +large, +clockwise, x, y);
                break;
            case CMD.Z:
                cmdStr = 'Z';
                break;
            case CMD.R:
                var x = round4(data[i++]);
                var y = round4(data[i++]);
                var w = round4(data[i++]);
                var h = round4(data[i++]);
                str.push(
                    'M', x, y,
                    'L', x + w, y,
                    'L', x + w, y + h,
                    'L', x, y + h,
                    'L', x, y
                );
                break;
        }
        cmdStr && str.push(cmdStr);
        for (var j = 0; j < nData; j++) {
            // PENDING With scale
            str.push(round4(data[i++]));
        }
    }
    return str.join(' ');
}
496309
def size(self):
        
        tot = 0
        for p in self.__iter__(overPath=True):
            tot += os.path.getsize(p)
        return tot
1193383
def path_for(self, *args):
        """"""
        if args and args[0].startswith(os.path.sep):
            return os.path.join(*args)
        return os.path.join(self._root_path or os.getcwd(), *args)
709319
function relative(path){
  var startX = 0
  var startY = 0
  var x = 0
  var y = 0

  return path.map(function(seg){
    seg = seg.slice()
    var type = seg[0]
    var command = type.toLowerCase()

    // is absolute
    if (type != command) {
      seg[0] = command
      switch (type) {
        case 'A':
          seg[6] -= x
          seg[7] -= y
          break
        case 'V':
          seg[1] -= y
          break
        case 'H':
          seg[1] -= x
          break
        default:
          for (var i = 1; i < seg.length;) {
            seg[i++] -= x
            seg[i++] -= y
          }
      }
    }

    // update cursor state
    switch (command) {
      case 'z':
        x = startX
        y = startY
        break
      case 'h':
        x += seg[1]
        break
      case 'v':
        y += seg[1]
        break
      case 'm':
        x += seg[1]
        y += seg[2]
        startX += seg[1]
        startY += seg[2]
        break
      default:
        x += seg[seg.length - 2]
        y += seg[seg.length - 1]
    }

    return seg
  })
}
18423
function scale(path, ratio) {
            for (var i = 0, l = path.length; i < l; i++) {
                var cur = path[i];
                cur.x *= ratio;
                cur.y *= ratio;
            }

            return path;
        }
60121
def length(self):
        """"""
        length = self.parse['attributes'].get('Shape_Length')
        if length:
            return round(float(length))
177767
public double pathLength(double delta, double... controlPoints)
    {
        if (delta < 0 || delta > 0.5)
        {
            throw new IllegalArgumentException("illegal delta");
        }
        Point2D.Double p1 = new Point2D.Double();
        Point2D.Double p2 = new Point2D.Double();
        double sum = 0;
        calc(0, p1::setLocation, controlPoints);
        for (double t=delta;t<1.0;t+=delta)
        {
            calc(t, p2::setLocation, controlPoints);
            sum += p1.distance(p2);
            p1.setLocation(p2);
        }
        calc(1.0, p2::setLocation, controlPoints);
        sum += p1.distance(p2);
        return sum;
    }
1172692
def length(self):
        
        length = 0
        for r in self._routes:
            length = length + r.length()

        return length
394561
def length(self, t0=0, t1=1, error=None, min_depth=None):
        """"""
        return abs(self.end - self.start)*(t1-t0)
749079
function(length, opt) {

            var segments = this.segments;
            var numSegments = segments.length;
            if (numSegments === 0) return null; // if segments is an empty array

            var fromStart = true;
            if (length < 0) {
                fromStart = false; // negative lengths mean start calculation from end point
                length = -length; // absolute value
            }

            opt = opt || {};
            var precision = (opt.precision === undefined) ? this.PRECISION : opt.precision;
            var segmentSubdivisions = (opt.segmentSubdivisions === undefined) ? this.getSegmentSubdivisions({ precision: precision }) : opt.segmentSubdivisions;
            // not using localOpt

            var lastVisibleSegmentIndex = null;
            var l = 0; // length so far
            for (var i = (fromStart ? 0 : (numSegments - 1)); (fromStart ? (i < numSegments) : (i >= 0)); (fromStart ? (i++) : (i--))) {

                var segment = segments[i];
                var subdivisions = segmentSubdivisions[i];
                var d = segment.length({ precision: precision, subdivisions: subdivisions });

                if (segment.isVisible) {
                    if (length <= (l + d)) return i;
                    lastVisibleSegmentIndex = i;
                }

                l += d;
            }

            // if length requested is higher than the length of the path, return last visible segment index
            // if no visible segment, return null
            return lastVisibleSegmentIndex;
        }
1325017
def get_path(self, i):
        """"""
        index = (i - 1) // 2
        reverse = (i - 1) % 2
        path = self.paths[index]
        if reverse:
            return path.reversed()
        else:
            return path
214502
def path_join(*args):
    """"""
    return SEP.join((x for x in args if x not in (None, ''))).strip(SEP)