text
stringlengths
18
773k
def makeWritePacket(ID, reg, values=None): """ Creates a packet that writes a value(s) to servo ID at location reg. Make sure the values are in little endian (use Packet.le() if necessary) for 16 b (word size) values. """ pkt = makePacket(ID, xl320.XL320_WRITE, reg, values) return pkt
def makeReadPacket(ID, reg, values=None): """ Creates a packet that reads the register(s) of servo ID at location reg. Make sure the values are in little endian (use Packet.le() if necessary) for 16 b (word size) values. """ pkt = makePacket(ID, xl320.XL320_READ, reg, values) return pkt
def makeResetPacket(ID, param): """ Resets a servo to one of 3 reset states: XL320_RESET_ALL = 0xFF XL320_RESET_ALL_BUT_ID = 0x01 XL320_RESET_ALL_BUT_ID_BAUD_RATE = 0x02 """ if param not in [0x01, 0x02, 0xff]: raise Exception('Packet.makeResetPacket invalide parameter {}'.format(par...
def makeServoPacket(ID, angle): """ Commands the servo to an angle (in degrees) """ if not (0.0 <= angle <= 300.0): raise Exception('makeServoPacket(), angle out of bounds: {}'.format(angle)) val = int(angle/300*1023) # lo, hi = le(val) # print('servo cmd {} deg : {} : L {} H {}'.format(angle, val, lo, hi)) p...
def makeServoMaxLimitPacket(ID, angle): """ Sets the maximum servo angle (in the CCW direction) """ angle = int(angle/300.0*1023) pkt = makeWritePacket(ID, xl320.XL320_CCW_ANGLE_LIMIT, le(angle)) return pkt
def makeServoMinLimitPacket(ID, angle): """ Sets the minimum servo angle (in the CW direction) """ angle = int(angle/300.0*1023) pkt = makeWritePacket(ID, xl320.XL320_CW_ANGLE_LIMIT, le(angle)) return pkt
def makeServoSpeedPacket(ID, maxSpeed): """ Run servo between 0.0 to 1.0, where 1.0 is 100% (full) speed. """ if 0.0 > maxSpeed > 1.0: raise Exception('makeServoSpeed: max speed is a percentage (0.0-1.0)') speed = int(maxSpeed*1023) pkt = makeWritePacket(ID, xl320.XL320_GOAL_VELOCITY, le(speed)) return pkt
def makeLEDPacket(ID, color): """ Turn on/off the servo LED and also sets the color. """ # pkt = [255, 255, 253, 0, ID, 11, 0, 3, 25, 0, 2 crc_l, crc_h] pkt = makeWritePacket(ID, xl320.XL320_LED, [color]) return pkt
def makeDelayPacket(ID, delay): """ It is the delay time per data value that takes from the transmission of Instruction Packet until the return of Status Packet. 0 to 254 (0xFE) can be used, and the delay time per data value is 2 usec. That is to say, if the data value is 10, 20 usec is delayed. The initial value...
def makeControlModePacket(ID, mode): """ Sets the xl-320 to either servo or wheel mode """ pkt = makeWritePacket(ID, xl320.XL320_CONTROL_MODE, le(mode)) return pkt
def makeBaudRatePacket(ID, rate): """ Set baud rate of servo. in: rate - 0: 9600, 1:57600, 2:115200, 3:1Mbps out: write packet """ if rate not in [0, 1, 2, 3]: raise Exception('Packet.makeBaudRatePacket: wrong rate {}'.format(rate)) pkt = makeWritePacket(ID, xl320.XL320_BAUD_RATE, [rate]) return pkt
def makeSyncAnglePacket(info): """ Write sync angle information to servos. info = [[ID, angle], [ID, angle], ...] """ addr = le(xl320.XL320_GOAL_POSITION) data = [] # since all servo angles have the same register addr (XL320_GOAL_POSITION) # and data size (2), a sinc packet is smart choice # compare bulk vs ...
def makeBulkAnglePacket(info): """ Write bulk angle information to servos. info = [[ID, angle], [ID, angle], ...] """ addr = le(xl320.XL320_GOAL_POSITION) data = [] for pkt in info: data.append(pkt[0]) # ID data.append(addr[0]) # LSB data.append(addr[1]) # MSB data.append(2) # 2 bytes data.append(...
def prettyPrintPacket(pkt): """ not done """ s = 'packet ID: {} instr: {} len: {}'.format(pkt[4], pkt[7], int((pkt[6] << 8) + pkt[5])) if len(s) > 10: params = pkt[8:-2] s += ' params: {}'.format(params) return s
def findPkt(pkt): """ Search through a string of binary for a valid xl320 package. in: buffer to search through out: a list of valid data packet """ # print('findpkt', pkt) # print('-----------------------') ret = [] while len(pkt)-10 >= 0: if pkt[0:4] != [0xFF, 0xFF, 0xFD, 0x00]: pkt.pop(0) # get rid o...
def packetToDict(pkt): """ Given a packet, this turns it into a dictionary ... is this useful? in: packet, array of numbers out: dictionary (key, value) """ d = { 'id': pkt[4], 'instruction': xl320.InstrToStr[pkt[7]], 'length': (pkt[6] << 8) + pkt[5], 'params': pkt[8:-2], 'crc': pkt[-2:] } return d
def populate_all(): """Fetch and store all metadata from the AFIP.""" ReceiptType.objects.populate() ConceptType.objects.populate() DocumentType.objects.populate() VatType.objects.populate() TaxType.objects.populate() CurrencyType.objects.populate()
def first_currency(): """ Returns the id for the first currency The `default` parameter of a foreign key *MUST* be a primary key (and not an instance), else migrations break. This helper method exists solely for that purpose. """ ct = CurrencyType.objects.filter(code='PES').first() if c...
def populate(self, ticket=None): """ Populate the database with types retrieved from the AFIP. If no ticket is provided, the most recent available one will be used. """ ticket = ticket or AuthTicket.objects.get_any_active('wsfe') client = clients.get_client('wsfe', ticke...
def certificate_object(self): """ Returns the certificate as an OpenSSL object Returns the certificate as an OpenSSL object (rather than as a file object). """ if not self.certificate: return None self.certificate.seek(0) return crypto.parse_c...
def get_certificate_expiration(self): """ Gets the certificate expiration from the certificate Gets the certificate expiration from the certificate file. Note that this value is stored into ``certificate_expiration`` when an instance is saved, so you should generally prefer tha...
def generate_key(self, force=False): """ Creates a key file for this TaxPayer Creates a key file for this TaxPayer if it does not have one, and immediately saves it. Returns True if and only if a key was created. """ if self.key and not force: logger...
def generate_csr(self, basename='djangoafip'): """ Creates a CSR for this TaxPayer's key Creates a file-like object that contains the CSR which can be used to request a new certificate from AFIP. """ csr = BytesIO() crypto.create_csr( self.key.file, ...
def create_ticket(self, service): """Create an AuthTicket for a given service.""" ticket = AuthTicket(owner=self, service=service) ticket.authorize() return ticket
def get_ticket(self, service): """Return an existing AuthTicket for a given service.""" return self.auth_tickets \ .filter(expires__gt=datetime.now(timezone.utc), service=service) \ .last()
def fetch_points_of_sales(self, ticket=None): """ Fetch all point of sales objects. Fetch all point of sales from the WS and store (or update) them locally. Returns a list of tuples with the format (pos, created,). """ ticket = ticket or self.get_or_create_ticke...
def logo_as_data_uri(self): """This TaxPayer's logo as a data uri.""" _, ext = os.path.splitext(self.logo.file.name) with open(self.logo.file.name, 'rb') as f: data = base64.b64encode(f.read()) return 'data:image/{};base64,{}'.format( ext[1:], # Remove the leadi...
def authorize(self): """Send this ticket to AFIP for authorization.""" request = self.__create_request_xml() request = self.__sign_request(request) request = b64encode(request).decode() client = clients.get_client('wsaa', self.owner.is_sandboxed) try: raw_res...
def _assign_numbers(self): """ Assign numbers in preparation for validating these receipts. WARNING: Don't call the method manually unless you know what you're doing! """ first = self.select_related('point_of_sales', 'receipt_type').first() next_num = Receipt.ob...
def check_groupable(self): """ Checks that all receipts returned by this queryset are groupable. "Groupable" means that they can be validated together: they have the same POS and receipt type. Returns the same queryset is all receipts are groupable, otherwise, raises :c...
def validate(self, ticket=None): """ Validates all receipts matching this queryset. Note that, due to how AFIP implements its numbering, this method is not thread-safe, or even multiprocess-safe. Because of this, it is possible that not all instances matching this query...
def fetch_last_receipt_number(self, point_of_sales, receipt_type): """Returns the number for the last validated receipt.""" client = clients.get_client('wsfe', point_of_sales.owner.is_sandboxed) response_xml = client.service.FECompUltimoAutorizado( serializers.serialize_ticket( ...
def total_vat(self): """Returns the sum of all Vat objects.""" q = Vat.objects.filter(receipt=self).aggregate(total=Sum('amount')) return q['total'] or 0
def total_tax(self): """Returns the sum of all Tax objects.""" q = Tax.objects.filter(receipt=self).aggregate(total=Sum('amount')) return q['total'] or 0
def is_validated(self): """ Returns True if this instance is validated. Note that resolving this property requires a DB query, so if you've a very large amount of receipts you should prefetch (see django's ``select_related``) the ``validation`` field. Even so, a DB query *may* ...
def validate(self, ticket=None, raise_=False): """ Validates this receipt. This is a shortcut to :class:`~.ReceiptQuerySet`'s method of the same name. Calling this validates only this instance. :param AuthTicket ticket: Use this ticket. If None, one will be loaded o...
def create_for_receipt(self, receipt, **kwargs): """ Creates a ReceiptPDF object for a given receipt. Does not actually generate the related PDF file. All attributes will be completed with the information for the relevant ``TaxPayerProfile`` instance. :param Receipt rec...
def save_pdf(self, save_model=True): """ Save the receipt as a PDF related to this model. The related :class:`~.Receipt` should be validated first, of course. :param bool save_model: If True, immediately save this model instance. """ from django_afip.views import Receip...
def compute_amount(self): """Auto-assign and return the total amount for this tax.""" self.amount = self.base_amount * self.aliquot / 100 return self.amount
def get_label_based_random_walk_matrix(adjacency_matrix, labelled_nodes, label_absorption_probability): """ Returns the label-absorbing random walk transition probability matrix. Input: - A: A sparse matrix that contains the adjacency matrix of the graph. Output: - W: A sparse matrix that contains th...
def get_natural_random_walk_matrix(adjacency_matrix, make_shared=False): """ Returns the natural random walk transition probability matrix given the adjacency matrix. Input: - A: A sparse matrix that contains the adjacency matrix of the graph. Output: - W: A sparse matrix that contains the natural ra...
def is_middleware(func) -> bool: """ test whether it is a middleware :return: Boolean """ if inspect.isfunction(func): _check = func _name = func.__name__ else: _check = func.__call__ _name = func.__class__.__name__ if not inspect.iscoroutinefunction(_check)...
def start(st_reg_number): """Checks the number valiaty for the Rondônia state""" divisor = 11 weight = [6, 5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2] if len(st_reg_number) != 9 and len(st_reg_number) != 14: return False if len(st_reg_number) == 9: sum_total = 0 peso = 6 ...
def start(st_reg_number): """Checks the number valiaty for the São Paulo state""" divisor = 11 verificador_one = int(st_reg_number[len(st_reg_number)-4]) verificador_two = int(st_reg_number[len(st_reg_number)-1]) weights_first = [1, 3, 4, 5, 6, 7, 8, 10] weights_secund = [3, 2, 10, 9, 8, 7, 6,...
def start(st_reg_number): """Checks the number valiaty for the Pernanbuco state""" divisor = 11 if len(st_reg_number) > 9: return False if len(st_reg_number) < 9: return False sum_total = 0 peso = 8 for i in range(len(st_reg_number)-2): sum_total = sum_total + int(...
def set_header(self, key: str, value: str) -> None: """ set response header :param key: the key of header :param value: the value of header """ self.headers[key] = value
def start(st_reg_number): """Checks the number valiaty for the Bahia state""" weights_second_digit = range(len(st_reg_number)-1, 1, -1) weights_first_digit = range(len(st_reg_number), 1, -1) second_digits = st_reg_number[-1:] number_state_registration = st_reg_number[0:len(st_reg_number) - 2] d...
async def send_http_response(writer, http_code: int, headers: List[Tuple[str, str]], content: bytes, http_status: str= None ) -> None: """ generate http response paylo...
async def serve(http_handler: HTTP_WRAPPER_TYPE, websocket_handler=None, address: str='127.0.0.1', port: int=8000): """ start server """ return await asyncio.start_server(SocketWrapper(http_handler, websocket_handler), address, port)
def __body_format(self, body): """ format body into different type :param body: :return: """ ctype, pdict = parse_header(self.content_type) if ctype == 'application/json': self.form = json.loads(body.decode()) elif ctype == 'application/x-www...
def start(st_reg_number): """Checks the number valiaty for the Paraiba state""" #st_reg_number = str(st_reg_number) weights = [9, 8, 7, 6, 5, 4, 3, 2] digit_state_registration = st_reg_number[-1] if len(st_reg_number) != 9: return False sum_total = 0 for i in range(0, 8): ...
def start(st_reg_number): """Checks the number valiaty for the Mato Grosso state""" #st_reg_number = str(st_reg_number) weights = [3, 2, 9, 8, 7, 6, 5, 4, 3, 2] digit_state_registration = st_reg_number[-1] if len(st_reg_number) != 11: return False sum = 0 for i in range(0, 10): ...
def start(st_reg_number): """Checks the number valiaty for the Sergipe state""" divisor = 11 if len(st_reg_number) > 9: return False if len(st_reg_number) < 9: return False sum_total = 0 peso = 9 for i in range(len(st_reg_number)-1): sum_total = sum_total + int(st...
def start(st_reg_number): """Checks the number valiaty for the Espirito Santo state""" weights = [9, 8, 7, 6, 5, 4, 3, 2] number_state_registration = st_reg_number[0:len(st_reg_number) - 1] digit_state_registration = st_reg_number[-1] if st_reg_number[0:2] not in ['10', '11', '12']: return...
def start(st_reg_number): """Checks the number valiaty for the Acre state""" #st_reg_number = str(st_reg_number) weights = [4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2] digits = st_reg_number[:len(st_reg_number) - 2] check_digits = st_reg_number[-2:] divisor = 11 if len(st_reg_number) > 13: re...
def load_from_object(self, object_name): """ load all upper parameters of object as config parameters :param object_name: the object you wanna load :return: """ for key in dir(object_name): if key.isupper(): self[key] = getattr(object_name, key...
def start(st_reg_number): """Checks the number valiaty for the Minas Gerais state""" #st_reg_number = str(st_reg_number) number_state_registration_first_digit = st_reg_number[0:3] + '0' + st_reg_number[3: len(st_reg_number)-2] weights_first_digit = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2] wights_second_...
def use(self, *middleware: MiddlewareType) -> None: """ Register Middleware :param middleware: The Middleware Function """ for m in middleware: if is_middleware(m): self.middleware.append(m)
async def handler(self, request: Request) -> Tuple[int, str, List[Tuple[str, str]], bytes]: """ The handler handling each request :param request: the Request instance :return: The Response instance """ response: 'Response' = Response() handler: Callable = empty ...
def run(self, host: str="localhost", port: int=8000, debug: bool=False): """ start the http server :param host: The listening host :param port: The listening port :param debug: whether it is in debug mod or not """ self.debug = debug loop = asyncio.get_eve...
def start(st_reg_number): """Checks the number valiaty for the Amazonas state""" weights = range(2, 10) digits = st_reg_number[0:len(st_reg_number) - 1] control_digit = 11 check_digit = st_reg_number[-1:] if len(st_reg_number) != 9: return False ...
def start(state_registration_number, state_abbreviation): """ This function is like a Facade to another modules that makes their own state validation. state_registration_number - string brazilian state registration number state_abbreviation - state abbreviation AC (Acre) ...
def start(st_reg_number): """Checks the number valiaty for the Alagoas state""" if len(st_reg_number) > 9: return False if len(st_reg_number) < 9: return False if st_reg_number[0:2] != "24": return False if st_reg_number[2] not in ['0', '3', '5', '7', '8']: return...
def start(st_reg_number): """Checks the number valiaty for the Alagoas state""" divisor = 11 if len(st_reg_number) > 9: return False if len(st_reg_number) < 9: return False if st_reg_number[0:2] != "03": return False aux = int(st_reg_number[0:len(st_reg_number) - 1]) ...
def to_dict(self): """Return a dictionary representation of the error. :return: A dict with the keys: - attr: Attribute which contains the error, or "<root>" if it refers to the schema root. - errors: A list of dictionary representations of the errors. """ def ex...
def _filtered_actions(self, *a_types): """ Get actions filtered on a list of action types. :param a_type: argparse.Action instance name (e.g. count, append) """ for a in filter(lambda _: self.is_action(_, *a_types), self._actions): yield a
def _input_arg(self, a): """ Ask the user for input of a single argument. :param a: argparse.Action instance :return: the user input, asked according to the action """ # if action of an argument that suppresses any other, just return if a.dest == SUPPRES...
def _set_arg(self, a, s="main", c=False): """ Set a single argument. :param a: argparse.Action instance :param s: config section title :param c: use class' ConfigParser instance to get parameters """ # if action of an argument that suppresses any other, j...
def _sorted_actions(self): """ Generate the sorted list of actions based on the "last" attribute. """ for a in filter(lambda _: not _.last and \ not self.is_action(_, 'parsers'), self._actions): yield a for a in filter(lambda _: _.last and \ ...
def config_args(self, section="main"): """ Additional method for feeding input arguments from a config file. :param section: current config section name """ if self._config_parsed: return for a in self._filtered_actions("config"): for o in...
def demo_args(self): """ Additional method for replacing input arguments by demo ones. """ argv = random.choice(self.examples).replace("--demo", "") self._reparse_args['pos'] = shlex.split(argv)
def parse_args(self, args=None, namespace=None): """ Reparses new arguments when _DemoAction (triggering parser.demo_args()) or _WizardAction (triggering input_args()) was called. """ if not namespace: # use the new Namespace class for handling _config namespace = N...
def error(self, message): """ Prints a usage message incorporating the message to stderr and exits in the case when no new arguments to be reparsed, that is when no special action like _DemoAction (triggering parser.demo_args()) or _WizardAction (triggering input_args()) was ...
def add_to_config(cls, section, name, value): """ Add a parameter to the shared ConfigParser object. :param section: parameter's section :param name: parameter's name :param value: parameter's value """ if value: if not cls._config.has_se...
def output(f): """ This decorator allows to choose to return an output as text or to save it to a file. """ def wrapper(self, *args, **kwargs): try: text = kwargs.get('text') or args[0] except IndexError: text = True _ = f(self, *args, **kwargs) i...
def html(self, text=TEXT): """ Generate an HTML file from the report data. """ self.logger.debug("Generating the HTML report{}..." .format(["", " (text only)"][text])) html = [] for piece in self._pieces: if isinstance(piece, string_types): ...
def pdf(self, text=TEXT): """ Generate a PDF file from the report data. """ self.logger.debug("Generating the PDF report...") html = HTML(string=self.html()) css_file = self.css or join(dirname(abspath(__file__)), "{}.css".format(self.theme)) c...
def csv(self, text=TEXT, sep=',', index=True, float_fmt="%.2g"): """ Generate a CSV table from the table data. """ return self._data.to_csv(sep=sep, index=index, float_format=float_fmt)
def md(self, text=TEXT, float_format="%.2g"): """ Generate Markdown from the table data. """ cols = self._data.columns hl = pd.DataFrame([["---"] * len(cols)], index=["---"], columns=cols) df = pd.concat([hl, self._data]) return df.to_csv(sep='|', index=True, float_format=float_f...
def xml(self, text=TEXT): """ Generate an XML output from the report data. """ def convert(line): xml = " <item>\n" for f in line.index: xml += " <field name=\"%s\">%s</field>\n" % (f, line[f]) xml += " </item>\n" return xml re...
def from_argspec(argspec): """ retrieve a FunctionSignature object from the argspec and the annotations passed. """ attributes = getattr(argspec, "args", []) + getattr(argspec, "keywords", []) defaults = argspec.defaults or [] arguments, keywords = [], {} ...
def split_args(self, arg_dict): """ given a dictionary of arguments, split them into args and kwargs note: this destroys the arg_dict passed. if you need it, create a copy first. """ pos_args = [] for arg in self.args: pos_args.append(arg_dict...
def std_input(prompt="", style=None): """ Very simple Python2/3-compatible input method. :param prompt: prompt message :param style: dictionary of ansi_wrap keyword-arguments """ p = ansi_wrap(prompt, **(style or {})) try: return raw_input(p).strip() except NameError: ...
def user_input(prompt="", choices=None, default=None, choices_str="", required=False): """ Python2/3-compatible input method handling choices and default value. :param prompt: prompt message :param choices: list of possible choices or lambda function :param default: default v...
def pretty_format_args(*args, **kwargs): """ Take the args, and kwargs that are passed them and format in a prototype style. """ args = list([repr(a) for a in args]) for key, value in kwargs.items(): args.append("%s=%s" % (key, repr(value))) return "(%s)" % ", ".join([a for a in args...
def render(file): """Pretty print the XML file for rendering.""" with file.open() as fp: encoding = detect_encoding(fp, default='utf-8') file_content = fp.read().decode(encoding) parsed_xml = xml.dom.minidom.parseString(file_content) return parsed_xml.toprettyxml(indent=' ', new...
def validate_xml(file): """Validate an XML file.""" max_file_size = current_app.config.get( 'PREVIEWER_MAX_FILE_SIZE_BYTES', 1 * 1024 * 1024) if file.size > max_file_size: return False with file.open() as fp: try: content = fp.read().decode('utf-8') xml.d...
def preview(file): """Render appropiate template with embed flag.""" return render_template( 'invenio_previewer/xml_prismjs.html', file=file, content=render(file), js_bundles=['previewer_prism_js'], css_bundles=['previewer_prism_css'], )
def _get_context(argspec, kwargs): """Prepare a context for the serialization. :param argspec: The argspec of the serialization function. :param kwargs: Dict with context :return: Keywords arguments that function can accept. """ if argspec.keywords is not None: return kwargs return ...
def get(self, obj, **kwargs): """Get an attribute from a value. :param obj: Object to get the attribute value from. :return: Value of object's attribute. """ assert self.getter is not None, "Getter accessor is not specified." if callable(self.getter): return ...
def set(self, obj, value): """Set value for obj's attribute. :param obj: Result object or dict to assign the attribute to. :param value: Value to be assigned. """ assert self.setter is not None, "Setter accessor is not specified." if callable(self.setter): re...
def accessor(self): """Get an attribute's accessor with the getter and the setter. :return: `Accessor` instance. """ if isinstance(self.attr, Accessor): return self.attr if callable(self.attr): return Accessor(getter=self.attr) attr = self.attr ...
def serialize(self, value, **kwargs): """Serialize the attribute of the input data. Gets the attribute value with accessor and converts it using the type serialization. Schema will place this serialized value into corresponding compartment of the HAL structure with the name of the ...
def deserialize(self, value, **kwargs): """Deserialize the attribute from a HAL structure. Get the value from the HAL structure from the attribute's compartment using the attribute's name as a key, convert it using the attribute's type. Schema will either return it to parent schema or ...
def key(self): """Embedded supports curies.""" if self.curie is None: return self.name return ":".join((self.curie.name, self.name))
def deserialize(cls, value, output=None, **kwargs): """Deserialize the HAL structure into the output value. :param value: Dict of already loaded json which will be deserialized by schema attributes. :param output: If present, the output object will be updated instead of returning the deserializ...
def parse(self, data): """Parse a 9 bytes packet in the Temperature format and return a dictionary containing the data extracted. An example of a return value would be: .. code-block:: python { 'id': "0x2EB2", 'packet_length': 8, ...
def neg_int(i): """ Simple negative integer validation. """ try: if isinstance(i, string_types): i = int(i) if not isinstance(i, int) or i > 0: raise Exception() except: raise ValueError("Not a negative integer") return i
def pos_int(i): """ Simple positive integer validation. """ try: if isinstance(i, string_types): i = int(i) if not isinstance(i, int) or i < 0: raise Exception() except: raise ValueError("Not a positive integer") return i
def ints(l, ifilter=lambda x: x, idescr=None): """ Parses a comma-separated list of ints. """ if isinstance(l, string_types): if l[0] == '[' and l[-1] == ']': l = l[1:-1] l = list(map(lambda x: x.strip(), l.split(','))) try: l = list(map(ifilter, list(map(int, l)))) e...