Exemple #1
0
def show_dot(dot_code):
    """Show the graph represented by *dot_code* in a browser.
    Can be called on the result of :func:`get_dot_dependency_graph`.
    """

    from tempfile import mkdtemp
    temp_dir = mkdtemp(prefix="tmp_dagrt_dot")

    dot_file_name = "code.dot"

    from os.path import join
    with open(join(temp_dir, dot_file_name), "w") as dotf:
        dotf.write(dot_code)

    svg_file_name = "code.svg"
    from subprocess import check_call
    check_call(["dot", "-Tsvg", "-o", svg_file_name, dot_file_name],
               cwd=temp_dir)

    full_svg_file_name = join(temp_dir, svg_file_name)
    logger.info("show_dot_dependency_graph: svg written to '%s'" %
                full_svg_file_name)

    from webbrowser import open as browser_open
    browser_open("file://" + full_svg_file_name)
Exemple #2
0
    def __init__(self, result, open_in_browser=False):
        """
        Init env, get template base and context to construct report file.

        Parameters
        ----------
            result: tc_result.TestCasesResult
                result of tests.
            open_in_browser: bool (default: False)
                open or not report in browser.
        """
        result.stream.writeln("Generating html report ...\n")
        env = Environment(
            loader=PackageLoader('testcases_executor.tc_reporter'),
            autoescape=True)  # load template base
        report_template = env.get_template('report_template.html')
        context_report = ContextReport(basename(getcwd()), result)
        with open('./tc_executor_report.html', 'w') as report_file:
            report_file.write(
                report_template.render(  # html report file
                    title=context_report.title,
                    header=context_report.header,
                    groups=context_report.groups))
        result.stream.writeln(
            f"---> {BOLD}{MUTED}tc_executor_report.html{S_RESET}\n")
        if open_in_browser:
            browser_open('./tc_executor_report.html')
Exemple #3
0
def show_dependency_graph(*args, **kwargs):
    """Show the dependency graph generated by :func:`get_dot_dependency_graph`
    in a browser. Accepts the same arguments as that function.
    """

    dot = get_dot_dependency_graph(*args, **kwargs)

    from tempfile import mkdtemp
    temp_dir = mkdtemp(prefix="tmp_loopy_dot")

    dot_file_name = "loopy.dot"

    from os.path import join
    with open(join(temp_dir, dot_file_name), "w") as dotf:
        dotf.write(dot)

    svg_file_name = "loopy.svg"
    from subprocess import check_call
    check_call(["dot", "-Tsvg", "-o", svg_file_name, dot_file_name],
               cwd=temp_dir)

    full_svg_file_name = join(temp_dir, svg_file_name)
    logger.info("show_dot_dependency_graph: svg written to '%s'" %
                full_svg_file_name)

    from webbrowser import open as browser_open
    browser_open("file://" + full_svg_file_name)
Exemple #4
0
def show_dependency_graph(*args, **kwargs):
    """Show the dependency graph generated by :func:`get_dot_dependency_graph`
    in a browser. Accepts the same arguments as that function.
    """

    dot = get_dot_dependency_graph(*args, **kwargs)

    from tempfile import mkdtemp
    temp_dir = mkdtemp(prefix="tmp_loopy_dot")

    dot_file_name = "loopy.dot"

    from os.path import join
    with open(join(temp_dir, dot_file_name), "w") as dotf:
        dotf.write(dot)

    svg_file_name = "loopy.svg"
    from subprocess import check_call
    check_call(["dot", "-Tsvg", "-o", svg_file_name, dot_file_name],
            cwd=temp_dir)

    full_svg_file_name = join(temp_dir, svg_file_name)
    logger.info("show_dot_dependency_graph: svg written to '%s'"
            % full_svg_file_name)

    from webbrowser import open as browser_open
    browser_open("file://" + full_svg_file_name)
Exemple #5
0
def show_dot(dot_code):
    """Show the graph represented by *dot_code* in a browser.
    Can be called on the result of :func:`get_dot_dependency_graph`.
    """

    from tempfile import mkdtemp
    temp_dir = mkdtemp(prefix="tmp_dagrt_dot")

    dot_file_name = "code.dot"

    from os.path import join
    with open(join(temp_dir, dot_file_name), "w") as dotf:
        dotf.write(dot_code)

    svg_file_name = "code.svg"
    from subprocess import check_call
    check_call(["dot", "-Tsvg", "-o", svg_file_name, dot_file_name],
            cwd=temp_dir)

    full_svg_file_name = join(temp_dir, svg_file_name)
    logger.info("show_dot_dependency_graph: svg written to '%s'"
            % full_svg_file_name)

    from webbrowser import open as browser_open
    browser_open("file://" + full_svg_file_name)
Exemple #6
0
    def clip(self, uname, passw, service):
        self.uname = uname
        self.passw = passw
        self.service = service

        print("The User Name or Email is: " + str(self.uname))
        print("""
        Wait for page to load, Type in the username. 
        Password is copied in the clipboard. Just paste within the password box!!!
        """)
        time.sleep(3)
        browser_open(service)
        copy(self.passw)
        time.sleep(1)
        program()
Exemple #7
0
 def load_stream(self, url):
     print('Loading {0} ...\n'.format(url))
     if not self.livestreamer_installed:
         return browser_open(url)
     qualities = StreamData(url)
     names = [q.lower().strip() for q in qualities.keys()]
     if self.best:
         q = 'source' 
     else:
         for i, q in enumerate(names):
             print('[{ind}] {qual}'.format(ind=i+1, qual=q))
         inp = self.get_input('Enter quality> ', 'Try again', len(names))
         q = names[inp]
     print('Using quality "{0}" ...\n'.format(q))
     call([self.livestreamer_path, url, q])
     return True
 def read_normal():
     browser_open(
         "https://www.poradnikzdrowie.pl/diety-i-zywienie/odchudzanie/jaka-jest-zbilansowana-dieta-optymalna-dla-ciebie-aa-cJ56-67oc-F24F.html")
 def read_vegan():
     browser_open("http://veganworkout.org.pl/co-jesc/")
Exemple #10
0
 def entity_open_external_clicked_cb(self, widget, URI):
     browser_open('/'.join(['https://wikidata.org/wiki', URI]))
Exemple #11
0
 def entity_discussion_open_external_clicked_cb(self, widget, URI):
     browser_open(''.join(['https://www.wikidata.org/wiki/Talk:', URI]))
Exemple #12
0
 def entity_history_open_external_clicked_cb(self, widget, URI):
     browser_open(''.join(['https://wikidata.org/w/index.php?action=history&title=', URI]))
from webbrowser import open as browser_open


def get_season():
    se = randrange(1, 12, 1)
    return se


def get_episode(season_num):
    if season_num == 1:
        ep = randrange(1, 17, 1)
    elif 1 < season_num < 4:
        ep = randrange(1, 23, 1)
    else:
        ep = randrange(1, 24, 1)
    return ep


def get_url(season_num, episode_num):
    url = f'https://hd.kinopoisk.ru/film/4c96bc227a377c8aa98da3789416c811?episode={episode_num}&from_block=kp-button-online&season={season_num}&watch='
    return url


if __name__ == '__main__':
    season = get_season()
    episode = get_episode(season)
    browser_open(get_url(season, episode))
    sys_exit()

# pyinstaller --onefile --nowindowed --icon "ico/TBBT.ico" --name "TheBigBangTheory_Randomizer" main.py
Exemple #14
0
#!/usr/bin/python3
import sys
from time import sleep
from webbrowser import open as browser_open
from random import randint as rnd

getchar = sys.stdin.read


def sleep_print(s, t=3):
    word = ""
    for i in s:
        word = word + i
        print(word, "\r", end="")
        sleep(rnd(50 * t, 100 * t) / 1000)
    print()


sleep_print(
    "hello,welcome to hafez fal program,niyyat first and then press enter")
getchar(1)
fal = rnd(1, 495)
pre_link = "http://www.coca.ir/hafez/ghazal-"
all_link = f"{pre_link}{fal}/"
sleep_print("your fal is ready.. opening..")
print(all_link)
browser_open(all_link)
Exemple #15
0

def _get_authentication():
    authentication = linkedin.LinkedInAuthentication(
        CONSUMER_KEY,
        CONSUMER_SECRET,
        RETURN_URL,
        linkedin.PERMISSIONS.enums.values(),
    )
    return authentication


def get_authorization_url():
    authentication = _get_authentication()
    return authentication.authorization_url


def get_access_token(code):
    authentication = _get_authentication()
    authentication.authorization_code = code
    return authentication.get_access_token().access_token


if __name__ == "__main__":
    authorization_url = get_authorization_url()
    print 'Opening {} in your browser...'.format(authorization_url)
    browser_open(authorization_url, new=0, autoraise=True)

    code = input('Enter code (from redirected URL): ')
    print get_access_token(code)