Ori.livneh has uploaded a new change for review.
https://gerrit.wikimedia.org/r/176502
Change subject: Remove odd markup from in-line comments
......................................................................
Remove odd markup from in-line comments
I'm not sure what the '#:' thing was about.
Change-Id: Ibcd2b4ed1a007716fb3eb31a64ea23e02d770f2a
---
M server/eventlogging/handlers.py
M server/eventlogging/jrm.py
M server/eventlogging/parse.py
M server/eventlogging/schema.py
M server/eventlogging/streams.py
M server/tests/fixtures.py
6 files changed, 63 insertions(+), 63 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/EventLogging
refs/changes/02/176502/1
diff --git a/server/eventlogging/handlers.py b/server/eventlogging/handlers.py
index a01dfdd..268f7e9 100644
--- a/server/eventlogging/handlers.py
+++ b/server/eventlogging/handlers.py
@@ -31,9 +31,9 @@
__all__ = ('load_plugins',)
-#: EventLogging will attempt to load the configuration file specified in the
-#: 'EVENTLOGGING_PLUGIN_DIR' environment variable if it is defined. If it is
-#: not defined, EventLogging will default to the value specified below.
+# EventLogging will attempt to load the configuration file specified in the
+# 'EVENTLOGGING_PLUGIN_DIR' environment variable if it is defined. If it is
+# not defined, EventLogging will default to the value specified below.
DEFAULT_PLUGIN_DIR = '/usr/local/lib/eventlogging'
diff --git a/server/eventlogging/jrm.py b/server/eventlogging/jrm.py
index e5a0fc6..a83953b 100644
--- a/server/eventlogging/jrm.py
+++ b/server/eventlogging/jrm.py
@@ -22,18 +22,18 @@
__all__ = ('store_sql_events', 'flatten')
-#: Format string for :func:`datetime.datetime.strptime` for MediaWiki
-#: timestamps. See `<http://www.mediawiki.org/wiki/Manual:Timestamp>`_.
+# Format string for :func:`datetime.datetime.strptime` for MediaWiki
+# timestamps. See `<http://www.mediawiki.org/wiki/Manual:Timestamp>`_.
MEDIAWIKI_TIMESTAMP = '%Y%m%d%H%M%S'
-#: Format string for table names. Interpolates a `SCID` -- i.e., a tuple
-#: of (schema_name, revision_id).
+# Format string for table names. Interpolates a `SCID` -- i.e., a tuple
+# of (schema_name, revision_id).
TABLE_NAME_FORMAT = '%s_%s'
-#: An iterable of properties that should not be stored in the database.
+# An iterable of properties that should not be stored in the database.
NO_DB_PROPERTIES = ('recvFrom', 'revision', 'schema', 'seqId')
-#: A dictionary mapping database engine names to table defaults.
+# A dictionary mapping database engine names to table defaults.
ENGINE_TABLE_OPTIONS = {
'mysql': {
'mysql_charset': 'utf8',
@@ -41,15 +41,15 @@
}
}
-#: How long (in seconds) we should accumulate events before flushing
-#: to the database.
+# How long (in seconds) we should accumulate events before flushing
+# to the database.
DB_FLUSH_INTERVAL = 2
class MediaWikiTimestamp(sqlalchemy.TypeDecorator):
"""A :class:`sqlalchemy.TypeDecorator` for MediaWiki timestamps."""
- #: Timestamps are stored as VARCHAR(14) columns.
+ # Timestamps are stored as VARCHAR(14) columns.
impl = sqlalchemy.Unicode(14)
def process_bind_param(self, value, dialect=None):
@@ -69,24 +69,24 @@
return datetime.datetime.strptime(value, MEDIAWIKI_TIMESTAMP)
-#: Maximum length for string and string-like types. Because InnoDB limits index
-#: columns to 767 bytes, the maximum length for a utf8mb4 column (which
-#: reserves up to four bytes per character) is 191 (191 * 4 = 764).
+# Maximum length for string and string-like types. Because InnoDB limits index
+# columns to 767 bytes, the maximum length for a utf8mb4 column (which
+# reserves up to four bytes per character) is 191 (191 * 4 = 764).
STRING_MAX_LEN = 191
-#: Default table column definition, to be overridden by mappers below.
+# Default table column definition, to be overridden by mappers below.
COLUMN_DEFAULTS = {'type_': sqlalchemy.Unicode(STRING_MAX_LEN)}
-#: Mapping of JSON Schema attributes to valid values. Each value maps to
-#: a dictionary of options. The options are compounded into a single
-#: dict, which is then used as kwargs for :class:`sqlalchemy.Column`.
-#:
-#: ..note::
-#:
-#: The mapping is keyed in order of increasing specificity. Thus a
-#: JSON property {"type": "number", "format": "utc-millisec"} will
-#: map onto a :class:`MediaWikiTimestamp` type, and not
-#: :class:`sqlalchemy.Float`.
+# Mapping of JSON Schema attributes to valid values. Each value maps to
+# a dictionary of options. The options are compounded into a single
+# dict, which is then used as kwargs for :class:`sqlalchemy.Column`.
+#
+# ..note::
+#
+# The mapping is keyed in order of increasing specificity. Thus a
+# JSON property {"type": "number", "format": "utc-millisec"} will
+# map onto a :class:`MediaWikiTimestamp` type, and not
+# :class:`sqlalchemy.Float`.
mappers = collections.OrderedDict((
('type', {
'boolean': {'type_': sqlalchemy.Boolean},
diff --git a/server/eventlogging/parse.py b/server/eventlogging/parse.py
index 9c0f83a..a67b0a0 100644
--- a/server/eventlogging/parse.py
+++ b/server/eventlogging/parse.py
@@ -47,22 +47,22 @@
__all__ = ('LogParser', 'ncsa_to_epoch', 'ncsa_utcnow', 'capsule_uuid')
-#: Format string (as would be passed to `strftime`) for timestamps in
-#: NCSA Common Log Format.
+# Format string (as would be passed to `strftime`) for timestamps in
+# NCSA Common Log Format.
NCSA_FORMAT = '%Y-%m-%dT%H:%M:%S'
-#: Formats event capsule objects into URLs using the combination of
-#: origin hostname, sequence ID, and timestamp. This combination is
-#: guaranteed to be unique. Example::
-#:
-#: event://vanadium.eqiad.wmnet/?seqId=438763×tamp=1359702955
-#:
+# Formats event capsule objects into URLs using the combination of
+# origin hostname, sequence ID, and timestamp. This combination is
+# guaranteed to be unique. Example::
+#
+# event://vanadium.eqiad.wmnet/?seqId=438763×tamp=1359702955
+#
EVENTLOGGING_URL_FORMAT = (
'event://%(recvFrom)s/?seqId=%(seqId)s×tamp=%(timestamp).10s')
-#: Specifies the length of time in seconds from the moment a key is
-#: generated until it is expired and replaced with a new key. The key is
-#: used to anonymize IP addresses.
+# Specifies the length of time in seconds from the moment a key is
+# generated until it is expired and replaced with a new key. The key is
+# used to anonymize IP addresses.
KEY_LIFESPAN = datetime.timedelta(days=90)
@@ -103,14 +103,14 @@
return json.loads(unquote_plus(qson.strip('?;')))
-#: A crytographic hash function for hashing client IPs. Produces HMAC SHA1
-#: hashes by using the client IP as the message and a 64-byte byte string as
-#: the key. The key is generated at runtime and is refreshed every 90 days.
-#: It is not written anywhere. The hash value is useful for detecting spam
-#: (large volume of events sharing a common origin).
+# A crytographic hash function for hashing client IPs. Produces HMAC SHA1
+# hashes by using the client IP as the message and a 64-byte byte string as
+# the key. The key is generated at runtime and is refreshed every 90 days.
+# It is not written anywhere. The hash value is useful for detecting spam
+# (large volume of events sharing a common origin).
hash_ip = keyhasher(rotating_key(size=64, period=KEY_LIFESPAN.total_seconds()))
-#: A mapping of format specifiers to a tuple of (regexp, caster).
+# A mapping of format specifiers to a tuple of (regexp, caster).
format_specifiers = {
'h': (r'(?P<clientIp>\S+)', hash_ip),
'j': (r'(?P<capsule>\S+)', json.loads),
@@ -121,7 +121,7 @@
't': (r'(?P<timestamp>\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2})',
ncsa_to_epoch),
- #: Deprecated format specifiers:
+ # Deprecated format specifiers:
'l': (r'(?P<recvFrom>\S+)', str),
'n': (r'(?P<seqId>\d+)', int),
}
@@ -137,11 +137,11 @@
"""
self.format = format
- #: Field casters, ordered by the relevant field's position in
- #: format string.
+ # Field casters, ordered by the relevant field's position in
+ # format string.
self.casters = []
- #: Compiled regexp.
+ # Compiled regexp.
format = re.sub(' ', r'\s+', format)
raw = re.sub(r'(?<!%)%({(\w+)})?([dhijlnqst])', self._repl, format)
self.re = re.compile(raw)
diff --git a/server/eventlogging/schema.py b/server/eventlogging/schema.py
index fa338a9..326b18e 100644
--- a/server/eventlogging/schema.py
+++ b/server/eventlogging/schema.py
@@ -20,17 +20,17 @@
'post_validation_fixups', 'validate')
-#: URL of index.php on the schema wiki (same as
-#: '$wgEventLoggingSchemaApiUri').
+# URL of index.php on the schema wiki (same as
+# '$wgEventLoggingSchemaApiUri').
SCHEMA_WIKI_API = 'http://meta.wikimedia.org/w/api.php'
-#: Template for schema article URLs. Interpolates a revision ID.
+# Template for schema article URLs. Interpolates a revision ID.
SCHEMA_URL_FORMAT = SCHEMA_WIKI_API + '?action=jsonschema&revid=%s'
-#: Schemas retrieved via HTTP are cached in this dictionary.
+# Schemas retrieved via HTTP are cached in this dictionary.
schema_cache = {}
-#: SCID of the metadata object which wraps each event.
+# SCID of the metadata object which wraps each event.
CAPSULE_SCID = ('EventCapsule', 8326736)
diff --git a/server/eventlogging/streams.py b/server/eventlogging/streams.py
index c1a9eed..b3f8a71 100644
--- a/server/eventlogging/streams.py
+++ b/server/eventlogging/streams.py
@@ -22,23 +22,23 @@
__all__ = ('iter_json', 'iter_unicode', 'make_canonical', 'pub_socket',
'stream', 'sub_socket', 'udp_socket')
-#: High water mark. The maximum number of outstanding messages to queue in
-#: memory for any single peer that the socket is communicating with.
+# High water mark. The maximum number of outstanding messages to queue
+# in memory for any single peer that the socket is communicating with.
ZMQ_HIGH_WATER_MARK = 3000
-#: If a socket is closed before all its messages has been sent, ØMQ will
-#: wait up to this many miliseconds before discarding the messages.
-#: We'd rather fail fast, even at the cost of dropping a few events.
+# If a socket is closed before all its messages has been sent, ZeroMQ
+# will wait up to this many miliseconds before discarding the messages.
+# We'd rather fail fast, even at the cost of dropping a few events.
ZMQ_LINGER = 0
-#: The maximum socket buffer size in bytes. This is used to set either
-#: SO_SNDBUF or SO_RCVBUF for the underlying socket, depending on its
-#: type. We set it to 64 kB to match Udp2LogConfig::BLOCK_SIZE.
+# The maximum socket buffer size in bytes. This is used to set either
+# SO_SNDBUF or SO_RCVBUF for the underlying socket, depending on its
+# type. We set it to 64 kB to match Udp2LogConfig::BLOCK_SIZE.
SOCKET_BUFFER_SIZE = 64 * 1024
def pub_socket(endpoint):
- """Get a pre-configured ØMQ publisher."""
+ """Get a pre-configured ZeroMQ publisher."""
context = zmq.Context.instance()
sock = context.socket(zmq.PUB)
if hasattr(zmq, 'HWM'):
@@ -51,7 +51,7 @@
def sub_socket(endpoint, identity='', subscribe=''):
- """Get a pre-configured ØMQ subscriber."""
+ """Get a pre-configured ZeroMQ subscriber."""
context = zmq.Context.instance()
sock = context.socket(zmq.SUB)
if hasattr(zmq, 'HWM'):
diff --git a/server/tests/fixtures.py b/server/tests/fixtures.py
index ed41c47..e060692 100644
--- a/server/tests/fixtures.py
+++ b/server/tests/fixtures.py
@@ -241,7 +241,7 @@
"""A :class:`unittest.TestCase` mix-in that imposes a time-limit on
tests. Tests exceeding the limit are failed."""
- #: Max time (in seconds) to allow tests to run before failing.
+ # Max time (in seconds) to allow tests to run before failing.
max_time = 2
def setUp(self):
--
To view, visit https://gerrit.wikimedia.org/r/176502
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibcd2b4ed1a007716fb3eb31a64ea23e02d770f2a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/EventLogging
Gerrit-Branch: master
Gerrit-Owner: Ori.livneh <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits