diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index e4b67772..1a7449f2 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -24,11 +24,11 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v3 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v1 + uses: github/codeql-action/init@v2 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -39,7 +39,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@v1 + uses: github/codeql-action/autobuild@v2 # ℹī¸ Command-line programs to run using the OS shell. # 📚 https://git.io/JvXDl @@ -53,4 +53,4 @@ jobs: # make release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 + uses: github/codeql-action/analyze@v2 diff --git a/.github/workflows/tests-amd64.yml b/.github/workflows/tests-amd64.yml index a7144b6a..b80c8aa7 100644 --- a/.github/workflows/tests-amd64.yml +++ b/.github/workflows/tests-amd64.yml @@ -13,18 +13,9 @@ jobs: strategy: matrix: include: - - name: "Python 2.7" - python-version: '2.7' - toxenv: "py27" - - name: "Pypy 2.7" - python-version: 'pypy-2.7' - toxenv: 'pypy' - name: "Python 3.7" python-version: '3.7' toxenv: 'py37' - - name: "Pypy 3.7" - python-version: 'pypy-3.7' - toxenv: 'pypy3' - name: "Python 3.8" python-version: '3.8' toxenv: 'py38' @@ -34,10 +25,16 @@ jobs: - name: "Python 3.10" python-version: '3.10' toxenv: 'py310' + - name: "Pypy 3.10" + python-version: 'pypy-3.10' + toxenv: 'pypy3' + - name: "Python 3.11" + python-version: '3.11' + toxenv: 'py311' steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - name: Install dependencies @@ -51,18 +48,18 @@ jobs: run: | tox - name: Linting - if: ${{ matrix.python-version==3.10 }} + if: ${{ matrix.python-version==3.11 }} env: TOXENV: lint run: | tox - name: Run Codecov - if: ${{ matrix.python-version==3.10 }} + if: ${{ matrix.python-version==3.11 }} env: TOXENV: lint run: | pip install codecov codecov - name: Upload coverage to Codecov - if: ${{ matrix.python-version==3.10 }} - uses: codecov/codecov-action@v1 + if: ${{ matrix.python-version==3.11 }} + uses: codecov/codecov-action@v3 diff --git a/lib/carbon/carbon_pb2.py b/lib/carbon/carbon_pb2.py index b056c361..9a4a0f67 100644 --- a/lib/carbon/carbon_pb2.py +++ b/lib/carbon/carbon_pb2.py @@ -1,161 +1,30 @@ +# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: carbon.proto - -import sys +"""Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor -from google.protobuf import message as _message -from google.protobuf import reflection as _reflection +from google.protobuf import descriptor_pool as _descriptor_pool from google.protobuf import symbol_database as _symbol_database +from google.protobuf.internal import builder as _builder # @@protoc_insertion_point(imports) - _sym_db = _symbol_database.Default() -_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode('latin1')) - -DESCRIPTOR = _descriptor.FileDescriptor( - name='carbon.proto', - package='carbon', - syntax='proto3', - serialized_pb=_b('\n\x0c\x63\x61rbon.proto\x12\x06\x63\x61rbon\")\n\x05Point\x12\x11\n\ttimestamp' - '\x18\x01 \x01(\r\x12\r\n\x05value\x18\x02 \x01(\x01\"7\n\x06Metric\x12\x0e\n' - '\x06metric\x18\x01 \x01(\t\x12\x1d\n\x06points\x18\x02 \x03(\x0b\x32\r.carbon.' - 'Point\"*\n\x07Payload\x12\x1f\n\x07metrics\x18\x01 \x03(\x0b\x32\x0e.carbon.' - 'Metricb\x06proto3') -) -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - -_POINT = _descriptor.Descriptor( - name='Point', - full_name='carbon.Point', - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name='timestamp', full_name='carbon.Point.timestamp', index=0, - number=1, type=13, cpp_type=3, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='value', full_name='carbon.Point.value', index=1, - number=2, type=1, cpp_type=5, label=1, - has_default_value=False, default_value=float(0), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=24, - serialized_end=65, -) - - -_METRIC = _descriptor.Descriptor( - name='Metric', - full_name='carbon.Metric', - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name='metric', full_name='carbon.Metric.metric', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=_b("").decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='points', full_name='carbon.Metric.points', index=1, - number=2, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=67, - serialized_end=122, -) - - -_PAYLOAD = _descriptor.Descriptor( - name='Payload', - full_name='carbon.Payload', - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name='metrics', full_name='carbon.Payload.metrics', index=0, - number=1, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=124, - serialized_end=166, -) -_METRIC.fields_by_name['points'].message_type = _POINT -_PAYLOAD.fields_by_name['metrics'].message_type = _METRIC -DESCRIPTOR.message_types_by_name['Point'] = _POINT -DESCRIPTOR.message_types_by_name['Metric'] = _METRIC -DESCRIPTOR.message_types_by_name['Payload'] = _PAYLOAD -Point = _reflection.GeneratedProtocolMessageType('Point', (_message.Message,), dict( - DESCRIPTOR=_POINT, - __module__='carbon_pb2' - # @@protoc_insertion_point(class_scope:carbon.Point) -)) -_sym_db.RegisterMessage(Point) -Metric = _reflection.GeneratedProtocolMessageType('Metric', (_message.Message,), dict( - DESCRIPTOR=_METRIC, - __module__='carbon_pb2' - # @@protoc_insertion_point(class_scope:carbon.Metric) -)) -_sym_db.RegisterMessage(Metric) +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0c\x63\x61rbon.proto\x12\x06\x63\x61rbon\")\n\x05Point\x12\x11\n\ttimestamp\x18\x01 \x01(\r\x12\r\n\x05value\x18\x02 \x01(\x01\"7\n\x06Metric\x12\x0e\n\x06metric\x18\x01 \x01(\t\x12\x1d\n\x06points\x18\x02 \x03(\x0b\x32\r.carbon.Point\"*\n\x07Payload\x12\x1f\n\x07metrics\x18\x01 \x03(\x0b\x32\x0e.carbon.Metricb\x06proto3') -Payload = _reflection.GeneratedProtocolMessageType('Payload', (_message.Message,), dict( - DESCRIPTOR=_PAYLOAD, - __module__='carbon_pb2' - # @@protoc_insertion_point(class_scope:carbon.Payload) -)) -_sym_db.RegisterMessage(Payload) +_globals = globals() +_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) +_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'carbon_pb2', _globals) +if _descriptor._USE_C_DESCRIPTORS == False: + DESCRIPTOR._options = None + _globals['_POINT']._serialized_start=24 + _globals['_POINT']._serialized_end=65 + _globals['_METRIC']._serialized_start=67 + _globals['_METRIC']._serialized_end=122 + _globals['_PAYLOAD']._serialized_start=124 + _globals['_PAYLOAD']._serialized_end=166 # @@protoc_insertion_point(module_scope) diff --git a/lib/carbon/tests/test_protocols.py b/lib/carbon/tests/test_protocols.py index 97909bd9..a9848f58 100644 --- a/lib/carbon/tests/test_protocols.py +++ b/lib/carbon/tests/test_protocols.py @@ -244,19 +244,19 @@ def test_invalid_pickle(self): self.receiver.stringReceived(b"i") # ImportError self.receiver.stringReceived(b"iii") - MetricReceiver.metricReceived.not_called() + MetricReceiver.metricReceived.assert_not_called() def test_decode_pickle(self): """ Missing timestamp/value should not call metricReceived """ metrics = [('foo.bar', 1)] self.receiver.stringReceived(pickle.dumps(metrics)) - MetricReceiver.metricReceived.not_called() + MetricReceiver.metricReceived.assert_not_called() def test_invalid_types(self): """ Timestamp/value in wrong type should not call metricReceived """ metrics = [('foo.bar', ('a', 'b'))] self.receiver.stringReceived(pickle.dumps(metrics)) - MetricReceiver.metricReceived.not_called() + MetricReceiver.metricReceived.assert_not_called() def test_py2_unicode_to_string_conversion(self): """ Metricname in python2 unicode type should be transformed to str """ diff --git a/tox.ini b/tox.ini index bc9ff1af..071fe346 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] envlist = - py{27,36,37,38,39,py,py3}{,-pyhash}, + py{37,38,39,310,311,py3}{,-pyhash}, lint, benchmark @@ -22,7 +22,7 @@ deps = flake8 six commands = - flake8 {toxinidir}/lib {toxinidir}/bin + flake8 --exclude {toxinidir}/lib/carbon/carbon_pb2.py {toxinidir}/lib {toxinidir}/bin [testenv:benchmark] voting = False