Skip to content

Commit 3029762

Browse files
committed
fix: docstrings
1 parent d106841 commit 3029762

File tree

6 files changed

+16
-16
lines changed

6 files changed

+16
-16
lines changed

.pre-commit-config.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@ repos:
1111
rev: 6.1.1
1212
hooks:
1313
- id: pydocstyle
14+
files: ^buildurl
1415
- repo: https://gitlab.com/pycqa/flake8
1516
rev: 3.9.2
1617
hooks:
1718
- id: flake8
18-
additional_dependencies: [flake8-black, flake8-isort, flake8-docstrings]
19+
# additional_dependencies: [flake8-black, flake8-isort, flake8-docstrings]
1920
- repo: https://github.com/pre-commit/mirrors-mypy
2021
rev: v0.910
2122
hooks:

buildurl/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Simple URL builder"""
1+
"""Simple URL builder."""
22

33
__version__ = "4.0.0"
44

buildurl/builder.py

+4-9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"""BuildURL's core."""
2+
13
from copy import deepcopy
24
from typing import Any, Dict, List, Optional, Tuple, Union
35
from urllib.parse import parse_qs, urlencode, urlsplit, urlunsplit
@@ -31,6 +33,7 @@ class BuildURL:
3133
"""
3234

3335
def __init__(self, base: str = "", force_trailing_slash: bool = False):
36+
"""Initialize a new instance of BuildURL."""
3437
purl = urlsplit(base)
3538

3639
# scheme://netloc/path;params?query#fragment
@@ -68,7 +71,7 @@ def copy(self) -> "BuildURL":
6871
return deepcopy(self)
6972

7073
def set_force_trailing_slash(self, enabled: bool = True) -> "BuildURL":
71-
"""Sets the `force_trailing_slash` attribute
74+
"""Set the `force_trailing_slash` attribute.
7275
7376
Args:
7477
enabled:
@@ -115,7 +118,6 @@ def add_path(self, *args: Path) -> "BuildURL":
115118
>>> print(url.get)
116119
https://example.com/never/stopping/to/play/with/paths
117120
"""
118-
119121
path_list = list()
120122
for path in args:
121123
if isinstance(path, str):
@@ -166,7 +168,6 @@ def add_query(self, *args: Query, **kwargs) -> "BuildURL":
166168
>>> print(url.get)
167169
https://example.com?key=value&another=query&more=stuff&a=b&c=d&e=f
168170
"""
169-
170171
query_dict = dict()
171172
for query in args:
172173
if isinstance(query, str):
@@ -250,7 +251,6 @@ def __itruediv__(self, path: Path) -> "BuildURL":
250251
>>> print(url.get)
251252
https://example.com/test/more/paths/again/and/again/
252253
"""
253-
254254
self.add_path(path)
255255
return self
256256

@@ -274,7 +274,6 @@ def __truediv__(self, path: Path) -> "BuildURL":
274274
>>> print(new_url.get)
275275
https://example.com/testing
276276
"""
277-
278277
out = self.copy()
279278
out /= path
280279
return out
@@ -300,7 +299,6 @@ def __iadd__(self, query: Query) -> "BuildURL":
300299
>>> print(url.get)
301300
https://example.com?key=value&another=query&more=stuff
302301
"""
303-
304302
self.add_query(query)
305303
return self
306304

@@ -324,7 +322,6 @@ def __add__(self, query: Query) -> "BuildURL":
324322
>>> print(new_url.get)
325323
https://example.com?test=it
326324
"""
327-
328325
out = self.copy()
329326
out += query
330327
return out
@@ -340,7 +337,6 @@ def __repr__(self) -> str:
340337
>>> print(repr(url))
341338
BuildURL(base='https://example.com/test?now=true', force_trailing_slash=False)
342339
"""
343-
344340
return f"{self.__class__.__name__}(base='{self.get}', force_trailing_slash={self.force_trailing_slash})"
345341

346342
def __str__(self) -> str:
@@ -359,7 +355,6 @@ def __str__(self) -> str:
359355
>>> print(url)
360356
https://example.com/test
361357
"""
362-
363358
return self.get
364359

365360
def __len__(self) -> int:

docs/conf.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
# Configuration file for the Sphinx documentation builder.
2-
#
3-
# This file only contains a selection of the most common options. For a full
4-
# list see the documentation:
5-
# https://www.sphinx-doc.org/en/master/usage/configuration.html
1+
"""Configuration file for the Sphinx documentation builder.
2+
3+
This file only contains a selection of the most common options. For a full
4+
list see the documentation:
5+
https://www.sphinx-doc.org/en/master/usage/configuration.html
6+
"""
67

78
# -- Path setup --------------------------------------------------------------
89

setup.cfg

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ profile = black
3535

3636
[pydocstyle]
3737
convention = google
38+
match_dir = buildurl
3839

3940
[semantic_release]
4041
changelog_capitalize = false

setup.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"""Project setup."""
2+
13
import setuptools
24

35
setuptools.setup()

0 commit comments

Comments
 (0)