Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/daniel-m-campos/code-style-formatter
https://github.com/daniel-m-campos/code-style-formatter
Last synced: about 22 hours ago
JSON representation
- Host: GitHub
- URL: https://github.com/daniel-m-campos/code-style-formatter
- Owner: daniel-m-campos
- License: mit
- Created: 2022-12-22T18:20:56.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2022-12-25T17:18:10.000Z (almost 2 years ago)
- Last Synced: 2023-12-28T04:25:17.306Z (11 months ago)
- Language: Python
- Size: 9.77 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Code Style Formatter
A small tool for converting between snake and camel case naming conventions.## Examples
### Snake to Camel Case
```python
# Snake case source
source = """import functools as ftools
from typing import TupleCONST = 42
@ftools.lru_cache
def my_func(a_var: int, b_var: str = "Hello") -> Tuple:
return [CONST + a_var * i for i in range(2)], b_varif __name__ == "__main__":
result = my_func(1)
print(*result)
"""# Convert using code_style_converter
import code_style_formatter as csf
dest = csf.to_camel(source)
# Print newly converted camel case source
print(dest)
"""import functools as ftools
from typing import TupleCONST = 42
@ftools.lru_cache
def myFunc(aVar: int, bVar: str = "Hello") -> Tuple:
return [CONST + aVar * i for i in range(2)], bVarif __name__ == "__main__":
result = myFunc(1)
print(*result)
"""
```### Camel to Snake Case
```python
# Camel case source
source = """import functools as ftools
from typing import TupleCONST = 42
@ftools.lru_cache
def myFunc(aVar: int, bVar: str = "Hello") -> Tuple:
return [CONST + aVar * i for i in range(2)], bVarif __name__ == "__main__":
result = myFunc(1)
print(*result)"""
# Convert using code_style_converter
import code_style_formatter as csf
dest = csf.to_snake(source)
# Print newly converted snake case source
print(dest)
"""import functools as ftools
from typing import TupleCONST = 42
@ftools.lru_cache
def my_func(a_var: int, b_var: str = "Hello") -> Tuple:
return [CONST + a_var * i for i in range(2)], b_varif __name__ == "__main__":
result = my_func(1)
print(*result)
"""
```