text
stringlengths
0
1.05M
meta
dict
from flask_sqlalchemy import SQLAlchemy from sqlalchemy.exc import SQLAlchemyError from werkzeug.security import generate_password_hash, check_password_hash from app import db class User(db.Model): id = db.Column(db.Integer, primary_key=True) email = db.Column(db.String(250), unique=True, nullable=False) ...
{ "repo_name": "yi-ge/ci", "path": "app/user/model.py", "copies": "1", "size": "1456", "license": "mit", "hash": 4011389911057593000, "line_mean": 27, "line_max": 73, "alpha_frac": 0.6456043956, "autogenerated": false, "ratio": 3.752577319587629, "config_test": false, "has_no_keywords": false,...
from flask_sqlalchemy import SQLAlchemy from sqlalchemy import Column, Integer, Text, create_engine, MetaData, Float, Boolean db = SQLAlchemy() class Game(db.Model): id = Column(Integer, primary_key=True) player_a = Column(Text, unique=False) player_b = Column(Text, unique=False) score_a = Column(Int...
{ "repo_name": "wseaton/pongr", "path": "app/model.py", "copies": "1", "size": "1402", "license": "mit", "hash": 4725297337785736000, "line_mean": 32.4047619048, "line_max": 85, "alpha_frac": 0.6968616262, "autogenerated": false, "ratio": 3.4029126213592233, "config_test": false, "has_no_keywo...
from flask_sqlalchemy import SQLAlchemy from sqlalchemy import create_engine from sqlalchemy import Column, Date, Integer, String, Text, ForeignKey from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import relationship, sessionmaker from sqlalchemy.schema import UniqueConstraint db = SQLAlche...
{ "repo_name": "IamGianluca/todo", "path": "todo/models.py", "copies": "1", "size": "2176", "license": "mit", "hash": -7445693050704676000, "line_mean": 30.0857142857, "line_max": 79, "alpha_frac": 0.6300551471, "autogenerated": false, "ratio": 3.992660550458716, "config_test": false, "has_no_...
from flask_sqlalchemy import SQLAlchemy from sqlalchemy import ForeignKeyConstraint from sqlalchemy_utils import ArrowType from flask_user import UserMixin import string import arrow db = SQLAlchemy() LONGEST_ENGLISH_WORD_LENGTH = 28 MAX_PUNCTUATION_LENGTH = 7 class Novel(db.Model): """ A model consisting o...
{ "repo_name": "thebritican/anovelmous", "path": "anovelmous/models.py", "copies": "1", "size": "6207", "license": "mit", "hash": -6347057754755232000, "line_mean": 34.2727272727, "line_max": 119, "alpha_frac": 0.6690832931, "autogenerated": false, "ratio": 3.5448315248429467, "config_test": fal...
from flask_sqlalchemy import SQLAlchemy from sqlalchemy import ForeignKey, PrimaryKeyConstraint from sqlalchemy.orm import relationship from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() db = SQLAlchemy() association_table = db.Table('association', db.Column('brand', db.Integer, Foreig...
{ "repo_name": "indonoso/small-Inventory", "path": "models.py", "copies": "1", "size": "5475", "license": "mit", "hash": 1026473440235394300, "line_mean": 35.744966443, "line_max": 137, "alpha_frac": 0.6462100457, "autogenerated": false, "ratio": 3.564453125, "config_test": false, "has_no_keyw...
from flask_sqlalchemy import SQLAlchemy from sqlalchemy import func db = SQLAlchemy() class Unit(db.Model): table = db.Column(db. String(), primary_key=True) field = db.Column(db.String(), primary_key=True) unit = db.Column(db.String()) class Simulation(db.Model): timestamp = db.Column(db.DateTime(ti...
{ "repo_name": "Solar-Computing/solar-app2", "path": "app/models.py", "copies": "1", "size": "4267", "license": "mit", "hash": 2716648006979294000, "line_mean": 37.7909090909, "line_max": 100, "alpha_frac": 0.6311225685, "autogenerated": false, "ratio": 3.7627865961199296, "config_test": false, ...
from flask_sqlalchemy import SQLAlchemy from sqlalchemy import or_ db = SQLAlchemy() class CRUDMixin(object): __table_args__ = {'extend_existing': True} id = db.Column(db.Integer, primary_key=True) @classmethod def get_by_id(cls, id): if any((isinstance(id, str) and id.isdigit(), ...
{ "repo_name": "cburmeister/flask-bones", "path": "app/database.py", "copies": "1", "size": "3985", "license": "mit", "hash": 811075892066880800, "line_mean": 32.487394958, "line_max": 90, "alpha_frac": 0.6193224592, "autogenerated": false, "ratio": 3.88401559454191, "config_test": false, "has...
from flask_sqlalchemy import SQLAlchemy from sqlalchemy import Table, Column, Integer, ForeignKey from sqlalchemy.orm import relationship from base import Base from models import link_tables db = SQLAlchemy() class User(Base): __tablename__ = 'user' id = db.Column(db.String(500), unique=True, primary_key=True) ...
{ "repo_name": "blackmad/snippets", "path": "models/user.py", "copies": "1", "size": "2257", "license": "apache-2.0", "hash": 197605832170416670, "line_mean": 31.2571428571, "line_max": 103, "alpha_frac": 0.6942844484, "autogenerated": false, "ratio": 3.45635528330781, "config_test": false, "h...
from flask_sqlalchemy import SQLAlchemy from sqlalchemy import UniqueConstraint from sqlalchemy.ext.hybrid import hybrid_property db = SQLAlchemy() ATMOSPHERES = ( "None", "Trace", "Very thin, Tainted", "Very thin", "Thin, Tainted", "Thin", "Standard", "Standard, Tainted", "Dense", "Dense, Tainted", "Exo...
{ "repo_name": "danjac/traveler-starmap", "path": "server/starmap/models.py", "copies": "1", "size": "11675", "license": "mit", "hash": -1474187769727937500, "line_mean": 26.8639618138, "line_max": 78, "alpha_frac": 0.5759314775, "autogenerated": false, "ratio": 3.331906392694064, "config_test":...
from flask_sqlalchemy import SQLAlchemy from sqlalchemy import UniqueConstraint db = SQLAlchemy() class Budget(db.Model): __table_args__ = (UniqueConstraint('year', 'month'),) id = db.Column(db.Integer, primary_key=True) year = db.Column(db.Integer, nullable=False) month = db.Column(db.Integer, nulla...
{ "repo_name": "BenDoan/NestEgg", "path": "nestegg/database.py", "copies": "1", "size": "1698", "license": "mit", "hash": -7939860353814965000, "line_mean": 35.9130434783, "line_max": 92, "alpha_frac": 0.6778563015, "autogenerated": false, "ratio": 3.222011385199241, "config_test": false, "has...
from flask_sqlalchemy import SQLAlchemy from sqlalchemy.orm import relationship from datetime import datetime, timedelta from werkzeug import generate_password_hash, check_password_hash from petlib.ec import EcPt from petlib.pack import encode, decode from binascii import hexlify, unhexlify db = SQLAlchemy() class U...
{ "repo_name": "moullos/UnlimitID", "path": "UnlimitID/IdP/models.py", "copies": "1", "size": "6417", "license": "bsd-2-clause", "hash": 5490794987363902000, "line_mean": 28.7083333333, "line_max": 77, "alpha_frac": 0.6051114228, "autogenerated": false, "ratio": 3.6584948688711516, "config_test"...
from flask_sqlalchemy import SQLAlchemy from sqlalchemy.sql import text # Create a class that will give us an object that we can use to connect to a database class MySQLConnection(object): def __init__(self, app, db): config = { 'host': 'localhost', 'database': db, # we got d...
{ "repo_name": "jiobert/python", "path": "Smith_Ben/Assignments/email_validation/mysqlconnection.py", "copies": "4", "size": "1932", "license": "mit", "hash": -9047650530224681000, "line_mean": 48.5641025641, "line_max": 133, "alpha_frac": 0.6055900621, "autogenerated": false, "ratio": 4.264900662...
from flask_sqlalchemy import SQLAlchemy from sqlalchemy_utils import EncryptedType from sqlalchemy.types import TypeDecorator, LargeBinary from app import app from werkzeug.security import generate_password_hash, check_password_hash from os import environ import boto3 import botocore import uuid import os import base64...
{ "repo_name": "giubil/trackit", "path": "api/files/api/app/models.py", "copies": "1", "size": "14102", "license": "apache-2.0", "hash": 4952983684454397000, "line_mean": 35.4392764858, "line_max": 132, "alpha_frac": 0.6326762161, "autogenerated": false, "ratio": 3.483695652173913, "config_test"...
from flask_sqlalchemy import sqlalchemy from telegram import ParseMode, KeyboardButton, ReplyKeyboardMarkup from ... import db from ...models import ( Sentence, Paraphrase, SentenceBinary, SentenceSimilairty, TelegramUser ) from .botfsm import BotGraphMachine class LabelingMachine(BotGraphMachine): # Con...
{ "repo_name": "Lee-W/Sentence-Labeling-Bot", "path": "labelingbot/main/labelingfsm/labelingfsm.py", "copies": "1", "size": "6396", "license": "mit", "hash": -98877002242476450, "line_mean": 31.9690721649, "line_max": 81, "alpha_frac": 0.5590994371, "autogenerated": false, "ratio": 3.936, "confi...
from flask_sqlalchemy import SQLAlchemy import datetime db = SQLAlchemy() class User(db.Model): user_id = db.Column(db.Integer, primary_key=True) username = db.Column(db.Unicode(20), unique=True, nullable=False) password = db.Column(db.String(100), nullable=False) score = db.Column(db.Integer) bar...
{ "repo_name": "N4NU/mn-darts", "path": "darts/models.py", "copies": "1", "size": "4384", "license": "mit", "hash": -9069008244114051000, "line_mean": 37.1217391304, "line_max": 89, "alpha_frac": 0.669479927, "autogenerated": false, "ratio": 3.419656786271451, "config_test": false, "has_no_key...
from flask_sqlalchemy import SQLAlchemy import datetime db = SQLAlchemy() def convert_time(time): if not time: return None return time.strftime('%m-%d-%Y %H:%M:%S') class User(db.Model): __tablename__ = 'user' id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(64), nu...
{ "repo_name": "Rastii/BilliardStats", "path": "BilliardStats/models/__init__.py", "copies": "1", "size": "2124", "license": "mit", "hash": -5620598770370215000, "line_mean": 30.2352941176, "line_max": 77, "alpha_frac": 0.5602636535, "autogenerated": false, "ratio": 3.453658536585366, "config_te...
from flask_sqlalchemy import SQLAlchemy import json db = SQLAlchemy() class Interface(db.Model): id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String, unique=True) url = db.Column(db.String) query_string = db.Column(db.String) active = db.Column(db.Boolean, index=True) defa...
{ "repo_name": "IfengAutomation/mockserver", "path": "mockserver/database/database.py", "copies": "1", "size": "1668", "license": "apache-2.0", "hash": 4136280210997501000, "line_mean": 32.36, "line_max": 109, "alpha_frac": 0.574940048, "autogenerated": false, "ratio": 3.8700696055684456, "confi...
from flask_sqlalchemy import SQLAlchemy import os import bcrypt import datetime db = SQLAlchemy() followers = db.Table('followers', db.Column('follower_id', db.Integer, db.ForeignKey('user.id')), db.Column('followed_id', db.Integer, db.ForeignKey('user.id')) ) class User(db.Model): id = db.Column(db.Inte...
{ "repo_name": "ECGHelloWorld/PhoenixNow", "path": "PhoenixNow/model.py", "copies": "1", "size": "5154", "license": "mit", "hash": -7221731565575131000, "line_mean": 34.7916666667, "line_max": 192, "alpha_frac": 0.6121459061, "autogenerated": false, "ratio": 3.4474916387959866, "config_test": fa...
from flask_sqlalchemy import SQLAlchemy import os import hashlib import datetime db = SQLAlchemy() class Product(db.Model): """ Product model: * name * admin_email * admin_token * request_date * state * public """ __tablename__ = "product" id = db.Col...
{ "repo_name": "bzhtux/RaccoonArtifactsManager", "path": "raccoon/models.py", "copies": "1", "size": "2983", "license": "mit", "hash": -406419982574688300, "line_mean": 34.9397590361, "line_max": 160, "alpha_frac": 0.6315789474, "autogenerated": false, "ratio": 3.8243589743589745, "config_test":...
from flask_sqlalchemy import SQLAlchemy import re from models import * import nltk from nltk.corpus import cmudict import curses from curses.ascii import isdigit d = cmudict.dict() def scrubText(text, punctuation): separatedLines = [line.split(punctuation) for line in text] separatedLines = [string for sublist in ...
{ "repo_name": "hollabaq86/haikuna-matata", "path": "seed_database.py", "copies": "1", "size": "3648", "license": "mit", "hash": -6086985957304978000, "line_mean": 36.2244897959, "line_max": 85, "alpha_frac": 0.6296600877, "autogenerated": false, "ratio": 2.9160671462829737, "config_test": false...
from flask_sqlalchemy import SQLAlchemy __database = None SESSION = 'Session' SESSION_SCHEMA = '(sid, logout)' MODEL = 'Model' MODEL_SCHEMA = '(sid, mid, model)' PROBANNO = 'Probanno' PROBANNO_SCHEMA = '(fasta_id, sid, probs_id)' PROBS = 'Probs' PROBS_SCHEMA = '(id, probs, name)' JOB = 'Jobs' JOB_SCHEMA = '(jid, sid...
{ "repo_name": "kingb12/flask_probanno", "path": "data/database.py", "copies": "1", "size": "6163", "license": "mit", "hash": 7984730352298948000, "line_mean": 38.7677419355, "line_max": 125, "alpha_frac": 0.6563361999, "autogenerated": false, "ratio": 3.114199090449722, "config_test": false, ...
from flask_sqlalchemy import SQLAlchemy database = SQLAlchemy() class Blog(database.Model): """ Blog Model class """ __tablename__ = "blog" id = database.Column(database.Integer, primary_key=True) title = database.Column(database.String, unique=True) category = database.Column(database.String) ...
{ "repo_name": "jasonvila/jasonvila.com", "path": "backend/models.py", "copies": "1", "size": "2571", "license": "mit", "hash": 8441391321120136000, "line_mean": 39.8095238095, "line_max": 112, "alpha_frac": 0.6398288604, "autogenerated": false, "ratio": 3.546206896551724, "config_test": false, ...
from flask_sqlalchemy import SQLAlchemy db = SQLAlchemy() followers = db.Table('followers', db.Column('follower_id', db.Integer, db.ForeignKey('user.id')), db.Column('followed_id', db.Integer, db.ForeignKey('user.id')) ) class User(db.Model): """ SavingChristmas Light Node User """ id = db....
{ "repo_name": "bradysalz/SavingChristmas", "path": "webapp/flaskapp/models.py", "copies": "1", "size": "2067", "license": "mit", "hash": 4950174118840802000, "line_mean": 30.3181818182, "line_max": 83, "alpha_frac": 0.5428156749, "autogenerated": false, "ratio": 3.771897810218978, "config_test"...
from flask_sqlalchemy import SQLAlchemy db = SQLAlchemy() class AdminModel(db.Model): __tablename__ = 'admins' id = db.Column(db.Integer, primary_key=True) username = db.Column(db.String(50), unique=True, nullable=False) password = db.Column(db.String(50), nullable=False) sign = db.Column(db.Str...
{ "repo_name": "psychesworld/service_detection", "path": "server/app/repository/sqlalchemy/models.py", "copies": "1", "size": "1406", "license": "mit", "hash": -5352561292494195000, "line_mean": 30.9545454545, "line_max": 80, "alpha_frac": 0.6322901849, "autogenerated": false, "ratio": 3.396135265...
from flask_sqlalchemy import SQLAlchemy db = SQLAlchemy() class Client(db.Model): id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(50)) def __init__(self, name): self.name = name def __repr__(self): return '<Client %r>' % self.name class Area(db.Model): ...
{ "repo_name": "yuriyarhipov/FeatureRequestApp", "path": "models.py", "copies": "1", "size": "1068", "license": "mit", "hash": -9101052582342585000, "line_mean": 25.0487804878, "line_max": 79, "alpha_frac": 0.6235955056, "autogenerated": false, "ratio": 3.3167701863354035, "config_test": false, ...
from flask_sqlalchemy import SQLAlchemy DB = SQLAlchemy() class Team(DB.Model): """Store data for a single Team""" number = DB.Column(DB.Integer, primary_key=True) name = DB.Column(DB.String(200), unique=True) affiliation = DB.Column(DB.String(200), unique=True) round1 = DB.Column(DB.Integer) ...
{ "repo_name": "rtfoley/fllipit", "path": "models.py", "copies": "1", "size": "5025", "license": "mit", "hash": -1765268478907061000, "line_mean": 32.2847682119, "line_max": 130, "alpha_frac": 0.6187064677, "autogenerated": false, "ratio": 3.3080974325213957, "config_test": false, "has_no_keyw...
from flask_sqlalchemy import SQLAlchemy db = SQLAlchemy() class User(db.Model): __tablename__ = 'user' user_id = db.Column(db.Integer, autoincrement=True) username = db.Column(db.Unicode(64), primary_key=True) password = db.Column(db.Unicode(128)) def __init__(self, username, password): ...
{ "repo_name": "vinx13/sjtuface-web", "path": "sjtuface/core/models.py", "copies": "1", "size": "1638", "license": "apache-2.0", "hash": -94257090207079950, "line_mean": 23.447761194, "line_max": 74, "alpha_frac": 0.6306471306, "autogenerated": false, "ratio": 3.664429530201342, "config_test": f...
from flask_sqlalchemy import SQLAlchemy db = SQLAlchemy() class User(db.Model): __tablename__ = 'users' id = db.Column(db.Integer, primary_key=True) first_name = db.Column(db.String(100)) last_name = db.Column(db.String(100)) username = db.Column(db.String(80), unique=True) password = db.Col...
{ "repo_name": "jorgensoares/pimat", "path": "pimat_web/models.py", "copies": "1", "size": "6702", "license": "mit", "hash": 8503924066050719000, "line_mean": 33.5463917526, "line_max": 119, "alpha_frac": 0.6257833483, "autogenerated": false, "ratio": 3.253398058252427, "config_test": false, "...
from flask_sqlalchemy import SQLAlchemy db = SQLAlchemy() class User(db.Model): """用户表 Attributes: ID: 用户ID Name: 用户名字 Password: 用户密码 """ ID = db.Column(db.Integer, primary_key=True) Name = db.Column(db.String(80), unique=True, nullable=False) Password = db.Column(db....
{ "repo_name": "Xuanwo/jade-ims", "path": "jade_ims/models.py", "copies": "1", "size": "4282", "license": "mit", "hash": -179165302146738340, "line_mean": 27.5, "line_max": 83, "alpha_frac": 0.6159317212, "autogenerated": false, "ratio": 3.3609561752988046, "config_test": false, "has_no_keywor...
from flask_sqlalchemy import SQLAlchemy from core.job.models import Job from core.metrics.models import JobMetrics from core.tag.models import JobTag from core.monitoring.models import JobPerformance def __add_perf(db: SQLAlchemy, perf: JobPerformance): db.session.add(perf) db.session.commit() def __add_tag(db: SQ...
{ "repo_name": "srcc-msu/job_statistics", "path": "core/common/controllers.py", "copies": "1", "size": "1357", "license": "mit", "hash": 8439127192443536000, "line_mean": 26.14, "line_max": 106, "alpha_frac": 0.7008106116, "autogenerated": false, "ratio": 2.8095238095238093, "config_test": false...
from flask_sqlalchemy import SQLAlchemy from sqlalchemy.sql import func from sqlalchemy.orm import synonym db = SQLAlchemy() class Redirect(db.Model): __tablename__ = 'redirect' id = db.Column(db.Integer(), primary_key=True) short = db.Column(db.String(255)) _type = db.Column('type', db.SmallInte...
{ "repo_name": "dizpers/usb", "path": "usb/models.py", "copies": "1", "size": "2872", "license": "mit", "hash": 6181215968692766000, "line_mean": 25.1090909091, "line_max": 93, "alpha_frac": 0.6222144847, "autogenerated": false, "ratio": 3.764089121887287, "config_test": false, "has_no_keyword...
from flask_sqlalchemy import SQLAlchemy db = SQLAlchemy() class Feature(db.Model): id = db.Column(db.Integer, primary_key=True) title = db.Column(db.String(80), nullable=False) description = db.Column(db.Text) date = db.Column(db.String(10), nullable=False) priority = db.Column(db.Integer, nulla...
{ "repo_name": "xfilipe/EngineeringMidLevel", "path": "backend/app/models.py", "copies": "1", "size": "2260", "license": "mit", "hash": -7651925118454937000, "line_mean": 24.9770114943, "line_max": 93, "alpha_frac": 0.6137168142, "autogenerated": false, "ratio": 3.616, "config_test": false, "h...
from flask_sqlalchemy import SQLAlchemy WORKFLOW = 'workflow' # Workflow table includes workflow metadata TASK = 'task' # Task table includes task metadata STATUS = 'status' # Status table includes task status RESOURCE = 'resource' # Resource table includes task resource utilization NODE = 'no...
{ "repo_name": "Parsl/parsl", "path": "parsl/monitoring/visualization/models.py", "copies": "1", "size": "4793", "license": "apache-2.0", "hash": 2881753781837161500, "line_mean": 44.2169811321, "line_max": 90, "alpha_frac": 0.6684748592, "autogenerated": false, "ratio": 3.413817663817664, "conf...
from flask_sqlalchemy import SQLAlchemy from videoonline.extensions import bcrypt db = SQLAlchemy() # # 用户-权限 多对多关系声明 # users_roles = db.Table('users_roles', # db.Column('user_id', db.Integer, db.ForeignKey('users.id')), # db.Column('role_id', db.Integer, db.ForeignKey('roles.id'))) # 用户 class Use...
{ "repo_name": "zgoo/OVSS-I", "path": "videoonline/models.py", "copies": "1", "size": "4140", "license": "mit", "hash": -8694783909826138000, "line_mean": 28.9763779528, "line_max": 93, "alpha_frac": 0.5895218718, "autogenerated": false, "ratio": 3.3664383561643834, "config_test": false, "has_...
from flask_sqlalchemy import SQLAlchemy db = SQLAlchemy() class User(db.Model): __tablename__ = 'user' id = db.Column(db.Integer, primary_key=True) from flask_restful import fields MAPPING = { 'integer': fields.Integer } class SerializerMetaclass(type): def __new__(cls, name, b...
{ "repo_name": "by46/geek", "path": "thirdpart/serializer.py", "copies": "1", "size": "1229", "license": "mit", "hash": -3372160279931167000, "line_mean": 24.7173913043, "line_max": 63, "alpha_frac": 0.5736371033, "autogenerated": false, "ratio": 4.152027027027027, "config_test": false, "has_n...
from flask_sqlalchemy import SQLAlchemy db = SQLAlchemy() def safe_serialize(obj): try: return obj.serialized() except Exception as ex: print('unable to serialize {}'.format(obj), ex) raise ex class ProductTypes(db.Model, object): # existing product types __tabl...
{ "repo_name": "parejadan/feature-center", "path": "feature/model/__init__.py", "copies": "1", "size": "3114", "license": "mit", "hash": 6894087294172546000, "line_mean": 35.0714285714, "line_max": 120, "alpha_frac": 0.5989081567, "autogenerated": false, "ratio": 3.8876404494382024, "config_test...
from flask_sqlalchemy import SQLAlchemy, SignallingSession, SessionBase from sqlalchemy import Column, Integer, String, ForeignKey import util class _SignallingSession(SignallingSession): """A subclass of `SignallingSession` that allows for `binds` to be specified in the `options` keyword arguments. """...
{ "repo_name": "Cryptoverse/cryptoverse-service-python", "path": "project/models.py", "copies": "1", "size": "10675", "license": "mit", "hash": 1306018206832451300, "line_mean": 27.1662269129, "line_max": 80, "alpha_frac": 0.5590632319, "autogenerated": false, "ratio": 3.880407124681934, "config...
from flask_sqlalchemy.model import camel_to_snake_case from marshmallow.exceptions import ValidationError from backend.extensions.marshmallow import ma from .constants import READ_ONLY_FIELDS from .utils import to_camel_case class ModelSerializer(ma.ModelSchema): """ Base class for database model serializer...
{ "repo_name": "briancappello/flask-react-spa", "path": "backend/api/model_serializer.py", "copies": "1", "size": "3599", "license": "mit", "hash": 1601081504757186000, "line_mean": 37.6989247312, "line_max": 85, "alpha_frac": 0.6168380106, "autogenerated": false, "ratio": 4.448702101359704, "co...
from flask_sslify import SSLify from flask import ( Flask, abort, redirect, render_template, request, Response, send_from_directory, session, ) from flask.sessions import ( NullSession, SecureCookieSession, ) from model import ( get_all_event_info, get_all_question_info, get_org_info_by_user, ...
{ "repo_name": "davidbstein/moderator", "path": "src/controller.py", "copies": "1", "size": "8230", "license": "mit", "hash": -972771742840059900, "line_mean": 26.9931972789, "line_max": 110, "alpha_frac": 0.6568651276, "autogenerated": false, "ratio": 3.132851161020175, "config_test": false, ...
from flask_superadmin.babel import gettext from flask_superadmin.model import filters from flask_superadmin.contrib.sqlamodel import tools class BaseSQLAFilter(filters.BaseFilter): """ Base SQLAlchemy filter. """ def __init__(self, column, name, options=None, data_type=None): """ ...
{ "repo_name": "syrusakbary/Flask-SuperAdmin", "path": "flask_superadmin/model/backends/sqlalchemy/filters.py", "copies": "3", "size": "3289", "license": "bsd-3-clause", "hash": 4701966199745909000, "line_mean": 26.6386554622, "line_max": 82, "alpha_frac": 0.6533900882, "autogenerated": false, "ra...
from flask_superadmin.model.base import BaseModelAdmin from orm import model_form, AdminModelConverter from django.db import models import operator class ModelAdmin(BaseModelAdmin): @staticmethod def model_detect(model): return issubclass(model, models.Model) def allow_pk(self): return F...
{ "repo_name": "0x1997/Flask-SuperAdmin", "path": "flask_superadmin/model/backends/django/view.py", "copies": "3", "size": "2232", "license": "bsd-3-clause", "hash": -827494746586305700, "line_mean": 27.6153846154, "line_max": 92, "alpha_frac": 0.583781362, "autogenerated": false, "ratio": 3.95044...
from flask_superadmin.model.base import BaseModelAdmin from orm import model_form, AdminModelConverter import operator import mongoengine from bson.objectid import ObjectId SORTABLE_FIELDS = ( mongoengine.BooleanField, mongoengine.DateTimeField, #mongoengine.DecimalField, mongoengine.FloatField, ...
{ "repo_name": "syrusakbary/Flask-SuperAdmin", "path": "flask_superadmin/model/backends/mongoengine/view.py", "copies": "3", "size": "2684", "license": "bsd-3-clause", "hash": 3596496341196824600, "line_mean": 26.6701030928, "line_max": 92, "alpha_frac": 0.6061847988, "autogenerated": false, "rati...
from flask_swagger_ui import get_swaggerui_blueprint from flask import Flask, request, Response import json import os import socket app = Flask(__name__) users = [ { "id": 0, "username": "mrblack", "status": "active", "stars": 3 }, { "id": 1, "username": "mr...
{ "repo_name": "CALlanoR/virtual_environments", "path": "docker/vagrant_environment/examples/docker_examples/python_flask/app.py", "copies": "2", "size": "1983", "license": "apache-2.0", "hash": -3271631673907140000, "line_mean": 22.0581395349, "line_max": 67, "alpha_frac": 0.5698436712, "autogenera...
from flask_table import Col, DateCol, DatetimeCol from .forms import (StringField, DSDateField as DateField, DSDateTimeField as DateTimeField, IntegerField) def str_data_factory(name): return data_types[name.lower()] def data_factory(val=None, sql_type=None): if sql_type.startswith('INTEG...
{ "repo_name": "plumdog/datasheet", "path": "datasheet/data_types.py", "copies": "1", "size": "1219", "license": "mit", "hash": 8146354968973161000, "line_mean": 20.3859649123, "line_max": 67, "alpha_frac": 0.6127973749, "autogenerated": false, "ratio": 3.907051282051282, "config_test": false, ...
from flask_table import Table, Col, ButtonCol from flask import Flask, request """An example for creating LinkCol or ButtonCol with local attributes that can't be initially set when subclassing Table """ app = Flask(__name__) class LocalAttributeLinkTable(Table): name = Col('Name') def __init__(self, l...
{ "repo_name": "plumdog/flask_table", "path": "examples/subclassing3.py", "copies": "1", "size": "1507", "license": "bsd-3-clause", "hash": -8685087117226175000, "line_mean": 28.5490196078, "line_max": 75, "alpha_frac": 0.6297279363, "autogenerated": false, "ratio": 4.029411764705882, "config_te...
from flask_table import Table, Col, LinkCol from flask import Flask, Markup, request, url_for """ A example for creating a Table that is sortable by its header """ app = Flask(__name__) class SortableTable(Table): id = Col('ID') name = Col('Name') description = Col('Description') link = LinkCol( ...
{ "repo_name": "plumdog/flask_table", "path": "examples/sortable.py", "copies": "1", "size": "1872", "license": "bsd-3-clause", "hash": 8637781885176551000, "line_mean": 25.7428571429, "line_max": 73, "alpha_frac": 0.5614316239, "autogenerated": false, "ratio": 3.5121951219512195, "config_test":...
from flask_table import Table, Col, LinkCol from flask import Flask """A example for creating a simple table within a working Flask app. Our table has just two columns, one of which shows the name and is a link to the item's page. The other shows the description. """ app = Flask(__name__) class ItemTable(Table): ...
{ "repo_name": "plumdog/flask_table", "path": "examples/simple_app.py", "copies": "1", "size": "1464", "license": "bsd-3-clause", "hash": 8190221036402720000, "line_mean": 24.2413793103, "line_max": 68, "alpha_frac": 0.6024590164, "autogenerated": false, "ratio": 3.5107913669064748, "config_test...
from flask_table import Table, Col, NestedTableCol """Lets suppose that we have a class that we get an iterable of from somewhere, such as a database. We can declare a table that pulls out the relevant entries, escapes them and displays them. Additionally, we show here how to used a NestedTableCol, by first defining ...
{ "repo_name": "plumdog/flask_table", "path": "examples/simple_nested.py", "copies": "1", "size": "2266", "license": "bsd-3-clause", "hash": 8168986460115100000, "line_mean": 26.975308642, "line_max": 76, "alpha_frac": 0.5255957635, "autogenerated": false, "ratio": 3.2557471264367814, "config_te...
from flask_table import Table, Col import db class Item(object): def __init__(self, show, day, start, end, hosts): self.show = show self.day = day self.start = start self.end = end self.hosts = hosts class ItemTable(Table): classes = ['table', 'table-striped', 'table...
{ "repo_name": "naliuj/WHHB-Twitter-Bot", "path": "make_table.py", "copies": "1", "size": "1136", "license": "mit", "hash": 2803165544665130000, "line_mean": 23.6956521739, "line_max": 111, "alpha_frac": 0.511443662, "autogenerated": false, "ratio": 3.55, "config_test": false, "has_no_keywords...
from flask_table import Table, Col class Item(object): def __init__(self, name, description): self.name = name self.description = description def important(self): """Items are important if their description starts with an a. """ return self.description.lower().starts...
{ "repo_name": "plumdog/flask_table", "path": "examples/rows.py", "copies": "1", "size": "1263", "license": "bsd-3-clause", "hash": -1770010152657912600, "line_mean": 18.1363636364, "line_max": 69, "alpha_frac": 0.478226445, "autogenerated": false, "ratio": 3.8042168674698793, "config_test": fal...
from flask_table import Table, Col """If we want to put an HTML class onto the table element, we can set the "classes" attribute on the table class. This should be an iterable of that are joined together and all added as classes. If none are set, then no class is added to the table element. """ class Item(object):...
{ "repo_name": "plumdog/flask_table", "path": "examples/classes.py", "copies": "1", "size": "1756", "license": "bsd-3-clause", "hash": -2429938969862243300, "line_mean": 17.4842105263, "line_max": 70, "alpha_frac": 0.5410022779, "autogenerated": false, "ratio": 3.6813417190775684, "config_test":...
from flask_table import Table, Col """Lets suppose that we have a class that we get an iterable of from somewhere, such as a database. We can declare a table that pulls out the relevant entries, escapes them and displays them. """ class Item(object): def __init__(self, name, description): self.name = n...
{ "repo_name": "plumdog/flask_table", "path": "examples/simple.py", "copies": "1", "size": "1220", "license": "bsd-3-clause", "hash": -3744598421645183500, "line_mean": 19, "line_max": 68, "alpha_frac": 0.5229508197, "autogenerated": false, "ratio": 3.674698795180723, "config_test": false, "ha...
from flask_table import Table, Col """What if we need to apply some classes (or any other attribute) to the td and th HTML attributes? Maybe you want this so you can apply some styling or attach some javascript. NB: This example just handles the adding of some fixed attributes to a column. If you want to do somethin...
{ "repo_name": "plumdog/flask_table", "path": "examples/column_html_attrs.py", "copies": "1", "size": "2631", "license": "bsd-3-clause", "hash": 6963038686076391000, "line_mean": 26.40625, "line_max": 73, "alpha_frac": 0.5610034208, "autogenerated": false, "ratio": 3.8920118343195265, "config_te...
#from flask.templating import render_template # Also installed redis from app import app from flask import Flask, request, url_for, Response, redirect from extended_client import extended_client import json from jinja2 import Environment, PackageLoader import logging from time import sleep #To access JMX Rest api impo...
{ "repo_name": "johankaito/fufuka", "path": "microblog/app/views.py", "copies": "1", "size": "10442", "license": "apache-2.0", "hash": 6714577300560026000, "line_mean": 26.4789473684, "line_max": 197, "alpha_frac": 0.6918214901, "autogenerated": false, "ratio": 2.99112002291607, "config_test": f...
from flask.templating import render_template, render_template_string import logging from waitlist import permissions from typing import List, Optional, Dict, Union, Any from flask_babel import lazy_gettext from flask_login.utils import current_user logger = logging.getLogger(__name__) class OrderedItem(object): ...
{ "repo_name": "SpeedProg/eve-inc-waitlist", "path": "waitlist/utility/mainmenu/models.py", "copies": "1", "size": "8725", "license": "mit", "hash": 627590641104654100, "line_mean": 34.7581967213, "line_max": 97, "alpha_frac": 0.5761604585, "autogenerated": false, "ratio": 4.225181598062954, "co...
from flask.testing import FlaskClient from flask.json import _json as json from .json_encoder import json_encoder from toolspy import merge class FlaskClientBooster(FlaskClient): def jread(self, resp): return json.loads(resp.data) def jpost(self, url, data, **kwargs): kwargs['content_type']...
{ "repo_name": "inkmonk/flask-sqlalchemy-booster", "path": "flask_sqlalchemy_booster/flask_client_booster.py", "copies": "1", "size": "1776", "license": "mit", "hash": 2090198243539587000, "line_mean": 38.4666666667, "line_max": 75, "alpha_frac": 0.6368243243, "autogenerated": false, "ratio": 3.61...
from flask.testing import FlaskClient import json import os.path import sys from blueprint.io.server import app SECRET = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_-' NAME = 'test' SHA = 'adff242fbc01ba3753abf8c3f9b45eeedec23ec6' filename = '{0}.tar'.format(SHA) pathname = os.path.join(os.path.d...
{ "repo_name": "volcomism/blueprint", "path": "tests.py", "copies": "4", "size": "5429", "license": "bsd-2-clause", "hash": 4013004884934430700, "line_mean": 34.9536423841, "line_max": 79, "alpha_frac": 0.5750598637, "autogenerated": false, "ratio": 3.648521505376344, "config_test": true, "has...
from flask_testing import TestCase from base64 import b64encode from app import db, init_app class BaseTest(TestCase): headers = {'Content-Type': 'application/json'} # We need an app obj on the class to use our setUpClass # and tearDownClass methods. _app = init_app(testing=True) @classmethod ...
{ "repo_name": "chamilto/flask_starter_pack", "path": "tests/common.py", "copies": "1", "size": "1517", "license": "mit", "hash": -7599912564045956000, "line_mean": 27.6226415094, "line_max": 77, "alpha_frac": 0.5827290705, "autogenerated": false, "ratio": 4.285310734463277, "config_test": false...
from flask_testing import TestCase from flask_sqlalchemy import SQLAlchemy from ..encoder import JSONEncoder import connexion import logging import unittest from unittest.mock import MagicMock from unittest import mock from ..models.inbound import Inbound from ..models.outbound import Outbound from ..services.messaging...
{ "repo_name": "gengstrand/clojure-news-feed", "path": "server/feed5/swagger_server/test/__init__.py", "copies": "1", "size": "2165", "license": "epl-1.0", "hash": 4084764135777390000, "line_mean": 30.8382352941, "line_max": 77, "alpha_frac": 0.7362586605, "autogenerated": false, "ratio": 3.480707...
from flask_testing import TestCase from flask_testing import LiveServerTestCase import logging from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.co...
{ "repo_name": "CSC-IT-Center-for-Science/pouta-blueprints", "path": "pebbles/tests/base.py", "copies": "1", "size": "4069", "license": "mit", "hash": 460005902906559900, "line_mean": 34.0775862069, "line_max": 78, "alpha_frac": 0.6193167855, "autogenerated": false, "ratio": 4.22533748701973, "c...
from flask_testing import TestCase from past.builtins import basestring import unittest from solr import app class TestWebservices(TestCase): def create_app(self): """Start the wsgi application""" return app.create_app() def test_ResourcesRoute(self): """Tests for the existence of a ...
{ "repo_name": "adsabs/solr-service", "path": "solr/tests/unittests/test_webservices.py", "copies": "1", "size": "1402", "license": "mit", "hash": 8951504303757672000, "line_mean": 31.6046511628, "line_max": 86, "alpha_frac": 0.6141226819, "autogenerated": false, "ratio": 4.300613496932515, "con...
from flask_testing import TestCase import testing.postgresql from graphics_service.models import Base class TestCaseDatabase(TestCase): """ Base test class for when databases are being used. """ postgresql_url_dict = { 'port': 1234, 'host': '127.0.0.1', 'user': 'postgres', ...
{ "repo_name": "adsabs/graphics_service", "path": "graphics_service/tests/base.py", "copies": "1", "size": "1386", "license": "mit", "hash": 7907415536368181000, "line_mean": 26.72, "line_max": 69, "alpha_frac": 0.588023088, "autogenerated": false, "ratio": 3.9263456090651556, "config_test": tru...
from flask_testing import TestCase from fortunate.utils import make_app class ViewsMixin(object): fortunes = list('abcdefg') def set_fortune(self, *args, **kwargs): payload = kwargs response = self.client.post('/fortune/', data=payload) return response def test_to...
{ "repo_name": "kryptn/Fortunate", "path": "fortunate/fortunate/tests/test_views.py", "copies": "1", "size": "3662", "license": "mit", "hash": -8710367872418518000, "line_mean": 33.2242990654, "line_max": 92, "alpha_frac": 0.6234298198, "autogenerated": false, "ratio": 3.5657254138266796, "confi...
from flask import render_template, jsonify, url_for, session, request, flash, redirect, abort from app import * from app.models import * from app.apputils import * from app.funcutils import * from sqlalchemy import desc from sqlalchemy.exc import IntegrityError from datetime import datetime import json ...
{ "repo_name": "zjurelinac/NotesApp", "path": "app/controllers.py", "copies": "1", "size": "12395", "license": "mit", "hash": -4346211192315281400, "line_mean": 21.2132616487, "line_max": 100, "alpha_frac": 0.5965308592, "autogenerated": false, "ratio": 3.0432113920942796, "config_test": false, ...
from flask_ui import db # Many to many relationship user_group_relationship = db.Table( 'User-Group-Relationship', db.Column('user_id', db.Integer, db.ForeignKey('User.id')), db.Column('group_id', db.Integer, db.ForeignKey('Group.id')) ) class Group(db.Model): __tablename__ = 'Groups' id = db.Co...
{ "repo_name": "matcom/autoexam", "path": "flask_ui/models/__init__.py", "copies": "1", "size": "1254", "license": "mit", "hash": -2831330644820082000, "line_mean": 25.6808510638, "line_max": 88, "alpha_frac": 0.6531100478, "autogenerated": false, "ratio": 3.0886699507389164, "config_test": fals...
from flaskup import app @app.template_filter() def dateformat(value, format='%H:%M / %d-%m-%Y'): return value.strftime(format) @app.template_filter() def filesizeformat(value, binary=False): """Format the value like a 'human-readable' file size (i.e. 13 kB, 4.1 MB, 102 Bytes, etc). Per default decimal ...
{ "repo_name": "nthien/flaskup", "path": "flaskup/filters.py", "copies": "2", "size": "1181", "license": "bsd-3-clause", "hash": -6946593856340548000, "line_mean": 30.9189189189, "line_max": 74, "alpha_frac": 0.5461473328, "autogenerated": false, "ratio": 3.3456090651558075, "config_test": false...
from flask_user import DBAdapter class DataStoreAdapter(DBAdapter): """ An Wrapper to be use by Flask User to interact with the database in this case, the DataStore """ def __init__(self, db, objMOdel): super().__init__(db, objMOdel) def get_object(self, ObjectClass, pk): """ Ret...
{ "repo_name": "oldani/nanodegree-blog", "path": "app/models/datastore_adapter.py", "copies": "1", "size": "2094", "license": "mit", "hash": 8257204964340828000, "line_mean": 33.9, "line_max": 72, "alpha_frac": 0.6107927412, "autogenerated": false, "ratio": 4.408421052631579, "config_test": fals...
from flask_user import UserMixin from app import db #First make the user class User(db.Model, UserMixin): __tablename__ = 'users' id = db.Column(db.Integer, primary_key=True) #User authentication info for Flask-User email = db.Column(db.Unicode(255), nullable=False, server_default=u'', unique=True) ...
{ "repo_name": "noxora/flask-base", "path": "app/models.py", "copies": "1", "size": "1407", "license": "mit", "hash": -4640348829528608000, "line_mean": 41.6363636364, "line_max": 87, "alpha_frac": 0.6666666667, "autogenerated": false, "ratio": 3.4400977995110025, "config_test": false, "has_no...
from flask_user import UserMixin from app import db # Define the User data model. Make sure to add the flask_user.UserMixin !! class User(db.Model, UserMixin): __tablename__ = 'users' id = db.Column(db.Integer, primary_key=True) # User authentication information (required for Flask-User) email = db.C...
{ "repo_name": "UCL-CS35/incdb-poc", "path": "app/models/users.py", "copies": "1", "size": "1952", "license": "bsd-2-clause", "hash": 472539763919770240, "line_mean": 45.5, "line_max": 109, "alpha_frac": 0.6921106557, "autogenerated": false, "ratio": 3.473309608540925, "config_test": false, "h...
from flask_user import UserMixin from flask.ext.login import current_user from app import db from common import models from common.awis import AWISContextManager class User(db.Model, UserMixin, models.BaseModelMixin): __tablename__ = 'users' email = db.Column(db.Unicode(255), nullable=False, unique=True) ...
{ "repo_name": "uploadcare/intercom-rank", "path": "app/accounts/models.py", "copies": "1", "size": "2891", "license": "mit", "hash": -7924136528719425000, "line_mean": 32.6162790698, "line_max": 77, "alpha_frac": 0.6502940159, "autogenerated": false, "ratio": 3.7545454545454544, "config_test": ...
from flask_user import UserMixin from flask_user.forms import RegisterForm from flask_wtf import Form from wtforms import StringField, SubmitField, validators from app import db, app import flask.ext.whooshalchemy as whooshalchemy # Define the User data model. Make sure to add the flask_user.UserMixin !! class User(d...
{ "repo_name": "teirce/thesis", "path": "app/core/models.py", "copies": "2", "size": "3622", "license": "bsd-2-clause", "hash": -397114262373287600, "line_mean": 34.8613861386, "line_max": 109, "alpha_frac": 0.6775262286, "autogenerated": false, "ratio": 3.561455260570305, "config_test": false, ...
from flask_user import UserMixin from flask_user.forms import RegisterForm from flask_wtf import Form from wtforms import StringField, SubmitField, validators from app import db # Define the User data model. Make sure to add the flask_user.UserMixin !! class User(db.Model, UserMixin): __tablename__ = 'users' ...
{ "repo_name": "UCL-CS35/incdb-user", "path": "app/core/models.py", "copies": "1", "size": "2829", "license": "bsd-2-clause", "hash": -7764734518696550000, "line_mean": 41.8636363636, "line_max": 109, "alpha_frac": 0.6970661011, "autogenerated": false, "ratio": 3.792225201072386, "config_test": ...
from flask_user import UserMixin from sqlalchemy import ForeignKey, Enum from sqlalchemy.orm import relationship from sqlalchemy.dialects import postgresql from nosferatu import db class Node(db.Model): __tablename__ = 'nodes' id = db.Column(db.Integer, primary_key=True) mac_addr = db.Column(postgresql....
{ "repo_name": "DanCardin/nosferatu", "path": "nosferatu/models.py", "copies": "1", "size": "2918", "license": "apache-2.0", "hash": 1356359418539507200, "line_mean": 29.7157894737, "line_max": 87, "alpha_frac": 0.6315969842, "autogenerated": false, "ratio": 3.4208675263774913, "config_test": fa...
from flask_user import UserMixin from debut.database import db class User(db.Model, UserMixin): id = db.Column(db.Integer, primary_key=True) # User email information (required for Flask-User). email = db.Column(db.String(255), nullable=False, unique=True) ...
{ "repo_name": "whiskyechobravo/flask-debut", "path": "debut/user/models.py", "copies": "1", "size": "2382", "license": "bsd-3-clause", "hash": -9097849755255260000, "line_mean": 33.5217391304, "line_max": 72, "alpha_frac": 0.5201511335, "autogenerated": false, "ratio": 4.323049001814882, "confi...
from flask_user import UserMixin from hortiradar.website import db class User(db.Model, UserMixin): id = db.Column(db.Integer, primary_key=True) # User authentication information username = db.Column(db.String(50), nullable=False, unique=True) password = db.Column(db.String(255), nullable=False, ser...
{ "repo_name": "mctenthij/hortiradar", "path": "hortiradar/website/models.py", "copies": "1", "size": "1248", "license": "apache-2.0", "hash": 8262245198871652000, "line_mean": 35.7058823529, "line_max": 85, "alpha_frac": 0.6746794872, "autogenerated": false, "ratio": 3.466666666666667, "config_...
from flask.views import MethodView, MethodViewType from flask import jsonify, current_app, request import json import six import sqlalchemy import sys import calendar import datetime import traceback class LeverException(Exception): """ Lever handles many common errors that occur in the API and raises this e...
{ "repo_name": "Crowdlink/lever", "path": "lever/base.py", "copies": "1", "size": "25513", "license": "bsd-2-clause", "hash": 3993654280600706000, "line_mean": 36.0290275762, "line_max": 99, "alpha_frac": 0.5627719202, "autogenerated": false, "ratio": 4.287178625441102, "config_test": false, "...
from flask.views import MethodView from flask_helpers.build_response import build_response from python_cowbull_server import app, error_handler class HealthCheck(MethodView): def get(self): self.persistence_engine = app.config.get("PERSISTER", None) if not self.persistence_engine: rais...
{ "repo_name": "dsandersAzure/python_cowbull_server", "path": "flask_controllers/HealthCheck.py", "copies": "1", "size": "1230", "license": "apache-2.0", "hash": -4680884002883593000, "line_mean": 33.1666666667, "line_max": 95, "alpha_frac": 0.556097561, "autogenerated": false, "ratio": 4.53874538...
from flask.views import MethodView from flask import flash from flask import request, render_template, session from cifsdk.client.zeromq import ZMQ as Client from cif.constants import ROUTER_ADDR import json import logging import csv from csirtg_indicator import Indicator from csirtg_indicator.constants import COLUMNS ...
{ "repo_name": "csirtgadgets/bearded-avenger", "path": "cif/httpd/views/u/indicators.py", "copies": "1", "size": "2871", "license": "mpl-2.0", "hash": -5819396109485839000, "line_mean": 31.2584269663, "line_max": 77, "alpha_frac": 0.5935214211, "autogenerated": false, "ratio": 3.900815217391304, ...
from flask.views import MethodView from flask import jsonify, request, make_response import re from . import authenticate_blueprint from app.models import User EMAIL_REGEX = re.compile(r"(^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$)") class SignUpView(MethodView): """Models signing up as a new user.""" ...
{ "repo_name": "Alweezy/cp2-bucketlist-api", "path": "app/auth/views.py", "copies": "1", "size": "4440", "license": "mit", "hash": -7916198619213592000, "line_mean": 33.4186046512, "line_max": 85, "alpha_frac": 0.4849099099, "autogenerated": false, "ratio": 5.150812064965197, "config_test": fals...
from flask.views import MethodView from flask import jsonify, request from helpers.auth import check_token class GenericControler(MethodView): def get(self): try: args = request.args.get('id').replace('[', '').replace(']', '') except: args = '' user_id = check_toke...
{ "repo_name": "rapkin/data-vis", "path": "subapps/api/controller/generic.py", "copies": "1", "size": "1147", "license": "mit", "hash": 1743033314380179200, "line_mean": 25.0681818182, "line_max": 75, "alpha_frac": 0.5501307759, "autogenerated": false, "ratio": 3.8361204013377925, "config_test":...
from flask.views import MethodView from flask import jsonify, request from serializers.device import DeviceSerializer, DevicesSerializer from models import Device, db class DeviceView(MethodView): def patch(self, device_id): d = Device.query.get(device_id) json = request.json if 'name' in...
{ "repo_name": "belljustin/whoshome", "path": "views/device.py", "copies": "1", "size": "1054", "license": "mit", "hash": 1781722528900729300, "line_mean": 27.4864864865, "line_max": 66, "alpha_frac": 0.6214421252, "autogenerated": false, "ratio": 3.88929889298893, "config_test": false, "has_n...
from flask.views import MethodView from flask import redirect from flask import request, render_template, session, url_for, flash from cifsdk.client.zeromq import ZMQ as Client from cif.constants import ROUTER_ADDR import logging import os import json remote = ROUTER_ADDR HTTPD_TOKEN = os.getenv('CIF_HTTPD_TOKEN') lo...
{ "repo_name": "csirtgadgets/bearded-avenger", "path": "cif/httpd/views/u/tokens.py", "copies": "1", "size": "4452", "license": "mpl-2.0", "hash": -7284131075667755000, "line_mean": 25.8192771084, "line_max": 75, "alpha_frac": 0.5231356694, "autogenerated": false, "ratio": 4.215909090909091, "co...
from flask.views import MethodView from flask import render_template, flash, abort, redirect, request from relier.models import Organization, User, database import bcrypt class RegisterView(MethodView): def get(self): print 'Get hit' return render_template('register.j2') @staticmethod def...
{ "repo_name": "citruspi/relier-api", "path": "relier/web/views/register.py", "copies": "1", "size": "2298", "license": "unlicense", "hash": 8470569874401828000, "line_mean": 27.0365853659, "line_max": 166, "alpha_frac": 0.5678851175, "autogenerated": false, "ratio": 4.75776397515528, "config_te...
from flask.views import MethodView from flask import render_template from models.appointment import Appointment from forms.new_appointment import NewAppointmentForm from flask import request, redirect, url_for import reminders import arrow class AppointmentResourceDelete(MethodView): def post(self, id): ...
{ "repo_name": "TwilioDevEd/appointment-reminders-flask", "path": "views/appointment.py", "copies": "1", "size": "1858", "license": "mit", "hash": 4953845910444270000, "line_mean": 29.9666666667, "line_max": 77, "alpha_frac": 0.642088267, "autogenerated": false, "ratio": 3.919831223628692, "conf...
from flask.views import MethodView from flask import render_template, request, flash, redirect, session, abort from relier.models import User, Invitation class InvitationView(MethodView): def get(self, token): if Invitation.select().where(Invitation.token == token).count() == 0: abort(404) ...
{ "repo_name": "citruspi/relier-api", "path": "relier/web/views/invitation.py", "copies": "1", "size": "1352", "license": "unlicense", "hash": -3439878924506811400, "line_mean": 30.4418604651, "line_max": 84, "alpha_frac": 0.5791420118, "autogenerated": false, "ratio": 4.319488817891374, "config...
from flask.views import MethodView from flask import request from config.service_locator import service_locator import json def index(): return 'index' class Events(MethodView): def post(self): payload = request.json #at the very least, events should have; action, user, item. errors = [] if 'action' not...
{ "repo_name": "farouqzaib/Personify", "path": "app/controllers.py", "copies": "1", "size": "1024", "license": "mit", "hash": -1194794482610253600, "line_mean": 23.9756097561, "line_max": 75, "alpha_frac": 0.6904296875, "autogenerated": false, "ratio": 3.4829931972789114, "config_test": false, ...
from flask.views import MethodView from flask import request, render_template, session, redirect, flash from cif.constants import ROUTER_ADDR import logging from csirtg_indicator import Indicator, InvalidIndicator from cifsdk.client.zeromq import ZMQ as Client remote = ROUTER_ADDR logger = logging.getLogger('cif-http...
{ "repo_name": "csirtgadgets/bearded-avenger", "path": "cif/httpd/views/u/submit.py", "copies": "1", "size": "1340", "license": "mpl-2.0", "hash": 8569621261200079000, "line_mean": 25.8, "line_max": 79, "alpha_frac": 0.6067164179, "autogenerated": false, "ratio": 4.04833836858006, "config_test":...
from flask.views import MethodView from flask import request, session from flask import jsonify from orm.fields import HasField from orm.exceptions import FieldNotValidError, ObjectNotFoundError from .login import api_login_required ''' These two classes implements basic JSON REST-api ''' class APIListView(MethodVie...
{ "repo_name": "theikkila/lopputili", "path": "app/controllers/listview.py", "copies": "1", "size": "3002", "license": "mit", "hash": -7140986146635771000, "line_mean": 27.6, "line_max": 114, "alpha_frac": 0.6758827448, "autogenerated": false, "ratio": 3.2989010989010987, "config_test": false, ...
from flask.views import MethodView from utils import MailMan, json_response class Home(MethodView): def get(self): applicationDescription = {'Name':'Finkit','Description':'A REST-ish API \ for IMAP mailboxes','Source':'https://github.com/Fuchida/finkit'} return json_response(200, applicati...
{ "repo_name": "Fuchida/Archive", "path": "finkit/src/views.py", "copies": "1", "size": "1348", "license": "mit", "hash": 745211193513016200, "line_mean": 37.5142857143, "line_max": 82, "alpha_frac": 0.6973293769, "autogenerated": false, "ratio": 3.8624641833810887, "config_test": false, "has_...
from flask.views import MethodView class Status(MethodView): def get_response_times(self, analytics_key): from jsondb.db import Database database = Database("settings.db") if analytics_key not in database: return [] return database[analytics_key] def bytes2human...
{ "repo_name": "gunthercox/salvius", "path": "salvius/api.py", "copies": "1", "size": "4124", "license": "mit", "hash": -8273744521544815000, "line_mean": 38.2761904762, "line_max": 78, "alpha_frac": 0.5846265761, "autogenerated": false, "ratio": 3.62071992976295, "config_test": false, "has_no...
from flask.views import MethodView, View import flask import glob, json class ProcReadView(MethodView): def __init__(self, path): self.path = path def get(self, id, fd): path = "%s/%s/%s" % (self.path, id, fd) resp = flask.make_response(file(path).read(), 200) resp.headers['Co...
{ "repo_name": "rande/python-shirka", "path": "shirka/control/proc.py", "copies": "1", "size": "1165", "license": "mit", "hash": 1314145640319090000, "line_mean": 23.8085106383, "line_max": 63, "alpha_frac": 0.5596566524, "autogenerated": false, "ratio": 3.595679012345679, "config_test": false, ...
from flask.views import View from flask import Flask, request class RTUListener(object): """ This class will allow you to quickly instantiate a listener for Real-Time Updates from ThreatExchange. ThreatExchange will send a GET request to confirm connectivity and will expect a string in the response w...
{ "repo_name": "mgoffin/ThreatExchange", "path": "pytx/pytx/rtu.py", "copies": "3", "size": "4299", "license": "bsd-3-clause", "hash": -1297335619717616400, "line_mean": 34.825, "line_max": 80, "alpha_frac": 0.6052570365, "autogenerated": false, "ratio": 4.511017838405037, "config_test": false, ...
from flask.views import View from flask import render_template, current_app, abort, url_for, request from google.appengine.api import users from google.appengine.ext import ndb from ..config import ConfigLoader class BaseView(View): """ Base View contain some boilerplate. """ #ONLY GET ALLOWED BY DEFA...
{ "repo_name": "eigenn/flaskengine", "path": "flaskengine/views/base.py", "copies": "1", "size": "5887", "license": "mit", "hash": 7754306202320228000, "line_mean": 23.7352941176, "line_max": 80, "alpha_frac": 0.5330388993, "autogenerated": false, "ratio": 4.459848484848485, "config_test": false...
from flask.views import View from flask import render_template, session, redirect, url_for, request, flash, jsonify from app.models.user import User def login_required(f): """Checks whether user is logged in or redirects login page""" def decorator(*args, **kwargs): if not "logged_in" in session: return redirec...
{ "repo_name": "theikkila/lopputili", "path": "app/controllers/login.py", "copies": "1", "size": "1382", "license": "mit", "hash": 4228532016425293300, "line_mean": 29.7333333333, "line_max": 86, "alpha_frac": 0.6924746744, "autogenerated": false, "ratio": 3.3462469733656173, "config_test": fals...
from flask.views import View from flask import request from models import Ticket, PhoneSMS, get_prepared_sms_for_ticket import json from database import db_session from utils import parse_sms from smssender import SmsSender class Inbox_view(View): def dispatch_request(self): message = json.loads(request...
{ "repo_name": "pavelkraleu/bit-brno", "path": "inbox_view.py", "copies": "1", "size": "1482", "license": "mit", "hash": 852117151127074600, "line_mean": 29.875, "line_max": 102, "alpha_frac": 0.5964912281, "autogenerated": false, "ratio": 3.859375, "config_test": false, "has_no_keywords": fal...
from flask.views import View from flask import request from utils import make_api_response, get_post_data, SUCCESS class BaseAPIGETView(View): methods = ['GET', ] def get_data(self, **kwargs): raise NotImplementedError() def dispatch_request(self, **kwargs): """ get response forma...
{ "repo_name": "ragnraok/MonoReader", "path": "monoweb/mono/api/apibase.py", "copies": "1", "size": "2061", "license": "mit", "hash": -7908707528655875000, "line_mean": 26.48, "line_max": 84, "alpha_frac": 0.577874818, "autogenerated": false, "ratio": 3.933206106870229, "config_test": false, "...
from flaskwallet import app from flaskwallet import session from flaskwallet import init_db from otpapp.app import otpapp from settingsapp.app import settingsapp from walletapp.app import walletapp try: from flask_debugtoolbar import DebugToolbarExtension toolbar = True except: toolbar = False app.config...
{ "repo_name": "nkuttler/flaskwallet", "path": "main.py", "copies": "1", "size": "1097", "license": "bsd-3-clause", "hash": -7032358491468661000, "line_mean": 25.756097561, "line_max": 71, "alpha_frac": 0.7219690064, "autogenerated": false, "ratio": 3.561688311688312, "config_test": false, "ha...
from FlaskWebProject import app import subprocess import json from flask import render_template, jsonify, request import os @app.route("/") @app.route("/index") def index(): return render_template("index_tpl.html") @app.route("/resp") def resp(): tag = '"'+request.args.get("tag")+'"' start_date = '"'+req...
{ "repo_name": "enhance-your-calm/ic2016_hack", "path": "FlaskWebProject/views.py", "copies": "1", "size": "1992", "license": "mit", "hash": -1775772033936760000, "line_mean": 27.8695652174, "line_max": 124, "alpha_frac": 0.5235943775, "autogenerated": false, "ratio": 3.2925619834710744, "config...
from FlaskWebTemplate import db, app from passlib.apps import custom_app_context as pwd_context from itsdangerous import TimedJSONWebSignatureSerializer as Serializer, SignatureExpired, BadSignature class User(db.Model): __tablename__ = 'restful_users' id = db.Column(db.Integer, primary_key=True) username ...
{ "repo_name": "xydinesh/flask-restful", "path": "FlaskWebTemplate/models.py", "copies": "1", "size": "1218", "license": "apache-2.0", "hash": 4842522766095768000, "line_mean": 34.8529411765, "line_max": 102, "alpha_frac": 0.6592775041, "autogenerated": false, "ratio": 3.9290322580645163, "confi...
from FlaskWithJobResolvers import FlaskWithJobResolvers class WrongAuthInfo(Exception): pass class FlaskWithAuth(FlaskWithJobResolvers): """The class inherites from FlaskWithJobResolvers with a purporse of creating the correct authentification flow. It can be safely turned of, if you do not need the auth ...
{ "repo_name": "flavioarchilli/root-web-monitoring", "path": "webmonitor/FlaskWithAuth.py", "copies": "1", "size": "1155", "license": "mit", "hash": 2392035680958466600, "line_mean": 30.2162162162, "line_max": 123, "alpha_frac": 0.6043290043, "autogenerated": false, "ratio": 3.7868852459016393, ...