{"id":21301889,"url":"https://github.com/sergiors/pyf","last_synced_at":"2025-06-14T11:34:07.659Z","repository":{"id":75410056,"uuid":"151760714","full_name":"sergiors/pyf","owner":"sergiors","description":null,"archived":false,"fork":false,"pushed_at":"2020-06-18T00:03:47.000Z","size":19,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-15T18:51:54.522Z","etag":null,"topics":["functional-programming","python"],"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/sergiors.png","metadata":{"files":{"readme":"README.md","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":"2018-10-05T18:12:39.000Z","updated_at":"2020-06-18T00:03:50.000Z","dependencies_parsed_at":"2023-06-06T10:15:50.998Z","dependency_job_id":null,"html_url":"https://github.com/sergiors/pyf","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sergiors/pyf","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sergiors%2Fpyf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sergiors%2Fpyf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sergiors%2Fpyf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sergiors%2Fpyf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sergiors","download_url":"https://codeload.github.com/sergiors/pyf/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sergiors%2Fpyf/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259809364,"owners_count":22914837,"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-21T15:53:18.931Z","updated_at":"2025-06-14T11:34:07.655Z","avatar_url":"https://github.com/sergiors.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Pyf\n---\n\n**Pyf** is a functional library. It's built on the shoulders of [Pipe](https://github.com/JulienPalard/Pipe) project.\nIf you don't find some functions here, we recommend you take a look on the [Pipe](https://github.com/JulienPalard/Pipe) project.\n\nBelow It's all functions that have been implemented.\n\n\n```python\n\u003e\u003e\u003e from pipe import as_list\n\u003e\u003e\u003e from pyf import *\n\n\u003e\u003e\u003e [1, 2, 3] | prepend(1)\n[1, 1, 2, 3]\n\n\u003e\u003e\u003e {'foo': 'bar'} | merge({'bar': 'foo'})\n{'foo': 'bar', 'bar': 'foo'}\n\n\u003e\u003e\u003e {'name': 'Joe'} | prop('name')\n'Joe'\n\n\u003e\u003e\u003e {'name': 'Joe'} | prop('addr', {})\n{}\n\n\u003e\u003e\u003e {'name': 'Jimi', 'surname': 'Hendrix'} | values\n['Jimi', 'Hendrix']\n\n\u003e\u003e\u003e {'addr': {'country': 'Brazil'}} | path(['addr', 'country'])\n'Brazil'\n\n\u003e\u003e\u003e {'user': {'addr': {'country': 'Brazil'}}} | path(['user', 'addr'])\n{'country': 'Brazil'}\n\n\u003e\u003e\u003e {'addr': {'country': 'Brazil'}} | path(['addr', 'street_number'], 0)\n0\n\n\u003e\u003e\u003e {} | path(['addr', 'street_number'], 0)\n0\n\n\u003e\u003e\u003e @partial\n... def plus(x):\n...     return x + 2\n\u003e\u003e\u003e [1, 2, 3] | map(plus) | as_list\n[3, 4, 5]\n\n\u003e\u003e\u003e [-1, 1, 2, -2, 3] | filter(lambda x: x \u003e 0) | as_list\n[1, 2, 3]\n\n\u003e\u003e\u003e @partial\n... def sum(x, y):\n...     return x + y\n\u003e\u003e\u003e [1, 2, 3, 4, 5] | reduce(sum)\n15\n\n\u003e\u003e\u003e ['b', 'c'] | reduce(lambda x, y: x+y, 'a')\n'abc'\n\n\u003e\u003e\u003e {'black': '#000', 'gray': '#808080'} | pick(['gray'])\n{'gray': '#808080'}\n\n\u003e\u003e\u003e {'indigo': '#4b0082', 'navy': '#000080'} | omit(['indigo'])\n{'navy': '#000080'}\n\n\u003e\u003e\u003e [5, 4, 5, 6, 7] | filter(equals(5)) | as_list\n[5, 5]\n\n\u003e\u003e\u003e [2, 3, 4, 5, 6, 7, 8] | find(lambda x: x % 2 is 1)\n3\n\n\u003e\u003e\u003e [{'name': 'Jimi'}, {'name': 'James'}] | find_index(prop_eq('name', 'James'))\n1\n\n\u003e\u003e\u003e [0, 3, 5] | find_index(equals(1))\n-1\n\n\u003e\u003e\u003e equals(1, 1)\nTrue\n\n```\n\nContributions\n-------------\n\nEveryone's welcome to contribute it. You might open a pull request at anytime.\n\nLicense\n-------\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsergiors%2Fpyf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsergiors%2Fpyf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsergiors%2Fpyf/lists"}