Esempio n. 1
0
 def multiplication_list(multiplier_list):
     multiply = 1
     if Validator.number_control(multiplier_list):
         for number in multiplier_list:
             multiply *= number
         return multiply
     else:
         return False
Esempio n. 2
0
 def extraction(first_number, second_number):
     if Validator.number_control([first_number, second_number]):
         if first_number < second_number:
             return second_number - first_number
         else:
             return first_number - second_number
     else:
         return False
Esempio n. 3
0
 def rea_abs(number):
     if Validator.number_control([number]):
         if number > 0:
             return number
         else:
             return -number
     else:
         return False
Esempio n. 4
0
 def division_floor(divided, divisor):
     if Validator.number_control([divided, divisor]):
         if divided != 0 and divisor != 0:
             if divided > divisor:
                 return divided // divisor
             else:
                 return divisor // divided
         else:
             return False
     else:
         return False
Esempio n. 5
0
    def button_start_daemon_handler(self):

        if not Validator.check_path_from_text(
            [self.input_images, self.input_pdf, self.input_other_files]):
            self.SC_alert.show_warning('Поля не заполнены',
                                       'Пожалуйста, заполните корректно поля')
        else:
            self.SC_tray_icon.show()
            self.hide()
            self.SC_alert.show_info(
                "Уведомление",
                "Приложение продолжает работать в свернутом режиме")
Esempio n. 6
0
 def different_percent(first_number, second_number, boolean):
     if Validator.number_control([first_number, second_number]):
         if boolean:
             if first_number < second_number:
                 return (first_number / second_number) * 100
             else:
                 return (second_number / first_number) * 100
         else:
             if first_number > second_number:
                 return (first_number / second_number) * 100
             else:
                 return (second_number / first_number) * 100
     else:
         return False
Esempio n. 7
0
 def rea_sqrt(number, expo, boolean):
     if Validator.number_control([number, expo]):
         if number > 0 and expo >= 0:
             sqrt_number: Union[float, Any] = number**(1 / expo)
             for i in range(1, 100):
                 if i >= sqrt_number:
                     number = i
                     break
             if boolean:
                 return number
             else:
                 return sqrt_number
         else:
             return False
     else:
         return False
Esempio n. 8
0
 def percent(number, ratio):
     if Validator.number_control([number, ratio]):
         return (number * ratio) / 100
     else:
         return False
Esempio n. 9
0
 def remainder(first_number, second_number):
     if Validator.number_control([first_number, second_number]):
         return first_number % second_number
     else:
         return False
Esempio n. 10
0
 def summation(first_number, second_number):
     if Validator.number_control([first_number, second_number]):
         return first_number + second_number
     else:
         return False
Esempio n. 11
0
 def multiplication(multiplicand, multiplier):
     if Validator.number_control([multiplicand, multiplier]):
         return multiplicand * multiplier
     else:
         return False
Esempio n. 12
0
 def average(number_list):
     if Validator.number_control(number_list):
         return ReaMath.summation_list(number_list) / len(number_list)
     else:
         return False
Esempio n. 13
0
 def summation_list(number_list):
     total = 0
     if Validator.number_control(number_list):
         for number in number_list:
             total += number
         return total
Esempio n. 14
0
 def exponentiation(number, exponent):
     if Validator.number_control([number, exponent]):
         return number**exponent
     else:
         return False
Esempio n. 15
0
    def moveForward(self, probe):
        movedProbe = self.forward[probe.direction](probe)
        if (not Validator.validate(movedProbe, self.land)):
            return probe

        return movedProbe
Esempio n. 16
0
parser.add_argument("check_in_date", help="Check-in date format YYYY-MM-DD")
parser.add_argument("check_out_date", help="Check-out date format YYYY-MM-DD")
parser.add_argument("--vpn",
                    help="Using this flag cause parsing through vpn",
                    action="store_true")
parser.add_argument(
    "-r",
    "--requests",
    help=
    "The maximum number of concurrent requests that will be performed by the "
    "Scrapy downloader.",
    type=int)

args = parser.parse_args()

validator = Validator()
if validator.validate_input(checkin_date=args.check_in_date,
                            checkout_date=args.check_out_date):
    c_in = datetime.strptime(args.check_in_date, '%Y-%m-%d')
    c_out = datetime.strptime(args.check_out_date, '%Y-%m-%d')

    kwargs = {
        'country': args.country,
        'city': args.city,
        'checkin_monthday': c_in.day,
        'checkin_month': c_in.month,
        'checkin_year': c_in.year,
        'checkout_monthday': c_out.day,
        'checkout_month': c_out.month,
        'checkout_year': c_out.year,
        'use_vpn': args.vpn,