libmozdata 0.2.8__tar.gz → 0.2.10__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.
Files changed (39) hide show
  1. {libmozdata-0.2.8/libmozdata.egg-info → libmozdata-0.2.10}/PKG-INFO +1 -1
  2. libmozdata-0.2.10/VERSION +1 -0
  3. {libmozdata-0.2.8 → libmozdata-0.2.10}/libmozdata/config.py +25 -6
  4. {libmozdata-0.2.8 → libmozdata-0.2.10}/libmozdata/lando.py +7 -5
  5. {libmozdata-0.2.8 → libmozdata-0.2.10/libmozdata.egg-info}/PKG-INFO +1 -1
  6. libmozdata-0.2.8/VERSION +0 -1
  7. {libmozdata-0.2.8 → libmozdata-0.2.10}/MANIFEST.in +0 -0
  8. {libmozdata-0.2.8 → libmozdata-0.2.10}/README.md +0 -0
  9. {libmozdata-0.2.8 → libmozdata-0.2.10}/libmozdata/BZInfo.py +0 -0
  10. {libmozdata-0.2.8 → libmozdata-0.2.10}/libmozdata/FXRevision.py +0 -0
  11. {libmozdata-0.2.8 → libmozdata-0.2.10}/libmozdata/FileStats.py +0 -0
  12. {libmozdata-0.2.8 → libmozdata-0.2.10}/libmozdata/HGFileInfo.py +0 -0
  13. {libmozdata-0.2.8 → libmozdata-0.2.10}/libmozdata/__init__.py +0 -0
  14. {libmozdata-0.2.8 → libmozdata-0.2.10}/libmozdata/bugzilla.py +0 -0
  15. {libmozdata-0.2.8 → libmozdata-0.2.10}/libmozdata/buildhub.py +0 -0
  16. {libmozdata-0.2.8 → libmozdata-0.2.10}/libmozdata/clouseau.py +0 -0
  17. {libmozdata-0.2.8 → libmozdata-0.2.10}/libmozdata/connection.py +0 -0
  18. {libmozdata-0.2.8 → libmozdata-0.2.10}/libmozdata/fx_trains.py +0 -0
  19. {libmozdata-0.2.8 → libmozdata-0.2.10}/libmozdata/handler.py +0 -0
  20. {libmozdata-0.2.8 → libmozdata-0.2.10}/libmozdata/hgmozilla.py +0 -0
  21. {libmozdata-0.2.8 → libmozdata-0.2.10}/libmozdata/modules.json +0 -0
  22. {libmozdata-0.2.8 → libmozdata-0.2.10}/libmozdata/modules.py +0 -0
  23. {libmozdata-0.2.8 → libmozdata-0.2.10}/libmozdata/patchanalysis.py +0 -0
  24. {libmozdata-0.2.8 → libmozdata-0.2.10}/libmozdata/phabricator.py +0 -0
  25. {libmozdata-0.2.8 → libmozdata-0.2.10}/libmozdata/redash.py +0 -0
  26. {libmozdata-0.2.8 → libmozdata-0.2.10}/libmozdata/release_owners.py +0 -0
  27. {libmozdata-0.2.8 → libmozdata-0.2.10}/libmozdata/socorro.py +0 -0
  28. {libmozdata-0.2.8 → libmozdata-0.2.10}/libmozdata/utils.py +0 -0
  29. {libmozdata-0.2.8 → libmozdata-0.2.10}/libmozdata/vcs_map.py +0 -0
  30. {libmozdata-0.2.8 → libmozdata-0.2.10}/libmozdata/versions.py +0 -0
  31. {libmozdata-0.2.8 → libmozdata-0.2.10}/libmozdata/wiki_parser.py +0 -0
  32. {libmozdata-0.2.8 → libmozdata-0.2.10}/libmozdata.egg-info/SOURCES.txt +0 -0
  33. {libmozdata-0.2.8 → libmozdata-0.2.10}/libmozdata.egg-info/dependency_links.txt +0 -0
  34. {libmozdata-0.2.8 → libmozdata-0.2.10}/libmozdata.egg-info/not-zip-safe +0 -0
  35. {libmozdata-0.2.8 → libmozdata-0.2.10}/libmozdata.egg-info/requires.txt +0 -0
  36. {libmozdata-0.2.8 → libmozdata-0.2.10}/libmozdata.egg-info/top_level.txt +0 -0
  37. {libmozdata-0.2.8 → libmozdata-0.2.10}/requirements.txt +0 -0
  38. {libmozdata-0.2.8 → libmozdata-0.2.10}/setup.cfg +0 -0
  39. {libmozdata-0.2.8 → libmozdata-0.2.10}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 1.1
2
2
  Name: libmozdata
3
- Version: 0.2.8
3
+ Version: 0.2.10
4
4
  Summary: Library to access and aggregate several Mozilla data sources.
5
5
  Home-page: https://github.com/mozilla/libmozdata
6
6
  Author: Mozilla Release Management
@@ -0,0 +1 @@
1
+ 0.2.10
@@ -11,12 +11,19 @@ except ImportError:
11
11
 
12
12
 
13
13
  class Config(object):
14
- def get(section, option, default=None):
15
- raise NotImplementedError
14
+ def __init__(self):
15
+ self.local_config = {}
16
+
17
+ def set_default(self, section, option, value):
18
+ self.local_config[(section, option)] = value
19
+
20
+ def get(self, section, option, default=None):
21
+ return self.local_config.get((section, option), default)
16
22
 
17
23
 
18
24
  class ConfigIni(Config):
19
25
  def __init__(self, path=None):
26
+ super().__init__()
20
27
  self.config = ConfigParser()
21
28
  if path is not None:
22
29
  self.config.read(path)
@@ -32,7 +39,9 @@ class ConfigIni(Config):
32
39
 
33
40
  def get(self, section, option, default=None, type=str):
34
41
  if not self.config.has_option(section, option):
35
- return default
42
+ if default is not None:
43
+ return default
44
+ return super().get(section, option)
36
45
 
37
46
  res = self.config.get(section, option)
38
47
  if type == list or type == set:
@@ -45,12 +54,17 @@ class ConfigIni(Config):
45
54
 
46
55
 
47
56
  class ConfigEnv(Config):
48
- def get(self, section, option, default=None):
57
+ def get(self, section, option, default=None, type=str):
49
58
  env = os.environ.get("LIBMOZDATA_CFG_" + section.upper() + "_" + option.upper())
50
59
  if not env:
51
- return default
60
+ if default is not None:
61
+ return default
62
+ return super().get(section, option)
52
63
 
53
- return env
64
+ if type == list or type == set:
65
+ return type([s.strip(" /t") for s in env.split(",")])
66
+ else:
67
+ return type(env)
54
68
 
55
69
 
56
70
  __config = ConfigIni()
@@ -69,3 +83,8 @@ def get(section, option, default=None, type=str, required=False):
69
83
  if required:
70
84
  assert value is not None, f"Option {option} in section {section} is not set"
71
85
  return value
86
+
87
+
88
+ def set_default_value(section, option, value):
89
+ global __config
90
+ __config.set_default(section, option, value)
@@ -14,7 +14,7 @@ class LandoWarnings(object):
14
14
  """
15
15
 
16
16
  def __init__(self, api_url, api_key):
17
- self.api_url = f"{api_url}/diff_warnings"
17
+ self.api_url = f"{api_url}/diff_warnings/"
18
18
  self.api_key = api_key
19
19
  self.USER_AGENT = config.get("User-Agent", "name", required=True)
20
20
 
@@ -26,7 +26,7 @@ class LandoWarnings(object):
26
26
  warning_id = warning["id"]
27
27
 
28
28
  response = requests.delete(
29
- f"{self.api_url}/{warning_id}",
29
+ f"{self.api_url}{warning_id}",
30
30
  headers={
31
31
  "X-Phabricator-API-Key": self.api_key,
32
32
  "User-Agent": self.USER_AGENT,
@@ -34,7 +34,9 @@ class LandoWarnings(object):
34
34
  )
35
35
 
36
36
  if response.status_code != 200:
37
- raise Exception(f"Failed to delete warning with ID {warning_id}!")
37
+ raise Exception(
38
+ f"Failed to delete warning with ID {warning_id} with error {response.status_code}:\n{response.text}"
39
+ )
38
40
 
39
41
  def add_warning(self, warning, revision_id, diff_id):
40
42
  """
@@ -55,7 +57,7 @@ class LandoWarnings(object):
55
57
  )
56
58
  if response.status_code != 201:
57
59
  raise Exception(
58
- f"Failed to add warnings for revision_id {revision_id} and diff_id {diff_id}!"
60
+ f"Failed to add warnings for revision_id {revision_id} and diff_id {diff_id} with error {response.status_code}:\n{response.text}"
59
61
  )
60
62
 
61
63
  def get_warnings(self, revision_id, diff_id):
@@ -76,7 +78,7 @@ class LandoWarnings(object):
76
78
  )
77
79
  if response.status_code != 200:
78
80
  raise Exception(
79
- f"Failed to get warnings for revision_id {revision_id} and diff_id {diff_id}!"
81
+ f"Failed to get warnings for revision_id {revision_id} and diff_id {diff_id} with error {response.status_code}:\n{response.text}"
80
82
  )
81
83
 
82
84
  return response.json()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 1.1
2
2
  Name: libmozdata
3
- Version: 0.2.8
3
+ Version: 0.2.10
4
4
  Summary: Library to access and aggregate several Mozilla data sources.
5
5
  Home-page: https://github.com/mozilla/libmozdata
6
6
  Author: Mozilla Release Management
libmozdata-0.2.8/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.2.8
File without changes
File without changes
File without changes
File without changes
File without changes