index int64 | repo_name string | branch_name string | path string | content string | import_graph string |
|---|---|---|---|---|---|
23,625 | coleifer/walrus | refs/heads/master | /walrus/tests/database.py | from walrus.containers import *
from walrus.tests.base import WalrusTestCase
from walrus.tests.base import db
class TestWalrus(WalrusTestCase):
def test_get_key(self):
h = db.Hash('h1')
h['hk1'] = 'v1'
l = db.List('l1')
l.append('i1')
s = db.Set('s1')
s.add('k1')
... | {"/walrus/streams.py": ["/walrus/containers.py", "/walrus/utils.py"], "/walrus/tests/models.py": ["/walrus/__init__.py", "/walrus/query.py", "/walrus/tests/base.py"], "/walrus/tusks/vedisdb.py": ["/walrus/__init__.py"], "/examples/twitter/app.py": ["/walrus/__init__.py"], "/walrus/containers.py": ["/walrus/utils.py"], ... |
23,626 | coleifer/walrus | refs/heads/master | /walrus/rate_limit.py | import hashlib
import pickle
import time
from functools import wraps
class RateLimitException(Exception):
pass
class RateLimit(object):
"""
Rate limit implementation. Allows up to "limit" number of events every per
the given number of seconds.
"""
def __init__(self, database, name, limit=5, ... | {"/walrus/streams.py": ["/walrus/containers.py", "/walrus/utils.py"], "/walrus/tests/models.py": ["/walrus/__init__.py", "/walrus/query.py", "/walrus/tests/base.py"], "/walrus/tusks/vedisdb.py": ["/walrus/__init__.py"], "/examples/twitter/app.py": ["/walrus/__init__.py"], "/walrus/containers.py": ["/walrus/utils.py"], ... |
23,627 | coleifer/walrus | refs/heads/master | /walrus/tests/rate_limit.py | import time
from walrus.rate_limit import RateLimitException
from walrus.tests.base import WalrusTestCase
from walrus.tests.base import db
class TestRateLimit(WalrusTestCase):
def setUp(self):
super(TestRateLimit, self).setUp()
# Limit to 5 events per second.
self.rl = self.get_rate_limit... | {"/walrus/streams.py": ["/walrus/containers.py", "/walrus/utils.py"], "/walrus/tests/models.py": ["/walrus/__init__.py", "/walrus/query.py", "/walrus/tests/base.py"], "/walrus/tusks/vedisdb.py": ["/walrus/__init__.py"], "/examples/twitter/app.py": ["/walrus/__init__.py"], "/walrus/containers.py": ["/walrus/utils.py"], ... |
23,628 | coleifer/walrus | refs/heads/master | /walrus/lock.py | from functools import wraps
import os
class Lock(object):
"""
Lock implementation. Can also be used as a context-manager or
decorator.
Unlike the redis-py lock implementation, this Lock does not
use a spin-loop when blocking to acquire the lock. Instead,
it performs a blocking pop on a list. ... | {"/walrus/streams.py": ["/walrus/containers.py", "/walrus/utils.py"], "/walrus/tests/models.py": ["/walrus/__init__.py", "/walrus/query.py", "/walrus/tests/base.py"], "/walrus/tusks/vedisdb.py": ["/walrus/__init__.py"], "/examples/twitter/app.py": ["/walrus/__init__.py"], "/walrus/containers.py": ["/walrus/utils.py"], ... |
23,629 | coleifer/walrus | refs/heads/master | /walrus/tests/fts.py | #coding:utf-8
from walrus.tests.base import WalrusTestCase
from walrus.tests.base import db
class TestSearchIndex(WalrusTestCase):
def test_search_index(self):
phrases = [
('A faith is a necessity to a man. Woe to him who believes in '
'nothing.'),
('All who call on Go... | {"/walrus/streams.py": ["/walrus/containers.py", "/walrus/utils.py"], "/walrus/tests/models.py": ["/walrus/__init__.py", "/walrus/query.py", "/walrus/tests/base.py"], "/walrus/tusks/vedisdb.py": ["/walrus/__init__.py"], "/examples/twitter/app.py": ["/walrus/__init__.py"], "/walrus/containers.py": ["/walrus/utils.py"], ... |
23,630 | coleifer/walrus | refs/heads/master | /examples/diary.py | #!/usr/bin/env python
from collections import OrderedDict
import datetime
import sys
from walrus import *
database = Database(host='localhost', port=6379, db=0)
class Entry(Model):
__database__ = database
__namespace__ = 'diary'
content = TextField(fts=True)
timestamp = DateTimeField(default=dateti... | {"/walrus/streams.py": ["/walrus/containers.py", "/walrus/utils.py"], "/walrus/tests/models.py": ["/walrus/__init__.py", "/walrus/query.py", "/walrus/tests/base.py"], "/walrus/tusks/vedisdb.py": ["/walrus/__init__.py"], "/examples/twitter/app.py": ["/walrus/__init__.py"], "/walrus/containers.py": ["/walrus/utils.py"], ... |
23,631 | coleifer/walrus | refs/heads/master | /walrus/__init__.py | """
Lightweight Python utilities for working with Redis.
"""
__author__ = 'Charles Leifer'
__license__ = 'MIT'
__version__ = '0.9.3'
# ___
# .-9 9 `\
# =(:(::)= ;
# |||| \
# |||| `-.
# ,\|\| `,
# / \
# ... | {"/walrus/streams.py": ["/walrus/containers.py", "/walrus/utils.py"], "/walrus/tests/models.py": ["/walrus/__init__.py", "/walrus/query.py", "/walrus/tests/base.py"], "/walrus/tusks/vedisdb.py": ["/walrus/__init__.py"], "/examples/twitter/app.py": ["/walrus/__init__.py"], "/walrus/containers.py": ["/walrus/utils.py"], ... |
23,632 | kfjustis/dic-final | refs/heads/master | /encoder_lib.py | import cv2
from PIL import Image
import numpy as np
import pywt
def load_image_as_array(imgFile):
img = Image.open(imgFile)
imgArray = np.asarray(img)
return imgArray
| {"/encoder.py": ["/encoder_lib.py", "/zigzag_lib.py"], "/decoder.py": ["/encoder_lib.py", "/decoder_lib.py", "/zigzag_lib.py"]} |
23,633 | kfjustis/dic-final | refs/heads/master | /encoder.py | import encoder_lib as encoder
import zigzag_lib as ziggy
import huffman_lib as huffman
import getopt
import sys
def main(argv):
inputFile = ""
qsize = ""
# load file with command line args
try:
opts, args = getopt.getopt(argv,"i:q:")
except getopt.GetoptError:
print("USAGE: python... | {"/encoder.py": ["/encoder_lib.py", "/zigzag_lib.py"], "/decoder.py": ["/encoder_lib.py", "/decoder_lib.py", "/zigzag_lib.py"]} |
23,634 | kfjustis/dic-final | refs/heads/master | /zigzag_lib.py | import math
import numpy as np
'''
Source: http://wdxtub.com/interview/14520595473495.html
I modified this for functional design then converted it
to Python 3 with 2to3.
'''
def generateZigMatrix(matrix):
if matrix is None:
return None
i = 0
j = 0
m = len(matrix)
n = len(matrix[0])
ret... | {"/encoder.py": ["/encoder_lib.py", "/zigzag_lib.py"], "/decoder.py": ["/encoder_lib.py", "/decoder_lib.py", "/zigzag_lib.py"]} |
23,635 | kfjustis/dic-final | refs/heads/master | /decoder_lib.py | import cv2
from PIL import Image
import math
import matplotlib.pyplot as plt
import numpy as np
def getImageError(img1_arr, img2_arr):
if img1_arr is None or img2_arr is None:
return None
arr1 = img1_arr.ravel()
arr2 = img2_arr.ravel()
i = 0
error = 0.0
eArr = []
while i < len(arr... | {"/encoder.py": ["/encoder_lib.py", "/zigzag_lib.py"], "/decoder.py": ["/encoder_lib.py", "/decoder_lib.py", "/zigzag_lib.py"]} |
23,636 | kfjustis/dic-final | refs/heads/master | /decoder.py | import encoder_lib as encoder
import decoder_lib as decoder
import zigzag_lib as ziggy
import huffman_lib as huffman
import matplotlib.pyplot as plt
import getopt
import sys
def main(argv):
inputFile1 = ""
intputFile2 = ""
qsize = ""
# load file with command line args
try:
opts, args = ge... | {"/encoder.py": ["/encoder_lib.py", "/zigzag_lib.py"], "/decoder.py": ["/encoder_lib.py", "/decoder_lib.py", "/zigzag_lib.py"]} |
23,638 | alexabravo/Proyecto2 | refs/heads/master | /main.py | #Cristopher Jose Rodolfo Barrios Solis 18207
#Proyecto 2 Algoritmos
#Recomendar restaurantes
from Connectar import *
print("O _ 0 Bienvenido a nuestra aplicacion RESTAUNATOS O _ 0\n")
inicio = ("\n""Que desea hacer? (Ingrese numero)\n\n"
"1. Iniciar Sesion\n"
"2. Comer Ya!\n"
"3.... | {"/main.py": ["/Connectar.py"]} |
23,639 | alexabravo/Proyecto2 | refs/heads/master | /Connectar.py | #Cristopher Barrios 18207
#Documentacion https://neo4j-rest-client.readthedocs.io/en/latest/
from neo4jrestclient.client import GraphDatabase
gdb = GraphDatabase("http://localhost:7474", username="neo4j", password="CristopherBarrios")
#insertando
def agregarRestaurante(name):
CadenaDeRestaurantes= gdb.nodes.creat... | {"/main.py": ["/Connectar.py"]} |
23,650 | compunova/kozinaki | refs/heads/master | /kozinaki/providers/common.py | # Copyright (c) 2016 CompuNova Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | {"/kozinaki/providers/aws/provider.py": ["/kozinaki/providers/aws/config.py", "/kozinaki/providers/common.py"], "/kozinaki/providers/gcp/provider.py": ["/kozinaki/providers/common.py"], "/kozinaki/manage/manage.py": ["/kozinaki/manage/utils.py"], "/kozinaki/providers/libcloud_driver/provider.py": ["/kozinaki/providers/... |
23,651 | compunova/kozinaki | refs/heads/master | /kozinaki/manage/utils.py | import os
from jinja2 import Environment, PackageLoader, meta
PACKAGE_NAME = __name__[:__name__.rfind('.')]
def render_template(template, to_file=None, context=None):
path, template = os.path.split(template)
jenv = Environment(loader=PackageLoader(PACKAGE_NAME, path), keep_trailing_newline=True)
text = ... | {"/kozinaki/providers/aws/provider.py": ["/kozinaki/providers/aws/config.py", "/kozinaki/providers/common.py"], "/kozinaki/providers/gcp/provider.py": ["/kozinaki/providers/common.py"], "/kozinaki/manage/manage.py": ["/kozinaki/manage/utils.py"], "/kozinaki/providers/libcloud_driver/provider.py": ["/kozinaki/providers/... |
23,652 | compunova/kozinaki | refs/heads/master | /kozinaki/providers/aws/config.py | # Copyright (c) 2016 CompuNova Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | {"/kozinaki/providers/aws/provider.py": ["/kozinaki/providers/aws/config.py", "/kozinaki/providers/common.py"], "/kozinaki/providers/gcp/provider.py": ["/kozinaki/providers/common.py"], "/kozinaki/manage/manage.py": ["/kozinaki/manage/utils.py"], "/kozinaki/providers/libcloud_driver/provider.py": ["/kozinaki/providers/... |
23,653 | compunova/kozinaki | refs/heads/master | /kozinaki/utils.py | # Copyright (c) 2016 CompuNova Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | {"/kozinaki/providers/aws/provider.py": ["/kozinaki/providers/aws/config.py", "/kozinaki/providers/common.py"], "/kozinaki/providers/gcp/provider.py": ["/kozinaki/providers/common.py"], "/kozinaki/manage/manage.py": ["/kozinaki/manage/utils.py"], "/kozinaki/providers/libcloud_driver/provider.py": ["/kozinaki/providers/... |
23,654 | compunova/kozinaki | refs/heads/master | /kozinaki/providers/azure/provider.py | # Copyright (c) 2016 CompuNova Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | {"/kozinaki/providers/aws/provider.py": ["/kozinaki/providers/aws/config.py", "/kozinaki/providers/common.py"], "/kozinaki/providers/gcp/provider.py": ["/kozinaki/providers/common.py"], "/kozinaki/manage/manage.py": ["/kozinaki/manage/utils.py"], "/kozinaki/providers/libcloud_driver/provider.py": ["/kozinaki/providers/... |
23,655 | compunova/kozinaki | refs/heads/master | /kozinaki/network.py | # Copyright (c) 2016 CompuNova Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | {"/kozinaki/providers/aws/provider.py": ["/kozinaki/providers/aws/config.py", "/kozinaki/providers/common.py"], "/kozinaki/providers/gcp/provider.py": ["/kozinaki/providers/common.py"], "/kozinaki/manage/manage.py": ["/kozinaki/manage/utils.py"], "/kozinaki/providers/libcloud_driver/provider.py": ["/kozinaki/providers/... |
23,656 | compunova/kozinaki | refs/heads/master | /kozinaki/providers/aws/provider.py | # Copyright (c) 2016 CompuNova Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | {"/kozinaki/providers/aws/provider.py": ["/kozinaki/providers/aws/config.py", "/kozinaki/providers/common.py"], "/kozinaki/providers/gcp/provider.py": ["/kozinaki/providers/common.py"], "/kozinaki/manage/manage.py": ["/kozinaki/manage/utils.py"], "/kozinaki/providers/libcloud_driver/provider.py": ["/kozinaki/providers/... |
23,657 | compunova/kozinaki | refs/heads/master | /kozinaki/providers/__init__.py | # Copyright (c) 2016 CompuNova Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | {"/kozinaki/providers/aws/provider.py": ["/kozinaki/providers/aws/config.py", "/kozinaki/providers/common.py"], "/kozinaki/providers/gcp/provider.py": ["/kozinaki/providers/common.py"], "/kozinaki/manage/manage.py": ["/kozinaki/manage/utils.py"], "/kozinaki/providers/libcloud_driver/provider.py": ["/kozinaki/providers/... |
23,658 | compunova/kozinaki | refs/heads/master | /setup.py | from setuptools import setup, find_packages
def readme():
with open('README.md') as f:
return f.read()
setup(
name='kozinaki',
description='OpenStack multi-cloud driver for AWS, Azure',
url='https://github.com/compunova/kozinaki.git',
author='Compunova',
author_email='kozinaki@compu-n... | {"/kozinaki/providers/aws/provider.py": ["/kozinaki/providers/aws/config.py", "/kozinaki/providers/common.py"], "/kozinaki/providers/gcp/provider.py": ["/kozinaki/providers/common.py"], "/kozinaki/manage/manage.py": ["/kozinaki/manage/utils.py"], "/kozinaki/providers/libcloud_driver/provider.py": ["/kozinaki/providers/... |
23,659 | compunova/kozinaki | refs/heads/master | /kozinaki/providers/gcp/provider.py | # Copyright (c) 2016 CompuNova Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | {"/kozinaki/providers/aws/provider.py": ["/kozinaki/providers/aws/config.py", "/kozinaki/providers/common.py"], "/kozinaki/providers/gcp/provider.py": ["/kozinaki/providers/common.py"], "/kozinaki/manage/manage.py": ["/kozinaki/manage/utils.py"], "/kozinaki/providers/libcloud_driver/provider.py": ["/kozinaki/providers/... |
23,660 | compunova/kozinaki | refs/heads/master | /kozinaki/manage/manage.py | import os
import re
import json
import inspect
from collections import defaultdict
import yaml
from fabric.api import local, settings, hide
from libcloud.compute.types import Provider, OLD_CONSTANT_TO_NEW_MAPPING
from libcloud.compute.providers import get_driver as get_libcloud_driver
from .utils import render_templa... | {"/kozinaki/providers/aws/provider.py": ["/kozinaki/providers/aws/config.py", "/kozinaki/providers/common.py"], "/kozinaki/providers/gcp/provider.py": ["/kozinaki/providers/common.py"], "/kozinaki/manage/manage.py": ["/kozinaki/manage/utils.py"], "/kozinaki/providers/libcloud_driver/provider.py": ["/kozinaki/providers/... |
23,661 | compunova/kozinaki | refs/heads/master | /kozinaki/providers/libcloud_driver/extended_drivers.py | from libcloud.utils.py3 import httplib
from libcloud.compute.types import Provider
from libcloud.compute.providers import get_driver
from libcloud.compute.base import NodeSize
from libcloud.common.linode import API_ROOT
def get_extended_driver(driver_cls, nova_config=None):
extended_drivers = {
'Vultr': V... | {"/kozinaki/providers/aws/provider.py": ["/kozinaki/providers/aws/config.py", "/kozinaki/providers/common.py"], "/kozinaki/providers/gcp/provider.py": ["/kozinaki/providers/common.py"], "/kozinaki/manage/manage.py": ["/kozinaki/manage/utils.py"], "/kozinaki/providers/libcloud_driver/provider.py": ["/kozinaki/providers/... |
23,662 | compunova/kozinaki | refs/heads/master | /kozinaki/providers/libcloud_driver/provider.py | # Copyright (c) 2016 CompuNova Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | {"/kozinaki/providers/aws/provider.py": ["/kozinaki/providers/aws/config.py", "/kozinaki/providers/common.py"], "/kozinaki/providers/gcp/provider.py": ["/kozinaki/providers/common.py"], "/kozinaki/manage/manage.py": ["/kozinaki/manage/utils.py"], "/kozinaki/providers/libcloud_driver/provider.py": ["/kozinaki/providers/... |
23,663 | compunova/kozinaki | refs/heads/master | /kozinaki/manage/__main__.py | import os
import sys
import argparse
import pkg_resources
import yaml
import libcloud
import click
import click_spinner
from terminaltables import AsciiTable
from .manage import NodeManager
DEFAULT_LANG = 'en'
BASE_PATH = os.path.dirname(os.path.realpath(__file__))
CONTEXT_SETTINGS = {'help_option_names': ['-h', '--... | {"/kozinaki/providers/aws/provider.py": ["/kozinaki/providers/aws/config.py", "/kozinaki/providers/common.py"], "/kozinaki/providers/gcp/provider.py": ["/kozinaki/providers/common.py"], "/kozinaki/manage/manage.py": ["/kozinaki/manage/utils.py"], "/kozinaki/providers/libcloud_driver/provider.py": ["/kozinaki/providers/... |
23,664 | onkarmumbrekar/CFPWSN | refs/heads/master | /buildModel.py | # -*- coding: utf-8 -*-
"""
Created on Fri Jun 15 11:05:26 2018
@author: Onkar Mumbrekar
Website: www.onkarmumbrekar.co.in
"""
from scipy.spatial.distance import pdist, squareform
from dataClean import userCreation
def similarityMatrixCreation(P,sources,userdata):# P=user size, sources = temperature, humidity, ligh... | {"/buildModel.py": ["/dataClean.py"], "/test2.py": ["/Prediction_model.py", "/dataClean.py", "/buildModel.py"], "/test.py": ["/Prediction_model.py"]} |
23,665 | onkarmumbrekar/CFPWSN | refs/heads/master | /test2.py | # -*- coding: utf-8 -*-
"""
Created on Fri Jun 15 12:39:53 2018
@author: Onkar Mumbrekar
Website: www.onkarmumbrekar.co.in
"""
import pandas as pd
from Prediction_model import Prediction
from dataClean import cleanDataset,userCreation
from buildModel import similarityMatrixCreation
data_file = 'data.csv'
#dataset ... | {"/buildModel.py": ["/dataClean.py"], "/test2.py": ["/Prediction_model.py", "/dataClean.py", "/buildModel.py"], "/test.py": ["/Prediction_model.py"]} |
23,666 | onkarmumbrekar/CFPWSN | refs/heads/master | /dataClean.py | # -*- coding: utf-8 -*-
"""
Created on Fri Jun 15 09:36:45 2018
@author:Onkar Mumbrekar
Website: www.onkarmumbrekar.co.in
"""
import numpy as np
def userCreation(P,sources,userdata):
users = np.zeros((len(userdata.iloc[:])-P, P*sources))
for i in range(len(userdata.iloc[:])-P):
users[i]=np.array(use... | {"/buildModel.py": ["/dataClean.py"], "/test2.py": ["/Prediction_model.py", "/dataClean.py", "/buildModel.py"], "/test.py": ["/Prediction_model.py"]} |
23,667 | onkarmumbrekar/CFPWSN | refs/heads/master | /test.py | # -*- coding: utf-8 -*-
"""
Created on Thu Jun 14 09:54:37 2018
@author:Onkar Mumbrekar
Website: www.onkarmumbrekar.co.in
"""
import pandas as pd
from scipy.spatial.distance import pdist, squareform
from sklearn.model_selection import train_test_split
import numpy as np
import Prediction_model as pm
data_file = 'da... | {"/buildModel.py": ["/dataClean.py"], "/test2.py": ["/Prediction_model.py", "/dataClean.py", "/buildModel.py"], "/test.py": ["/Prediction_model.py"]} |
23,668 | onkarmumbrekar/CFPWSN | refs/heads/master | /Prediction_model.py | # -*- coding: utf-8 -*-
"""
Created on Wed Jun 13 16:41:56 2018
@author:Onkar Mumbrekar
Website: www.onkarmumbrekar.co.in
"""
import numpy as np
#def Prediction(user,item,w,userdata,p,sources):
# ri_dash = cal_rating_mean_ri_dash(userdata,item)
# #print("ri_dash ", ri_dash)
# sigma_i = cal_variance(userdata,... | {"/buildModel.py": ["/dataClean.py"], "/test2.py": ["/Prediction_model.py", "/dataClean.py", "/buildModel.py"], "/test.py": ["/Prediction_model.py"]} |
23,673 | citizen-stig/aquizz | refs/heads/master | /aquizz/settings/base.py | import os
class Config(object):
PROJECT_ROOT = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
CLIENT_BUILD_FOLDER = os.path.join(PROJECT_ROOT, 'aquizz-client', 'build')
STATIC_FOLDER = os.path.join(CLIENT_BUILD_FOLDER, 'static')
DEBUG = False
TESTING = False
MONGO... | {"/aquizz/settings/production.py": ["/aquizz/settings/base.py"], "/aquizz/settings/develop.py": ["/aquizz/settings/base.py"], "/aquizz/app.py": ["/aquizz/models.py", "/aquizz/admin.py", "/aquizz/api.py"], "/aquizz/wsgi.py": ["/aquizz/app.py"]} |
23,674 | citizen-stig/aquizz | refs/heads/master | /aquizz/settings/production.py | import os
from .base import Config as BaseConfig
from pymongo.uri_parser import parse_uri
def get_mongodb_settings():
connection_string = os.environ['MONGODB_URI']
parsed = parse_uri(connection_string)
first_node = parsed['nodelist'][0]
host, port = first_node
return {
'host': host,
... | {"/aquizz/settings/production.py": ["/aquizz/settings/base.py"], "/aquizz/settings/develop.py": ["/aquizz/settings/base.py"], "/aquizz/app.py": ["/aquizz/models.py", "/aquizz/admin.py", "/aquizz/api.py"], "/aquizz/wsgi.py": ["/aquizz/app.py"]} |
23,675 | citizen-stig/aquizz | refs/heads/master | /aquizz/exc.py | class QuizException(Exception):
pass
| {"/aquizz/settings/production.py": ["/aquizz/settings/base.py"], "/aquizz/settings/develop.py": ["/aquizz/settings/base.py"], "/aquizz/app.py": ["/aquizz/models.py", "/aquizz/admin.py", "/aquizz/api.py"], "/aquizz/wsgi.py": ["/aquizz/app.py"]} |
23,676 | citizen-stig/aquizz | refs/heads/master | /aquizz/gunicorn.conf.py | import os
import multiprocessing
port = os.getenv('PORT', '5000')
bind = '0.0.0.0:' + str(port)
worker_class = 'gevent'
workers = multiprocessing.cpu_count() * 2 + 1
threads = workers * 2
max_requests = 1000
| {"/aquizz/settings/production.py": ["/aquizz/settings/base.py"], "/aquizz/settings/develop.py": ["/aquizz/settings/base.py"], "/aquizz/app.py": ["/aquizz/models.py", "/aquizz/admin.py", "/aquizz/api.py"], "/aquizz/wsgi.py": ["/aquizz/app.py"]} |
23,677 | citizen-stig/aquizz | refs/heads/master | /aquizz/utils.py | import csv
from aquizz import models
def load_data_from_file(filename):
with open(filename) as csv_file:
csv_reader = csv.reader(csv_file, delimiter=',', quotechar='"')
for row in csv_reader:
text = row[0].strip()
question = models.Question.objects(text=text).first()
... | {"/aquizz/settings/production.py": ["/aquizz/settings/base.py"], "/aquizz/settings/develop.py": ["/aquizz/settings/base.py"], "/aquizz/app.py": ["/aquizz/models.py", "/aquizz/admin.py", "/aquizz/api.py"], "/aquizz/wsgi.py": ["/aquizz/app.py"]} |
23,678 | citizen-stig/aquizz | refs/heads/master | /aquizz/models.py | from bson import ObjectId
from datetime import datetime
from flask_mongoengine import MongoEngine
from flask_security import UserMixin, RoleMixin, MongoEngineUserDatastore
from aquizz import exc
db = MongoEngine()
class Option(db.EmbeddedDocument):
value = db.StringField(required=True)
is_correct = db.Boole... | {"/aquizz/settings/production.py": ["/aquizz/settings/base.py"], "/aquizz/settings/develop.py": ["/aquizz/settings/base.py"], "/aquizz/app.py": ["/aquizz/models.py", "/aquizz/admin.py", "/aquizz/api.py"], "/aquizz/wsgi.py": ["/aquizz/app.py"]} |
23,679 | citizen-stig/aquizz | refs/heads/master | /aquizz/settings/develop.py | import os
from .base import Config as BaseConfig
class Config(BaseConfig):
DEBUG = True
SECRET_KEY = 'super-secret'
SECURITY_PASSWORD_SALT = os.getenv('FLASK_PASSWORD_SALT', 'some_salt')
| {"/aquizz/settings/production.py": ["/aquizz/settings/base.py"], "/aquizz/settings/develop.py": ["/aquizz/settings/base.py"], "/aquizz/app.py": ["/aquizz/models.py", "/aquizz/admin.py", "/aquizz/api.py"], "/aquizz/wsgi.py": ["/aquizz/app.py"]} |
23,680 | citizen-stig/aquizz | refs/heads/master | /aquizz/admin.py | import pprint
from collections import defaultdict, OrderedDict
from flask import request, redirect, url_for
from flask_admin import AdminIndexView, expose
from flask_admin.babel import lazy_gettext
from flask_admin.contrib.mongoengine import ModelView, filters
from flask_security import current_user, login_required, r... | {"/aquizz/settings/production.py": ["/aquizz/settings/base.py"], "/aquizz/settings/develop.py": ["/aquizz/settings/base.py"], "/aquizz/app.py": ["/aquizz/models.py", "/aquizz/admin.py", "/aquizz/api.py"], "/aquizz/wsgi.py": ["/aquizz/app.py"]} |
23,681 | citizen-stig/aquizz | refs/heads/master | /aquizz/app.py | import importlib
import os
from flask import Flask, send_file
from flask_admin import Admin
from flask_restful import Api
from flask_security import Security
from aquizz.models import db
from aquizz.admin import AdminProtectedModelView, AdminProtectedIndexView, QuestionAdminView, QuizAdminView
from aquizz.models imp... | {"/aquizz/settings/production.py": ["/aquizz/settings/base.py"], "/aquizz/settings/develop.py": ["/aquizz/settings/base.py"], "/aquizz/app.py": ["/aquizz/models.py", "/aquizz/admin.py", "/aquizz/api.py"], "/aquizz/wsgi.py": ["/aquizz/app.py"]} |
23,682 | citizen-stig/aquizz | refs/heads/master | /aquizz/wsgi.py | import os
from aquizz.app import create_app
os.environ.setdefault('FLASK_SETTINGS', 'production')
app = create_app()
| {"/aquizz/settings/production.py": ["/aquizz/settings/base.py"], "/aquizz/settings/develop.py": ["/aquizz/settings/base.py"], "/aquizz/app.py": ["/aquizz/models.py", "/aquizz/admin.py", "/aquizz/api.py"], "/aquizz/wsgi.py": ["/aquizz/app.py"]} |
23,683 | citizen-stig/aquizz | refs/heads/master | /manage.py | import statistics
from flask_script import Manager, Command, Option
import numpy as np
from aquizz import app as app_factory
from aquizz import models
from aquizz import utils
class CreateAdminUser(Command):
option_list = (
Option('--email', '-e', dest='email'),
Option('--password', '-p', dest='... | {"/aquizz/settings/production.py": ["/aquizz/settings/base.py"], "/aquizz/settings/develop.py": ["/aquizz/settings/base.py"], "/aquizz/app.py": ["/aquizz/models.py", "/aquizz/admin.py", "/aquizz/api.py"], "/aquizz/wsgi.py": ["/aquizz/app.py"]} |
23,684 | citizen-stig/aquizz | refs/heads/master | /aquizz/api.py | import random
from bson import ObjectId
from flask_restful import Resource, abort
from marshmallow import fields, Schema
from webargs.flaskparser import use_args
from aquizz import models, exc
class NewQuizSchema(Schema):
player_name = fields.String(required=False)
class ItemSchema(Schema):
question_id = ... | {"/aquizz/settings/production.py": ["/aquizz/settings/base.py"], "/aquizz/settings/develop.py": ["/aquizz/settings/base.py"], "/aquizz/app.py": ["/aquizz/models.py", "/aquizz/admin.py", "/aquizz/api.py"], "/aquizz/wsgi.py": ["/aquizz/app.py"]} |
23,685 | luancaius/kaggle-manager | refs/heads/master | /service.py | import util
import sys
class Service:
def __init__(self, settings):
self.settings = settings
self.compName = settings["compName"]
self.filesToCopy = ['util.txt', 'customEmail.txt', 'main.txt', 'prepareData.txt',
'training.txt', 'tuning.txt', 'submission.txt']
... | {"/service.py": ["/util.py"], "/manager.py": ["/service.py"]} |
23,686 | luancaius/kaggle-manager | refs/heads/master | /util.py | import os
import shutil
def copyFileTo(src, filename, dst):
shutil.copy(src+'/'+filename, dst)
newfilename = os.path.splitext(filename)[0]+'.py'
os.rename(dst+'/'+filename, dst+'/'+newfilename)
def createDir(folder):
try:
if not os.path.exists(folder):
print('Creating folder '+fo... | {"/service.py": ["/util.py"], "/manager.py": ["/service.py"]} |
23,687 | luancaius/kaggle-manager | refs/heads/master | /manager.py | from service import Service
import json
with open('settings.txt') as f:
settings = json.load(f)
compName = input("Type Kaggle competition name to Download:")
settings["compName"] = compName
service = Service(settings)
service.InitCompetition()
exit(0)
| {"/service.py": ["/util.py"], "/manager.py": ["/service.py"]} |
23,688 | discoverygarden/IslandoraPYUtils | refs/heads/1.x | /islandoraUtils/metadata/eaccpf.py | #!/usr/bin/env python2.6
import logging
import datetime
from StringIO import StringIO
import base64
from islandoraUtils import xmlib
etree = xmlib.import_etree()
class EACCPF(object):
'''
A python library to deal with (a tiny subset) of EAC-CPF
See http://eac.staatsbibliothek-berlin.... | {"/islandoraUtils/metadata/tests/fedora_relationships.py": ["/islandoraUtils/metadata/fedora_relationships.py"], "/islandoraUtils/fedoraLib.py": ["/islandoraUtils/misc.py"], "/islandoraUtils/fileManipulator.py": ["/islandoraUtils/misc.py"], "/islandoraUtils/xacml/parser.py": ["/islandoraUtils/xacml/constants.py"], "/is... |
23,689 | discoverygarden/IslandoraPYUtils | refs/heads/1.x | /islandoraUtils/metadata/tests/fedora_relationships.py | import unittest
from islandoraUtils.metadata.fedora_relationships import rels_namespace, rels_object, rels_ext_string, rels_int_string, fedora_relationship, rels_predicate
from lxml import etree
import xml.etree.ElementTree
class XmlHelper:
@classmethod
def mangle(cls, xmlStr):
parser = etree.XMLParser... | {"/islandoraUtils/metadata/tests/fedora_relationships.py": ["/islandoraUtils/metadata/fedora_relationships.py"], "/islandoraUtils/fedoraLib.py": ["/islandoraUtils/misc.py"], "/islandoraUtils/fileManipulator.py": ["/islandoraUtils/misc.py"], "/islandoraUtils/xacml/parser.py": ["/islandoraUtils/xacml/constants.py"], "/is... |
23,690 | discoverygarden/IslandoraPYUtils | refs/heads/1.x | /islandoraUtils/fedoraLib.py | '''
Created on Apr 20, 2011
@author: William Panting
'''
import tempfile
import string
import re
import random
import subprocess
from urllib import quote
import logging
from StringIO import StringIO as StringIO
from fcrepo.connection import Connection
from fcrepo.client import FedoraClient as Client
from metadata impo... | {"/islandoraUtils/metadata/tests/fedora_relationships.py": ["/islandoraUtils/metadata/fedora_relationships.py"], "/islandoraUtils/fedoraLib.py": ["/islandoraUtils/misc.py"], "/islandoraUtils/fileManipulator.py": ["/islandoraUtils/misc.py"], "/islandoraUtils/xacml/parser.py": ["/islandoraUtils/xacml/constants.py"], "/is... |
23,691 | discoverygarden/IslandoraPYUtils | refs/heads/1.x | /islandoraUtils/xacml/constants.py |
XACML_NAMESPACE = "urn:oasis:names:tc:xacml:1.0:policy"
XACML = "{%s}" % XACML_NAMESPACE
XSI_NAMESPACE = "http://www.w3.org/2001/XMLSchema-instance"
XSI = "{%s}" % XSI_NAMESPACE
NSMAP = {None : XACML_NAMESPACE, 'xsi' : XSI_NAMESPACE}
XPATH_MAP = {'xacml' : XACML_NAMESPACE, 'xsi' : XSI_NAMESPACE}
stringequal = "urn:o... | {"/islandoraUtils/metadata/tests/fedora_relationships.py": ["/islandoraUtils/metadata/fedora_relationships.py"], "/islandoraUtils/fedoraLib.py": ["/islandoraUtils/misc.py"], "/islandoraUtils/fileManipulator.py": ["/islandoraUtils/misc.py"], "/islandoraUtils/xacml/parser.py": ["/islandoraUtils/xacml/constants.py"], "/is... |
23,692 | discoverygarden/IslandoraPYUtils | refs/heads/1.x | /islandoraUtils/xmlib.py | '''
Created on Apr 15, 2011
@file
This is unavoidable don't move around the order of functions/imports and calls in this file
@author
William Panting
@dependencies
lxml
'''
import logging
def import_etree():
'''
This function will import the best etree it can find.
Because dynamic importing is crazy this fu... | {"/islandoraUtils/metadata/tests/fedora_relationships.py": ["/islandoraUtils/metadata/fedora_relationships.py"], "/islandoraUtils/fedoraLib.py": ["/islandoraUtils/misc.py"], "/islandoraUtils/fileManipulator.py": ["/islandoraUtils/misc.py"], "/islandoraUtils/xacml/parser.py": ["/islandoraUtils/xacml/constants.py"], "/is... |
23,693 | discoverygarden/IslandoraPYUtils | refs/heads/1.x | /islandoraUtils/xacml/test.py | from islandoraUtils.xacml.tools import Xacml
xacml = Xacml()
xacml.managementRule.addUser('jon')
xacml.managementRule.addRole(['roleA', 'roleB'])
xacml.managementRule.removeRole('roleB')
xacml.viewingRule.addUser('feet')
xacml.viewingRule.addRole('toes')
xacml.datastreamRule.addUser('22')
xacml.datastreamRule.addDsi... | {"/islandoraUtils/metadata/tests/fedora_relationships.py": ["/islandoraUtils/metadata/fedora_relationships.py"], "/islandoraUtils/fedoraLib.py": ["/islandoraUtils/misc.py"], "/islandoraUtils/fileManipulator.py": ["/islandoraUtils/misc.py"], "/islandoraUtils/xacml/parser.py": ["/islandoraUtils/xacml/constants.py"], "/is... |
23,694 | discoverygarden/IslandoraPYUtils | refs/heads/1.x | /islandoraUtils/fileManipulator.py | '''
Created on May 5, 2011
@author
William Panting
This file is meant to help with file manipulations/alterations.
'''
from pyPdf import PdfFileWriter, PdfFileReader
import logging, os
from . import xmlib
from .misc import force_extract_integer_from_string
etree = xmlib.import_etree()
def appendPDFwithPDF(outFile,t... | {"/islandoraUtils/metadata/tests/fedora_relationships.py": ["/islandoraUtils/metadata/fedora_relationships.py"], "/islandoraUtils/fedoraLib.py": ["/islandoraUtils/misc.py"], "/islandoraUtils/fileManipulator.py": ["/islandoraUtils/misc.py"], "/islandoraUtils/xacml/parser.py": ["/islandoraUtils/xacml/constants.py"], "/is... |
23,695 | discoverygarden/IslandoraPYUtils | refs/heads/1.x | /setup.py | '''
Created on Apr 18, 2011
Setup script for isladoraUtils
@author: William Panting
'''
import os
from setuptools import setup, find_packages
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name='islandoraUtils',
version='0.1',
description='A Package... | {"/islandoraUtils/metadata/tests/fedora_relationships.py": ["/islandoraUtils/metadata/fedora_relationships.py"], "/islandoraUtils/fedoraLib.py": ["/islandoraUtils/misc.py"], "/islandoraUtils/fileManipulator.py": ["/islandoraUtils/misc.py"], "/islandoraUtils/xacml/parser.py": ["/islandoraUtils/xacml/constants.py"], "/is... |
23,696 | discoverygarden/IslandoraPYUtils | refs/heads/1.x | /islandoraUtils/misc.py | '''
Created on May 30, 2011
This is a holding place for useful re-usable code
that doesn't have a place anywhere else in the package
'''
import os
import hashlib
import re
def getMimeType(extension):
'''
This function will get the mimetype of the provided file extension
This is not fool proof, some exten... | {"/islandoraUtils/metadata/tests/fedora_relationships.py": ["/islandoraUtils/metadata/fedora_relationships.py"], "/islandoraUtils/fedoraLib.py": ["/islandoraUtils/misc.py"], "/islandoraUtils/fileManipulator.py": ["/islandoraUtils/misc.py"], "/islandoraUtils/xacml/parser.py": ["/islandoraUtils/xacml/constants.py"], "/is... |
23,697 | discoverygarden/IslandoraPYUtils | refs/heads/1.x | /islandoraUtils/metadata/fedora_relationships.py | from lxml import etree
import copy
import fcrepo #For type checking...
class rels_namespace:
def __init__(self, alias, uri):
self.alias = alias
self.uri = uri
def __repr__(self):
return '{%s}' % self.uri
class rels_object:
DSID = 1
LITERAL = 2
PID = 3
TYPES = [DSID, L... | {"/islandoraUtils/metadata/tests/fedora_relationships.py": ["/islandoraUtils/metadata/fedora_relationships.py"], "/islandoraUtils/fedoraLib.py": ["/islandoraUtils/misc.py"], "/islandoraUtils/fileManipulator.py": ["/islandoraUtils/misc.py"], "/islandoraUtils/xacml/parser.py": ["/islandoraUtils/xacml/constants.py"], "/is... |
23,698 | discoverygarden/IslandoraPYUtils | refs/heads/1.x | /islandoraUtils/DSConverter.py | '''
Created on March 5, 2011
@author: jonathangreen
Copyied into islandoraUtils by Adam Vessey
TODO: Should likely be made to use the fileConverter module, so as not to have
two copies of code which do much of the same thing... If someone is doing this
this should be treated as the cannonical copy. I have been updati... | {"/islandoraUtils/metadata/tests/fedora_relationships.py": ["/islandoraUtils/metadata/fedora_relationships.py"], "/islandoraUtils/fedoraLib.py": ["/islandoraUtils/misc.py"], "/islandoraUtils/fileManipulator.py": ["/islandoraUtils/misc.py"], "/islandoraUtils/xacml/parser.py": ["/islandoraUtils/xacml/constants.py"], "/is... |
23,699 | discoverygarden/IslandoraPYUtils | refs/heads/1.x | /islandoraUtils/fileConverter.py | '''
Created on Apr 5, 2011
@author: William Panting
@dependencies: Kakadu, ImageMagick, ABBYY CLI, Lame, SWFTools, FFmpeg
This is a Library that will make file conversions and manipulations like OCR using Python easier.
Primarily it will use Kakadu and ABBYY
but it will fall back on ImageMagick if Kakadu fails and fo... | {"/islandoraUtils/metadata/tests/fedora_relationships.py": ["/islandoraUtils/metadata/fedora_relationships.py"], "/islandoraUtils/fedoraLib.py": ["/islandoraUtils/misc.py"], "/islandoraUtils/fileManipulator.py": ["/islandoraUtils/misc.py"], "/islandoraUtils/xacml/parser.py": ["/islandoraUtils/xacml/constants.py"], "/is... |
23,700 | discoverygarden/IslandoraPYUtils | refs/heads/1.x | /islandoraUtils/xacml/parser.py | import islandoraUtils.xacml.constants as xacmlconstants
from islandoraUtils.xacml.exception import XacmlException
import string
from lxml import etree
def parse (xacml_string):
xacml = {}
xacml['rules'] = []
parser = etree.XMLParser(remove_blank_text=True)
root = etree.fromstring(xacml_string, parser)... | {"/islandoraUtils/metadata/tests/fedora_relationships.py": ["/islandoraUtils/metadata/fedora_relationships.py"], "/islandoraUtils/fedoraLib.py": ["/islandoraUtils/misc.py"], "/islandoraUtils/fileManipulator.py": ["/islandoraUtils/misc.py"], "/islandoraUtils/xacml/parser.py": ["/islandoraUtils/xacml/constants.py"], "/is... |
23,701 | discoverygarden/IslandoraPYUtils | refs/heads/1.x | /islandoraUtils/xacml/writer.py | from lxml import etree
import islandoraUtils.xacml.constants as xacmlconstants
from islandoraUtils.xacml.exception import XacmlException
def toXML(xacml, prettyprint=False):
# create the root element
policy = createRoot(xacml)
createTarget(policy, xacml)
createRules(policy, xacml)
# return the XML... | {"/islandoraUtils/metadata/tests/fedora_relationships.py": ["/islandoraUtils/metadata/fedora_relationships.py"], "/islandoraUtils/fedoraLib.py": ["/islandoraUtils/misc.py"], "/islandoraUtils/fileManipulator.py": ["/islandoraUtils/misc.py"], "/islandoraUtils/xacml/parser.py": ["/islandoraUtils/xacml/constants.py"], "/is... |
23,702 | discoverygarden/IslandoraPYUtils | refs/heads/1.x | /islandoraUtils/xacml/tools.py | import islandoraUtils.xacml.writer as xacmlwriter
import islandoraUtils.xacml.parser as xacmlparser
import islandoraUtils.xacml.constants as xacmlconst
from abc import ABCMeta
'''
@file
This file defines a set of object for manipulating XACML. Other files in the
XACML module provide a lower level access to creatin... | {"/islandoraUtils/metadata/tests/fedora_relationships.py": ["/islandoraUtils/metadata/fedora_relationships.py"], "/islandoraUtils/fedoraLib.py": ["/islandoraUtils/misc.py"], "/islandoraUtils/fileManipulator.py": ["/islandoraUtils/misc.py"], "/islandoraUtils/xacml/parser.py": ["/islandoraUtils/xacml/constants.py"], "/is... |
23,705 | chanonroy/ml-dog-or-cat | refs/heads/master | /models.py | import os
import tflearn
from tflearn.layers.conv import conv_2d, max_pool_2d
from tflearn.layers.core import input_data, dropout, fully_connected
from tflearn.layers.estimator import regression
IMG_SIZE = 50
LR = 1e-3
def setup_model(MODEL_NAME, IMG_SIZE, LEARNING_RATE):
"""
:MODEL_NAME: - str
:IMG_SIZE:... | {"/train.py": ["/models.py"], "/predict.py": ["/models.py"]} |
23,706 | chanonroy/ml-dog-or-cat | refs/heads/master | /train.py | import cv2 # resizing image
import numpy as np
import os
from random import shuffle
from tqdm import tqdm # progress bar for CLI
BASE_DIR = 'X:/Machine_Learning/Data/dogs_vs_cats'
TRAIN_DIR = BASE_DIR + '/train'
TEST_DIR = BASE_DIR + '/test1'
IMG_SIZE = 50
LR = 1e-3
MODEL_NAME = 'dogsvscats-{}-... | {"/train.py": ["/models.py"], "/predict.py": ["/models.py"]} |
23,707 | chanonroy/ml-dog-or-cat | refs/heads/master | /predict.py | import os
import cv2
import numpy as np
import models
IMG_SIZE = 50
LR = 1e-3
PATH = os.getcwd()
IMAGE_PATH = PATH + '/images/340.jpg'
MODEL_NAME = 'dogsvscats-0.001-6conv-basic'
class PetClassifier():
def __init__(self):
self.model = models.setup_model(MODEL_NAME, IMG_SIZE, LR)
def parse_img_from_p... | {"/train.py": ["/models.py"], "/predict.py": ["/models.py"]} |
23,720 | luciengaitskell/python-dagu-rs039 | refs/heads/master | /example/motor_drive_example.py | from dagurs039 import DaguRS039, data
from dagurs039.config import MotorLayout
import time
d = DaguRS039()
d.cfg(MotorLayout(MotorLayout.INDIV), data.lipo_low_bty_preset['2S'], 2, 2, 2, 2, 13500, 800, 10, 10)
num_mtrs = 4
for m in range(0, num_mtrs):
mp = [0] * num_mtrs
mp[m] = 10
print("Set Motor {} to 1... | {"/example/motor_drive_example.py": ["/dagurs039/__init__.py", "/dagurs039/config.py"], "/dagurs039/__init__.py": ["/dagurs039/main.py", "/dagurs039/config.py"], "/example/configure_example.py": ["/dagurs039/__init__.py", "/dagurs039/config.py"], "/setup.py": ["/dagurs039/__init__.py"], "/dagurs039/main.py": ["/dagurs0... |
23,721 | luciengaitskell/python-dagu-rs039 | refs/heads/master | /dagurs039/__init__.py | """An i2c interface library for the Dagu RS039 ComMotion motor controller."""
from .main import DaguRS039
from .config import MotorLayout
__version__ = '0.2'
| {"/example/motor_drive_example.py": ["/dagurs039/__init__.py", "/dagurs039/config.py"], "/dagurs039/__init__.py": ["/dagurs039/main.py", "/dagurs039/config.py"], "/example/configure_example.py": ["/dagurs039/__init__.py", "/dagurs039/config.py"], "/setup.py": ["/dagurs039/__init__.py"], "/dagurs039/main.py": ["/dagurs0... |
23,722 | luciengaitskell/python-dagu-rs039 | refs/heads/master | /dagurs039/data.py | # Values for low voltage configuration:
lipo_low_bty_preset = {'2S': 60, '3S': 90}
| {"/example/motor_drive_example.py": ["/dagurs039/__init__.py", "/dagurs039/config.py"], "/dagurs039/__init__.py": ["/dagurs039/main.py", "/dagurs039/config.py"], "/example/configure_example.py": ["/dagurs039/__init__.py", "/dagurs039/config.py"], "/setup.py": ["/dagurs039/__init__.py"], "/dagurs039/main.py": ["/dagurs0... |
23,723 | luciengaitskell/python-dagu-rs039 | refs/heads/master | /example/configure_example.py | from dagurs039 import DaguRS039, data
from dagurs039.config import MotorLayout
import time
d = DaguRS039()
d.cfg(MotorLayout(MotorLayout.INDIV), data.lipo_low_bty_preset['2S'], 2, 2, 2, 2, 13500, 800, 10, 10)
| {"/example/motor_drive_example.py": ["/dagurs039/__init__.py", "/dagurs039/config.py"], "/dagurs039/__init__.py": ["/dagurs039/main.py", "/dagurs039/config.py"], "/example/configure_example.py": ["/dagurs039/__init__.py", "/dagurs039/config.py"], "/setup.py": ["/dagurs039/__init__.py"], "/dagurs039/main.py": ["/dagurs0... |
23,724 | luciengaitskell/python-dagu-rs039 | refs/heads/master | /dagurs039/config.py | class MotorLayout:
OMNI3 = 0
OMNI4 = 1
MEC = 2
INDIV = 3
def __init__(self, base_layout: int, enc_enable: bool=False):
self.base = base_layout
if enc_enable:
self.enc = 0
else:
self.enc = 16
def as_num(self):
return self.base + self.enc
| {"/example/motor_drive_example.py": ["/dagurs039/__init__.py", "/dagurs039/config.py"], "/dagurs039/__init__.py": ["/dagurs039/main.py", "/dagurs039/config.py"], "/example/configure_example.py": ["/dagurs039/__init__.py", "/dagurs039/config.py"], "/setup.py": ["/dagurs039/__init__.py"], "/dagurs039/main.py": ["/dagurs0... |
23,725 | luciengaitskell/python-dagu-rs039 | refs/heads/master | /setup.py | #!/usr/bin/env python
from setuptools import setup, find_packages
from dagurs039 import __version__
setup(name='python-dagu-rs039',
version=__version__,
description='An i2c interface library for the Dagu RS039 ComMotion motor controller',
author='luciengaitskell',
packages=find_packages(),
... | {"/example/motor_drive_example.py": ["/dagurs039/__init__.py", "/dagurs039/config.py"], "/dagurs039/__init__.py": ["/dagurs039/main.py", "/dagurs039/config.py"], "/example/configure_example.py": ["/dagurs039/__init__.py", "/dagurs039/config.py"], "/setup.py": ["/dagurs039/__init__.py"], "/dagurs039/main.py": ["/dagurs0... |
23,726 | luciengaitskell/python-dagu-rs039 | refs/heads/master | /dagurs039/main.py | from . import data
from .config import MotorLayout
import smbus
import time
def split_high_low(arr):
return [(arr >> 8) & 0xff, arr & 0xff]
class DaguRS039:
def __init__(self, addr=0x1e, bus=1):
self.b = smbus.SMBus(1)
self.addr = addr
def cfg(self, mtr_cfg: MotorLayout, btry_lv: int, m... | {"/example/motor_drive_example.py": ["/dagurs039/__init__.py", "/dagurs039/config.py"], "/dagurs039/__init__.py": ["/dagurs039/main.py", "/dagurs039/config.py"], "/example/configure_example.py": ["/dagurs039/__init__.py", "/dagurs039/config.py"], "/setup.py": ["/dagurs039/__init__.py"], "/dagurs039/main.py": ["/dagurs0... |
23,727 | amithreddy/demoapp | refs/heads/master | /flaskserver.py | from flask import Flask, render_template, request, redirect, url_for, g
import imgrepo
app = Flask(__name__)
@app.route('/', methods= ['GET','POST'])
def main():
db = get_db()
#request is a global object that flask uses to store incoming request data
if request.method == "GET":
#Get all image link... | {"/flaskserver.py": ["/imgrepo.py"]} |
23,728 | amithreddy/demoapp | refs/heads/master | /imgrepo.py | import sqlite3
import os
import shutil
#This code is to acess a Sqlite server which holds the links to all the images in our repo.
class DB:
def __init__(self):
self.cursor=None
self.conn=None
self.masterdb='masterrepo.db'
self.dbfile='imgrepo.db'
self.connect()
def con... | {"/flaskserver.py": ["/imgrepo.py"]} |
23,730 | prabhakarkevat/graphtraversalpython | refs/heads/master | /MainClass.py | from Graph import Graph
class MainClass(object):
"""docstring for MainClass"""
def __init__(self):
super(MainClass, self).__init__()
def main(self):
adj_mat1 = [
[0, 1, 1, 0, 0, 0, 1],
[1, 0, 0, 0, 1, 0, 1],
[1, 0, 0, 1, 0, 0, 1],
[0, 0, 1, 0, 0, 1, 1],
[0, 1, 0, 0, 0, 1, 1],
[0, 0, 0, 1, ... | {"/MainClass.py": ["/Graph.py"]} |
23,731 | prabhakarkevat/graphtraversalpython | refs/heads/master | /Graph.py | from Stack import Stack
from Queue import Queue
class Graph(object):
"""docs for Graph"""
def __init__(self, n=0):
super(Graph, self).__init__()
self.n = n
def dfs(self, adj_mat, source=0):
path = "";
stack = Stack();
visited = [0] * self.n
stack.push(source)
stack.push(source)
visited[source] = 1... | {"/MainClass.py": ["/Graph.py"]} |
23,762 | ddu365/datawhale-code | refs/heads/master | /task7/dynamic_programming.py | # 0-1背包问题
# 递推关系: c[i][m]=max{c[i-1][m-w[i]]+p[i] (m>w[i]), c[i-1][m]}
# 参考链接: https://blog.csdn.net/superzzx0920/article/details/72178544
# n:物品件数;c:最大承重为c的背包;w:各个物品的重量;v:各个物品的价值
# 第一步建立最大价值矩阵(横坐标表示[0,c]整数背包承重):(n+1)*(c+1)
# 技巧:python 生成二维数组(数组)通常先生成列再生成行
def bag(n, c, w, p):
res = [[-1 for _ in range(c+1)]for ... | {"/task1/linkedlist_test.py": ["/task1/linkedlist.py"], "/task2/array_test.py": ["/task2/array.py"], "/task5/priority_queue.py": ["/task5/heap.py"], "/task2/trie_test.py": ["/task2/trie.py"]} |
23,763 | ddu365/datawhale-code | refs/heads/master | /task6/graph_adj_list.py | """
图的分类:
按边是否有方向可分为有向图和无向图
按边是否有权重可分为有权图和无权图
图的表示:
邻接表: 将所有与图中某个顶点u相连的顶点依此表示出来 [无需事先指定顶点数]
邻接矩阵: 一维数组存储图的顶点信息,二维数组(邻接矩阵)存储顶点间边的信息 [需事先指定顶点数]
"""
import copy
import queue
class Vertex:
def __init__(self, val):
self._val = val
self._adjacent = {}
self.visited = False
# self.previous... | {"/task1/linkedlist_test.py": ["/task1/linkedlist.py"], "/task2/array_test.py": ["/task2/array.py"], "/task5/priority_queue.py": ["/task5/heap.py"], "/task2/trie_test.py": ["/task2/trie.py"]} |
23,764 | ddu365/datawhale-code | refs/heads/master | /task3/bubble_sort.py | def bubble_sort(s):
"""
sort the elements of list s using the bubble-sort algorithm
Complexity: best O(n) avg O(n^2), worst O(n^2)
"""
for i in range(0, len(s)):
for j in range(1, len(s)-i):
if s[j-1] > s[j]:
s[j-1], s[j] = s[j], s[j-1]
return s
if __name__ ... | {"/task1/linkedlist_test.py": ["/task1/linkedlist.py"], "/task2/array_test.py": ["/task2/array.py"], "/task5/priority_queue.py": ["/task5/heap.py"], "/task2/trie_test.py": ["/task2/trie.py"]} |
23,765 | ddu365/datawhale-code | refs/heads/master | /task5/heap.py | """
Min Heap. A min heap is a complete binary tree where each node is smaller
its children. The root, therefore, is the minimum element in the tree. The min
heap use array to represent the data and operation. For example a min heap:
4
/ \
50 7
/ \ /
55 90 87
Heap [4, 50, 7, 55, 90, 87]
Method in class... | {"/task1/linkedlist_test.py": ["/task1/linkedlist.py"], "/task2/array_test.py": ["/task2/array.py"], "/task5/priority_queue.py": ["/task5/heap.py"], "/task2/trie_test.py": ["/task2/trie.py"]} |
23,766 | ddu365/datawhale-code | refs/heads/master | /task7/divide_conquer.py | # 逆序对个数
# 解题思路:
# 首先将给定的数组列表按索引递归的分成左右两部分,然后比较分割后的左右两部分,
# 当左边列表的元素大于右边的,往左移动左列表的索引,并记录逆序对个数
# 当右边列表的元素大于左边的,往左移动右列表的索引
# 最终将两个列表合成一个有序的列表
# 重复上述过程,直到将所有的左右列表合成一个列表。
global count
count = 0
def inverse_pairs(data):
return merge_sort(data)
def merge_sort(lists):
global count
if len(lists) <= 1:
r... | {"/task1/linkedlist_test.py": ["/task1/linkedlist.py"], "/task2/array_test.py": ["/task2/array.py"], "/task5/priority_queue.py": ["/task5/heap.py"], "/task2/trie_test.py": ["/task2/trie.py"]} |
23,767 | ddu365/datawhale-code | refs/heads/master | /task1/queue_test.py | import task1.queue as queue
from collections import deque
class MyCircularDeque:
def __init__(self, k: int):
"""
Initialize your data structure here. Set the size of the deque to be k.
"""
self._array = [None] * k
self._front = 0
self._rear = 0
self._size =... | {"/task1/linkedlist_test.py": ["/task1/linkedlist.py"], "/task2/array_test.py": ["/task2/array.py"], "/task5/priority_queue.py": ["/task5/heap.py"], "/task2/trie_test.py": ["/task2/trie.py"]} |
23,768 | ddu365/datawhale-code | refs/heads/master | /task7/backtracking.py | # N皇后
# 解题思路:
# 判断棋盘上某一行某一列的皇后与之前行上的皇后 是否在同列或同对角线上,
# 如果在,移动当前行的皇后至下一列,再判断是否在同列或同对角线上,如果移动到最后仍然在,则回溯到上一行,重复上述移动与判断的过程。
# 总结: 走不通,就掉头[采用深度优先的策略去搜索问题的解]
def place(x, k): # 判断是否冲突
for i in range(1, k):
# x[i] == x[k]判断i行皇后与k行皇后是否在同一列
# abs(x[i] - x[k]) == abs(i - k)判断i行的皇后与k行的皇后是否在对角线上
if x... | {"/task1/linkedlist_test.py": ["/task1/linkedlist.py"], "/task2/array_test.py": ["/task2/array.py"], "/task5/priority_queue.py": ["/task5/heap.py"], "/task2/trie_test.py": ["/task2/trie.py"]} |
23,769 | ddu365/datawhale-code | refs/heads/master | /task1/linkedlist_test.py | import task1.linkedlist as ll
import math
# 题目链接 https://leetcode-cn.com/problems/middle-of-the-linked-list/
def middle_node(head):
count = 0
d = {}
while head:
count += 1
d[count] = head
head = head.next
return d[math.ceil((count - 1) / 2) + 1].value
def reverse_singly_linke... | {"/task1/linkedlist_test.py": ["/task1/linkedlist.py"], "/task2/array_test.py": ["/task2/array.py"], "/task5/priority_queue.py": ["/task5/heap.py"], "/task2/trie_test.py": ["/task2/trie.py"]} |
23,770 | ddu365/datawhale-code | refs/heads/master | /task3/selection_sort.py | def selection_sort(s):
"""
sort the elements of list s using the selection-sort algorithm
Complexity: best O(n^2) avg O(n^2), worst O(n^2)
"""
for i in range(len(s)):
min_index = i
for j in range(i+1, len(s)):
if s[j] < s[min_index]:
min_index = j
... | {"/task1/linkedlist_test.py": ["/task1/linkedlist.py"], "/task2/array_test.py": ["/task2/array.py"], "/task5/priority_queue.py": ["/task5/heap.py"], "/task2/trie_test.py": ["/task2/trie.py"]} |
23,771 | ddu365/datawhale-code | refs/heads/master | /task2/brute_force.py | def find_brute(t, p):
"""
字符串匹配--bf 暴力搜索
:param t: 主串
:param p: 模式串
:return: 返回 子串p开始的t的最低索引(没找到则为-1)
"""
n, m = len(t), len(p)
for i in range(n-m+1):
k = 0
while k < m and t[i+k] == p[k]:
k += 1
if k == m:
return i
return -1
if __nam... | {"/task1/linkedlist_test.py": ["/task1/linkedlist.py"], "/task2/array_test.py": ["/task2/array.py"], "/task5/priority_queue.py": ["/task5/heap.py"], "/task2/trie_test.py": ["/task2/trie.py"]} |
23,772 | ddu365/datawhale-code | refs/heads/master | /task6/graph_adj_matrix.py | """
图的分类:
按边是否有方向可分为有向图和无向图
按边是否有权重可分为有权图和无权图
图的表示:
邻接表: 将所有与图中某个顶点u相连的顶点依此表示出来 [无需事先指定顶点数]
邻接矩阵: 一维数组存储图的顶点信息,二维数组(邻接矩阵)存储顶点间边的信息 [需事先指定顶点数]
"""
import copy
import queue
class Vertex:
def __init__(self, val):
self.val = val
# Mark all nodes unvisited
self.visited = False
def get_verte... | {"/task1/linkedlist_test.py": ["/task1/linkedlist.py"], "/task2/array_test.py": ["/task2/array.py"], "/task5/priority_queue.py": ["/task5/heap.py"], "/task2/trie_test.py": ["/task2/trie.py"]} |
23,773 | ddu365/datawhale-code | refs/heads/master | /task5/bst.py |
class Node:
def __init__(self, data):
self.data = data
self.left = None
self.right = None
class BST:
def __init__(self):
self._root = None
def get_root(self):
return self._root
def insert(self, data):
if self._root is None:
self._root = No... | {"/task1/linkedlist_test.py": ["/task1/linkedlist.py"], "/task2/array_test.py": ["/task2/array.py"], "/task5/priority_queue.py": ["/task5/heap.py"], "/task2/trie_test.py": ["/task2/trie.py"]} |
23,774 | ddu365/datawhale-code | refs/heads/master | /task2/array_test.py | import task2.array as cusArr
if __name__ == '__main__':
try:
a = cusArr.DynamicArray(2)
a.append(4)
a.append(5)
print(a)
print(len(a))
print(a.get_capacity())
# 动态扩容
a.append(8)
print(a)
print(len(a))
print(a.get_capacity())
... | {"/task1/linkedlist_test.py": ["/task1/linkedlist.py"], "/task2/array_test.py": ["/task2/array.py"], "/task5/priority_queue.py": ["/task5/heap.py"], "/task2/trie_test.py": ["/task2/trie.py"]} |
23,775 | ddu365/datawhale-code | refs/heads/master | /task3/binary_search.py | def bs(s, t):
"""
标准二分查找
:param s: 有序数组
:param t: target
:return: target在s中的索引
"""
l, r = 0, len(s) - 1
while l <= r:
m = (l + r) // 2
if t < s[m]:
r = m - 1
elif t > s[m]:
l = m + 1
else:
return m
return -1
def bs... | {"/task1/linkedlist_test.py": ["/task1/linkedlist.py"], "/task2/array_test.py": ["/task2/array.py"], "/task5/priority_queue.py": ["/task5/heap.py"], "/task2/trie_test.py": ["/task2/trie.py"]} |
23,776 | ddu365/datawhale-code | refs/heads/master | /task1/stack_test.py | import task1.stack as stack
class Browser:
def __init__(self):
self._fs = stack.ArrayStack() # forwards stack
self._bs = stack.LinkedListStack() # backwards stack
@staticmethod
def print_url(action, url):
print(f'action: {action} -- current page is {url}')
def open(self, ur... | {"/task1/linkedlist_test.py": ["/task1/linkedlist.py"], "/task2/array_test.py": ["/task2/array.py"], "/task5/priority_queue.py": ["/task5/heap.py"], "/task2/trie_test.py": ["/task2/trie.py"]} |
23,777 | ddu365/datawhale-code | refs/heads/master | /task3/merge_sort.py | """
the merge-sort algorithm proceeds as follows:
1. Divide: If S has zero or one element, return S immediately; it is already
sorted. Otherwise (S has at least two elements), remove all the elements
from S and put them into two sequences, S1 and S2 , each containing about
half of the elements of S; that is, S1 contain... | {"/task1/linkedlist_test.py": ["/task1/linkedlist.py"], "/task2/array_test.py": ["/task2/array.py"], "/task5/priority_queue.py": ["/task5/heap.py"], "/task2/trie_test.py": ["/task2/trie.py"]} |
23,778 | ddu365/datawhale-code | refs/heads/master | /task3/insert_sort.py | def insert_sort(s):
"""
sort the elements of list s using the insert-sort algorithm
Complexity: best O(n) avg O(n^2), worst O(n^2)
"""
for i in range(1, len(s)):
cur = s[i]
j = i
while j > 0 and cur < s[j-1]:
s[j] = s[j-1]
j -= 1
s[j] = cur
... | {"/task1/linkedlist_test.py": ["/task1/linkedlist.py"], "/task2/array_test.py": ["/task2/array.py"], "/task5/priority_queue.py": ["/task5/heap.py"], "/task2/trie_test.py": ["/task2/trie.py"]} |
23,779 | ddu365/datawhale-code | refs/heads/master | /task1/linkedlist.py | """"
Pros
Linked Lists have constant-time insertions and deletions in any position,
in comparison, arrays require O(n) time to do the same thing.
Linked lists can continue to expand without having to specify
their size ahead of time (remember our lectures on Array sizing
form the Array Sequence section of the course!)
... | {"/task1/linkedlist_test.py": ["/task1/linkedlist.py"], "/task2/array_test.py": ["/task2/array.py"], "/task5/priority_queue.py": ["/task5/heap.py"], "/task2/trie_test.py": ["/task2/trie.py"]} |
23,780 | ddu365/datawhale-code | refs/heads/master | /task5/priority_queue.py | from queue import PriorityQueue
from task5.heap import MinHeap
# built-in PriorityQueue using heapq and thread safe
que = PriorityQueue()
que.put(85)
que.put(24)
que.put(63)
que.put(45)
que.put(17)
que.put(31)
que.put(96)
que.put(50)
print('[built-in PriorityQueue]', [que.get() for _ in range(que.qsize())])
# my ... | {"/task1/linkedlist_test.py": ["/task1/linkedlist.py"], "/task2/array_test.py": ["/task2/array.py"], "/task5/priority_queue.py": ["/task5/heap.py"], "/task2/trie_test.py": ["/task2/trie.py"]} |
23,781 | ddu365/datawhale-code | refs/heads/master | /task7/recursion.py | from time import time
from functools import lru_cache
# 题目链接: https://leetcode-cn.com/problems/climbing-stairs/
# 递推公式: f(n) = f(n-1) + f(n-2) (f(1)=1,f(2)=2)
# 当n较大时,用递归会存在大量重复的存储与计算,效率低
# 自定义装饰器
# 参考链接: https://blog.csdn.net/mp624183768/article/details/79522231
def memo(func):
cache = {}
def wrap(*args):
... | {"/task1/linkedlist_test.py": ["/task1/linkedlist.py"], "/task2/array_test.py": ["/task2/array.py"], "/task5/priority_queue.py": ["/task5/heap.py"], "/task2/trie_test.py": ["/task2/trie.py"]} |
23,782 | ddu365/datawhale-code | refs/heads/master | /task2/trie.py | """
Implement a trie with insert, search, and startsWith methods.
Note:
You may assume that all inputs are consist of lowercase letters a-z.
"""
import collections
class TrieNode:
def __init__(self):
# 设置字典的默认值(value)为TrieNode类型
self.children = collections.defaultdict(TrieNode)
self.is_w... | {"/task1/linkedlist_test.py": ["/task1/linkedlist.py"], "/task2/array_test.py": ["/task2/array.py"], "/task5/priority_queue.py": ["/task5/heap.py"], "/task2/trie_test.py": ["/task2/trie.py"]} |
23,783 | ddu365/datawhale-code | refs/heads/master | /task4/lru.py | from functools import lru_cache
import urllib
# 参考链接: https://leetcode-cn.com/problems/lru-cache/
class LRUCache:
def __init__(self, capacity: int):
import collections
self.capacity = capacity
self._cache = collections.OrderedDict()
def get(self, key: int) -> int:
if self._ca... | {"/task1/linkedlist_test.py": ["/task1/linkedlist.py"], "/task2/array_test.py": ["/task2/array.py"], "/task5/priority_queue.py": ["/task5/heap.py"], "/task2/trie_test.py": ["/task2/trie.py"]} |
23,784 | ddu365/datawhale-code | refs/heads/master | /task3/quick_sort.py | """
the quick-sort algorithm consists of the following three steps :
1. Divide: If S has at least two elements (nothing needs to be done if S has
zero or one element), select a specific element x from S, which is called the
pivot. As is common practice, choose the pivot x to be the last element in S.
Remove all the ele... | {"/task1/linkedlist_test.py": ["/task1/linkedlist.py"], "/task2/array_test.py": ["/task2/array.py"], "/task5/priority_queue.py": ["/task5/heap.py"], "/task2/trie_test.py": ["/task2/trie.py"]} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.