Beispiel #1
0
A productivity tool that binds pandas and plotly.
It also provides tools for color generation and transformation. 

Author: @jorgesantos

"""



import datetools
import utils
import datagen
import tools
import colors
import pandastools
import ta

from plotlytools import *
from plotly.plotly import plot
from utils import pp
from tools import subplots,scatter_matrix,figures
from extract import to_df
from auth import set_config_file,get_config_file
from offline import is_offline,go_offline,go_online
from version import __version__

if get_config_file()['offline']:
	go_offline()
else:
	go_online()
Beispiel #2
0
def set_config_file(
    sharing=None,
    theme=None,
    colorscale=None,
    offline=None,
    offline_url=None,
    offline_show_link=None,
    offline_link_text=None,
    datagen_mode=None,
    **kwargs
):
    """
	Set the keyword-value pairs in `~/.config`.

	sharing : string
			Sets the sharing level permission
				public - anyone can see this chart
				private - only you can see this chart
				secret - only people with the link can see the chart
	theme : string
			Sets the default theme
			See cufflinks.getThemes() for available themes 
	colorscale : string
			Sets the default colorscale
			See cufflinks.scales()
	offline : bool
			If true then the charts are rendered
			locally. 
	offline_show_link : bool
			If true then the chart will show a link to 
			plot.ly at the bottom right of the chart 
	offline_link_text : string
			Text to display as link at the bottom 
			right of the chart 
	datagen_mode : string
			Mode in which the data is generated
			by the datagen module
				stocks : random stock names are used for the index
				abc : alphabet values are used for the index

	"""
    if not _file_permissions:
        raise Exception("You don't have proper file permissions " "to run this function.")
    valid_kwargs = ["world_readable"]
    for key in kwargs.keys():
        if key not in valid_kwargs:
            raise Exception("Invalid keyword : '{0}'".format(key))
    if all(["world_readable" in kwargs, sharing is None]):
        sharing = kwargs["world_readable"]
    if isinstance(sharing, bool):
        if sharing:
            sharing = "public"
        else:
            sharing = "private"
    config = get_config_file()
    if sharing is not None:
        config["sharing"] = sharing
    if theme:
        config["theme"] = theme
    if colorscale:
        config["colorscale"] = colorscale
    if offline is not None:
        config["offline"] = offline
        if offline:
            go_offline()
    if datagen_mode:
        config["datagen_mode"] = datagen_mode
    if offline_url:
        config["offline_url"] = offline_url
    if offline_show_link is not None:
        config["offline_show_link"] = offline_show_link
    if offline_link_text:
        config["offline_link_text"] = offline_link_text
    save_json_dict(CONFIG_FILE, config)
    ensure_local_files()