index int64 | repo_name string | branch_name string | path string | content string | import_graph string |
|---|---|---|---|---|---|
60,717 | ahmedbendev/Reclamation-Client | refs/heads/master | /requets/migrations/0011_auto_20190423_1328.py | # Generated by Django 2.2 on 2019-04-23 11:28
import datetime
from django.db import migrations, models
from django.utils.timezone import utc
class Migration(migrations.Migration):
dependencies = [
('requets', '0010_auto_20190422_1354'),
]
operations = [
migrations.AlterField(
... | {"/manager/views.py": ["/manager/permissions.py", "/manager/forms.py", "/requets/models.py", "/users/models.py", "/manager/serializers.py"], "/requets/admin.py": ["/requets/models.py"], "/manager/serializers.py": ["/requets/models.py"], "/users/models.py": ["/requets/models.py"], "/requets/views.py": ["/users/forms.py"... |
60,718 | ahmedbendev/Reclamation-Client | refs/heads/master | /users/migrations/0010_auto_20190425_1440.py | # Generated by Django 2.2 on 2019-04-25 12:40
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0009_auto_20190425_1435'),
]
operations = [
migrations.AlterField(
model_name='address',
name='logement',
... | {"/manager/views.py": ["/manager/permissions.py", "/manager/forms.py", "/requets/models.py", "/users/models.py", "/manager/serializers.py"], "/requets/admin.py": ["/requets/models.py"], "/manager/serializers.py": ["/requets/models.py"], "/users/models.py": ["/requets/models.py"], "/requets/views.py": ["/users/forms.py"... |
60,721 | EpsAvlc/SECOND_ROS | refs/heads/master | /second/data/pcd_dataset.py | import os
import pcl
import numpy as np
from pathlib import Path
import concurrent.futures as futures
import pickle
import fire
from second.data.dataset import Dataset
class PCDDataset(Dataset):
"""
This class is designed for custom data in pcd form.
"""
NumPointFeatures = 4
def __init__(self... | {"/second_ros/pcd_inferencer.py": ["/second/data/pcd_dataset.py"]} |
60,722 | EpsAvlc/SECOND_ROS | refs/heads/master | /second_ros/pcd_inferencer.py | from pathlib import Path
from google.protobuf import text_format
import torch
import pcl
import pickle
import numpy as np
from functools import partial
from second.protos import pipeline_pb2
from second.pytorch.builder import (box_coder_builder, input_reader_builder,
lr_scheduler_bu... | {"/second_ros/pcd_inferencer.py": ["/second/data/pcd_dataset.py"]} |
60,724 | 123mayur/Serverless_AWS_APIEndpoint | refs/heads/main | /EC2_Start_Stop.py | import boto3
import json
def lambda_handler_start(event, context):
inputParams = json.loads(json.dumps(event))
sevice_Id =inputParams['id']
instances = [sevice_Id]
ec2 = boto3.client('ec2')
ec2.start_instances(InstanceIds=instances)
ec2.delete_tags(Resources=instances, Tags=[{'Key':'Schedule', ... | {"/app.py": ["/schedule_lambda.py"]} |
60,725 | 123mayur/Serverless_AWS_APIEndpoint | refs/heads/main | /schedule_lambda.py | import boto3
import json
import datetime
import calendar
from croniter import croniter
import pandas as pd
db = boto3.resource('dynamodb')
table = db.Table('Myapp')
def create_schedule(event):
payload = json.loads(json.dumps(event))
table.put_item(Item=payload)
return json.dumps({"message":"your schedule ... | {"/app.py": ["/schedule_lambda.py"]} |
60,726 | 123mayur/Serverless_AWS_APIEndpoint | refs/heads/main | /app.py | import json
from flask import request,json
from flask_lambda import FlaskLambda
import schedule_lambda
app = FlaskLambda(__name__)
@app.route('/')
def index():
return json_response({"message":"Hello Word"})
@app.route('/myapp',methods=['GET'])
def fetch_all():
if request.method == 'GET':
data = json.... | {"/app.py": ["/schedule_lambda.py"]} |
60,761 | FelixDikland/Suducko | refs/heads/master | /main_sudoku.py | from skimage import io, color, measure, morphology, filters
from matplotlib import pyplot as plt
from skimage.feature import local_binary_pattern
import numpy as np
import math
from datetime import datetime
startTime = datetime.now()
def preprocess(image_path):
img = io.imread(image_path)
img = color.rgb2gray(... | {"/flup.py": ["/main_sudoku.py"]} |
60,762 | FelixDikland/Suducko | refs/heads/master | /flup.py | import main_sudoku as sud
image_paths = ['sudoku_straight.jpeg','sudoku_diag.jpeg', 'sudoku_diag_tilted.jpeg', 'sudoku_straight_tilted.jpeg']
path = 'test.jpeg'
#sud.test('test.jpeg', 4)
sud.main('yes', image_paths)
| {"/flup.py": ["/main_sudoku.py"]} |
60,763 | jahanxb/hello_world | refs/heads/master | /hello_world_api/hello_api/__init__.py | # -*-coding:utf-8-*-
from flask import Blueprint
hello_app = Blueprint('hello_app', __name__)
from hello_world_api.hello_api import views
| {"/hello_world_api/__init__.py": ["/hello_world_api/hello_api/__init__.py", "/conf/configs.py"], "/hello_world_api/hello_api/views.py": ["/hello_world_api/hello_api/__init__.py"]} |
60,764 | jahanxb/hello_world | refs/heads/master | /hello_world_api/__init__.py | # -*-coding:utf-8-*-
import os
from flask import Flask
from hello_world_api.hello_api import hello_app
from conf.configs import Config as config,config_dict
def create_app():
app = Flask(__name__)
app.config.from_object(config_dict[configName])
return app
configName = os.environ.get('CONFIGNAME') or ... | {"/hello_world_api/__init__.py": ["/hello_world_api/hello_api/__init__.py", "/conf/configs.py"], "/hello_world_api/hello_api/views.py": ["/hello_world_api/hello_api/__init__.py"]} |
60,765 | jahanxb/hello_world | refs/heads/master | /hello_world_api/hello_api/views.py | from datetime import datetime
from hello_world_api.hello_api import hello_app
import json
@hello_app.route('/localtime', methods=['GET'])
def response_manager():
from datetime import datetime, timezone
utc_dt = datetime.now(timezone.utc)
print("Local time {}".format(utc_dt.astimezone().isoformat()))
r... | {"/hello_world_api/__init__.py": ["/hello_world_api/hello_api/__init__.py", "/conf/configs.py"], "/hello_world_api/hello_api/views.py": ["/hello_world_api/hello_api/__init__.py"]} |
60,766 | jahanxb/hello_world | refs/heads/master | /conf/configs.py | # -*-coding:utf-8-*-
class Config:
pass
class ProductionConfig(Config):
DEBUG = False
class DevelopmentConfig(Config):
DEBUG = True
config_dict = {
'development': DevelopmentConfig,
'production': ProductionConfig,
'default': DevelopmentConfig
}
| {"/hello_world_api/__init__.py": ["/hello_world_api/hello_api/__init__.py", "/conf/configs.py"], "/hello_world_api/hello_api/views.py": ["/hello_world_api/hello_api/__init__.py"]} |
60,767 | Jaima-Jarnaz/Django-website-2-SKETCH- | refs/heads/master | /drawings/admin.py | from django.contrib import admin
from .models import Sketch,Samima,Tonima,Mithila,Isrita,Bintu,Puspo
# Register your models here.
admin.site.register(Sketch)
admin.site.register(Samima)
admin.site.register(Tonima)
admin.site.register(Mithila)
admin.site.register(Isrita)
admin.site.register(Bintu)
admin.site.register(P... | {"/drawings/admin.py": ["/drawings/models.py"], "/drawings/views.py": ["/drawings/models.py"]} |
60,768 | Jaima-Jarnaz/Django-website-2-SKETCH- | refs/heads/master | /drawings/models.py | from django.db import models
# Create your models here.
class Sketch(models.Model):
img=models.ImageField(upload_to='pics')
class Samima(models.Model):
img=models.ImageField(upload_to='picsofsamima')
class Tonima(models.Model):
img=models.ImageField(upload_to='picsoftonima')
class Mithila(models.Model):
... | {"/drawings/admin.py": ["/drawings/models.py"], "/drawings/views.py": ["/drawings/models.py"]} |
60,769 | Jaima-Jarnaz/Django-website-2-SKETCH- | refs/heads/master | /accounts/models.py | from django.db import models
#class User(models.Model):
#pic=models.ImageField(upload_to="profiles") | {"/drawings/admin.py": ["/drawings/models.py"], "/drawings/views.py": ["/drawings/models.py"]} |
60,770 | Jaima-Jarnaz/Django-website-2-SKETCH- | refs/heads/master | /accounts/urls.py | from django.urls import path
from django.conf import settings
from django.conf.urls.static import static
from . import views
urlpatterns=[
path("register",views.register,name='register'),
path("login",views.login,name='login'),
path("user",views.user,name='user'),
#path('upload',views.upload_image,name... | {"/drawings/admin.py": ["/drawings/models.py"], "/drawings/views.py": ["/drawings/models.py"]} |
60,771 | Jaima-Jarnaz/Django-website-2-SKETCH- | refs/heads/master | /accounts/views.py | from django.shortcuts import render,redirect
from django.contrib import messages
from django.contrib.auth.models import User,auth
# Create your views here.
def login(request):
if request.method=='POST':
username=request.POST['username']
password=request.POST['password']
user=auth.authentica... | {"/drawings/admin.py": ["/drawings/models.py"], "/drawings/views.py": ["/drawings/models.py"]} |
60,772 | Jaima-Jarnaz/Django-website-2-SKETCH- | refs/heads/master | /drawings/migrations/0004_bintu_isrita_mithila_puspo_tonima.py | # Generated by Django 3.0.5 on 2020-07-10 17:19
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('drawings', '0003_auto_20200710_2207'),
]
operations = [
migrations.CreateModel(
name='Bintu',
fields=[
... | {"/drawings/admin.py": ["/drawings/models.py"], "/drawings/views.py": ["/drawings/models.py"]} |
60,773 | Jaima-Jarnaz/Django-website-2-SKETCH- | refs/heads/master | /drawings/views.py | from django.shortcuts import render
from .models import Sketch,Samima,Mithila,Isrita,Bintu,Puspo,Tonima
#,Tonima,Mithila,Isrita,Bintu,Puspo
def home(request):
s=Sketch.objects.all()
return render(request,"home.html",{'s':s})
# Create your views here.
def samima(request):
s=Samima.objects.all()
retu... | {"/drawings/admin.py": ["/drawings/models.py"], "/drawings/views.py": ["/drawings/models.py"]} |
60,774 | Jaima-Jarnaz/Django-website-2-SKETCH- | refs/heads/master | /drawings/apps.py | from django.apps import AppConfig
class DrawingsConfig(AppConfig):
name = 'drawings'
| {"/drawings/admin.py": ["/drawings/models.py"], "/drawings/views.py": ["/drawings/models.py"]} |
60,775 | Jaima-Jarnaz/Django-website-2-SKETCH- | refs/heads/master | /accounts/migrations/0004_delete_user.py | # Generated by Django 3.0.5 on 2020-07-10 15:52
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('accounts', '0003_user'),
]
operations = [
migrations.DeleteModel(
name='User',
),
]
| {"/drawings/admin.py": ["/drawings/models.py"], "/drawings/views.py": ["/drawings/models.py"]} |
60,776 | Jaima-Jarnaz/Django-website-2-SKETCH- | refs/heads/master | /drawings/urls.py | from django.urls import path
from .import views
urlpatterns=[
path('',views.home,name='home'),
path('samima',views.samima,name='samima'),
path('tonima',views.tonima,name='tonima'),
path('mithila',views.mithila,name='mithila'),
path('isrita',views.isrita,name='isrita'),
path('bintu',views.bint... | {"/drawings/admin.py": ["/drawings/models.py"], "/drawings/views.py": ["/drawings/models.py"]} |
60,782 | muberrabulbul/fakedatabase | refs/heads/master | /fakedata.py | import os
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings')
import django
django.setup()
from faker import Faker
from fakedatabase.models import Person
fake = Faker()
def database(N=1000):
for _ in range(N):
name=fake.first_name()
surname=fake.last_name()
job=fake.job()... | {"/fakedata.py": ["/fakedatabase/models.py"], "/fakedatabase/views.py": ["/fakedatabase/models.py"]} |
60,783 | muberrabulbul/fakedatabase | refs/heads/master | /fakedatabase/apps.py | from django.apps import AppConfig
class FakedatabaseConfig(AppConfig):
name = 'fakedatabase'
| {"/fakedata.py": ["/fakedatabase/models.py"], "/fakedatabase/views.py": ["/fakedatabase/models.py"]} |
60,784 | muberrabulbul/fakedatabase | refs/heads/master | /fakedatabase/migrations/0002_auto_20200901_0612.py | # Generated by Django 3.1 on 2020-09-01 06:12
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('fakedatabase', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='person',
name='job',
f... | {"/fakedata.py": ["/fakedatabase/models.py"], "/fakedatabase/views.py": ["/fakedatabase/models.py"]} |
60,785 | muberrabulbul/fakedatabase | refs/heads/master | /fakedatabase/models.py |
from django.db import models
class Person(models.Model):
name = models.TextField()
surname = models.TextField()
job = models.TextField()
address = models.TextField()
email = models.EmailField()
description = models.TextField()
def __str__(self):
return self.name
| {"/fakedata.py": ["/fakedatabase/models.py"], "/fakedatabase/views.py": ["/fakedatabase/models.py"]} |
60,786 | muberrabulbul/fakedatabase | refs/heads/master | /fakedatabase/views.py | from django.utils import timezone
from django.views.generic.list import ListView
from .models import Person
from django.core.paginator import Paginator
from django.shortcuts import render
from django.http import HttpResponseRedirect
from django.contrib import messages
from django.db.models import Q
class PersonListVi... | {"/fakedata.py": ["/fakedatabase/models.py"], "/fakedatabase/views.py": ["/fakedatabase/models.py"]} |
60,787 | muberrabulbul/fakedatabase | refs/heads/master | /fakedatabase/api/serializers.py | from django.urls import path, include
from django.contrib.auth.models import Person
from rest_framework import routers, serializers, viewsets
class UserSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Person
fields = ['name', 'surname', 'job', 'address', 'email', 'address' ] | {"/fakedata.py": ["/fakedatabase/models.py"], "/fakedatabase/views.py": ["/fakedatabase/models.py"]} |
60,788 | rlcjj/OAServer | refs/heads/master | /OAServer/db_manage.py | __author__ = 'Justin'
import json
def to_json(objs):
jsObjs = []
for temp in objs:
dict = {}
dict.update(temp.__dict__)
jsObjs.append(dict)
return jsObjs
| {"/OAServer/views.py": ["/OAServer/models.py", "/OAServer/db_manage.py"]} |
60,789 | rlcjj/OAServer | refs/heads/master | /server.py | import Pyro.core
from PyQt4.QtCore import QCoreApplication
import sys, threading
from demoEngine import MainEngine
from eventEngine import EventEngine
def qtLoop():
daemon.requestLoop()
app = QCoreApplication(sys.argv)
me = MainEngine()
daemon=Pyro.core.Daemon(host='localhost',port=9000)
P... | {"/OAServer/views.py": ["/OAServer/models.py", "/OAServer/db_manage.py"]} |
60,790 | rlcjj/OAServer | refs/heads/master | /OAServer/models.py | __author__ = 'Justin'
from django.db import models
class TestModel(models.Model):
name = models.CharField(max_length=5)
def __unicode__(self):
return self.name | {"/OAServer/views.py": ["/OAServer/models.py", "/OAServer/db_manage.py"]} |
60,791 | rlcjj/OAServer | refs/heads/master | /OAServer/views.py | __author__ = 'Justin'
from django.http import HttpResponse
from OAServer.models import TestModel
from OAServer.db_manage import to_json
import json
#haha
def post_only(func):
""" Ensures a method is post only """
def wrapped_f(request):
if request.method != "POST":
response = HttpResponse(j... | {"/OAServer/views.py": ["/OAServer/models.py", "/OAServer/db_manage.py"]} |
60,804 | JohnSchlerf/CenterOut | refs/heads/master | /devices/UseMouse.py | # Mouse module for Cursor class.
# Uses pygame.
# Could be re-implemented for other hardware.
import pygame
class MotionHardware:
def __init__(self, homeX, homeY):
# Since this is just a mouse, this is trivial. Other hardware
# may need hardware initialization code here (query serial
# por... | {"/devices/Cursor.py": ["/devices/UseMouse.py"], "/Adaptation_Experiment.py": ["/devices/Clock.py", "/devices/Cursor.py", "/devices/Monitor.py", "/dialog.py"]} |
60,805 | JohnSchlerf/CenterOut | refs/heads/master | /devices/Monitor.py | import pygame
from pygame.locals import *
# I'm defining this to handle basic pygame initialization stuff and deal
# with the screen object in an easy-to-use way. Does a lot of the standard
# things that I need for experiments; somewhat limited in terms of more
# advanced graphics.
def loadImage(filename, col... | {"/devices/Cursor.py": ["/devices/UseMouse.py"], "/Adaptation_Experiment.py": ["/devices/Clock.py", "/devices/Cursor.py", "/devices/Monitor.py", "/dialog.py"]} |
60,806 | JohnSchlerf/CenterOut | refs/heads/master | /devices/old__init__.py | # This lets me import code in the "devices" directory using
# the syntax: "from devices import <X>"
try: from Clock import *
except (ImportError):
print("Clock.py is broken or missing.")
try: from Monitor import *
except (ImportError):
print("Monitor.py is broken or missing.")
try: from Cursor import *
exce... | {"/devices/Cursor.py": ["/devices/UseMouse.py"], "/Adaptation_Experiment.py": ["/devices/Clock.py", "/devices/Cursor.py", "/devices/Monitor.py", "/dialog.py"]} |
60,807 | JohnSchlerf/CenterOut | refs/heads/master | /devices/Cursor.py | import math
# Import the appropriate "MotionHardware" class
from .UseMouse import MotionHardware
# Could be expanded for additional plugins.
class Cursor:
"""
2D Cursor class.
"""
# Handle some simple world-to-graphics values. These can be perturbed to
# require adaptation (learning).
Current... | {"/devices/Cursor.py": ["/devices/UseMouse.py"], "/Adaptation_Experiment.py": ["/devices/Clock.py", "/devices/Cursor.py", "/devices/Monitor.py", "/dialog.py"]} |
60,808 | JohnSchlerf/CenterOut | refs/heads/master | /devices/Clock.py | import os
# Use the most accurate clock.
# Tested on Windows XP and Linux.
if os.name == 'nt':
from time import clock as CurrentTime
import time
ADJUST_FOR_EPOCH = time.time()
else:
from time import time as CurrentTime
ADJUST_FOR_EPOCH = 0
class Clock:
"""Class for timers
In ... | {"/devices/Cursor.py": ["/devices/UseMouse.py"], "/Adaptation_Experiment.py": ["/devices/Clock.py", "/devices/Cursor.py", "/devices/Monitor.py", "/dialog.py"]} |
60,809 | JohnSchlerf/CenterOut | refs/heads/master | /dialog.py | from tkinter import Tk
from tkinter.simpledialog import askstring
from tkinter.filedialog import askopenfilenames
import os
def get_name(prompt="Name of Volunteer", default_value="Volunteer"):
"""Prompt for a subject's name using a dialog
Parameters
----------
prompt : string, optional
Text a... | {"/devices/Cursor.py": ["/devices/UseMouse.py"], "/Adaptation_Experiment.py": ["/devices/Clock.py", "/devices/Cursor.py", "/devices/Monitor.py", "/dialog.py"]} |
60,810 | JohnSchlerf/CenterOut | refs/heads/master | /Adaptation_Experiment.py | # This implements a simple center-out reaching experiment.
# My code:
from devices.Clock import Clock
from devices.Cursor import Cursor
from devices.Monitor import Monitor
from dialog import get_name, get_target_files
# Pygame:
import pygame
from pygame.locals import *
# These packages are fairly standar... | {"/devices/Cursor.py": ["/devices/UseMouse.py"], "/Adaptation_Experiment.py": ["/devices/Clock.py", "/devices/Cursor.py", "/devices/Monitor.py", "/dialog.py"]} |
60,822 | puzzleindex/SS_Panel_TrimePay_Bot | refs/heads/master | /main.py | # -*- coding: UTF-8 -*-
import config
import trimepay
import sql
import re
import qrcode
import PIL
import os
import time
import telebot
from telebot import types
bot = telebot.TeleBot(config.TOKEN)
@bot.message_handler(commands=['start'])
def start(message):
bot.send_message(message.chat.id,'使用... | {"/main.py": ["/config.py", "/trimepay.py", "/sql.py"], "/trimepay.py": ["/config.py", "/sql.py"], "/sql.py": ["/config.py"]} |
60,823 | puzzleindex/SS_Panel_TrimePay_Bot | refs/heads/master | /trimepay.py | # -*- coding: UTF-8 -*-
import config
import sql
import hashlib
import urllib
import json
import base64
import uuid
import qrcode
import PIL
import requests
def params(tgid,totalFee,payType):
#准备签名
merchantTradeNo = ''.join(str(uuid.uuid1()).split('-'))[:8].upper()
#创建paylist
uid = sq... | {"/main.py": ["/config.py", "/trimepay.py", "/sql.py"], "/trimepay.py": ["/config.py", "/sql.py"], "/sql.py": ["/config.py"]} |
60,824 | puzzleindex/SS_Panel_TrimePay_Bot | refs/heads/master | /config.py | # -*- coding: UTF-8 -*-
TOKEN = '' #申请的充值 bot 的 Token
#魔改数据库信息
db_host = ''
db_database = ''
db_username = ''
db_password = ''
baseUrl = '' #SSPanel的config的baseUrl
bindBot = '' #SSPanel绑定的签到查询bot的username
#Trimepay
trimepay_appid = ''
trimepay_secret = ''
#此行勿动
gatewayUri = 'https://api.Trimepay.c... | {"/main.py": ["/config.py", "/trimepay.py", "/sql.py"], "/trimepay.py": ["/config.py", "/sql.py"], "/sql.py": ["/config.py"]} |
60,825 | puzzleindex/SS_Panel_TrimePay_Bot | refs/heads/master | /sql.py | # -*- coding: UTF-8 -*-
import config
import pymysql
import time
#数据库链接信息
def getConnect():
db = pymysql.connect(config.db_host,config.db_username,config.db_password,config.db_database)
return db
#通过tg id 获取user id
def getUidByTgid(tgid):
db = getConnect()
cursor = db.cursor()
sql = 'SELEC... | {"/main.py": ["/config.py", "/trimepay.py", "/sql.py"], "/trimepay.py": ["/config.py", "/sql.py"], "/sql.py": ["/config.py"]} |
60,826 | 2021-Sillicon-Valley-Internship-TeamG/poc_beta | refs/heads/master | /app/models.py | from app import db
class img_upload(db.Model):
__tablename__ = 'imgdir_table'
img_type = db.Column(db.String())
imgdir = db.Column(db.Text,primary_key=True)
def __init__(self, img_type, imgdir):
self.img_type = img_type
self.imgdir = imgdir
# def __repr__(self):
# ret... | {"/app/models.py": ["/app/__init__.py"], "/app/dbcon.py": ["/app/__init__.py"]} |
60,827 | 2021-Sillicon-Valley-Internship-TeamG/poc_beta | refs/heads/master | /app/__init__.py | # Controller file : call & render html, data process
import os
from flask import Flask, render_template, request
from werkzeug.utils import secure_filename
from app.main import test_kakao
from flask_cors import CORS
import configparser
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
config = ... | {"/app/models.py": ["/app/__init__.py"], "/app/dbcon.py": ["/app/__init__.py"]} |
60,828 | 2021-Sillicon-Valley-Internship-TeamG/poc_beta | refs/heads/master | /app/dbcon.py | from app import db
from . import models
def add(img_type,imgdir):
img = models.img_upload(img_type,imgdir)
db.session.add(img)
db.session.commit()
def read():
return db.session.query(models.img_upload.imgdir).all()
def count():
return db.session.query(models.img_upload).count() | {"/app/models.py": ["/app/__init__.py"], "/app/dbcon.py": ["/app/__init__.py"]} |
60,830 | no-i-in-team/twitoff23 | refs/heads/main | /twitoff/models.py | """SQLAlchemy Database"""
from flask_sqlalchemy import SQLAlchemy
from flask_login import UserMixin
DB = SQLAlchemy()
# User Table using sqlalchemy syntax
class User(DB.Model):
"""Twitter users that correspond to tweets"""
id = DB.Column(DB.BigInteger, primary_key=True)
name = DB.Column(DB.String, nullabl... | {"/twitoff/main.py": ["/twitoff/models.py", "/twitoff/predict.py"], "/twitoff/predict.py": ["/twitoff/models.py"]} |
60,831 | no-i-in-team/twitoff23 | refs/heads/main | /twitoff/main.py | """Main main/routing file for Twitoff"""
from os import getenv
from flask import Flask, render_template, request, Blueprint
from flask_login import LoginManager, login_required, current_user
from .models import DB, User
from .twitter import aou_user, uall_users
from .predict import predict_user
main = Blueprint('main... | {"/twitoff/main.py": ["/twitoff/models.py", "/twitoff/predict.py"], "/twitoff/predict.py": ["/twitoff/models.py"]} |
60,832 | no-i-in-team/twitoff23 | refs/heads/main | /twitoff/predict.py | """Predicts who is more likely to say a hypothetical tweet"""
import numpy as np
from sklearn.linear_model import LogisticRegression
from .models import User
from .twitter import vectorize_tweet
def predict_user(user0_name, user1_name, hypothetical_tweet):
"""Determines which user is most lilely the tweet's autho... | {"/twitoff/main.py": ["/twitoff/models.py", "/twitoff/predict.py"], "/twitoff/predict.py": ["/twitoff/models.py"]} |
60,861 | gogbajbobo/3d-fourier | refs/heads/master | /generator.py | """
Generate porous pictures
Code taken from PoreSpy with adding param k to blobs() function to make orthogonal anisotropy
"""
import scipy as sp
from scipy import ndimage as spim
from scipy import special
import numpy as np
import skimage as skim
import skimage.filters as filters
import matplotlib.pyplot as plt
impor... | {"/gen_hist_3d.py": ["/generator.py"], "/gen_test.py": ["/generator.py"], "/gen_fft.py": ["/generator.py"]} |
60,862 | gogbajbobo/3d-fourier | refs/heads/master | /gen_hist_3d.py | """
Generate 3D porous picture and calc gray values histogram
"""
import matplotlib.pyplot as plt
import numpy as np
import generator
im_size = 200
im_shape = np.ones(3, dtype=int) * im_size
shape_ranges = tuple(int(i * im_size) for i in (0.0125, 0.025, 0.05, 0.1, 0.25, 0.5, 1))
nrows = 3
ncols = 7
figsize = (28, 9)
... | {"/gen_hist_3d.py": ["/generator.py"], "/gen_test.py": ["/generator.py"], "/gen_fft.py": ["/generator.py"]} |
60,863 | gogbajbobo/3d-fourier | refs/heads/master | /gen_test.py | """
Generate 2D porous picture and calc gray values histogram
"""
import matplotlib.pyplot as plt
import numpy as np
import generator
dim = 3
im_size = 400
im_shape = np.ones(dim, dtype=int) * im_size
k = np.ones(dim)
image = generator.blobs(im_shape, k=k, show_figs=True)
# plt.figure()
# plt.imshow(image, cmap='g... | {"/gen_hist_3d.py": ["/generator.py"], "/gen_test.py": ["/generator.py"], "/gen_fft.py": ["/generator.py"]} |
60,864 | gogbajbobo/3d-fourier | refs/heads/master | /gen_fft.py | """
Generate 2D porous picture and fft it's internal parts
"""
import matplotlib.pyplot as plt
import numpy as np
import generator
im_size = 1000
im_shape = np.ones(2, dtype=int) * im_size
shape_ranges = tuple(int(i * im_size) for i in (0.0125, 0.025, 0.05, 0.1, 0.25, 0.5, 1))
nrows = 4
ncols = 7
figsize = (28, 12)
... | {"/gen_hist_3d.py": ["/generator.py"], "/gen_test.py": ["/generator.py"], "/gen_fft.py": ["/generator.py"]} |
60,865 | gogbajbobo/3d-fourier | refs/heads/master | /gen_mem_profile.py | from typing import List
import scipy as sp
import scipy.ndimage as spim
from scipy import special
import matplotlib.pyplot as plt
from memory_profiler import profile
import sys
@profile
def blobs(
shape: List[int],
porosity: float = 0.5,
blobiness: int = 1,
show_images: bool = False,
... | {"/gen_hist_3d.py": ["/generator.py"], "/gen_test.py": ["/generator.py"], "/gen_fft.py": ["/generator.py"]} |
60,866 | gogbajbobo/3d-fourier | refs/heads/master | /main2d.py | import porespy as ps
import matplotlib.pyplot as plt
import skimage as skim
import skimage.filters as filters
im = ps.generators.blobs([100, 100])
plt.figure()
plt.imshow(im)
im1 = skim.util.random_noise(im, var=0.125)
im1 = filters.gaussian(im1)
plt.figure()
plt.imshow(im1)
plt.figure()
plt.hist(im1, 100, facecol... | {"/gen_hist_3d.py": ["/generator.py"], "/gen_test.py": ["/generator.py"], "/gen_fft.py": ["/generator.py"]} |
60,867 | gogbajbobo/3d-fourier | refs/heads/master | /main.py | import numpy as np
import matplotlib.pyplot as plt
def plot_some(a):
b = np.fft.fft(a)
plt.figure(figsize=(14, 3))
plt.subplot(121)
plt.plot(a)
plt.subplot(122)
_b = np.fft.fftshift(np.log(1 + np.abs(b)))
center = _b.shape[0]//2
_b = _b[center-50:center+50]
plt.plot(_b)
# p... | {"/gen_hist_3d.py": ["/generator.py"], "/gen_test.py": ["/generator.py"], "/gen_fft.py": ["/generator.py"]} |
60,868 | DnWTechnology/Cubic-Spline-Interpolation | refs/heads/master | /cubicsplinedollitle.py | '''Author - MD ELIOUS ALI MONDAL
Created - 28/5/2017'''
#approximation via cubic splines
from sined import xi
from sined import yi
ai = yi[:]
x = float(input('Enter the value of x : '))
j = 0
for i in range(len(xi)):
if x > xi[i]:
if x < xi[i+1]:
j = i
else:
... | {"/cubicsplinedollitle.py": ["/sined.py"]} |
60,869 | DnWTechnology/Cubic-Spline-Interpolation | refs/heads/master | /sined.py | '''Author - MD ELIOUS ALI MONDAL
Created - 28/5/2017'''
import math
xi = []
i = 0
while i <= math.pi/2:
xi.append(i)
i += 0.1
yi = [math.sin(i) for i in xi]
| {"/cubicsplinedollitle.py": ["/sined.py"]} |
60,877 | Krash13/vk_bot | refs/heads/master | /pars.py | from selenium import webdriver
from bs4 import BeautifulSoup
def print_score(url):
driver = webdriver.PhantomJS()
driver.get(url)
main_page = driver.page_source
soup = BeautifulSoup(main_page, 'lxml')
scoreA = soup.find("div", { "class" : "ig__stat-scoreA" }).text
scoreB = soup.find("div", {"cl... | {"/main.py": ["/pars.py"]} |
60,878 | Krash13/vk_bot | refs/heads/master | /main.py | import vk_api
from vk_api.bot_longpoll import VkBotLongPoll, VkBotEventType
from vk_api.utils import get_random_id
from pars import print_score
def vkbot():
vk_session=vk_api.VkApi(token='fcb715bac83de58c82745490f78b4bc7264bf23035dbff8d35c1531193f8acc43113122ad9866cb78e6a6') #Сообщество https://vk.com/club192951... | {"/main.py": ["/pars.py"]} |
60,879 | reparadocs/asgard | refs/heads/master | /polls/urls.py | from django.urls import path
from . import views
urlpatterns = [
path('vote', views.SubmitVote.as_view(), name='vote'),
path('status', views.GetStatus.as_view(), name='status'),
path('question', views.SubmitQuestion.as_view(), name='question'),
path('comment', views.CommentView.as_view(), name='comment'),
] | {"/polls/views.py": ["/polls/models.py", "/polls/serializers.py"], "/polls/serializers.py": ["/polls/models.py"]} |
60,880 | reparadocs/asgard | refs/heads/master | /polls/views.py | from django.shortcuts import render
from .models import *
from .serializers import *
from rest_framework.views import APIView
from rest_framework import status
from rest_framework.response import Response
from django.utils import timezone
from datetime import timedelta
class SubmitVote(APIView):
def post(self, reque... | {"/polls/views.py": ["/polls/models.py", "/polls/serializers.py"], "/polls/serializers.py": ["/polls/models.py"]} |
60,881 | reparadocs/asgard | refs/heads/master | /polls/migrations/0001_initial.py | # Generated by Django 2.2.6 on 2019-10-31 01:25
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Option',
fields=[
... | {"/polls/views.py": ["/polls/models.py", "/polls/serializers.py"], "/polls/serializers.py": ["/polls/models.py"]} |
60,882 | reparadocs/asgard | refs/heads/master | /polls/serializers.py | from rest_framework import serializers
from .models import *
from django.core.exceptions import ObjectDoesNotExist
class VoteSerializer(serializers.ModelSerializer):
class Meta:
model = Vote
exclude = ('id',)
class OptionSerializer(serializers.ModelSerializer):
votes = serializers.IntegerField()
cla... | {"/polls/views.py": ["/polls/models.py", "/polls/serializers.py"], "/polls/serializers.py": ["/polls/models.py"]} |
60,883 | reparadocs/asgard | refs/heads/master | /polls/models.py | from django.db import models
class Question(models.Model):
text = models.CharField(max_length=500)
time = models.DateTimeField(auto_now_add=True)
class Option(models.Model):
text = models.CharField(max_length=100)
question = models.ForeignKey(Question, on_delete=models.CASCADE)
@property
def votes(self):... | {"/polls/views.py": ["/polls/models.py", "/polls/serializers.py"], "/polls/serializers.py": ["/polls/models.py"]} |
60,884 | kswapd/crypto-trading-bot | refs/heads/master | /fetch_huobi.py | #! /usr/bin/python
#-*-coding:utf-8-*-
import urllib.request
import json
import sys, time
import curses
import hmac,hashlib,base64
import conf
import console_view as cv
import logging
import requests
import datetime
import collections
class fetch_huobi(cv.console_view):
def __init__(self, x = 0, y = 16, width = 80... | {"/fetch_huobi.py": ["/conf.py", "/console_view.py"], "/fetch_kraken.py": ["/console_view.py", "/conf.py"], "/fetch_poloniex.py": ["/conf.py", "/console_view.py"], "/console_view.py": ["/conf.py"], "/trade.py": ["/conf.py"], "/fetch_coinmarket.py": ["/console_view.py"], "/poloniex_bot.py": ["/conf.py", "/console_view.p... |
60,885 | kswapd/crypto-trading-bot | refs/heads/master | /fetch_kraken.py | #! /usr/bin/python
#-*-coding:utf-8-*-
import urllib.request
import json
import sys, time
import curses
import logging
import console_view as cv
import conf,hmac,hashlib,base64
import requests
class fetch_kraken(cv.console_view):
def __init__(self, x = 80, y = 16, width = 80, height = 15, is_view = True):
... | {"/fetch_huobi.py": ["/conf.py", "/console_view.py"], "/fetch_kraken.py": ["/console_view.py", "/conf.py"], "/fetch_poloniex.py": ["/conf.py", "/console_view.py"], "/console_view.py": ["/conf.py"], "/trade.py": ["/conf.py"], "/fetch_coinmarket.py": ["/console_view.py"], "/poloniex_bot.py": ["/conf.py", "/console_view.p... |
60,886 | kswapd/crypto-trading-bot | refs/heads/master | /fetch_poloniex.py | #! /usr/bin/python
#-*-coding:utf-8-*-
import urllib.request
import json
import sys, time
import curses
import hmac,hashlib
import conf
import console_view as cv
import logging
import requests
class fetch_poloniex(cv.console_view):
def __init__(self, x = 0, y = 16, width = 80, height = 15, is_view = True):
... | {"/fetch_huobi.py": ["/conf.py", "/console_view.py"], "/fetch_kraken.py": ["/console_view.py", "/conf.py"], "/fetch_poloniex.py": ["/conf.py", "/console_view.py"], "/console_view.py": ["/conf.py"], "/trade.py": ["/conf.py"], "/fetch_coinmarket.py": ["/console_view.py"], "/poloniex_bot.py": ["/conf.py", "/console_view.p... |
60,887 | kswapd/crypto-trading-bot | refs/heads/master | /console_view.py | #! /usr/bin/python
#-*-coding:utf-8-*-
import urllib.request
import json
import sys, time
import curses
import hmac,hashlib
import conf
class console_view:
def __init__(self, x = 0, y = 0, width = 80, height = 15, is_view = True):
self.display_pos = {'x':x, 'y':y, 'width':width, 'height':height}
self.is_view = is... | {"/fetch_huobi.py": ["/conf.py", "/console_view.py"], "/fetch_kraken.py": ["/console_view.py", "/conf.py"], "/fetch_poloniex.py": ["/conf.py", "/console_view.py"], "/console_view.py": ["/conf.py"], "/trade.py": ["/conf.py"], "/fetch_coinmarket.py": ["/console_view.py"], "/poloniex_bot.py": ["/conf.py", "/console_view.p... |
60,888 | kswapd/crypto-trading-bot | refs/heads/master | /trade.py | #! /usr/bin/python
import ccxt as ct
import pprint
import trade
import time
import conf
class auto_trade:
def prt(self,info):
pprint.pprint(info)
def __init__(self):
self.k = ct.kraken()
self.y = ct.yobit()
self.p = ct.poloniex()
self.coinmarket = ct.coinmarketcap()
... | {"/fetch_huobi.py": ["/conf.py", "/console_view.py"], "/fetch_kraken.py": ["/console_view.py", "/conf.py"], "/fetch_poloniex.py": ["/conf.py", "/console_view.py"], "/console_view.py": ["/conf.py"], "/trade.py": ["/conf.py"], "/fetch_coinmarket.py": ["/console_view.py"], "/poloniex_bot.py": ["/conf.py", "/console_view.p... |
60,889 | kswapd/crypto-trading-bot | refs/heads/master | /conf.py | #! /usr/bin/python
import configparser
import string, os, sys
class TradeKeys:
def __init__(self):
cf = configparser.ConfigParser()
cf.read("keys.ini")
kraken_public = cf.get("kraken", "public")
kraken_secret = cf.get("kraken", "secret")
poloniex_public = cf.get("poloniex", "... | {"/fetch_huobi.py": ["/conf.py", "/console_view.py"], "/fetch_kraken.py": ["/console_view.py", "/conf.py"], "/fetch_poloniex.py": ["/conf.py", "/console_view.py"], "/console_view.py": ["/conf.py"], "/trade.py": ["/conf.py"], "/fetch_coinmarket.py": ["/console_view.py"], "/poloniex_bot.py": ["/conf.py", "/console_view.p... |
60,890 | kswapd/crypto-trading-bot | refs/heads/master | /fetch_web.py | import urllib.request
class fetch_url:
def __init__(self):
print('init')
def start(self):
req = urllib.request.Request('http://www.baidu.com')
res = urllib.request.urlopen(req)
page = res.read()
print(page)
| {"/fetch_huobi.py": ["/conf.py", "/console_view.py"], "/fetch_kraken.py": ["/console_view.py", "/conf.py"], "/fetch_poloniex.py": ["/conf.py", "/console_view.py"], "/console_view.py": ["/conf.py"], "/trade.py": ["/conf.py"], "/fetch_coinmarket.py": ["/console_view.py"], "/poloniex_bot.py": ["/conf.py", "/console_view.p... |
60,891 | kswapd/crypto-trading-bot | refs/heads/master | /fetch_coinmarket.py | #! /usr/bin/python
#-*-coding:utf-8-*-
import urllib.request
import json
import sys, time
import curses
import console_view as cv
class fetch_coinmarket(cv.console_view):
def __init__(self, x = 0, y = 0, width = 80, height = 15, is_view = True):
cv.console_view.__init__(self, x, y, width, height, is_view)
... | {"/fetch_huobi.py": ["/conf.py", "/console_view.py"], "/fetch_kraken.py": ["/console_view.py", "/conf.py"], "/fetch_poloniex.py": ["/conf.py", "/console_view.py"], "/console_view.py": ["/conf.py"], "/trade.py": ["/conf.py"], "/fetch_coinmarket.py": ["/console_view.py"], "/poloniex_bot.py": ["/conf.py", "/console_view.p... |
60,892 | kswapd/crypto-trading-bot | refs/heads/master | /poloniex_bot.py | #! /usr/bin/python
# -*-coding:utf-8-*-
import urllib.request
import json
import sys
import time
import hmac
import hashlib
import conf
import console_view as cv
import logging
import requests
class poloniex_bot():
def __init__(self, x=0, y=16, width=80, height=15, is_view=True):
self.is_stop = False
... | {"/fetch_huobi.py": ["/conf.py", "/console_view.py"], "/fetch_kraken.py": ["/console_view.py", "/conf.py"], "/fetch_poloniex.py": ["/conf.py", "/console_view.py"], "/console_view.py": ["/conf.py"], "/trade.py": ["/conf.py"], "/fetch_coinmarket.py": ["/console_view.py"], "/poloniex_bot.py": ["/conf.py", "/console_view.p... |
60,893 | kswapd/crypto-trading-bot | refs/heads/master | /poloniex_sample.py | import urllib.request
import json
import time
import hmac,hashlib
def createTimeStamp(datestr, format="%Y-%m-%d %H:%M:%S"):
return time.mktime(time.strptime(datestr, format))
class poloniex:
def __init__(self, APIKey, Secret):
self.APIKey = APIKey
self.Secret = Secret
def post_process(sel... | {"/fetch_huobi.py": ["/conf.py", "/console_view.py"], "/fetch_kraken.py": ["/console_view.py", "/conf.py"], "/fetch_poloniex.py": ["/conf.py", "/console_view.py"], "/console_view.py": ["/conf.py"], "/trade.py": ["/conf.py"], "/fetch_coinmarket.py": ["/console_view.py"], "/poloniex_bot.py": ["/conf.py", "/console_view.p... |
60,894 | kswapd/crypto-trading-bot | refs/heads/master | /monitor.py | import pprint as pp
#import trade
import time
import fetch_web
import fetch_coinmarket
import fetch_yobit
import fetch_poloniex
import fetch_kraken
import _thread
import curses
class trade_monitor:
def __init__(self):
a = 1
def start2(self):
print('aaaa')
def start(self):
time.sleep... | {"/fetch_huobi.py": ["/conf.py", "/console_view.py"], "/fetch_kraken.py": ["/console_view.py", "/conf.py"], "/fetch_poloniex.py": ["/conf.py", "/console_view.py"], "/console_view.py": ["/conf.py"], "/trade.py": ["/conf.py"], "/fetch_coinmarket.py": ["/console_view.py"], "/poloniex_bot.py": ["/conf.py", "/console_view.p... |
60,895 | kswapd/crypto-trading-bot | refs/heads/master | /stock_simu.py | #! /usr/bin/python
# -*-coding:utf-8-*-
import urllib.request
import json
import sys
import time
import _thread
import logging
import sched
import time
import random
from datetime import datetime
import yaml
def print_time(sc, a='default'):
logging.info("From print_time", time.time(), a)
sc.enter(2, 1, print_... | {"/fetch_huobi.py": ["/conf.py", "/console_view.py"], "/fetch_kraken.py": ["/console_view.py", "/conf.py"], "/fetch_poloniex.py": ["/conf.py", "/console_view.py"], "/console_view.py": ["/conf.py"], "/trade.py": ["/conf.py"], "/fetch_coinmarket.py": ["/console_view.py"], "/poloniex_bot.py": ["/conf.py", "/console_view.p... |
60,896 | kswapd/crypto-trading-bot | refs/heads/master | /main.py | #! /usr/bin/python
#! /usr/bin/python
#-*-coding:utf-8-*-
#import ccxt as ct
import pprint as pp
#import trade
import time
import fetch_web
import fetch_coinmarket
import fetch_yobit
import fetch_poloniex
import fetch_kraken
import _thread
import curses
import auto_monitor
if __name__ == "__main__":
monitor = aut... | {"/fetch_huobi.py": ["/conf.py", "/console_view.py"], "/fetch_kraken.py": ["/console_view.py", "/conf.py"], "/fetch_poloniex.py": ["/conf.py", "/console_view.py"], "/console_view.py": ["/conf.py"], "/trade.py": ["/conf.py"], "/fetch_coinmarket.py": ["/console_view.py"], "/poloniex_bot.py": ["/conf.py", "/console_view.p... |
60,897 | kswapd/crypto-trading-bot | refs/heads/master | /coinmarket_bot.py | #! /usr/bin/python
# -*-coding:utf-8-*-
import json
import sys
import time
import requests
from bs4 import BeautifulSoup
from requests.adapters import HTTPAdapter
from requests.packages.urllib3.util.retry import Retry
session = requests.Session()
proxyDict = {
'http': 'socks5://127.0.0.1:1081',
'https': 'socks5... | {"/fetch_huobi.py": ["/conf.py", "/console_view.py"], "/fetch_kraken.py": ["/console_view.py", "/conf.py"], "/fetch_poloniex.py": ["/conf.py", "/console_view.py"], "/console_view.py": ["/conf.py"], "/trade.py": ["/conf.py"], "/fetch_coinmarket.py": ["/console_view.py"], "/poloniex_bot.py": ["/conf.py", "/console_view.p... |
60,898 | kswapd/crypto-trading-bot | refs/heads/master | /fetch_images.py | #! /usr/bin/python3
#-*-coding:utf-8-*-
'''
批量下载豆瓣首页的图片
采用伪装浏览器的方式爬取豆瓣网站首页的图片,保存到指定路径文件夹下
'''
#导入所需的库
import urllib.request.request,socket,re,sys,os
#定义文件保存路径
targetPath = "./images"
def saveFile(path):
#检测当前路径的有效性
if not os.path.isdir(targetPath):
os.mkdir(targetPath)
#设置每个图片的路径
pos = pat... | {"/fetch_huobi.py": ["/conf.py", "/console_view.py"], "/fetch_kraken.py": ["/console_view.py", "/conf.py"], "/fetch_poloniex.py": ["/conf.py", "/console_view.py"], "/console_view.py": ["/conf.py"], "/trade.py": ["/conf.py"], "/fetch_coinmarket.py": ["/console_view.py"], "/poloniex_bot.py": ["/conf.py", "/console_view.p... |
60,899 | kswapd/crypto-trading-bot | refs/heads/master | /auto_monitor.py | #! /usr/bin/python
#-*-coding:utf-8-*-
#import ccxt as ct
import pprint as pp
#import trade
import time
import fetch_web
import fetch_coinmarket
import fetch_yobit
import fetch_poloniex
import fetch_kraken
import fetch_binance
import fetch_huobi
import _thread
import curses
import monitor
import logging
from logging.... | {"/fetch_huobi.py": ["/conf.py", "/console_view.py"], "/fetch_kraken.py": ["/console_view.py", "/conf.py"], "/fetch_poloniex.py": ["/conf.py", "/console_view.py"], "/console_view.py": ["/conf.py"], "/trade.py": ["/conf.py"], "/fetch_coinmarket.py": ["/console_view.py"], "/poloniex_bot.py": ["/conf.py", "/console_view.p... |
60,900 | funyoo/sinny | refs/heads/master | /module/video/video_player.py | """
视频播放者 video_player
使用 omxlayer 播放视频
提供两种播放方式:循环播放 和 播放一次
@author: funyoo
"""
from omxplayer import OMXPlayer
from pathlib import Path
from time import sleep
from module.video import sys_video_list
PLAYING = False
HAVE_STOP = True
SLEEP_STEP = 0.5
NOW_PLAYING = sys_video_list.SLEEP_VIDEO
# 循环播放
def loopPlay(f... | {"/module/voice_module.py": ["/module/base_module.py"], "/module/rgb_module.py": ["/module/base_module.py"], "/main.py": ["/module_register.py", "/wake_up.py"], "/wake_up.py": ["/commander.py"], "/module/picture_module.py": ["/module/base_module.py"], "/commander.py": ["/reader.py", "/module_register.py"]} |
60,901 | funyoo/sinny | refs/heads/master | /module/voice_module.py | """
控制树莓派rgb灯:
通过udp接收命令完成相应控制
@author: funyoo
"""
import socket
import threading
import time
from module.base_module import BaseModule
from module.voice import voice_operator
BUFFSIZE = 1024
COMMANDS = ["command:.*", ".*播放音.*"]
ip_port = ('127.0.0.1', 9003)
server = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)... | {"/module/voice_module.py": ["/module/base_module.py"], "/module/rgb_module.py": ["/module/base_module.py"], "/main.py": ["/module_register.py", "/wake_up.py"], "/wake_up.py": ["/commander.py"], "/module/picture_module.py": ["/module/base_module.py"], "/commander.py": ["/reader.py", "/module_register.py"]} |
60,902 | funyoo/sinny | refs/heads/master | /module/rgb/rgb_operator.py | """
rgb操作者
过滤命令,再委托给 rgb_worker执行
@author: funyoo
"""
from module.rgb import rgb_worker
import threading
# 操作入口
def operate(msg):
if "command:" in msg:
sysCommand(msg)
else:
userCommand(msg)
# 用户命令
def userCommand(msg):
if "开" in msg:
# 彩虹渐变灯命令
if "渐变" in msg or "彩虹" in ... | {"/module/voice_module.py": ["/module/base_module.py"], "/module/rgb_module.py": ["/module/base_module.py"], "/main.py": ["/module_register.py", "/wake_up.py"], "/wake_up.py": ["/commander.py"], "/module/picture_module.py": ["/module/base_module.py"], "/commander.py": ["/reader.py", "/module_register.py"]} |
60,903 | funyoo/sinny | refs/heads/master | /module/rgb_module.py | """
控制树莓派rgb灯:
通过udp接收命令完成相应控制
@author: funyoo
"""
import socket
import threading
import time
from module.base_module import BaseModule
from module.rgb import rgb_operator
BUFFSIZE = 1024
COMMANDS = [".*[开,关].*[灯,彩虹,LED]", "command:.*"]
IP_PORT = ('127.0.0.1', 9001)
SERVER = socket.socket(socket.AF_INET, socket.SOC... | {"/module/voice_module.py": ["/module/base_module.py"], "/module/rgb_module.py": ["/module/base_module.py"], "/main.py": ["/module_register.py", "/wake_up.py"], "/wake_up.py": ["/commander.py"], "/module/picture_module.py": ["/module/base_module.py"], "/commander.py": ["/reader.py", "/module_register.py"]} |
60,904 | funyoo/sinny | refs/heads/master | /module/picture/picture_player.py | """
图片操作者
"""
import threading
import time
LOOP = False
STOP = True
def playPic(file):
print("ss")
def playPics(pics, space=0.03, loop=False):
print(pics)
print(space)
print(loop)
global LOOP, STOP
while LOOP:
for pic in pics:
print("显示图片")
time.sleep(space)... | {"/module/voice_module.py": ["/module/base_module.py"], "/module/rgb_module.py": ["/module/base_module.py"], "/main.py": ["/module_register.py", "/wake_up.py"], "/wake_up.py": ["/commander.py"], "/module/picture_module.py": ["/module/base_module.py"], "/commander.py": ["/reader.py", "/module_register.py"]} |
60,905 | funyoo/sinny | refs/heads/master | /main.py | """
项目启动主程序
@author: funyoo
"""
import sys
import module_register
import wake_up
import signal
# 检查唤醒词
if len(sys.argv) == 1:
print("Error: need to specify model name")
print("Usage: python xxx.py your.model")
sys.exit(-1)
# 定义信号处理函数 参数:用来识别信号 进程栈状态
def signal_handle(signal, frame):
wake_up.setInt... | {"/module/voice_module.py": ["/module/base_module.py"], "/module/rgb_module.py": ["/module/base_module.py"], "/main.py": ["/module_register.py", "/wake_up.py"], "/wake_up.py": ["/commander.py"], "/module/picture_module.py": ["/module/base_module.py"], "/commander.py": ["/reader.py", "/module_register.py"]} |
60,906 | funyoo/sinny | refs/heads/master | /module/voice/voice_operator.py | """
音频操作者
负责处理音频命令 交由 voice_player 播放
"""
from module.voice import voice_player
from module.voice import sys_voice_list
# 处理命令
def operate(command):
if "command:" in command:
# 系统命令
sysCommand(command)
else:
# 用户命令
userCommand(command)
# 系统命令处理
def sysCommand(command):
... | {"/module/voice_module.py": ["/module/base_module.py"], "/module/rgb_module.py": ["/module/base_module.py"], "/main.py": ["/module_register.py", "/wake_up.py"], "/wake_up.py": ["/commander.py"], "/module/picture_module.py": ["/module/base_module.py"], "/commander.py": ["/reader.py", "/module_register.py"]} |
60,907 | funyoo/sinny | refs/heads/master | /module/voice/sys_voice_list.py | """
系统声音列表
"""
ROOT_PATH = "/home/pi/Sinny/resources/voice/"
WO_ZAI = ROOT_PATH + "wozai.mp3"
HAO = ROOT_PATH + "hao.wav"
ERR = ROOT_PATH + "err.wav" | {"/module/voice_module.py": ["/module/base_module.py"], "/module/rgb_module.py": ["/module/base_module.py"], "/main.py": ["/module_register.py", "/wake_up.py"], "/wake_up.py": ["/commander.py"], "/module/picture_module.py": ["/module/base_module.py"], "/commander.py": ["/reader.py", "/module_register.py"]} |
60,908 | funyoo/sinny | refs/heads/master | /module/picture/picture_operate.py | """
图片控制者
@author: funyoo
"""
# 处理命令
def operate(command):
if "command:" in command:
# 系统命令
sysCommand(command)
else:
# 用户命令
userCommand(command)
# 系统命令处理
def sysCommand(command):
sys_command = command.replace("command:", "")
if sys_command == "sleep":
# 显示睡眠... | {"/module/voice_module.py": ["/module/base_module.py"], "/module/rgb_module.py": ["/module/base_module.py"], "/main.py": ["/module_register.py", "/wake_up.py"], "/wake_up.py": ["/commander.py"], "/module/picture_module.py": ["/module/base_module.py"], "/commander.py": ["/reader.py", "/module_register.py"]} |
60,909 | funyoo/sinny | refs/heads/master | /module/voice/voice_player.py | """
声音播放
@author funyoo
"""
import os
import pygame
import threading
# 播放音频
def play(file):
# frequency用来控制速度
# pygame.mixer.init(frequency=16000, size=0)
#
# pygame.mixer.music.load(file)
# pygame.mixer.music.play()
# while pygame.mixer.music.get_busy():
# continue
# pygame.mixe... | {"/module/voice_module.py": ["/module/base_module.py"], "/module/rgb_module.py": ["/module/base_module.py"], "/main.py": ["/module_register.py", "/wake_up.py"], "/wake_up.py": ["/commander.py"], "/module/picture_module.py": ["/module/base_module.py"], "/commander.py": ["/reader.py", "/module_register.py"]} |
60,910 | funyoo/sinny | refs/heads/master | /wake_up.py | """
唤醒程序:借助 snowboy 唤醒
@author: funyoo
"""
import sys
sys.path.append('./snowboy/examples/Python3/')
import snowboydecoder
import signal
import logging
import commander
interrupted = False
detector = object
STOP = False
def startup(model):
global detector
# 初始化探测器 参数:唤醒词文件 灵敏度
detector = snowboydecoder... | {"/module/voice_module.py": ["/module/base_module.py"], "/module/rgb_module.py": ["/module/base_module.py"], "/main.py": ["/module_register.py", "/wake_up.py"], "/wake_up.py": ["/commander.py"], "/module/picture_module.py": ["/module/base_module.py"], "/commander.py": ["/reader.py", "/module_register.py"]} |
60,911 | funyoo/sinny | refs/heads/master | /module/picture_module.py | """
控制树莓派图片模块:
通过udp接收命令完成相应控制
@author: funyoo
"""
import socket
import threading
import time
from module.base_module import BaseModule
from module.picture import picture_operate
BUFFSIZE = 1024
COMMANDS = ["command:.*"]
IP_PORT = ('127.0.0.1', 9004)
SERVER = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
START =... | {"/module/voice_module.py": ["/module/base_module.py"], "/module/rgb_module.py": ["/module/base_module.py"], "/main.py": ["/module_register.py", "/wake_up.py"], "/wake_up.py": ["/commander.py"], "/module/picture_module.py": ["/module/base_module.py"], "/commander.py": ["/reader.py", "/module_register.py"]} |
60,912 | funyoo/sinny | refs/heads/master | /module/base_module.py | """
为所有module提供基类
所有功能模块都要实现以下方法:
ip_port:获取功能模块地址
startup: 开启服务
shutdown:关闭
commands: 服务识别关键信息
working: 服务方法
@author: funyoo
"""
import abc
class BaseModule(object):
@abc.abstractmethod
def ip_port(self):
pass
@abc.abstractmethod
def startup(self):
pass
@abc.abstractmethod
... | {"/module/voice_module.py": ["/module/base_module.py"], "/module/rgb_module.py": ["/module/base_module.py"], "/main.py": ["/module_register.py", "/wake_up.py"], "/wake_up.py": ["/commander.py"], "/module/picture_module.py": ["/module/base_module.py"], "/commander.py": ["/reader.py", "/module_register.py"]} |
60,913 | funyoo/sinny | refs/heads/master | /module_register.py | """
服务注册中心
负责扫描 module 下的各服务,并通过反射启动服务
@author: funyoo
"""
import importlib
import os
# 服务文件列表
service_filenames = []
# 命令匹配列表 [[命令正则,(ip,port)]]
commands_list = []
def startup(dirPath="./module"):
search_services("./module")
load_services()
def search_services(dirPath):
global service_filenames
... | {"/module/voice_module.py": ["/module/base_module.py"], "/module/rgb_module.py": ["/module/base_module.py"], "/main.py": ["/module_register.py", "/wake_up.py"], "/wake_up.py": ["/commander.py"], "/module/picture_module.py": ["/module/base_module.py"], "/commander.py": ["/reader.py", "/module_register.py"]} |
60,914 | funyoo/sinny | refs/heads/master | /module/video/video_operator.py | """
video 命令操作者
处理系统命令和用户命令,下达给video_player执行播放
@author: funyoo
"""
from module.video import sys_video_list
from module.video import video_player
import threading
# 命令编号 用于两种唤醒视频交替播放
COMMAND_ID = 0
# 处理命令
def operate(command):
if "command:" in command:
# 系统命令
sysCommand(command)
else:
... | {"/module/voice_module.py": ["/module/base_module.py"], "/module/rgb_module.py": ["/module/base_module.py"], "/main.py": ["/module_register.py", "/wake_up.py"], "/wake_up.py": ["/commander.py"], "/module/picture_module.py": ["/module/base_module.py"], "/commander.py": ["/reader.py", "/module_register.py"]} |
60,915 | funyoo/sinny | refs/heads/master | /module/rgb/rgb_worker.py | """
rgb 工作者
控制rgb灯光的开关
这里用两个标志FLAG和THREAD_EXIT来避免产生大量线程造成的线程泄露
@author: funyoo
"""
from module.rgb import rgb_color
import time
from module.rgb.pixels import Pixels, pixels
from module.rgb.alexa_led_pattern import AlexaLedPattern
from module.rgb.google_home_led_pattern import GoogleHomeLedPattern
import threading
pi... | {"/module/voice_module.py": ["/module/base_module.py"], "/module/rgb_module.py": ["/module/base_module.py"], "/main.py": ["/module_register.py", "/wake_up.py"], "/wake_up.py": ["/commander.py"], "/module/picture_module.py": ["/module/base_module.py"], "/commander.py": ["/reader.py", "/module_register.py"]} |
60,916 | funyoo/sinny | refs/heads/master | /reader.py | """
reader: 读取者
提供语音识别的方法
readOffLine: 离线识别
readOnLine: 在线识别
@author: funyoo
"""
from aip import AipSpeech
import speech_recognition as sr
# 百度需要的参数
APP_ID = 'xxxxxxxxxx'
API_KEY = 'xxxxxxxxxxxxxxxxxx'
SECRET_KEY = 'xxxxxxxxxxxxxxxxxxxxxxxx'
CLIENT = AipSpeech(APP_ID, API_KEY, SECRET_KEY)
# 离线识别
def readOffLine(... | {"/module/voice_module.py": ["/module/base_module.py"], "/module/rgb_module.py": ["/module/base_module.py"], "/main.py": ["/module_register.py", "/wake_up.py"], "/wake_up.py": ["/commander.py"], "/module/picture_module.py": ["/module/base_module.py"], "/commander.py": ["/reader.py", "/module_register.py"]} |
60,917 | funyoo/sinny | refs/heads/master | /commander.py | """
commander 即指挥者,指令处理中心
负责处理和发送指令
@author: funyoo
"""
import socket
import wave
import reader
import pyaudio
import time
import re
import module_register
BUFFSIZE = 1024
# 命令发送客户端
CLIENT = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
CHUNK = 1024
FORMAT = pyaudio.paInt16
CHANNELS = 1
RATE = 16000
RECORD_SECON... | {"/module/voice_module.py": ["/module/base_module.py"], "/module/rgb_module.py": ["/module/base_module.py"], "/main.py": ["/module_register.py", "/wake_up.py"], "/wake_up.py": ["/commander.py"], "/module/picture_module.py": ["/module/base_module.py"], "/commander.py": ["/reader.py", "/module_register.py"]} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.