شريط اخر الاخبار
شريط الاهداءات
صفحة 2 من 2 الأولىالأولى 12
النتائج 11 إلى 12 من 12

الموضوع: صور مشبات بافضل الديكورات والابداعات الجديده والمستمر في المشبات حيث نقوم بكافت اعمال

  1. #11
    تاريخ التسجيل
    Mar 2016
    المشاركات
    250
    معدل تقييم المستوى
    45

    افتراضي var_mngr

    import os import traceback from itertools import chain import re import random import string # def unique(lst): try: return list(set(lst)) except: try: unique_lst = [] for i in lst: if i not in unique_lst: unique_lst.append(i) return sorted(unique_lst) except: traceback.print_exc() return 0 # def valid_path(inp, typ): # from C0R3.utils.file_mngr import is_path_exist if not inp: inp = None elif inp[0] == "~": inp = os.path.join(os.path.expanduser("~"), inp[1:]) elif not "/" == inp[0]: inp = os.path.join(os.path.expanduser("~"), inp) if "exist" in typ and (not inp or not is_path_exist(inp, empty=1)): inp = None return inp # def is_digit(num): try: return float(num) except: return num # def is_int(par): if type(par) == str and par.isnumeric(): return int(par) else: try: if int(par) == par: return int(par) except ValueError: pass return None # def is_bool(par): if type(par) == str: par = par.lower() par = 1 if par in ['1', 'true', 't', 'y', 'yes', 1, True] else 0 if par in ['0', 'false', 'f', 'n', 'no', 0, False] else None return par # def ip_range_list(lst, new_ip_range): for n in range(len(lst)): if any(1 for i in new_ip_range if i in range(lst[n][0], lst[n][1])) or any( 1 for i in lst[n] if i in range(new_ip_range[0], new_ip_range[1])): lst[n][0] = min(new_ip_range[0], lst[n][0]) lst[n][1] = max(new_ip_range[1], lst[n][1]) return 0 lst.append(new_ip_range) return 0 # def list_2d_1d(lst): return list(chain.from_iterable(lst)) # convert list to dictionary def list_to_dict(rcnd): it1 = dict() [it1.update({c: d}) if not c in it1.keys() else it1.update({c: it1[c] + d}) for rcnditem in rcnd[1] for (c, d) in rcnditem.items()] return [rcnd[0], it1] # def in_list(string, lst, partially=0): lst = list(lst) nlst = [k.upper() for k in lst] lst = [lst[c] for c in range(len(nlst)) if string.upper() == nlst[c] or (re.match("^" + string, nlst[c], re.I) and partially)] return lst # def non_empty_list(lst): return [l for l in lst if l] while 1: if not lst[-1]: lst = lst[:-1] else: return lst def get_random_string(length): letters = string.ascii_lowercase + string.ascii_uppercase + "0123456789 " return ''.join(random.choice(letters) for i in range(length)) def sorted_list(lst, column=0, reverse=False): return sorted(lst, key=lambda l: l[column], reverse=reverse) def number_to_ordered_string(num): s = "" if num < 0: s, num = "minus",abs(num) s += "0" if num == 0 else "1st" if num == 1 else "2nd" if num == 2 else "3rd" if num == 3 else str(num) + "th" return s

  2. #12
    تاريخ التسجيل
    Mar 2016
    المشاركات
    250
    معدل تقييم المستوى
    45

    افتراضي browser_mngr

    # from libs.ext_mngr import subprocess, selenium_webdriver, selenium_exceptions from libs.browser_requests import Firefox from libs.url_mngr import schema_based_url from libs.file_mngr import is_path_exist, correct_path, current_dir def get_firefox_browser(headless, special=0): # options = selenium_webdriver.FirefoxOptions() firefox_profile = selenium_webdriver.FirefoxProfile() options.add_argument("-safe-mode") options.add_argument('-incognito') # if headless: options.add_argument('-headless') # if special: options.add_argument("-mute-audio") options.add_argument("-disable-media-source") firefox_profile.set_preference('permissions.defaul t.stylesheet', 2) firefox_profile.set_preference('permissions.defaul t.image', 2) firefox_profile.set_preference('dom.ipc.plugins.en abled.libflashplayer.so', 'false') firefox_profile.set_preference("dom.webnotificatio ns.enabled", False) firefox_profile.set_preference('dom.successive_dia log_time_limit', 0) firefox_profile.accept_untrusted_certs = True options.add_argument('--ignore-ssl-errors=yes') firefox_profile.set_preference('media.autoplay.def ault', 1) firefox_profile.set_preference('media.autoplay.all ow-muted', False) firefox_profile.set_preference("intl.accept_langua ges", 'locale') firefox_profile.set_preference('dom.ipc.plugins.en abled.libflashplayer.so', 'false') firefox_profile.set_preference("general.useragent. override", 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) ' 'Gecko/20100101 Firefox/25.0') firefox_profile.set_preference('useAutomationExten sion', False) options.add_argument('--disable-automation') firefox_profile.set_preference("dom.webdriver.enab led", False) browser = Firefox(options=options, firefox_profile=firefox_profile, log_path='NUL') # webdriver. if is_path_exist('core/main_ext.xpi'): browser.install_addon(correct_path(current_dir(), 'core/main_ext.xpi'), temporary=True) # return browser, "gecodriver" # def browser_get(browser, url, force_regain=0): url = schema_based_url(url) if not browser.current_url == url or force_regain: try: browser.get(url) except (selenium_exceptions.TimeoutException, selenium_exceptions.WebDriverException) as e: return else: try: browser.switch_to.alert.dismiss() except selenium_exceptions.NoAlertPresentException: pass return 1 def browser_request(browser, method, url, data = dict()): if method == "post": request = browser.request(method, url, data=data) else: request = browser.request(method, url, params=data) return request # def browser_killer(browser, process_name, wild=0): # try: browser.quit() except (AttributeError, TypeError) as e: # if wild: # subprocesses = subprocess.getoutput("killall" + process_name) except Exception: print("Browser exit failed") def scroll_down(browser): browser.execute_script("window.scrollTo(0, document.body.scrollHeight);") def window_switcher(browser, window_num): browser.switch_to.window(browser.window_handles[window_num]) def window_creator(browser): browser.execute_script("window.open('', '_blank');") def close_window(browser,window_num): browser.switch_to.window(browser.window_handles[window_num]) browser.close()

صفحة 2 من 2 الأولىالأولى 12

معلومات الموضوع

الأعضاء الذين يشاهدون هذا الموضوع

الذين يشاهدون الموضوع الآن: 1 (0 من الأعضاء و 1 زائر)

الكلمات الدلالية لهذا الموضوع

المفضلات

المفضلات

ضوابط المشاركة

  • لا تستطيع إضافة مواضيع جديدة
  • لا تستطيع الرد على المواضيع
  • لا تستطيع إرفاق ملفات
  • لا تستطيع تعديل مشاركاتك
  •  

مواضيع لم يتم الرد عليها