Esempio n. 1
0
def nbconvert():
    """helper function to convert all .ipynb files in the current directory to 
    html files.

    The output html files are in a directory named `html` under the current 
    directory. Existing html files with the same name are overwritten.

    If no directory named `html` is present, it will be created (jupyter nbconvert
    does that automatically)
    """
    # Get the current directory
    #cdir = path.dirname(path.realpath(__file__))
    cdir =  _getcwd()
    # Get a list of .ipynb files
    files2convert = [f for f in _listdir(cdir) if f.endswith('.ipynb')]
    # Convert the files within a try-except block
    count_files_successfully_converted = 0
    failedFiles = []
    for i, f in enumerate(files2convert):
        _getMD5(f)
        print(">>> [{}] Converting file ... ".format(i+1))
        if _convert(f):
            count_files_successfully_converted += 1
        else:
            failedFiles.append(f)

    # Print some human readable feedback
    print("\n")
    print("*******************************************")
    print("                  REPORT                   ")
    print("*******************************************")
    print("\nCurrent Directory: ", cdir)
    print("Number of IPython notebooks found: ", len(files2convert))
    print("Number of files successfully converted to html:",
    count_files_successfully_converted)
    print("Number of files failed to convert to html:", len(failedFiles))
    if failedFiles:
        print("Files that failed to convert:")
        for f in failedFiles:
            print(f)
    print("\nDONE!")
    raw_input("Press ENTER to close the appliation ...")
Esempio n. 2
0
from os import getcwd as _getcwd
from os import getenv as _getenv
from os.path import normpath as _normpath

SUBREDDIT: str = _getenv("SUBREDDIT", "")
WEBHOOK_URL: str = _getenv("WEBHOOK_URL", "")

DB_URI: str = _getenv("DB_URI",
                      "sqlite:///" + (_normpath(_getcwd() + "/app.db")))

FEED_LIMIT: int = int(_getenv("FEED_LIMIT", 100))
REFRESH_TIME: int = int(_getenv("REFRESH_TIME", 60))

POST: bool = _getenv("POST", "true").lower() == "true"
FEED: bool = _getenv("FEED_ONLY", "true").lower() == "true"

DIRTY: int = int(_getenv("DIRTY", "86400"))
Esempio n. 3
0
NAME = 'tosdb'
VERSION = '0.8'
DESCRIPTION = "Python Front-End / Wrapper for TOSDataBridge"
AUTHOR = "Jonathon Ogden"
AUTHOR_EMAIL = "*****@*****.**"
PACKAGES = ['tosdb', 'tosdb/cli_scripts', 'tosdb/intervalize']

_AUTO_EXT = '_tosdb'
# everything should be relative to the python/setup.py
_OUR_PATH = _dirname(_realpath(__file__))
_HEADER_NAME = 'tos_databridge.h'
_HEADER_PATH = _path_join(_OUR_PATH, '..', 'include', _HEADER_NAME)
_OUTPUT_PATH = _path_join(_OUR_PATH, NAME, _AUTO_EXT + '.py')

if _OUR_PATH != _getcwd():
    _sys.stderr.write(
        "fatal: setup.py must be run from its own directory(python/)\n")
    exit(1)

#string that should bookmark the topics in Topic_Enum_Wrapper::TOPICS<T>
_MAGIC_TOPIC_STR = 'ksxaw9834hr84hf;esij?><'

#regex for finding our header #define consts
#TODO: adjust so we can pull non-ints
_REGEX_HEADER_CONST = "#define[\s]+([\w]+)[\s]+.*?(-?[\d][\w]*)"

#adjust for topics we had to permute to form valid enum vars
TOPIC_VAL_REPLACE = {'HIGH52': '52HIGH', 'LOW52': '52LOW'}

#exclude certain header consts
Esempio n. 4
0
NAME = 'tosdb'
VERSION = '0.9'
DESCRIPTION = "Python Front-End / Wrapper for TOSDataBridge"
AUTHOR = "Jonathon Ogden"
AUTHOR_EMAIL = "*****@*****.**"
PACKAGES = ['tosdb','tosdb/cli_scripts','tosdb/intervalize', 'tosdb/streaming']  


_AUTO_EXT = '_tosdb' 
# everything should be relative to the python/setup.py
_OUR_PATH = _dirname(_realpath(__file__))
_HEADER_NAME = 'tos_databridge.h'
_HEADER_PATH = _path_join(_OUR_PATH, '..', 'include', _HEADER_NAME)
_OUTPUT_PATH = _path_join(_OUR_PATH, NAME, _AUTO_EXT + '.py')

if _OUR_PATH != _getcwd():
    _sys.stderr.write("fatal: setup.py must be run from its own directory(python/)\n")
    exit(1)


#string that should bookmark the topics in Topic_Enum_Wrapper::TOPICS<T> 
_MAGIC_TOPIC_STR = 'ksxaw9834hr84hf;esij?><'

#regex for finding our header #define consts 
#TODO: adjust so we can pull non-ints
_REGEX_HEADER_CONST = "#define[\s]+([\w]+)[\s]+.*?(-?[\d][\w]*)"

#adjust for topics we had to permute to form valid enum vars
TOPIC_VAL_REPLACE = {'HIGH52':'52HIGH','LOW52':'52LOW'}

#exclude certain header consts
Esempio n. 5
0
# coding: utf-8
from os import getcwd as _getcwd
file_glob = _getcwd() + '/devel-docs/*/*-decl.txt'
maintainer = 'David Nečas (Yeti) <*****@*****.**>'
syntax_name = 'gwyddion'
url = 'http://trific.ath.cx/Ftp/vim/syntax/gwyddion.vim'
Esempio n. 6
0
# coding: utf-8
from os import getcwd as _getcwd
file_glob = _getcwd() + '/devel-docs/*/*-decl.txt'
maintainer = 'David Nečas (Yeti) <*****@*****.**>'
syntax_name = 'gwyddion'
url = 'http://gwyddion.net/download/test/gwyddion.vim'
Esempio n. 7
0
def remember_cwd():
    curdir = _getcwd()
    try:
        yield
    finally:
        _chdir(curdir)
Esempio n. 8
0
#
#    mdciao is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU Lesser General Public License for more details.
#
#    You should have received a copy of the GNU Lesser General Public License
#    along with mdciao.  If not, see <https://www.gnu.org/licenses/>.
##############################################################################

from os import path as _path, getcwd as _getcwd, chdir as _chdir, link as _link
from mdciao import __path__ as mdc_path
from subprocess import run as _run

mdc_path = _path.split(mdc_path[0])[0]
cwd = _getcwd()

long2short = {
    "--residues": "-r",
    "--n_smooth_hw": "-ns",
    "--table_ext": "-tx",
    "--BW_uniprot": "--BW",
    "--CGN_PDB": "--CGN"
}

long2long = {key: key for key in long2short.keys()}

from mdciao.filenames import filenames

filenames = filenames()