Did I find the right examples for you? yes no

All Samples(4)  |  Call(0)  |  Derive(0)  |  Import(4)
str(object='') -> string

Return a nice string representation of the object.
If the argument is a string, the return value is the same object.

src/p/r/PrimCom-HEAD/h.py   PrimCom(Download)
def setup_history_and_tab_completion():
    histfile = "{root}/.history".format(root=cfg.ROOT)
    #
    truncate_histfile(histfile)
    #
    Let's convert it to absolute path.
    """
    return "{root}/data/{f}".format(root=cfg.ROOT, f=fname)
 
 
def view_edit_json(key):
    db = get_db_by_key(key)
    os.system("{ed} {f}".format(ed=cfg.EDITOR,
                                f="{root}/data/{db}.json".format(root=cfg.ROOT, db=db)))
 
def add_item():
    os.system("python {root}/add_item.py".format(root=cfg.ROOT))
 
 
def edit_entry(key):
    db = get_db_by_key(key)
    dbfile = "{root}/data/{db}.json".format(root=cfg.ROOT, db=db)

src/p/r/PrimCom-HEAD/add_item.py   PrimCom(Download)
def create_db(db):
    dbfile = "{root}/data/{db}.json".format(root=cfg.ROOT, db=db)
    if not os.path.isfile(dbfile):
        with open(dbfile, "w") as f:
            f.write("{}")    # empty dict.
    else:
        print("Warning! The file {db} already exists.".format(db=dbfile))
    #
    dbdir = "{root}/data/{db}".format(root=cfg.ROOT, db=db)
def get_db():
    li = [e for e in os.listdir("{root}/data".format(root=cfg.ROOT)) if e.endswith(".json") and e != "urls.json"]
    for index, db in enumerate(li, start=1):
        print("[{i}] {db}".format(i=index, db=strip_end(db, ".json")))
    print("[n] new...")
        action_value = raw_input("  filename: ").strip()
        action_value = "{db}/{av}".format(db=db, av=action_value)
        fname = "{root}/data/{db}/{f}".format(root=cfg.ROOT, db=db, f=action_value)
        if os.path.isfile(fname):
            print("Error: the file {fname} already exists.".format(fname=fname))
            sys.exit(1)
        dbfile = "{root}/data/{db}.json".format(root=cfg.ROOT, db=db)

src/v/e/Vealous-HEAD/vealous/service/blog.py   Vealous(Download)
def get_path(condition, name):
    if condition:
        path = os.path.join(config.ROOT, 'tpl','mobile' , name)
        return path
    path = os.path.join(config.ROOT, 'tpl', config.THEME, name)
        keys = dbs.Article.show_keys()[:10]
        rdic['datas'] = dbs.Article.get_data_by_keys(keys)
        path = os.path.join(config.ROOT, 'tpl', 'atom.xml')
        html = render(path, rdic)
        memcache.set('a_atom', html)
        keys = dbs.Article.show_keys()[:10]
        rdic['datas'] = dbs.Article.get_data_by_keys(keys)
        path = os.path.join(config.ROOT, 'tpl', 'rss.xml')
        html = render(path, rdic)
        memcache.set('a_rss', html)
            addurl(art.the_url, art.modified,'weekly',0.5)
        rdic['urlset'] = urlset
        path = os.path.join(config.ROOT, 'tpl', 'sitemap.xml')
        html = render(path, rdic)
        memcache.set('a_sitemap', html)

src/v/e/Vealous-HEAD/vealous/service/utils.py   Vealous(Download)
def get_path(request, name):
    if is_mobile(request):
        path = os.path.join(config.ROOT, 'tpl','mobile' , name)
        return path
    path = os.path.join(config.ROOT, 'tpl', config.THEME, name)

src/s/o/sona_framework-HEAD/server/localhost_server.py   sona_framework(Download)
#!/usr/bin/env python
import sys
from bottle import run, route, Bottle, static_file, debug, redirect
from bottle import request
from config import STATIC_URLS, ROOT
            return redirect(url + 'index.html')
        else:
            return render_dir(url, ROOT)
 
    if is_static_url(url):
        return static_file(url, ROOT)
 
 
    return static_file(url, ROOT)
 
 

src/v/e/Vealous-HEAD/vealous/god/__init__.py   Vealous(Download)
#-*- coding: utf-8 -*-
 
import os
from utils import is_mobile
from config import ROOT
 
def get_path(request , name):
    if is_mobile(request):
        path = os.path.join(ROOT, 'god','mobile' , name)
def get_path(request , name):
    if is_mobile(request):
        path = os.path.join(ROOT, 'god','mobile' , name)
        return path
    path = os.path.join(ROOT, 'god', 'tpl', name)
    return path
 
def get_tpl(name):
    path = os.path.join(ROOT, 'god', 'tpl', name)

src/p/r/PrimCom-HEAD/modules/radio.py   PrimCom(Download)
def read_radio_data():
    """Read the input .csv file."""
    li = []
    dic = {}
    with open("{root}/modules/assets/radio.csv".format(root=cfg.ROOT), 'r') as f:

src/p/r/PrimCom-HEAD/modules/pidcheck.py   PrimCom(Download)
def notify_send(msg):
    logo = "{root}/assets/logo.xpm".format(root=cfg.ROOT)
    main = "PrimCom Alert"
    sub = msg
    cmd = 'notify-send -i {logo} "{main}" "{sub}"'.format(logo=logo,

src/p/r/PrimCom-HEAD/modules/colored_line_numbers.py   PrimCom(Download)
    startup in the background.
    """
    fname = "{root}/assets/alap.py".format(root=cfg.ROOT)
    if fs.which("pygmentize") and os.path.isfile(fname):
        with open(os.devnull, 'w') as devnull:

src/p/r/PrimCom-HEAD/modules/reddit.py   PrimCom(Download)
from __future__ import (absolute_import, division, print_function,
                        unicode_literals)
 
from config import ROOT
from lib.common import my_exit, open_url
 
 
def read_subreddits():
    with open("{root}/modules/assets/reddit.txt".format(root=ROOT)) as f:

  1 | 2  Next