• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

klieret / RandomFileTree / 7253604930

18 Dec 2023 08:44PM UTC coverage: 96.016%. Remained the same
7253604930

Pull #74

github

web-flow
Bump actions/upload-artifact from 3 to 4

Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 3 to 4.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Pull Request #74: Bump actions/upload-artifact from 3 to 4

241 of 251 relevant lines covered (96.02%)

4.78 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

90.48
/randomfiletree/cli.py
1
#!/usr/bin/env python3
2

3
"""Create random directory and file tree.
5✔
4

5
This is done in an iterative fashion: For every iteration, files and folders
6
are created based on set probabilities in all subfolders of the target folder.
7
"""
8

9
import argparse
5✔
10
from randomfiletree.core import iterative_gaussian_tree
5✔
11
from typing import no_type_check
5✔
12

13

14
def parser() -> argparse.ArgumentParser:
5✔
15
    _parser = argparse.ArgumentParser(description=__doc__)
5✔
16
    _parser.add_argument(
5✔
17
        dest="basedir", help="Directory to create file/directory structure in"
18
    )
19
    _parser.add_argument(
5✔
20
        "-d",
21
        "--directories",
22
        default=1,
23
        dest="nfolders",
24
        help="Average number of folders to create in every subfolder of the "
25
        " target folder in every iteration",
26
        type=float,
27
    )
28
    _parser.add_argument(
5✔
29
        "-f",
30
        "--files",
31
        default=1,
32
        dest="nfiles",
33
        help="Average number of files to create in every subfolder of the "
34
        "target folder in every iteration",
35
        type=float,
36
    )
37
    _parser.add_argument(
5✔
38
        "--files-sigma",
39
        default=1,
40
        dest="files_sigma",
41
        help="Spread of number of files created in each step",
42
        type=float,
43
    )
44
    _parser.add_argument(
5✔
45
        "--directories-sigma",
46
        default=1,
47
        dest="folders_sigma",
48
        help="Spread of number of folders created in each step",
49
        type=float,
50
    )
51
    _parser.add_argument(
5✔
52
        "-r",
53
        "--repeat",
54
        default=2,
55
        help="Number of times to traverse existing file/directory structure to "
56
        "create new elements",
57
        type=int,
58
    )
59
    _parser.add_argument(
5✔
60
        "--maxdepth",
61
        default=None,
62
        help="Maximal depth of file/directory structure to create",
63
        type=int,
64
    )
65
    return _parser
5✔
66

67

68
@no_type_check  # TODO rewrite function to make mypy happy with Optional args
5✔
69
def cli(args=None):
5✔
70
    if not args:
5✔
71
        args = parser().parse_args()
×
72
    iterative_gaussian_tree(
5✔
73
        basedir=args.basedir,
74
        nfiles=args.nfiles,
75
        nfolders=args.nfolders,
76
        repeat=args.repeat,
77
        maxdepth=args.maxdepth,
78
        sigma_files=args.files_sigma,
79
        sigma_folders=args.folders_sigma,
80
    )
81

82

83
if __name__ == "__main__":
5✔
84
    cli()
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc