generated from MasoniteFramework/starter-package
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #495 from circulon/patch/fix_join_on_value
- Loading branch information
Showing
16 changed files
with
290 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
"""Module for miscellaneous helper methods.""" | ||
|
||
import warnings | ||
import re | ||
|
||
|
||
def deprecated(message): | ||
warnings.simplefilter("default", DeprecationWarning) | ||
|
||
def deprecated_decorator(func): | ||
def deprecated_func(*args, **kwargs): | ||
warnings.warn( | ||
"{} is a deprecated function. {}".format(func.__name__, message), | ||
category=DeprecationWarning, | ||
stacklevel=2, | ||
) | ||
return func(*args, **kwargs) | ||
|
||
return deprecated_func | ||
|
||
return deprecated_decorator | ||
|
||
|
||
def database_url(url): | ||
regex = re.compile( | ||
"(?P<schema>.*?)://(?P<user>.*?):(?P<password>.*?)@(?P<host>.*?)/(?P<database>.*)" | ||
) | ||
dic = {} | ||
match = regex.match(url) | ||
user = match.group(2) | ||
host = match.group(4) | ||
hostname = host.split(":")[0] | ||
port = None if ":" not in host else host.split(":")[1] | ||
database = match.group(5) | ||
dic.update( | ||
{ | ||
"user": user, | ||
"password": match.group(3), | ||
"host": hostname, | ||
"port": port, | ||
"database": database, | ||
} | ||
) | ||
|
||
return dic |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.