index int64 | repo_name string | branch_name string | path string | content string | import_graph string |
|---|---|---|---|---|---|
83,838 | Core-coders/Angadi | refs/heads/main | /mainapp/admin.py | from django.contrib import admin
from .models import User
# Register your models here.
class UserImp(admin.ModelAdmin):
list_display = ('username','user_type' )
admin.site.register(User, UserImp) | {"/mainapp/Views/ration.py": ["/mainapp/forms.py"], "/survey/forms.py": ["/survey/models.py"], "/mainapp/admin.py": ["/mainapp/models.py"], "/mainapp/Views/user.py": ["/mainapp/forms.py"], "/mainapp/Views/food.py": ["/mainapp/forms.py"], "/survey/views.py": ["/survey/forms.py", "/survey/models.py"]} |
83,839 | Core-coders/Angadi | refs/heads/main | /mainapp/urls.py | from django.urls import path,include
# from .Views import site, provider
from . import views
from .Views import food,ration,user
from . import views
urlpatterns = [
path('',views.Indexview, name="Home"),
path('depot/dashboard/', views.depodashview),
path('shop/dashboard/', views.shopdashview),
path('ac... | {"/mainapp/Views/ration.py": ["/mainapp/forms.py"], "/survey/forms.py": ["/survey/models.py"], "/mainapp/admin.py": ["/mainapp/models.py"], "/mainapp/Views/user.py": ["/mainapp/forms.py"], "/mainapp/Views/food.py": ["/mainapp/forms.py"], "/survey/views.py": ["/survey/forms.py", "/survey/models.py"]} |
83,840 | Core-coders/Angadi | refs/heads/main | /survey/models.py | from django.db import models
item =(
("1", "Raw Rice"),
("2", "Wheat"),
("3", "Sugar"),
("4", "Atta"),
("5", "Urad dal"),
("6", "Rava"),
("7", "Coconut oil"),
("8", "Sunflower oil"),
("9", "Salt"),
("10", "Green gram"),
("11", "Black chana"),
("12", "Chilly po... | {"/mainapp/Views/ration.py": ["/mainapp/forms.py"], "/survey/forms.py": ["/survey/models.py"], "/mainapp/admin.py": ["/mainapp/models.py"], "/mainapp/Views/user.py": ["/mainapp/forms.py"], "/mainapp/Views/food.py": ["/mainapp/forms.py"], "/survey/views.py": ["/survey/forms.py", "/survey/models.py"]} |
83,841 | Core-coders/Angadi | refs/heads/main | /mainapp/Views/user.py | from allauth.account.views import SignupView
from ..forms import UserSignupForm
class UserSignupRegistrationView(SignupView):
template_name = 'account/signup.html'
form_class = UserSignupForm
success_url = None
def get_context_data(self, **kwargs):
ret = super(UserSignupRegistrationView, self)... | {"/mainapp/Views/ration.py": ["/mainapp/forms.py"], "/survey/forms.py": ["/survey/models.py"], "/mainapp/admin.py": ["/mainapp/models.py"], "/mainapp/Views/user.py": ["/mainapp/forms.py"], "/mainapp/Views/food.py": ["/mainapp/forms.py"], "/survey/views.py": ["/survey/forms.py", "/survey/models.py"]} |
83,842 | Core-coders/Angadi | refs/heads/main | /mainapp/Views/food.py | from allauth.account.views import SignupView
from ..forms import FoodSignupForm
class FoodUserRegistrationView(SignupView):
template_name = 'account/signup_organiser.html'
form_class = FoodSignupForm
success_url = None
def get_context_data(self, **kwargs):
ret = super(FoodUserRegistration... | {"/mainapp/Views/ration.py": ["/mainapp/forms.py"], "/survey/forms.py": ["/survey/models.py"], "/mainapp/admin.py": ["/mainapp/models.py"], "/mainapp/Views/user.py": ["/mainapp/forms.py"], "/mainapp/Views/food.py": ["/mainapp/forms.py"], "/survey/views.py": ["/survey/forms.py", "/survey/models.py"]} |
83,843 | Core-coders/Angadi | refs/heads/main | /survey/views.py | from django.shortcuts import render,redirect
from .forms import ItemForm
from .models import Survey
from django import forms
# Create your views here.
def survey_view(request):
my_form = ItemForm()
if request.method == 'POST':
my_form = ItemForm(request.POST)
if my_form.is_valid():
... | {"/mainapp/Views/ration.py": ["/mainapp/forms.py"], "/survey/forms.py": ["/survey/models.py"], "/mainapp/admin.py": ["/mainapp/models.py"], "/mainapp/Views/user.py": ["/mainapp/forms.py"], "/mainapp/Views/food.py": ["/mainapp/forms.py"], "/survey/views.py": ["/survey/forms.py", "/survey/models.py"]} |
83,844 | Core-coders/Angadi | refs/heads/main | /mainapp/forms.py | from allauth.account.forms import SignupForm
class UserSignupForm(SignupForm):
def save(self, request):
user = super(UserSignupForm, self).save(request)
user.ration_no = self.cleaned_data.get('ration_no')
user.save()
return user
class RationSignupForm(SignupForm):
def save(sel... | {"/mainapp/Views/ration.py": ["/mainapp/forms.py"], "/survey/forms.py": ["/survey/models.py"], "/mainapp/admin.py": ["/mainapp/models.py"], "/mainapp/Views/user.py": ["/mainapp/forms.py"], "/mainapp/Views/food.py": ["/mainapp/forms.py"], "/survey/views.py": ["/survey/forms.py", "/survey/models.py"]} |
83,845 | Core-coders/Angadi | refs/heads/main | /mainapp/views.py | from django.shortcuts import render
# Create your views here.
def Indexview(request):
return render(request,'account/home.html',{})
def depodashview(request):
return render(request,'Depot/depotdashboard.html',{})
def shopdashview(request):
return render(request,'shop/shopdashboard.html',{})
| {"/mainapp/Views/ration.py": ["/mainapp/forms.py"], "/survey/forms.py": ["/survey/models.py"], "/mainapp/admin.py": ["/mainapp/models.py"], "/mainapp/Views/user.py": ["/mainapp/forms.py"], "/mainapp/Views/food.py": ["/mainapp/forms.py"], "/survey/views.py": ["/survey/forms.py", "/survey/models.py"]} |
83,859 | zxins/zxins | refs/heads/master | /app/blog/gunicorn_config.py | # -*- coding: utf-8 -*-
from app.blog.blog_config import app_port
bind = "0.0.0.0:{port}".format(port=app_port)
workers = 1
worker_class = "gevent" | {"/app/blog/gunicorn_config.py": ["/app/blog/blog_config.py"], "/app/blog/controller/controller.py": ["/app/blog/entity/article_cls.py", "/repository/mysql/__init__.py", "/repository/mysql/article_rep.py"], "/repository/mysql/article_rep.py": ["/app/blog/entity/article_cls.py", "/repository/mysql/__init__.py"], "/app/b... |
83,860 | zxins/zxins | refs/heads/master | /app/blog/entity/article_cls.py | # -*- coding: utf-8 -*-
from schemer import Schema
class Article(object):
""" 文章类 """
def __init__(self, **kwargs):
"""
:param author: 作者
:param title: 标题
:param content: 内容
:param label: 标签
"""
param_schema = Schema({
'id': {'type': b... | {"/app/blog/gunicorn_config.py": ["/app/blog/blog_config.py"], "/app/blog/controller/controller.py": ["/app/blog/entity/article_cls.py", "/repository/mysql/__init__.py", "/repository/mysql/article_rep.py"], "/repository/mysql/article_rep.py": ["/app/blog/entity/article_cls.py", "/repository/mysql/__init__.py"], "/app/b... |
83,861 | zxins/zxins | refs/heads/master | /app/blog/controller/forms.py | # -*- coding: utf-8 -*-
from flask_wtf import FlaskForm
from wtforms import StringField, TextAreaField, SubmitField
from wtforms.validators import DataRequired
class UserForm(FlaskForm):
account = StringField(u'用户名:', validators=[DataRequired()])
passwd = StringField(u'密码:', validators=[DataRequired()])
su... | {"/app/blog/gunicorn_config.py": ["/app/blog/blog_config.py"], "/app/blog/controller/controller.py": ["/app/blog/entity/article_cls.py", "/repository/mysql/__init__.py", "/repository/mysql/article_rep.py"], "/repository/mysql/article_rep.py": ["/app/blog/entity/article_cls.py", "/repository/mysql/__init__.py"], "/app/b... |
83,862 | zxins/zxins | refs/heads/master | /app/blog/controller/controller.py | # -*- coding: utf-8 -*-
import traceback
from schemer import Schema
from app.blog.entity.article_cls import Article
from repository.mysql import get_session
from repository.mysql.article_rep import ArticleRepository
class Controller(object):
def __init__(self):
pass
def find_all(self):
"""... | {"/app/blog/gunicorn_config.py": ["/app/blog/blog_config.py"], "/app/blog/controller/controller.py": ["/app/blog/entity/article_cls.py", "/repository/mysql/__init__.py", "/repository/mysql/article_rep.py"], "/repository/mysql/article_rep.py": ["/app/blog/entity/article_cls.py", "/repository/mysql/__init__.py"], "/app/b... |
83,863 | zxins/zxins | refs/heads/master | /repository/mysql/__init__.py | # -*- coding: utf-8 -*-
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.automap import automap_base
from config import MYSQL_PASS, MYSQL_USER, MYSQL_HOST
Base = automap_base()
# 数据库连接
MYSQL_CONN = 'mysql+mysqldb://{0}:{1}@{2}/Blog?charset=utf8'.format(MYSQL_USER, MYS... | {"/app/blog/gunicorn_config.py": ["/app/blog/blog_config.py"], "/app/blog/controller/controller.py": ["/app/blog/entity/article_cls.py", "/repository/mysql/__init__.py", "/repository/mysql/article_rep.py"], "/repository/mysql/article_rep.py": ["/app/blog/entity/article_cls.py", "/repository/mysql/__init__.py"], "/app/b... |
83,864 | zxins/zxins | refs/heads/master | /config/dev.py | # -*- coding: utf-8 -*-
# mysql数据库配置
MYSQL_HOST = 'localhost'
MYSQL_USER = 'root'
MYSQL_PASS = 'Zx3620382.'
| {"/app/blog/gunicorn_config.py": ["/app/blog/blog_config.py"], "/app/blog/controller/controller.py": ["/app/blog/entity/article_cls.py", "/repository/mysql/__init__.py", "/repository/mysql/article_rep.py"], "/repository/mysql/article_rep.py": ["/app/blog/entity/article_cls.py", "/repository/mysql/__init__.py"], "/app/b... |
83,865 | zxins/zxins | refs/heads/master | /app/blog/blog_config.py | # -*- coding: utf-8 -*-
from flask import Flask
from flask_bootstrap import Bootstrap
from flask_ckeditor import CKEditor
app = Flask(__name__)
app.secret_key = 'key-secret-zxins'
app.config['CKEDITOR_SERVE_LOCAL'] = True
app.config['CKEDITOR_HEIGHT'] = 400
app.config['CKEDITOR_ENABLE_MARKDOWN'] = True # enable markd... | {"/app/blog/gunicorn_config.py": ["/app/blog/blog_config.py"], "/app/blog/controller/controller.py": ["/app/blog/entity/article_cls.py", "/repository/mysql/__init__.py", "/repository/mysql/article_rep.py"], "/repository/mysql/article_rep.py": ["/app/blog/entity/article_cls.py", "/repository/mysql/__init__.py"], "/app/b... |
83,866 | zxins/zxins | refs/heads/master | /repository/mysql/article_rep.py | # -*- coding: utf-8 -*-
from sqlalchemy.orm.exc import NoResultFound
from app.blog.entity.article_cls import Article
from repository.mysql import get_session, ArticleModel
class ArticleRepository(object):
def __init__(self, session=None):
self.session = session or get_session()
# 决定是否自己销毁session... | {"/app/blog/gunicorn_config.py": ["/app/blog/blog_config.py"], "/app/blog/controller/controller.py": ["/app/blog/entity/article_cls.py", "/repository/mysql/__init__.py", "/repository/mysql/article_rep.py"], "/repository/mysql/article_rep.py": ["/app/blog/entity/article_cls.py", "/repository/mysql/__init__.py"], "/app/b... |
83,867 | zxins/zxins | refs/heads/master | /app/__init__.py | # -*- coding: utf-8 -*-
from flask import jsonify
class RestResponse(object):
""" 标准的接口Response类, 所有的api必须返回这个类的对象, 以便统一处理返回 """
def __init__(self, language=None):
self.language = language or "en"
def fail(self, code=500, message="Server Got A Exception"):
d = {'meta': {
's... | {"/app/blog/gunicorn_config.py": ["/app/blog/blog_config.py"], "/app/blog/controller/controller.py": ["/app/blog/entity/article_cls.py", "/repository/mysql/__init__.py", "/repository/mysql/article_rep.py"], "/repository/mysql/article_rep.py": ["/app/blog/entity/article_cls.py", "/repository/mysql/__init__.py"], "/app/b... |
83,868 | zxins/zxins | refs/heads/master | /app/blog/views/index.py | # -*- coding: utf-8 -*-
from flask import render_template
from app.blog.blog_config import app
from app.blog.controller.forms import EditorForm
from app.blog.controller.controller import Controller
@app.route('/', methods=['GET'])
def index():
con = Controller()
hot = con.find_hot()
items = con.find_all(... | {"/app/blog/gunicorn_config.py": ["/app/blog/blog_config.py"], "/app/blog/controller/controller.py": ["/app/blog/entity/article_cls.py", "/repository/mysql/__init__.py", "/repository/mysql/article_rep.py"], "/repository/mysql/article_rep.py": ["/app/blog/entity/article_cls.py", "/repository/mysql/__init__.py"], "/app/b... |
83,869 | zxins/zxins | refs/heads/master | /blog_server.py | # -*- coding: utf-8 -*-
from app.blog.views.index import *
from app.blog.blog_config import app, app_host, app_port
if __name__ == '__main__':
app.run(host=app_host, port=int(app_port))
| {"/app/blog/gunicorn_config.py": ["/app/blog/blog_config.py"], "/app/blog/controller/controller.py": ["/app/blog/entity/article_cls.py", "/repository/mysql/__init__.py", "/repository/mysql/article_rep.py"], "/repository/mysql/article_rep.py": ["/app/blog/entity/article_cls.py", "/repository/mysql/__init__.py"], "/app/b... |
83,874 | lint-ai/vibora | refs/heads/master | /tests/router/prefixes.py | from vibora import Vibora, TestSuite
from vibora.blueprints import Blueprint
from vibora.responses import JsonResponse
class RouterPrefixesTestCase(TestSuite):
async def test_root_route_expect_registered(self):
data = {'hello': 'world'}
app = Vibora()
@app.route('/asd', methods=['GET'])
... | {"/tests/router/prefixes.py": ["/vibora/__init__.py", "/vibora/blueprints.py"], "/tests/timeouts.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/limits.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/templates/extensions.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/helpers.py": ["/vibor... |
83,875 | lint-ai/vibora | refs/heads/master | /tests/timeouts.py | import asyncio
from vibora import Vibora
from vibora.limits import RouteLimits
from vibora.tests import TestSuite
from vibora.responses import Response, StreamingResponse
class TimeoutsTestCase(TestSuite):
async def test_simple_case_expects_timeout_response(self):
app = Vibora()
@app.route('/', ... | {"/tests/router/prefixes.py": ["/vibora/__init__.py", "/vibora/blueprints.py"], "/tests/timeouts.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/limits.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/templates/extensions.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/helpers.py": ["/vibor... |
83,876 | lint-ai/vibora | refs/heads/master | /tests/limits.py | from vibora import Vibora
from vibora.responses import Response
from vibora.request import Request
from vibora.tests import TestSuite
from vibora.limits import ServerLimits, RouteLimits
class LimitTestCase(TestSuite):
async def test_body_smaller_than_limit_expects_200(self):
app = Vibora(route_limits=Rout... | {"/tests/router/prefixes.py": ["/vibora/__init__.py", "/vibora/blueprints.py"], "/tests/timeouts.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/limits.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/templates/extensions.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/helpers.py": ["/vibor... |
83,877 | lint-ai/vibora | refs/heads/master | /tests/templates/extensions.py | from vibora import Vibora, Response
from vibora.tests import TestSuite
from vibora.templates import Template
class ViboraExtensionSuiteCase(TestSuite):
def setUp(self):
self.app = Vibora()
@self.app.route('/')
async def home():
return Response(b'')
self.app.initialize... | {"/tests/router/prefixes.py": ["/vibora/__init__.py", "/vibora/blueprints.py"], "/tests/timeouts.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/limits.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/templates/extensions.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/helpers.py": ["/vibor... |
83,878 | lint-ai/vibora | refs/heads/master | /tests/helpers.py | from vibora import Vibora
from vibora.tests import TestSuite
from vibora.responses import Response
class UrlForTestSuite(TestSuite):
def setUp(self):
self.app = Vibora()
@self.app.route('/123')
async def home():
return Response(b'')
self.app.initialize(debug=True)
... | {"/tests/router/prefixes.py": ["/vibora/__init__.py", "/vibora/blueprints.py"], "/tests/timeouts.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/limits.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/templates/extensions.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/helpers.py": ["/vibor... |
83,879 | lint-ai/vibora | refs/heads/master | /tests/responses.py | import ujson
from unittest import TestCase
from vibora.responses import JsonResponse, Response
from vibora.cookies import Cookie
class AttributesTestCase(TestCase):
"""
It's important to be able to access common attributes
like cookies, headers from Python
"""
def test_json_response_attributes(se... | {"/tests/router/prefixes.py": ["/vibora/__init__.py", "/vibora/blueprints.py"], "/tests/timeouts.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/limits.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/templates/extensions.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/helpers.py": ["/vibor... |
83,880 | lint-ai/vibora | refs/heads/master | /tests/client/keep_alive.py | from vibora.tests import TestSuite
from vibora import Vibora
from vibora.client import Session
from vibora.utils import wait_server_offline
class KeepAliveTestCase(TestSuite):
async def test_connection_pool_recycling_connections(self):
v = Vibora()
address, port = '127.0.0.1', 65530
with S... | {"/tests/router/prefixes.py": ["/vibora/__init__.py", "/vibora/blueprints.py"], "/tests/timeouts.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/limits.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/templates/extensions.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/helpers.py": ["/vibor... |
83,881 | lint-ai/vibora | refs/heads/master | /vibora/application.py | import os
from tempfile import gettempdir
from typing import Callable, Type
from collections import defaultdict
from inspect import stack
from .request import Request
from .blueprints import Blueprint
from .router import Router, Route, RouterStrategy, RouteLimits
from .protocol import Connection
from .components import... | {"/tests/router/prefixes.py": ["/vibora/__init__.py", "/vibora/blueprints.py"], "/tests/timeouts.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/limits.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/templates/extensions.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/helpers.py": ["/vibor... |
83,882 | lint-ai/vibora | refs/heads/master | /vibora/tests.py | import unittest
import asyncio
from inspect import iscoroutinefunction
def wrapper(f):
def async_runner(*args, **kwargs):
loop = asyncio.get_event_loop()
loop.run_until_complete(f(*args, **kwargs))
loop.stop()
loop.run_forever()
return async_runner
class TestSuite(unittest.T... | {"/tests/router/prefixes.py": ["/vibora/__init__.py", "/vibora/blueprints.py"], "/tests/timeouts.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/limits.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/templates/extensions.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/helpers.py": ["/vibor... |
83,883 | lint-ai/vibora | refs/heads/master | /vibora/workers/handler.py | import asyncio
import signal
from socket import (
IPPROTO_TCP,
TCP_NODELAY,
SO_REUSEADDR,
SOL_SOCKET,
SO_REUSEPORT,
socket,
)
from multiprocessing import Process
from functools import partial
from .reaper import Reaper
from ..hooks import Events
from ..utils import asynclib
class RequestHandle... | {"/tests/router/prefixes.py": ["/vibora/__init__.py", "/vibora/blueprints.py"], "/tests/timeouts.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/limits.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/templates/extensions.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/helpers.py": ["/vibor... |
83,884 | lint-ai/vibora | refs/heads/master | /tests/client/ssl_connections.py | import ssl
from vibora.tests import TestSuite
from vibora import client
class TestSSLErrors(TestSuite):
async def test_expired_ssl__expects_exception(self):
try:
await client.get('https://expired.badssl.com/')
self.fail('Client trusted in an expired SSL certificate.')
excep... | {"/tests/router/prefixes.py": ["/vibora/__init__.py", "/vibora/blueprints.py"], "/tests/timeouts.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/limits.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/templates/extensions.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/helpers.py": ["/vibor... |
83,885 | lint-ai/vibora | refs/heads/master | /vibora/client/session.py | import asyncio
import uuid
from asyncio import BaseEventLoop
from typing import Union, List
from urllib.parse import urlencode
from vibora.parsers.parser import parse_url
from .retries import RetryStrategy
from .request import Request
from .response import Response
from .pool import ConnectionPool
from .limits import R... | {"/tests/router/prefixes.py": ["/vibora/__init__.py", "/vibora/blueprints.py"], "/tests/timeouts.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/limits.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/templates/extensions.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/helpers.py": ["/vibor... |
83,886 | lint-ai/vibora | refs/heads/master | /vibora/workers/reaper.py | import time
import os
import signal
import pendulum
from datetime import datetime
from email.utils import formatdate
from threading import Thread
from ..responses import update_current_time
from ..protocol import ConnectionStatus
# TODO: Handle concurrency.
class Reaper(Thread):
def __init__(self, app):
... | {"/tests/router/prefixes.py": ["/vibora/__init__.py", "/vibora/blueprints.py"], "/tests/timeouts.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/limits.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/templates/extensions.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/helpers.py": ["/vibor... |
83,887 | lint-ai/vibora | refs/heads/master | /vibora/schemas/schemas.py | from .messages import EnglishLanguage
from vibora.request import Request
class Schema:
_fields = []
def __init__(self, silent: bool = False):
"""
:param silent:
"""
pass
@classmethod
async def load(
cls, values: dict, language: dict = EnglishLanguage, contex... | {"/tests/router/prefixes.py": ["/vibora/__init__.py", "/vibora/blueprints.py"], "/tests/timeouts.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/limits.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/templates/extensions.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/helpers.py": ["/vibor... |
83,888 | lint-ai/vibora | refs/heads/master | /samples/sessions/redis_sync.py | import redis
from vibora import Vibora
from vibora.request import Request
from vibora.hooks import Events
from vibora.sessions import Redis
from vibora.responses import JsonResponse
app = Vibora(sessions=Redis())
@app.route('/')
def home(request: Request):
if request.session.get('count') is None:
reques... | {"/tests/router/prefixes.py": ["/vibora/__init__.py", "/vibora/blueprints.py"], "/tests/timeouts.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/limits.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/templates/extensions.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/helpers.py": ["/vibor... |
83,889 | lint-ai/vibora | refs/heads/master | /tests/hooks.py | import asyncio
import time
import uuid
from vibora import Vibora, Response, Request, MissingComponent
from vibora.responses import StreamingResponse
from vibora.hooks import Events
from vibora.tests import TestSuite
class HooksTestSuite(TestSuite):
def setUp(self):
self.app = Vibora()
async def test_... | {"/tests/router/prefixes.py": ["/vibora/__init__.py", "/vibora/blueprints.py"], "/tests/timeouts.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/limits.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/templates/extensions.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/helpers.py": ["/vibor... |
83,890 | lint-ai/vibora | refs/heads/master | /vibora/__init__.py | import asyncio
try:
import uvloop
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
except ImportError:
pass
from .server import *
from .tests import *
| {"/tests/router/prefixes.py": ["/vibora/__init__.py", "/vibora/blueprints.py"], "/tests/timeouts.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/limits.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/templates/extensions.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/helpers.py": ["/vibor... |
83,891 | lint-ai/vibora | refs/heads/master | /vibora/optimizer.py | import dis
def is_static(route):
"""
:param route:
:return:
"""
seen_load_fast_0 = False
seen_return_value = False
seen_call_fun = False
valid_responses = ('JsonResponse', 'Response')
for instruction in dis.get_instructions(route):
if (
instruction.opname == ... | {"/tests/router/prefixes.py": ["/vibora/__init__.py", "/vibora/blueprints.py"], "/tests/timeouts.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/limits.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/templates/extensions.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/helpers.py": ["/vibor... |
83,892 | lint-ai/vibora | refs/heads/master | /tests/client/streaming.py | from vibora import Vibora
from vibora.tests import TestSuite
from vibora.responses import StreamingResponse, Response
class ChunkedStreamingTestCase(TestSuite):
def setUp(self):
def generate_data():
yield b'1' * (10 * 1024)
yield b'2' * 1024
self.data = b''.join(generate_d... | {"/tests/router/prefixes.py": ["/vibora/__init__.py", "/vibora/blueprints.py"], "/tests/timeouts.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/limits.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/templates/extensions.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/helpers.py": ["/vibor... |
83,893 | lint-ai/vibora | refs/heads/master | /tests/templates/integration.py | from vibora import Vibora, Response
from vibora.tests import TestSuite
from vibora.templates import Template
class ViboraExtensionSuiteCase(TestSuite):
def setUp(self):
self.app = Vibora()
@self.app.route('/')
async def home():
return Response(b'')
self.app.initialize... | {"/tests/router/prefixes.py": ["/vibora/__init__.py", "/vibora/blueprints.py"], "/tests/timeouts.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/limits.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/templates/extensions.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/helpers.py": ["/vibor... |
83,894 | lint-ai/vibora | refs/heads/master | /vibora/blueprints.py | from inspect import isclass, iscoroutinefunction
from .cache import Static
from .optimizer import is_static
from .exceptions import ExceptionHandler, DuplicatedBlueprint, ConflictingPrefixes
from .router import Route, WebsocketRoute, websocket_handshake_handler
from .hooks import Hook, Events
from .responses import Res... | {"/tests/router/prefixes.py": ["/vibora/__init__.py", "/vibora/blueprints.py"], "/tests/timeouts.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/limits.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/templates/extensions.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/helpers.py": ["/vibor... |
83,895 | lint-ai/vibora | refs/heads/master | /tests/subdomains.py | from vibora import Vibora, Response
from vibora.blueprints import Blueprint
from vibora.tests import TestSuite
class BlueprintsTestCase(TestSuite):
def setUp(self):
self.app = Vibora()
async def test_simple_sub_domain_expects_match(self):
b1 = Blueprint(hosts=['.*'])
@b1.route('/')
... | {"/tests/router/prefixes.py": ["/vibora/__init__.py", "/vibora/blueprints.py"], "/tests/timeouts.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/limits.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/templates/extensions.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/helpers.py": ["/vibor... |
83,896 | lint-ai/vibora | refs/heads/master | /vibora/hooks.py | from inspect import iscoroutinefunction
from typing import get_type_hints
class Events:
# After the fork but before the server is online receiving requests.
BEFORE_SERVER_START = 1
# After server fork and server online. Understand this is not deterministic, you could
# theoretically be in the middle... | {"/tests/router/prefixes.py": ["/vibora/__init__.py", "/vibora/blueprints.py"], "/tests/timeouts.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/limits.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/templates/extensions.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/helpers.py": ["/vibor... |
83,897 | lint-ai/vibora | refs/heads/master | /samples/force_timeout.py | import time
from vibora import Vibora
from vibora.responses import Response
from vibora.utils import Timeouts
app = Vibora()
@app.route('/')
def home():
time.sleep(10)
return Response(b'123')
if __name__ == '__main__':
app.run(
debug=False,
port=8000,
host='0.0.0.0',
wo... | {"/tests/router/prefixes.py": ["/vibora/__init__.py", "/vibora/blueprints.py"], "/tests/timeouts.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/limits.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/templates/extensions.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/helpers.py": ["/vibor... |
83,898 | lint-ai/vibora | refs/heads/master | /vibora/schemas/messages.py | class Messages:
MISSING_REQUIRED_FIELD = 1
MUST_BE_STRING = 2
MUST_BE_INTEGER = 3
MUST_BE_NUMBER = 4
MUST_BE_LIST = 5
MUST_BE_DICT = 6
EnglishLanguage = {
Messages.MISSING_REQUIRED_FIELD: lambda x: 'Missing required field',
Messages.MUST_BE_STRING: lambda x: 'Must be a string',
Mes... | {"/tests/router/prefixes.py": ["/vibora/__init__.py", "/vibora/blueprints.py"], "/tests/timeouts.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/limits.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/templates/extensions.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/helpers.py": ["/vibor... |
83,899 | lint-ai/vibora | refs/heads/master | /vibora/protocol/__init__.py | from .definitions import *
from . import cprotocol
locals()['Connection'] = cprotocol.Connection
| {"/tests/router/prefixes.py": ["/vibora/__init__.py", "/vibora/blueprints.py"], "/tests/timeouts.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/limits.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/templates/extensions.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/helpers.py": ["/vibor... |
83,900 | lint-ai/vibora | refs/heads/master | /tests/client/multipart.py | from vibora import Vibora, Request
from vibora.tests import TestSuite
from vibora.responses import JsonResponse
from vibora.multipart import FileUpload
class FormsTestCase(TestSuite):
async def test_simple_post__expects_correctly_interpreted(self):
app = Vibora()
@app.route('/', methods=['POST'])... | {"/tests/router/prefixes.py": ["/vibora/__init__.py", "/vibora/blueprints.py"], "/tests/timeouts.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/limits.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/templates/extensions.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/helpers.py": ["/vibor... |
83,901 | lint-ai/vibora | refs/heads/master | /tests/streaming.py | import asyncio
from asyncio import futures
from vibora import Vibora
from vibora.limits import ServerLimits
from vibora.responses import StreamingResponse
from vibora.tests import TestSuite
class StreamingTestSuite(TestSuite):
async def test_simple_streaming_expects_successful(self):
app = Vibora()
... | {"/tests/router/prefixes.py": ["/vibora/__init__.py", "/vibora/blueprints.py"], "/tests/timeouts.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/limits.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/templates/extensions.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/helpers.py": ["/vibor... |
83,902 | lint-ai/vibora | refs/heads/master | /vibora/responses/responses.py | #######################################################
# This is a very sensitive file.
# The whole framework performance is highly impacted by the implementations here.
# There are a lot of "bad practices" here, super calls avoided, duplicated code, early bindings everywhere.
# Tests should help us stay calm and main... | {"/tests/router/prefixes.py": ["/vibora/__init__.py", "/vibora/blueprints.py"], "/tests/timeouts.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/limits.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/templates/extensions.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/helpers.py": ["/vibor... |
83,903 | lint-ai/vibora | refs/heads/master | /vibora/exceptions.py | from inspect import signature
from typing import Callable, get_type_hints
class ViboraException(Exception):
pass
class RouteConfigurationError(ViboraException):
pass
class MissingComponent(Exception):
def __init__(self, msg, component=None, route=None):
self.component = component
self.... | {"/tests/router/prefixes.py": ["/vibora/__init__.py", "/vibora/blueprints.py"], "/tests/timeouts.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/limits.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/templates/extensions.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/helpers.py": ["/vibor... |
83,904 | lint-ai/vibora | refs/heads/master | /tests/forms.py | from vibora import Vibora
from vibora.multipart import FileUpload
from vibora.request import Request
from vibora.responses import JsonResponse
from vibora.tests import TestSuite
class FormsTestCase(TestSuite):
async def test_simple_form_expects_correctly_parsed(self):
app = Vibora()
@app.route('/... | {"/tests/router/prefixes.py": ["/vibora/__init__.py", "/vibora/blueprints.py"], "/tests/timeouts.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/limits.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/templates/extensions.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/helpers.py": ["/vibor... |
83,905 | lint-ai/vibora | refs/heads/master | /tests/blueprints.py | from vibora.tests import TestSuite
from vibora.blueprints import Blueprint, Response
from vibora.router import RouterStrategy
from vibora import Vibora
class BlueprintsTestCase(TestSuite):
def setUp(self):
self.app = Vibora(router_strategy=RouterStrategy.STRICT)
async def test_simple_add_blueprint__e... | {"/tests/router/prefixes.py": ["/vibora/__init__.py", "/vibora/blueprints.py"], "/tests/timeouts.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/limits.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/templates/extensions.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/helpers.py": ["/vibor... |
83,906 | lint-ai/vibora | refs/heads/master | /vibora/server.py | import logging
import sys
import traceback
from email.utils import formatdate
from signal import pause
from collections import OrderedDict, deque
from functools import partial
from multiprocessing import cpu_count
from vibora.__version__ import __version__
from .client import Session
from .workers.handler import Reques... | {"/tests/router/prefixes.py": ["/vibora/__init__.py", "/vibora/blueprints.py"], "/tests/timeouts.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/limits.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/templates/extensions.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/helpers.py": ["/vibor... |
83,907 | lint-ai/vibora | refs/heads/master | /tests/exceptions.py | from vibora import Vibora, Request
from vibora.responses import Response, JsonResponse
from vibora.blueprints import Blueprint
from vibora.tests import TestSuite
class ExceptionsTestCase(TestSuite):
def setUp(self):
self.app = Vibora()
async def test_simple_exception_expects_handled(self):
@s... | {"/tests/router/prefixes.py": ["/vibora/__init__.py", "/vibora/blueprints.py"], "/tests/timeouts.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/limits.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/templates/extensions.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/helpers.py": ["/vibor... |
83,908 | lint-ai/vibora | refs/heads/master | /tests/cache.py | import time
from multiprocessing import Manager
from vibora import Vibora, Request, Hook
from vibora.hooks import Events
from vibora.cache import Static, CacheEngine
from vibora.responses import JsonResponse
from vibora.tests import TestSuite
class CacheTestCase(TestSuite):
async def test_async_cache_engine_skipp... | {"/tests/router/prefixes.py": ["/vibora/__init__.py", "/vibora/blueprints.py"], "/tests/timeouts.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/limits.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/templates/extensions.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/helpers.py": ["/vibor... |
83,909 | lint-ai/vibora | refs/heads/master | /tests/schemas/fields.py | from unittest import TestCase
from vibora.schemas.fields import String
from vibora.schemas.exceptions import ValidationError
class StringTestCase(TestCase):
def test_default__expects_successful(self):
field = String()
self.assertEqual('Test', field.load('Test'))
def test_default_with_integer_... | {"/tests/router/prefixes.py": ["/vibora/__init__.py", "/vibora/blueprints.py"], "/tests/timeouts.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/limits.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/templates/extensions.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/helpers.py": ["/vibor... |
83,910 | lint-ai/vibora | refs/heads/master | /vibora/client/__init__.py | from typing import Coroutine, Any
from .session import Session
from .response import Response
from .retries import RetryStrategy
__default_session = Session(keep_alive=False)
async def get(
url: str = '',
stream: bool = False,
follow_redirects: bool = True,
max_redirects: int = 30,
decode: bool =... | {"/tests/router/prefixes.py": ["/vibora/__init__.py", "/vibora/blueprints.py"], "/tests/timeouts.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/limits.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/templates/extensions.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/helpers.py": ["/vibor... |
83,911 | lint-ai/vibora | refs/heads/master | /vibora/router/router.py | import base64
import hashlib
import re
import uuid
from collections import deque
from typing import get_type_hints
from inspect import iscoroutinefunction, isbuiltin, signature
from .parser import PatternParser
from ..limits import RouteLimits
from ..utils import clean_route_name, clean_methods
from ..exceptions import... | {"/tests/router/prefixes.py": ["/vibora/__init__.py", "/vibora/blueprints.py"], "/tests/timeouts.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/limits.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/templates/extensions.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/helpers.py": ["/vibor... |
83,912 | lint-ai/vibora | refs/heads/master | /tests/schemas/schemas.py | from unittest.mock import Mock, MagicMock
from vibora.schemas import Schema, fields
from vibora.schemas.exceptions import ValidationError, InvalidSchema
from vibora.schemas.messages import Messages, EnglishLanguage
from vibora.tests import TestSuite
class SchemasTestCase(TestSuite):
async def test_basic_schema_lo... | {"/tests/router/prefixes.py": ["/vibora/__init__.py", "/vibora/blueprints.py"], "/tests/timeouts.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/limits.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/templates/extensions.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/helpers.py": ["/vibor... |
83,913 | lint-ai/vibora | refs/heads/master | /setup.py | import platform
from setuptools import setup, Extension, find_packages
if platform.system().lower() == 'linux':
dependencies = ['uvloop', 'ujson', 'pendulum']
else:
dependencies = ['pendulum']
setup(
name="vibora",
version='0.0.6',
description='Fast, asynchronous and sexy Python web framework',
... | {"/tests/router/prefixes.py": ["/vibora/__init__.py", "/vibora/blueprints.py"], "/tests/timeouts.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/limits.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/templates/extensions.py": ["/vibora/__init__.py", "/vibora/tests.py"], "/tests/helpers.py": ["/vibor... |
83,917 | BigRLab/sliding_window_counter | refs/heads/master | /test_model.py | """
Runs unit tests for the SlidingWindowCounter found in model.py. To run
type `python test_model.py`. Tests take under 4 seconds.
"""
import time
from model import SlidingWindowCounter
def test_zero_events():
counter = SlidingWindowCounter()
assert counter.num_last_second() == 0
assert counter.num_last... | {"/test_model.py": ["/model.py"]} |
83,918 | BigRLab/sliding_window_counter | refs/heads/master | /model.py | """
Thank you for viewing my submission! Included in my SlidingWindowCounter
are comments and explanations of my implementation. Please test this class
by using `python test_model.py`.
"""
from datetime import datetime
import bisect
class SlidingWindowCounter:
time_resolution = 'nanoseconds'
def __ini... | {"/test_model.py": ["/model.py"]} |
84,001 | wozaimoyu/GNN4GAT | refs/heads/master | /model/attention.py | import torch
import math
import torch.nn.functional as F
import torch.nn as nn
from utils.utils import clones
def attention(query, key, value, mask=None, dropout=None): #query:[batch_size, ]
d_k = query.size(-1)
#假设d_k和d_v相等
scores = torch.matmul(query, key.transpose(-2, -1)) / math.sqrt(d_k)
if m... | {"/model/GAT.py": ["/utils/constants.py"]} |
84,002 | wozaimoyu/GNN4GAT | refs/heads/master | /test.py | import torch
t1 = torch.randn((6, 3, 2))
t2 = torch.randn((1, 3, 2))
res = t1 * t2
print(res.shape) | {"/model/GAT.py": ["/utils/constants.py"]} |
84,003 | wozaimoyu/GNN4GAT | refs/heads/master | /utils/constants.py | import os
import enum
from torch.utils.tensorboard import SummaryWriter
class LayerType(enum.Enum):
IMP1 = 0,
IMP2 = 1,
IMP3 = 2
| {"/model/GAT.py": ["/utils/constants.py"]} |
84,004 | wozaimoyu/GNN4GAT | refs/heads/master | /model/GAT.py | import torch
import torch.nn as nn
from utils.constants import LayerType
class GAT(torch.nn.Module):
def __init__(self, num_of_layers, num_heads_per_layer, num_features_per_layer, add_skip_connection=True, bias=True,
dropout=0.6, layer_type=LayerType.IMP3, log_attention_weights=False):
su... | {"/model/GAT.py": ["/utils/constants.py"]} |
84,015 | dstufft/twelve | refs/heads/master | /tests/test_services.py | from twelve import services
class TestDatabases:
def test_databases(self):
environ = {"DATABASE_URL": "postgres://user:pass@hostname:5432/dbname"}
expected = {"default": {"name": "dbname", "service": "postgres", "host": "hostname", "user": "user", "password": "pass", "port": 5432}}
resul... | {"/tests/test_services.py": ["/twelve/__init__.py"], "/setup.py": ["/twelve/__init__.py", "/twelve/adapters.py", "/twelve/services.py"], "/twelve/services.py": ["/twelve/compat.py"], "/twelve/adapters.py": ["/twelve/compat.py"], "/twelve/__init__.py": ["/twelve/config.py"], "/tests/test_adapters.py": ["/twelve/__init__... |
84,016 | dstufft/twelve | refs/heads/master | /setup.py | #!/usr/bin/env python
from setuptools import setup
from setuptools.command.test import test as TestCommand
import os
os.environ["TWELVE_ALLOW_NO_EXTENSIONS"] = "1"
import twelve
import twelve.adapters
import twelve.services
class PyTest(TestCommand):
def finalize_options(self):
TestCommand.finalize_opt... | {"/tests/test_services.py": ["/twelve/__init__.py"], "/setup.py": ["/twelve/__init__.py", "/twelve/adapters.py", "/twelve/services.py"], "/twelve/services.py": ["/twelve/compat.py"], "/twelve/adapters.py": ["/twelve/compat.py"], "/twelve/__init__.py": ["/twelve/config.py"], "/tests/test_adapters.py": ["/twelve/__init__... |
84,017 | dstufft/twelve | refs/heads/master | /twelve/services.py | import urlparse
from twelve.compat import extensions
# Register database schemes in URLs.
urlparse.uses_netloc.append("postgres")
urlparse.uses_netloc.append("postgis")
urlparse.uses_netloc.append("mysql")
urlparse.uses_netloc.append("sqlite")
# Register email schemes in URLs.
urlparse.uses_netloc.append("smtp")
url... | {"/tests/test_services.py": ["/twelve/__init__.py"], "/setup.py": ["/twelve/__init__.py", "/twelve/adapters.py", "/twelve/services.py"], "/twelve/services.py": ["/twelve/compat.py"], "/twelve/adapters.py": ["/twelve/compat.py"], "/twelve/__init__.py": ["/twelve/config.py"], "/tests/test_adapters.py": ["/twelve/__init__... |
84,018 | dstufft/twelve | refs/heads/master | /twelve/adapters.py | from twelve.compat import extensions
def django_debug(value):
return value.lower() in ["true", "t", "yes", "on", "y"]
def django_databases(values):
databases = {}
for name, config in values.items():
database = {}
for k, v in config.items():
if v is None:
con... | {"/tests/test_services.py": ["/twelve/__init__.py"], "/setup.py": ["/twelve/__init__.py", "/twelve/adapters.py", "/twelve/services.py"], "/twelve/services.py": ["/twelve/compat.py"], "/twelve/adapters.py": ["/twelve/compat.py"], "/twelve/__init__.py": ["/twelve/config.py"], "/tests/test_adapters.py": ["/twelve/__init__... |
84,019 | dstufft/twelve | refs/heads/master | /twelve/__init__.py | __version__ = "0.1.dev1"
from twelve.config import Configuration
| {"/tests/test_services.py": ["/twelve/__init__.py"], "/setup.py": ["/twelve/__init__.py", "/twelve/adapters.py", "/twelve/services.py"], "/twelve/services.py": ["/twelve/compat.py"], "/twelve/adapters.py": ["/twelve/compat.py"], "/twelve/__init__.py": ["/twelve/config.py"], "/tests/test_adapters.py": ["/twelve/__init__... |
84,020 | dstufft/twelve | refs/heads/master | /twelve/compat.py | try:
import extensions
except ImportError:
import os
if not "TWELVE_ALLOW_NO_EXTENSIONS" in os.environ:
raise
else:
extensions = None
| {"/tests/test_services.py": ["/twelve/__init__.py"], "/setup.py": ["/twelve/__init__.py", "/twelve/adapters.py", "/twelve/services.py"], "/twelve/services.py": ["/twelve/compat.py"], "/twelve/adapters.py": ["/twelve/compat.py"], "/twelve/__init__.py": ["/twelve/config.py"], "/tests/test_adapters.py": ["/twelve/__init__... |
84,021 | dstufft/twelve | refs/heads/master | /tests/test_adapters.py | from twelve import adapters
class TestDjango:
def test_databases_postgres(self):
values = {"default": {"name": "dbname", "service": "postgres", "host": "hostname", "user": "user", "password": "pass", "port": 5432}}
expected = {"default": {"ENGINE": "django.db.backends.postgresql_psycopg2", "HOST"... | {"/tests/test_services.py": ["/twelve/__init__.py"], "/setup.py": ["/twelve/__init__.py", "/twelve/adapters.py", "/twelve/services.py"], "/twelve/services.py": ["/twelve/compat.py"], "/twelve/adapters.py": ["/twelve/compat.py"], "/twelve/__init__.py": ["/twelve/config.py"], "/tests/test_adapters.py": ["/twelve/__init__... |
84,022 | dstufft/twelve | refs/heads/master | /twelve/config.py | import os
from twelve.compat import extensions
class Configuration(object):
def __init__(self, adapter=None, environ=None, names=None, *args, **kwargs):
super(Configuration, self).__init__(*args, **kwargs)
if names is None:
names = {}
self.adapter = adapter.lower()
... | {"/tests/test_services.py": ["/twelve/__init__.py"], "/setup.py": ["/twelve/__init__.py", "/twelve/adapters.py", "/twelve/services.py"], "/twelve/services.py": ["/twelve/compat.py"], "/twelve/adapters.py": ["/twelve/compat.py"], "/twelve/__init__.py": ["/twelve/config.py"], "/tests/test_adapters.py": ["/twelve/__init__... |
84,034 | connorff/high-schools-list | refs/heads/master | /main.py | from data_handler import Data_Handler
from csv_writer import CSV_Writer
# how many grades a high school must have to be added
# for example, a high school with only freshman may not be suitable
min_grade_size = 2
file_data = {
"public": {
"file_name": "files/Public_Universe_Survey.csv",
"name_colu... | {"/main.py": ["/data_handler.py", "/csv_writer.py"]} |
84,035 | connorff/high-schools-list | refs/heads/master | /csv_writer.py | import os
import csv
class CSV_Writer:
file_types = ("csv")
def __init__(self, file_name):
if not file_name.endswith(self.file_types):
raise ValueError(f"File must be of types: {self.file_types}")
self.fn = file_name
# sets column names
with open(self.fn, mode="w"... | {"/main.py": ["/data_handler.py", "/csv_writer.py"]} |
84,036 | connorff/high-schools-list | refs/heads/master | /data_handler.py | import csv
import os
from state_abbrevs import us_state_abbrev
from titlecase import titlecase
class Data_Handler:
file_types = ("csv")
def __init__(self, file_name, school_name_column, school_city_column, school_state_column, school_level_column, min_grade_size, grade_columns, good_levels, convert_state = F... | {"/main.py": ["/data_handler.py", "/csv_writer.py"]} |
84,039 | krosn/PTU-Helper | refs/heads/master | /pokemon.py | from enum import Enum, auto
import json
from level import Level
from location import Location
from math import floor
from typing import Dict, List
class Pokemon:
"""A pokemon and its experience information"""
def __init__(self, name: str, location: Location, level: Level = Level(0)):
self.level = level... | {"/pokemon.py": ["/level.py", "/location.py"], "/main.py": ["/level.py", "/location.py", "/pokemon.py"]} |
84,040 | krosn/PTU-Helper | refs/heads/master | /level.py | import json
from typing import Dict
def _load_levels(filepath: str = "data/levels.json") -> Dict[int, int]:
"""Loads the levels json file into a dict
Arguments:
filepath {[str]} -- The filpath of the .json file
Returns:
Dict[int, Level] -- A dict of [level nu... | {"/pokemon.py": ["/level.py", "/location.py"], "/main.py": ["/level.py", "/location.py", "/pokemon.py"]} |
84,041 | krosn/PTU-Helper | refs/heads/master | /main.py | import json
from level import Level
from location import Location
from pokemon import Pokemon
from typing import Any, Callable, List
pk_json_file = 'data/pokemon.json'
def _confirm(msg: str) -> bool:
print(msg)
confirm = input('Is this correct? [y/yes]').lower()
return confirm in ['y', 'yes', '']
def _... | {"/pokemon.py": ["/level.py", "/location.py"], "/main.py": ["/level.py", "/location.py", "/pokemon.py"]} |
84,042 | krosn/PTU-Helper | refs/heads/master | /location.py | import json
from typing import Dict, List
def _load_xp_mult(filepath: str = "data/locations.json") -> Dict[str, float]:
"""
Loads the known xp multipliers into a dict for dynamic creation
Locations as needed
Arguments:
filepath {[str]} -- The filpath of the .json fi... | {"/pokemon.py": ["/level.py", "/location.py"], "/main.py": ["/level.py", "/location.py", "/pokemon.py"]} |
84,056 | Quanfita/flask_demo | refs/heads/master | /common/singleton.py | import threading
class SingletonIns(object):
__instance_lock = threading.Lock()
def __init__(self, cls):
self._cls = cls
self._instance = {}
def __call__(self, *args, **kw):
if self._cls not in self._instance:
with self.__instance_lock:
if self._cls not... | {"/app/__init__.py": ["/app/flask_app.py", "/app/views.py"]} |
84,057 | Quanfita/flask_demo | refs/heads/master | /app/__init__.py | # -*- encoding: utf-8 -*-
from flask import Flask
#from flask_sqlalchemy import SQLAlchemy
#import config
#db = SQLAlchemy()
from app.flask_app import app
from app.views import IndexView
app.add_url_rule('/index/',view_func=IndexView.as_view('index'))
| {"/app/__init__.py": ["/app/flask_app.py", "/app/views.py"]} |
84,058 | Quanfita/flask_demo | refs/heads/master | /config.py | # -*- encoding: utf-8 -*-
import os
basedir = os.path.abspath(os.path.dirname(__file__))
| {"/app/__init__.py": ["/app/flask_app.py", "/app/views.py"]} |
84,059 | Quanfita/flask_demo | refs/heads/master | /app/flask_app.py | import flask_restful
from flask import Flask
import os
from flask_cors import *
app = Flask(__name__)
app.config['SECRET_KEY']=os.urandom(24)
api = flask_restful.Api(app)
CORS(app, supports_credentials=True)
| {"/app/__init__.py": ["/app/flask_app.py", "/app/views.py"]} |
84,060 | Quanfita/flask_demo | refs/heads/master | /app/views.py | from flask.views import MethodView
from flask import make_response, render_template
import json
class IndexView(MethodView):
def get(self):
return render_template('index.html')
def post(self):
return make_response('')
| {"/app/__init__.py": ["/app/flask_app.py", "/app/views.py"]} |
84,065 | tylrdvs277/DoublyLinkedList | refs/heads/master | /ordered_list_tests.py | # Name: Tyler Davis
# Course: CPE 202
# Instructor: Dave Parkinson
# Assignment: Lab 4
# Term: Fall 2017
import unittest
from ordered_list import OrderedList
class TestLab4(unittest.TestCase):
def test_add(self):
"""Tests the add method by adding two items and making sure they are ... | {"/ordered_list_tests.py": ["/ordered_list.py"]} |
84,066 | tylrdvs277/DoublyLinkedList | refs/heads/master | /ordered_list.py | # Name: Tyler Davis
# Course: CPE 202
# Instructor: Dave Parkinson
# Assignment: Lab 4
# Term: Fall 2017
class Node:
def __init__(self, data):
self.data = data
self.next = None
self.prev = None
def get_data(self):
return self.data
def get_next(self):... | {"/ordered_list_tests.py": ["/ordered_list.py"]} |
84,068 | rd146354/cpe1040-stack-class | refs/heads/master | /main.py | from stack import Stack
def test_integers():
s = Stack()
s.push(int(5))
print(s.value)
t = s.pop()
print(s.value)
print(t)
def test_floats():
s = Stack()
s.push(3.14159)
print(s.value)
t = s.pop()
print(s.value)
print(t)
def test_strings():
s = Stack()
s.pus... | {"/main.py": ["/stack.py"]} |
84,069 | rd146354/cpe1040-stack-class | refs/heads/master | /stack.py | def expect_int(i, sample):
if not isinstance(i, type(sample)):
raise ValueError('Expected {}'.format(type(sample)) + ' but got {}'.format(type(i)))
else:
print('Got an {}'.format(type(sample)) + ' value {}'.format(i))
class Stack():
def __init__(self):
self.sample = 6
print... | {"/main.py": ["/stack.py"]} |
84,071 | Andrew-Der/taboo | refs/heads/master | /server.py | import os
from http.server import BaseHTTPRequestHandler
# from http_response.staticHandler import StaticHandler
from http_response.template_handler import TemplateHandler
from http_response.bad_request_handler import BadRequestHandler
from http_response.no_action_handler import NoActionHandler
from game_logic impor... | {"/server.py": ["/http_response/no_action_handler.py", "/game_logic.py"], "/game_logic.py": ["/helpers.py"]} |
84,072 | Andrew-Der/taboo | refs/heads/master | /http_request/test.py | test = "ANDREW" | {"/server.py": ["/http_response/no_action_handler.py", "/game_logic.py"], "/game_logic.py": ["/helpers.py"]} |
84,073 | Andrew-Der/taboo | refs/heads/master | /http_response/no_action_handler.py | from http_response.request_handler import RequestHandler
class NoActionHandler(RequestHandler):
def __init__(self):
super().__init__()
self.contentType = 'text/html'
self.contents = open('templates/dummy.html')
self.setStatus(200) | {"/server.py": ["/http_response/no_action_handler.py", "/game_logic.py"], "/game_logic.py": ["/helpers.py"]} |
84,074 | Andrew-Der/taboo | refs/heads/master | /helpers.py |
import json
def get_active_and_watching_players(gh):
rounds = gh.roundsCompleted
team_a_player = gh.teamAPlayerIds[rounds % len(gh.teamAPlayerIds)]
team_b_player = gh.teamBPlayerIds[rounds % len(gh.teamBPlayerIds)]
if rounds%2:
activePlayer = team_b_player
watchingPlayer = team_a_play... | {"/server.py": ["/http_response/no_action_handler.py", "/game_logic.py"], "/game_logic.py": ["/helpers.py"]} |
84,075 | Andrew-Der/taboo | refs/heads/master | /game_logic.py | import json
from json import JSONEncoder
from helpers import add_player_to_gh
class Card:
def __init__(self):
self.id = 0
self.word = ""
self.taboo_words = ""
class Player:
def __init__(self, name, isTeamA, gameId):
self.name = name
self.isTeamA = isTeamA
... | {"/server.py": ["/http_response/no_action_handler.py", "/game_logic.py"], "/game_logic.py": ["/helpers.py"]} |
84,079 | isobelfc/eng84_python_oop | refs/heads/main | /reptile.py | # Let's import Animal class
# Best practices are to use a new file for each class to make debugging easier
# "from animal" works because they're in the same project
# if animal file was elsewhere we would need to give the path
from animal import Animal
class Reptile(Animal): # we need to pass the Animal class as an ... | {"/reptile.py": ["/animal.py"], "/python.py": ["/snake.py"], "/snake.py": ["/reptile.py"]} |
84,080 | isobelfc/eng84_python_oop | refs/heads/main | /python.py | # Create python class inheriting from snake
from snake import Snake
class Python(Snake):
def __init__(self):
super().__init__()
self.large = True
self.two_lungs = True
self.venom = False # polymorphism - overridden from Snake
def climb(self):
return "up we go"
de... | {"/reptile.py": ["/animal.py"], "/python.py": ["/snake.py"], "/snake.py": ["/reptile.py"]} |
84,081 | isobelfc/eng84_python_oop | refs/heads/main | /snake.py | # Let's import reptile class
from reptile import Reptile
class Snake(Reptile):
def __init__(self):
super().__init__()
self.limbs = False
self.venom = True
self.fork_tongue = True
def scent_with_tongue(self):
return "I use my tongue to smell"
def shed_skin(self):
... | {"/reptile.py": ["/animal.py"], "/python.py": ["/snake.py"], "/snake.py": ["/reptile.py"]} |
84,082 | isobelfc/eng84_python_oop | refs/heads/main | /animal.py | # Let's create our first class
# Syntax class is the keyword then name of the class
# # To bypass the code without putting data in
# class Animal():
# pass # pass is the keyword to bypass
# Creating an Animal class
class Animal():
# name = "Dog" # class variable
def __init__(self): # self refers to t... | {"/reptile.py": ["/animal.py"], "/python.py": ["/snake.py"], "/snake.py": ["/reptile.py"]} |
84,094 | Junwan-Yun/synthesis | refs/heads/master | /singleshot.py | import os
import time
import torch
from torch.autograd import Variable
from torchvision import datasets, transforms
import scipy.io
import warnings
warnings.filterwarnings("ignore")
from darknet import Darknet
from utils import *
from MeshPly import MeshPly
from PIL import Image
import cv2
import PyKDL
class singlesh... | {"/main.py": ["/singleshot.py"], "/data_generator_ver2_april.py": ["/singleshot.py"]} |
84,095 | Junwan-Yun/synthesis | refs/heads/master | /main.py | import sys
import cv2
from cv_bridge import CvBridge, CvBridgeError
import time
import numpy as np
from PyQt5 import QtGui, QtCore
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.uic import loadUi
import roslib
from math import pi, atan, tan, sin, cos
from math ... | {"/main.py": ["/singleshot.py"], "/data_generator_ver2_april.py": ["/singleshot.py"]} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.