Skip to content

Commit

Permalink
Merge pull request #439 from INTI-CMNB/distributor_clean_up
Browse files Browse the repository at this point in the history
Cleans the kicost/distributors/distributor.py code
  • Loading branch information
hildogjr authored Mar 10, 2021
2 parents 063eb2f + 9f5eeda commit 9746edb
Showing 1 changed file with 12 additions and 17 deletions.
29 changes: 12 additions & 17 deletions kicost/distributors/distributor.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,43 +27,38 @@
__webpage__ = 'https://github.com/mmmaisel/'

# Libraries.
import sys, time, os, re
import logging
import time

#from . import fake_browser
#import http.client # For web scraping exceptions.
#from ..global_vars import PartHtmlError
# from . import fake_browser
# import http.client # For web scraping exceptions.
# from ..global_vars import PartHtmlError
# Kept this for future use.

from ..edas.tools import order_refs # To better print the warnings about the parts.

from .global_vars import *

from currency_converter import CurrencyConverter
from .global_vars import DEFAULT_CURRENCY, distributors_modules_dict


__all__ = ['distributor_class']


class distributor_class(object):
start_time = time.time()

def __init__(self, name, logger):
self.name = name
self.logger = logger

# Don't create fake_browser for "local" distributor.
#if self.domain != None:
# self.browser = fake_browser.fake_browser \
# (self.domain, self.logger, self.scrape_retries, throttle_delay)
# if self.domain != None:
# self.browser = fake_browser.fake_browser \
# (self.domain, self.logger, self.scrape_retries, throttle_delay)
# Kept this for future use.


def get_dist_parts_info(self, parts, distributors, currency=DEFAULT_CURRENCY):
''' Get the parts info using the modules API/Scrape/Local.'''
for d in distributors_modules:
for d in list(distributors_modules_dict):
globals()[d].query_part_info(parts, distributors, currency)
#dist_local_template.query_part_info(parts, distributors, currency)
#api_partinfo_kitspace.query_part_info(parts, distributors, currency)
# dist_local_template.query_part_info(parts, distributors, currency)
# api_partinfo_kitspace.query_part_info(parts, distributors, currency)

# Abstract methods, implemented in distributor specific modules.
@staticmethod
Expand Down

0 comments on commit 9746edb

Please sign in to comment.