{"id":20181433,"url":"https://github.com/dotoscat/pyfunstream","last_synced_at":"2025-03-03T06:11:52.172Z","repository":{"id":99766825,"uuid":"126174356","full_name":"dotoscat/pyfunstream","owner":"dotoscat","description":"Allow to chain functions with the | operator through streams","archived":false,"fork":false,"pushed_at":"2018-03-25T08:44:22.000Z","size":14,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-13T17:20:25.891Z","etag":null,"topics":["functional-programming","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dotoscat.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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":"2018-03-21T12:20:57.000Z","updated_at":"2018-03-25T08:44:22.000Z","dependencies_parsed_at":"2023-05-09T14:17:13.869Z","dependency_job_id":null,"html_url":"https://github.com/dotoscat/pyfunstream","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotoscat%2Fpyfunstream","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotoscat%2Fpyfunstream/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotoscat%2Fpyfunstream/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotoscat%2Fpyfunstream/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dotoscat","download_url":"https://codeload.github.com/dotoscat/pyfunstream/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241616700,"owners_count":19991543,"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":["functional-programming","python"],"created_at":"2024-11-14T02:35:30.653Z","updated_at":"2025-03-03T06:11:52.153Z","avatar_url":"https://github.com/dotoscat.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"pyfunstream\n===========\n\nThis module provide a simple mechanism to chain functions, only using\nthe operator overloading and a pair of classes\n\n\nFeatures\n========\n\n- Functional programming with the pipe | operator.\n- The stream stores the returned value by the last function.\n- Partials.\n\nExample of use\n==============\n\n```\n    import funstream\n\n    def sum2(a):\n        return a + 2\n\n    def mul3(a):\n        return a*3\n\n    fns = funstream.Stream()\n\n    2 | fns[sum2] | fns[mul3] | fns[print]\n\n    # The stream keeps the last value returned by the last function call\n\n    fns = funstream.Stream() # Throw away the old stream\n\n    2 | fns[lambda n: n*3]\n    fns | fns[lambda n: n + 2]\n    # fns.last_value == 8\n\n    # Partials\n\n    def mysum(a, b):\n        return a + b\n\n    def mymul(a, b):\n        return a*b\n\n    def addletter(letter, chain):\n        return chain + letter\n\n    s = funstream.Stream()\n    value = 2 | s[(mysum, 2)] | s[(mymul, 2)] | s[str] | s[(addletter, 'a')] \n    # value == \"8a\"\n\n```\n\nTODO\n====\n\n- Incorporate mypy to the project, at least a look.\n- Store calls and its values through the stream (function call, value, return value).\n\nLicense\n=======\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdotoscat%2Fpyfunstream","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdotoscat%2Fpyfunstream","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdotoscat%2Fpyfunstream/lists"}