Skip to content

Commit c40ae79

Browse files
authored
Merge pull request #106 from bastelfreak/pep257
pep257: fix D401/D400
2 parents a61aca1 + d8e9975 commit c40ae79

21 files changed

Lines changed: 48 additions & 45 deletions

.prospector.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ pep257:
88
disable:
99
- D203
1010
- D212
11+
enable:
12+
- D400
13+
- D401
1114
pep8:
1215
run: true
1316
full: true

marmoset/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""initial file that handles marmoset"""
1+
"""initial file that handles marmoset."""
22
from marmoset import cli
33
from marmoset import config
44

marmoset/cli/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""initial file that handles all CLI operations"""
1+
"""initial file that handles all CLI operations."""
22
from argparse import ArgumentParser
33

44

marmoset/cli/imagecatalog_parser.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
"""ClI module for imagecatalog"""
1+
"""ClI module for imagecatalog."""
22
from .. import imagecatalog
33

44

55
def add_to(parser, name, **kwargs):
6-
"""Updates the CLI parser to support imagecatalog"""
6+
"""Update the CLI parser to support imagecatalog."""
77
command = parser.add_parser(name, **kwargs)
88
subcommands = command.add_subparsers(title='%s subcommands' % name)
99

marmoset/cli/installstatus_parser.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
"""ClI module for installimage status updates"""
1+
"""ClI module for installimage status updates."""
22
from .. import installstatus
33

44

55
def add_to(parser, name, **kwargs):
66
"""
7-
Updates the CLI parser to support installimage status updates and stats.
7+
Update the CLI parser to support installimage status updates and stats.
88
99
supports a lot of information based on a UUID. For example a list of
1010
all status updates a UUID got, the last update it got or some stats for it.

marmoset/config.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Module to parse our config"""
1+
"""Module to parse our config."""
22
import configparser
33
import socket
44
import warnings
@@ -8,7 +8,7 @@
88

99

1010
def default():
11-
"""Get default values"""
11+
"""Get default values."""
1212
config = configparser.ConfigParser()
1313

1414
config['Common'] = dict(
@@ -44,7 +44,7 @@ def default():
4444

4545

4646
def read_file(file_path=None):
47-
"""Read our config file"""
47+
"""Read our config file."""
4848
config = default()
4949
if file_path is None:
5050
file_path = PATH
@@ -56,7 +56,7 @@ def read_file(file_path=None):
5656

5757

5858
def load_config(file_path=None):
59-
"""Get all options from our config"""
59+
"""Get all options from our config."""
6060
config = read_file(file_path)
6161

6262
if config['Modules'].getboolean('PXE'):

marmoset/dhcp/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""initial file for dealing with DHCP"""
1+
"""initial file for dealing with DHCP."""
22
from .dhcp_config import DhcpConfig
33
from .isc_dhcp_ldap_config import ISCDhcpLdapConfig
44

marmoset/dhcp/dhcp_config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66

77

88
class DhcpConfig:
9-
"""Model for a DHCP object"""
9+
"""Model for a DHCP object."""
1010

1111
def __init__(self, mac, ip_address, gateway=None, networkmask=None):
12-
"""Initialize all attributes with default values"""
12+
"""Initialize all attributes with default values."""
1313
self.additional_statements = {}
1414

1515
self.mac = None

marmoset/dhcp/isc_dhcp_ldap_config.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Module to provide LDAP access for our DHCP stuff"""
1+
"""Module to provide LDAP access for our DHCP stuff."""
22

33

44
import re
@@ -13,10 +13,10 @@
1313

1414

1515
class ISCDhcpLdapConfig:
16-
"""Initial class to connect to our LDAP"""
16+
"""Initial class to connect to our LDAP."""
1717

1818
def __init__(self, dhcp_config):
19-
"""Initialize the dhcp configuration credentials and URI"""
19+
"""Initialize the dhcp configuration credentials and URI."""
2020
self.dhcp_config = dhcp_config
2121

2222
@staticmethod
@@ -33,7 +33,7 @@ def __get_server_connection():
3333
return conn
3434

3535
def save(self):
36-
"""Saves a DHCP entry for a single node in an LDAP database"""
36+
"""Save a DHCP entry for a single node in an LDAP database."""
3737
conn = self.__get_server_connection()
3838

3939
dhcp_statements = ["fixed-address %s;" % self.dhcp_config.ip_address,
@@ -61,7 +61,7 @@ def save(self):
6161

6262
@staticmethod
6363
def get_all_db_entries():
64-
"""Method to get all entries from our DB"""
64+
"""Return all IPs? from our DB."""
6565
conn = ISCDhcpLdapConfig.__get_server_connection()
6666

6767
entry_generator = conn.extend.standard.paged_search(
@@ -81,7 +81,7 @@ def get_all_db_entries():
8181

8282
@staticmethod
8383
def __get_dn_by_ipv4(ip_address, multi=False):
84-
"""Get a DN for a certain entry based on the provided ipv4 address"""
84+
"""Get a DN for a certain entry based on the provided ipv4 address."""
8585
conn = ISCDhcpLdapConfig.__get_server_connection()
8686
conn.search(
8787
search_base=config['DHCPConfig'].get('ldap_client_base_dn'),
@@ -111,7 +111,7 @@ def __get_dn_by_ipv4(ip_address, multi=False):
111111

112112
@staticmethod
113113
def __get_dn_by_mac(mac_address, multi=False):
114-
"""Get a DN for a certain entry based on the provided MAC address"""
114+
"""Get a DN for a certain entry based on the provided MAC address."""
115115
conn = ISCDhcpLdapConfig.__get_server_connection()
116116
conn.search(
117117
search_base=config['DHCPConfig'].get('ldap_client_base_dn'),
@@ -141,7 +141,7 @@ def __get_dn_by_mac(mac_address, multi=False):
141141

142142
@staticmethod
143143
def __get_dhcp_config(distinguished_name):
144-
"""Gets a LDAP object based on the provided DN"""
144+
"""Get a LDAP object based on the provided DN."""
145145
# pylint: disable-msg=too-many-locals
146146
from marmoset.dhcp import DhcpConfig
147147

@@ -198,7 +198,7 @@ def __get_dhcp_config(distinguished_name):
198198

199199
@staticmethod
200200
def get_by_ip(ip_address):
201-
"""Gets a config based on the provided IP"""
201+
"""Get a config based on the provided IP."""
202202
distinguished_name = ISCDhcpLdapConfig.__get_dn_by_ipv4(ip_address)
203203

204204
if distinguished_name is None:
@@ -208,7 +208,7 @@ def get_by_ip(ip_address):
208208

209209
@staticmethod
210210
def get_by_mac(mac_address):
211-
"""Gets a config based on the provided MAC"""
211+
"""Get a config based on the provided MAC."""
212212
distinguished_name = ISCDhcpLdapConfig.__get_dn_by_mac(mac_address)
213213

214214
if distinguished_name is None:
@@ -218,7 +218,7 @@ def get_by_mac(mac_address):
218218

219219
@staticmethod
220220
def remove_by_ipv4(ipv4):
221-
"""Remove an entry based on the IP"""
221+
"""Remove an entry based on the IP."""
222222
dn_list = ISCDhcpLdapConfig.__get_dn_by_ipv4(ipv4, multi=True)
223223

224224
for distinguished_name in dn_list:
@@ -230,7 +230,7 @@ def remove_by_ipv4(ipv4):
230230

231231
@staticmethod
232232
def remove_by_mac(mac):
233-
"""Remove an entry based on the MAC"""
233+
"""Remove an entry based on the MAC."""
234234
dn_list = ISCDhcpLdapConfig.__get_dn_by_mac(mac, multi=True)
235235

236236
for distinguished_name in dn_list:

marmoset/imagecatalog/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
"""Initial file for the image catalog"""
1+
"""Initial file for the image catalog."""
22

33
from .catalog import ImageCatalog
44

55

66
def list_all(args):
7-
"""List all images"""
7+
"""List all images."""
88
# pylint: disable-msg=unused-argument
99
catalog = ImageCatalog()
1010
metadata_list = catalog.list_all_metadata()
@@ -13,7 +13,7 @@ def list_all(args):
1313

1414

1515
def print_metadata(metadata_dict):
16-
"""Prints the image's metadata dict"""
16+
"""Print the image's metadata dict."""
1717
spacer = '-' * 40
1818
print('%s\nimage_file: %s\n%s' % (
1919
spacer, metadata_dict['image_file'], spacer))

0 commit comments

Comments
 (0)