Skip to content

Commit

Permalink
Updating python code to best practices.
Browse files Browse the repository at this point in the history
  • Loading branch information
Git committed Jan 7, 2024
1 parent 605e4b7 commit 9ee8abd
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions certificate/CertificateStatistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

class CertificateStatistics:
"""This class is responsible for helping with calculations of meta data."""

CLASS_VERSION = "0.01"

certificate_time_format = CertificateTimeFormat.CertificateTimeFormat().cert_time_format
Expand Down
1 change: 1 addition & 0 deletions certificate/CertificateTimeFormat.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
class CertificateTimeFormat:
"""Defines the time format for usage in Certificates."""

CLASS_VERSION = "0.01"
cert_time_format = "%b %d %H:%M:%S %Y %Z"
1 change: 1 addition & 0 deletions certificate/DisplayCertificate.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

class DisplayCertificate:
"""This class is responsible for displaying the certificate Meta Data."""

CLASS_VERSION = "0.01"

# Define a certificate_stats object for use when calculating statistics about the certificate.
Expand Down
3 changes: 3 additions & 0 deletions certificate/FileOperations.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class FileOperations:
Attributes:
file_path (str): The path to the file where the binary data will be written.
"""

CLASS_VERSION = "0.01"

def __init__(self, file_path: str):
Expand All @@ -24,6 +25,7 @@ def ensure_directory(self) -> None:
"""
Ensures that the directory for the file path exists. If not, it creates the necessary directories.
"""

directory = os.path.dirname(self.file_path)
if not os.path.exists(directory):
os.makedirs(directory)
Expand All @@ -39,6 +41,7 @@ def write_binary(self, content: bytes) -> None:
ValueError: If the content is not of type bytes.
IOError: If there is an issue writing to the file.
"""

if not isinstance(content, bytes):
raise ValueError("Content must be of type bytes.")

Expand Down
1 change: 1 addition & 0 deletions certificate/certificateModule.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

class certificateModule:
"""certificateModule class"""

# Define a certificate_time_format object to be used in certificate calculations.
certificate_time_format = CertificateTimeFormat.CertificateTimeFormat().cert_time_format

Expand Down

0 comments on commit 9ee8abd

Please sign in to comment.