text stringlengths 0 1.05M | meta dict |
|---|---|
from flask import has_request_context, request, current_app
from frasco.models import db
from frasco.ext import get_extension_state
from frasco.utils import cached_property
from sqlalchemy.ext.declarative import declared_attr
import stripe
from . import signals
import datetime
import time
import logging
logger = logg... | {
"repo_name": "frascoweb/frasco",
"path": "frasco/billing/stripe/model.py",
"copies": "1",
"size": "23747",
"license": "mit",
"hash": 8580380579586348000,
"line_mean": 42.0980036298,
"line_max": 158,
"alpha_frac": 0.6512401567,
"autogenerated": false,
"ratio": 3.8789611238157464,
"config_test":... |
from flask import json, current_app
from frasco.ext import get_extension_state
from frasco.utils import unknown_value
from .utils import build_object_key
import inspect
__all__ = ('redis_cached_property', 'redis_cached_property_as_json', 'redis_cached_method', 'redis_cached_method_as_json')
class RedisCachedAttribu... | {
"repo_name": "frascoweb/frasco",
"path": "frasco/redis/attr.py",
"copies": "1",
"size": "6849",
"license": "mit",
"hash": 9039978812434261000,
"line_mean": 30.8558139535,
"line_max": 122,
"alpha_frac": 0.5667980727,
"autogenerated": false,
"ratio": 3.8959044368600684,
"config_test": false,
"... |
from flask import json,current_app
from ..models import User
from google.appengine.api import users
from google.appengine.ext import ndb
import re
import hashlib
import urllib, urllib2
STEAM="steam"
_steam_id_re = re.compile('steamcommunity.com/openid/id/(.*?)$')
#returns a datastore key with the format : provi... | {
"repo_name": "izogain/steam-flask-openid",
"path": "core/auth/providers.py",
"copies": "1",
"size": "1791",
"license": "mit",
"hash": 6915588374324050000,
"line_mean": 32.7924528302,
"line_max": 107,
"alpha_frac": 0.7035175879,
"autogenerated": false,
"ratio": 3.3602251407129455,
"config_test"... |
from flask import json, Flask, request, session, jsonify, render_template, redirect, url_for, escape, send_file, g, make_response
import requests #, json
from functools import wraps
import base64
import hashlib
import time
import logging
from logging.handlers import RotatingFileHandler
from datetime import datetime
fr... | {
"repo_name": "ooici/ion-ux",
"path": "main.py",
"copies": "1",
"size": "36079",
"license": "bsd-2-clause",
"hash": 4816872866270176000,
"line_mean": 40.3276059565,
"line_max": 232,
"alpha_frac": 0.6115191663,
"autogenerated": false,
"ratio": 3.897482985848547,
"config_test": false,
"has_no_k... |
from flask import jsonify, abort, make_response
from flask.ext.httpauth import HTTPBasicAuth
from flask import Blueprint
api = Blueprint('api', __name__)
auth = HTTPBasicAuth()
tasks = [
{
'id': 1,
'title': u'Buy groceries',
'description': u'Milk, Cheese, Pizza, Fruit, Tylenol',
'd... | {
"repo_name": "abdesslem/pcapTotal",
"path": "api.py",
"copies": "1",
"size": "1225",
"license": "mit",
"hash": 8466937573385704000,
"line_mean": 23.0196078431,
"line_max": 74,
"alpha_frac": 0.6163265306,
"autogenerated": false,
"ratio": 3.2068062827225132,
"config_test": false,
"has_no_keywo... |
from flask import jsonify, abort, make_response
import base64
import pytesseract
import cv2
import numpy as np
import io
# This is the height of the image used to align the document
# A lower value is faster to compute but less accurate than a higher value
ALIGNMENT_RESIZE_HEIGHT = 500
# The area of the document we ... | {
"repo_name": "Cyberjusticelab/JusticeAI",
"path": "src/task_service/controllers/ocr_controller.py",
"copies": "1",
"size": "5581",
"license": "mit",
"hash": -3572519982527084500,
"line_mean": 32.4191616766,
"line_max": 115,
"alpha_frac": 0.6799856657,
"autogenerated": false,
"ratio": 3.310201660... |
from flask import jsonify, abort
from app.config import db_sql
from app.models import Lugar
def get_lugares():
"""
@api {get} /lugares/:id Obtiene una lista de lugares
@apiVersion 1.0.0
@apiName get_lugares
@apiGroup Lugar
@apiDescription Obtiene una lista de lugares
@apiExample Example us... | {
"repo_name": "alanudg/SmartCheckIn",
"path": "app/api/v1/Lugar.py",
"copies": "2",
"size": "1783",
"license": "mit",
"hash": 7832676902824354000,
"line_mean": 32.641509434,
"line_max": 78,
"alpha_frac": 0.6247896803,
"autogenerated": false,
"ratio": 3.301851851851852,
"config_test": false,
"... |
from flask import jsonify, abort
from flask.ext.restful import Api, Resource, reqparse, fields, marshal
from app import api, models, db
from app.models import datetime_converter
import datetime
"""
The API routing and logic is done here, as an example, I created a
UserAPI, which works as an API resource serv... | {
"repo_name": "martijnroo/fitness-back-end",
"path": "app/views/exercises.py",
"copies": "1",
"size": "4772",
"license": "mit",
"hash": -2354181964405697000,
"line_mean": 31.9172413793,
"line_max": 109,
"alpha_frac": 0.614417435,
"autogenerated": false,
"ratio": 4.016835016835016,
"config_test"... |
from flask import jsonify, abort
from flask.ext.restful import Api, Resource, reqparse
from app import api, models, db
from config import DEBUG
"""
The API routing and logic is done here, as an example, I created a
UserAPI, which works as an API resource serving user information from
several endpoints, w... | {
"repo_name": "martijnroo/fitness-back-end",
"path": "app/views/users.py",
"copies": "1",
"size": "5783",
"license": "mit",
"hash": -2261288909810891800,
"line_mean": 28.5051020408,
"line_max": 111,
"alpha_frac": 0.5749610929,
"autogenerated": false,
"ratio": 4.004847645429363,
"config_test": f... |
from flask import jsonify, abort
from flask_restful import Resource, reqparse
from app import api, db
from sqlalchemy import desc
from app.models import Measurement, Exercise, datetime_converter, measurements_list
"""
The API routing and logic is done here, as an example, I created a
UserAPI, which works as ... | {
"repo_name": "martijnroo/fitness-back-end",
"path": "app/views/measurements.py",
"copies": "1",
"size": "4762",
"license": "mit",
"hash": -6371489322733199000,
"line_mean": 32.5352112676,
"line_max": 119,
"alpha_frac": 0.6163376732,
"autogenerated": false,
"ratio": 4.267025089605735,
"config_t... |
from flask import jsonify, abort
from .. import main
from app import db
from app.main.views import get_json_from_request
from app.models import Job, Service
from app.main.validators import valid_job_submission
from datetime import datetime
from sqlalchemy.exc import IntegrityError
from sqlalchemy import desc
from app.m... | {
"repo_name": "alphagov/notify-api",
"path": "app/main/views/job.py",
"copies": "1",
"size": "1750",
"license": "mit",
"hash": -6057818349244767000,
"line_mean": 26.34375,
"line_max": 81,
"alpha_frac": 0.652,
"autogenerated": false,
"ratio": 3.653444676409186,
"config_test": false,
"has_no_ke... |
from flask import jsonify, abort, request, current_app
from datetime import datetime
from ...models import AuditEvent
from sqlalchemy import asc, Date, cast
from sqlalchemy.exc import IntegrityError
from sqlalchemy.sql.expression import true, false
from ...utils import pagination_links
from .. import main
from ... impo... | {
"repo_name": "RichardKnop/digitalmarketplace-api",
"path": "app/main/views/audits.py",
"copies": "2",
"size": "2967",
"license": "mit",
"hash": -1468069077293185800,
"line_mean": 30.5638297872,
"line_max": 74,
"alpha_frac": 0.627569936,
"autogenerated": false,
"ratio": 3.86328125,
"config_test... |
from flask import jsonify, abort, request, current_app
from sqlalchemy.exc import IntegrityError, DataError
from .. import main
from ... import db
from ...models import Supplier, ContactInformation, AuditEvent, Service, \
SelectionAnswers, Framework
from ...validation import (
validate_supplier_json_or_400,
... | {
"repo_name": "RichardKnop/digitalmarketplace-api",
"path": "app/main/views/suppliers.py",
"copies": "2",
"size": "10050",
"license": "mit",
"hash": 1601263722465928400,
"line_mean": 29.6402439024,
"line_max": 77,
"alpha_frac": 0.6341293532,
"autogenerated": false,
"ratio": 3.9976133651551313,
... |
from flask import jsonify, abort, request, make_response, render_template, redirect
from app import app, auth, db, models
from sqlalchemy.orm import aliased
BASE_URL = "http://www.dotabuff.com"
def allTeams(fameous):
query = models.Team.query
if fameous:
query = query.filter(models.Team.imageUrl != No... | {
"repo_name": "BamX/dota2-matches-statistic",
"path": "app/views.py",
"copies": "1",
"size": "1816",
"license": "mit",
"hash": -6358486774636881000,
"line_mean": 34.6078431373,
"line_max": 171,
"alpha_frac": 0.688876652,
"autogenerated": false,
"ratio": 3.2486583184257602,
"config_test": false,... |
from flask import jsonify, abort, request
from flask_login import logout_user, current_user
from wikked.web import app, get_wiki
from wikked.webimpl.admin import do_login_user
@app.route('/api/user/login', methods=['POST'])
def api_user_login():
if do_login_user():
username = request.form.get('username')
... | {
"repo_name": "ludovicchabant/Wikked",
"path": "wikked/api/user.py",
"copies": "1",
"size": "1421",
"license": "apache-2.0",
"hash": -3643017560070435300,
"line_mean": 23.9298245614,
"line_max": 55,
"alpha_frac": 0.5770584096,
"autogenerated": false,
"ratio": 3.6157760814249365,
"config_test": ... |
from flask import jsonify, abort, request
from .. import app
from .models import Compliment
def build_compliment(compliment):
return {'id': compliment['id'], 'text': compliment['text']} if compliment else abort(404)
@app.route('/', methods=['GET'])
def home():
return jsonify({'message': 'Hi, this is an API... | {
"repo_name": "shermanng10/NaaS",
"path": "NaaS/compliments/views.py",
"copies": "1",
"size": "1241",
"license": "mit",
"hash": 5792255027753344000,
"line_mean": 29.2682926829,
"line_max": 96,
"alpha_frac": 0.6599516519,
"autogenerated": false,
"ratio": 3.4664804469273744,
"config_test": false,... |
from flask import jsonify, abort, Response, make_response, request
import os
from varappx.handle_config import settings
from functools import wraps
from .. import main
DAY_IN_SECONDS = 86400
TOKEN_DURATION = DAY_IN_SECONDS / 4
SECRET_KEY = settings.SECRET_KEY
SUPERUSER = 'superuser'
ADMIN = 'admin'
HEAD = 'head'
GUES... | {
"repo_name": "444thLiao/VarappX-flask",
"path": "varappx/main/views/accounts_views.py",
"copies": "1",
"size": "10416",
"license": "mit",
"hash": -6866177101758391000,
"line_mean": 36.6028880866,
"line_max": 356,
"alpha_frac": 0.6712749616,
"autogenerated": false,
"ratio": 3.66373549067886,
"c... |
from flask import jsonify as to_json, request
from flask.ext.restful import Resource, reqparse, abort
from ..common.validate_token import validate_token
class SecureResource(Resource):
"""
A Resource which only allows access with a valid token.
Upon initialization this class sets the following instance ... | {
"repo_name": "YnkDK/restful-mys",
"path": "restful_mys/controller/secure_resource.py",
"copies": "1",
"size": "2751",
"license": "mit",
"hash": 6520531256928834000,
"line_mean": 37.7605633803,
"line_max": 114,
"alpha_frac": 0.6303162486,
"autogenerated": false,
"ratio": 4.6003344481605355,
"co... |
from flask import jsonify, Blueprint, abort
from flask_restful import (Resource, Api, reqparse,
inputs, fields,
marshal, marshal_with,
url_for
)
import models
space_fields = {
'id': fields.Integer,
'field_values': fields.String
}
def parse_field_values(field_values):
field_values.str... | {
"repo_name": "davefaliskie/smart_parking_api",
"path": "resources/spaces.py",
"copies": "1",
"size": "2167",
"license": "mit",
"hash": 4185047108883356700,
"line_mean": 20.0485436893,
"line_max": 66,
"alpha_frac": 0.6677434241,
"autogenerated": false,
"ratio": 2.960382513661202,
"config_test":... |
from flask import jsonify, Blueprint, abort
from flask_restful import (Resource, Api, reqparse, url_for,
inputs, fields, marshal, marshal_with)
from auth import auth
import models
course_fields = {
'id': fields.Integer,
'title': fields.String,
'url': fields.String,
'reviews... | {
"repo_name": "davejlin/treehouse",
"path": "python/flask/rest-api/resources/courses.py",
"copies": "1",
"size": "3105",
"license": "unlicense",
"hash": -2352290436195923000,
"line_mean": 27.2363636364,
"line_max": 80,
"alpha_frac": 0.5706924316,
"autogenerated": false,
"ratio": 3.900753768844221... |
from flask import jsonify, Blueprint, current_app
import appr.api.impl.builder
from appr.api.app import getvalues
from appr.api.app import repo_name
builder_app = Blueprint('builder', __name__) # pylint: disable=C0103
def _build(package, version, media_type='kpm'):
values = getvalues()
namespace = values.ge... | {
"repo_name": "cn-app-registry/cnr-server",
"path": "appr/api/builder.py",
"copies": "2",
"size": "2522",
"license": "apache-2.0",
"hash": 9146502570089456000,
"line_mean": 41.0333333333,
"line_max": 114,
"alpha_frac": 0.6471054718,
"autogenerated": false,
"ratio": 3.671033478893741,
"config_te... |
from flask import jsonify, Blueprint, current_app
import kpm.api.impl.builder
from kpm.api.app import getvalues
from appr.api.app import repo_name
builder_app = Blueprint('builder', __name__) # pylint: disable=C0103
def _build(package, version, media_type='kpm'):
values = getvalues()
namespace = values.get(... | {
"repo_name": "kubespray/kpm",
"path": "kpm/api/builder.py",
"copies": "1",
"size": "2464",
"license": "apache-2.0",
"hash": 6687336740160257000,
"line_mean": 41.4827586207,
"line_max": 114,
"alpha_frac": 0.6590909091,
"autogenerated": false,
"ratio": 3.6023391812865495,
"config_test": false,
... |
from flask import jsonify, Blueprint, current_app
import kpm.api.impl.builder
from kpm.api.app import getvalues
builder_app = Blueprint('builder', __name__,)
def _build(package):
values = getvalues()
version = values.get('version', None)
namespace = values.get('namespace', None)
variables = values.ge... | {
"repo_name": "ant31/kpm",
"path": "kpm/api/builder.py",
"copies": "1",
"size": "1845",
"license": "apache-2.0",
"hash": 4842440573982512000,
"line_mean": 35.9,
"line_max": 107,
"alpha_frac": 0.6021680217,
"autogenerated": false,
"ratio": 3.7885010266940453,
"config_test": false,
"has_no_keyw... |
from flask import jsonify, Blueprint
from werkzeug.exceptions import default_exceptions
from swagger_parser import SwaggerParser
from flakon.util import get_content, error_handling
class JsonBlueprint(Blueprint):
def __init__(self, name, import_name, static_folder=None,
static_url_path=None, temp... | {
"repo_name": "Runnerly/flakon",
"path": "flakon/blueprints.py",
"copies": "1",
"size": "3241",
"license": "apache-2.0",
"hash": 4994178518195877000,
"line_mean": 41.6447368421,
"line_max": 77,
"alpha_frac": 0.5396482567,
"autogenerated": false,
"ratio": 4.433652530779754,
"config_test": false,... |
from flask import jsonify, Blueprint, redirect as flask_redirect, url_for, \
render_template, request, current_app
from flask_login import current_user, logout_user, login_user, login_required
from client.libs.core import User, Session
from client.libs.service import Service, Employment
from client import login_man... | {
"repo_name": "Braiiin/outline-client",
"path": "outline_client/public/views.py",
"copies": "1",
"size": "4303",
"license": "apache-2.0",
"hash": -3530159578354343400,
"line_mean": 28.8819444444,
"line_max": 79,
"alpha_frac": 0.6437369277,
"autogenerated": false,
"ratio": 3.8113374667847655,
"c... |
from flask import jsonify, Blueprint, request, json
from werkzeug.datastructures import MultiDict
from projectp import socketio
from projectp import db
from projectp.auth import requires_auth
from projectp.visits.forms import DateForm
from projectp.visits.models import Visit
from .models import Location
locations = ... | {
"repo_name": "Proj-P/project-p-api",
"path": "projectp/locations/views.py",
"copies": "1",
"size": "2614",
"license": "mit",
"hash": -2690708034189742000,
"line_mean": 28.0444444444,
"line_max": 128,
"alpha_frac": 0.6782708493,
"autogenerated": false,
"ratio": 3.750358680057389,
"config_test":... |
from flask import jsonify, Blueprint, url_for, render_template, request,\
redirect
from site_client.libs.core import Conference, Engagement, Speaker, Nomination, \
Staff, Membership
from .forms import AddSpeakerForm, EditSpeakerForm, AddStaffForm, EditStaffForm\
, AddConferenceForm, EditConferenceForm
admi... | {
"repo_name": "TEDxBerkeley/site-client",
"path": "site_client/admin/views.py",
"copies": "1",
"size": "5772",
"license": "apache-2.0",
"hash": 5405218629242151000,
"line_mean": 30.2,
"line_max": 84,
"alpha_frac": 0.6576576577,
"autogenerated": false,
"ratio": 3.5717821782178216,
"config_test":... |
from flask import jsonify, current_app
from .... import db
from .... import celery
from ....core.mod import mods as _mods
from ....core.local import current_user, request_values
from ....core.connection import autoccontext
from ...admin.auth import admin_required
from .. import bp
from ..token import make_token
from ..... | {
"repo_name": "Answeror/torabot",
"path": "torabot/frontend/api/views/main.py",
"copies": "1",
"size": "1858",
"license": "mit",
"hash": 2396716903133882000,
"line_mean": 24.1081081081,
"line_max": 83,
"alpha_frac": 0.654467169,
"autogenerated": false,
"ratio": 3.3537906137184117,
"config_test"... |
from flask import jsonify, current_app
from dmapiclient.audit import AuditTypes
from dmutils.email.helpers import hash_string
from app import db
from app.callbacks import callbacks
from app.utils import get_json_from_request
from app.models import User, AuditEvent
@callbacks.route('/')
@callbacks.route('')
def call... | {
"repo_name": "alphagov/digitalmarketplace-api",
"path": "app/callbacks/views/notify.py",
"copies": "1",
"size": "2000",
"license": "mit",
"hash": 2403642363195743000,
"line_mean": 28.8507462687,
"line_max": 101,
"alpha_frac": 0.6235,
"autogenerated": false,
"ratio": 4.048582995951417,
"config_... |
from flask import jsonify, current_app, request, abort
from app.main.validators import valid_sms_notification
from app.main.validators import valid_email_notification
from .. import main, get_token_from_headers
from ... import db, sms_wrapper
from sqlalchemy.exc import IntegrityError, DataError
from app.main.views impo... | {
"repo_name": "alphagov/notify-api",
"path": "app/main/views/notification.py",
"copies": "1",
"size": "7348",
"license": "mit",
"hash": -2395136726180932600,
"line_mean": 34.1578947368,
"line_max": 119,
"alpha_frac": 0.6705225912,
"autogenerated": false,
"ratio": 4.23028209556707,
"config_test"... |
from flask import jsonify, current_app, request
from . import status
from .. import data_api_client
from dmutils.status import get_flags
@status.route('/_status')
def status():
if 'ignore-dependencies' in request.args:
return jsonify(
status="ok",
), 200
version = current_app.co... | {
"repo_name": "AusDTO/dto-digitalmarketplace-buyer-frontend",
"path": "app/status/views.py",
"copies": "1",
"size": "1092",
"license": "mit",
"hash": -1303229278341421600,
"line_mean": 23.2666666667,
"line_max": 68,
"alpha_frac": 0.5448717949,
"autogenerated": false,
"ratio": 3.752577319587629,
... |
from flask import jsonify, current_app, request
from . import status
from .. import data_api_client, search_api_client
from dmutils.status import get_flags
@status.route('/_status')
def status():
if 'ignore-dependencies' in request.args:
return jsonify(
status="ok",
), 200
versi... | {
"repo_name": "mtekel/digitalmarketplace-buyer-frontend",
"path": "app/status/views.py",
"copies": "1",
"size": "1410",
"license": "mit",
"hash": 2587493156331319300,
"line_mean": 25.1111111111,
"line_max": 76,
"alpha_frac": 0.5397163121,
"autogenerated": false,
"ratio": 3.8315217391304346,
"co... |
from flask import jsonify, current_app, url_for
from flask.ext.mongoengine import MongoEngine
from werkzeug.security import generate_password_hash, check_password_hash
from itsdangerous import TimedJSONWebSignatureSerializer as Serializer
db = MongoEngine()
class Sensor(db.Document):
sensorId = db.StringField()
... | {
"repo_name": "tcufer/nyc_traffic_speed_api",
"path": "common/models.py",
"copies": "1",
"size": "1915",
"license": "mit",
"hash": -6276978466307697000,
"line_mean": 28.9375,
"line_max": 78,
"alpha_frac": 0.6657963446,
"autogenerated": false,
"ratio": 3.6268939393939394,
"config_test": false,
... |
from flask import jsonify, Flask, request
from flask_cors import CORS
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from load import *
from __main__ import getConnectionString
# Setup database engine and connect
engine = create_engine(getConnectionString())
conn = engine.connect()
# Setu... | {
"repo_name": "youngpascal/pAPI",
"path": "pAPI/api.py",
"copies": "1",
"size": "3569",
"license": "mit",
"hash": -4815054583804405000,
"line_mean": 37.376344086,
"line_max": 137,
"alpha_frac": 0.6382740263,
"autogenerated": false,
"ratio": 3.5127952755905514,
"config_test": false,
"has_no_ke... |
from flask import jsonify, Flask, request
from pymongo import MongoClient
import os
import json
import pprint
import traceback
app = Flask(__name__)
client = MongoClient(os.environ["MONGOLAB_URI"])
db = client["heroku_gw4w78g9"]
col = db["locations"]
print col
@app.route('/location', methods=["POST"])
def addLocation... | {
"repo_name": "mzmttks/miteteyo",
"path": "server/app.py",
"copies": "1",
"size": "1209",
"license": "mit",
"hash": 6914129593433982000,
"line_mean": 22.25,
"line_max": 67,
"alpha_frac": 0.6401985112,
"autogenerated": false,
"ratio": 3.30327868852459,
"config_test": false,
"has_no_keywords": ... |
from flask import jsonify, Flask, Response, request
from pymongo import MongoClient
import bson.json_util
app = Flask(__name__)
app.cursors = {}
class ResultFlagType():
# returned, with zero results, when getMore is called but the cursor id
# is not valid at the server.
ResultFlag_CursorNotFound = 1
... | {
"repo_name": "RRZE-PP/mongobrowser",
"path": "backends/python_flask.py",
"copies": "1",
"size": "7603",
"license": "apache-2.0",
"hash": 9023239510364236000,
"line_mean": 28.3590733591,
"line_max": 117,
"alpha_frac": 0.6635538603,
"autogenerated": false,
"ratio": 3.2999131944444446,
"config_te... |
from flask import jsonify, g, abort, url_for, current_app, request
from .. import db
from ..models import Post, Permission
from . import api
from .decorators import permission_required
from .errors import forbidden
@api.route('/posts/')
def get_posts():
page = request.args.get('page', 1, type=int)
pagination ... | {
"repo_name": "hcjcch/blogbyflask",
"path": "app/api_1_0/posts.py",
"copies": "1",
"size": "1737",
"license": "mit",
"hash": 8982381416178107000,
"line_mean": 30.0178571429,
"line_max": 73,
"alpha_frac": 0.648244099,
"autogenerated": false,
"ratio": 3.314885496183206,
"config_test": false,
"h... |
from flask import jsonify, g, Blueprint, request
from flask_security import login_required, current_user
from api.helper.apiexception import ApiException
from uuid import UUID
projects_meta = Blueprint('api_projects_meta', __name__)
def init_project_meta(project_id, time):
user_mail = current_user['email'].re... | {
"repo_name": "Drakulix/knex",
"path": "backend/api/projectsMeta.py",
"copies": "1",
"size": "3695",
"license": "mit",
"hash": -8504863060172257000,
"line_mean": 37.4479166667,
"line_max": 91,
"alpha_frac": 0.5700352208,
"autogenerated": false,
"ratio": 3.7245206861755804,
"config_test": false,... |
from flask import jsonify, g, current_app
from flask.ext.httpauth import HTTPBasicAuth
from .models import User
auth = HTTPBasicAuth()
auth_token = HTTPBasicAuth()
@auth.verify_password
def verify_password(username, password):
g.user = User.query.filter_by(username=username).first()
if g.user is None:
... | {
"repo_name": "codervince/oreilly-flask-apis-video",
"path": "orders/app/auth.py",
"copies": "3",
"size": "1082",
"license": "mit",
"hash": -4178114592027091000,
"line_mean": 29.0555555556,
"line_max": 76,
"alpha_frac": 0.6756007394,
"autogenerated": false,
"ratio": 3.7569444444444446,
"config_... |
from flask import jsonify, g, current_app
from flask_httpauth import HTTPBasicAuth
from .models import User
auth = HTTPBasicAuth()
auth_token = HTTPBasicAuth()
@auth.verify_password
def verify_password(username, password):
g.user = User.query.filter_by(username=username).first()
if g.user is None:
re... | {
"repo_name": "andela-akhenda/maisha-goals",
"path": "app/auth.py",
"copies": "1",
"size": "1081",
"license": "mit",
"hash": -7282370773667130000,
"line_mean": 26.7179487179,
"line_max": 76,
"alpha_frac": 0.6734505088,
"autogenerated": false,
"ratio": 3.7797202797202796,
"config_test": false,
... |
from flask import jsonify, g
from flask_httpauth import HTTPBasicAuth, HTTPTokenAuth
from ..models import User
basic_auth = HTTPBasicAuth()
token_auth = HTTPTokenAuth('Bearer')
@basic_auth.verify_password
def verify_password(email, password):
"""This is the email/password verification callback."""
user = U... | {
"repo_name": "SalveMais/api",
"path": "salvemais/accounts/auth.py",
"copies": "1",
"size": "1303",
"license": "mit",
"hash": 2358211729430923000,
"line_mean": 28.6136363636,
"line_max": 77,
"alpha_frac": 0.6930161167,
"autogenerated": false,
"ratio": 3.996932515337423,
"config_test": false,
... |
from flask import jsonify, g
from .. import db
from ..models import Comment
# from ..emails import send_comment_notification
from . import api
from .errors import forbidden, bad_request
@api.route('/comments/<int:id>', methods=['PUT'])
def approve_comment(id):
comment = Comment.query.get_or_404(id)
if commen... | {
"repo_name": "goalong/flask-demo",
"path": "app/api_1_0/comments.py",
"copies": "1",
"size": "1151",
"license": "mit",
"hash": -8451282270091182000,
"line_mean": 31.8857142857,
"line_max": 59,
"alpha_frac": 0.6733275413,
"autogenerated": false,
"ratio": 3.8366666666666664,
"config_test": false... |
from flask import jsonify, g
from .. import db
from ..models import Comment
from ..emails import send_comment_notification
from . import api
from .errors import forbidden, bad_request
@api.route('/comments/<int:id>', methods=['PUT'])
def approve_comment(id):
comment = Comment.query.get_or_404(id)
if comment.... | {
"repo_name": "miguelgrinberg/flask-pycon2014",
"path": "app/api_1_0/comments.py",
"copies": "6",
"size": "1147",
"license": "mit",
"hash": 6757493098906692000,
"line_mean": 31.7714285714,
"line_max": 59,
"alpha_frac": 0.6756756757,
"autogenerated": false,
"ratio": 3.848993288590604,
"config_te... |
from flask import jsonify, g, request
from flask.ext.cors import cross_origin
from application import app
from database import *
from costi import *
import json
@app.before_request
def before_request():
if db_status() == True:
#salvo in g (variabile interna di flask) l'istanza del db per
#questa connessione
g.d... | {
"repo_name": "GnuRant/MyMobiCost",
"path": "Backend/application/api.py",
"copies": "1",
"size": "5166",
"license": "mit",
"hash": 7074230825905008000,
"line_mean": 25.3571428571,
"line_max": 98,
"alpha_frac": 0.6676345335,
"autogenerated": false,
"ratio": 2.5972850678733033,
"config_test": fal... |
from flask import jsonify,json
from flask import render_template, session, redirect, url_for, current_app, request
from .. import db
from ..models import Doc, DataSrc
from . import datasrc
from pymongo import MongoClient
@datasrc.route('/datasrc/add', methods=['POST'])
def newDataSrc():
data = json.loads(request.form... | {
"repo_name": "Justyer/NightHeartDataPlatform",
"path": "firefly/app/datasrc/views.py",
"copies": "1",
"size": "2163",
"license": "mit",
"hash": 4196519871733726700,
"line_mean": 28.2432432432,
"line_max": 83,
"alpha_frac": 0.7022653722,
"autogenerated": false,
"ratio": 2.801813471502591,
"conf... |
from flask import jsonify, json
import hashlib
from google.appengine.ext import ndb
import logging
import datetime
class Profile(ndb.Model):
id = ndb.StringProperty()
name = ndb.StringProperty()
description = ndb.StringProperty()
create_date = ndb.DateTimeProperty(auto_now_add=True)
last_access = n... | {
"repo_name": "djw8605/GratiaChromeShareApp",
"path": "profile.py",
"copies": "1",
"size": "1776",
"license": "apache-2.0",
"hash": 4105987140985702400,
"line_mean": 25.1176470588,
"line_max": 165,
"alpha_frac": 0.6064189189,
"autogenerated": false,
"ratio": 4.111111111111111,
"config_test": fa... |
from flask import jsonify, json
"""
Helper functions used in the app.
"""
def json_data(req):
"""(flask.request) -> dict
Returns a dict representing the json request
submitted to /email.
"""
return {k: v.strip() for k, v in req.get_json().iteritems()}
def get_services(email, app):
"""(Email) -> list
R... | {
"repo_name": "wa3l/mailr",
"path": "helpers.py",
"copies": "1",
"size": "1911",
"license": "mit",
"hash": -3088935457147006500,
"line_mean": 24.1447368421,
"line_max": 104,
"alpha_frac": 0.6708529566,
"autogenerated": false,
"ratio": 3.612476370510397,
"config_test": false,
"has_no_keywords"... |
from flask import jsonify, json, request
import re
import urlparse
import logging
# Include any style sheet that we need here
embed_intro = """
document.write('<link rel="stylesheet" href="%(url)s/assets/embed.css">');
document.write(' """
# End the embed
embed_end = """');
"""
def create_html(imageURL, name, descri... | {
"repo_name": "djw8605/GratiaChromeShareApp",
"path": "embed.py",
"copies": "1",
"size": "1866",
"license": "apache-2.0",
"hash": -7648303993309219000,
"line_mean": 30.6271186441,
"line_max": 161,
"alpha_frac": 0.6120042872,
"autogenerated": false,
"ratio": 3.50093808630394,
"config_test": fals... |
from flask import jsonify, make_response, abort, current_app
from flask_restful import reqparse
from homeautomation.models import StockProduct
from homeautomation.schemas import ProductSchema
from .base import BaseResource
class StockCategoryProducts(BaseResource):
"""
Api to return all subCategorys of the ... | {
"repo_name": "gtema/homeautomation-backend",
"path": "homeautomation/api_v1/resources/products.py",
"copies": "1",
"size": "2975",
"license": "apache-2.0",
"hash": -5613376836922485000,
"line_mean": 29.6701030928,
"line_max": 79,
"alpha_frac": 0.585210084,
"autogenerated": false,
"ratio": 4.0809... |
from flask import jsonify, make_response, abort, current_app
from homeautomation.models import db, StockProductItem
from homeautomation.schemas import ProductItemSchema
from sqlalchemy.exc import DatabaseError
from .base import BaseResource
class StockCategoryProductItems(BaseResource):
"""
Api to return al... | {
"repo_name": "gtema/homeautomation-backend",
"path": "homeautomation/api_v1/resources/productitems.py",
"copies": "1",
"size": "3233",
"license": "apache-2.0",
"hash": -7712104870777270000,
"line_mean": 29.7904761905,
"line_max": 78,
"alpha_frac": 0.5589236004,
"autogenerated": false,
"ratio": 4... |
from flask import jsonify, make_response, g, Blueprint
from flask_security import login_required, current_user
from api.notifications import add_notification
from api.helper.apiexception import ApiException
bookmarks = Blueprint('api_bookmarks', __name__)
@bookmarks.route('/api/bookmarks/<uuid:id>', methods=['POST'... | {
"repo_name": "Drakulix/knex",
"path": "backend/api/bookmarks.py",
"copies": "1",
"size": "2379",
"license": "mit",
"hash": 8184739557860872000,
"line_mean": 35.0454545455,
"line_max": 99,
"alpha_frac": 0.6385035729,
"autogenerated": false,
"ratio": 3.951827242524917,
"config_test": false,
"h... |
from flask import jsonify, make_response, g
from werkzeug.security import generate_password_hash
from config import db, auth
from models import User
def responsify(data, code=200):
"""Util function for building the jsonified response.
Use this to add headers or do something you wish to include in every res... | {
"repo_name": "albalitz/save-api",
"path": "src/util.py",
"copies": "1",
"size": "1202",
"license": "mit",
"hash": 4284689557875396600,
"line_mean": 29.8205128205,
"line_max": 82,
"alpha_frac": 0.7038269551,
"autogenerated": false,
"ratio": 4.247349823321555,
"config_test": false,
"has_no_key... |
from flask import jsonify, make_response
from flask_api import status # HTTP Status Codes
from app import app
######################################################################
# Custom Exceptions
######################################################################
class DataValidationError(ValueError):
p... | {
"repo_name": "devops-s17-payments/payments",
"path": "app/error_handlers.py",
"copies": "1",
"size": "1436",
"license": "apache-2.0",
"hash": 3689944172394951700,
"line_mean": 42.5454545455,
"line_max": 196,
"alpha_frac": 0.614902507,
"autogenerated": false,
"ratio": 4.174418604651163,
"config... |
from flask import jsonify, make_response
def register_errorhandlers(app):
"""Default error endpoints. These can be overriden for individual endpoints,
eg, a login view might return a more specific message than just 'Forbidden'
"""
@app.errorhandler(400)
def bad_request(error):
data = {'ms... | {
"repo_name": "carlegbert/wholenote",
"path": "fnote/errorhandlers.py",
"copies": "1",
"size": "1510",
"license": "mit",
"hash": 8115753425515114000,
"line_mean": 31.1276595745,
"line_max": 80,
"alpha_frac": 0.6066225166,
"autogenerated": false,
"ratio": 3.901808785529716,
"config_test": false,... |
from flask import jsonify, make_response, request
from functools import wraps
def add_response_headers(headers=None, default_headers=None, cors=False):
"""
Adds a bunch of headers to the Flask responses
:param headers: a dictionary of headers and values to add to the response
:param default_headers: a... | {
"repo_name": "mozilla/http-observatory",
"path": "httpobs/website/decorators.py",
"copies": "2",
"size": "3263",
"license": "mpl-2.0",
"hash": -951484851026749700,
"line_mean": 37.8452380952,
"line_max": 111,
"alpha_frac": 0.5562365921,
"autogenerated": false,
"ratio": 4.2376623376623375,
"con... |
from flask import jsonify, make_response, request, url_for
import utils
from redis_inventory import LOCATION_ID, NEW, OPEN_BOX, PRODUCT_ID, QUANTITY, RESTOCK_LEVEL, TYPE, USED
from . import app
# Status Codes
HTTP_200_OK = 200
HTTP_201_CREATED = 201
HTTP_204_NO_CONTENT = 204
HTTP_400_BAD_REQUEST = 400
HTTP_404_NOT_FO... | {
"repo_name": "devops-foxtrot-s17/inventory",
"path": "app/server.py",
"copies": "1",
"size": "11327",
"license": "mit",
"hash": 960343400933725200,
"line_mean": 28.9656084656,
"line_max": 118,
"alpha_frac": 0.5738500927,
"autogenerated": false,
"ratio": 4.674783326454808,
"config_test": false,... |
from flask import jsonify, make_response, Response
from flask_sqlalchemy import SQLAlchemy
from src.webservice.base import Base
db = SQLAlchemy()
Base.query = db.session.query_property()
class Output(Base):
__tablename__ = 'tbl_OutputPin'
id = db.Column(db.Integer, primary_key=True)
number = db.Column(db... | {
"repo_name": "deklungel/iRulez",
"path": "src/webservice/_outputPin.py",
"copies": "1",
"size": "2167",
"license": "mit",
"hash": -6490515459055507000,
"line_mean": 34.5245901639,
"line_max": 127,
"alpha_frac": 0.6119058606,
"autogenerated": false,
"ratio": 3.8558718861209966,
"config_test": f... |
from flask import jsonify, Markup, render_template
from app import app
import os
import re
initialised = False
musicFiles = None
mpeg_regex = re.compile(r"^.*\.mp3$")
jpeg_regex = re.compile(r"^.*\.jpe?g$")
png_regex = re.compile(r"^.*\.png$")
def getMusicFiles(path): # credit to https://stackoverflow.com/a/2... | {
"repo_name": "WeilonYing/html5-music-player",
"path": "app/views.py",
"copies": "1",
"size": "1235",
"license": "apache-2.0",
"hash": 891695678217735400,
"line_mean": 26.7906976744,
"line_max": 87,
"alpha_frac": 0.5910931174,
"autogenerated": false,
"ratio": 3.3288409703504045,
"config_test": ... |
from flask import jsonify
from app import app, app_log
__author__ = 'Xiaoxiao.Xiong'
class CustomError(Exception):
status_code = 400
def __init__(self, message, status_code=None, payload=None):
Exception.__init__(self)
self.message = message
if status_code is not None:
... | {
"repo_name": "dhrproject/mydatasource",
"path": "DataSource/app/handler/error_handler.py",
"copies": "1",
"size": "2097",
"license": "mit",
"hash": 9074626984114592000,
"line_mean": 25.8974358974,
"line_max": 67,
"alpha_frac": 0.6390081068,
"autogenerated": false,
"ratio": 3.854779411764706,
"... |
from flask import jsonify
from base.application import app
from subprocess import Popen, PIPE
from base.constants import DATASET_RELEASE
from base.views.api.api_variant import variant_query
from base.views.api.api_strain import get_isotypes
from base.utils.decorators import jsonify_request
from logzero import logger
... | {
"repo_name": "AndersenLab/cegwas-web",
"path": "base/views/api/api_popgen.py",
"copies": "2",
"size": "2562",
"license": "mit",
"hash": -9218054996295285000,
"line_mean": 34.5972222222,
"line_max": 116,
"alpha_frac": 0.5964090554,
"autogenerated": false,
"ratio": 3.578212290502793,
"config_tes... |
from flask import jsonify
from config import SECRET_KEY, TIMEOUT
import base64, random, time, json, hmac
import redis
from config import RedisHost,RedisPost
from Crypto.Cipher import AES
class Token_Manager(object):
'''
data = {'username':'test','urlrole':'/'}
or something other user's data
'''... | {
"repo_name": "zhxiaohe/starsea",
"path": "cmdb-backend/common/token_manage.py",
"copies": "1",
"size": "3193",
"license": "mit",
"hash": 3904529261420783000,
"line_mean": 27.1327433628,
"line_max": 79,
"alpha_frac": 0.5872916011,
"autogenerated": false,
"ratio": 3.637299771167048,
"config_test... |
from flask import jsonify
from constants import APIStatus
from errors import ParameterError
import datetime
import time
def response(status=APIStatus.SUCCESS, message='', **kwargs):
data = {
'status': status.__int__(),
'message': message
}
if len(kwargs):
data['data'] = kwargs
... | {
"repo_name": "clayz/crazy-quiz-web",
"path": "src/utilities.py",
"copies": "1",
"size": "1308",
"license": "apache-2.0",
"hash": -2431453812010338300,
"line_mean": 22.375,
"line_max": 76,
"alpha_frac": 0.626911315,
"autogenerated": false,
"ratio": 3.7586206896551726,
"config_test": false,
"h... |
from flask import jsonify
from ..exceptions import ValidationError, ConflictError
from . import api
@api.app_errorhandler(ValidationError)
def generic_bad_request(e):
res = jsonify({'status': 400, 'error': 'bad request',
'message': e.args[0]})
res.status_code = 400
return res
@api.app_... | {
"repo_name": "andela-akhenda/maisha-goals",
"path": "app/api_v1/errors.py",
"copies": "1",
"size": "1623",
"license": "mit",
"hash": 6244429607462315000,
"line_mean": 26.05,
"line_max": 72,
"alpha_frac": 0.6105976587,
"autogenerated": false,
"ratio": 3.7224770642201834,
"config_test": false,
... |
from flask import jsonify
from ..exceptions import ValidationError
from . import api
@api.errorhandler(ValidationError)
def bad_request(e):
response = jsonify({'status': 400, 'error': 'bad request',
'message': e.args[0]})
response.status_code = 400
return response
@api.app_errorh... | {
"repo_name": "albertogviana/oreilly-flask-apis-video",
"path": "orders/app/api_v1/errors.py",
"copies": "3",
"size": "1072",
"license": "mit",
"hash": -6332550975567096000,
"line_mean": 29.6285714286,
"line_max": 72,
"alpha_frac": 0.6315298507,
"autogenerated": false,
"ratio": 4,
"config_test"... |
from flask import jsonify
from flask_allows import requires, And
from flask_restful import Resource, reqparse
from opsy.access import HasPermission
from opsy.plugins.monitoring.backends.base import Client, Check, Result, \
Event, Silence, Zone
from opsy.plugins.monitoring.dashboard import Dashboard
from opsy.plugin... | {
"repo_name": "cryptk/opsy",
"path": "opsy/plugins/monitoring/resources.py",
"copies": "1",
"size": "7395",
"license": "mit",
"hash": 6451282769592492000,
"line_mean": 32.3108108108,
"line_max": 76,
"alpha_frac": 0.6462474645,
"autogenerated": false,
"ratio": 3.6975,
"config_test": false,
"ha... |
from flask import jsonify
from flask.blueprints import Blueprint
from flask_api.status import HTTP_202_ACCEPTED, HTTP_206_PARTIAL_CONTENT
from flask_cors.extension import CORS
from flask_jwt import jwt_required, current_identity, JWTError
from flask_restful import Resource, reqparse
from flaskiwsapp.api.v1.schemas.use... | {
"repo_name": "rafasis1986/EngineeringMidLevel",
"path": "flaskiwsapp/api/v1/views/userViews.py",
"copies": "1",
"size": "4427",
"license": "mit",
"hash": -417247375227469000,
"line_mean": 41.9805825243,
"line_max": 129,
"alpha_frac": 0.6857917326,
"autogenerated": false,
"ratio": 3.5933441558441... |
from flask import jsonify
from flask.ext.restful import request, Resource
from app.users.models import User
from app import db, app
import jwt
import datetime
class LoginResource(Resource):
def post(self):
resp = dict()
try:
data = request.get_json(force=True)
email = data.... | {
"repo_name": "russellwmy/speculator",
"path": "server/app/users/resources.py",
"copies": "1",
"size": "1062",
"license": "mit",
"hash": -5349434775236537000,
"line_mean": 33.2580645161,
"line_max": 87,
"alpha_frac": 0.511299435,
"autogenerated": false,
"ratio": 4.425,
"config_test": false,
"... |
from flask import jsonify
from flask.ext.restful import request, Resource
import jwt
import datetime
from app import db, app
from app.users.models import User
class LoginResource(Resource):
def post(self):
resp = dict()
try:
data = request.get_json(force=True)
username = dat... | {
"repo_name": "russellwmy/speculator",
"path": "server/app/auth/resources.py",
"copies": "1",
"size": "1086",
"license": "mit",
"hash": -2357714587761258500,
"line_mean": 34.0322580645,
"line_max": 87,
"alpha_frac": 0.5303867403,
"autogenerated": false,
"ratio": 4.543933054393306,
"config_test"... |
from flask import jsonify
from flask.ext.restful import Resource, reqparse
from .models import Message
class Inbox(Resource):
def get(self):
parser = reqparse.RequestParser()
parser.add_argument('count', type=int, help='Number of results to return')
args = parser.parse_args()
if "... | {
"repo_name": "Grum-Hackdee/grum-web",
"path": "grum/api/inbox.py",
"copies": "1",
"size": "1192",
"license": "mit",
"hash": -422797201741119740,
"line_mean": 29.5897435897,
"line_max": 82,
"alpha_frac": 0.5293624161,
"autogenerated": false,
"ratio": 4.226950354609929,
"config_test": false,
"... |
from flask import jsonify
from flask import abort
from app import app, db, models, remote
def database_add(x):
try:
db.session.add(x)
db.session.commit()
return jsonify( {'success': 'True'} )
except:
return jsonify( {'success': 'False'} )
def get_user_or_return(usernam... | {
"repo_name": "srinathv/myhat",
"path": "app/db_utils.py",
"copies": "2",
"size": "1071",
"license": "mit",
"hash": -3258777654853324300,
"line_mean": 23.3409090909,
"line_max": 79,
"alpha_frac": 0.6218487395,
"autogenerated": false,
"ratio": 3.086455331412104,
"config_test": false,
"has_no_k... |
from flask import jsonify
from flask import abort
from flask import make_response
from flask import request
from flask import url_for
from math import ceil
from data_provider_service import DataProviderService
db_engine = 'mysql+mysqldb://root:supersecure@db/flaskwebapi'
PAGE_SIZE = 2
DATA_PROVIDER = DataProviderS... | {
"repo_name": "CALlanoR/virtual_environments",
"path": "web/api_rest/python_flask/www/middleware.py",
"copies": "1",
"size": "3250",
"license": "apache-2.0",
"hash": 7231295779488052000,
"line_mean": 29.3738317757,
"line_max": 81,
"alpha_frac": 0.6326153846,
"autogenerated": false,
"ratio": 3.910... |
from flask import jsonify
from flask import render_template
from flask import flash
from flask import current_app
from flask import abort
from middleware import candidate_by_id
from middleware import candidate
from middleware import add_candidate
from middleware import update_candidate
from middleware import random_ca... | {
"repo_name": "CALlanoR/virtual_environments",
"path": "web/api_rest/python_flask/www/routes.py",
"copies": "1",
"size": "4616",
"license": "apache-2.0",
"hash": 5852652538813213000,
"line_mean": 40.5855855856,
"line_max": 113,
"alpha_frac": 0.6694107452,
"autogenerated": false,
"ratio": 3.713596... |
from flask import jsonify
from flask import render_template
from flask import flash
from flask import current_app
from flask import make_response
from flask import abort
from flask import request
from middleware import candidate_by_id
from middleware import candidate
from middleware import add_candidate
from middlewar... | {
"repo_name": "BartGo/flask-drafts",
"path": "app/examples/lynda-webapiflask/routes.py",
"copies": "1",
"size": "5163",
"license": "mit",
"hash": 1408481174217160000,
"line_mean": 36.4130434783,
"line_max": 113,
"alpha_frac": 0.6749951579,
"autogenerated": false,
"ratio": 3.709051724137931,
"co... |
from flask import jsonify
from flask import render_template, session, redirect, url_for, current_app, request
from .. import db
from ..models import Account, Doc, DataSrc
from . import main
from pymongo import MongoClient
#go to homepage
@main.route('/', methods=['GET', 'POST'])
def home():
if 'account_id' in session... | {
"repo_name": "Justyer/NightHeartDataPlatform",
"path": "firefly/app/main/views.py",
"copies": "1",
"size": "1777",
"license": "mit",
"hash": -7847595813507416000,
"line_mean": 30.75,
"line_max": 83,
"alpha_frac": 0.7101857062,
"autogenerated": false,
"ratio": 3.032423208191126,
"config_test": ... |
from flask import jsonify
from flask import request
from flask.ext.autodoc import Autodoc
from app import app
from models import magnet, website
auto = Autodoc(app)
@app.route('/site/delete/<site>', methods=["delete"])
@auto.doc()
def site_delete(site):
""" Deletes all data associated with the requested site ho... | {
"repo_name": "andychase/classwork",
"path": "cs496/assignment_3/views.py",
"copies": "1",
"size": "2464",
"license": "mit",
"hash": 2311713459927572000,
"line_mean": 24.1428571429,
"line_max": 72,
"alpha_frac": 0.5669642857,
"autogenerated": false,
"ratio": 3.5555555555555554,
"config_test": f... |
from flask import jsonify
from flask import request
from flask import Response
from flask import stream_with_context
import hmac
import hashlib
from functools import wraps
from functools import update_wrapper
import time
import json
import base64
import datetime
import core.util.debug as debug
import core.util.extras ... | {
"repo_name": "oskgeek/liftpass",
"path": "core/util/rest.py",
"copies": "1",
"size": "5432",
"license": "apache-2.0",
"hash": -849220627727709700,
"line_mean": 32.1219512195,
"line_max": 138,
"alpha_frac": 0.7251472754,
"autogenerated": false,
"ratio": 3.685210312075984,
"config_test": false,
... |
from flask import jsonify
from flask import request
from flask_restful import Resource
from oeda.crowdnav_config import Config
import traceback
import json
class CrowdNavConfigController(Resource):
@staticmethod
def get():
try:
knobs = json.loads(open('oeda/crowdnav_config/knobs.json').rea... | {
"repo_name": "Starofall/OEDA",
"path": "Backend/oeda/controller/crowdnav_configuration.py",
"copies": "1",
"size": "1367",
"license": "mit",
"hash": 7732847255277625000,
"line_mean": 40.4242424242,
"line_max": 178,
"alpha_frac": 0.6239941478,
"autogenerated": false,
"ratio": 4.339682539682539,
... |
from flask import jsonify
from flask import request
from models import User
from sqlalchemy import exc
from os import sys
import logging
def user_details(userid):
"""
Return basic user information based on the user ID.
Args:
userid: User ID
Return:
JSON with all the user iformation.
... | {
"repo_name": "devraccoon/platypus",
"path": "platypus/server/views.py",
"copies": "1",
"size": "2950",
"license": "bsd-3-clause",
"hash": -9040926661195446000,
"line_mean": 23.5833333333,
"line_max": 71,
"alpha_frac": 0.5966101695,
"autogenerated": false,
"ratio": 3.98110661268556,
"config_tes... |
from flask import jsonify
from flask import request
from myhvac_core.db import api as db
from myhvac_core.db import models
from myhvac_core import system_state as sstate
from myhvac_core import temp
from app import app
from myhvac_web.myhvac_service import api as srvc_api
import logging
from datetime import datetime,... | {
"repo_name": "alanquillin/myhvac_web",
"path": "myhvac_web/rest.py",
"copies": "1",
"size": "5112",
"license": "apache-2.0",
"hash": -5547074441345384000,
"line_mean": 39.896,
"line_max": 119,
"alpha_frac": 0.558685446,
"autogenerated": false,
"ratio": 4.231788079470198,
"config_test": false,
... |
from flask import jsonify
from flask_login import login_required, current_user
from sixquiprend.models.game import Game
from sixquiprend.sixquiprend import app
@app.route('/games/<int:game_id>/status')
@login_required
def get_game_status(game_id):
"""Get status for a game. Used to know when to choose cards
for... | {
"repo_name": "nyddogghr/SixQuiPrend",
"path": "sixquiprend/routes/games_turn.py",
"copies": "1",
"size": "2231",
"license": "mit",
"hash": -6174599442630963000,
"line_mean": 43.62,
"line_max": 92,
"alpha_frac": 0.7090990587,
"autogenerated": false,
"ratio": 3.2380261248185778,
"config_test": f... |
from flask import jsonify
from flaskmob import app, db
from flask_restful import Resource, Api
api = Api(app)
class Pokeymon(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String, unique=True)
color = db.Column(db.String)
def __init__(self, name, color=None):
if n... | {
"repo_name": "orlandopython/Flask-Mob",
"path": "flaskmob/api.py",
"copies": "1",
"size": "1150",
"license": "mit",
"hash": 3217324129681257000,
"line_mean": 25.1363636364,
"line_max": 68,
"alpha_frac": 0.6391304348,
"autogenerated": false,
"ratio": 3.2577903682719547,
"config_test": false,
... |
from flask import jsonify
from flask_modular_auth import privilege_required, RolePrivilege, AuthenticatedPrivilege, current_authenticated_entity
from mass_flask_api.config import api_blueprint
from mass_flask_core.models import User
from .base import BaseResource
from mass_flask_api.utils import get_pagination_compati... | {
"repo_name": "mass-project/mass_server",
"path": "mass_flask_api/resources/analysis_system_instance.py",
"copies": "1",
"size": "6611",
"license": "mit",
"hash": -2835364522023753700,
"line_mean": 42.7814569536,
"line_max": 162,
"alpha_frac": 0.6085312358,
"autogenerated": false,
"ratio": 5.2593... |
from flask import jsonify
from flask_restful import marshal, \
reqparse, Resource
from app import db
from models import User
from serializers import users_serializer
class RegisterUser(Resource):
""" Defines endpoint for User registration
method: POST
url: /api/v1/auth/register
"""
... | {
"repo_name": "andela-jmuli/live-it",
"path": "app/users.py",
"copies": "1",
"size": "2747",
"license": "mit",
"hash": -5645061334702246000,
"line_mean": 32.5,
"line_max": 77,
"alpha_frac": 0.5387695668,
"autogenerated": false,
"ratio": 5.096474953617811,
"config_test": false,
"has_no_keyword... |
from flask import jsonify
from flask_restful import Resource
import oeda.controller.stages as sc
from oeda.databases import db
import json as json
import traceback
from oeda.controller.experiment_results import get_all_stage_data
from oeda.log import *
globalDict = dict()
class RunningAllStageResultsWithExperimentId... | {
"repo_name": "Starofall/OEDA",
"path": "Backend/oeda/controller/running_experiment_results.py",
"copies": "1",
"size": "2803",
"license": "mit",
"hash": -1161613464578207000,
"line_mean": 33.1829268293,
"line_max": 134,
"alpha_frac": 0.6050660007,
"autogenerated": false,
"ratio": 4.2793893129770... |
from flask import jsonify
from flask_restful import Resource
import oeda.controller.stages as sc
import json as json
import traceback
from oeda.databases import db
class StageResultsWithExperimentIdController(Resource):
@staticmethod
def get(experiment_id, stage_no):
try:
res = db().get_d... | {
"repo_name": "Starofall/OEDA",
"path": "Backend/oeda/controller/experiment_results.py",
"copies": "1",
"size": "1631",
"license": "mit",
"hash": -2509553237232620000,
"line_mean": 29.2037037037,
"line_max": 90,
"alpha_frac": 0.6002452483,
"autogenerated": false,
"ratio": 4.057213930348259,
"co... |
from flask import jsonify
from flask_restful import Resource, reqparse
from api.sql.models import * #import all of the models from models.py
from api.parse_json import * #for json request parsing
class manageUser(Resource):
def get(self, _username_):
try:
x = user_data.query.filter_by(username... | {
"repo_name": "devopsec/threatdetectionservice",
"path": "api/user/endpoint.py",
"copies": "1",
"size": "10737",
"license": "apache-2.0",
"hash": -6150976144974367000,
"line_mean": 44.8846153846,
"line_max": 112,
"alpha_frac": 0.4922231536,
"autogenerated": false,
"ratio": 4.804026845637584,
"c... |
from flask import jsonify
from flask_restful import Resource, reqparse
from sqlalchemy import exc
from app import db
from app.models import Url
parser = reqparse.RequestParser()
parser.add_argument('url')
parser.add_argument('count', default = 25, type = int)
parser.add_argument('page', default = 1, type = int)
parser... | {
"repo_name": "martydill/url_shortener",
"path": "code/app/resources/urls.py",
"copies": "1",
"size": "1290",
"license": "mit",
"hash": -6207257705801804000,
"line_mean": 30.4634146341,
"line_max": 93,
"alpha_frac": 0.6565891473,
"autogenerated": false,
"ratio": 3.675213675213675,
"config_test"... |
from flask import jsonify
from flask_restplus import inputs
from flexget.api import APIResource, api
from flexget.api.app import BadRequest, NotFoundError, etag
from flexget.components.thetvdb.api_tvdb import lookup_episode, lookup_series, search_for_series
tvdb_api = api.namespace('tvdb', description='TheTVDB Shows'... | {
"repo_name": "malkavi/Flexget",
"path": "flexget/components/thetvdb/api.py",
"copies": "1",
"size": "9063",
"license": "mit",
"hash": -4504073327290184000,
"line_mean": 33.2,
"line_max": 104,
"alpha_frac": 0.5458457464,
"autogenerated": false,
"ratio": 3.893041237113402,
"config_test": false,
... |
from flask import jsonify
from flask_restplus import inputs
from flexget.api import APIResource, api
from flexget.api.app import BadRequest, NotFoundError, etag
from flexget.components.tvmaze.api_tvmaze import APITVMaze
tvmaze_api = api.namespace('tvmaze', description='TVMaze Shows')
class ObjectsContainer:
act... | {
"repo_name": "malkavi/Flexget",
"path": "flexget/components/tvmaze/api.py",
"copies": "1",
"size": "6377",
"license": "mit",
"hash": -452003728093796350,
"line_mean": 32.920212766,
"line_max": 92,
"alpha_frac": 0.5105849145,
"autogenerated": false,
"ratio": 3.7227086981903095,
"config_test": f... |
from flask import jsonify
from flask_restplus import inputs
from flexget.api import APIResource, api
from flexget.api.app import (
BadRequest,
NotFoundError,
base_message_schema,
empty_response,
success_response,
)
irc_api = api.namespace('irc', description='View and manage IRC connections')
irc_... | {
"repo_name": "malkavi/Flexget",
"path": "flexget/components/irc/api.py",
"copies": "1",
"size": "3966",
"license": "mit",
"hash": 8896741495720938000,
"line_mean": 30.4761904762,
"line_max": 97,
"alpha_frac": 0.6306101866,
"autogenerated": false,
"ratio": 3.9267326732673267,
"config_test": fal... |
from flask import jsonify
from flask_restplus import inputs
from flexget import plugin
from flexget.api import APIResource, api
from flexget.api.app import BadRequest, NotFoundError, etag
tmdb_api = api.namespace('tmdb', description='TMDB lookup endpoint')
class ObjectsContainer:
poster_object = {
'type... | {
"repo_name": "malkavi/Flexget",
"path": "flexget/components/tmdb/api.py",
"copies": "1",
"size": "5011",
"license": "mit",
"hash": 5778149987705266000,
"line_mean": 32.8581081081,
"line_max": 97,
"alpha_frac": 0.5282378767,
"autogenerated": false,
"ratio": 3.728422619047619,
"config_test": fal... |
from flask import jsonify
from flask_restx import inputs
from flexget.api import APIResource, api
from flexget.api.app import BadRequest, NotFoundError, etag
from flexget.components.thetvdb.api_tvdb import lookup_episode, lookup_series, search_for_series
tvdb_api = api.namespace('tvdb', description='TheTVDB Shows')
... | {
"repo_name": "ianstalk/Flexget",
"path": "flexget/components/thetvdb/api.py",
"copies": "2",
"size": "9060",
"license": "mit",
"hash": -1832805743258275600,
"line_mean": 33.1886792453,
"line_max": 104,
"alpha_frac": 0.5456953642,
"autogenerated": false,
"ratio": 3.8917525773195876,
"config_tes... |
from flask import jsonify
from flask_restx import inputs
from flexget.api import APIResource, api
from flexget.api.app import BadRequest, NotFoundError, etag
from flexget.components.tvmaze.api_tvmaze import APITVMaze
tvmaze_api = api.namespace('tvmaze', description='TVMaze Shows')
class ObjectsContainer:
actor_... | {
"repo_name": "Flexget/Flexget",
"path": "flexget/components/tvmaze/api.py",
"copies": "2",
"size": "6374",
"license": "mit",
"hash": 633631338668199400,
"line_mean": 32.9042553191,
"line_max": 92,
"alpha_frac": 0.5103545654,
"autogenerated": false,
"ratio": 3.7209573847051955,
"config_test": f... |
from flask import jsonify
from flask_restx import inputs
from flexget.api import APIResource, api
from flexget.api.app import (
BadRequest,
NotFoundError,
base_message_schema,
empty_response,
success_response,
)
irc_api = api.namespace('irc', description='View and manage IRC connections')
irc_par... | {
"repo_name": "Flexget/Flexget",
"path": "flexget/components/irc/api.py",
"copies": "2",
"size": "3963",
"license": "mit",
"hash": 1298879095578723800,
"line_mean": 30.4523809524,
"line_max": 97,
"alpha_frac": 0.6303305577,
"autogenerated": false,
"ratio": 3.9237623762376237,
"config_test": fal... |
from flask import jsonify
from flask_restx import inputs
from flexget import plugin
from flexget.api import APIResource, api
from flexget.api.app import BadRequest, NotFoundError, etag
tmdb_api = api.namespace('tmdb', description='TMDB lookup endpoint')
class ObjectsContainer:
poster_object = {
'type': ... | {
"repo_name": "ianstalk/Flexget",
"path": "flexget/components/tmdb/api.py",
"copies": "2",
"size": "5008",
"license": "mit",
"hash": 6849651799074813000,
"line_mean": 32.8378378378,
"line_max": 97,
"alpha_frac": 0.5279552716,
"autogenerated": false,
"ratio": 3.7261904761904763,
"config_test": f... |
from flask import jsonify
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy import Table, Column, Integer, ForeignKey
from src.webservice.base import Base
from src.webservice._action import Action
db = SQLAlchemy()
Base.query = db.session.query_property()
class Input(Base):
__tablename__ = 'tbl_InputPin'
... | {
"repo_name": "deklungel/iRulez",
"path": "src/webservice/_inputPin.py",
"copies": "1",
"size": "1909",
"license": "mit",
"hash": 601358957322712300,
"line_mean": 35.7115384615,
"line_max": 121,
"alpha_frac": 0.6181246726,
"autogenerated": false,
"ratio": 3.848790322580645,
"config_test": false... |
from flask import jsonify
from flask_sqlalchemy import SQLAlchemy
from src.webservice.base import Base
from src.webservice._notification import Notification
from src.webservice._outputPin import Output
db = SQLAlchemy()
Base.query = db.session.query_property()
class Action(Base):
__tablename__ = 'tbl_Action'
... | {
"repo_name": "deklungel/iRulez",
"path": "src/webservice/_action.py",
"copies": "1",
"size": "8540",
"license": "mit",
"hash": -3588025226868468700,
"line_mean": 43.9473684211,
"line_max": 121,
"alpha_frac": 0.5791569087,
"autogenerated": false,
"ratio": 4.086124401913875,
"config_test": false... |
from flask import jsonify
from flask_sqlalchemy import SQLAlchemy
from src.webservice.base import Base
db = SQLAlchemy()
Base.query = db.session.query_property()
class Action_Type(Base):
__tablename__ = 'tbl_Action_Type'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(50))
@s... | {
"repo_name": "deklungel/iRulez",
"path": "src/webservice/_action_type.py",
"copies": "1",
"size": "1034",
"license": "mit",
"hash": -3460597347459560400,
"line_mean": 33.5,
"line_max": 86,
"alpha_frac": 0.6411992263,
"autogenerated": false,
"ratio": 3.6537102473498235,
"config_test": false,
... |
from flask import jsonify
from flask_sqlalchemy import SQLAlchemy
from src.webservice.base import Base
db = SQLAlchemy()
Base.query = db.session.query_property()
class Device(Base):
__tablename__ = 'tbl_Arduino'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(50))
mac = db.Col... | {
"repo_name": "deklungel/iRulez",
"path": "src/webservice/_device.py",
"copies": "1",
"size": "2190",
"license": "mit",
"hash": 4422230600418959400,
"line_mean": 33.21875,
"line_max": 111,
"alpha_frac": 0.5936073059,
"autogenerated": false,
"ratio": 3.7758620689655173,
"config_test": false,
"... |
from flask import jsonify
from flask_sqlalchemy import SQLAlchemy
from src.webservice.base import Base
db = SQLAlchemy()
Base.query = db.session.query_property()
class Group(Base):
__tablename__ = 'tbl_Groups'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(50))
users = db.rel... | {
"repo_name": "deklungel/iRulez",
"path": "src/webservice/_group.py",
"copies": "1",
"size": "1951",
"license": "mit",
"hash": 1875715905611149600,
"line_mean": 28.1194029851,
"line_max": 79,
"alpha_frac": 0.5884161968,
"autogenerated": false,
"ratio": 3.9414141414141413,
"config_test": false,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.