skilleter-thingy 0.0.49__tar.gz → 0.0.51__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of skilleter-thingy might be problematic. Click here for more details.

Files changed (74) hide show
  1. {skilleter_thingy-0.0.49/skilleter_thingy.egg-info → skilleter_thingy-0.0.51}/PKG-INFO +1 -1
  2. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51}/pyproject.toml +1 -1
  3. skilleter_thingy-0.0.51/skilleter_thingy/box.py +31 -0
  4. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51}/skilleter_thingy/git_hold.py +2 -2
  5. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51}/skilleter_thingy/git_review.py +2 -2
  6. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51}/skilleter_thingy/git_update.py +1 -1
  7. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51}/skilleter_thingy/photodupe.py +0 -1
  8. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51}/skilleter_thingy/py_audit.py +1 -2
  9. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51}/skilleter_thingy/readable.py +21 -1
  10. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51}/skilleter_thingy/thingy/git.py +30 -14
  11. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51}/skilleter_thingy/thingy/git2.py +0 -9
  12. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51}/skilleter_thingy/thingy/tidy.py +18 -3
  13. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51}/skilleter_thingy/venv_create.py +1 -0
  14. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51/skilleter_thingy.egg-info}/PKG-INFO +1 -1
  15. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51}/skilleter_thingy.egg-info/SOURCES.txt +1 -0
  16. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51}/LICENSE +0 -0
  17. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51}/README.md +0 -0
  18. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51}/setup.cfg +0 -0
  19. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51}/skilleter_thingy/__init__.py +0 -0
  20. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51}/skilleter_thingy/addpath.py +0 -0
  21. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51}/skilleter_thingy/borger.py +0 -0
  22. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51}/skilleter_thingy/console_colours.py +0 -0
  23. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51}/skilleter_thingy/diskspacecheck.py +0 -0
  24. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51}/skilleter_thingy/docker_purge.py +0 -0
  25. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51}/skilleter_thingy/ffind.py +0 -0
  26. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51}/skilleter_thingy/ggit.py +0 -0
  27. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51}/skilleter_thingy/ggrep.py +0 -0
  28. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51}/skilleter_thingy/git_br.py +0 -0
  29. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51}/skilleter_thingy/git_ca.py +0 -0
  30. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51}/skilleter_thingy/git_cleanup.py +0 -0
  31. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51}/skilleter_thingy/git_co.py +0 -0
  32. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51}/skilleter_thingy/git_common.py +0 -0
  33. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51}/skilleter_thingy/git_mr.py +0 -0
  34. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51}/skilleter_thingy/git_parent.py +0 -0
  35. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51}/skilleter_thingy/git_wt.py +0 -0
  36. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51}/skilleter_thingy/gitcmp_helper.py +0 -0
  37. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51}/skilleter_thingy/gitprompt.py +0 -0
  38. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51}/skilleter_thingy/gl.py +0 -0
  39. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51}/skilleter_thingy/gphotosync.py +0 -0
  40. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51}/skilleter_thingy/linecount.py +0 -0
  41. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51}/skilleter_thingy/moviemover.py +0 -0
  42. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51}/skilleter_thingy/phototidier.py +0 -0
  43. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51}/skilleter_thingy/remdir.py +0 -0
  44. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51}/skilleter_thingy/rmdupe.py +0 -0
  45. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51}/skilleter_thingy/rpylint.py +0 -0
  46. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51}/skilleter_thingy/splitpics.py +0 -0
  47. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51}/skilleter_thingy/strreplace.py +0 -0
  48. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51}/skilleter_thingy/sysmon.py +0 -0
  49. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51}/skilleter_thingy/tfm.py +0 -0
  50. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51}/skilleter_thingy/tfparse.py +0 -0
  51. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51}/skilleter_thingy/thingy/__init__.py +0 -0
  52. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51}/skilleter_thingy/thingy/colour.py +0 -0
  53. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51}/skilleter_thingy/thingy/dc_curses.py +0 -0
  54. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51}/skilleter_thingy/thingy/dc_defaults.py +0 -0
  55. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51}/skilleter_thingy/thingy/dc_util.py +0 -0
  56. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51}/skilleter_thingy/thingy/dircolors.py +0 -0
  57. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51}/skilleter_thingy/thingy/docker.py +0 -0
  58. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51}/skilleter_thingy/thingy/files.py +0 -0
  59. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51}/skilleter_thingy/thingy/gitlab.py +0 -0
  60. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51}/skilleter_thingy/thingy/logger.py +0 -0
  61. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51}/skilleter_thingy/thingy/path.py +0 -0
  62. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51}/skilleter_thingy/thingy/popup.py +0 -0
  63. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51}/skilleter_thingy/thingy/process.py +0 -0
  64. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51}/skilleter_thingy/thingy/run.py +0 -0
  65. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51}/skilleter_thingy/thingy/tfm_pane.py +0 -0
  66. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51}/skilleter_thingy/thingy/venv_template.py +0 -0
  67. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51}/skilleter_thingy/trimpath.py +0 -0
  68. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51}/skilleter_thingy/window_rename.py +0 -0
  69. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51}/skilleter_thingy/xchmod.py +0 -0
  70. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51}/skilleter_thingy/yamlcheck.py +0 -0
  71. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51}/skilleter_thingy.egg-info/dependency_links.txt +0 -0
  72. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51}/skilleter_thingy.egg-info/entry_points.txt +0 -0
  73. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51}/skilleter_thingy.egg-info/requires.txt +0 -0
  74. {skilleter_thingy-0.0.49 → skilleter_thingy-0.0.51}/skilleter_thingy.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: skilleter_thingy
3
- Version: 0.0.49
3
+ Version: 0.0.51
4
4
  Summary: A collection of useful utilities, mainly aimed at making Git more friendly
5
5
  Author-email: John Skilleter <john@skilleter.org.uk>
6
6
  Project-URL: Home, https://skilleter.org.uk
@@ -7,7 +7,7 @@ name = "skilleter_thingy"
7
7
 
8
8
  # Version must be incremented to install updated Thingy
9
9
 
10
- version = "0.0.49"
10
+ version = "0.0.51"
11
11
 
12
12
  authors = [
13
13
  {name="John Skilleter", email="john@skilleter.org.uk"},
@@ -0,0 +1,31 @@
1
+ #! /usr/bin/env python3
2
+
3
+ ################################################################################
4
+ """ Draw a box with text in
5
+ """
6
+ ################################################################################
7
+
8
+ import sys
9
+ import thingy.colour as colour
10
+
11
+ ################################################################################
12
+
13
+ def main():
14
+ """The guts"""
15
+ return
16
+ ################################################################################
17
+
18
+ def box():
19
+ """Entry point"""
20
+
21
+ try:
22
+ main()
23
+ except KeyboardInterrupt:
24
+ sys.exit(1)
25
+ except BrokenPipeError:
26
+ sys.exit(2)
27
+
28
+ ################################################################################
29
+
30
+ if __name__ == '__main__':
31
+ box()
@@ -54,7 +54,7 @@ def archive_branches(branches):
54
54
  colour.error(f'[RED:ERROR:] An archive tag already exists for branch {branch}')
55
55
 
56
56
  if branch == current_branch:
57
- colour.error(f'[RED:ERROR:] Cannot archive the current branch')
57
+ colour.error('[RED:ERROR:] Cannot archive the current branch')
58
58
 
59
59
  for branch in branches:
60
60
  tag_name = archive_tag_name(branch)
@@ -95,7 +95,7 @@ def restore_archive_branches(branches):
95
95
  tags = archive_tags()
96
96
 
97
97
  for branch in branches:
98
- if not archive_tag_name(branch) in tags:
98
+ if archive_tag_name(branch) not in tags:
99
99
  colour.error(f'[RED:ERROR:] Archive branch {branch} does not exist')
100
100
 
101
101
  archive_tag_names = []
@@ -1299,13 +1299,13 @@ def parse_command_line():
1299
1299
  # Make sure that we're actually in a git working tree
1300
1300
 
1301
1301
  if not git.working_tree():
1302
- colour.error(f'[RED:ERROR] Not a git repository')
1302
+ colour.error('[RED:ERROR] Not a git repository')
1303
1303
 
1304
1304
  # -C/--change is shorthand for '--commit HEAD^'
1305
1305
 
1306
1306
  if args.change:
1307
1307
  if args.commits:
1308
- colour.error(f'[RED:ERROR] The -C/--change option does not take parameters')
1308
+ colour.error('[RED:ERROR] The -C/--change option does not take parameters')
1309
1309
 
1310
1310
  args.commits = ['HEAD^']
1311
1311
 
@@ -195,7 +195,7 @@ def branch_pull(args, results, branch, fail=True):
195
195
  fail = False
196
196
 
197
197
  elif exc.msg.startswith('Your configuration specifies to merge with the ref'):
198
- colour.write(f'[RED:WARNING]: The upstream branch no longer exists', indent=4)
198
+ colour.write('[RED:WARNING]: The upstream branch no longer exists', indent=4)
199
199
  fail = False
200
200
 
201
201
  elif 'no such ref was fetched' in exc.msg:
@@ -3,7 +3,6 @@
3
3
 
4
4
  import sys
5
5
  import os
6
- import sys
7
6
  import pickle
8
7
  import argparse
9
8
 
@@ -5,7 +5,6 @@
5
5
 
6
6
  ################################################################################
7
7
 
8
- import os
9
8
  import sys
10
9
  import requests
11
10
  import subprocess
@@ -64,7 +63,7 @@ def audit(package, version):
64
63
  print()
65
64
  print(v['details'])
66
65
  else:
67
- print(f'No known vulnerabilities')
66
+ print('No known vulnerabilities')
68
67
 
69
68
  ################################################################################
70
69
 
@@ -29,7 +29,7 @@ import thingy.files as files
29
29
  TF_OBJECTS_CHANGED_END = 'Terraform detected the following changes made outside of Terraform since the last "terraform apply":'
30
30
  TF_IGNORE_MSG = 'Unless you have made equivalent changes to your configuration, or ignored the relevant attributes using ignore_changes, the following plan may include actions to undo or respond to these changes.'
31
31
 
32
- TF_REFRESHING_AND_READING = re.compile(r'.*: (?:Refreshing state\.\.\.|Reading\.\.\.|Read complete after |Preparing import\.\.\.).*')
32
+ TF_REFRESHING_AND_READING = re.compile(r'.*: (?:Refreshing state\.\.\.|Reading\.\.\.|Still reading\.\.\.|Read complete after |Preparing import\.\.\.).*')
33
33
  TF_FINDING_AND_INSTALLING = re.compile(r'- (?:Finding .*[.]{3}|Installing .*[.]{3}|Installed .*)')
34
34
 
35
35
  TF_HAS_CHANGED = re.compile(r' # .* has changed')
@@ -62,6 +62,7 @@ def parse_command_line():
62
62
  parser.add_argument('-O', '--dir', action='store', default=None, help='Store output files in the specified directory (creating it if it doesn\'t exist)')
63
63
  parser.add_argument('-a', '--aws', action='store_true', help='Remove AWS resource IDs')
64
64
  parser.add_argument('-T', '--terraform', action='store_true', help='Clean Terraform plan/apply log files')
65
+ parser.add_argument('-R', '--replace', action='append', default=None, help='Additional regex replacements in the form "REGEX=REPLACEMENT"')
65
66
  parser.add_argument('files', nargs='*', default=None, help='The files to convert (use stdin/stout if no input files are specified)')
66
67
 
67
68
  args = parser.parse_args()
@@ -91,6 +92,18 @@ def parse_command_line():
91
92
  if args.dir and not os.path.isdir(args.dir):
92
93
  os.mkdir(args.dir)
93
94
 
95
+ # Handle additional regex replacements
96
+
97
+ if args.replace:
98
+ args.regex_replace = []
99
+ for entry in args.replace:
100
+ regex, replace = entry.split('=')
101
+ try:
102
+ args.regex_replace.append({'regex': re.compile(regex), 'replace':replace})
103
+ except re.error as exc:
104
+ print(f'ERROR in regular expression {regex}: {exc}')
105
+ sys.exit(1)
106
+
94
107
  return args
95
108
 
96
109
  ################################################################################
@@ -139,6 +152,7 @@ def cleanfile(args, infile, outfile):
139
152
  clean = tidy.remove_sha256(clean)
140
153
  clean = tidy.remove_sha1(clean)
141
154
  clean = tidy.remove_times(clean)
155
+ clean = tidy.remove_speeds(clean)
142
156
 
143
157
  if not args.light and not args.dark:
144
158
  clean = tidy.remove_ansi(clean)
@@ -148,6 +162,12 @@ def cleanfile(args, infile, outfile):
148
162
  if args.aws:
149
163
  clean = tidy.remove_aws_ids(clean)
150
164
 
165
+ # Additional custom regex replacements
166
+
167
+ if args.replace:
168
+ for entry in args.regex_replace:
169
+ clean = entry['regex'].sub(entry['replace'], clean)
170
+
151
171
  # Do things with Terraform log data
152
172
 
153
173
  if args.terraform:
@@ -515,6 +515,13 @@ def difftool(commit_1=None, commit_2=None, files=None, tool=None):
515
515
 
516
516
  ################################################################################
517
517
 
518
+ # Match 'git diff --numstat' output - first re splits into lines added, removed
519
+ # and name. Second one is used if a file has been renamed, to get the old and
520
+ # new name components.
521
+
522
+ _DIFF_OUTPUT_RE = re.compile(r'(-|\d+)\s+(-|\d+)\s+(.*)')
523
+ _DIFF_OUTPUT_RENAME_RE = re.compile('(.*)\{(.*) => (.*)\}(.*)')
524
+
518
525
  def commit_info(commit_1=None, commit_2=None, paths=None, diff_stats=False):
519
526
  """ Return details of changes either in single commit (defaulting to the most
520
527
  recent one) or between two commits, optionally restricted a path or paths
@@ -523,22 +530,30 @@ def commit_info(commit_1=None, commit_2=None, paths=None, diff_stats=False):
523
530
  """
524
531
 
525
532
  def parse_diff_output(result):
526
- """Extract current filename and lines added/deleted from output from git diff --numstat"""
533
+ """Extract previous and current filename (which may be the same) and lines added/deleted
534
+ from output from git diff --numstat"""
535
+
536
+ p = _DIFF_OUTPUT_RE.fullmatch(result)
527
537
 
528
- p = re.fullmatch(r'(-|\d+)\s+(-|\d+)\s+(.*)', result)
538
+ # Extract number of lines added/removed
529
539
 
530
540
  lines_ins = 0 if p.group(1) == '-' else int(p.group(1))
531
541
  lines_del = 0 if p.group(2) == '-' else int(p.group(2))
532
542
 
543
+ # Check for rename and get both old and new names
544
+
533
545
  if ' => ' in p.group(3):
534
- filepath = p.group(3).split('{')[0]
535
- filename = p.group(3).split(' => ')[1]
536
- filename = filename.replace('}', '')
537
- filename = os.path.join(filepath, filename)
546
+ q = _DIFF_OUTPUT_RENAME_RE.fullmatch(p.group(3))
547
+
548
+ if q:
549
+ old_filename = q.group(1) + q.group(2) + q.group(4)
550
+ new_filename = q.group(1) + q.group(3) + q.group(4)
551
+ else:
552
+ old_filename, new_filename = p.group(3).split(' => ')
538
553
  else:
539
- filename = p.group(3)
554
+ old_filename = new_filename = p.group(3)
540
555
 
541
- return filename, lines_ins, lines_del
556
+ return old_filename, new_filename, lines_ins, lines_del
542
557
 
543
558
  # Either get changes between the two commits, or changes in the specified commit
544
559
 
@@ -588,22 +603,23 @@ def commit_info(commit_1=None, commit_2=None, paths=None, diff_stats=False):
588
603
  results = git(['diff', '--numstat'] + params)
589
604
 
590
605
  for result in results:
591
- filename, lines_ins, lines_del = parse_diff_output(result)
606
+ old_filename, new_filename, lines_ins, lines_del = parse_diff_output(result)
592
607
 
593
- info[filename]['deleted'] = lines_del
594
- info[filename]['added'] = lines_ins
608
+ info[new_filename]['deleted'] = lines_del
609
+ info[new_filename]['added'] = lines_ins
595
610
 
596
611
  # Run git diff to get stats ignoring whitespace changes and add them
597
612
 
598
613
  results = git(['diff', '--numstat', '--ignore-all-space', '--ignore-blank-lines'] + params)
599
614
 
600
615
  for result in results:
601
- filename, lines_ins, lines_del = parse_diff_output(result)
616
+ old_filename, new_filename, lines_ins, lines_del = parse_diff_output(result)
602
617
 
603
- info[filename]['non-ws deleted'] = lines_del
604
- info[filename]['non-ws added'] = lines_ins
618
+ info[new_filename]['non-ws deleted'] = lines_del
619
+ info[new_filename]['non-ws added'] = lines_ins
605
620
 
606
621
  # Fill in the blanks - files
622
+
607
623
  for filename in info:
608
624
  if 'deleted' not in info[filename]:
609
625
  info[filename]['deleted'] = info[filename]['added'] = 0
@@ -216,15 +216,6 @@ def merge(branch):
216
216
 
217
217
  ################################################################################
218
218
 
219
- def merging():
220
- """ Return True if a merge is in progress, False otherwise """
221
-
222
- merge_check = git_run_status(['rev-parse', '-q', '--verify', 'MERGE_HEAD'])
223
-
224
- return merge_check[1] == 0
225
-
226
- ################################################################################
227
-
228
219
  def abort_merge():
229
220
  """ Abort the current merge """
230
221
 
@@ -50,16 +50,16 @@ RE_TIME = [
50
50
  {'regex': re.compile(r'[1-9][0-9]{3}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}[.][0-9]+Z?'), 'replace': '{DATE+TIME}'},
51
51
  {'regex': re.compile(r'[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}(Z|,[0-9]+)'), 'replace': '{TIME}'},
52
52
  {'regex': re.compile(r'[0-9]{1,2}:[0-9]{2}:[0-9]{2}(\.[0-9]{1,6})?([+][0-9]{2}:[0-9]{2})?'), 'replace': '{TIME}'},
53
-
54
-
53
+
55
54
  {'regex': re.compile(r'[1-9][0-9]{3}/[0-9][0-9]?/[1-9][0-9]'), 'replace': '{DATE}'},
56
55
  {'regex': re.compile(r'[1-9][0-9]/[0-9][0-9]?/[1-9][0-9]{3}'), 'replace': '{DATE}'},
57
56
  {'regex': re.compile(r'[0-9]{4}-[0-9]{2}-[0-9]{2}'), 'replace': '{DATE}'},
58
57
  {'regex': re.compile(r'[0-9]{2}-[0-9]{2}-[0-9]{4}'), 'replace': '{DATE}'},
59
58
 
60
59
  {'regex': re.compile(r'[0-9]([.][0-9]*)*\s*(second[s]?)'), 'replace': '{ELAPSED}'},
61
-
60
+
62
61
  {'find': r'{DATE} {TIME}', 'replace': '{DATE+TIME}'},
62
+ {'find': r'\d{2}m \d{2}s', 'replace': '{TIME}'},
63
63
  ]
64
64
 
65
65
  # SHA values
@@ -85,6 +85,14 @@ RE_AWS = \
85
85
  {'regex': re.compile(r'request id: [0-0a-f]{8}-[0-0a-f]{4}-[0-0a-f]{4}-[0-0a-f]{4}-[0-0a-f]{12}'), 'replace': 'request id: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'},
86
86
  ]
87
87
 
88
+ # Data transfer speeds
89
+
90
+ RE_SPEED = \
91
+ [
92
+ {'regex': re.compile(r'[0-9.]+ *MB/s'), 'replace': '{SPEED}'},
93
+ {'regex': re.compile(r'[0-9.]+ *MiB/s'), 'replace': '{SPEED}'},
94
+ ]
95
+
88
96
  ################################################################################
89
97
 
90
98
  def regex_replace(data, regexes):
@@ -150,6 +158,13 @@ def remove_aws_ids(data):
150
158
 
151
159
  ################################################################################
152
160
 
161
+ def remove_speeds(data):
162
+ """ Attempt to remove data transfer speed references from a string """
163
+
164
+ return regex_replace(data, RE_SPEED)
165
+
166
+ ################################################################################
167
+
153
168
  def remove_ansi(text):
154
169
  """ Remove ANSI codes from a string """
155
170
 
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env python3
2
2
 
3
+ import sys
3
4
  import os
4
5
  import stat
5
6
  import argparse
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: skilleter_thingy
3
- Version: 0.0.49
3
+ Version: 0.0.51
4
4
  Summary: A collection of useful utilities, mainly aimed at making Git more friendly
5
5
  Author-email: John Skilleter <john@skilleter.org.uk>
6
6
  Project-URL: Home, https://skilleter.org.uk
@@ -4,6 +4,7 @@ pyproject.toml
4
4
  skilleter_thingy/__init__.py
5
5
  skilleter_thingy/addpath.py
6
6
  skilleter_thingy/borger.py
7
+ skilleter_thingy/box.py
7
8
  skilleter_thingy/console_colours.py
8
9
  skilleter_thingy/diskspacecheck.py
9
10
  skilleter_thingy/docker_purge.py