diff --git a/tclcheck_allfull.py b/tclcheck_allfull.py index 201712d..10525ba 100644 --- a/tclcheck_allfull.py +++ b/tclcheck_allfull.py @@ -11,8 +11,7 @@ from requests.exceptions import RequestException import tcllib import tcllib.argparser -from tcllib import ansi -from tcllib import devlist +from tcllib import ansi, devlist from tcllib.devices import DesktopDevice diff --git a/tclcheck_allota.py b/tclcheck_allota.py index 0d8c2b3..20504ab 100644 --- a/tclcheck_allota.py +++ b/tclcheck_allota.py @@ -11,8 +11,7 @@ from requests.exceptions import RequestException import tcllib import tcllib.argparser -from tcllib import ansi -from tcllib import devlist +from tcllib import ansi, devlist fc = tcllib.FotaCheck() diff --git a/tclcheck_findprd.py b/tclcheck_findprd.py index 02126e3..628bf08 100755 --- a/tclcheck_findprd.py +++ b/tclcheck_findprd.py @@ -12,8 +12,7 @@ from requests.exceptions import RequestException, Timeout import tcllib import tcllib.argparser -from tcllib import ansi -from tcllib import devlist +from tcllib import ansi, devlist fc = tcllib.FotaCheck() diff --git a/tclcheck_findprd2.py b/tclcheck_findprd2.py index 9844c59..e97f7ad 100644 --- a/tclcheck_findprd2.py +++ b/tclcheck_findprd2.py @@ -11,8 +11,7 @@ from requests.exceptions import RequestException, Timeout import tcllib import tcllib.argparser -from tcllib import ansi -from tcllib import devlist +from tcllib import ansi, devlist # Variants to scan for diff --git a/tcllib/__init__.py b/tcllib/__init__.py index 631b3e4..60c6ccd 100644 --- a/tcllib/__init__.py +++ b/tcllib/__init__.py @@ -9,8 +9,8 @@ import enum import requests -from . import (dumpmgr, servervote, tclcheck, - tclchecksum, tclencheader, tclrequest) +from . import (dumpmgr, servervote, tclcheck, tclchecksum, tclencheader, + tclrequest) def default_enum(enumname, vardict, qualroot="tcllib.FotaCheck"): diff --git a/tcllib/devices.py b/tcllib/devices.py index ea34419..6885ce3 100644 --- a/tcllib/devices.py +++ b/tcllib/devices.py @@ -3,6 +3,7 @@ """Pseudo-devices for desktop/mobile requests""" class Device(): + """Generic pseudo-device class.""" CLTP_STATES = { "MOBILE": 10, # only show actual newer versions or HTTP 206 "DESKTOP": 2010, # always show latest version for FULL updates @@ -13,6 +14,7 @@ class Device(): CKOT_STATES = {"ALL": 1, "AOTA_ONLY": 2, "FOTA_ONLY": 3} def __init__(self, curef, fwver): + """Populate variables.""" self.curef = curef self.imei = "" self.osver = "7.1.1" @@ -27,35 +29,39 @@ class Device(): self.ua = "tcl" def is_rooted(self): - return (self.rtd == 1) + """Get RTD as boolean.""" + return self.rtd == 1 def set_rooted(self, new_state: bool): - if new_state: - self.rtd = 1 - else: - self.rtd = 0 + """Set RTD as integer.""" + self.rtd = int(new_state) def set_cltp(self, new_cltp: str): + """Set CLTP while handling non-numeric input.""" # (Numerical CLTPs can be set by direct assigns.) # Throws exception when invalid cltp given: self.cltp = self.CLTP_STATES[new_cltp] def set_mode(self, new_mode: str): + """Set MODE while handling non-numeric input.""" # (Numerical MODEs can be set by direct assigns.) # Throws exception when invalid mode given: self.mode = self.MODE_STATES[new_mode] def set_chnl(self, new_chnl: str): + """Set CHNL while handling non-numeric input.""" # (Numerical CHNLs can be set by direct assigns.) # Throws exception when invalid mode given: self.chnl = self.CHNL_STATES[new_chnl] def set_ckot(self, new_ckot: str): + """Set CKOT while handling non-numeric input.""" # (Numerical CKOTs can be set by direct assigns.) # Throws exception when invalid mode given: self.ckot = self.CKOT_STATES[new_ckot] class MobileDevice(Device): + """Generic mobile (i.e. OTA) device.""" def __init__(self, curef="PRD-63117-011", fwver="AAO472"): super().__init__(curef, fwver) self.imei = "3531510" @@ -64,6 +70,7 @@ class MobileDevice(Device): self.ua = "com.tcl.fota/5.1.0.2.0029.0, Android" class DesktopDevice(Device): + """Generic desktop (i.e. full) device.""" def __init__(self, curef="PRD-63117-011", fwver="AAA000"): super().__init__(curef, fwver) self.imei = "543212345000000" diff --git a/tcllib/tclchecksum.py b/tcllib/tclchecksum.py index 9030bc9..9b60d78 100644 --- a/tcllib/tclchecksum.py +++ b/tcllib/tclchecksum.py @@ -8,8 +8,10 @@ import json from defusedxml import ElementTree + from . import credentials + class TclChecksumMixin: """A mixin component for TCL's checksum API.""" def do_checksum(self, encslave, address, uri):