{"id":13771052,"url":"https://github.com/craigds/decrapify","last_synced_at":"2025-06-25T04:32:54.827Z","repository":{"id":139348137,"uuid":"146127144","full_name":"craigds/decrapify","owner":"craigds","description":"Some scripts that use pybowler.io for refactoring Python code","archived":false,"fork":false,"pushed_at":"2021-01-26T08:36:08.000Z","size":39,"stargazers_count":12,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-27T08:48:35.703Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/craigds.png","metadata":{"files":{"readme":"README.md","changelog":null,"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-08-25T20:22:03.000Z","updated_at":"2025-02-04T03:58:42.000Z","dependencies_parsed_at":null,"dependency_job_id":"f2f8cb39-dd09-4f85-bcf3-3f2cd0dbded5","html_url":"https://github.com/craigds/decrapify","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/craigds%2Fdecrapify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/craigds%2Fdecrapify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/craigds%2Fdecrapify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/craigds%2Fdecrapify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/craigds","download_url":"https://codeload.github.com/craigds/decrapify/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248758451,"owners_count":21156957,"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-08-03T17:00:46.990Z","updated_at":"2025-04-13T17:53:07.571Z","avatar_url":"https://github.com/craigds.png","language":"Python","readme":"# decrapify\n\nThis is a set of scripts which refactor your Python code. They're invocations of [Bowler](https://pybowler.io/), which is a Facebook incubator project for refactoring Python code using lib2to3.\n\nThese scripts are just assorted refactoring steps I've found helpful in my day job as a full time Python developer, that I was unable to find elsewhere.\n\nPlease suggest or contribute extra scripts. I will accept any high quality scripts that may be useful, even if they're not useful to *me*. If you have a cool idea, please open an issue.\n\n# fstrings.py {sourcefile.py}\n\nUpgrades source file to use f-strings wherever possible. i.e. converts this\n\n```python\n'%s string literal' % myvar\n```\ninto this:\n\n```python\nf'{myvar} string literal'\n```\n\n# pytestify.py {sourcefile.py}\n\n*Partially* converts your xunit-style tests to pytest ones. Doesn't get you all the way there, but reduces the effort required to manually finish the job.\n\n# :warning: Warning\n\nThis repo exists primarily as a learning exercise in concrete syntax trees. You should exercise care if trying to using these scripts on code that is dear to you.\n\n# Requirements\n\n * Python 3.6+\n * The other stuff in `requirements.txt`\n\n# Future ideas?\n\nSome ideas I had which I haven't implemented yet:\n\n * convert `super(X,  self)` to `super()` (assuming X matches the class def)\n * remove obsolete `__future__` import statements (do any of the existing futurize/modernize tools do this? I couldn't find any)\n * re-format/prettify docstrings in some circumstances. (black doesn't touch the contents of docstrings). Specifically I would probably:\n     - always use \"\"\"triple-double-quotes\"\"\"\n     - always put both start and end quotes on their own line\n     - always match the indenation of the quotes to each other\n     - always use a raw string if the docstring contains a backslash\n     - always indent content to at least the same level as the starting quote marks.\n\n# Install\n\n```bash\ngit clone git@github.com:craigds/decrapify.git\nvirtualenv venv\n. venv/bin/activate\npip install -r requirements.txt\n```\n","funding_links":[],"categories":["UNIX-way formatters"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcraigds%2Fdecrapify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcraigds%2Fdecrapify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcraigds%2Fdecrapify/lists"}