Skip to content

Commit

Permalink
Merge pull request #32 from stefanofusai/30-standardize-ruff-rules
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanofusai authored Oct 3, 2024
2 parents 8866c8b + dd3bc17 commit 6cbcc33
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 5 deletions.
22 changes: 21 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,24 @@ strict = true

[tool.ruff.lint]
select = ["ALL"]
ignore = ["D100", "D104", "D203", "D213", "ISC001"]
ignore = [
# Bad rules
"COM812",
"D203",
"D212",
"E501",
"FA102",
"FIX",
"ISC001",
"PLR2004",
"RUF012",
"S101",
"S311",
"TD001",
"TD002",
"TD003",
"TRY003",
# Project-specific rules
"D100",
"D104"
]
5 changes: 5 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ scrapy==2.11.2
# via -r requirements.in
service-identity==24.1.0
# via scrapy
setuptools==75.1.0
# via
# influxdb3-python
# scrapy
# zope-interface
six==1.16.0
# via
# automat
Expand Down
12 changes: 8 additions & 4 deletions src/scrapy_influxdb_exporter/statscollectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,16 @@


class InfluxDBStatsCollector(StatsCollector):
"""A scrapy stats collector that persists stats to InfluxDB.
"""
A scrapy stats collector that persists stats to InfluxDB.
:param StatsCollector: The base class for stats collectors.
:type StatsCollector: class
"""

def __init__(self, crawler: Crawler) -> None:
"""Construct an instance of the InfluxDBStatsCollector class.
"""
Construct an instance of the InfluxDBStatsCollector class.
:param crawler: The crawler instance.
:type crawler: Crawler
Expand All @@ -33,7 +35,8 @@ def __init__(self, crawler: Crawler) -> None:
self._init_client()

def _get_setting(self, name: str) -> str:
"""Get a setting from the crawler settings.
"""
Get a setting from the crawler settings.
:param name: The name of the setting.
:type name: str
Expand All @@ -58,7 +61,8 @@ def _init_client(self) -> None:
)

def _persist_stats(self, stats: StatsT, spider: Spider) -> None:
"""Persist the spider stats to InfluxDB.
"""
Persist the spider stats to InfluxDB.
:param stats: The spider stats.
:type stats: StatsT
Expand Down

0 comments on commit 6cbcc33

Please sign in to comment.