A "Best of the Best Practices" (BOBP) guide to developing in Python.
- "Build tools for others that you want to be built for you." - Kenneth Reitz
- "Simplicity is alway better than functionality." - Pieter Hintjens
| { | |
| // The plugin looks for a .jsbeautifyrc file in the same directory as the | |
| // source file you're prettifying (or any directory above if it doesn't exist, | |
| // or in your home folder if everything else fails) and uses those options | |
| // along the default ones. | |
| // Details: https://github.com/victorporof/Sublime-HTMLPrettify#using-your-own-jsbeautifyrc-options | |
| // Documentation: https://github.com/einars/js-beautify/ | |
| "html": { | |
| "allowed_file_extensions": ["htm", "html", "xhtml", "shtml", "xml", "svg", "dust"], |
| import os | |
| from socket import gethostname | |
| formatters = { | |
| 'GREEN': '\033[92m', | |
| 'RED': '\033[91m', | |
| 'END': '\033[0m', | |
| } | |
| hostname = gethostname() | |
| username = os.environ['USER'] |
| # | |
| # Original solution via StackOverflow: | |
| # http://stackoverflow.com/questions/35802939/install-only-available-packages-using-conda-install-yes-file-requirements-t | |
| # | |
| # | |
| # Install via `conda` directly. | |
| # This will fail to install all | |
| # dependencies. If one fails, | |
| # all dependencies will fail to install. |
| Directive Meaning Notes | |
| %a Locale’s abbreviated weekday name. | |
| %A Locale’s full weekday name. | |
| %b Locale’s abbreviated month name. | |
| %B Locale’s full month name. | |
| %c Locale’s appropriate date and time representation. | |
| %d Day of the month as a decimal number [01,31]. | |
| %H Hour (24-hour clock) as a decimal number [00,23]. | |
| %I Hour (12-hour clock) as a decimal number [01,12]. |
| class _Config_Loader: | |
| """ | |
| Loads the Config file given while instantiating | |
| """ | |
| def __init__(self, config_path): | |
| from utility.exceptions import ImproperlyConfigured | |
| from pathlib import Path | |
| import yaml | |
| __config_path = Path(config_path).resolve() |
| import cProfile | |
| import pstats | |
| from functools import wraps | |
| def profile(func): | |
| """ | |
| Profiles a given function and dumps stats | |
| :return: | |
| """ |