skilleter-thingy 0.0.37__py3-none-any.whl → 0.0.39__py3-none-any.whl

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 (68) hide show
  1. {skilleter_thingy-0.0.37.dist-info → skilleter_thingy-0.0.39.dist-info}/METADATA +1 -1
  2. skilleter_thingy-0.0.39.dist-info/RECORD +6 -0
  3. skilleter_thingy-0.0.39.dist-info/top_level.txt +1 -0
  4. skilleter_thingy/__init__.py +0 -6
  5. skilleter_thingy/addpath.py +0 -107
  6. skilleter_thingy/borger.py +0 -269
  7. skilleter_thingy/console_colours.py +0 -63
  8. skilleter_thingy/diskspacecheck.py +0 -67
  9. skilleter_thingy/docker_purge.py +0 -113
  10. skilleter_thingy/ffind.py +0 -536
  11. skilleter_thingy/ggit.py +0 -90
  12. skilleter_thingy/ggrep.py +0 -154
  13. skilleter_thingy/git_br.py +0 -180
  14. skilleter_thingy/git_ca.py +0 -142
  15. skilleter_thingy/git_cleanup.py +0 -287
  16. skilleter_thingy/git_co.py +0 -220
  17. skilleter_thingy/git_common.py +0 -61
  18. skilleter_thingy/git_hold.py +0 -154
  19. skilleter_thingy/git_mr.py +0 -92
  20. skilleter_thingy/git_parent.py +0 -77
  21. skilleter_thingy/git_review.py +0 -1428
  22. skilleter_thingy/git_update.py +0 -385
  23. skilleter_thingy/git_wt.py +0 -96
  24. skilleter_thingy/gitcmp_helper.py +0 -322
  25. skilleter_thingy/gitprompt.py +0 -274
  26. skilleter_thingy/gl.py +0 -174
  27. skilleter_thingy/gphotosync.py +0 -610
  28. skilleter_thingy/linecount.py +0 -155
  29. skilleter_thingy/moviemover.py +0 -133
  30. skilleter_thingy/photodupe.py +0 -136
  31. skilleter_thingy/phototidier.py +0 -248
  32. skilleter_thingy/py_audit.py +0 -131
  33. skilleter_thingy/readable.py +0 -270
  34. skilleter_thingy/remdir.py +0 -126
  35. skilleter_thingy/rmdupe.py +0 -550
  36. skilleter_thingy/rpylint.py +0 -91
  37. skilleter_thingy/splitpics.py +0 -99
  38. skilleter_thingy/strreplace.py +0 -82
  39. skilleter_thingy/sysmon.py +0 -435
  40. skilleter_thingy/tfm.py +0 -920
  41. skilleter_thingy/tfparse.py +0 -101
  42. skilleter_thingy/thingy/__init__.py +0 -0
  43. skilleter_thingy/thingy/colour.py +0 -213
  44. skilleter_thingy/thingy/dc_curses.py +0 -278
  45. skilleter_thingy/thingy/dc_defaults.py +0 -221
  46. skilleter_thingy/thingy/dc_util.py +0 -50
  47. skilleter_thingy/thingy/dircolors.py +0 -308
  48. skilleter_thingy/thingy/docker.py +0 -95
  49. skilleter_thingy/thingy/files.py +0 -142
  50. skilleter_thingy/thingy/git.py +0 -1371
  51. skilleter_thingy/thingy/git2.py +0 -1307
  52. skilleter_thingy/thingy/gitlab.py +0 -193
  53. skilleter_thingy/thingy/logger.py +0 -112
  54. skilleter_thingy/thingy/path.py +0 -156
  55. skilleter_thingy/thingy/popup.py +0 -87
  56. skilleter_thingy/thingy/process.py +0 -112
  57. skilleter_thingy/thingy/run.py +0 -334
  58. skilleter_thingy/thingy/tfm_pane.py +0 -595
  59. skilleter_thingy/thingy/tidy.py +0 -160
  60. skilleter_thingy/trimpath.py +0 -84
  61. skilleter_thingy/window_rename.py +0 -92
  62. skilleter_thingy/xchmod.py +0 -125
  63. skilleter_thingy/yamlcheck.py +0 -89
  64. skilleter_thingy-0.0.37.dist-info/RECORD +0 -66
  65. skilleter_thingy-0.0.37.dist-info/top_level.txt +0 -1
  66. {skilleter_thingy-0.0.37.dist-info → skilleter_thingy-0.0.39.dist-info}/LICENSE +0 -0
  67. {skilleter_thingy-0.0.37.dist-info → skilleter_thingy-0.0.39.dist-info}/WHEEL +0 -0
  68. {skilleter_thingy-0.0.37.dist-info → skilleter_thingy-0.0.39.dist-info}/entry_points.txt +0 -0
skilleter_thingy/ggrep.py DELETED
@@ -1,154 +0,0 @@
1
- #! /usr/bin/env python3
2
-
3
- """ Run 'git grep' in all Git working trees under the current directory or just
4
- in the current directory if the current director is in a working tree.
5
-
6
- Copyright (C) 2019-21 John Skilleter
7
- """
8
-
9
- ################################################################################
10
-
11
- import os
12
- import re
13
- import sys
14
- import argparse
15
-
16
- import thingy.colour as colour
17
- import thingy.git as git
18
-
19
- ################################################################################
20
-
21
- BINARY_RE = re.compile(r'(Binary file )(.*)( matches)')
22
-
23
- ################################################################################
24
-
25
- def parse_command_line():
26
- """ Validate the command line, return the arguments """
27
-
28
- parser = argparse.ArgumentParser(
29
- description='Run a git grep in either the current working tree or all working git working trees under the current directory')
30
-
31
- parser.add_argument('-f', '--follow', action='store_true', help='Follow symlinks')
32
- parser.add_argument('-a', '--text', action='store_true', help='Process binary files as if they were text.')
33
- parser.add_argument('-i', '--ignore-case', action='store_true', help='Ignore case differences between the patterns and the files.')
34
- parser.add_argument('-w', '--word-regexp', action='store_true',
35
- help='Match the pattern only at word boundary (either begin at the beginning of a line, or preceded by a non-word character; end at the end of a line or followed by a non-word character).')
36
- parser.add_argument('-v', '--invert-match', action='store_true', help='Select non-matching lines.')
37
- parser.add_argument('-F', '--fixed-strings', action='store_true', help='Use fixed strings for patterns (don’t interpret pattern as a regex).')
38
- parser.add_argument('-n', '--line-number', action='store_true', help='Prefix the line number to matching lines.')
39
- parser.add_argument('-l', '--files-with-matches', action='store_true', help='Show only the names of files that contain matches')
40
- parser.add_argument('-L', '--files-without-matches', action='store_true', help='Show only the names of files that do NOT contain matches')
41
- parser.add_argument('-W', '--wildcard', action='append', help='Only search files matching the wildcard(s)')
42
- parser.add_argument('-o', '--only-matching', action='store_true', help='Print only the matched (non-empty) parts of a matching line, with each such part on a separate output line.')
43
- parser.add_argument('--no-color', action='store_true', help='Turn off match highlighting')
44
- parser.add_argument('pattern', action='store', help='Regular expression to search for')
45
- parser.add_argument('paths', nargs='*', help='Optional list of one or more paths to search')
46
-
47
- return parser.parse_args()
48
-
49
- ################################################################################
50
-
51
- def git_grep(args, path, pattern):
52
- """ Grep a git """
53
-
54
- if path == '.':
55
- path = ''
56
- elif path[0:2] == './':
57
- path = path[2:]
58
-
59
- grep_options = {'color': True, 'extended_regexp': True}
60
-
61
- if args.text:
62
- grep_options['text'] = True
63
-
64
- if args.ignore_case:
65
- grep_options['ignore_case'] = True
66
-
67
- if args.word_regexp:
68
- grep_options['word_regexp'] = True
69
-
70
- if args.invert_match:
71
- grep_options['invert_match'] = True
72
-
73
- if args.fixed_strings:
74
- grep_options['fixed_strings'] = True
75
-
76
- if args.line_number:
77
- grep_options['line_number'] = True
78
-
79
- if args.files_without_matches:
80
- grep_options['files_without_matches'] = True
81
-
82
- if args.files_with_matches:
83
- grep_options['files_with_matches'] = True
84
-
85
- if args.only_matching:
86
- grep_options['only_matching'] = True
87
-
88
- if path:
89
- output, status = git.grep(pattern, git_dir=os.path.join(path, '.git'), work_tree=path, options=grep_options, wildcards=args.wildcard)
90
- else:
91
- output, status = git.grep(pattern, options=grep_options, wildcards=args.wildcard)
92
-
93
- if status > 1:
94
- colour.error(output)
95
- elif status == 0:
96
- for out in output.split('\n'):
97
- if out:
98
- bin_match = BINARY_RE.match(out)
99
- if bin_match:
100
- match_path = os.path.join(path, bin_match.group(2))
101
- colour.write(f'[BOLD:{match_path}]: Binary file match')
102
- else:
103
- subdir = os.path.join(path, out.split(':', 1)[0])
104
- data = out.split(':', 1)[1]
105
-
106
- colour.write(f'[BLUE:{subdir}]: {data.strip()}')
107
-
108
- ################################################################################
109
-
110
- def git_grep_path(args, path):
111
- """ Look for git working trees under the specified path and grep them """
112
-
113
- for root, dirs, _ in os.walk(path, followlinks=args.follow):
114
- if '.git' in dirs:
115
- git_grep(args, root, args.pattern)
116
-
117
- ################################################################################
118
-
119
- def main():
120
- """ If we are in a repo, just run git grep, otherwise, hunt for
121
- repos and git grep them. """
122
-
123
- args = parse_command_line()
124
-
125
- if not args.paths:
126
- # No paths specified so if the current directory is in a working tree
127
- # just run git grep, otherwise, look for working trees in subdirectories
128
-
129
- if git.working_tree():
130
- git_grep(args, '.', args.pattern)
131
- else:
132
- args.paths = ['.']
133
-
134
- if args.paths:
135
- for path in args.paths:
136
- git_grep_path(args, path)
137
-
138
- ################################################################################
139
-
140
- def ggrep():
141
- """Entry point"""
142
-
143
- try:
144
- main()
145
-
146
- except KeyboardInterrupt:
147
- sys.exit(1)
148
- except BrokenPipeError:
149
- sys.exit(2)
150
-
151
- ################################################################################
152
-
153
- if __name__ == '__main__':
154
- ggrep()
@@ -1,180 +0,0 @@
1
- #! /usr/bin/env python3
2
-
3
- ################################################################################
4
- """ Thingy 'git-br' command - output branch information
5
-
6
- Author: John Skilleter
7
-
8
- Licence: GPL v3 or later
9
-
10
- TODO: Command line options for list of fields to output
11
- TODO: Command line options for sort order
12
- TODO: Debate the delete option, which currently isn't implemented
13
- """
14
- ################################################################################
15
-
16
- import sys
17
- import argparse
18
- import fnmatch
19
- import datetime
20
-
21
- from dateutil.parser import parse
22
- from dateutil.relativedelta import relativedelta
23
-
24
- import thingy.git as git
25
- import thingy.colour as colour
26
-
27
- ################################################################################
28
-
29
- def parse_command_line():
30
- """ Parse the command line """
31
-
32
- parser = argparse.ArgumentParser(description='List or delete branches that have been merged')
33
-
34
- parser.add_argument('-a', '--all', action='store_true', help='List all branches, including remotes')
35
- parser.add_argument('-d', '--delete', action='store_true',
36
- help='Delete the specified branch(es), even if it is the current one (list of branches to delete must be supplied as parameters)')
37
- parser.add_argument('branches', nargs='*', help='Filter the list of branches according to one or more patterns')
38
-
39
- args = parser.parse_args()
40
-
41
- if args.delete and not args.branches:
42
- colour.error('[RED:ERROR]: You must specify the branches to delete')
43
-
44
- return args
45
-
46
- ################################################################################
47
-
48
- def branch_match(ref, matching_branches):
49
- """ Return True if ref matches an entry in matching_branches """
50
-
51
- if matching_branches:
52
- for branch in matching_branches:
53
- if '?' in branch or '*' in branch:
54
- if branch[0] not in ['?', '*']:
55
- branch = f'*{branch}'
56
- if branch[-1] not in ['?', '*']:
57
- branch = f'{branch}*'
58
-
59
- if fnmatch.fnmatch(ref, branch):
60
- return True
61
- elif branch in ref:
62
- return True
63
-
64
- return False
65
-
66
- return True
67
-
68
- ################################################################################
69
-
70
- def get_matching_branches(args):
71
- """ Get a list of branches matching those specified in the script arguments """
72
-
73
- # Get the SHA1, date, author and name of the tip commit on each branch, including remotes
74
- # and keep track of the maximum length of each field
75
-
76
- branches = []
77
-
78
- for ref in git.ref(sort='-committerdate', fields=('objectname:short', 'committerdate', 'authorname', 'refname:short'), remotes=args.all):
79
- if branch_match(ref[3], args.branches):
80
- branches.append(ref)
81
-
82
- return branches
83
-
84
- ################################################################################
85
-
86
- def list_branches(branches):
87
- """ List branches. """
88
-
89
- max_len = [0] * len(branches[0])
90
-
91
- user = git.config_get('user', 'name')
92
-
93
- # Output the fields in columns, highlighting user's own branches and those owned by Jenkins
94
- # Replacing references to today and yesterday's dates with 'today' and 'yesterday' and
95
- # reformatting dates and time for readability.
96
-
97
- today = datetime.date.today()
98
- yesterday = today - relativedelta(days=1)
99
-
100
- all_output = []
101
-
102
- current_branch = git.branch()
103
-
104
- for branch in branches:
105
- output = []
106
-
107
- for i, field in enumerate(branch):
108
- if i==1:
109
- field = parse(field)
110
- time_str = field.strftime('%H:%M:%S')
111
-
112
- if field.date() == today:
113
- field = 'today ' + time_str
114
- elif field.date() == yesterday:
115
- field = 'yesterday ' + time_str
116
- else:
117
- field = field.date().strftime('%d/%m/%Y') + ' ' + time_str
118
-
119
- output.append('%-*s' % (max_len[i], field))
120
- max_len[i] = max(max_len[i], len(field))
121
-
122
- highlight = 'GREEN' if branch[3] in ('master', 'main', 'develop') \
123
- else 'BOLD' if branch[3] == current_branch \
124
- else 'BLUE' if branch[2] == user \
125
- else 'NORMAL'
126
-
127
- all_output.append({'highlight': highlight, 'output': output})
128
-
129
- for output in all_output:
130
- line = []
131
- for i, field in enumerate(output['output']):
132
- line.append('%-*s' % (max_len[i], field))
133
-
134
- colour.write('[%s:%s]' % (output['highlight'], ' '.join(line).rstrip()))
135
-
136
- ################################################################################
137
-
138
- def delete_branches(branches):
139
- """ Delete matching branches. Report an error if no branches specified """
140
-
141
- if not branches:
142
- print('ERROR: The branches to delete must be specified')
143
- sys.exit(1)
144
-
145
- print('TODO: Deleting %s' % branches)
146
-
147
- # TODO: List branches, prompt user, delete each branch - if current branch then checkout develop, main or master first
148
-
149
- ################################################################################
150
-
151
- def main():
152
- """ Main function """
153
-
154
- args = parse_command_line()
155
-
156
- branches = get_matching_branches(args)
157
-
158
- if args.delete:
159
- delete_branches(branches)
160
- else:
161
- list_branches(branches)
162
-
163
- ################################################################################
164
-
165
- def git_br():
166
- """Entry point"""
167
-
168
- try:
169
- main()
170
- except KeyboardInterrupt:
171
- sys.exit(1)
172
- except BrokenPipeError:
173
- sys.exit(2)
174
- except git.GitError as exc:
175
- colour.error(f'[RED:ERROR]: {exc.msg}', status=exc.status)
176
-
177
- ################################################################################
178
-
179
- if __name__ == '__main__':
180
- git_br()
@@ -1,142 +0,0 @@
1
- #! /usr/bin/env python3
2
-
3
- ################################################################################
4
- """ Thingy "git-ca" command - an intelligent version of "git commit --amend"
5
-
6
- Copyright (C) 2017-18 John Skilleter
7
-
8
- Licence: GPL v3 or later
9
-
10
- TODO: Handle attempt to amend commit in newly-initialised repo with no commits in.
11
- TODO: Fix failure with "fatal: pathspec "FILENAME" did not match any files" whilst amending a commit to include a deleted file.
12
- """
13
- ################################################################################
14
-
15
- import os
16
- import argparse
17
- import sys
18
-
19
- import thingy.colour as colour
20
- import thingy.git as git
21
- import thingy.logger as logger
22
-
23
- ################################################################################
24
-
25
- def main():
26
- """ Amend a comment, updating modified files that are already committed and
27
- adding files that are listed on the command line """
28
-
29
- # Files to add to git before committing and files to commit
30
-
31
- files_to_add = []
32
- files_to_commit = []
33
-
34
- # Parse the command line
35
-
36
- parser = argparse.ArgumentParser(
37
- description='Amend changes to the current commit. Updates files that are already in the commit and, optionally, adds additional files.')
38
-
39
- parser.add_argument('-A', '--added', action='store_true', help='Update files in the current commit, including files added with "git add"')
40
- parser.add_argument('-a', '--all', action='store_true', help='Append all locally-modified, tracked files to the current commit')
41
- parser.add_argument('-e', '--everything', action='store_true', help='Append all modified and untracked files to the current commit (implies --all)')
42
- parser.add_argument('-i', '--ignored', action='store_true', dest='ignored', help='Include files normally hidden by .gitignore')
43
- parser.add_argument('-p', '--patch', action='store_true', help='Use the interactive patch selection interface to chose which changes to commit.')
44
- parser.add_argument('-v', '--verbose', action='store_true', help='Verbose mode')
45
- parser.add_argument('-D', '--dry-run', action='store_true', help='Dry-run')
46
-
47
- parser.add_argument('files', nargs='*', help='List of files to add to the commit')
48
-
49
- args = parser.parse_args()
50
-
51
- # Configure logger
52
-
53
- log = logger.init(__name__)
54
-
55
- if args.verbose:
56
- log.setLevel(logger.INFO)
57
- log.info('Debug logging enabled')
58
-
59
- # 'Add' implies 'all'
60
-
61
- if args.everything:
62
- args.all = True
63
-
64
- # If there are any files on the command line then add them
65
- # to the list of files to be committed
66
-
67
- if args.files:
68
- for filename in args.files:
69
- rel_path = git.tree_path(filename)
70
- files_to_add.append(rel_path)
71
-
72
- # Move to the working tree
73
-
74
- working_tree = git.working_tree()
75
-
76
- if not working_tree:
77
- colour.error('fatal: not a git repository (or any of the parent directories)')
78
-
79
- os.chdir(working_tree)
80
-
81
- # Get the list of files modified in the most recent commit
82
-
83
- current_commit = git.commit_info('HEAD', 'HEAD^')
84
-
85
- # Get the list of locally-modified and untracked files, including
86
- # files matching .gitignore, if necessary
87
-
88
- log.info('Getting list of changed files')
89
- local_changes = git.status_info(args.ignored)
90
-
91
- for change in local_changes:
92
- log.info('Changed: %s (%s)', change, local_changes[change])
93
-
94
- if change in current_commit or (args.added and local_changes[change][0] == 'A'):
95
- # Locally changed and already in the commit or, optionally, added to it, so update it
96
-
97
- files_to_commit.append(change)
98
-
99
- elif args.all and (local_changes[change][1] in ('M', 'A', 'D', 'T') or local_changes[change][0] == 'D'):
100
- # Tracked and 'all' option specified so add it to the commit
101
-
102
- files_to_commit.append(change)
103
-
104
- elif args.everything and local_changes[change][0] in ('!', '?'):
105
- # Untracked and 'add' option specified so add it to Git and the commit
106
-
107
- files_to_add.append(change)
108
-
109
- if files_to_add:
110
- try:
111
- git.add(files_to_add)
112
- except git.GitError as exc:
113
- colour.error(exc.msg, status=exc.status)
114
-
115
- files_to_commit += files_to_add
116
-
117
- # Perform the commit running in the foreground in case the user is using a console
118
- # mode text editor for commit comments.
119
-
120
- log.info('Files to commit: %s', files_to_commit)
121
-
122
- try:
123
- git.commit(files_to_commit, amend=True, foreground=True, patch=args.patch, dry_run=args.dry_run)
124
- except git.GitError as exc:
125
- sys.exit(exc.status)
126
-
127
- ################################################################################
128
-
129
- def git_ca():
130
- """Entry point"""
131
-
132
- try:
133
- main()
134
- except KeyboardInterrupt:
135
- sys.exit(1)
136
- except BrokenPipeError:
137
- sys.exit(2)
138
-
139
- ################################################################################
140
-
141
- if __name__ == '__main__':
142
- git_ca()