def add_containers(self, containers): self._requests += 1 for container_data in containers: container = Container(container_data.get('name', '')) container.set_object_count(parse_int(container_data.get('count', 0))) container.set_bytes(container_data.get('bytes', 0)) container.set_cdn(container_data.get('cdn_enabled', False)) container.set_logging(container_data.get('log_retention', False)) container.set_ttl(parse_int(container_data.get('ttlparse_bool', 0))) container.set_cdn_uri(container_data.get('cdn_uri', '')) container.set_ssl_uri(container_data.get('cdn_ssl_uri', '')) container.set_stream_uri(container_data.get('cdn_streaming_uri', '')) if container.is_valid(): self._containers.append(container)
def read_orders(self): entered_orders = OrderList() print "Note: Press enter after entering orders\n " + \ "Enter order with space delimiter in following order:\n " + \ "Side Company Quantity" while True: entered_list = raw_input().split() if len(entered_list) == 0: print "Recevied orders... Processing..." break if len(entered_list) != 3: print "Invalid format, Skipping it. Reenter in valid format" continue side, company, quantity = entered_list if not helpers.is_valid_order_parameters(side = side, company = company, quantity = quantity): print "Invalid format, Skipping it. Reenter in valid format" continue parsed_quantity = helpers.parse_int(quantity) entered_orders.addorder( Order( side = side, company = company, quantity = parsed_quantity, remaining_quantity = parsed_quantity ) ) return entered_orders
def user_stats_pro(self, bot, update, args): if update.message.from_user.id not in self.users_to_inform: self.logger.error(f"Unknown user {update.message.from_user}") return self.track(TgEvent.USER_STATS, update) threshold, valid_threshold = parse_int(args[:1], 50) user_filter = ''.join(args if not valid_threshold else args[1:]) event_filter = [ get_event_by_name(i) for i in args if get_event_by_name(i) ] stats = self.tracker.stats(True, threshold, user_filter, event_filter) self.send_text(f'```\n{stats}\n```', update, parse_mode='Markdown')
def user_stats_pro(self, _, update, args): # TODO: Add user checking as a module (white/black lists and so on) if update.message.from_user.id != 26943105: self.logger.error(f"Unknown user {update.message.from_user}") return self.ping_prod() self.track(TgEvent.USER_STATS, update) threshold, valid_threshold = parse_int(args[:1], 50) user_filter = ''.join(args if not valid_threshold else args[1:]) event_filter = [ get_event_by_name(i) for i in args if get_event_by_name(i) ] stats = self.tracker.stats(True, threshold, user_filter, event_filter) self.logger.debug(stats) update.message.reply_text(f'```\n{stats}\n```', parse_mode='Markdown')
def set_container_count(self, x): self._container_count = parse_int(x)
def set_transport_len(self, length): self._transport_len = parse_int(length)