def cons( ident: IdentSpec = None, state: ViewState = None, geometry: ViewGeometry = None, open: bool = False, cwd: Path = None, pin: bool = False, ) -> 'SimplePane': return SimplePane( ensure_ident_or_generate(ident), state or ViewState.cons(), geometry or ViewGeometry.cons(), Boolean(open), Maybe.optional(cwd), Boolean(pin), )
def cons( ident: IdentSpec = None, state: ViewState = None, geometry: ViewGeometry = None, vertical: bool = True, ) -> 'SimpleLayout': return SimpleLayout( ensure_ident_or_generate(ident), state or ViewState.cons(), geometry or ViewGeometry.cons(), Boolean(vertical), )
def search(monitor) -> None: r = monitor['release'] date = Try(datetime.strptime, r['airdate'], '%Y-%m-%d') | None release = Release(name=r['series'], season=r['season'], episode=r['episode'], search_name=r['search_name'], airdate=date) query = cmd.rest.filter_not(_.empty) / _.join_tokens | release.search_query_no_res query1 = release.search_query_date if query == 'date' else query self.log.info(f'Searching torrent for "{release}" with query "{query1}"...') dl = TorrentDownloader([query1]) res = Boolean(dl._search()).m(dl.search_results) / Lists.wrap // _.head return ( res / (lambda l: cmd.put(data=(lambda i: Just(dict(url=l))), path=Just('link'))) | IO.failed('no search results') )
def decode(self, tpe: Type[Boolean], data: Json) -> Either[JsonError, Boolean]: return data.scalar.e(f'invalid type for `Boolean`: {data}', Boolean(data.data))
def try_sub(new, rest): is_lambda = Boolean(arg is AttrLambdaInst or isinstance(arg, AnonAttr)) return is_lambda.m(lambda: (transform(new), rest))
def null(self) -> Boolean: return Boolean.isinstance(self, JsonNull)
def absent(self) -> Boolean: return Boolean.isinstance(self, JsonAbsent)
def object(self) -> Boolean: return Boolean.isinstance(self, JsonObject)
def array(self) -> Boolean: return Boolean.isinstance(self, JsonArray)
def scalar(self) -> Boolean: return Boolean.isinstance(self, JsonScalar)
def path_lens_pred(a: A, sub: Callable[[A], List[A]], lsub, f: Callable[[A], bool]) -> Maybe[BoundLens]: g = lambda a: Boolean(f(lsub(a))).maybe(lsub(lens)) return path_lens(a, sub, g)
def function_bindings_relay(f: Callable) -> Boolean: target = f.__do_original if hasattr(f, '__do') else f anno = inspect.getfullargspec(target).annotations return Boolean(anno.get('bindings', None) is Bindings)
def layout_panes(node: LayoutNode) -> List[PaneNode]: return node.sub.filter(Boolean.is_a(PaneNode))