replaced the member '_class_name' by the 'class.__name__'

This commit is contained in:
KorenLazar
2021-02-07 08:18:22 +02:00
parent 67bff9fa76
commit 9983d07c2b
17 changed files with 11 additions and 55 deletions

View File

@@ -1,5 +1,6 @@
from chains.mahsaneiHashook import MahsaneiHashook
from supermarket_chain import SupermarketChain
class Bareket(MahsaneiHashook):
class Bareket(MahsaneiHashook, SupermarketChain):
pass

View File

@@ -26,6 +26,5 @@ class CerberusWebClient:
return download_url
@property
@abstractmethod
def username(self):
pass
return repr(type(self))

View File

@@ -1,5 +1,6 @@
from chains.mahsaneiHashook import MahsaneiHashook
from supermarket_chain import SupermarketChain
class CoOp(MahsaneiHashook):
class CoOp(MahsaneiHashook, SupermarketChain):
pass

View File

@@ -4,8 +4,3 @@ from supermarket_chain import SupermarketChain
class DorAlon(CerberusWebClient, SupermarketChain):
_date_hour_format = '%Y-%m-%d %H:%M:%S'
_class_name = 'DorAlon'
@property
def username(self):
return self._class_name

View File

@@ -4,8 +4,3 @@ from supermarket_chain import SupermarketChain
class Freshmarket(CerberusWebClient, SupermarketChain):
_date_hour_format = '%Y-%m-%d %H:%M:%S'
_class_name = 'Freshmarket'
@property
def username(self):
return self._class_name

View File

@@ -4,8 +4,3 @@ from supermarket_chain import SupermarketChain
class HaziHinam(CerberusWebClient, SupermarketChain):
_date_hour_format = '%Y-%m-%d %H:%M:%S'
_class_name = 'HaziHinam'
@property
def username(self):
return self._class_name

View File

@@ -4,8 +4,3 @@ from supermarket_chain import SupermarketChain
class Keshet(CerberusWebClient, SupermarketChain):
_date_hour_format = '%Y-%m-%d %H:%M:%S'
_class_name = 'Keshet'
@property
def username(self):
return self._class_name

View File

@@ -3,10 +3,4 @@ from supermarket_chain import SupermarketChain
class OsherAd(CerberusWebClient, SupermarketChain):
_date_hour_format = '%Y-%m-%d %H:%M:%S'
_class_name = 'OsherAd'
@property
def username(self):
return self._class_name

View File

@@ -4,8 +4,3 @@ from supermarket_chain import SupermarketChain
class RamiLevi(CerberusWebClient, SupermarketChain):
_date_hour_format = '%Y-%m-%d %H:%M:%S'
_class_name = 'RamiLevi'
@property
def username(self):
return self._class_name

View File

@@ -4,7 +4,7 @@ from bs4 import BeautifulSoup
from supermarket_chain import SupermarketChain
class ShuferSal(SupermarketChain):
class Shufersal(SupermarketChain):
@staticmethod
def get_download_url(store_id: int, category: SupermarketChain.XMLFilesCategory, session: requests.Session) -> str:

View File

@@ -4,8 +4,7 @@ from supermarket_chain import SupermarketChain
class StopMarket(CerberusWebClient, SupermarketChain):
_date_hour_format = '%Y-%m-%d %H:%M:%S'
_class_name = 'Stop_Market'
@property
def username(self):
return self._class_name
return 'Stop_Market'

View File

@@ -4,7 +4,3 @@ from supermarket_chain import SupermarketChain
class TivTaam(CerberusWebClient, SupermarketChain):
_class_name = 'TivTaam'
@property
def username(self):
return self._class_name

View File

@@ -1,5 +1,6 @@
from chains.mahsaneiHashook import MahsaneiHashook
from supermarket_chain import SupermarketChain
class Victory(MahsaneiHashook):
class Victory(MahsaneiHashook, SupermarketChain):
pass

View File

@@ -4,8 +4,3 @@ from supermarket_chain import SupermarketChain
class Yohananof(CerberusWebClient, SupermarketChain):
_date_hour_format = '%Y-%m-%d %H:%M:%S'
_class_name = 'Yohananof'
@property
def username(self):
return self._class_name

View File

@@ -29,7 +29,7 @@ from chains import (
Path(RESULTS_DIRNAME).mkdir(exist_ok=True)
Path(RAW_FILES_DIRNAME).mkdir(exist_ok=True)
chain_dict = {repr(chain): chain() for chain in SupermarketChain.__subclasses__()}
chain_dict = {repr(chain): chain() if callable(chain) else None for chain in SupermarketChain.__subclasses__()}
if __name__ == '__main__':
parser = ArgumentParser()

View File

@@ -126,8 +126,3 @@ class SupermarketChain(object, metaclass=Meta):
manufacturer=item.find(re.compile(r'Manufacture[r]?Name')).text,
code=item.find('ItemCode').text
)
@classmethod
@abstractmethod
def __repr__(cls):
pass