index int64 | repo_name string | branch_name string | path string | content string | import_graph string |
|---|---|---|---|---|---|
48,088 | whiterson/mockingJay | refs/heads/master | /mapReader.py | __author__ = 'Whitney'
import sys
import PIL
import pygame
from locationDef import locationDef
from PIL import Image
def deepForest(definition):
testFile = open('maptest.txt', 'a')
testFile.write('Pixel ID DeepForest\n')
testFile.close()
terrainType = 0
definition.setTerrain(terrainType)
defi... | {"/main.py": ["/engine.py", "/tribute.py"], "/map.py": ["/mapReader.py", "/game.py"], "/mapReader.py": ["/locationDef.py"], "/game.py": ["/tribute.py"], "/locationDef.py": ["/tribute.py"], "/weapon.py": ["/weaponInfo.py"]} |
48,089 | whiterson/mockingJay | refs/heads/master | /game.py | __author__ = 'Nathan'
import random as r
import tribute
class GameState(object):
"""
represents, well, the state of the game.
how should we separate the line between the map and the game state?
for now, I'm making the crude assumption that the map read parses to an empty game-state
"""
def __... | {"/main.py": ["/engine.py", "/tribute.py"], "/map.py": ["/mapReader.py", "/game.py"], "/mapReader.py": ["/locationDef.py"], "/game.py": ["/tribute.py"], "/locationDef.py": ["/tribute.py"], "/weapon.py": ["/weaponInfo.py"]} |
48,090 | whiterson/mockingJay | refs/heads/master | /locationDef.py | import tribute
class locationDef(object):
def __init__(self):
self.startSpace = False #True/False
self.playerThere = False #True/False
self.tribute = None #Tribute that is in a space. Null otherwise
self.terrain = 0 #0-15 Value for terrain Type
self... | {"/main.py": ["/engine.py", "/tribute.py"], "/map.py": ["/mapReader.py", "/game.py"], "/mapReader.py": ["/locationDef.py"], "/game.py": ["/tribute.py"], "/locationDef.py": ["/tribute.py"], "/weapon.py": ["/weaponInfo.py"]} |
48,091 | whiterson/mockingJay | refs/heads/master | /weapon.py | import random
from weaponInfo import weaponInfo
class weapon:
def __init__(self, type):
## All weapons start w/ a base d, and they gain or lose depending on what kind of weapon they're fighting against
self.weaponInfo = weaponInfo()
self.type = type
self.damageCap = 0
self.i... | {"/main.py": ["/engine.py", "/tribute.py"], "/map.py": ["/mapReader.py", "/game.py"], "/mapReader.py": ["/locationDef.py"], "/game.py": ["/tribute.py"], "/locationDef.py": ["/tribute.py"], "/weapon.py": ["/weaponInfo.py"]} |
48,094 | PatCondit03/PyDaVinci | refs/heads/main | /PaintFunctions.py | import time
import pyautogui
import random
time.sleep(4)
distance = 200
pyautogui.click(477,412)
#list of all the locations of colors in MS Paint
colorlist = [1090, 1123, 1153, 1189, 1223, 1255, 1290, 1323, 1353, 1390]
rows = [100, 120]
# function to draw a square shaped spiral
def squarespiral():
... | {"/Final Project Main.py": ["/ChooseColor.py"], "/DaVinci.py": ["/PaintFunctions.py"], "/Master_PyDaVinci.py": ["/PaintFunctions.py"]} |
48,095 | PatCondit03/PyDaVinci | refs/heads/main | /ChooseColor.py | # Defining the function to choose color, with RGB as inputs
import pyautogui as gui
def choosecolor(R, G, B):
gui.click(1440, 110)
gui.click(1260, 630)
gui.press('backspace', presses = 3)
for c in str(R):
gui.press(c)
gui.click(1260, 670)
gui.press('backspace... | {"/Final Project Main.py": ["/ChooseColor.py"], "/DaVinci.py": ["/PaintFunctions.py"], "/Master_PyDaVinci.py": ["/PaintFunctions.py"]} |
48,096 | PatCondit03/PyDaVinci | refs/heads/main | /Final Project Main.py | # IMPORTS
import time
from PIL import Image
import numpy as np
import pyautogui as gui
from ChooseColor import choosecolor
#opening image and getting 3d RGB pixel information
im = Image.open('Colorwheel.jpg')
pixels = np.array(im)
# rep is the varible defining how compressed we want the image. can be... | {"/Final Project Main.py": ["/ChooseColor.py"], "/DaVinci.py": ["/PaintFunctions.py"], "/Master_PyDaVinci.py": ["/PaintFunctions.py"]} |
48,113 | st-tse/neuron_poker_bot | refs/heads/master | /gym_env/__init__.py | """Registration to the gym"""
from gym.envs.registration import register
register(id='neuron_poker-v0',
entry_point='gym_env.env:HoldemTable')
register(id='neuron_poker-v1',
entry_point='gym_env.env_v1:HoldemTable')
register(id='neuron_poker-v2',
entry_point='gym_env.env_v2:HoldemTable... | {"/run_ppo.py": ["/agents/agent_consider_equity.py", "/agents/agent_ppo.py"], "/agents/agent_custom_q1.py": ["/gym_env/__init__.py"]} |
48,114 | st-tse/neuron_poker_bot | refs/heads/master | /agents/agent_random.py | """Random player"""
import random
autplay = True # play automatically if played against keras-rl
class Player:
"""Mandatory class with the player methods"""
def __init__(self, env='env', name='Random'):
"""Initiaization of an agent"""
my_import = __import__('gym_env.'+env, fromlist=['Action... | {"/run_ppo.py": ["/agents/agent_consider_equity.py", "/agents/agent_ppo.py"], "/agents/agent_custom_q1.py": ["/gym_env/__init__.py"]} |
48,115 | st-tse/neuron_poker_bot | refs/heads/master | /run_ppo.py | import gym
from agents.agent_consider_equity import Player as EquityPlayer
from gym_env.env import PlayerShell
from agents.agent_ppo import Player as PPOPlayer
import argparse
parser = argparse.ArgumentParser(description="Train a PPO agent for Poker")
parser.add_argument('--model_name', type=str, default='test', help=... | {"/run_ppo.py": ["/agents/agent_consider_equity.py", "/agents/agent_ppo.py"], "/agents/agent_custom_q1.py": ["/gym_env/__init__.py"]} |
48,116 | st-tse/neuron_poker_bot | refs/heads/master | /agents/agent_ppo.py | from tensorforce.agents import Agent
from tensorforce.environments import Environment
from tensorforce.execution import Runner
from gym_env.env import Action
import tensorflow as tf
import logging
import time
from tensorflow.keras.callbacks import TensorBoard
log = logging.getLogger(__name__)
class Player:
"""Man... | {"/run_ppo.py": ["/agents/agent_consider_equity.py", "/agents/agent_ppo.py"], "/agents/agent_custom_q1.py": ["/gym_env/__init__.py"]} |
48,117 | st-tse/neuron_poker_bot | refs/heads/master | /agents/SAC_agent.py | import tensorflow as tf
import json
import gym
from gym_env.env import Action
import spinup.utils.logx
from spinup import sac_tf1
import time
class Player:
def __init__(self, name='SAC', load_model=None, env=None):
self.equity_alive = 0
self.actions = []
self.last_action_in_stage = ''
... | {"/run_ppo.py": ["/agents/agent_consider_equity.py", "/agents/agent_ppo.py"], "/agents/agent_custom_q1.py": ["/gym_env/__init__.py"]} |
48,118 | st-tse/neuron_poker_bot | refs/heads/master | /agents/agent_consider_equity.py | """Random player"""
autoplay = True # play automatically if played against keras-rl
class Player:
"""Mandatory class with the player methods"""
def __init__(self, env='env', name='Random', min_call_equity=None, min_bet_equity=None):
"""Initiaization of an agent"""
my_import = __import__('gy... | {"/run_ppo.py": ["/agents/agent_consider_equity.py", "/agents/agent_ppo.py"], "/agents/agent_custom_q1.py": ["/gym_env/__init__.py"]} |
48,119 | st-tse/neuron_poker_bot | refs/heads/master | /tools/setup.py | """Setup py distutils"""
# pylint: skip-file
from distutils.core import setup
from Cython.Build import cythonize
setup(name='montecarlo_cython',
ext_modules=cythonize("montecarlo_cython.pyx"))
| {"/run_ppo.py": ["/agents/agent_consider_equity.py", "/agents/agent_ppo.py"], "/agents/agent_custom_q1.py": ["/gym_env/__init__.py"]} |
48,120 | st-tse/neuron_poker_bot | refs/heads/master | /agents/agent_custom_q1.py | """manual keypress agent"""
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, Dropout
from rl.memory import SequentialMemory
from agents.agent_keras_rl_dqn import TrumpPolicy, memory_limit, window_length
from gym_env import env
class Player:
"""Mandatory class with the pla... | {"/run_ppo.py": ["/agents/agent_consider_equity.py", "/agents/agent_ppo.py"], "/agents/agent_custom_q1.py": ["/gym_env/__init__.py"]} |
48,280 | GuiterMan/fypForDemo | refs/heads/master | /main.py | import pygame
import random
import time
import openpyxl
import threading
import os
from background import Background
from color import Color
from car import Car
from pedestrian import Pedestrian
from checkCollision import isTooCloseToCarInFront, isCarCollided, pedLightIsWalking, line56IsCarCollided
from carLight import... | {"/main.py": ["/background.py", "/color.py", "/car.py", "/pedestrian.py", "/checkCollision.py", "/carLight.py", "/pedLight.py"]} |
48,281 | GuiterMan/fypForDemo | refs/heads/master | /car.py | import pygame
import os
# Car object
class Car:
isBus = False
waitingTime = 0
x = 0
y = 0
speed = 0
line = 0
carImg = pygame.image.load(os.path.join('car.png'))
carImgRot = pygame.image.load(os.path.join('car2.png'))
carImgRot2 = pygame.image.load(os.path.join('car3.png'))
def ... | {"/main.py": ["/background.py", "/color.py", "/car.py", "/pedestrian.py", "/checkCollision.py", "/carLight.py", "/pedLight.py"]} |
48,282 | GuiterMan/fypForDemo | refs/heads/master | /color.py | import pygame
# Color set
class Color:
darkBlue = (140, 60, 10)
# darkBlue = (30, 30, 130)
black = (50, 50, 50)
red = (255, 0, 0)
yellow = (255, 211, 0)
green = (0, 255, 0)
lightBlue = (153, 204, 255)
darkGreen = (0, 200, 0)
| {"/main.py": ["/background.py", "/color.py", "/car.py", "/pedestrian.py", "/checkCollision.py", "/carLight.py", "/pedLight.py"]} |
48,283 | GuiterMan/fypForDemo | refs/heads/master | /pedestrian.py | import pygame
# Pedestrain object
class Pedestrian:
waitingTime = 0
x = 0
y = 0
speed = 0
pedStartNum = 0
def __init__(self, x, y, speed, waitingTime, line, pedStartNum):
self.x = x
self.y = y
self.speed = speed
self.waitingTime = waitingTime
self.pedSt... | {"/main.py": ["/background.py", "/color.py", "/car.py", "/pedestrian.py", "/checkCollision.py", "/carLight.py", "/pedLight.py"]} |
48,284 | GuiterMan/fypForDemo | refs/heads/master | /pedLight.py | import pygame
import time
# ped traffic light1 signal switching
def pedTrafficLightSignalSwitching(pedLight, screen, res_x, res_y, green, darkGreen, black, red, simStartTime, simTime):
if pedLight == "green":
pygame.draw.rect(screen, green, (res_x * 0.348, res_y * 0.703, 10, 10))
elif pedLight == "fla... | {"/main.py": ["/background.py", "/color.py", "/car.py", "/pedestrian.py", "/checkCollision.py", "/carLight.py", "/pedLight.py"]} |
48,285 | GuiterMan/fypForDemo | refs/heads/master | /background.py | import pygame
# Draw screen data
class Background:
res_x = 1024
res_y = 768
screen = pygame.display.set_mode((res_x , res_y))
image = pygame.image.load("rdbg.png")
# Pedstrian startPosition array
pedStart = [0, 0, 0]
pedStart0XAry = [res_x * 0.35, res_x * 0.355, res_x * 0.36, res_x * 0.365... | {"/main.py": ["/background.py", "/color.py", "/car.py", "/pedestrian.py", "/checkCollision.py", "/carLight.py", "/pedLight.py"]} |
48,286 | GuiterMan/fypForDemo | refs/heads/master | /carLight.py | import pygame
# Car traffic light1 signal switching
def carTrafficLightSignalSwitching(carLight, screen, res_x, res_y, green, yellow, red):
if carLight == "green":
pygame.draw.rect(screen, green, (res_x * 0.377, res_y * 0.7, 15, 15))
elif carLight == "greenToYellow" or carLight == "redToYellow":
... | {"/main.py": ["/background.py", "/color.py", "/car.py", "/pedestrian.py", "/checkCollision.py", "/carLight.py", "/pedLight.py"]} |
48,287 | GuiterMan/fypForDemo | refs/heads/master | /checkCollision.py | # check tooCloseToCarInFront
def isTooCloseToCarInFront(carLineArray, c):
for row in carLineArray:
if row[0] == c.line:
if 50 > (c.x - row[1].x) > 0:
return True
return False
# check collision 4line
def isCarCollided(carLineArray, c):
for row in carLineArray:
if ro... | {"/main.py": ["/background.py", "/color.py", "/car.py", "/pedestrian.py", "/checkCollision.py", "/carLight.py", "/pedLight.py"]} |
48,338 | singlemice/e_monitor | refs/heads/master | /new_sysinfo.py | # -*- coding: utf-8 -*-
__author__ = 'TaurenDruid'
from fun_sysinfo import disk_func
disk_func()
| {"/new_sysinfo.py": ["/fun_sysinfo.py"], "/py_unit_test.py": ["/readconfig.py"]} |
48,339 | singlemice/e_monitor | refs/heads/master | /e_monitor.py | # -*- coding: utf-8 -*-
__author__ = 'TaurenDruid'
import tornado.ioloop
import tornado.web
from tornado.options import define,options
import tornado.options
import os
import time
import json
from tornado import httpserver
class MainHandler(tornado.web.RequestHandler):
def get(self, *args, **kwargs):
self... | {"/new_sysinfo.py": ["/fun_sysinfo.py"], "/py_unit_test.py": ["/readconfig.py"]} |
48,340 | singlemice/e_monitor | refs/heads/master | /readconfig.py | __author__ = 'lihongchao'
import ConfigParser
class ReadConfig():
def __init__(self):
self.config=ConfigParser.ConfigParser()
self.config.read('config.cfg')
def ReadSection(self,section):
dict={}
options=self.config.options(section)
for option in options:
try... | {"/new_sysinfo.py": ["/fun_sysinfo.py"], "/py_unit_test.py": ["/readconfig.py"]} |
48,341 | singlemice/e_monitor | refs/heads/master | /monitor_web.py | # -*- coding: utf-8 -*-
__author__ = 'TaurenDruid'
import urllib
import datetime,os
from time import sleep
def writeToLog(logmsg):
try:
logfile=os.path.join(os.getcwd(),'check_status.txt')
f = open(logfile, 'a')
except Exception as e:
print "unable to open log file"
try:
... | {"/new_sysinfo.py": ["/fun_sysinfo.py"], "/py_unit_test.py": ["/readconfig.py"]} |
48,342 | singlemice/e_monitor | refs/heads/master | /redis_db.py | __author__ = 'lihongchao'
import redis
from readconfig import ReadConfig
class RedisDB():
def __init__(self):
rc = ReadConfig()
redis = rc.ReadSection('redis')
self.host= redis['host']
self.port = redis['port']
self.db_index = redis['db_index']
if self.host is No... | {"/new_sysinfo.py": ["/fun_sysinfo.py"], "/py_unit_test.py": ["/readconfig.py"]} |
48,343 | singlemice/e_monitor | refs/heads/master | /api/util/setting.py | # -*- coding: utf-8 -*-
__author__ = 'TaurenDruid'
from __future__ import with_statement
import json
def get_setting():
with open('config.conf') as config:
return json.load(config)
def get_sqlite():
config=get_setting()
return config["Sqlite"]
def get_redis():
config=get_setting()
retur... | {"/new_sysinfo.py": ["/fun_sysinfo.py"], "/py_unit_test.py": ["/readconfig.py"]} |
48,344 | singlemice/e_monitor | refs/heads/master | /asy.py | # -*- coding: utf-8 -*-
__author__ = 'TaurenDruid'
import tornado.httpserver
import tornado.ioloop
import tornado.options
import tornado.web
import tornado.httpclient
import urllib
import json
import datetime
import time
from tornado.options import define, options
define("port",default=8000,help="run on the port ")... | {"/new_sysinfo.py": ["/fun_sysinfo.py"], "/py_unit_test.py": ["/readconfig.py"]} |
48,345 | singlemice/e_monitor | refs/heads/master | /testnumpy.py | # -*- coding: utf-8 -*-
__author__ = 'TaurenDruid'
from numpy import *
import numpy as np
#a = array([arange(2)],[arange[2]])
a = arange(5)
print a
print a.dtype
print a.shape
import urllib
query = "abc"
print(urllib.urlencode({"q": query, "result_type": "recent", "rpp": 100})) | {"/new_sysinfo.py": ["/fun_sysinfo.py"], "/py_unit_test.py": ["/readconfig.py"]} |
48,346 | singlemice/e_monitor | refs/heads/master | /py_unit_test.py | __author__ = 'lihongchao'
import unittest
import readconfig
class readconfig(unittest.TestCase):
def test_ReadSection(self):
rc=readconfig()
rc.ReadConfig('host','ip')
self.assertIsNotNone(rc.ReadConfig('host','ip'),"ok")
if __name__=="__main__":
unittest.main() | {"/new_sysinfo.py": ["/fun_sysinfo.py"], "/py_unit_test.py": ["/readconfig.py"]} |
48,347 | singlemice/e_monitor | refs/heads/master | /fun_sysinfo.py | # -*- coding: utf-8 -*-
__author__ = 'TaurenDruid'
import subprocess
def uname_func():
uname = "uname"
uname_args = "-a"
print "Gathering System information with %s command:\n" % uname
subprocess.call([uname,uname_args])
def disk_func():
diskspace = "df"
diskspace_args = "-h"
print "Gath... | {"/new_sysinfo.py": ["/fun_sysinfo.py"], "/py_unit_test.py": ["/readconfig.py"]} |
48,348 | ArturMalkov/Algorithms-in-Python | refs/heads/master | /data_structures/linked_list.py | from __future__ import annotations
class Node:
"""
A Node in a Linked List.
Holds a data value and an optional reference to the next Node object in
the Linked List.
"""
data: any
next: Node
def __eq__(self, other: Node):
return self.data == other.data
def __str__(self):
... | {"/tests/test_trie.py": ["/data_structures/trie.py"], "/tests/test_depth_first_search.py": ["/util/graph.py"], "/main.py": ["/util/graph.py"], "/tests/test_binary_search_tree.py": ["/data_structures/binary_search_tree.py"], "/tests/test_linked_list.py": ["/data_structures/linked_list.py"]} |
48,349 | ArturMalkov/Algorithms-in-Python | refs/heads/master | /algorithms/sort/quick_sort.py | import random
def quick_sort(arr: list, start: int = None, end: int = None):
"""
Implementation of the Quick Sort algorithm. Sorts a list with time
complexity of O(n log n) and space complexity of O(log n).
:param arr: The list to be sorted
:param start: The start index of from where the list sho... | {"/tests/test_trie.py": ["/data_structures/trie.py"], "/tests/test_depth_first_search.py": ["/util/graph.py"], "/main.py": ["/util/graph.py"], "/tests/test_binary_search_tree.py": ["/data_structures/binary_search_tree.py"], "/tests/test_linked_list.py": ["/data_structures/linked_list.py"]} |
48,350 | ArturMalkov/Algorithms-in-Python | refs/heads/master | /data_structures/trie.py | from __future__ import annotations
from collections import deque
from typing import List, Optional, Tuple
class Node:
"""
Node implementation for a Trie data structure.
Attributes:
char single character of a word
children list of children nodes
final indicates whe... | {"/tests/test_trie.py": ["/data_structures/trie.py"], "/tests/test_depth_first_search.py": ["/util/graph.py"], "/main.py": ["/util/graph.py"], "/tests/test_binary_search_tree.py": ["/data_structures/binary_search_tree.py"], "/tests/test_linked_list.py": ["/data_structures/linked_list.py"]} |
48,351 | ArturMalkov/Algorithms-in-Python | refs/heads/master | /tests/test_trie.py | import random
from typing import List
from unittest import TestCase
from faker import Faker
from data_structures.trie import Node, Trie
class TestTrie(TestCase):
faker = Faker()
trie: Trie
words: List[str]
def setUp(self):
self.trie = Trie(Node(None))
self.words = self._populate_tri... | {"/tests/test_trie.py": ["/data_structures/trie.py"], "/tests/test_depth_first_search.py": ["/util/graph.py"], "/main.py": ["/util/graph.py"], "/tests/test_binary_search_tree.py": ["/data_structures/binary_search_tree.py"], "/tests/test_linked_list.py": ["/data_structures/linked_list.py"]} |
48,352 | ArturMalkov/Algorithms-in-Python | refs/heads/master | /data_structures/stack.py | from typing import List
class Stack:
stack: List[any]
def __init__(self):
self.stack = []
def append(self, obj):
self.stack.append(obj)
def pop(self):
self.stack.pop()
| {"/tests/test_trie.py": ["/data_structures/trie.py"], "/tests/test_depth_first_search.py": ["/util/graph.py"], "/main.py": ["/util/graph.py"], "/tests/test_binary_search_tree.py": ["/data_structures/binary_search_tree.py"], "/tests/test_linked_list.py": ["/data_structures/linked_list.py"]} |
48,353 | ArturMalkov/Algorithms-in-Python | refs/heads/master | /algorithms/sort/merge_sort.py | def merge_sort(arr: list):
"""
Implementation of the Merge Sort algorithm. Sorts a list of integers in
O(N log N) time complexity with O(N) space complexity.
Note that this algorithm performs changes "in place", meaning that the
given array object is edited.
:param arr: The list to be sorted
... | {"/tests/test_trie.py": ["/data_structures/trie.py"], "/tests/test_depth_first_search.py": ["/util/graph.py"], "/main.py": ["/util/graph.py"], "/tests/test_binary_search_tree.py": ["/data_structures/binary_search_tree.py"], "/tests/test_linked_list.py": ["/data_structures/linked_list.py"]} |
48,354 | ArturMalkov/Algorithms-in-Python | refs/heads/master | /tests/test_depth_first_search.py | import random
from unittest import TestCase
import igraph
from algorithms.search.depth_first_search import depth_first_search
from util.graph import create_random_graph
class TestDepthFirstSearch(TestCase):
graph: igraph.Graph
def setUp(self):
self.graph = create_random_graph()
def test_find_v... | {"/tests/test_trie.py": ["/data_structures/trie.py"], "/tests/test_depth_first_search.py": ["/util/graph.py"], "/main.py": ["/util/graph.py"], "/tests/test_binary_search_tree.py": ["/data_structures/binary_search_tree.py"], "/tests/test_linked_list.py": ["/data_structures/linked_list.py"]} |
48,355 | ArturMalkov/Algorithms-in-Python | refs/heads/master | /data_structures/binary_search_tree.py | from __future__ import annotations
from typing import Optional
class Node:
"""
Node class for a Binary Search Tree. Holds one data value and
optional references to left and right child nodes
"""
data: any
left: Optional[Node]
right: Optional[Node]
def __init__(self, data: any):
... | {"/tests/test_trie.py": ["/data_structures/trie.py"], "/tests/test_depth_first_search.py": ["/util/graph.py"], "/main.py": ["/util/graph.py"], "/tests/test_binary_search_tree.py": ["/data_structures/binary_search_tree.py"], "/tests/test_linked_list.py": ["/data_structures/linked_list.py"]} |
48,356 | ArturMalkov/Algorithms-in-Python | refs/heads/master | /main.py | import random
import time
from igraph import plot
from algorithms.breadth_first_search import breadth_first_search
from algorithms.depth_first_search import depth_first_search
from util.graph import create_random_graph
if __name__ == "__main__":
graph = create_random_graph()
plot(graph)
source = random.... | {"/tests/test_trie.py": ["/data_structures/trie.py"], "/tests/test_depth_first_search.py": ["/util/graph.py"], "/main.py": ["/util/graph.py"], "/tests/test_binary_search_tree.py": ["/data_structures/binary_search_tree.py"], "/tests/test_linked_list.py": ["/data_structures/linked_list.py"]} |
48,357 | ArturMalkov/Algorithms-in-Python | refs/heads/master | /util/array.py | import random
def create_random_array(length=100):
return [random.randint(0, 1000) for _ in range(length)]
| {"/tests/test_trie.py": ["/data_structures/trie.py"], "/tests/test_depth_first_search.py": ["/util/graph.py"], "/main.py": ["/util/graph.py"], "/tests/test_binary_search_tree.py": ["/data_structures/binary_search_tree.py"], "/tests/test_linked_list.py": ["/data_structures/linked_list.py"]} |
48,358 | ArturMalkov/Algorithms-in-Python | refs/heads/master | /tests/test_binary_search_tree.py | import random
from unittest import TestCase
from data_structures.binary_search_tree import BinarySearchTree, Node
class TestBinarySearchTree(TestCase):
tree: BinarySearchTree
def setUp(self):
random_node = Node(random.randint(0, 100))
self.tree = BinarySearchTree(random_node)
def test_i... | {"/tests/test_trie.py": ["/data_structures/trie.py"], "/tests/test_depth_first_search.py": ["/util/graph.py"], "/main.py": ["/util/graph.py"], "/tests/test_binary_search_tree.py": ["/data_structures/binary_search_tree.py"], "/tests/test_linked_list.py": ["/data_structures/linked_list.py"]} |
48,359 | ArturMalkov/Algorithms-in-Python | refs/heads/master | /tests/test_linked_list.py | import random
from unittest import TestCase
from faker import Faker
from data_structures.linked_list import LinkedList, Node
class TestLinkedList(TestCase):
faker = Faker()
list: LinkedList
num_nodes = 5
def setUp(self):
nodes = [Node(x) for x in range(0, self.num_nodes)]
self.list ... | {"/tests/test_trie.py": ["/data_structures/trie.py"], "/tests/test_depth_first_search.py": ["/util/graph.py"], "/main.py": ["/util/graph.py"], "/tests/test_binary_search_tree.py": ["/data_structures/binary_search_tree.py"], "/tests/test_linked_list.py": ["/data_structures/linked_list.py"]} |
48,360 | ArturMalkov/Algorithms-in-Python | refs/heads/master | /tests/test_binary_search.py | import random
from unittest import TestCase
from algorithms.search.binary_search import binary_search
class TestBinarySearch(TestCase):
arr: list
def setUp(self):
length = random.randint(10, 1000)
self.arr = range(0, length)
def test_find_value_in_array(self):
val = random.randi... | {"/tests/test_trie.py": ["/data_structures/trie.py"], "/tests/test_depth_first_search.py": ["/util/graph.py"], "/main.py": ["/util/graph.py"], "/tests/test_binary_search_tree.py": ["/data_structures/binary_search_tree.py"], "/tests/test_linked_list.py": ["/data_structures/linked_list.py"]} |
48,361 | ArturMalkov/Algorithms-in-Python | refs/heads/master | /util/graph.py | import igraph
def create_random_graph(n=15, p=0.3):
return igraph.Graph.Erdos_Renyi(n, p)
| {"/tests/test_trie.py": ["/data_structures/trie.py"], "/tests/test_depth_first_search.py": ["/util/graph.py"], "/main.py": ["/util/graph.py"], "/tests/test_binary_search_tree.py": ["/data_structures/binary_search_tree.py"], "/tests/test_linked_list.py": ["/data_structures/linked_list.py"]} |
48,362 | ladrua/django-oscar-api-vue-storefront | refs/heads/master | /oscar_vue_api/signals.py | from django.db.models.signals import post_save
from django.dispatch import receiver
from oscar.core.loading import get_model
from .search import obj_indexing_product
ProductModel = get_model('catalogue', 'product')
@receiver(post_save, sender=ProductModel)
def index_post(sender, instance, **kwargs):
obj_indexing... | {"/oscar_vue_api/signals.py": ["/oscar_vue_api/search.py"], "/oscar_vue_api/apps.py": ["/oscar_vue_api/signals.py"], "/oscar_vue_api/management/commands/oav_export.py": ["/oscar_vue_api/__init__.py"], "/oscar_vue_api/app.py": ["/oscar_vue_api/authtoken.py", "/oscar_vue_api/__init__.py"], "/oscar_vue_api/authtoken.py": ... |
48,363 | ladrua/django-oscar-api-vue-storefront | refs/heads/master | /oscar_vue_api/apps.py | from django.apps import AppConfig
class OscarVueApiConfig(AppConfig):
name = 'oscar_vue_api'
def ready(self):
import oscar_vue_api.signals
| {"/oscar_vue_api/signals.py": ["/oscar_vue_api/search.py"], "/oscar_vue_api/apps.py": ["/oscar_vue_api/signals.py"], "/oscar_vue_api/management/commands/oav_export.py": ["/oscar_vue_api/__init__.py"], "/oscar_vue_api/app.py": ["/oscar_vue_api/authtoken.py", "/oscar_vue_api/__init__.py"], "/oscar_vue_api/authtoken.py": ... |
48,364 | ladrua/django-oscar-api-vue-storefront | refs/heads/master | /oscar_vue_api/search.py | from elasticsearch_dsl.connections import connections
from elasticsearch_dsl import DocType, Text, Date, Integer, Float, Boolean, Object, Nested, Keyword, Long, InnerDoc
from elasticsearch.helpers import bulk
from elasticsearch import Elasticsearch
from oscar.core.loading import get_model, get_class
connections.create... | {"/oscar_vue_api/signals.py": ["/oscar_vue_api/search.py"], "/oscar_vue_api/apps.py": ["/oscar_vue_api/signals.py"], "/oscar_vue_api/management/commands/oav_export.py": ["/oscar_vue_api/__init__.py"], "/oscar_vue_api/app.py": ["/oscar_vue_api/authtoken.py", "/oscar_vue_api/__init__.py"], "/oscar_vue_api/authtoken.py": ... |
48,365 | ladrua/django-oscar-api-vue-storefront | refs/heads/master | /oscar_vue_api/__init__.py | default_app_config = 'oscar_vue_api.apps.OscarVueApiConfig'
| {"/oscar_vue_api/signals.py": ["/oscar_vue_api/search.py"], "/oscar_vue_api/apps.py": ["/oscar_vue_api/signals.py"], "/oscar_vue_api/management/commands/oav_export.py": ["/oscar_vue_api/__init__.py"], "/oscar_vue_api/app.py": ["/oscar_vue_api/authtoken.py", "/oscar_vue_api/__init__.py"], "/oscar_vue_api/authtoken.py": ... |
48,366 | ladrua/django-oscar-api-vue-storefront | refs/heads/master | /oscar_vue_api/management/commands/oav_export.py | from django.core.management.base import BaseCommand, CommandError
from oscar_vue_api import search
class Command(BaseCommand):
help = "Export products to ElasticSearch"
def handle(self, *args, **kwargs):
bulk_products = search.bulk_indexing_products()
bulk_categories = search.bulk_indexing_cat... | {"/oscar_vue_api/signals.py": ["/oscar_vue_api/search.py"], "/oscar_vue_api/apps.py": ["/oscar_vue_api/signals.py"], "/oscar_vue_api/management/commands/oav_export.py": ["/oscar_vue_api/__init__.py"], "/oscar_vue_api/app.py": ["/oscar_vue_api/authtoken.py", "/oscar_vue_api/__init__.py"], "/oscar_vue_api/authtoken.py": ... |
48,367 | ladrua/django-oscar-api-vue-storefront | refs/heads/master | /oscar_vue_api/services.py | import requests
import json
from rest_framework.response import Response
def elastic_result(self, request):
path = request.META['PATH_INFO'].partition("catalog")[2]
fullpath = 'http://db.local:9200' + path
if request.method == "POST":
requestdata = json.loads(request.body)
r = request... | {"/oscar_vue_api/signals.py": ["/oscar_vue_api/search.py"], "/oscar_vue_api/apps.py": ["/oscar_vue_api/signals.py"], "/oscar_vue_api/management/commands/oav_export.py": ["/oscar_vue_api/__init__.py"], "/oscar_vue_api/app.py": ["/oscar_vue_api/authtoken.py", "/oscar_vue_api/__init__.py"], "/oscar_vue_api/authtoken.py": ... |
48,368 | ladrua/django-oscar-api-vue-storefront | refs/heads/master | /oscar_vue_api/app.py | from django.conf.urls import url
from oscarapi.app import RESTApiApplication
from oscar_vue_api.authtoken import obtain_auth_token
from . import views
class MyRESTApiApplication(RESTApiApplication):
def get_urls(self):
urls = [
url(r'^user/login', obtain_auth_token),
url(r'^user/me... | {"/oscar_vue_api/signals.py": ["/oscar_vue_api/search.py"], "/oscar_vue_api/apps.py": ["/oscar_vue_api/signals.py"], "/oscar_vue_api/management/commands/oav_export.py": ["/oscar_vue_api/__init__.py"], "/oscar_vue_api/app.py": ["/oscar_vue_api/authtoken.py", "/oscar_vue_api/__init__.py"], "/oscar_vue_api/authtoken.py": ... |
48,369 | ladrua/django-oscar-api-vue-storefront | refs/heads/master | /oscar_vue_api/authtoken.py | from rest_framework.authtoken.views import ObtainAuthToken
from oscar_vue_api.renderers import CustomJSONRenderer
from rest_framework.authtoken.models import Token
from rest_framework.response import Response
from django.contrib.auth import authenticate
from django.utils.translation import ugettext_lazy as _
from rest_... | {"/oscar_vue_api/signals.py": ["/oscar_vue_api/search.py"], "/oscar_vue_api/apps.py": ["/oscar_vue_api/signals.py"], "/oscar_vue_api/management/commands/oav_export.py": ["/oscar_vue_api/__init__.py"], "/oscar_vue_api/app.py": ["/oscar_vue_api/authtoken.py", "/oscar_vue_api/__init__.py"], "/oscar_vue_api/authtoken.py": ... |
48,370 | ladrua/django-oscar-api-vue-storefront | refs/heads/master | /oscar_vue_api/serializers.py | from oscar.core.loading import get_class
from rest_framework import serializers
from oscarapi.serializers import checkout, product
Selector = get_class('partner.strategy', 'Selector')
class TotalSegmentSerializer(serializers.Serializer):
code = serializers.CharField()
title = serializers.CharField()
va... | {"/oscar_vue_api/signals.py": ["/oscar_vue_api/search.py"], "/oscar_vue_api/apps.py": ["/oscar_vue_api/signals.py"], "/oscar_vue_api/management/commands/oav_export.py": ["/oscar_vue_api/__init__.py"], "/oscar_vue_api/app.py": ["/oscar_vue_api/authtoken.py", "/oscar_vue_api/__init__.py"], "/oscar_vue_api/authtoken.py": ... |
48,371 | ladrua/django-oscar-api-vue-storefront | refs/heads/master | /oscar_vue_api/renderers.py | from rest_framework import renderers
from rest_framework import status
class CustomJSONRenderer(renderers.JSONRenderer):
def render(self, data, accepted_media_type=None, renderer_context=None):
response_data = {}
response_data['code'] = renderer_context['response'].status_code
response_data... | {"/oscar_vue_api/signals.py": ["/oscar_vue_api/search.py"], "/oscar_vue_api/apps.py": ["/oscar_vue_api/signals.py"], "/oscar_vue_api/management/commands/oav_export.py": ["/oscar_vue_api/__init__.py"], "/oscar_vue_api/app.py": ["/oscar_vue_api/authtoken.py", "/oscar_vue_api/__init__.py"], "/oscar_vue_api/authtoken.py": ... |
48,372 | ladrua/django-oscar-api-vue-storefront | refs/heads/master | /oscar_vue_api/views.py | from django.shortcuts import render
from oscarapi.views import product, basket
from .serializers import *
from .services import elastic_result
from .renderers import CustomJSONRenderer
from rest_framework.views import APIView
from rest_framework.response import Response
from oscarapi.basket import operations
from res... | {"/oscar_vue_api/signals.py": ["/oscar_vue_api/search.py"], "/oscar_vue_api/apps.py": ["/oscar_vue_api/signals.py"], "/oscar_vue_api/management/commands/oav_export.py": ["/oscar_vue_api/__init__.py"], "/oscar_vue_api/app.py": ["/oscar_vue_api/authtoken.py", "/oscar_vue_api/__init__.py"], "/oscar_vue_api/authtoken.py": ... |
48,396 | ashih42/ComputorV2 | refs/heads/master | /function.py | from colorama import Fore, Back, Style
from exceptions import ComputorException
class Function:
def __init__(self, name, local_vars, expr):
self.name = name
self.local_vars = local_vars
if len(self.local_vars) != len(set(self.local_vars)):
raise ComputorException('Function local variables repeated')
self... | {"/function.py": ["/exceptions.py"], "/simplifier.py": ["/matrix.py", "/computor.py"], "/main.py": ["/computor.py"], "/parser.py": ["/exceptions.py", "/computor.py"], "/computor.py": ["/function.py", "/variable.py", "/complex.py", "/matrix.py", "/parser.py", "/simplifier.py", "/evaluator.py", "/solver.py", "/exceptions... |
48,397 | ashih42/ComputorV2 | refs/heads/master | /simplifier.py | from lark import Lark, Transformer, v_args
from colorama import Fore, Back, Style
from matrix import Matrix
from file_to_string import file_to_string
import computor
class Simplifier:
@v_args(inline=True) # Affects the signatures of the methods
class MyTransformer(Transformer):
def __init__(self):
pass
# ... | {"/function.py": ["/exceptions.py"], "/simplifier.py": ["/matrix.py", "/computor.py"], "/main.py": ["/computor.py"], "/parser.py": ["/exceptions.py", "/computor.py"], "/computor.py": ["/function.py", "/variable.py", "/complex.py", "/matrix.py", "/parser.py", "/simplifier.py", "/evaluator.py", "/solver.py", "/exceptions... |
48,398 | ashih42/ComputorV2 | refs/heads/master | /variable.py | from colorama import Fore, Back, Style
class Variable:
def __init__(self, name, value):
self.name = name
self.value = value
def __str__(self):
return Style.BRIGHT + Fore.BLUE + self.name + Fore.RESET + Style.RESET_ALL + ' = ' + str(self.value)
| {"/function.py": ["/exceptions.py"], "/simplifier.py": ["/matrix.py", "/computor.py"], "/main.py": ["/computor.py"], "/parser.py": ["/exceptions.py", "/computor.py"], "/computor.py": ["/function.py", "/variable.py", "/complex.py", "/matrix.py", "/parser.py", "/simplifier.py", "/evaluator.py", "/solver.py", "/exceptions... |
48,399 | ashih42/ComputorV2 | refs/heads/master | /main.py | from colorama import Fore, Back, Style
from sys import argv
from os import path, getenv
import readline
from computor import Computor
def terminate_with_usage():
print(Style.BRIGHT + 'usage: ' + Style.RESET_ALL)
print ('python3 ' + Fore.BLUE + 'main.py ' + Fore.RESET + '-h \t\t\t (usage)')
print ('python3 ' + Fore... | {"/function.py": ["/exceptions.py"], "/simplifier.py": ["/matrix.py", "/computor.py"], "/main.py": ["/computor.py"], "/parser.py": ["/exceptions.py", "/computor.py"], "/computor.py": ["/function.py", "/variable.py", "/complex.py", "/matrix.py", "/parser.py", "/simplifier.py", "/evaluator.py", "/solver.py", "/exceptions... |
48,400 | ashih42/ComputorV2 | refs/heads/master | /parser.py | from lark import Lark, Transformer, v_args
from lark.exceptions import LarkError
from colorama import Fore, Back, Style
from exceptions import ParserException
from file_to_string import file_to_string
import computor
class Parser:
@v_args(inline=True) # Affects the signatures of the methods
class MyTransformer(Tra... | {"/function.py": ["/exceptions.py"], "/simplifier.py": ["/matrix.py", "/computor.py"], "/main.py": ["/computor.py"], "/parser.py": ["/exceptions.py", "/computor.py"], "/computor.py": ["/function.py", "/variable.py", "/complex.py", "/matrix.py", "/parser.py", "/simplifier.py", "/evaluator.py", "/solver.py", "/exceptions... |
48,401 | ashih42/ComputorV2 | refs/heads/master | /computor.py | from colorama import Fore, Back, Style
from math import sin, cos, tan, pi
from os import system
from function import Function
from variable import Variable
from complex import Complex
from matrix import Matrix
from parser import Parser
from simplifier import Simplifier
# from evaluator import Evaluator
import evalua... | {"/function.py": ["/exceptions.py"], "/simplifier.py": ["/matrix.py", "/computor.py"], "/main.py": ["/computor.py"], "/parser.py": ["/exceptions.py", "/computor.py"], "/computor.py": ["/function.py", "/variable.py", "/complex.py", "/matrix.py", "/parser.py", "/simplifier.py", "/evaluator.py", "/solver.py", "/exceptions... |
48,402 | ashih42/ComputorV2 | refs/heads/master | /term.py | from colorama import Fore, Back, Style
class Term:
def __init__(self, coef, degree):
self.coef = coef
self.degree = degree
def __str__(self):
buffer = ''
if self.degree == 0:
buffer += Fore.RED
elif self.degree == 1:
buffer += Fore.GREEN
elif self.degree == 2:
buffer += Fore.BLUE
else:
b... | {"/function.py": ["/exceptions.py"], "/simplifier.py": ["/matrix.py", "/computor.py"], "/main.py": ["/computor.py"], "/parser.py": ["/exceptions.py", "/computor.py"], "/computor.py": ["/function.py", "/variable.py", "/complex.py", "/matrix.py", "/parser.py", "/simplifier.py", "/evaluator.py", "/solver.py", "/exceptions... |
48,403 | ashih42/ComputorV2 | refs/heads/master | /matrix.py | from exceptions import ComputorException
class Matrix:
@staticmethod
def add(a, b):
if a.shape != b.shape:
raise ComputorException('Invalid Matrix shapes: M' + str(a.shape) + ' + M' + str(b.shape))
data = []
for i in range(a.shape[0]):
data.append(list(map(lambda x, y: x + y, a.data[i], b.data[i])))
r... | {"/function.py": ["/exceptions.py"], "/simplifier.py": ["/matrix.py", "/computor.py"], "/main.py": ["/computor.py"], "/parser.py": ["/exceptions.py", "/computor.py"], "/computor.py": ["/function.py", "/variable.py", "/complex.py", "/matrix.py", "/parser.py", "/simplifier.py", "/evaluator.py", "/solver.py", "/exceptions... |
48,404 | ashih42/ComputorV2 | refs/heads/master | /evaluator.py | from lark import Lark, Transformer, v_args
from colorama import Fore, Back, Style
from matrix import Matrix
from file_to_string import file_to_string
import computor
class Evaluator:
@v_args(inline=True) # Affects the signatures of the methods
class MyTransformer(Transformer):
def __init__(self):
pass
# O... | {"/function.py": ["/exceptions.py"], "/simplifier.py": ["/matrix.py", "/computor.py"], "/main.py": ["/computor.py"], "/parser.py": ["/exceptions.py", "/computor.py"], "/computor.py": ["/function.py", "/variable.py", "/complex.py", "/matrix.py", "/parser.py", "/simplifier.py", "/evaluator.py", "/solver.py", "/exceptions... |
48,405 | ashih42/ComputorV2 | refs/heads/master | /exceptions.py | class ParserException(Exception):
pass
class ComputorException(Exception):
pass
| {"/function.py": ["/exceptions.py"], "/simplifier.py": ["/matrix.py", "/computor.py"], "/main.py": ["/computor.py"], "/parser.py": ["/exceptions.py", "/computor.py"], "/computor.py": ["/function.py", "/variable.py", "/complex.py", "/matrix.py", "/parser.py", "/simplifier.py", "/evaluator.py", "/solver.py", "/exceptions... |
48,406 | ashih42/ComputorV2 | refs/heads/master | /complex.py | from exceptions import ComputorException
class Complex:
@staticmethod
def add(a, b):
return Complex(a.real + b.real, a.imag + b.imag)
@staticmethod
def sub(a, b):
return Complex(a.real - b.real, a.imag - b.imag)
# (a + bi) * (c + di) = (ac - bd, (ad + bc)i)
@staticmethod
def mul(a, b):
return Complex(a... | {"/function.py": ["/exceptions.py"], "/simplifier.py": ["/matrix.py", "/computor.py"], "/main.py": ["/computor.py"], "/parser.py": ["/exceptions.py", "/computor.py"], "/computor.py": ["/function.py", "/variable.py", "/complex.py", "/matrix.py", "/parser.py", "/simplifier.py", "/evaluator.py", "/solver.py", "/exceptions... |
48,407 | ashih42/ComputorV2 | refs/heads/master | /solver.py | from lark import Lark, Transformer, v_args
from lark.exceptions import LarkError
from colorama import Fore, Back, Style
from function import Function
from term import Term
from file_to_string import file_to_string
from exceptions import ParserException, ComputorException
import computor
class Solver:
@v_args(inline... | {"/function.py": ["/exceptions.py"], "/simplifier.py": ["/matrix.py", "/computor.py"], "/main.py": ["/computor.py"], "/parser.py": ["/exceptions.py", "/computor.py"], "/computor.py": ["/function.py", "/variable.py", "/complex.py", "/matrix.py", "/parser.py", "/simplifier.py", "/evaluator.py", "/solver.py", "/exceptions... |
48,422 | qiulongquan/test_celery | refs/heads/master | /tools/tasks.py | from __future__ import absolute_import
from celery import shared_task
import time
@shared_task(track_started=True)
# 你很可能在可重用的 Django APP 中编写了一些任务,
# 但是 Django APP 不能依赖于具体的 Django 项目,
# 所以你无法直接导入 Celery 实例。
# @shared_task 装饰器能让你在没有具体的 Celery 实例时创建任务:
def add(x, y):
time.sleep(30)
return x + y
| {"/test_celery/views/add.py": ["/tools/tasks.py", "/test_celery/models.py", "/tools/db.py"]} |
48,423 | qiulongquan/test_celery | refs/heads/master | /test_celery/models.py | from django.db import models
class Add(models.Model):
task_id = models.CharField(max_length=128)
first = models.IntegerField()
second = models.IntegerField()
log_date = models.DateTimeField()
| {"/test_celery/views/add.py": ["/tools/tasks.py", "/test_celery/models.py", "/tools/db.py"]} |
48,424 | qiulongquan/test_celery | refs/heads/master | /test_celery/views/add.py | #__*__coding:utf-8__*__
from celery.result import AsyncResult
from django.shortcuts import render_to_response
from tools.tasks import add
from test_celery.models import Add
from tools.db import Db
import datetime
def index(request):
return render_to_response('index.html')
def add_1(request):
first = int(r... | {"/test_celery/views/add.py": ["/tools/tasks.py", "/test_celery/models.py", "/tools/db.py"]} |
48,425 | qiulongquan/test_celery | refs/heads/master | /tools/db.py | import datetime
import MySQLdb
from MySQLdb.cursors import DictCursor
from test_celery.settings import DATABASES
class Db:
def __init__(self):
self.database = DATABASES['default']
self.database_name = self.database['NAME']
self.user = self.database['USER']
self.password = self.da... | {"/test_celery/views/add.py": ["/tools/tasks.py", "/test_celery/models.py", "/tools/db.py"]} |
48,432 | lu-cq/my_flask | refs/heads/master | /manage.py | # coding: utf-8
from __future__ import absolute_import
from src.cli import main
if __name__ == '__main__':
main()
| {"/manage.py": ["/src/cli.py"], "/libs/logger/rsyslog.py": ["/libs/logger/filelogger.py"], "/src/cli.py": ["/src/ext.py", "/src/wsgi.py"], "/src/wsgi.py": ["/src/app.py"], "/src/views/schema/order.py": ["/src/views/schema/fields.py", "/src/views/schema/user.py"], "/src/models/order.py": ["/src/ext.py", "/src/models/use... |
48,433 | lu-cq/my_flask | refs/heads/master | /libs/logger/rsyslog.py | # coding=utf-8
from .filelogger import get_file_logger
__all__ = ['rsyslog']
class RsysLogger(object):
"""重写 rsyslog 日志写本地"""
@classmethod
def send(cls, message, tag=None):
logger = get_file_logger(tag)
if not tag:
tag = 'notag'
logger.info(message)
rsyslog = Rsys... | {"/manage.py": ["/src/cli.py"], "/libs/logger/rsyslog.py": ["/libs/logger/filelogger.py"], "/src/cli.py": ["/src/ext.py", "/src/wsgi.py"], "/src/wsgi.py": ["/src/app.py"], "/src/views/schema/order.py": ["/src/views/schema/fields.py", "/src/views/schema/user.py"], "/src/models/order.py": ["/src/ext.py", "/src/models/use... |
48,434 | lu-cq/my_flask | refs/heads/master | /src/views/schema/fields.py | # coding: utf-8
"""
API Schema Fields
~~~~~~~~~~~~~~~~~
This module includes a numbers of fields which is compatible with schema
classes defined in :class:`marshmallow.Schema`.
"""
from __future__ import absolute_import, unicode_literals
from marshmallow.fields import DateTime
from dateutil.tz impor... | {"/manage.py": ["/src/cli.py"], "/libs/logger/rsyslog.py": ["/libs/logger/filelogger.py"], "/src/cli.py": ["/src/ext.py", "/src/wsgi.py"], "/src/wsgi.py": ["/src/app.py"], "/src/views/schema/order.py": ["/src/views/schema/fields.py", "/src/views/schema/user.py"], "/src/models/order.py": ["/src/ext.py", "/src/models/use... |
48,435 | lu-cq/my_flask | refs/heads/master | /src/cli.py | # coding: utf-8
from __future__ import absolute_import
from flask_script import Manager
from flask_migrate import Migrate, MigrateCommand
from gunicorn.app.wsgiapp import WSGIApplication
from src.ext import db
from src.wsgi import app
manager = Manager(app)
migrate = Migrate(app, db)
manager.add_command('db', Migr... | {"/manage.py": ["/src/cli.py"], "/libs/logger/rsyslog.py": ["/libs/logger/filelogger.py"], "/src/cli.py": ["/src/ext.py", "/src/wsgi.py"], "/src/wsgi.py": ["/src/app.py"], "/src/views/schema/order.py": ["/src/views/schema/fields.py", "/src/views/schema/user.py"], "/src/models/order.py": ["/src/ext.py", "/src/models/use... |
48,436 | lu-cq/my_flask | refs/heads/master | /libs/logger/filelogger.py | # coding=utf-8
import logging
import os
from datetime import date
from logging import Formatter, handlers
def get_file_logger(name):
logger = logging.getLogger(name)
# 单例模式,如果已经注册了filehandler,直接返回logger
if logger.handlers:
return logger
formatter = Formatter('%(asctime)s\t%(message)s', '%Y-%m... | {"/manage.py": ["/src/cli.py"], "/libs/logger/rsyslog.py": ["/libs/logger/filelogger.py"], "/src/cli.py": ["/src/ext.py", "/src/wsgi.py"], "/src/wsgi.py": ["/src/app.py"], "/src/views/schema/order.py": ["/src/views/schema/fields.py", "/src/views/schema/user.py"], "/src/models/order.py": ["/src/ext.py", "/src/models/use... |
48,437 | lu-cq/my_flask | refs/heads/master | /src/wsgi.py | # -*- coding: UTF-8 -*-
# from envcfg.json.cms import DEBUG
# if not DEBUG:
# from gevent import monkey
# monkey.patch_all(thread=False)
from werkzeug.middleware.proxy_fix import ProxyFix
from werkzeug.middleware.profiler import ProfilerMiddleware
# from werkzeug.contrib.profiler import ProfilerMiddleware
fro... | {"/manage.py": ["/src/cli.py"], "/libs/logger/rsyslog.py": ["/libs/logger/filelogger.py"], "/src/cli.py": ["/src/ext.py", "/src/wsgi.py"], "/src/wsgi.py": ["/src/app.py"], "/src/views/schema/order.py": ["/src/views/schema/fields.py", "/src/views/schema/user.py"], "/src/models/order.py": ["/src/ext.py", "/src/models/use... |
48,438 | lu-cq/my_flask | refs/heads/master | /src/views/schema/order.py | # coding: utf-8
from marshmallow import Schema, fields, validates, validate, ValidationError
from src.views.schema.fields import LocalDateTimeField
from .user import UserSchema
fields.Field.default_error_messages = {
'required': u'缺少必填数据.',
'type': u'数据类型不合法.',
'null': u'数据不能为空.',
'validator_failed':... | {"/manage.py": ["/src/cli.py"], "/libs/logger/rsyslog.py": ["/libs/logger/filelogger.py"], "/src/cli.py": ["/src/ext.py", "/src/wsgi.py"], "/src/wsgi.py": ["/src/app.py"], "/src/views/schema/order.py": ["/src/views/schema/fields.py", "/src/views/schema/user.py"], "/src/models/order.py": ["/src/ext.py", "/src/models/use... |
48,439 | lu-cq/my_flask | refs/heads/master | /ipython_config.py | # Configuration file for ipython.
c = get_config()
c.InteractiveShellApp.exec_lines = [
'%load_ext autoreload',
'%autoreload 2',
'from source.app import create_app',
'create_app().app_context().push()',
]
| {"/manage.py": ["/src/cli.py"], "/libs/logger/rsyslog.py": ["/libs/logger/filelogger.py"], "/src/cli.py": ["/src/ext.py", "/src/wsgi.py"], "/src/wsgi.py": ["/src/app.py"], "/src/views/schema/order.py": ["/src/views/schema/fields.py", "/src/views/schema/user.py"], "/src/models/order.py": ["/src/ext.py", "/src/models/use... |
48,440 | lu-cq/my_flask | refs/heads/master | /src/models/order.py | # coding: utf-8
from werkzeug.utils import cached_property
from sqlalchemy import func, text, Index
from src.ext import db
from src.models.base import BaseModel
from src.models.user import User
class Order(db.Model, BaseModel):
__tablename__ = 'order'
id = db.Column(db.Integer, primary_key=True, autoincreme... | {"/manage.py": ["/src/cli.py"], "/libs/logger/rsyslog.py": ["/libs/logger/filelogger.py"], "/src/cli.py": ["/src/ext.py", "/src/wsgi.py"], "/src/wsgi.py": ["/src/app.py"], "/src/views/schema/order.py": ["/src/views/schema/fields.py", "/src/views/schema/user.py"], "/src/models/order.py": ["/src/ext.py", "/src/models/use... |
48,441 | lu-cq/my_flask | refs/heads/master | /src/ext.py | # coding: utf-8
from __future__ import absolute_import
from flask_sqlalchemy import SQLAlchemy
from itsdangerous import TimedJSONWebSignatureSerializer
from envcfg.json.flask import SECRET_KEY, TOKEN_EXPIRES_IN
token_object = TimedJSONWebSignatureSerializer(SECRET_KEY, TOKEN_EXPIRES_IN)
db = SQLAlchemy()
| {"/manage.py": ["/src/cli.py"], "/libs/logger/rsyslog.py": ["/libs/logger/filelogger.py"], "/src/cli.py": ["/src/ext.py", "/src/wsgi.py"], "/src/wsgi.py": ["/src/app.py"], "/src/views/schema/order.py": ["/src/views/schema/fields.py", "/src/views/schema/user.py"], "/src/models/order.py": ["/src/ext.py", "/src/models/use... |
48,442 | lu-cq/my_flask | refs/heads/master | /src/views/blueprint_factory.py | # coding: utf-8
from __future__ import absolute_import
from flask import Blueprint, jsonify, request, g
from werkzeug.exceptions import HTTPException
from marshmallow import ValidationError
from src.errors import GBaseError
from src.utils.request_log import log_request
class BlueprintFactory(object):
def __ini... | {"/manage.py": ["/src/cli.py"], "/libs/logger/rsyslog.py": ["/libs/logger/filelogger.py"], "/src/cli.py": ["/src/ext.py", "/src/wsgi.py"], "/src/wsgi.py": ["/src/app.py"], "/src/views/schema/order.py": ["/src/views/schema/fields.py", "/src/views/schema/user.py"], "/src/models/order.py": ["/src/ext.py", "/src/models/use... |
48,443 | lu-cq/my_flask | refs/heads/master | /src/views/schema/user.py | # coding: utf-8
from marshmallow import Schema, fields, validates, validate, ValidationError
from src.views.schema.fields import LocalDateTimeField
fields.Field.default_error_messages = {
'required': u'缺少必填数据.',
'type': u'数据类型不合法.',
'null': u'数据不能为空.',
'validator_failed': u'非法数据.'
}
class UserSchem... | {"/manage.py": ["/src/cli.py"], "/libs/logger/rsyslog.py": ["/libs/logger/filelogger.py"], "/src/cli.py": ["/src/ext.py", "/src/wsgi.py"], "/src/wsgi.py": ["/src/app.py"], "/src/views/schema/order.py": ["/src/views/schema/fields.py", "/src/views/schema/user.py"], "/src/models/order.py": ["/src/ext.py", "/src/models/use... |
48,444 | lu-cq/my_flask | refs/heads/master | /src/app.py | # coding: utf-8
import sys
import logging
from flask import Flask
from werkzeug.utils import import_string
from libs.logger.filelogger import get_file_logger
from tasks import make_celery
blueprints = [
'src.middlewares.auto_commit:bp',
'src.views.api.v1.order:bp',
]
extensions = [
'src.ext:db',
]
coll... | {"/manage.py": ["/src/cli.py"], "/libs/logger/rsyslog.py": ["/libs/logger/filelogger.py"], "/src/cli.py": ["/src/ext.py", "/src/wsgi.py"], "/src/wsgi.py": ["/src/app.py"], "/src/views/schema/order.py": ["/src/views/schema/fields.py", "/src/views/schema/user.py"], "/src/models/order.py": ["/src/ext.py", "/src/models/use... |
48,445 | lu-cq/my_flask | refs/heads/master | /src/models/user.py | # coding: utf-8
from sqlalchemy import func, text, Index
from src.ext import db
from src.models.base import BaseModel
class User(db.Model, BaseModel):
__tablename__ = 'user'
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
name = db.Column(db.String(50), nullable=False, server_default=''... | {"/manage.py": ["/src/cli.py"], "/libs/logger/rsyslog.py": ["/libs/logger/filelogger.py"], "/src/cli.py": ["/src/ext.py", "/src/wsgi.py"], "/src/wsgi.py": ["/src/app.py"], "/src/views/schema/order.py": ["/src/views/schema/fields.py", "/src/views/schema/user.py"], "/src/models/order.py": ["/src/ext.py", "/src/models/use... |
48,446 | lu-cq/my_flask | refs/heads/master | /src/middlewares/auto_commit.py | # -*- coding: utf-8 -*-
'''
本地支持跨域
'''
from flask import Blueprint, current_app
from sqlalchemy.exc import SQLAlchemyError
from src.ext import db
bp = Blueprint('middlewares.auto_commit', __name__)
@bp.after_app_request
def auto_commit(response):
# add for develop mode
try:
db.session.commit(... | {"/manage.py": ["/src/cli.py"], "/libs/logger/rsyslog.py": ["/libs/logger/filelogger.py"], "/src/cli.py": ["/src/ext.py", "/src/wsgi.py"], "/src/wsgi.py": ["/src/app.py"], "/src/views/schema/order.py": ["/src/views/schema/fields.py", "/src/views/schema/user.py"], "/src/models/order.py": ["/src/ext.py", "/src/models/use... |
48,447 | lu-cq/my_flask | refs/heads/master | /src/errors/__init__.py | # coding: utf-8
from __future__ import unicode_literals, absolute_import
class GBaseError(Exception):
errno = 2000
code = 0
class GNetworkTimeout(GBaseError):
errno = 5001
class TokenExpiresError(GBaseError):
errno = 4001
class UserNoExistError(GBaseError):
errno = 4004
| {"/manage.py": ["/src/cli.py"], "/libs/logger/rsyslog.py": ["/libs/logger/filelogger.py"], "/src/cli.py": ["/src/ext.py", "/src/wsgi.py"], "/src/wsgi.py": ["/src/app.py"], "/src/views/schema/order.py": ["/src/views/schema/fields.py", "/src/views/schema/user.py"], "/src/models/order.py": ["/src/ext.py", "/src/models/use... |
48,448 | lu-cq/my_flask | refs/heads/master | /src/views/api/blueprint.py | # coding: utf-8
from __future__ import absolute_import, unicode_literals
from flask import Blueprint
from src.views.blueprint_factory import BlueprintFactory
__all__ = ['create_blueprint']
create_blueprint = BlueprintFactory(
blueprint_class=Blueprint, url_package='api')
| {"/manage.py": ["/src/cli.py"], "/libs/logger/rsyslog.py": ["/libs/logger/filelogger.py"], "/src/cli.py": ["/src/ext.py", "/src/wsgi.py"], "/src/wsgi.py": ["/src/app.py"], "/src/views/schema/order.py": ["/src/views/schema/fields.py", "/src/views/schema/user.py"], "/src/models/order.py": ["/src/ext.py", "/src/models/use... |
48,449 | lu-cq/my_flask | refs/heads/master | /src/utils/request_log.py | # coding: utf-8
from uuid import uuid4
from libs.logger.rsyslog import rsyslog
__all__ = ['log_request']
hidden_fields = ['password']
def log_request(request, response, module_name):
"""Record request log"""
try:
req_id = uuid4().hex
req_remote_addr = request.remote_addr
req_host ... | {"/manage.py": ["/src/cli.py"], "/libs/logger/rsyslog.py": ["/libs/logger/filelogger.py"], "/src/cli.py": ["/src/ext.py", "/src/wsgi.py"], "/src/wsgi.py": ["/src/app.py"], "/src/views/schema/order.py": ["/src/views/schema/fields.py", "/src/views/schema/user.py"], "/src/models/order.py": ["/src/ext.py", "/src/models/use... |
48,450 | lu-cq/my_flask | refs/heads/master | /src/views/api/v1/order.py | # coding: utf-8
from __future__ import absolute_import, unicode_literals
from flask import jsonify, request, abort, g
from src.views.api.blueprint import create_blueprint
from src.views.schema.order import order_schema_data
from src.models.order import Order
bp = create_blueprint('order', 'v1', package_name=__name... | {"/manage.py": ["/src/cli.py"], "/libs/logger/rsyslog.py": ["/libs/logger/filelogger.py"], "/src/cli.py": ["/src/ext.py", "/src/wsgi.py"], "/src/wsgi.py": ["/src/app.py"], "/src/views/schema/order.py": ["/src/views/schema/fields.py", "/src/views/schema/user.py"], "/src/models/order.py": ["/src/ext.py", "/src/models/use... |
48,451 | lu-cq/my_flask | refs/heads/master | /tasks/order.py | # coding=utf8
from src.app import CELERY
@CELERY.task
def test(m, n):
"""celery test
"""
print('m+n=', m+n)
return None
| {"/manage.py": ["/src/cli.py"], "/libs/logger/rsyslog.py": ["/libs/logger/filelogger.py"], "/src/cli.py": ["/src/ext.py", "/src/wsgi.py"], "/src/wsgi.py": ["/src/app.py"], "/src/views/schema/order.py": ["/src/views/schema/fields.py", "/src/views/schema/user.py"], "/src/models/order.py": ["/src/ext.py", "/src/models/use... |
48,452 | lu-cq/my_flask | refs/heads/master | /celery_worker.py | # coding: utf-8
from src.app import create_app
current_app = create_app()
current_app.app_context().push()
from src.app import CELERY
| {"/manage.py": ["/src/cli.py"], "/libs/logger/rsyslog.py": ["/libs/logger/filelogger.py"], "/src/cli.py": ["/src/ext.py", "/src/wsgi.py"], "/src/wsgi.py": ["/src/app.py"], "/src/views/schema/order.py": ["/src/views/schema/fields.py", "/src/views/schema/user.py"], "/src/models/order.py": ["/src/ext.py", "/src/models/use... |
48,516 | eik4862/TinyCalculator | refs/heads/master | /Function/Exponential.py | from typing import final
from Function import Function
class ExpFun(Function.Fun):
"""
Exponential and logarithm function toolbox.
:cvar __sign: Signatures of exponential and logarithm functions.
"""
def __new__(cls) -> None:
raise NotImplementedError
# @classmethod
# def __exp... | {"/Function/Exponential.py": ["/Function/__init__.py"], "/Core/WarningManager.py": ["/Warning/__init__.py"], "/Function/Error.py": ["/Function/__init__.py"], "/Core/DB.py": ["/Error/__init__.py", "/Util/Macro.py"], "/Function/Signal.py": ["/Function/__init__.py"], "/Function/Combination.py": ["/Function/__init__.py"], ... |
48,517 | eik4862/TinyCalculator | refs/heads/master | /Core/WarningManager.py | from typing import List, final
from Core import Type, DB
from Warning import Warning
from Util import Printer
from Warning import *
@final
class WarnManager:
"""
Handle warning by generating proper warning messages in consistent form.
This class is implemented as singleton.
For the concept of single... | {"/Function/Exponential.py": ["/Function/__init__.py"], "/Core/WarningManager.py": ["/Warning/__init__.py"], "/Function/Error.py": ["/Function/__init__.py"], "/Core/DB.py": ["/Error/__init__.py", "/Util/Macro.py"], "/Function/Signal.py": ["/Function/__init__.py"], "/Function/Combination.py": ["/Function/__init__.py"], ... |
48,518 | eik4862/TinyCalculator | refs/heads/master | /Function/Error.py | from typing import final
from Function import Function
class ErrorFun(Function.Fun):
def __new__(cls, *args, **kwargs) -> None:
raise NotImplementedError
@final
class Erf(ErrorFun):
def __new__(cls, *args, **kwargs) -> None:
raise NotImplementedError
@final
class Erfc(ErrorFun):
def _... | {"/Function/Exponential.py": ["/Function/__init__.py"], "/Core/WarningManager.py": ["/Warning/__init__.py"], "/Function/Error.py": ["/Function/__init__.py"], "/Core/DB.py": ["/Error/__init__.py", "/Util/Macro.py"], "/Function/Signal.py": ["/Function/__init__.py"], "/Function/Combination.py": ["/Function/__init__.py"], ... |
48,519 | eik4862/TinyCalculator | refs/heads/master | /Core/DB.py | from decimal import Decimal
from typing import Dict, List, TextIO, final, Final, Union
from Core import Type
from Error import Error
from Util import Printer
from Util.Macro import is_comment, is_newline, is_tag
# from Function import *
@final
class DB:
"""
Load database from source file and manage them.
... | {"/Function/Exponential.py": ["/Function/__init__.py"], "/Core/WarningManager.py": ["/Warning/__init__.py"], "/Function/Error.py": ["/Function/__init__.py"], "/Core/DB.py": ["/Error/__init__.py", "/Util/Macro.py"], "/Function/Signal.py": ["/Function/__init__.py"], "/Function/Combination.py": ["/Function/__init__.py"], ... |
48,520 | eik4862/TinyCalculator | refs/heads/master | /Function/Signal.py | from typing import final, Final, List
from Function import Function
class SigFun(Function.Fun):
def __new__(cls, *args, **kwargs) -> None:
raise NotImplementedError
@final
class Ramp(SigFun):
__SGN: Final[List[str]] = ['Ramp[Real] -> Real', 'Ramp[Sym] -> Sym']
def __new__(cls, *args, **kwargs)... | {"/Function/Exponential.py": ["/Function/__init__.py"], "/Core/WarningManager.py": ["/Warning/__init__.py"], "/Function/Error.py": ["/Function/__init__.py"], "/Core/DB.py": ["/Error/__init__.py", "/Util/Macro.py"], "/Function/Signal.py": ["/Function/__init__.py"], "/Function/Combination.py": ["/Function/__init__.py"], ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.