Example #1
0
    def test_last(self):
        # base functionality
        arr = [1, 2, 3, 4]

        got = last(arr)
        expected = 4

        self.assertEqual(got, expected)
Example #2
0
def dropLastArray(key: str):
    parts = key.split('.')

    # if the last part of the dict path is an element in an array
    # then just drop that part
    if re.match(r'\[\d+\]', last(parts)):
        return '.'.join(parts[:-1])

    return '.'.join(parts)
Example #3
0
    def fillRest(self, value: Any, steps: int):
        for k in self.run_data:
            arr = self.run_data[k]
            l = last(arr)
            v = value
            if not np.isscalar(l):
                v = np.zeros_like(l)
                v.fill(value)

            fillRest(arr, v, steps)
Example #4
0
def fileName(path):
    parts = path.split('/')
    f = last(parts)
    return f
Example #5
0
def fileName(path: str):
    parts = split(path)
    f = last(parts)
    return f