Skip to content
This repository was archived by the owner on Oct 29, 2024. It is now read-only.

Commit e16ace2

Browse files
author
klDen
committed
- Fix flake7 errors : E131 continuation line unaligned for hanging indent
- Fix typo - Fix cls._client declaration ordering - Remove duplicate code cls._autocommit ...
1 parent c0032cf commit e16ace2

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

influxdb/helper.py

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ class Meta:
4242
autocommit = True
4343
# If True and no bulk_size, then will set bulk_size to 1.
4444
time_precision = "h"|"m"|s"|"ms"|"u"|"ns"
45-
#default is ns (nanoseconds)
46-
#Setting time precision while writing point
47-
#you should also make sure time set is in the given precision
45+
# Default is ns (nanoseconds)
46+
# Setting time precision while writing point
47+
# You should also make sure time is set in the given precision
4848
4949
"""
5050

@@ -77,22 +77,17 @@ def __new__(cls, *args, **kwargs):
7777
cls._autocommit = getattr(_meta, 'autocommit', False)
7878
cls._time_precision = getattr(_meta, 'time_precision', None)
7979

80-
allowed_time_precisions = ["h", "m", "s", "ms", "u", "ns", None]
80+
allowed_time_precisions = ['h', 'm', 's', 'ms', 'u', 'ns', None]
8181
if cls._time_precision not in allowed_time_precisions:
8282
raise AttributeError(
83-
'In {0}, time_precison is set, but invalid. use any of {}.'
84-
.format(cls.__name__, ','.join(allowed_time_precisions)))
85-
86-
if cls._autocommit and not cls._client:
87-
raise AttributeError(
88-
'In {0}, autocommit is set to True, but no client is set.'
89-
.format(cls.__name__))
83+
'In {0}, time_precision is set, but invalid use any of {}.'
84+
.format(cls.__name__, ','.join(allowed_time_precisions)))
9085

9186
cls._client = getattr(_meta, 'client', None)
9287
if cls._autocommit and not cls._client:
9388
raise AttributeError(
9489
'In {0}, autocommit is set to True, but no client is set.'
95-
.format(cls.__name__))
90+
.format(cls.__name__))
9691

9792
try:
9893
cls._bulk_size = getattr(_meta, 'bulk_size')
@@ -135,7 +130,7 @@ def __init__(self, **kw):
135130
if not (tags <= keys):
136131
raise NameError(
137132
'Expected arguments to contain all tags {0}, instead got {1}.'
138-
.format(cls._tags, kw.keys()))
133+
.format(cls._tags, kw.keys()))
139134
if not (keys - tags <= fields):
140135
raise NameError('Got arguments not in tags or fields: {0}'
141136
.format(keys - tags - fields))

0 commit comments

Comments
 (0)