##// END OF EJS Templates
lint: more autofixes
super-admin -
r1153:bc27ecc0 default
parent child Browse files
Show More
@@ -130,7 +130,7 b' class LFSOidStore:'
130 f.write('...')
130 f.write('...')
131 """
131 """
132
132
133 class StoreEngine(object):
133 class StoreEngine:
134 def __init__(self, mode, store_path, oid_path, tmp_oid_path):
134 def __init__(self, mode, store_path, oid_path, tmp_oid_path):
135 self.mode = mode
135 self.mode = mode
136 self.store_path = store_path
136 self.store_path = store_path
@@ -71,7 +71,7 b' class StatsClientBase:'
71
71
72 def incr(self, stat, count=1, rate=1, tags=None):
72 def incr(self, stat, count=1, rate=1, tags=None):
73 """Increment a stat by `count`."""
73 """Increment a stat by `count`."""
74 self._send_stat(stat, '%s|c' % count, rate, tags)
74 self._send_stat(stat, f'{count}|c', rate, tags)
75
75
76 def decr(self, stat, count=1, rate=1, tags=None):
76 def decr(self, stat, count=1, rate=1, tags=None):
77 """Decrement a stat by `count`."""
77 """Decrement a stat by `count`."""
@@ -85,18 +85,18 b' class StatsClientBase:'
85 return
85 return
86 with self.pipeline() as pipe:
86 with self.pipeline() as pipe:
87 pipe._send_stat(stat, '0|g', 1)
87 pipe._send_stat(stat, '0|g', 1)
88 pipe._send_stat(stat, '%s|g' % value, 1)
88 pipe._send_stat(stat, f'{value}|g', 1)
89 else:
89 else:
90 prefix = '+' if delta and value >= 0 else ''
90 prefix = '+' if delta and value >= 0 else ''
91 self._send_stat(stat, '%s%s|g' % (prefix, value), rate, tags)
91 self._send_stat(stat, f'{prefix}{value}|g', rate, tags)
92
92
93 def set(self, stat, value, rate=1):
93 def set(self, stat, value, rate=1):
94 """Set a set value."""
94 """Set a set value."""
95 self._send_stat(stat, '%s|s' % value, rate)
95 self._send_stat(stat, f'{value}|s', rate)
96
96
97 def histogram(self, stat, value, rate=1, tags=None):
97 def histogram(self, stat, value, rate=1, tags=None):
98 """Set a histogram"""
98 """Set a histogram"""
99 self._send_stat(stat, '%s|h' % value, rate, tags)
99 self._send_stat(stat, f'{value}|h', rate, tags)
100
100
101 def _send_stat(self, stat, value, rate, tags=None):
101 def _send_stat(self, stat, value, rate, tags=None):
102 self._after(self._prepare(stat, value, rate, tags))
102 self._after(self._prepare(stat, value, rate, tags))
@@ -108,10 +108,10 b' class StatsClientBase:'
108 if rate < 1:
108 if rate < 1:
109 if random.random() > rate:
109 if random.random() > rate:
110 return
110 return
111 value = '%s|@%s' % (value, rate)
111 value = f'{value}|@{rate}'
112
112
113 if self._prefix:
113 if self._prefix:
114 stat = '%s.%s' % (self._prefix, stat)
114 stat = f'{self._prefix}.{stat}'
115
115
116 res = '%s:%s%s' % (
116 res = '%s:%s%s' % (
117 stat,
117 stat,
@@ -123,7 +123,7 b' class GitRepository:'
123 # blows up if you sprinkle "flush" (0000) as "0001\n".
123 # blows up if you sprinkle "flush" (0000) as "0001\n".
124 # It reads binary, per number of bytes specified.
124 # It reads binary, per number of bytes specified.
125 # if you do add '\n' as part of data, count it.
125 # if you do add '\n' as part of data, count it.
126 server_advert = '# service=%s\n' % git_command
126 server_advert = f'# service={git_command}\n'
127 packet_len = hex(len(server_advert) + 4)[2:].rjust(4, '0').lower()
127 packet_len = hex(len(server_advert) + 4)[2:].rjust(4, '0').lower()
128 try:
128 try:
129 gitenv = dict(os.environ)
129 gitenv = dict(os.environ)
@@ -59,7 +59,7 b' class BaseInstallHooks:'
59 HOOK_FILES = ()
59 HOOK_FILES = ()
60
60
61 def _check_hook_file_mode(self, file_path):
61 def _check_hook_file_mode(self, file_path):
62 assert os.path.exists(file_path), 'path %s missing' % file_path
62 assert os.path.exists(file_path), f'path {file_path} missing'
63 stat_info = os.stat(file_path)
63 stat_info = os.stat(file_path)
64
64
65 file_mode = stat.S_IMODE(stat_info.st_mode)
65 file_mode = stat.S_IMODE(stat_info.st_mode)
General Comments 0
You need to be logged in to leave comments. Login now