Skip to content

#315 Renamed all .py files to snake_case - #993

Merged
cclauss merged 1 commit into
TheAlgorithms:masterfrom
Alfro:master
Jul 11, 2019
Merged

#315 Renamed all .py files to snake_case#993
cclauss merged 1 commit into
TheAlgorithms:masterfrom
Alfro:master

Conversation

@Alfro

@AlfroAlfro commented Jul 10, 2019

Copy link
Copy Markdown
Contributor

#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

Alfro commented Jul 10, 2019

Copy link
Copy Markdown
ContributorAuthor

I broke all __init__.py files 😅
edit: fixed

@cclauss

Copy link
Copy Markdown
Member

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
Copy Markdown
Member

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

@Alfro

Copy link
Copy Markdown
ContributorAuthor

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

@cclauss

Copy link
Copy Markdown
Member

Nice!

@cclauss
cclauss merged commit 5f991f7 into TheAlgorithms:masterJul 11, 2019
stokhos pushed a commit to stokhos/Python that referenced this pull request Jan 3, 2021
Sign up for freeto 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

@Alfro@cclauss