def main():
    amenity_df = get_data()
    plot_amenities(amenity_df)
    plt.show())

    stats=amenity_IQR(amenity_df)
    to_markdown(stats)  # tabulated form of stats table
Example #2
0
def main():
    """Analyzes a single property from a url"""
    url = input("URL: ")
    prp = PropertyAnalyzer(url, verbose=True, num_comps=40)
    prp.get_comps()

    # Print formatted tables of results
    to_markdown(prp.best_amenities())
    to_markdown(prp.NLP())
Example #3
0
def single_picky(slug='test'):
    try:
        f = open(PICKY_DIR + slug + '.md')
    except IOError:
        abort(404)
    picky = f.read()
    f.close()
    meta_regex = re.compile(
            r"^\s*(?:-|=){3,}\s*\n((?:.|\n)+?)\n\s*(?:-|=){3,}\s*\n*",
            re.MULTILINE
        )
    match = re.match(meta_regex, picky)
    if not match:
        abort(404)
    metas = match.group(1)
    title = None
    date = None
    meta = metas.split("\n")
    try:
        title = meta[0].split("=>")[1]
    except IndexError:
        title = meta[0].split("=>")[0]
    try:
        date = meta[1].split("=>")[1]
    except IndexError:
        date = meta[1].split("=>")[0]
    cont = to_unicode(picky[match.end():])
    content = to_markdown(cont)
    return template('picky.html', content=content, title=to_unicode(title),
                                 date=to_unicode(date), slug=slug)
Example #4
0
def post_update_post(id):
    postid = request.forms.get('postid')
    title = request.forms.get('title').decode('utf-8')
    slug = request.forms.get('slug').decode('utf-8')
    post = request.forms.get('post')
    tags = request.forms.get('tags').decode('utf-8')
    category = request.forms.get('category').decode('utf-8')
    post_type = request.forms.get('postype')
    if post_type == 'HTML':
        is_html = 1
        content = post.decode('utf-8')
        markdown = u'html'
    else:
        is_html = 0
        markdown = post.decode('utf-8')
        content = to_markdown(markdown)
    category = Category.get(name=category)
    Post.update(title=title, slug=slug, content=content, markdown=markdown,
                tags=tags, category=category,
                is_html=is_html).where(id=postid).execute()
    tag_list = set(tags.split(","))
    for tag in tag_list:
        try:
            Tag.get(name=tag.strip(), post_id=postid)
        except Post.DoesNotExist:
            Tag.create(name=tag.strip(), post_id=postid)
    redirect("/%s" % slug)
Example #5
0
def post_new_post():
    title = request.forms.get('title').decode('utf-8')
    slug = request.forms.get('slug').decode('utf-8')
    post = request.forms.get('post')
    tags = request.forms.get('tags').decode('utf-8')
    category = request.forms.get('category').decode('utf-8')
    post_type = request.forms.get('postype')
    set_time = request.forms.get('setime')
    if set_time != '1':
        t = [int(tt) for tt in set_time.split('-')]
        d = datetime.datetime(*t)
        published = d
    else:
        published = datetime.datetime.now()

    if post_type == 'HTML':
        is_html = 1
        content = post.decode('utf-8')
        markdown = u'html'
    else:
        is_html = 0
        markdown = post.decode('utf-8')
        content = to_markdown(markdown)
    category = Category.get(name=category)
    post = Post.create(title=title, slug=slug.strip(), content=content,
                       markdown=markdown, tags=tags, category=category,
                       is_html=is_html, published=published, comm_count=0)
    for tag in post.tags_list():
        Tag.create(name=tag.strip(), post_id=post.id)
    redirect("/%s" % slug)