mirror of
https://github.com/mbirth/tcl_ota_check.git
synced 2024-11-09 22:06:47 +00:00
docstrings, import sorting
This commit is contained in:
parent
808282c347
commit
58a270275d
@ -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
|
||||
|
||||
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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
|
||||
|
@ -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"):
|
||||
|
@ -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"
|
||||
|
@ -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):
|
||||
|
Loading…
Reference in New Issue
Block a user