replaced the member '_class_name' by the 'class.__name__'
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
from chains.mahsaneiHashook import MahsaneiHashook
|
from chains.mahsaneiHashook import MahsaneiHashook
|
||||||
|
from supermarket_chain import SupermarketChain
|
||||||
|
|
||||||
|
|
||||||
class Bareket(MahsaneiHashook):
|
class Bareket(MahsaneiHashook, SupermarketChain):
|
||||||
pass
|
pass
|
||||||
|
@@ -26,6 +26,5 @@ class CerberusWebClient:
|
|||||||
return download_url
|
return download_url
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@abstractmethod
|
|
||||||
def username(self):
|
def username(self):
|
||||||
pass
|
return repr(type(self))
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
from chains.mahsaneiHashook import MahsaneiHashook
|
from chains.mahsaneiHashook import MahsaneiHashook
|
||||||
|
from supermarket_chain import SupermarketChain
|
||||||
|
|
||||||
|
|
||||||
class CoOp(MahsaneiHashook):
|
class CoOp(MahsaneiHashook, SupermarketChain):
|
||||||
pass
|
pass
|
||||||
|
@@ -4,8 +4,3 @@ from supermarket_chain import SupermarketChain
|
|||||||
|
|
||||||
class DorAlon(CerberusWebClient, SupermarketChain):
|
class DorAlon(CerberusWebClient, SupermarketChain):
|
||||||
_date_hour_format = '%Y-%m-%d %H:%M:%S'
|
_date_hour_format = '%Y-%m-%d %H:%M:%S'
|
||||||
_class_name = 'DorAlon'
|
|
||||||
|
|
||||||
@property
|
|
||||||
def username(self):
|
|
||||||
return self._class_name
|
|
||||||
|
@@ -4,8 +4,3 @@ from supermarket_chain import SupermarketChain
|
|||||||
|
|
||||||
class Freshmarket(CerberusWebClient, SupermarketChain):
|
class Freshmarket(CerberusWebClient, SupermarketChain):
|
||||||
_date_hour_format = '%Y-%m-%d %H:%M:%S'
|
_date_hour_format = '%Y-%m-%d %H:%M:%S'
|
||||||
_class_name = 'Freshmarket'
|
|
||||||
|
|
||||||
@property
|
|
||||||
def username(self):
|
|
||||||
return self._class_name
|
|
||||||
|
@@ -4,8 +4,3 @@ from supermarket_chain import SupermarketChain
|
|||||||
|
|
||||||
class HaziHinam(CerberusWebClient, SupermarketChain):
|
class HaziHinam(CerberusWebClient, SupermarketChain):
|
||||||
_date_hour_format = '%Y-%m-%d %H:%M:%S'
|
_date_hour_format = '%Y-%m-%d %H:%M:%S'
|
||||||
_class_name = 'HaziHinam'
|
|
||||||
|
|
||||||
@property
|
|
||||||
def username(self):
|
|
||||||
return self._class_name
|
|
||||||
|
@@ -4,8 +4,3 @@ from supermarket_chain import SupermarketChain
|
|||||||
|
|
||||||
class Keshet(CerberusWebClient, SupermarketChain):
|
class Keshet(CerberusWebClient, SupermarketChain):
|
||||||
_date_hour_format = '%Y-%m-%d %H:%M:%S'
|
_date_hour_format = '%Y-%m-%d %H:%M:%S'
|
||||||
_class_name = 'Keshet'
|
|
||||||
|
|
||||||
@property
|
|
||||||
def username(self):
|
|
||||||
return self._class_name
|
|
||||||
|
@@ -22,7 +22,7 @@ class MahsaneiHashook(SupermarketChain):
|
|||||||
req_res: requests.Response = requests.get(url)
|
req_res: requests.Response = requests.get(url)
|
||||||
soup = BeautifulSoup(req_res.text, features='lxml')
|
soup = BeautifulSoup(req_res.text, features='lxml')
|
||||||
suffix: str = soup.find('a', href=lambda value: value and category.name.replace('s', '') in value
|
suffix: str = soup.find('a', href=lambda value: value and category.name.replace('s', '') in value
|
||||||
and f'-{store_id:03d}-20' in value).attrs['href']
|
and f'-{store_id:03d}-20' in value).attrs['href']
|
||||||
down_url: str = prefix + suffix
|
down_url: str = prefix + suffix
|
||||||
print(down_url)
|
print(down_url)
|
||||||
return down_url
|
return down_url
|
||||||
|
@@ -3,10 +3,4 @@ from supermarket_chain import SupermarketChain
|
|||||||
|
|
||||||
|
|
||||||
class OsherAd(CerberusWebClient, SupermarketChain):
|
class OsherAd(CerberusWebClient, SupermarketChain):
|
||||||
|
|
||||||
_date_hour_format = '%Y-%m-%d %H:%M:%S'
|
_date_hour_format = '%Y-%m-%d %H:%M:%S'
|
||||||
_class_name = 'OsherAd'
|
|
||||||
|
|
||||||
@property
|
|
||||||
def username(self):
|
|
||||||
return self._class_name
|
|
||||||
|
@@ -4,8 +4,3 @@ from supermarket_chain import SupermarketChain
|
|||||||
|
|
||||||
class RamiLevi(CerberusWebClient, SupermarketChain):
|
class RamiLevi(CerberusWebClient, SupermarketChain):
|
||||||
_date_hour_format = '%Y-%m-%d %H:%M:%S'
|
_date_hour_format = '%Y-%m-%d %H:%M:%S'
|
||||||
_class_name = 'RamiLevi'
|
|
||||||
|
|
||||||
@property
|
|
||||||
def username(self):
|
|
||||||
return self._class_name
|
|
||||||
|
@@ -4,7 +4,7 @@ from bs4 import BeautifulSoup
|
|||||||
from supermarket_chain import SupermarketChain
|
from supermarket_chain import SupermarketChain
|
||||||
|
|
||||||
|
|
||||||
class ShuferSal(SupermarketChain):
|
class Shufersal(SupermarketChain):
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_download_url(store_id: int, category: SupermarketChain.XMLFilesCategory, session: requests.Session) -> str:
|
def get_download_url(store_id: int, category: SupermarketChain.XMLFilesCategory, session: requests.Session) -> str:
|
||||||
|
@@ -4,8 +4,7 @@ from supermarket_chain import SupermarketChain
|
|||||||
|
|
||||||
class StopMarket(CerberusWebClient, SupermarketChain):
|
class StopMarket(CerberusWebClient, SupermarketChain):
|
||||||
_date_hour_format = '%Y-%m-%d %H:%M:%S'
|
_date_hour_format = '%Y-%m-%d %H:%M:%S'
|
||||||
_class_name = 'Stop_Market'
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def username(self):
|
def username(self):
|
||||||
return self._class_name
|
return 'Stop_Market'
|
||||||
|
@@ -4,7 +4,3 @@ from supermarket_chain import SupermarketChain
|
|||||||
|
|
||||||
class TivTaam(CerberusWebClient, SupermarketChain):
|
class TivTaam(CerberusWebClient, SupermarketChain):
|
||||||
_class_name = 'TivTaam'
|
_class_name = 'TivTaam'
|
||||||
|
|
||||||
@property
|
|
||||||
def username(self):
|
|
||||||
return self._class_name
|
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
from chains.mahsaneiHashook import MahsaneiHashook
|
from chains.mahsaneiHashook import MahsaneiHashook
|
||||||
|
from supermarket_chain import SupermarketChain
|
||||||
|
|
||||||
|
|
||||||
class Victory(MahsaneiHashook):
|
class Victory(MahsaneiHashook, SupermarketChain):
|
||||||
pass
|
pass
|
||||||
|
@@ -4,8 +4,3 @@ from supermarket_chain import SupermarketChain
|
|||||||
|
|
||||||
class Yohananof(CerberusWebClient, SupermarketChain):
|
class Yohananof(CerberusWebClient, SupermarketChain):
|
||||||
_date_hour_format = '%Y-%m-%d %H:%M:%S'
|
_date_hour_format = '%Y-%m-%d %H:%M:%S'
|
||||||
_class_name = 'Yohananof'
|
|
||||||
|
|
||||||
@property
|
|
||||||
def username(self):
|
|
||||||
return self._class_name
|
|
||||||
|
2
main.py
2
main.py
@@ -29,7 +29,7 @@ from chains import (
|
|||||||
Path(RESULTS_DIRNAME).mkdir(exist_ok=True)
|
Path(RESULTS_DIRNAME).mkdir(exist_ok=True)
|
||||||
Path(RAW_FILES_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__':
|
if __name__ == '__main__':
|
||||||
parser = ArgumentParser()
|
parser = ArgumentParser()
|
||||||
|
@@ -126,8 +126,3 @@ class SupermarketChain(object, metaclass=Meta):
|
|||||||
manufacturer=item.find(re.compile(r'Manufacture[r]?Name')).text,
|
manufacturer=item.find(re.compile(r'Manufacture[r]?Name')).text,
|
||||||
code=item.find('ItemCode').text
|
code=item.find('ItemCode').text
|
||||||
)
|
)
|
||||||
|
|
||||||
@classmethod
|
|
||||||
@abstractmethod
|
|
||||||
def __repr__(cls):
|
|
||||||
pass
|
|
||||||
|
Reference in New Issue
Block a user