Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#315 Renamed all .py files to snake_case #993

Merged
merged 1 commit into from
Jul 11, 2019
Merged

#315 Renamed all .py files to snake_case #993

merged 1 commit into from
Jul 11, 2019

Conversation

Alfro
Copy link
Contributor

@Alfro Alfro commented Jul 10, 2019

#491 and #362 seemed to tackle this as well but seemed to currently have conflicts with the main branch

Used a simple python script to turn all names into snake_case (done for clarity, not efficiency)

import os
import re

path = '.'

def snake_it(filename):
    newfilename = filename.replace('-','_')
    newfilename = re.sub(r'([a-z])([A-Z])', r'\1_\2' , newfilename)
    return newfilename.lower()

for root, subdirs, files in os.walk(path):
    for filename in files:
        if filename.endswith('.py'):
            fullpath = root + '/' + filename
            newfullpath = snake_it(fullpath)
            print( fullpath + ' -> ' + newfullpath)
            os.rename(fullpath, newfullpath)

@Alfro
Copy link
Contributor Author

Alfro commented Jul 10, 2019

I broke all __init__.py files 😅
edit: fixed

@cclauss
Copy link
Member

cclauss commented Jul 10, 2019

Maybe you should add https://pypi.org/project/flake8-filename to .travis.yml to enforce this change on all future pull requests.

@cclauss
Copy link
Member

cclauss commented Jul 11, 2019

There are four conflicts... Do you know how to resolve them?

@Alfro
Copy link
Contributor Author

Alfro commented Jul 11, 2019

Done. Wow, faster moves fast, doesn't it? :)

@cclauss
Copy link
Member

cclauss commented Jul 11, 2019

Nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants