sentry-relay 0.8.27__zip → 0.8.28__zip

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.
@@ -1,6 +1,6 @@
1
- Metadata-Version: 1.0
1
+ Metadata-Version: 1.2
2
2
  Name: sentry-relay
3
- Version: 0.8.27
3
+ Version: 0.8.28
4
4
  Summary: A python library to access sentry relay functionality.
5
5
  Home-page: UNKNOWN
6
6
  Author: Sentry
@@ -8,3 +8,4 @@ Author-email: hello@sentry.io
8
8
  License: BSL-1.1
9
9
  Description: UNKNOWN
10
10
  Platform: any
11
+ Requires-Python: >=3.8
@@ -1,7 +1,6 @@
1
1
  import json
2
2
  import uuid
3
3
  from sentry_relay._lowlevel import lib
4
- from sentry_relay._compat import PY2, text_type, implements_to_string
5
4
  from sentry_relay.utils import (
6
5
  RustObject,
7
6
  encode_str,
@@ -23,7 +22,6 @@ __all__ = [
23
22
  ]
24
23
 
25
24
 
26
- @implements_to_string
27
25
  class PublicKey(RustObject):
28
26
  __dealloc_func__ = lib.relay_publickey_free
29
27
 
@@ -49,7 +47,7 @@ class PublicKey(RustObject):
49
47
  return decode_str(self._methodcall(lib.relay_publickey_to_string), free=True)
50
48
 
51
49
  def __repr__(self):
52
- return "<%s %r>" % (self.__class__.__name__, text_type(self))
50
+ return f"<{self.__class__.__name__} {str(self)!r}>"
53
51
 
54
52
 
55
53
  class SecretKey(RustObject):
@@ -66,16 +64,14 @@ class SecretKey(RustObject):
66
64
  return decode_str(self._methodcall(lib.relay_secretkey_sign, buf), free=True)
67
65
 
68
66
  def pack(self, data):
69
- packed = json.dumps(data, separators=(",", ":"))
70
- if not PY2:
71
- packed = packed.encode("utf8")
67
+ packed = json.dumps(data, separators=(",", ":")).encode("utf8")
72
68
  return packed, self.sign(packed)
73
69
 
74
70
  def __str__(self):
75
71
  return decode_str(self._methodcall(lib.relay_secretkey_to_string), free=True)
76
72
 
77
73
  def __repr__(self):
78
- return "<%s %r>" % (self.__class__.__name__, text_type(self))
74
+ return f"<{self.__class__.__name__} {str(self)!r}>"
79
75
 
80
76
 
81
77
  def generate_key_pair():
@@ -1,4 +1,3 @@
1
- from sentry_relay._compat import implements_to_string
2
1
  from sentry_relay._lowlevel import lib
3
2
 
4
3
 
@@ -6,7 +5,6 @@ __all__ = ["RelayError"]
6
5
  exceptions_by_code = {}
7
6
 
8
7
 
9
- @implements_to_string
10
8
  class RelayError(Exception):
11
9
  code = None
12
10
 
@@ -18,7 +16,7 @@ class RelayError(Exception):
18
16
  def __str__(self):
19
17
  rv = self.message
20
18
  if self.rust_info is not None:
21
- return "%s\n\n%s" % (rv, self.rust_info)
19
+ return f"{rv}\n\n{self.rust_info}"
22
20
  return rv
23
21
 
24
22
 
@@ -1,6 +1,5 @@
1
1
  import json
2
2
 
3
- from sentry_relay._compat import string_types, iteritems, text_type
4
3
  from sentry_relay._lowlevel import lib, ffi
5
4
  from sentry_relay.utils import (
6
5
  encode_str,
@@ -65,10 +64,10 @@ def meta_with_chunks(data, meta):
65
64
  return meta
66
65
 
67
66
  result = {}
68
- for key, item in iteritems(meta):
67
+ for key, item in meta.items():
69
68
  if key == "" and isinstance(item, dict):
70
69
  result[""] = item.copy()
71
- if item.get("rem") and isinstance(data, string_types):
70
+ if item.get("rem") and isinstance(data, str):
72
71
  result[""]["chunks"] = split_chunks(data, item["rem"])
73
72
  elif isinstance(data, dict):
74
73
  result[key] = meta_with_chunks(data.get(key), item)
@@ -88,14 +87,14 @@ class GeoIpLookup(RustObject):
88
87
 
89
88
  @classmethod
90
89
  def from_path(cls, path):
91
- if isinstance(path, text_type):
90
+ if isinstance(path, str):
92
91
  path = path.encode("utf-8")
93
92
  rv = cls._from_objptr(rustcall(lib.relay_geoip_lookup_new, path))
94
93
  rv._path = path
95
94
  return rv
96
95
 
97
96
  def __repr__(self):
98
- return "<GeoIpLookup %r>" % (self._path,)
97
+ return f"<GeoIpLookup {self._path!r}>"
99
98
 
100
99
 
101
100
  class StoreNormalizer(RustObject):
@@ -124,7 +123,7 @@ class StoreNormalizer(RustObject):
124
123
 
125
124
  def _serialize_event(event):
126
125
  raw_event = json.dumps(event, ensure_ascii=False)
127
- if isinstance(raw_event, text_type):
126
+ if isinstance(raw_event, str):
128
127
  raw_event = raw_event.encode("utf-8", errors="replace")
129
128
  return raw_event
130
129
 
@@ -157,13 +156,13 @@ def is_glob_match(
157
156
  if allow_newline:
158
157
  flags |= lib.GLOB_FLAGS_ALLOW_NEWLINE
159
158
 
160
- if isinstance(value, text_type):
159
+ if isinstance(value, str):
161
160
  value = value.encode("utf-8")
162
161
  return rustcall(lib.relay_is_glob_match, make_buf(value), encode_str(pat), flags)
163
162
 
164
163
 
165
164
  def is_codeowners_path_match(value, pattern):
166
- if isinstance(value, text_type):
165
+ if isinstance(value, str):
167
166
  value = value.encode("utf-8")
168
167
  return rustcall(
169
168
  lib.relay_is_codeowners_path_match, make_buf(value), encode_str(pattern)
@@ -178,7 +177,7 @@ def validate_pii_config(config):
178
177
  as a string such that line numbers from the error message match with what
179
178
  the user typed in.
180
179
  """
181
- assert isinstance(config, string_types)
180
+ assert isinstance(config, str)
182
181
  raw_error = rustcall(lib.relay_validate_pii_config, encode_str(config))
183
182
  error = decode_str(raw_error, free=True)
184
183
  if error:
@@ -232,7 +231,7 @@ def validate_sampling_condition(condition):
232
231
  Validate a dynamic rule condition. Used in dynamic sampling serializer.
233
232
  The parameter is a string containing the rule condition as JSON.
234
233
  """
235
- assert isinstance(condition, string_types)
234
+ assert isinstance(condition, str)
236
235
  raw_error = rustcall(lib.relay_validate_sampling_condition, encode_str(condition))
237
236
  error = decode_str(raw_error, free=True)
238
237
  if error:
@@ -244,7 +243,7 @@ def validate_sampling_configuration(condition):
244
243
  Validate the whole sampling configuration. Used in dynamic sampling serializer.
245
244
  The parameter is a string containing the rules configuration as JSON.
246
245
  """
247
- assert isinstance(condition, string_types)
246
+ assert isinstance(condition, str)
248
247
  raw_error = rustcall(
249
248
  lib.relay_validate_sampling_configuration, encode_str(condition)
250
249
  )
@@ -258,7 +257,7 @@ def validate_project_config(config, strict: bool):
258
257
 
259
258
  :param strict: Whether or not to check for unknown fields.
260
259
  """
261
- assert isinstance(config, string_types)
260
+ assert isinstance(config, str)
262
261
  raw_error = rustcall(lib.relay_validate_project_config, encode_str(config), strict)
263
262
  error = decode_str(raw_error, free=True)
264
263
  if error:
@@ -269,10 +268,10 @@ def run_dynamic_sampling(sampling_config, root_sampling_config, dsc, event):
269
268
  """
270
269
  Runs dynamic sampling on an event and returns the merged rules together with the sample rate.
271
270
  """
272
- assert isinstance(sampling_config, string_types)
273
- assert isinstance(root_sampling_config, string_types)
274
- assert isinstance(dsc, string_types)
275
- assert isinstance(event, string_types)
271
+ assert isinstance(sampling_config, str)
272
+ assert isinstance(root_sampling_config, str)
273
+ assert isinstance(dsc, str)
274
+ assert isinstance(event, str)
276
275
 
277
276
  result_json = rustcall(
278
277
  lib.run_dynamic_sampling,
@@ -2,7 +2,6 @@ import os
2
2
  import uuid
3
3
  import weakref
4
4
  from sentry_relay._lowlevel import ffi, lib
5
- from sentry_relay._compat import text_type, with_metaclass
6
5
  from sentry_relay.exceptions import exceptions_by_code, RelayError
7
6
 
8
7
 
@@ -35,7 +34,7 @@ def rustcall(func, *args):
35
34
  raise exc
36
35
 
37
36
 
38
- class RustObject(with_metaclass(_NoDict)):
37
+ class RustObject(metaclass=_NoDict):
39
38
  __slots__ = ["_objptr", "_shared"]
40
39
  __dealloc_func__ = None
41
40
 
@@ -85,7 +84,7 @@ def decode_str(s, free=False):
85
84
  def encode_str(s, mutable=False):
86
85
  """Encodes a RelayStr"""
87
86
  rv = ffi.new("RelayStr *")
88
- if isinstance(s, text_type):
87
+ if isinstance(s, str):
89
88
  s = s.encode("utf-8")
90
89
  if mutable:
91
90
  s = bytearray(s)
@@ -59,7 +59,7 @@ def build_native(spec):
59
59
  def delete_scratchpad():
60
60
  try:
61
61
  shutil.rmtree(scratchpad)
62
- except (IOError, OSError):
62
+ except OSError:
63
63
  pass
64
64
 
65
65
  zf = zipfile.ZipFile("rustsrc.zip")
@@ -79,7 +79,7 @@ def build_native(spec):
79
79
  def find_dylib():
80
80
  cargo_target = os.environ.get("CARGO_BUILD_TARGET")
81
81
  if cargo_target:
82
- in_path = "target/%s/%s" % (cargo_target, target)
82
+ in_path = f"target/{cargo_target}/{target}"
83
83
  else:
84
84
  in_path = "target/%s" % target
85
85
  return build.find_dylib("relay_cabi", in_path=in_path)
@@ -109,6 +109,7 @@ setup(
109
109
  include_package_data=True,
110
110
  zip_safe=False,
111
111
  platforms="any",
112
+ python_requires=">=3.8",
112
113
  install_requires=['enum34>=1.1.6,<1.2.0;python_version<"3.4"', "milksnake>=0.1.2"],
113
114
  setup_requires=["milksnake>=0.1.2"],
114
115
  milksnake_tasks=[build_native],
@@ -0,0 +1 @@
1
+ 0.8.28
@@ -1,36 +0,0 @@
1
- import sys
2
-
3
-
4
- PY2 = sys.version_info[0] == 2
5
-
6
- if PY2:
7
- text_type = unicode # noqa
8
- int_types = (int, long) # noqa
9
- string_types = (str, unicode) # noqa
10
- range_type = xrange # noqa
11
- iteritems = lambda x: x.iteritems()
12
- itervalues = lambda x: x.itervalues()
13
- NUL = "\x00"
14
-
15
- def implements_to_string(cls):
16
- cls.__unicode__ = cls.__str__
17
- cls.__str__ = lambda x: x.__unicode__().encode("utf-8")
18
- return cls
19
-
20
- else:
21
- text_type = str
22
- int_types = (int,)
23
- string_types = (str,)
24
- range_type = range
25
- iteritems = lambda x: x.items()
26
- itervalues = lambda x: x.values()
27
- NUL = 0
28
- implements_to_string = lambda x: x
29
-
30
-
31
- def with_metaclass(meta, *bases):
32
- class metaclass(type):
33
- def __new__(cls, name, this_bases, d):
34
- return meta(name, bases, d)
35
-
36
- return type.__new__(metaclass, "temporary_class", (), {})
@@ -1 +0,0 @@
1
- 0.8.27
File without changes