Explorar el Código

Pass through datetime, math, re, and time to --pyfilter

master
JustAnotherArchivist hace 3 años
padre
commit
d915a18a40
Se han modificado 1 ficheros con 1 adiciones y 1 borrados
  1. +1
    -1
      archivebot-jobs

+ 1
- 1
archivebot-jobs Ver fichero

@@ -62,7 +62,7 @@ class FilterAction(argparse.Action):
func = compile(values[0], '<pyfilter>', 'eval')
except Exception as e:
parser.error(f'Could not compile filter expression: {type(e).__module__}.{type(e).__name__}: {e!s}')
setattr(namespace, self.dest, lambda job: eval(func, {}, {'job': job}))
setattr(namespace, self.dest, lambda job: eval(func, {k: v for k, v in globals().items() if k in ('datetime', 'math', 're', 'time')}, {'job': job}))
return
global columns
match = re.match(r'^(?P<column>[A-Za-z ]+)(?P<op>[=<>^*$~])(?P<value>.*)$', values[0])


Cargando…
Cancelar
Guardar