Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BEAM-13051][D] Enable pylint warnings (no-name-in-module/no-value-for-parameter) #16562

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 7 additions & 1 deletion sdks/python/apache_beam/io/avroio_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,13 @@ def tearDown(self):
os.remove(path)
self._temp_files = []

def _write_data(self, directory, prefix, codec, count, sync_interval):
def _write_data(
self,
directory=None,
prefix=None,
codec=None,
count=None,
sync_interval=None):
Comment on lines +100 to +104
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this necessary if the arguments are mandatory? Are you seeing a failure with this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, they throw no-value-for-parameter warnings.

raise NotImplementedError

def _write_pattern(self, num_files, return_filenames=False):
Expand Down
3 changes: 1 addition & 2 deletions sdks/python/apache_beam/io/filesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,7 @@ def _read_from_internal_buffer(self, read_fn):
self._read_buffer.seek(0, os.SEEK_END) # Allow future writes.
return result

def read(self, num_bytes):
# type: (int) -> bytes
def read(self, num_bytes: Optional[int] = None) -> bytes:
if not self._decompressor:
raise ValueError('decompressor not initialized')

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ def __init__(
'InfluxDB')
self.filters = filters

def publish_metrics(self, result, extra_metrics: dict):
def publish_metrics(self, result, extra_metrics: Optional[dict] = None):
metric_id = uuid.uuid4().hex
metrics = result.metrics().query(self.filters)

Expand All @@ -227,13 +227,16 @@ def publish_metrics(self, result, extra_metrics: dict):
# a list of dictionaries matching the schema.
insert_dicts = self._prepare_all_metrics(metrics, metric_id)

insert_dicts += self._prepare_extra_metrics(extra_metrics, metric_id)
insert_dicts += self._prepare_extra_metrics(metric_id, extra_metrics)
if len(insert_dicts) > 0:
for publisher in self.publishers:
publisher.publish(insert_dicts)

def _prepare_extra_metrics(self, extra_metrics: dict, metric_id: str):
def _prepare_extra_metrics(
self, metric_id: str, extra_metrics: Optional[dict] = None):
ts = time.time()
if not extra_metrics:
extra_metrics = {}
return [
Metric(ts, metric_id, v, label=k).as_dict() for k,
v in extra_metrics.items()
Expand Down