summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Clauss <cclauss@me.com>2022-12-04 10:15:08 +0100
committerGitHub <noreply@github.com>2022-12-04 10:15:08 +0100
commit30136b1daa379d6fe8ab6b822ce6ced6252f2e63 (patch)
tree16d24589b9788cdff4f759a0a7ceecdba7d15622
parent715a2295117c31882c6d94dd033964009163ea63 (diff)
parent4c621bf0ec0f15cf25b4fc25a4b232bb78329995 (diff)
downloadpystatsd-30136b1daa379d6fe8ab6b822ce6ced6252f2e63.tar.gz
Merge branch 'main' into patch-1
-rw-r--r--.github/workflows/ci.yml4
-rw-r--r--.github/workflows/codeql.yml72
-rw-r--r--CHANGELOG.md8
-rw-r--r--docs/conf.py23
-rw-r--r--pyproject.toml9
-rw-r--r--statsd/__init__.py2
-rw-r--r--statsd/client/base.py10
-rw-r--r--statsd/client/timer.py2
-rw-r--r--statsd/client/udp.py4
-rw-r--r--statsd/tests.py6
10 files changed, 110 insertions, 30 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index d78cf7d..6d0da75 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -5,12 +5,14 @@ on:
- main
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
+ schedule:
+ - cron: '33 7 * * 0' # run weekly on sundays
jobs:
test:
strategy:
fail-fast: false
matrix:
- os: [ubuntu-latest] # [macos-latest, ubuntu-latest, windows-latest]
+ os: [ubuntu-latest]
python: ['3.7', '3.8', '3.9', '3.10', '3.11', 'pypy-3.9']
runs-on: ${{ matrix.os }}
steps:
diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml
new file mode 100644
index 0000000..2ab9593
--- /dev/null
+++ b/.github/workflows/codeql.yml
@@ -0,0 +1,72 @@
+# For most projects, this workflow file will not need changing; you simply need
+# to commit it to your repository.
+#
+# You may wish to alter this file to override the set of languages analyzed,
+# or to provide custom queries or build logic.
+#
+# ******** NOTE ********
+# We have attempted to detect the languages in your repository. Please check
+# the `language` matrix defined below to confirm you have the correct set of
+# supported CodeQL languages.
+#
+name: "CodeQL"
+
+on:
+ push:
+ branches: [ "main" ]
+ pull_request:
+ # The branches below must be a subset of the branches above
+ branches: [ "main" ]
+ schedule:
+ - cron: '18 0 * * 1'
+
+jobs:
+ analyze:
+ name: Analyze
+ runs-on: ubuntu-latest
+ permissions:
+ actions: read
+ contents: read
+ security-events: write
+
+ strategy:
+ fail-fast: false
+ matrix:
+ language: [ 'python' ]
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v3
+
+ # Initializes the CodeQL tools for scanning.
+ - name: Initialize CodeQL
+ 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.
+ # By default, queries listed here will override any specified in a config file.
+ # Prefix the list here with "+" to use these queries and those in the config file.
+
+ # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
+ # queries: security-extended,security-and-quality
+
+
+ # Autobuild attempts to build any compiled languages (C/C++, C#, Go, 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@v2
+
+ # ℹī¸ Command-line programs to run using the OS shell.
+ # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
+
+ # If the Autobuild fails above, remove it and uncomment the following three lines.
+ # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
+
+ # - run: |
+ # echo "Run, Build Application using script"
+ # ./location_of_script_within_repo/buildscript.sh
+
+ - name: Perform CodeQL Analysis
+ uses: github/codeql-action/analyze@v2
+ with:
+ category: "/language:${{matrix.language}}"
diff --git a/CHANGELOG.md b/CHANGELOG.md
index bb86c10..d476d11 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,13 @@
# Statsd Changelog
+## UNRELEASED
+
+## v4.0.1
+
+### Fixed
+
+- Updated PyPI trove classifiers for current Python versions.
+
## v4.0
### Added
diff --git a/docs/conf.py b/docs/conf.py
index 71cfeee..e5141dd 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -1,5 +1,3 @@
-# -*- coding: utf-8 -*-
-#
# Python StatsD documentation build configuration file, created by
# sphinx-quickstart on Mon Apr 9 15:47:23 2012.
#
@@ -11,7 +9,8 @@
# All configuration values have a default; values that are commented out
# serve to show the default.
-import sys, os
+import os
+import sys
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
@@ -40,8 +39,8 @@ source_suffix = '.rst'
master_doc = 'index'
# General information about the project.
-project = u'Python StatsD'
-copyright = u'2015, James Socol'
+project = 'Python StatsD'
+copyright = '2015, James Socol'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
@@ -50,7 +49,7 @@ copyright = u'2015, James Socol'
# The short X.Y version.
version = '4.0'
# The full version, including alpha/beta/rc tags.
-release = '4.0.0'
+release = '4.0.1'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
@@ -183,8 +182,8 @@ latex_elements = {
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
- ('index', 'PythonStatsD.tex', u'Python StatsD Documentation',
- u'James Socol', 'manual'),
+ ('index', 'PythonStatsD.tex', 'Python StatsD Documentation',
+ 'James Socol', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
@@ -213,8 +212,8 @@ latex_documents = [
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
- ('index', 'pythonstatsd', u'Python StatsD Documentation',
- [u'James Socol'], 1)
+ ('index', 'pythonstatsd', 'Python StatsD Documentation',
+ ['James Socol'], 1)
]
# If true, show URL addresses after external links.
@@ -227,8 +226,8 @@ man_pages = [
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
- ('index', 'PythonStatsD', u'Python StatsD Documentation',
- u'James Socol', 'PythonStatsD', 'One line description of project.',
+ ('index', 'PythonStatsD', 'Python StatsD Documentation',
+ 'James Socol', 'PythonStatsD', 'One line description of project.',
'Miscellaneous'),
]
diff --git a/pyproject.toml b/pyproject.toml
index faed4aa..b931110 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "statsd"
-version = "4.0.0"
+version = "4.0.1"
authors = [{name = "James Socol", email = "me@jamessocol.com"}]
license = {text = "MIT"}
description = "A simple statsd client."
@@ -16,13 +16,12 @@ classifiers = [
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python",
- "Programming Language :: Python :: 2",
- "Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
- "Programming Language :: Python :: 3.5",
- "Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
+ "Programming Language :: Python :: 3.9",
+ "Programming Language :: Python :: 3.10",
+ "Programming Language :: Python :: 3.11",
"Topic :: Software Development :: Libraries :: Python Modules",
]
urls = {Homepage = "https://github.com/jsocol/pystatsd"}
diff --git a/statsd/__init__.py b/statsd/__init__.py
index 4834ecd..839a767 100644
--- a/statsd/__init__.py
+++ b/statsd/__init__.py
@@ -3,6 +3,6 @@ from .client import TCPStatsClient
from .client import UnixSocketStatsClient
-VERSION = (4, 0, 0)
+VERSION = (4, 0, 1)
__version__ = '.'.join(map(str, VERSION))
__all__ = ['StatsClient', 'TCPStatsClient', 'UnixSocketStatsClient']
diff --git a/statsd/client/base.py b/statsd/client/base.py
index 61dcf18..4fbbe5c 100644
--- a/statsd/client/base.py
+++ b/statsd/client/base.py
@@ -5,7 +5,7 @@ from datetime import timedelta
from .timer import Timer
-class StatsClientBase(object):
+class StatsClientBase:
"""A Base class for various statsd clients."""
def close(self):
@@ -51,7 +51,7 @@ class StatsClientBase(object):
pipe._send_stat(stat, '%s|g' % value, 1)
else:
prefix = '+' if delta and value >= 0 else ''
- self._send_stat(stat, '%s%s|g' % (prefix, value), rate)
+ self._send_stat(stat, '{}{}|g'.format(prefix, value), rate)
def set(self, stat, value, rate=1):
"""Set a set value."""
@@ -64,12 +64,12 @@ class StatsClientBase(object):
if rate < 1:
if random.random() > rate:
return
- value = '%s|@%s' % (value, rate)
+ value = '{}|@{}'.format(value, rate)
if self._prefix:
- stat = '%s.%s' % (self._prefix, stat)
+ stat = '{}.{}'.format(self._prefix, stat)
- return '%s:%s' % (stat, value)
+ return '{}:{}'.format(stat, value)
def _after(self, data):
if data:
diff --git a/statsd/client/timer.py b/statsd/client/timer.py
index 453197e..5354a47 100644
--- a/statsd/client/timer.py
+++ b/statsd/client/timer.py
@@ -10,7 +10,7 @@ def safe_wraps(wrapper, *args, **kwargs):
return functools.wraps(wrapper, *args, **kwargs)
-class Timer(object):
+class Timer:
"""A context manager/decorator for statsd.timing()."""
def __init__(self, client, stat, rate=1):
diff --git a/statsd/client/udp.py b/statsd/client/udp.py
index 4e44d5c..ec10fc7 100644
--- a/statsd/client/udp.py
+++ b/statsd/client/udp.py
@@ -6,7 +6,7 @@ from .base import StatsClientBase, PipelineBase
class Pipeline(PipelineBase):
def __init__(self, client):
- super(Pipeline, self).__init__(client)
+ super().__init__(client)
self._maxudpsize = client._maxudpsize
def _send(self):
@@ -40,7 +40,7 @@ class StatsClient(StatsClientBase):
"""Send data to statsd."""
try:
self._sock.sendto(data.encode('ascii'), self._addr)
- except (socket.error, RuntimeError):
+ except (OSError, RuntimeError):
# No time for love, Dr. Jones!
pass
diff --git a/statsd/tests.py b/statsd/tests.py
index d1b2a96..5688977 100644
--- a/statsd/tests.py
+++ b/statsd/tests.py
@@ -69,7 +69,7 @@ def _timer_check(sock, count, proto, start, end):
send = send_method[proto](sock)
eq_(send.call_count, count)
value = send.call_args[0][0].decode('ascii')
- exp = re.compile(r'^%s:\d+|%s$' % (start, end))
+ exp = re.compile(r'^{}:\d+|{}$'.format(start, end))
assert exp.match(value)
@@ -85,7 +85,7 @@ def _sock_check(sock, count, proto, val=None, addr=None):
)
-class assert_raises(object):
+class assert_raises:
"""A context manager that asserts a given exception was raised.
>>> with assert_raises(TypeError):
@@ -132,7 +132,7 @@ class assert_raises(object):
def __exit__(self, typ, value, tb):
assert typ, 'No exception raised.'
- assert typ in self.exc_cls, '%s not in %s' % (
+ assert typ in self.exc_cls, '{} not in {}'.format(
typ.__name__, [e.__name__ for e in self.exc_cls])
self.exc_type = typ
self.exception = value