8000 chore: added check to code style, added check to correct PyPI documen… · aszhou/influxdb-client-python@5c39813 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5c39813

Browse files
authored
chore: added check to code style, added check to correct PyPI documentation (influxdata#126)
1 parent 8c167e9 commit 5c39813

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+112
-94
lines changed

.circleci/config.yml

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
parameters:
4747
python-image:
4848
type: string
49-
default: "circleci/python:3.6-buster"
49+
default: &default-python "circleci/python:3.6-buster"
5050
influxdb-image:
5151
type: string
5252
default: "influxdb:2.0.0-beta"
@@ -69,24 +69,51 @@ jobs:
6969
- run:
7070
name: "Collecting coverage reports"
7171
command: bash <(curl -s https://codecov.io/bash) -f ./coverage.xml || echo "Codecov did not collect coverage reports"
72+
check-code-style:
73+
docker:
74+
- image: *default-python
75+
environment:
76+
PIPENV_VENV_IN_PROJECT: true
77+
steps:
78+
- checkout
79+
- run:
80+
name: Checks style consistency across sources.
81+
command: |
82+
pip install flake8 --user
83+
flake8 influxdb_client/
84+
check-twine:
85+
docker:
86+
- image: *default-python
87+
environment:
88+
PIPENV_VENV_IN_PROJECT: true
89+
steps:
90+
- checkout
91+
- run:
92+
name: Checks that the description will render correctly on PyPI.
93+
command: |
94+
pip install twine --user
95+
python setup.py sdist bdist_wheel
96+
twine check dist/*
7297
7398
workflows:
7499
version: 2
75100
build:
76101
jobs:
102+
- check-code-style
103+
- check-twine
77104
- tests-python:
78-
name: python-3.6
105+
name: test-3.6
79106
- tests-python:
80-
name: python-3.6-without-ciso8601
107+
name: test-3.6-without-ciso8601
81108
enabled-ciso-8601: false
82109
- tests-python:
83-
name: python-3.6-nightly
110+
name: test-3.6-influxdb-nightly
84111
influxdb-image: "influx:nightly"
85112
- tests-python:
86-
name: python-3.7
113+
name: test-3.7
87114
python-image: "circleci/python:3.7-buster"
88115
- tests-python:
89-
name: python-3.8
116+
name: test-3.8
90117
python-image: "circleci/python:3.8-buster"
91118

92119
nightly:

influxdb_client/client/abstract_client.py

Lines changed: 0 additions & 4 deletions
This file was deleted.

influxdb_client/client/influxdb_client.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ def from_env_properties(cls, debug=None, enable_gzip=False):
9696
if key.startswith("INFLUXDB_V2_TAG_"):
9797
default_tags[key[16:].lower()] = value
9898

99-
return cls(url, token, debug=debug, timeout=int(timeout), org=org, default_tags=default_tags, enable_gzip=enable_gzip)
99+
return cls(url, token, debug=debug, timeout=int(timeout), org=org, default_tags=default_tags,
100+
enable_gzip=enable_gzip)
100101

101102
def write_api(self, write_options=WriteOptions(), point_settings=PointSettings()) -> WriteApi:
102103
"""

influxdb_client/client/write_api.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
from rx.subject import Subject
1515

1616
from influxdb_client import WritePrecision, WriteService
17-
from influxdb_client.client.abstract_client import AbstractClient
1817
from influxdb_client.client.write.point import Point, DEFAULT_WRITE_PRECISION, _ESCAPE_KEY
1918
from influxdb_client.rest import ApiException
2019

@@ -119,7 +118,7 @@ def __hash__(self) -> int:
119118

120119
def __eq__(self, o: object) -> bool:
121120
return isinstance(o, self.__class__) \
122-
and self.bucket == o.bucket and self.org == o.org and self.precision == o.precision
121+
and self.bucket == o.bucket and self.org == o.org and self.precision == o.precision
123122

124123
def __str__(self) -> str:
125124
return '_BatchItemKey[bucket:\'{}\', org:\'{}\', precision:\'{}\']' \
@@ -141,7 +140,7 @@ def _body_reduce(batch_items):
141140
return b'\n'.join(map(lambda batch_item: batch_item.data, batch_items))
142141

143142

144-
class WriteApi(AbstractClient):
143+
class WriteApi:
145144

146145
def __init__(self, influxdb_client, write_options: WriteOptions = WriteOptions(),
147146
point_settings: PointSettings = PointSettings()) -> None:
@@ -188,9 +187,12 @@ def write(self, bucket: str, org: str = None,
188187
"""
189188
Writes time-series data into influxdb.
190189
191-
:param str org: specifies the destination organization for writes; take either the ID or Name interchangeably; if both orgID and org are specified, org takes precedence. (required)
190+
:param str org: specifies the destination organization for writes; take either the ID or Name interchangeably;
191+
if both orgID and org are specified, org takes precedence. (required)
192192
:param str bucket: specifies the destination bucket for writes (required)
193-
:param WritePrecision write_precision: specifies the precision for the unix timestamps within the body line-protocol. The precision specified on a Point has precedes and is use for write.
193+
:param WritePrecision write_precision: specifies the precision for the unix timestamps within
194+
the body line-protocol. The precision specified on a Point has precedes
195+
and is use for write.
194196
:param record: Points, line protocol, Pandas DataFrame, RxPY Observable to write
195197
:param data_frame_measurement_name: name of measurement for writing Pandas DataFrame
196198
:param data_frame_tag_columns: list of DataFrame columns which are tags, rest columns will be fields
@@ -253,7 +255,8 @@ def _serialize(self, record, write_precision, payload, **kwargs):
253255
self._serialize(record.to_line_protocol(), record.write_precision, payload, **kwargs)
254256

255257
elif isinstance(record, dict):
256-
self._serialize(Point.from_dict(record, write_precision=write_precision), write_precision, payload, **kwargs)
258+
self._serialize(Point.from_dict(record, write_precision=write_precision),
259+
write_precision, payload, **kwargs)
257260
elif 'DataFrame' in type(record).__name__:
258261
_data = self._data_frame_to_list_of_points(record, precision=write_precision, **kwargs)
259262
self._serialize(_data, write_precision, payload, **kwargs)

influxdb_client/domain/authorization.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class Authorization(AuthorizationUpdateRequest):
6363

6464
def __init__(self, created_at=None, updated_at=None, org_id=None, permissions=None, id=None, token=None, user_id=None, user=None, org=None, links=None, status='active', description=None): # noqa: E501
6565
"""Authorization - a model defined in OpenAPI""" # noqa: E501
66-
AuthorizationUpdateRequest.__init__(self, status=status, description=description)
66+
AuthorizationUpdateRequest.__init__(self, status=status, description=description) # noqa: E501
6767

6868
self._created_at = None
6969
self._updated_at = None

influxdb_client/domain/check.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class Check(CheckBase):
6969

7070
def __init__(self, id=None, name=None, org_id=None, owner_id=None, created_at=None, updated_at=None, query=None, status=None, every=None, offset=None, tags=None, description=None, status_message_template=None, labels=None, links=None): # noqa: E501
7171
"""Check - a model defined in OpenAPI""" # noqa: E501
72-
CheckBase.__init__(self, id=id, name=name, org_id=org_id, owner_id=owner_id, created_at=created_at, updated_at=updated_at, query=query, status=status, every=every, offset=offset, tags=tags, description=description, status_message_template=status_message_template, labels=labels, links=links)
72+
CheckBase.__init__(self, id=id, name=name, org_id=org_id, owner_id=owner_id, created_at=created_at, updated_at=updated_at, query=query, status=status, every=every, offset=offset, tags=tags, description=description, status_message_template=status_message_template, labels=labels, links=links) # noqa: E501
7373
self.discriminator = None
7474

7575
def to_dict(self):

influxdb_client/domain/check_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class CheckBase(CheckDiscriminator):
6969

7070
def __init__(self, id=None, name=None, org_id=None, owner_id=None, created_at=None, updated_at=None, query=None, status=None, every=None, offset=None, tags=None, description=None, status_message_template=None, labels=None, links=None): # noqa: E501
7171
"""CheckBase - a model defined in OpenAPI""" # noqa: E501
72-
CheckDiscriminator.__init__(self)
72+
CheckDiscriminator.__init__(self) # noqa: E501
7373

7474
self._id = None
7575
self._name = None

influxdb_client/domain/check_discriminator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class CheckDiscriminator(PostCheck):
4646

4747
def __init__(self): # noqa: E501
4848
"""CheckDiscriminator - a model defined in OpenAPI""" # noqa: E501
49-
PostCheck.__init__(self)
49+
PostCheck.__init__(self) # noqa: E501
5050
self.discriminator = 'type'
5151

5252
def get_real_child_model(self, data):

influxdb_client/domain/check_view_properties.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class CheckViewProperties(ViewProperties):
5151

5252
def __init__(self, type=None, shape=None, check_id=None, check=None, queries=None, colors=None): # noqa: E501
5353
"""CheckViewProperties - a model defined in OpenAPI""" # noqa: E501
54-
ViewProperties.__init__(self)
54+
ViewProperties.__init__(self) # noqa: E501
5555

5656
self._type = None
5757
self._shape = None

influxdb_client/domain/dashboard.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class Dashboard(CreateDashboardRequest):
5555

5656
def __init__(self, links=None, id=None, meta=None, cells=None, labels=None, org_id=None, name=None, description=None): # noqa: E501
5757
"""Dashboard - a model defined in OpenAPI""" # noqa: E501
58-
CreateDashboardRequest.__init__(self, org_id=org_id, name=name, description=description)
58+
CreateDashboardRequest.__init__(self, org_id=org_id, name=name, description=description) # noqa: E501
5959

6060
self._links = None
6161
self._id = None

0 commit comments

Comments
 (0)
0