Skip to content

Commit

Permalink
Version 6.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ohidurbappy committed Jan 10, 2021
1 parent ca7cf59 commit d9cfb6b
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 5 deletions.
10 changes: 10 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
Changelog
=========
Version 0.0.6
------------
* Fixed configuration format in json
* Added multiline_input() function

Version 0.0.5
------------
* Added headline() function
* Added splash() function

Version 0.0.4
-------------
* Added is_valid_json() function
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,5 @@ mykey=config.get('my_key')
- **random_useragent()** : return a random useragent
- **is_valid_json()** : checks if given string is valid json
- **headline()** : return a formatted string in headline style
- **splash()** : return a string with splash style
- **splash()** : return a string with splash style
- **multiline_input()** : takes multiline user input
2 changes: 1 addition & 1 deletion reusable/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
A python package with reusable functions and utility classes.
"""
__author__="Ohidur Rahman Bappy"
__version__="0.0.5"
__version__="0.0.6"
__license__ = "MIT"
__status__ = "Production"

Expand Down
2 changes: 1 addition & 1 deletion reusable/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def _open_config_file(self):
def save_config_file(self):
"""Saves the config file"""
with open(self.config_file_name, 'w') as outfile:
json.dump(self._config, outfile)
json.dump(self._config, outfile,indent=2)

def get(self, key, default_val=None):
"""Return value stored in config
Expand Down
29 changes: 27 additions & 2 deletions reusable/utility_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
'is_python3',
'is_python_above_or_equal',
'check_modules_installed',
'is_valid_json'
'is_valid_json',
'multiline_input'
]


Expand Down Expand Up @@ -113,4 +114,28 @@ def is_valid_json(json_str:str)->bool:
json.loads(json_str)
except ValueError:
return False
return True
return True


def multiline_input(prompt: any = None) -> str:
r"""Takes multiline user input
Params::
None
Usage::
>>> inp=multiline_input()
>>> print(inp)
"""
lines=[]
if prompt:
print(prompt,end="")
while True:
inp=input()
if inp:
lines.append(inp)
else:
break
return "\n".join(lines)

0 comments on commit d9cfb6b

Please sign in to comment.