{"id":18925519,"url":"https://github.com/nightmachinery/pynight","last_synced_at":"2025-04-15T13:32:13.642Z","repository":{"id":46376295,"uuid":"411222614","full_name":"NightMachinery/PyNight","owner":"NightMachinery","description":"My Python utility library.","archived":false,"fork":false,"pushed_at":"2024-10-24T17:21:49.000Z","size":357,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-25T21:21:58.748Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NightMachinery.png","metadata":{"files":{"readme":"readme.org","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-09-28T09:45:39.000Z","updated_at":"2024-10-24T17:21:53.000Z","dependencies_parsed_at":"2023-01-17T19:45:20.928Z","dependency_job_id":"5c9d21bc-6e8f-4884-9edd-bb44bf3203d7","html_url":"https://github.com/NightMachinery/PyNight","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NightMachinery%2FPyNight","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NightMachinery%2FPyNight/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NightMachinery%2FPyNight/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NightMachinery%2FPyNight/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NightMachinery","download_url":"https://codeload.github.com/NightMachinery/PyNight/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223672990,"owners_count":17183618,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T11:12:09.428Z","updated_at":"2024-11-08T11:12:10.054Z","avatar_url":"https://github.com/NightMachinery.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"#+TITLE: PyNight\n\n* Install\n#+begin_example zsh\npip install -U pynight\n#+end_example\n\nOr install the latest version directly from git:\n#+begin_example zsh\npip install git+https://github.com/NightMachinery/PyNight.git\n#+end_example\n\nTo reinstall the latest version:\n#+begin_example zsh\npip install git+https://github.com/NightMachinery/PyNight.git\npip install --no-deps --force-reinstall git+https://github.com/NightMachinery/PyNight.git\n#+end_example\n\n* =pynight.common_dynamic=\n#+begin_src jupyter-python :kernel py_base :session emacs_py_1 :async yes :exports both\nfrom pynight.common_dynamic import (\n    DynamicVariables,\n    DynamicObject,\n    dynamic_set,\n    dynamic_get,\n)\n\ndynamic_dict = {}\nobj = DynamicObject(dynamic_dict, default_to_none_p=True)\nobj.x = -13\nobj.z = 72\nprint(\n    f\"x: {obj.x}, z: {obj.z}, nonexistent_attribute: {obj.nonexistent_attribute or 'some_default_value'}\"\n)\n#: x: -13, z: 72, nonexistent_attribute: some_default_value\nwith DynamicVariables(obj, x=10):\n    print(f\"x: {obj.x}, z: {obj.z}\")  #: x: 10, z: 72\n    with DynamicVariables(obj, x=20):\n        print(f\"x: {obj.x}, z: {obj.z}\")  #: x: 20, z: 72\n        obj.x = 99\n        obj.y = 81\n        obj.z = -6\n        print(f\"x: {obj.x}, y: {obj.y}, z: {obj.z}\")\n        #: x: 99, y: 81, z: -6\n    print(f\"x: {obj.x}, y: {obj.y}, z: {obj.z}\")\n    #: x: 10, y: 81, z: -6\n    #: z and y did NOT get reset as they were not explicitly set in the previous context manager.\n\n    obj.y = 560\nprint(f\"x: {obj.x}, y: {obj.y}, z: {obj.z}\")\n#: x: -13, y: 560, z: -6\n#+end_src\n\n#+RESULTS:\n: x: -13, z: 72, nonexistent_attribute: some_default_value\n: x: 10, z: 72\n: x: 20, z: 72\n: x: 99, y: 81, z: -6\n: x: 10, y: 81, z: -6\n: x: -13, y: 560, z: -6\n\n* =pynight.common_tqdm=\n** =tqdm_telegram=\n#+begin_src jupyter-python :kernel py_base :session /jpy:127.0.0.1#6035:orgk1/ :async yes :exports both\nfrom os import environ\n\nenviron['TQDM_TELEGRAM_TOKEN'] = 'xxx'\nenviron['TQDM_TELEGRAM_CHAT_ID'] = 'xxx'\n#+end_src\n\n#+RESULTS:\n\n#+begin_src jupyter-python :kernel py_base :session /jpy:127.0.0.1#6035:orgk1/ :async yes :exports both\nfrom pynight.common_tqdm import tqdm, trange\nimport time\n\nfor i in tqdm(range(100)):\n    # print(i)\n    \n    time.sleep(0.1)\n#+end_src\n\n\n\n* =rtl_iterfzf=\n#+begin_src python :eval never\nfrom pynight.common_fzf import rtl_iterfzf\nfrom pynight.common_rtl import rtl_reshaper_v1\n\n# Your iterable of items\niterable_items = [\n    \"سلام دنیا\",  # Persian for \"Hello World\"\n    \"Hello World\",\n    \"مرحبا بالعالم\",  # Arabic for \"Hello World\"\n    \"Bonjour le monde\",\n]\n\n# Use the rtl_iterfzf function\nresult = rtl_iterfzf(\n    iterable_items,\n    reshaper_func=rtl_reshaper_v1,\n    multi=True,  # Set to True if you want to select multiple items\n    # You can pass additional iterfzf options here\n)\n\nif result:\n    print(\"Selected Items:\", result.selected)\n    print(\"Indices:\", result.indices)\n    \nelse:\n    print(\"No selection made.\")\n#+end_src\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnightmachinery%2Fpynight","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnightmachinery%2Fpynight","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnightmachinery%2Fpynight/lists"}