repo_name
stringlengths
6
97
path
stringlengths
3
341
text
stringlengths
8
1.02M
sourcery-ai-bot/personal-expenses-accounting
app/services/recogniser/app/ImageProcessing.py
<reponame>sourcery-ai-bot/personal-expenses-accounting import os from functools import reduce import cv2 import numpy as np from wand.image import Image as WandImage class ImageProcessing: def __init__(self, image): self.image_path = image self.image_name = image.split("/")[-1] self.image ...
sourcery-ai-bot/personal-expenses-accounting
app/services/recogniser/app/tests/base.py
import os import unittest import pytest from project import create_app, db class BaseTestCase(unittest.TestCase): def __init__(self, *args, **kwargs): self.app = create_app() super(BaseTestCase, self).__init__(*args, **kwargs) def create_app(self): self.app.config.from_object("app....
sourcery-ai-bot/personal-expenses-accounting
app/services/tesseract/ModelTraining.py
import json import os from time import sleep import re import subprocess import uuid from subprocess import PIPE, STDOUT, Popen, check_output from typing import Dict from ModelProperties import ModelProperties from OrderedClassMembers import OrderedClassMembers from app.base.ProcessManager import ProcessManager from u...
sourcery-ai-bot/personal-expenses-accounting
app/services/recogniser/app/RecognizeAPI.py
import base64 import datetime import json import os from io import BytesIO from flask import current_app, g, jsonify, request from flask.views import MethodView from PIL import Image from werkzeug.utils import secure_filename from app.Recognizer import Recognizer class RecognizeAPI(MethodView): def allowed_fil...
sourcery-ai-bot/personal-expenses-accounting
app/services/tesseract/utils/tests/test_font.py
<reponame>sourcery-ai-bot/personal-expenses-accounting import unittest from app.utils.font import ( is_lang_supported, convert_to_iso_639_1 ) class TestFont(unittest.TestCase): def test_is_lang_supported(self): self.assertTrue(is_lang_supported('OCR-A', 'eng')) self.assertTrue(is_lang_su...
sourcery-ai-bot/personal-expenses-accounting
app/services/server/app/controller/Dashboard.py
<reponame>sourcery-ai-bot/personal-expenses-accounting from flask import Flask, current_app, jsonify, render_template, request from flask.views import MethodView from flask_login import current_user, login_required class Dashboard(MethodView): @login_required def get(self): return render_template("inde...
sourcery-ai-bot/personal-expenses-accounting
app/services/server/app/controller/UserAPI.py
import json from flask import jsonify from flask.views import MethodView from flasgger import swag_from from app.models.User import User class UserAPI(MethodView): @swag_from('UserAPI.yml') def get(self, id): user = User.query.filter_by(id=id).first() receipts = [] if user: ...
sourcery-ai-bot/personal-expenses-accounting
app/services/server/manage.py
<filename>app/services/server/manage.py import os import sys import unittest import coverage from flask.cli import FlaskGroup from app import create_app, db from app.models import ReceiptData, User COV = coverage.Coverage( branch=True, include="app/*", omit=[ 'app/tests/*', 'services/web_...
sourcery-ai-bot/personal-expenses-accounting
app/services/recogniser/app/Recognizer.py
<reponame>sourcery-ai-bot/personal-expenses-accounting<filename>app/services/recogniser/app/Recognizer.py import json import os import re from typing import List import cv2 import pytesseract import requests from redis import Redis from rq import Queue from app.category.search_category import SearchCategory from app....
sourcery-ai-bot/personal-expenses-accounting
app/services/recogniser/manage.py
<filename>app/services/recogniser/manage.py import os import sys import unittest import coverage from colour_runner.runner import ColourTextTestRunner from flask.cli import FlaskGroup from app import create_app, db from app.RecognizeAPI import RecognizeAPI test_dir = 'services/recogniser/app/tests' COV = coverage.C...
sourcery-ai-bot/personal-expenses-accounting
app/services/server/app/email/send_email.py
<reponame>sourcery-ai-bot/personal-expenses-accounting from flask_mail import Message from flask import render_template from project import create_app from flask_mail import Mail app = create_app('development') mail = Mail(app) def send_email(to, subject, template, **kwargs): msg = Message( subject, ...
sourcery-ai-bot/personal-expenses-accounting
app/services/recogniser/app/ImageHandler.py
import time from watchdog.events import FileSystemEventHandler from watchdog.observers import Observer from Recogniser import recognise_factory class ImageHandler(FileSystemEventHandler): def on_created(self, event): file = str(event.src_path).split("/")[1] if file.endswith('.jpg') and 'output.p...
sourcery-ai-bot/personal-expenses-accounting
app/services/server/app/controller/LogOutAPI.py
from flask import redirect, request, url_for from flask.views import MethodView from flask_login import logout_user class LogOutAPI(MethodView): def get(self): logout_user() return redirect(url_for('authenticate'))
sourcery-ai-bot/personal-expenses-accounting
app/services/server/tests/test_users.py
import json import unittest import requests from project import create_app, db from project.models.User import User from tests.utils import user class TestUsers(unittest.TestCase): """ Test Users service""" def setUp(self): self.app = create_app("testing") self.app_context = self.app.app_co...
InfiniteSynthesis/iacr-eprint-push
send_update.py
<gh_stars>0 import pathlib import json import requests import bs4 import html5lib import smtplib import sys from email.header import Header from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText contentWrapper = '''<div style="background-color:transparent;"><div class="block-grid mixed-two...
tannerbitz/conan-ros2
example-application/conanfile.py
<filename>example-application/conanfile.py # Software License Agreement (BSD License) # # Copyright (c) 2021, iRobot ROS # All rights reserved. # # This file is part of conan-ros2, which is released under BSD-3-Clause. # You may use, distribute and modify this code under the BSD-3-Clause license. # from conans imp...
tannerbitz/conan-ros2
conan/ros2-virtualenvgen/all/conanfile.py
<reponame>tannerbitz/conan-ros2<filename>conan/ros2-virtualenvgen/all/conanfile.py # Software License Agreement (BSD License) # # Copyright (c) 2021, iRobot ROS # All rights reserved. # # This file is part of conan-ros2, which is released under BSD-3-Clause. # You may use, distribute and modify this code under the ...
tannerbitz/conan-ros2
conan/ros2-base/all/conanfile.py
<gh_stars>10-100 # Software License Agreement (BSD License) # # Copyright (c) 2021, iRobot ROS # All rights reserved. # # This file is part of conan-ros2, which is released under BSD-3-Clause. # You may use, distribute and modify this code under the BSD-3-Clause license. # import os import sys from conans import ...
tannerbitz/conan-ros2
conan/ros2-core/all/conanfile.py
<filename>conan/ros2-core/all/conanfile.py # Software License Agreement (BSD License) # # Copyright (c) 2021, iRobot ROS # All rights reserved. # # This file is part of conan-ros2, which is released under BSD-3-Clause. # You may use, distribute and modify this code under the BSD-3-Clause license. # import os impor...
cinnamon-bun/knausj_talon
apps/vscode/vscode.py
<filename>apps/vscode/vscode.py from talon import Context, actions, ui, Module, app, clip from typing import List, Union is_mac = app.platform == "mac" ctx = Context() mod = Module() mod.apps.vscode = """ os: mac and app.bundle: com.microsoft.VSCode """ mod.apps.vscode = """ os: linux and app.name: Code os: linux and...
mattborgard/MAX-Image-Resolution-Enhancer
api/predict.py
<reponame>mattborgard/MAX-Image-Resolution-Enhancer # # Copyright 2018-2019 IBM Corp. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licens...
mattborgard/MAX-Image-Resolution-Enhancer
tests/test.py
# # Copyright 2018-2019 IBM Corp. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
mattborgard/MAX-Image-Resolution-Enhancer
core/model.py
<filename>core/model.py # # Copyright 2018-2019 IBM Corp. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless re...
yangle94/deepin_learning_learn
mnist/ch01/mnist1.py
<filename>mnist/ch01/mnist1.py import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets("../MNIST_data/", one_hot=True) shape = 28 * 28 # 定义输入图片数据的占位符 x = tf.placeholder(tf.float32, [None, shape]) # 定义矩阵 W W = tf.Variable(tf.zeros([shape, 10])) # 定义偏置 b b =...
yangle94/deepin_learning_learn
mnist/ch01/mnistCNN.py
import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets("../MNIST_data/", one_hot=True) x = tf.placeholder(tf.float32, [None, 784]) y_ = tf.placeholder(tf.float32, [None, 10]) x_image = tf.reshape(x, [-1, 28, 28, 1]) def weight_variable(shape): initi...
yangle94/deepin_learning_learn
mnist/ch02/convolutional.py
<filename>mnist/ch02/convolutional.py # coding: utf-8 # 两层卷积网络 import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data # 读入数据 mnist = input_data.read_data_sets("../MNIST_data/", one_hot=True) x = tf.placeholder(tf.float32, [None, 28 * 28]) y_ = tf.placeholder(tf.float32, [None, 10]) # 将7...
daltonmaag/babelfont
lib/babelfont/anchor.py
from fontParts.base.anchor import BaseAnchor from babelfont import addUnderscoreProperty @addUnderscoreProperty("name") @addUnderscoreProperty("glyph") @addUnderscoreProperty("color") @addUnderscoreProperty("x") @addUnderscoreProperty("y") class Anchor(BaseAnchor): def __init__(self, **kwargs): self.x = 0...
daltonmaag/babelfont
tests/test_vfj_loader.py
<gh_stars>10-100 from babelfont import Babelfont def test_load_glyph(): filename = "tests/data/Castoro Roman.vfj" font = Babelfont.open(filename) assert len(font["A"].contours[0]) == 20 assert len(font["A"].contours[1]) == 4
daltonmaag/babelfont
lib/babelfont/lib.py
<reponame>daltonmaag/babelfont<gh_stars>10-100 from fontParts.base.lib import BaseLib class Lib(BaseLib): def __init__(self, **kwargs): self._dict = {} super(BaseLib, self).__init__(self, **kwargs) def _set_glyph(self, glyph): self._dict["glyph"] = glyph def _getItem(self, attr)...
daltonmaag/babelfont
lib/babelfont/variablefont.py
<reponame>daltonmaag/babelfont from babelfont.convertors.glyphs import _load_gsfont from babelfont.convertors.ufo import load as load_ufo from glyphsLib.builder.builders import UFOBuilder from glyphsLib.classes import GSFont from fontTools.designspaceLib import DesignSpaceDocument from fontTools.varLib import models ...
daltonmaag/babelfont
tests/test_glyphs_loader.py
<filename>tests/test_glyphs_loader.py from babelfont.glyph import Glyph from babelfont.layer import Layer from babelfont.font import Font import babelfont.convertors.glyphs as glyphs import glyphsLib def test_gslayer_load(): testfile = glyphsLib.GSFont("tests/data/Test1.glyphs") a = testfile.glyphs[0].layers[...
daltonmaag/babelfont
lib/babelfont/image.py
from fontParts.base.image import BaseImage from babelfont import addUnderscoreProperty @addUnderscoreProperty("data") class Image(BaseImage): def __init__(self, **kwargs): self._dict = {} super(BaseImage, self).__init__(self, **kwargs) def _getAttr(self, attr): if not attr in self._di...
0xGREG/Assembler
assembler/Assembler.py
from enum import Enum from collections import namedtuple import string from assembler.formats._bin import BIN from assembler.formats._elf import ELF class AssemblerException(Exception): pass def setup(initialParameters): processor = Processor(initialParameters) processor.tokenize() if initialParamet...
0xGREG/Assembler
assembler/formats/_bin.py
<reponame>0xGREG/Assembler<gh_stars>0 from assembler.formats._template import fileFormatClass class BIN(fileFormatClass): def __init__(self, parameters): fileFormatClass.__init__(self, parameters) if parameters.verbose: print('selected output file format: BIN') def generateTemplat...
0xGREG/Assembler
assembler/formats/_elf.py
from assembler.formats._template import fileFormatClass class ELF(fileFormatClass): def __init__(self, parameters): fileFormatClass.__init__(self, parameters) if parameters.verbose: print('selected output file format: ELF') def generateTemplate(self): elfHeader = [0x7f, 0x...
0xGREG/Assembler
assembler/formats/_template.py
class fileFormatClass: def __init__(self, parameters): self.parameters = parameters def generateTemplate(self): pass def getOrg(self): return self.org def addFormatData(self, data, startingAddress): return data
0xGREG/Assembler
assembler.py
<filename>assembler.py #!/usr/bin/python3 import sys from assembler import Assembler def displayHelp(): print('Correct usage:\n' + sys.argv[0] + ' [OPTIONS..]\n\n' + 'OPTIONS:\n' + '\t-i fileName specify the input file\n' + '\t-o fileName specify the output file\n' ...
scienceacademy/python_examples
pi.py
import random n = int(input("How many darts: ")) inside = 0 for i in range(n): x = random.random() y = random.random() if x * x + y * y < 1: inside += 1 result = 4 * inside / n print(f"Result: {result}")
scienceacademy/python_examples
files.py
<reponame>scienceacademy/python_examples<gh_stars>0 f = open("data.txt", "w") f.write("goodbye") f.close() with open("data.txt", "r") as f: data = f.read() print(data)
scienceacademy/python_examples
dictionary.py
<reponame>scienceacademy/python_examples grades = [95, 94, 60, 83, 50] names = ["bob", "alice", "eve", "joe", "susan"] grades = {"alice": 94, "bob": 95, "eve": 60, "joe": 83, "susan":50} # look up a grade name = input("Name: ") print(grades[name]) # print all grades for name in grades: print(name, grades[name]) # ...
scienceacademy/python_examples
forloop.py
<filename>forloop.py total = 0 for i in range(1, 11): total += i print(total) word = "hello!" for char in word: if char == "!": print("found an !")
scienceacademy/python_examples
hello.py
<filename>hello.py name = input("What's your name? ") print(f"hello, {name}") age = int( input("How old are you? ") ) print(f"Next year you'll be {age + 1}")
scienceacademy/python_examples
word_count.py
<gh_stars>0 import string wordcount = {} with open("alice.txt", "r") as f: data = f.read() words = data.split() for word in words: word = word.lower() for char in string.punctuation: word = word.replace(char, "") word = word.replace('"', "") if word in wordcount: ...
scienceacademy/python_examples
valid3.py
<filename>valid3.py<gh_stars>0 choice = "" good_choices = ["y", "n", "yes", "no"] while choice not in good_choices: choice = input("Choose yes or no: ").lower() print("Thanks for answering.")
scienceacademy/python_examples
valid2.py
num = 0 while num < 1 or num > 10: try: num = int(input("Pick an integer from 1 to 10: ")) except: print("That's not an integer.") print(f"You picked {num}.")
scienceacademy/python_examples
conditional_examples.py
<reponame>scienceacademy/python_examples<filename>conditional_examples.py print("Enter two numbers") x = int(input("x: ")) y = int(input("y: ")) if x > y: print("x is bigger") elif y > x: print("y is bigger") else: print("they're the same") age = int(input("How old are you? ")) if age > 12 and age < 20: ...
scienceacademy/python_examples
comprehensions.py
<gh_stars>0 # this loop: numbers = [] for i in range(1, 1001): numbers.append(i) # becomes: numbers = [i for i in range(1, 1001)] # examples: evens = [i for i in numbers if i % 2 == 0] sixes = [i for i in numbers if "6" in str(i)] text = "The slick slimy squid slithered through the slick seaweed." words = len([ch...
scienceacademy/python_examples
caesar.py
alpha = "abcdefghijklmnopqrstuvwxyz" shift = int(input("Shift: ")) clear = input("Cleartext: ").lower() cipher = "" for char in clear: n = (alpha.find(char) + shift) % 26 cipher = cipher + alpha[n] print(f"Ciphertext: {cipher}")
scienceacademy/python_examples
tictactoe/ttt6.py
import math # board[row][column] board = [[0, 0, 0], [0, 0, 0], [0, 0, 0]] players = [" ", "X", "O"] def print_board(): print(" 0 1 2") for n, row in enumerate(board): print(f"{n} ", end="") for col in row: print(f"{players[col]} ", end="") print() def i...
scienceacademy/python_examples
rand.py
import random #random.seed(1234) for i in range(10): x = random.randint(1, 6) print(x) colors = ["green", "blue" , "red", "orange", "purple"] print(random.choice(colors))
scienceacademy/python_examples
valid.py
num = 0 while num < 1: try: num = int(input("Pick a positive number: ")) except: print("That's not an integer.") print(f"You picked {num}.")
scienceacademy/python_examples
func.py
def greet(name): print(f"Hello, {name}") greet("Bob") greet("Alice") def triple(n): return n * 3 x = triple(5) print(x)
gcavalcante8808/flask-wiki
flask_wiki/backend/models.py
<gh_stars>0 import uuid import markdown2 from flask_sqlalchemy import SQLAlchemy from sqlalchemy import UniqueConstraint, event from flask_wiki.backend.custom_fields import GUIDField from slugify import slugify db = SQLAlchemy() # TODO: Add Owner and other security fields later. class Page(db.Model): """ Imp...
gcavalcante8808/flask-wiki
flask_wiki/backend/views.py
<gh_stars>0 import markdown2 from flask_restful import Resource, reqparse, fields, marshal_with, marshal,\ abort from flask_wiki.backend.models import Page, db page_fields = { 'guid': fields.String, 'name': fields.String, 'raw_content': fields.String, 'rendered_content': fields.String, 'slug': ...
gcavalcante8808/flask-wiki
flask_wiki/backend/routes.py
from flask_wiki.backend.backend import api from flask_wiki.backend.views import PageView, PageDetail, MDRender api.add_resource(PageView, '/pages-list', endpoint='pages-list') api.add_resource(PageDetail, '/pages/<slug>', endpoint='page-detail') api.add_resource(MDRender, '/md-render', endpoint='md-render')
gcavalcante8808/flask-wiki
flask_wiki/frontend/tests.py
from xvfbwrapper import Xvfb from selenium import webdriver from flask_testing import LiveServerTestCase from flask_wiki.frontend.frontend import app class FrontendTestCase(LiveServerTestCase): """ Test frontend access through firefox webdriver """ def create_app(self): return app def set...
gcavalcante8808/flask-wiki
flask_wiki/backend/custom_fields.py
from sqlalchemy.types import TypeDecorator, CHAR import uuid class GUIDField(TypeDecorator): # Platform independent GUID Implementation that uses little endianess. impl = CHAR def load_dialect_impl(self, dialect): return dialect.type_descriptor(CHAR(32)) def process_bind_param(self, value, d...
gcavalcante8808/flask-wiki
flask_wiki/frontend/__init__.py
__author__ = '01388863189'
gcavalcante8808/flask-wiki
flask_wiki/backend/__init__.py
import flask_wiki.backend.routes
gcavalcante8808/flask-wiki
setup.py
<gh_stars>0 from distutils.core import setup setup( name='flask-wiki', version='0.1', packages=[''], url='https://github.com/gcavalcante8808/flask-wiki', license='BSD', author='gcavalcante8808', author_email='<EMAIL>', description='A Wiki written with Flask FrameWork' )
gcavalcante8808/flask-wiki
flask_wiki/views.py
<reponame>gcavalcante8808/flask-wiki from flask_restful import Resource, Api class HomeView(Resource): def get(self, page_id): return {'page_id': page_id} def post(self, page_id): return {'page_id': page_id}
gcavalcante8808/flask-wiki
flask_wiki/backend/serializers.py
from flask_wiki.backend.backend import marsh from flask_wiki.backend.custom_serialization_fields import GUIDSerializationField from flask_wiki.backend.models import Page from marshmallow import fields # TODO: Change it for ModelSchema. class PageSchema(marsh.Schema): class Meta: model = Page guid = GU...
gcavalcante8808/flask-wiki
flask_wiki/backend/backend.py
import os from flask import Flask from flask_script import Manager from flask_migrate import Migrate, MigrateCommand from flask_restful import Api from flask_marshmallow import Marshmallow from mixer.backend.flask import mixer from flask_wiki.backend.models import db # TODO: Verify URL prefix implementation if debug is...
gcavalcante8808/flask-wiki
flask_wiki/frontend/frontend.py
<reponame>gcavalcante8808/flask-wiki from flask import Flask, render_template, abort, redirect, url_for from flask_script import Manager from jinja2 import TemplateNotFound app = Flask(__name__) app.config['TESTING'] = True manager = Manager(app) @app.route('/', endpoint='frontend-index') def root(): # Redirect ...
gcavalcante8808/flask-wiki
flask_wiki/backend/serialization_fields.py
from marshmallow import fields import uuid class GUIDSerializationField(fields.Field): def _serialize(self, value, attr, obj): if value is None: return value else: if isinstance(value, uuid.UUID): return str(value) else: return No...
gcavalcante8808/flask-wiki
flask_wiki/wiki.py
<filename>flask_wiki/wiki.py from werkzeug.wsgi import DispatcherMiddleware from werkzeug.serving import run_simple from flask_wiki.backend import backend from flask_wiki.frontend import frontend debug = True application = DispatcherMiddleware(frontend.app, {'/api': backend.app}) i...
gcavalcante8808/flask-wiki
flask_wiki/tests.py
<filename>flask_wiki/tests.py #TODO: Create tests for DispatcherMiddleWare.
gcavalcante8808/flask-wiki
flask_wiki/backend/tests.py
import os from flask import url_for from flask_testing import TestCase from flask_wiki.backend.models import Page from flask_wiki.backend.backend import db, mixer, app from flask_wiki.backend.serialization_fields import GUIDSerializationField from slugify import slugify os.environ['CONFIG_MODULE'] = 'config.test' cl...
makinacorpus/ionyweb
ionyweb/plugin_app/plugin_slideshow/templatetags/slideshow_tags.py
<reponame>makinacorpus/ionyweb # -*- coding: utf-8 -*- from django import template from ionyweb.plugin_app.plugin_slideshow.models import FX_VALUES register = template.Library() @register.filter(name='slideshow_fx') def slideshow_fx(value): for code, verbose_name, value_fx in FX_VALUES: if code == value...
makinacorpus/ionyweb
ionyweb/design/views.py
# -*- coding: utf-8 -*- from django.http import HttpResponse from django.template.loader import render_to_string from django.template import RequestContext from django.template.defaultfilters import slugify from django.conf import settings from django.utils.translation import ugettext as _ from ionyweb.loaders.manife...
makinacorpus/ionyweb
ionyweb/plugin_app/plugin_video/viewers/dailymotion.py
# -*- coding: utf-8 -*- from django.utils.safestring import mark_safe from ionyweb.plugin_app.plugin_video.viewers.base import BaseViewer import re class DailymotionViewer(BaseViewer): @staticmethod def is_competent_for_url(url): """ Return true for : - http://www.dailymotion.com/...
makinacorpus/ionyweb
ionyweb/utils.py
# -*- coding: utf-8 -*- from django.contrib.contenttypes.models import ContentType from ionyweb.decorators import singleton from ionyweb.page.models import Page from ionyweb.page.sitemap import PagesSitemap def get_sitemaps(): sitemaps = {'pages': PagesSitemap} for page in Page.objects.all(): app_sit...
makinacorpus/ionyweb
ionyweb/bin/manage.py
<filename>ionyweb/bin/manage.py #!/usr/bin/python # -*- coding: utf-8 -*- import sys import os import argparse from datetime import date import shutil try: from jinja2 import Environment, PackageLoader except: print >> sys.stderr, "Don't forget to install Jinja2\n pip install jinja2" sys.exit(4) from ...
makinacorpus/ionyweb
ionyweb/page/forms.py
<reponame>makinacorpus/ionyweb # -*- coding: utf-8 -*- import floppyforms as forms from django.utils.safestring import mark_safe from django.utils.translation import ugettext as _ from django.contrib.contenttypes.models import ContentType from django.conf import settings from ionyweb.forms import ModuloModelForm fro...
makinacorpus/ionyweb
ionyweb/website/forms.py
# -*- coding: utf-8 -*- from django.conf import settings from django.contrib.sites.models import Site from ionyweb.forms import ModuloModelForm import floppyforms as forms from django.utils.translation import ugettext as _ from models import WebSite # import floppyforms as forms class Website_AnalyticsForm(ModuloMod...
makinacorpus/ionyweb
ionyweb/website/utils.py
# -*- coding: utf-8 -*- from hashlib import sha1 from django.conf import settings def main_menus(request): if not getattr(request, 'page', None): return {} menus = request.website.pages.select_related()\ .filter(is_diplayed_in_menu=True, level__gte=0, lev...
makinacorpus/ionyweb
ionyweb/page_app/page_book/tests.py
<reponame>makinacorpus/ionyweb<filename>ionyweb/page_app/page_book/tests.py<gh_stars>1-10 # -*- coding: utf-8 -*- from django.conf import settings from django.test import TestCase from django.core.urlresolvers import reverse urls_prefix = u'/references/%s' % settings.URL_PAGE_APP_SEP def test_reverse(*args, **kwargs)...
makinacorpus/ionyweb
ionyweb/plugin/settings.py
# -*- coding: utf-8 -*- from django.utils.translation import ugettext as _ PLUGIN = { 'NAME': 'Please configure your PLUGIN_INFO name', 'SHORT_DESCRIPTION': 'Please configure your PLUGIN_INFO short description', 'AUTHOR': _(u"Ionyweb Team"), 'CATEGORY': None, 'VERSION': "1.0", 'WEBSITE': None, ...
makinacorpus/ionyweb
ionyweb/page_app/page_blog/wa_actions_views.py
<filename>ionyweb/page_app/page_blog/wa_actions_views.py # -*- coding: utf-8 -*- from ionyweb.administration.actions.views import ActionAdminDetailView class EntryActionAdminDetailView(ActionAdminDetailView): def get_new_form(self, *args, **kwargs): entry_kwargs = self._get_entry_form_kwargs(*args, **kwarg...
makinacorpus/ionyweb
ionyweb/plugin_app/plugin_fb_likebox/models.py
# -*- coding: utf-8 -*- from django.db import models from django.utils.translation import ugettext as _ from ionyweb.plugin.models import AbstractPlugin class Plugin_FbLikebox(AbstractPlugin): # Define your fields here href = models.URLField(_(u"Facebook profile's url")) width = models.PositiveIntege...
makinacorpus/ionyweb
ionyweb/plugin_app/plugin_video/viewers/__init__.py
<reponame>makinacorpus/ionyweb # -*- coding: utf-8 -*- from ionyweb.plugin_app.plugin_video.viewers.youtube import YoutubeViewer from ionyweb.plugin_app.plugin_video.viewers.dailymotion import DailymotionViewer from ionyweb.plugin_app.plugin_video.viewers.vimeo import VimeoViewer from ionyweb.plugin_app.plugin_video.v...
makinacorpus/ionyweb
ionyweb/plugin_app/plugin_video/__init__.py
<reponame>makinacorpus/ionyweb # -*- coding: utf-8 -*- from django.utils.translation import ugettext as _ PLUGIN_INFO = { 'NAME': _(u"Video player"), 'CATEGORY': 'video', 'VERSION': "1.0", 'SHORT_DESCRIPTION': _(u"Add a vidéo on your page."), 'DESCRIPTION': _(u"You can display a video on your page ...
makinacorpus/ionyweb
ionyweb/plugin_app/plugin_video/tests.py
# -*- coding: utf-8 -*- from django.conf import settings from django.contrib.auth.models import User from django.contrib.sites.models import Site from ionyweb.website.models import WebSite from ionyweb.page.models import Page from ionyweb.page_app.page_text.models import PageApp_Text from django.contrib.contenttypes.m...
makinacorpus/ionyweb
ionyweb/administration/views/file_manager.py
<filename>ionyweb/administration/views/file_manager.py # -*- coding: utf-8 -*- from ionyweb.administration.views import IsSuperAdminView from djangorestframework.response import Response, ErrorResponse from djangorestframework import status from django.conf import settings from django.template.loader import render_to...
makinacorpus/ionyweb
ionyweb/page_app/page_blog/feeds.py
# -*- coding: utf-8 """ Feeds of ``blog`` application. """ from django.utils.translation import ugettext_lazy as _ from django.core.exceptions import ObjectDoesNotExist from django.core.urlresolvers import reverse from django.contrib.syndication.views import Feed from django.contrib.sites.models import Site from iony...
makinacorpus/ionyweb
ionyweb/plugin_app/plugin_map/models.py
<filename>ionyweb/plugin_app/plugin_map/models.py<gh_stars>1-10 # -*- coding: utf-8 -*- from django.db import models from django.utils.translation import ugettext_lazy as _, ugettext from ionyweb.plugin.models import AbstractPlugin class Plugin_Map(AbstractPlugin): address = models.CharField(_(u'address'), max_l...
makinacorpus/ionyweb
ionyweb/plugin_app/plugin_links_list/forms.py
# -*- coding: utf-8 -*- import floppyforms as forms from ionyweb.forms import ModuloModelForm, ModuloForm from django.forms.models import modelformset_factory from models import Plugin_LinksList, Link class Plugin_LinksListForm(ModuloModelForm): class Meta: model = Plugin_LinksList class LinkForm(M...
makinacorpus/ionyweb
ionyweb/administration/tests/website.py
<gh_stars>1-10 # -*- coding: utf-8 -*- from django.conf import settings from django.contrib.sites.models import Site from ionyweb.administration.tests import test_reverse, AdministrationTests from time import time class WebsiteViewTests(AdministrationTests): def test_domains_view(self): url = test_revers...
makinacorpus/ionyweb
ionyweb/__init__.py
# -*- coding: utf-8 -*- import sys import os VERSION = (0, 1, 0, 'beta', 0) VERSION_INFO = '.'.join([str(i) for i in VERSION]).strip('0.') def get_ionyweb_path(): """ Return full patt of ionyweb """ fs_encoding = sys.getfilesystemencoding() or sys.getdefaultencoding() template_dir = os.path.di...
makinacorpus/ionyweb
ionyweb/administration/actions/views.py
# -*- coding: utf-8 -*- from django.conf import settings from django.template import RequestContext from django.core.exceptions import ImproperlyConfigured from django.template.loader import render_to_string from django.utils.translation import ugettext as _ from django.views.generic.list import ListView from django.vi...
makinacorpus/ionyweb
ionyweb/page_app/page_book/admin.py
<reponame>makinacorpus/ionyweb # -*- coding: utf-8 -*- from django.contrib import admin from django.utils.translation import ugettext as _ from models import * from forms import ReferenceForm class ReferenceAdmin(admin.ModelAdmin): list_display = ('title', 'client', 'date', 'description') list_display_links...
makinacorpus/ionyweb
ionyweb/page_app/page_redirect/views.py
<reponame>makinacorpus/ionyweb # -*- coding: utf-8 -*- from django.http import HttpResponseRedirect from django.template import RequestContext from ionyweb.website.rendering.utils import render_view def index_view(request, page_app): if page_app.url != '': return HttpResponseRedirect(page_app.url) else...
makinacorpus/ionyweb
ionyweb/file_manager/functions.py
<reponame>makinacorpus/ionyweb # -*- coding: utf-8 -*- # Python imports import os.path from tempfile import NamedTemporaryFile # Django imports from django.conf import settings from django.core.files.storage import DefaultStorage from django.core.files import File # PIL import try: from PIL import Image except I...
makinacorpus/ionyweb
ionyweb/page_app/page_agenda/tests.py
<filename>ionyweb/page_app/page_agenda/tests.py # -*- coding: utf-8 -*- import datetime from django.conf import settings from django.contrib.auth.models import User from django.contrib.sites.models import Site from ionyweb.website.models import WebSite from ionyweb.page.models import Page from ionyweb.page_app.page_a...
makinacorpus/ionyweb
ionyweb/plugin_app/plugin_text/admin.py
# -*- coding: utf-8 -*- from django.contrib import admin from ionyweb.plugin_app.plugin_text.models import * admin.site.register(Plugin_Text)
makinacorpus/ionyweb
ionyweb/page_app/page_agenda/admin.py
# -*- coding: utf-8 -*- from django.contrib import admin from django.utils.translation import ugettext as _ from models import * admin.site.register(PageApp_Agenda) class EventAdmin(admin.ModelAdmin): list_display = ('title', 'display_description_admin', 'start_date', 'is_published', 'last_modif', 'app') dat...
makinacorpus/ionyweb
ionyweb/page_app/page_book/views.py
# -*- coding: utf-8 -*- from django.conf import settings from ionyweb.website.rendering.medias import JSAdminMedia from ionyweb.website.rendering.utils import render_view RENDER_MEDIAS = ( JSAdminMedia('page_book_actions.js'), ) def index_view(request, page_app): return render_view('page_book/index.html'...
makinacorpus/ionyweb
ionyweb/website/templatetags/placeholder_tags.py
<filename>ionyweb/website/templatetags/placeholder_tags.py<gh_stars>1-10 # -*- coding: utf-8 -*- """Tags used by ionyweb for placeholders rendering""" from django import template from django.conf import settings from django.template.loader import render_to_string register = template.Library() # --------------------...
makinacorpus/ionyweb
ionyweb/administration/templatetags/actions_admin_tags.py
<gh_stars>1-10 # -*- coding: utf-8 -*- from django import template from ionyweb.administration.actions.utils import get_actions_for_object_model register = template.Library() @register.tag(name="actions_admin") def do_actions_admin(parser, token): try: tag_name, obj = token.split_contents() except Va...
makinacorpus/ionyweb
ionyweb/page_app/page_sitemap/models.py
<reponame>makinacorpus/ionyweb<filename>ionyweb/page_app/page_sitemap/models.py # -*- coding: utf-8 -*- from django.db import models from django.utils.translation import ugettext_lazy as _ from ionyweb.page.models import AbstractPageApp class PageApp_Sitemap(AbstractPageApp): def __unicode__(self): r...