skilleter-thingy 0.0.51__py3-none-any.whl → 0.0.52__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.

@@ -49,12 +49,13 @@ def main():
49
49
  else:
50
50
  parents, _ = git.parents()
51
51
 
52
+ if not parents:
53
+ colour.error('Unable to determine parent branch. Use the [BLUE]--parent[NORMAL] option to specify the appropriate one.')
54
+
52
55
  if len(parents) > 1:
53
56
  parent_list = ', '.join(parents)
54
57
  colour.error(
55
58
  f'Branch has multiple potential parents: [BLUE]{parent_list}[NORMAL]. Use the [BLUE]--parent[NORMAL] option to specify the appropriate one.')
56
- elif not parents:
57
- colour.error('Unable to determine parent branch. Use the [BLUE]--parent[NORMAL] option to specify the appropriate one.')
58
59
 
59
60
  options = ['merge_request.create', f'merge_request.target={parents[0]}']
60
61
 
@@ -73,6 +73,8 @@ def format_size(size, always_suffix=False):
73
73
  # to 1 (set to 0 when we don't have a divisor).
74
74
 
75
75
  div *= 1024
76
+ else:
77
+ units = ' PiB'
76
78
 
77
79
  # Calculate the size in 10ths so the we get the first digit after
78
80
  # the decimal point, doing all the work in the integer domain to
@@ -89,9 +91,13 @@ def format_size(size, always_suffix=False):
89
91
 
90
92
  ################################################################################
91
93
 
92
- def backup(filename, extension='bak', copyfile=True):
94
+ def backup(filename, extension='bak', copyfile=True, timestamps=True):
93
95
  """ Create a backup of a file by copying or renaming it into a file with extension
94
- .bak, deleting any existing file with that name """
96
+ .bak, deleting any existing file with that name.
97
+
98
+ Copies the file by default, unless copyfile is False
99
+ Sets the timetamps of the backup file to be the same as the original, unless
100
+ timestamps is False."""
95
101
 
96
102
  # Do nothing if the file does not exist
97
103
 
@@ -117,13 +123,20 @@ def backup(filename, extension='bak', copyfile=True):
117
123
  if os.path.isfile(backupname):
118
124
  os.unlink(backupname)
119
125
 
120
- # Create the backup by copying or renaming the file
126
+ # Create the backup by copying or renaming the file, optionally preserving the
127
+ # timestamp of the original file
128
+
129
+ if timestamps:
130
+ file_info = os.stat(filename)
121
131
 
122
132
  if copyfile:
123
133
  shutil.copyfile(filename, backupname)
124
134
  else:
125
135
  os.rename(filename, backupname)
126
136
 
137
+ if timestamps:
138
+ os.utime(backupname, ns=(file_info.st_atime_ns, file_info.st_mtime_ns))
139
+
127
140
  ################################################################################
128
141
  # Test code
129
142
 
@@ -520,7 +520,7 @@ def difftool(commit_1=None, commit_2=None, files=None, tool=None):
520
520
  # new name components.
521
521
 
522
522
  _DIFF_OUTPUT_RE = re.compile(r'(-|\d+)\s+(-|\d+)\s+(.*)')
523
- _DIFF_OUTPUT_RENAME_RE = re.compile('(.*)\{(.*) => (.*)\}(.*)')
523
+ _DIFF_OUTPUT_RENAME_RE = re.compile(r'(.*)\{(.*) => (.*)\}(.*)')
524
524
 
525
525
  def commit_info(commit_1=None, commit_2=None, paths=None, diff_stats=False):
526
526
  """ Return details of changes either in single commit (defaulting to the most
@@ -535,6 +535,11 @@ def commit_info(commit_1=None, commit_2=None, paths=None, diff_stats=False):
535
535
 
536
536
  p = _DIFF_OUTPUT_RE.fullmatch(result)
537
537
 
538
+ # This shouldn't happen...
539
+
540
+ if not p:
541
+ return 'ERROR', 'ERROR', 0, 0
542
+
538
543
  # Extract number of lines added/removed
539
544
 
540
545
  lines_ins = 0 if p.group(1) == '-' else int(p.group(1))
@@ -1342,7 +1347,7 @@ def run_tests():
1342
1347
  if value is None:
1343
1348
  print(' Successfully failed to read the newly-deleted config data')
1344
1349
  else:
1345
- raise GitError
1350
+ raise GitError('Unexpected lack of error reading configuration data', 1)
1346
1351
 
1347
1352
  config_set('user', 'email', 'user@localhost')
1348
1353
  config_set('user', 'name', 'User Name')
@@ -1259,7 +1259,7 @@ if __name__ == '__main__':
1259
1259
  if value is None:
1260
1260
  print(' Successfully failed to read the newly-deleted config data')
1261
1261
  else:
1262
- raise GitError
1262
+ raise GitError('Unexpectd lack of error reading configuration data', 1)
1263
1263
 
1264
1264
  config_set('user', 'email', 'user@localhost')
1265
1265
  config_set('user', 'name', 'User Name')
@@ -60,7 +60,7 @@ def capture_output(cmd, input_stream, output_streams, ansi_clean):
60
60
  if stream in (sys.stdout, sys.stderr):
61
61
  stream.write(tidy.convert_ansi(output))
62
62
  elif ansi_clean:
63
- stream.write(colour.clean(output))
63
+ stream.write(tidy.remove_ansi(output))
64
64
  else:
65
65
  stream.write(output)
66
66
 
@@ -63,7 +63,7 @@ class Pane():
63
63
 
64
64
  self.index = index
65
65
 
66
- self.current_dir = None
66
+ self.current_dir = ''
67
67
 
68
68
  self.ino = inotify.adapters.Inotify() if sys.platform == 'linux' else None
69
69
 
@@ -290,13 +290,11 @@ class Pane():
290
290
  else:
291
291
  entry = name + ' ' * (self.width - len(name) - len(data)) + data
292
292
 
293
+ file_colour = self.dircolours.get_colour_pair(current_file['name'], current_file['mode'])
293
294
  else:
294
295
  filename = entry = None
295
296
  current = False
296
-
297
- # Render the current line
298
-
299
- file_colour = self.dircolours.get_colour_pair(current_file['name'], current_file['mode']) if filename else normal_colour
297
+ file_colour = normal_colour
300
298
 
301
299
  # Reverse the colours if this the cursor line
302
300
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: skilleter_thingy
3
- Version: 0.0.51
3
+ Version: 0.0.52
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
@@ -14,7 +14,7 @@ skilleter_thingy/git_cleanup.py,sha256=TnUPYAUnByVyY_dwANzDg2BGGNh3jskNF1DgU3pc8
14
14
  skilleter_thingy/git_co.py,sha256=gBES0ltlomy7vXX8IHh0-Vt1af54t2Ie5UnRYYfP4tM,8212
15
15
  skilleter_thingy/git_common.py,sha256=ZjNkvIBRDGNLFYwOu9FjeqdDKJdm0sndX5QATtmq290,1879
16
16
  skilleter_thingy/git_hold.py,sha256=Zk6YUhr08znUOdpVJkJAt0rOtrCXnKE0NHoZzoaEEGo,4616
17
- skilleter_thingy/git_mr.py,sha256=BCE68hhz2bV0zwHkEv5tyfRY0aXoUdb_aJ-yWYDu_Wo,3087
17
+ skilleter_thingy/git_mr.py,sha256=2vLzpd5waddNBRlOvQUxwqHVQaK9Rg6FYHb4VMEpS8c,3086
18
18
  skilleter_thingy/git_parent.py,sha256=D47D01dPs6kActusA0ircJYTv8tBjDoe8MzMpJVWJpA,2683
19
19
  skilleter_thingy/git_review.py,sha256=WCBw49OP3WHiaxku8jUUk6I_NqtjScLGaQHvPxX6LnU,52053
20
20
  skilleter_thingy/git_update.py,sha256=uYd4ubnDbHzkwwrtzVatNIg-L15ap1X8UMO-2PafseY,13971
@@ -49,21 +49,21 @@ skilleter_thingy/thingy/dc_defaults.py,sha256=ahcteQvoWZrO5iTU68zkIY1Zex6iX5uR5u
49
49
  skilleter_thingy/thingy/dc_util.py,sha256=Df73imXhHx3HzcPHiRcHAoea0e3HURdLcrolUsMhOFs,1783
50
50
  skilleter_thingy/thingy/dircolors.py,sha256=5NbXMsGWdABLvvZfB70VPmN6N5HyyihfpgoQq1NRJbg,12264
51
51
  skilleter_thingy/thingy/docker.py,sha256=9EFatudoVPfB1UbDEtzdJDB3o6ToHiNHv8-oLsUeqiQ,2449
52
- skilleter_thingy/thingy/files.py,sha256=8wXUHEGALhHvYtJewjSNwHFw-hGHFYbWH9_40lJj5ZY,4257
53
- skilleter_thingy/thingy/git.py,sha256=e7CmcL4tV0CktA1tJD7ZeIaOGIT3l4egSha6uV9WChU,38678
54
- skilleter_thingy/thingy/git2.py,sha256=HdLar1rN5-Uop6GvoWM-NERDBOI7s93dC6Ry7iuEumA,35473
52
+ skilleter_thingy/thingy/files.py,sha256=oW6E6WWwVFSUPdrZnKMx7P_w_hh3etjoN7RrqvYHCHc,4705
53
+ skilleter_thingy/thingy/git.py,sha256=qXWIduF4jbP5pKFYt_hW9Ex5iL9mSBBrcNKBkULhRTg,38834
54
+ skilleter_thingy/thingy/git2.py,sha256=UgdAC1rZWf6Tdl9xB6PAIT6K_3OjD2juCOEQSHEEb90,35530
55
55
  skilleter_thingy/thingy/gitlab.py,sha256=uXAF918xnPk6qQyiwPQDbMZfqtJzhiRqDS7yEtJEIAg,6079
56
56
  skilleter_thingy/thingy/logger.py,sha256=xKgPAq8KGXmtaXIFjFs1AmZJXtYrXJn2sqL3oxHZjfQ,3107
57
57
  skilleter_thingy/thingy/path.py,sha256=me__Ukw-7NiD70Yd9tOWyj7QX79-deFvsQaQ9AGzWzU,4732
58
58
  skilleter_thingy/thingy/popup.py,sha256=jW-nbpdeswqEMTli7OmBv1J8XQsvFoMI0J33O6dOeu8,2529
59
59
  skilleter_thingy/thingy/process.py,sha256=88pKHQZXBP1m3Ja7t3DtKJ4Njn7HS2OtcI0Z0i1KwUs,3560
60
- skilleter_thingy/thingy/run.py,sha256=051lGahG4liYLckQFpmSaGuE9Chd-lFdmJO85LdmeXE,12607
61
- skilleter_thingy/thingy/tfm_pane.py,sha256=40DmQeLMEUPiKKIJkgN1MEpIen00V70I1HB7Q6git44,19814
60
+ skilleter_thingy/thingy/run.py,sha256=6SNKWF01fSxzB10GMU9ajraXYZqAL1w0PXkqjJdr1Uo,12611
61
+ skilleter_thingy/thingy/tfm_pane.py,sha256=oqy5zBzKwfbjbGqetbbhpKi4x5He7sl4qkmhUeqtdZc,19789
62
62
  skilleter_thingy/thingy/tidy.py,sha256=0EVUP2XyUTtoIpqaDwvrHL58YxM4Elvu5MO1nzhwLG4,5854
63
63
  skilleter_thingy/thingy/venv_template.py,sha256=SsVNvSwojd8NnFeQaZPCRQYTNdwJRplpZpygbUEXRnY,1015
64
- skilleter_thingy-0.0.51.dist-info/LICENSE,sha256=ljOS4DjXvqEo5VzGfdaRwgRZPbNScGBmfwyC8PChvmQ,32422
65
- skilleter_thingy-0.0.51.dist-info/METADATA,sha256=89Er69r_bvFLY6i4G7cMqTTn-G9LiEq6HwjSHNqeKLo,5313
66
- skilleter_thingy-0.0.51.dist-info/WHEEL,sha256=HiCZjzuy6Dw0hdX5R3LCFPDmFS4BWl8H-8W39XfmgX4,91
67
- skilleter_thingy-0.0.51.dist-info/entry_points.txt,sha256=IT6cZSbGHrd2UzIQbiMRotKiTJnYJBkESC4fAe8gjsE,2026
68
- skilleter_thingy-0.0.51.dist-info/top_level.txt,sha256=8-JhgToBBiWURunmvfpSxEvNkDHQQ7r25-aBXtZv61g,17
69
- skilleter_thingy-0.0.51.dist-info/RECORD,,
64
+ skilleter_thingy-0.0.52.dist-info/LICENSE,sha256=ljOS4DjXvqEo5VzGfdaRwgRZPbNScGBmfwyC8PChvmQ,32422
65
+ skilleter_thingy-0.0.52.dist-info/METADATA,sha256=buYbiQqFhFBdTi6MM02Jy8ZH8wuXmLxI2StMjulMVoo,5313
66
+ skilleter_thingy-0.0.52.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
67
+ skilleter_thingy-0.0.52.dist-info/entry_points.txt,sha256=IT6cZSbGHrd2UzIQbiMRotKiTJnYJBkESC4fAe8gjsE,2026
68
+ skilleter_thingy-0.0.52.dist-info/top_level.txt,sha256=8-JhgToBBiWURunmvfpSxEvNkDHQQ7r25-aBXtZv61g,17
69
+ skilleter_thingy-0.0.52.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (72.2.0)
2
+ Generator: setuptools (74.1.2)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5