Skip to content

Commit e5995ff

Browse files
committed
Adjust code style to be pep8 compatible
1 parent 416f49f commit e5995ff

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+342
-142
lines changed

LICENSE

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,4 +337,3 @@ proprietary programs. If your program is a subroutine library, you may
337337
consider it more useful to permit linking proprietary applications with the
338338
library. If this is what you want to do, use the GNU Lesser General
339339
Public License instead of this License.
340-

bin/did

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ range. By default all available stats for this week are reported.
3434

3535
import sys
3636

37-
import did.cli
3837
import did.base
38+
import did.cli
3939
import did.utils
4040

4141
try:

did/base.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,23 @@
22

33
""" Config, Date, User and Exceptions """
44

5+
import codecs
6+
import configparser
7+
import datetime
58
import io
69
import os
710
import re
811
import sys
9-
import codecs
10-
import datetime
11-
import optparse
12-
import configparser
13-
from dateutil.relativedelta import MO as MONDAY, FR as FRIDAY
14-
from datetime import timedelta
1512
from configparser import NoOptionError, NoSectionError
13+
from datetime import timedelta
14+
15+
from dateutil.relativedelta import FR as FRIDAY
16+
from dateutil.relativedelta import MO as MONDAY
1617
from dateutil.relativedelta import relativedelta as delta
1718

1819
from did import utils
1920
from did.utils import log
2021

21-
2222
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2323
# Constants
2424
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -51,15 +51,19 @@
5151
class GeneralError(Exception):
5252
""" General stats error """
5353

54+
5455
class ConfigError(GeneralError):
5556
""" Stats configuration problem """
5657

58+
5759
class ConfigFileError(ConfigError):
5860
""" Problem with the config file """
5961

62+
6063
class OptionError(GeneralError):
6164
""" Invalid command line """
6265

66+
6367
class ReportError(GeneralError):
6468
""" Report generation error """
6569

@@ -110,7 +114,7 @@ def plugins(self):
110114
""" Custom plugins """
111115
try:
112116
return self.parser.get("general", "plugins")
113-
except:
117+
except BaseException:
114118
return None
115119

116120
@property

did/cli.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@
77
running the main loop which gathers all individual stats.
88
"""
99

10+
import argparse
1011
import re
1112
import sys
12-
import argparse
13+
1314
from dateutil.relativedelta import relativedelta as delta
1415

1516
import did.base

did/plugins/bodhi.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@
1111
1212
"""
1313

14-
from did.utils import log, pretty, listed
15-
from did.base import Config, ReportError
16-
from did.stats import Stats, StatsGroup
17-
1814
from bodhi.client.bindings import BodhiClient
1915

16+
from did.base import Config, ReportError
17+
from did.stats import Stats, StatsGroup
18+
from did.utils import listed, log, pretty
2019

2120
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2221
# Investigator
2322
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2423

24+
2525
class Bodhi(object):
2626
""" Bodhi """
2727

@@ -57,6 +57,7 @@ def search(self, query):
5757

5858
class Update(object):
5959
""" Bodhi update """
60+
6061
def __init__(self, data):
6162
self.data = data
6263
self.title = data['title']
@@ -76,12 +77,13 @@ def __str__(self):
7677

7778
class UpdatesCreated(Stats):
7879
""" Updates created """
80+
7981
def fetch(self):
8082
log.info('Searching for updates created by {0}'.format(self.user))
8183
self.stats = [
8284
Update(update) for update in self.parent.bodhi.search(
83-
query='updates/?user={0}&submitted_before={1}'
84-
'&submitted_since={2}'.format(
85+
query='updates/?user={0}&submitted_before={1}'
86+
'&submitted_since={2}'.format(
8587
self.user.login, self.options.until.date,
8688
self.options.since.date))]
8789

did/plugins/bugzilla.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@
4242
.. _Preferences: https://bugzilla.redhat.com/userprefs.cgi?tab=apikey
4343
"""
4444

45-
import bugzilla
4645
import xmlrpc.client
4746

47+
import bugzilla
48+
4849
from did.base import Config, ReportError
4950
from did.stats import Stats, StatsGroup
5051
from did.utils import log, pretty, split
5152

52-
5353
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5454
# Constants
5555
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -274,13 +274,15 @@ def subscribed(self, user):
274274
# Bugzilla Stats
275275
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
276276

277+
277278
class VerifiedBugs(Stats):
278279
"""
279280
Bugs verified
280281
281282
Bugs with ``QA Contact`` field set to given user or changed by the
282283
given user and having their status changed to ``VERIFIED``.
283284
"""
285+
284286
def fetch(self):
285287
log.info("Searching for bugs verified by {0}".format(self.user))
286288
# Common query options
@@ -328,6 +330,7 @@ class ReturnedBugs(Stats):
328330
the ``ASSIGNED`` status, meaning the fix for the issue is not
329331
correct or complete.
330332
"""
333+
331334
def fetch(self):
332335
log.info("Searching for bugs returned by {0}".format(self.user))
333336
query = {
@@ -364,6 +367,7 @@ class FiledBugs(Stats):
364367
365368
Newly created bugs by given user, marked as the ``Reporter``.
366369
"""
370+
367371
def fetch(self):
368372
log.info("Searching for bugs filed by {0}".format(self.user))
369373
query = {
@@ -465,6 +469,7 @@ class PostedBugs(Stats):
465469
Bugs with patches posted for review, detected by their status
466470
change to ``POST`` and given user set as ``Assignee``.
467471
"""
472+
468473
def fetch(self):
469474
log.info("Searching for bugs posted by {0}".format(self.user))
470475
query = {
@@ -499,6 +504,7 @@ class PatchedBugs(Stats):
499504
denoting the patch for the issue is available (e.g. attached
500505
to the bug or pushed to a feature git branch).
501506
"""
507+
502508
def fetch(self):
503509
log.info("Searching for bugs patched by {0}".format(self.user))
504510
query = {
@@ -563,6 +569,7 @@ class CommentedBugs(Stats):
563569
564570
All bugs commented by given user in requested time frame.
565571
"""
572+
566573
def fetch(self):
567574
log.info("Searching for bugs commented by {0}".format(self.user))
568575
query = {
@@ -591,6 +598,7 @@ class SubscribedBugs(Stats):
591598
592599
All bugs subscribed by given user in requested time frame.
593600
"""
601+
594602
def fetch(self):
595603
log.info("Searching for bugs subscribed by {0}".format(self.user))
596604
query = {

did/plugins/confluence.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,18 @@
3232
higher priority.
3333
"""
3434

35+
import distutils.util
3536
import os
3637
import re
37-
import requests
3838
import urllib.parse
39-
import distutils.util
40-
from requests_gssapi import HTTPSPNEGOAuth, DISABLED
39+
40+
import requests
4141
from requests.packages.urllib3.exceptions import InsecureRequestWarning
42+
from requests_gssapi import DISABLED, HTTPSPNEGOAuth
4243

43-
from did.utils import log, pretty, listed
4444
from did.base import Config, ReportError
4545
from did.stats import Stats, StatsGroup
46+
from did.utils import listed, log, pretty
4647

4748
# Maximum number of results fetched at once
4849
MAX_RESULTS = 100
@@ -234,7 +235,7 @@ def __init__(self, option, name=None, parent=None, user=None):
234235
option=option + "-comments",
235236
parent=self,
236237
name="Comments added in {}".format(option)),
237-
]
238+
]
238239

239240
@property
240241
def session(self):

did/plugins/footer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313

1414
from did.stats import EmptyStatsGroup
1515

16-
1716
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1817
# Footer
1918
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2019

20+
2121
class Footer(EmptyStatsGroup):
2222
""" Footer """
2323
# Show footer at the bottom

did/plugins/gerrit.py

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,19 @@
1414
"""
1515

1616
import json
17-
import urllib.request
1817
import urllib.parse
18+
import urllib.request
1919
from datetime import datetime
2020

21-
from did.utils import log, pretty
21+
from did.base import TODAY, Config, ReportError
2222
from did.stats import Stats, StatsGroup
23-
from did.base import Config, ReportError, TODAY
24-
23+
from did.utils import log, pretty
2524

2625
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2726
# Change
2827
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2928

29+
3030
class Change(object):
3131
""" Request gerrit change """
3232

@@ -57,10 +57,12 @@ def __hash__(self):
5757
# Gerrit Stats
5858
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5959

60+
6061
class Gerrit(object):
6162
"""
6263
curl -s 'https://REPOURL/gerrit/changes/?q=is:abandoned+age:7d'
6364
"""
65+
6466
def __init__(self, baseurl, prefix):
6567
self.opener = urllib.request.FancyURLopener()
6668
self.baseurl = baseurl
@@ -122,6 +124,7 @@ class GerritUnit(Stats):
122124
General mother class offering general services for querying
123125
Gerrit repo.
124126
"""
127+
125128
def __init__(
126129
self, option, name=None, parent=None, base_url=None, prefix=None):
127130
self.base_url = base_url if base_url is not None else parent.repo_url
@@ -209,6 +212,7 @@ class AbandonedChanges(GerritUnit):
209212
"""
210213
Changes abandoned
211214
"""
215+
212216
def fetch(self):
213217
log.info("Searching for changes abandoned by {0}".format(self.user))
214218
self.stats = GerritUnit.fetch(self, 'status:abandoned')
@@ -220,6 +224,7 @@ class MergedChanges(GerritUnit):
220224
"""
221225
Changes successfully merged
222226
"""
227+
223228
def fetch(self):
224229
log.info("Searching for changes merged by {0}".format(self.user))
225230
self.stats = GerritUnit.fetch(self, 'status:merged')
@@ -238,35 +243,40 @@ class SubmitedChanges(GerritUnit):
238243
"""
239244
Changes submitted for review
240245
"""
246+
241247
def fetch(self):
242248
log.info("Searching for changes opened by {0}".format(self.user))
243249
if 'wip' in self.server_features:
244250
query_string = 'status:open -is:wip'
245251
else:
246252
query_string = 'status:open'
247253
self.stats = GerritUnit.fetch(self, query_string,
248-
limit_since=True)
254+
limit_since=True)
249255
log.debug("self.stats = {0}".format(self.stats))
250256

257+
251258
class WIPChanges(GerritUnit):
252259
"""
253260
Work in progress changes
254261
"""
262+
255263
def fetch(self):
256264
log.info("Searching for WIP changes opened by {0}".format(self.user))
257265
if 'wip' not in self.server_features:
258266
log.debug("WIP reviews are not supported by this server")
259267
return []
260268
self.stats = GerritUnit.fetch(self, 'status:open is:wip',
261-
limit_since=True)
269+
limit_since=True)
262270
log.debug("self.stats = {0}".format(self.stats))
263271

272+
264273
class AddedPatches(GerritUnit):
265274
# curl -s 'https://REPOURL\
266275
# /changes/?q=is:closed+owner:mcepl&q=is:open+owner:mcepl
267276
"""
268277
Additional patches added to existing changes
269278
"""
279+
270280
def fetch(self):
271281
log.info("Searching for patches added to changes by {0}".format(
272282
self.user))
@@ -320,6 +330,7 @@ class ReviewedChanges(GerritUnit):
320330
"""
321331
Review of a change (for reviewers)
322332
"""
333+
323334
def fetch(self):
324335
log.info("Searching for changes reviewed by {0}".format(self.user))
325336
# Collect ALL changes opened (and perhaps now closed) after
@@ -402,7 +413,7 @@ def __init__(self, option, name=None, parent=None, user=None):
402413
"No prefix set in the [{0}] section".format(option))
403414

404415
self.server_features = []
405-
if self.config.get('wip', True) == True:
416+
if self.config.get('wip', True):
406417
self.server_features.append('wip')
407418

408419
self.stats = [

0 commit comments

Comments
 (0)