code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-04-25 01:27
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migratio... | giocastagno/I.W._Delpuppo_Kopech_Castagno | turismo/sitio/migrations/0001_initial.py | Python | mit | 2,730 |
# https://leetcode.com/problems/build-array-where-you-can-find-the-maximum-exactly-k-comparisons
class Solution:
def numOfArrays(self, n: int, m: int, k: int) -> int:
M = 1000000007
ret = 0
for i in range(k, m+1):
ret += ((i-1)**(k-1)) * (i**(n-k))
return ret % M
# n =... | heyf/cloaked-octo-adventure | leetcode/1420_build-array-where-you-can-find-the-maximum-exactly-k-comparisons.py | Python | mit | 550 |
from fnote.blueprints.page.views import page
| carlegbert/wholenote | fnote/blueprints/page/__init__.py | Python | mit | 45 |
import numpy as np
import matplotlib.pyplot as plt
import libstarid
ls = libstarid.libstarid()
def test_sky(pathsky):
read_sky(pathsky)
imgdict = ls.image_generator(3)
plt.matshow(-1 * imgdict['pixels'], cmap='Greys', interpolation='nearest')
plt.show()
def read_sky(pathsky):
ls.read_sky(pathsky)
... | noahhsmith/starid | starid/util.py | Python | mit | 987 |
#
# In this file, there are code present for solving this problem using
# several different approaches. The first ones were two slow to be
# valid solution (Project EULER says that it should be possible to
# find an algorithm that solves the problem in less than 60 secs).
#
#
# In the end, method number five ended... | mo/project-euler | python/problem15.py | Python | mit | 8,409 |
import os
import sys
import shutil
import tempfile
import contextlib
from PySide import QtGui
from maya import (
cmds,
OpenMaya as api,
OpenMayaUI as apiUI
)
class Window(QtGui.QDialog):
def __init__(self, filename, parent=None):
super(Window, self).__init__(parent)
panel1 = QtGui.Q... | mottosso/maya-multicapture | multicapture.py | Python | mit | 4,677 |
class AuthenticationError(Exception):
pass
| kuldeep-k/pySocialFactory | socialFactory/core/AuthenticationError.py | Python | mit | 56 |
from cargo.base import CargoBase, lowercase, make_id_dict
class Image(CargoBase):
"""Python wrapper class encapsulating the metadata for a Docker Image"""
def __init__(self, *args, **kw):
super(Image, self).__init__(*args, **kw)
@property
def config(self, *args , **kw):
image = make_id_dict(self._do... | mvanveen/cargo | cargo/image.py | Python | mit | 1,022 |
"""
Support for IP Webcam, an Android app that acts as a full-featured webcam.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/android_ip_webcam/
"""
import asyncio
import logging
from datetime import timedelta
import voluptuous as vol
from homeassista... | miniconfig/home-assistant | homeassistant/components/android_ip_webcam.py | Python | mit | 9,809 |
"""Test pylint.extension.typing - consider-using-alias
'py-version' needs to be set to '3.7' or '3.8' and 'runtime-typing=no'.
"""
# pylint: disable=missing-docstring,invalid-name,unused-argument,line-too-long,unsubscriptable-object
import collections
import collections.abc
import typing
from collections.abc import Aw... | ruchee/vimrc | vimfiles/bundle/vim-python/submodules/pylint/tests/functional/t/typing/typing_consider_using_alias_without_future.py | Python | mit | 1,918 |
#! /user/bin/env python
__version__ = '0.8.53'
| jalanb/dotjab | src/python/__init__.py | Python | mit | 48 |
#!/usr/bin/env python
# coding=utf-8
import itertools, threading
import sys, math
import neopy
def main():
### USAGE: python -m neopy /dev/ttyACM0
if len(sys.argv) < 2:
sys.exit('python -m neopy /dev/ttyACM0')
dev = sys.argv[1]
### Named a device as neo_device
with neopy.neo(dev) as neo_d... | micvision/neo-sdk | neopy/neopy/__main__.py | Python | mit | 3,657 |
from secret import GOOGLE_API_KEY
from datetime import datetime
from util.arguments import Arguments
from discord.ext import commands
from shlex import split
from util.choices import enum
from collections import namedtuple
import util
import re
import urllib
import discord
class Portables:
def __init__(self, bot... | duke605/RunePy | commands/portables.py | Python | mit | 4,554 |
#!/usr/bin/env python
from __future__ import print_function
import numpy as np
from scipy.io import wavfile
def lmbinv(i, speed, fs, f1):
f0 = 10.
t1 = 20.
freq = f0 + (f1 - f0) * i / fs / t1
return freq / speed
def f_log(fs, i):
t = float(i) / fs
t1 = 10.
f0 = 20.
f1 = 20000.
re... | andreas-schmidt/tapetool | spiegel.py | Python | mit | 3,188 |
from pyramid.decorator import reify
from sqlalchemy import Column, ForeignKey, orm, distinct
from sqlalchemy.types import String, Integer
from sqlalchemy import event
from intranet3.models import Base, User, DBSession, Project
class Client(Base):
__tablename__ = 'client'
id = Column(Integer, primary_key=True... | stxnext/intranet-open | src/intranet3/intranet3/models/client.py | Python | mit | 2,225 |
# Copyright (C) 2010-2011 Richard Lincoln
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish... | rwl/PyCIM | CIM15/IEC61970/Informative/InfCustomers/ComplianceEvent.py | Python | mit | 2,503 |
from datetime import datetime
import tempfile
import os
import arcpy
import pandas as pd
import geodatabase_tempfile
import amaptor
import scripts.exceptions
import scripts.funcs
from .. import waterquality
from ..waterquality import classes
from ..waterquality import api
from .. import scripts
from ..scripts import... | ucd-cws/arcproject-wq-processing | arcproject/scripts/verify.py | Python | mit | 5,159 |
from pymongo import MongoClient
from helpers import db_url, db_database, parse_csv, to_int, to_float
mongo = MongoClient(db_url)
db = mongo[db_database]
print("Updating school information from 2015 data...")
for school in parse_csv("../data/2015/ks5_attainment.csv"):
# All schools are RECTYPE=1. Other RECTYPEs a... | danielgavrilov/schools | db/insert_schools.py | Python | mit | 1,894 |
class ParsingState(object):
"""
States of the parsing process.
"""
wait_for_header = 0
wait_for_section = 1
inside_section = 2
end = 4
| leandron/steinlib | steinlib/state.py | Python | mit | 163 |
class Solution:
def maxWidthOfVerticalArea(self, points: List[List[int]]) -> int:
xs = sorted(x for x, y in points)
return max(xs[i] - xs[i - 1] for i in range(1, len(xs)))
| jiadaizhao/LeetCode | 1601-1700/1637-Widest Vertical Area Between Two Points Containing No Points/1637-Widest Vertical Area Between Two Points Containing No Points.py | Python | mit | 193 |
"""
Flask-EasyWebDAV
-------------
This is the description for that library
"""
from setuptools import setup
setup(
name='Flask-EasyWebDAV',
version='0.1',
url='http://github.com/ghachey/flask-easywebdav',
license='MIT',
author='Ghislain Hachey',
author_email='ghachey@outlook.com',
descrip... | ghachey/flask-easywebdav | setup.py | Python | mit | 1,092 |
import time
import config
import util.cryptography
from linkr import db
class Link(db.Model):
"""
Model representing a link entry.
"""
__tablename__ = 'link'
link_id = db.Column(db.Integer, primary_key=True, autoincrement=True)
user_id = db.Column(db.Integer, index=True, default=None)
s... | LINKIWI/linkr | models/link.py | Python | mit | 3,658 |
class Automata(object):
def __init__(self, row, col, state):
self.row = row
self.col = col
self.init_state = state
self.state = state
self.neighbors = []
def connect(self, neighbor):
self.neighbors.append(neighbor)
def calc_next_state(self):
on_count... | dbjohnson/advent-of-code | solutions/day18/solution.py | Python | mit | 1,625 |
import os
import sys
from glad.lang.common.generator import Generator
from glad.lang.common.util import makefiledir
if sys.version_info >= (3, 0):
from urllib.request import urlretrieve
else:
from urllib import urlretrieve
KHRPLATFORM = 'https://www.khronos.org/registry/egl/api/KHR/khrplatform.h'
class C... | valeriog-crytek/glad | glad/lang/c/generator.py | Python | mit | 9,993 |
from django.conf import settings
from django.core.files import File
from django.db.models.fields.files import FieldFile
from django.db.models.fields.files import FileDescriptor
from datetime import datetime
import os.path
import subprocess
from videokit.apps import VideokitConfig
from videokit.tasks import generate_v... | pstreck/django-videokit | videokit/fields.py | Python | mit | 9,739 |
class Dict(dict):
'''
Simple dict but also support access as x.y style.
>>> d1=Dict()
>>> d1['x']=100
>>> d1.x
100
>>> d1.y=200
>>> d1['y']
200
>>> d2 = Dict(a=1, b=2, c='3')
>>> d2.c
'3'
>>> d2['empty']
Traceback (most recent call last):
...
KeyError... | YuHongJun/python-training | work_one/mydict2.py | Python | mit | 854 |
"""
homeassistant.components.mqtt
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
MQTT component, using paho-mqtt.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/mqtt/
"""
import json
import logging
import os
import socket
import time
from homeassistant.exceptions impo... | badele/home-assistant | homeassistant/components/mqtt/__init__.py | Python | mit | 9,508 |
# -*- coding: utf-8 -*-
from tests import TestElasticmock, INDEX_NAME, DOC_TYPE, BODY
UPDATED_BODY = {
'author': 'vrcmarcos',
'text': 'Updated Text'
}
class TestIndex(TestElasticmock):
def test_should_index_document(self):
data = self.es.index(index=INDEX_NAME, doc_type=DOC_TYPE, body=BODY)
... | vrcmarcos/elasticmock | tests/fake_elasticsearch/test_index.py | Python | mit | 2,017 |
from jsonrpc import ServiceProxy
import sys
import string
# ===== BEGIN USER SETTINGS =====
# if you do not set these you will be prompted for a password for every command
rpcuser = ""
rpcpass = ""
# ====== END USER SETTINGS ======
if rpcpass == "":
access = ServiceProxy("http://127.0.0.1:22713")
else:
access = Se... | Capricoinofficial/Capricoin | contrib/bitrpc/bitrpc.py | Python | mit | 7,842 |
#!/usr/bin/env python
"""
Copyright 2014 Jirafe, 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 applicab... | concerned3rdparty/jirafe-python | jirafe/models/Category.py | Python | mit | 944 |
from django.contrib.auth.models import User
from django.test import TestCase
from django.test.client import Client
from django.utils import timezone
from channel_facebook.channel import FacebookChannel
from channel_facebook.models import FacebookAccount
from core import models
class FacebookBaseTestCase(TestCase):
... | daisychainme/daisychain | daisychain/channel_facebook/tests/test_base.py | Python | mit | 2,078 |
from setuptools import setup, find_packages
import os
name = "presence_analyzer"
version = "0.2.0"
def read(*rnames):
return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
setup(
name=name,
version=version,
description="Presence analyzer",
long_description=read('README.md'),
... | stxnext-kindergarten/presence-analizer-rkierzkowski | setup.py | Python | mit | 909 |
"""Contains code for modelling coiled coils and collagens."""
import numpy
from ampal.specifications.polymer_specs.helix import HelicalHelix, _helix_parameters
from ampal.protein import Assembly
basis_set_parameters = {
2: {'name': 'CC-Di', 'pitch': 225.8, 'radius': 5.07, 'interface_angle': 283.56,
'sequ... | woolfson-group/isambard | isambard/ampal/specifications/assembly_specs/coiledcoil.py | Python | mit | 8,988 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'K:\Library\Python\AssetsBrowser\ui\window\applications_list.ui'
#
# Created by: PyQt5 UI code generator 5.14.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_AppListDialog(obj... | hueyyeng/AssetsBrowser | ui/window/ui_applications_list.py | Python | mit | 7,328 |
import argparse
import glob
import matplotlib.pyplot as plt
import numpy as np
import os
import pandas as pd
import pickle
from sklearn.preprocessing import StandardScaler, normalize
import sys
import common
FACT = 'pmi' # nmf/pmi_wl/pmi_wp/pmi_wlp
DIM = 200
DATASET = 'MSDmm'
WINDOW = 1
NSAMPLES = 'all' #all
MAX_N_S... | sergiooramas/tartarus | src/load.py | Python | mit | 6,438 |
import sys
import pygame
import time
import cPickle
from view_port import ViewPort
from grid import Grid
from mover import RandomMover
from terrain import TerrainData
from terrain.generators import MeteorTerrainGenerator, Smoother
from terrain.generators import PlasmaFractalGenerator
class Game:
def __init__(sel... | Apreche/Project-DORF | game.py | Python | mit | 6,031 |
"""
WSGI config for CanIGoPee project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CanIGoPee.settings")
from django.co... | Winawer/CanIGo | CanIGoPee/wsgi.py | Python | mit | 393 |
count = 0
total = 0
average = 0
while True:
inputNumber = raw_input('Enter a number : ')
# Edge Cases
if inputNumber == 'done':
break
if len(inputNumber) < 1:
break
# Logical work
try:
number = float(inputNumber)
except:
print 'Invalid Number'
conti... | rahulbohra/Python-Basic | 35_sum_count_avg_by_user_input.py | Python | mit | 454 |
# SPDX-License-Identifier: MIT
# Copyright (C) 2019 Tobias Gruetzmacher
from dosagelib.helpers import joinPathPartsNamer, queryNamer
class TestNamer(object):
"""
Tests for comic namer.
"""
def test_queryNamer(self):
testurl = 'http://FOO?page=result&page2=result2'
assert queryNamer('p... | webcomics/dosage | tests/test_helpers.py | Python | mit | 894 |
import orbit
| edermartioli/ExoplanetLight | src/test/test-orbit.py | Python | mit | 13 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
:mod:`processing`
==================
.. module:: processing
:platform: Unix, Windows
:synopsis:
.. moduleauthor:: hbldh <henrik.blidh@nedomkull.com>
Created on 2015-08-26, 14:48
"""
from __future__ import division
from __future__ import print_function
from _... | hbldh/wlmetrics | wlmetrics/data/processing.py | Python | mit | 1,548 |
# -*- coding: utf-8 -*-
'''
Created on 18 oct 2013
@author: franck
'''
from django.db import models
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from django.contrib.auth.models import User
from movesevent.models.movesApp import MovesApp
class MovesUser(models.Mod... | francxk/moves-event | movesevent/models/movesUser.py | Python | mit | 1,082 |
# Copyright (c) 2006-2014 LOGILAB S.A. (Paris, FRANCE) <contact@logilab.fr>
# Copyright (c) 2009 Vincent
# Copyright (c) 2009 Mads Kiilerich <mads@kiilerich.com>
# Copyright (c) 2012-2014 Google, Inc.
# Copyright (c) 2014-2018, 2020 Claudiu Popa <pcmanticore@gmail.com>
# Copyright (c) 2014-2015 Michal Nowikowski <godfr... | ruchee/vimrc | vimfiles/bundle/vim-python/submodules/pylint/pylint/utils/__init__.py | Python | mit | 3,308 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import rdkit
from rdkit.Chem import AllChem
from rdkit import DataStructs
__license__ = "X11"
METADATA = {
"id": "method_rdkit_ecfc2_tanimoto",
"representation": "ecfc2",
"similarity": "tanimoto"
}
def _compute_fingerprint(molecule):
return AllChem.GetM... | skodapetr/lbvs-environment | methods/ecfc/ecfc2_tanimoto.py | Python | mit | 1,365 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'CourierCity'
db.create_table(u'checkout_couriercity', (
(u'id', self.gf('django.... | Lisaveta-K/lisaveta-k.github.io | _site/tomat/apps/checkout/migrations/0009_courier_cities.py | Python | mit | 15,694 |
import os
import platform
from setuptools import setup
# "import" __version__
__version__ = 'unknown'
for line in open('sounddevice.py'):
if line.startswith('__version__'):
exec(line)
break
MACOSX_VERSIONS = '.'.join([
'macosx_10_6_x86_64', # for compatibility with pip < v21
'macosx_10_6_... | spatialaudio/python-sounddevice | setup.py | Python | mit | 2,712 |
"""
Django base settings for Waldur Core.
"""
from datetime import timedelta
import locale
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
import warnings
from waldur_core.core import WaldurExtension
from waldur_core.core.metadata import WaldurConfiguration
from waldur_core.server.adm... | opennode/nodeconductor-assembly-waldur | src/waldur_core/server/base_settings.py | Python | mit | 9,157 |
import sys
import numpy as np
import cv2
def main():
w, h = map(int, (sys.argv[1] if len(sys.argv) > 1 else '2048x1944').split('x'))
imgfile = sys.argv[2] if len(sys.argv) > 2 else r'D:\Downloads\example-navcam-imgs\navcamTests0619\rubbleML-def-14062019-25.raw'
imgout = sys.argv[3] if len(sys.ar... | oknuutti/visnav-py | visnav/iotools/read-raw-img.py | Python | mit | 811 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# http://www.forum-raspberrypi.de/Thread-python-taster-mit-mehreren-funktionen?pid=134513#pid134513
#
# v0.1 by meigrafd
#
# https://github.com/SoCo/SoCo
#
import sys
from time import sleep, time
import RPi.GPIO as GPIO
import signal
from soco import SoCo
#-------------------... | meigrafd/Sample-Code | gpio_multifunction.py | Python | mit | 3,122 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-11-26 02:30
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('crm', '0001_initial'),
]
operations = [
migrations.AlterField(
m... | rg3915/orcamentos | orcamentos/crm/migrations/0002_auto_20161126_0030.py | Python | mit | 1,108 |
# -*- coding: utf-8 -*-
"""VocabTool database module
This is the database module of 'VocabTool'.
It connects the program with external database
"""
# Standard library
import sqlite3
# TODO: Implement function:add_to_database <RihanW>
def add_to_database(word):
"""Add the current word to local database"""
pa... | RihanWu/vocabtool | database.py | Python | mit | 323 |
#!/usr/bin/env python3
"""Artistools - NLTE population related functions."""
import argparse
import math
import multiprocessing
import os
# import re
# import sys
# from functools import lru_cache
# from functools import partial
from pathlib import Path
# from itertools import chain
import matplotlib.pyplot as plt
imp... | lukeshingles/artistools | artistools/nltepops/plotnltepops.py | Python | mit | 24,895 |
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies and Contributors
# See license.txt
from __future__ import unicode_literals
import frappe
import unittest
# test_records = frappe.get_test_records('Integration Service')
class TestIntegrationService(unittest.TestCase):
pass
| vqw/frappe | frappe/integration_broker/doctype/integration_service/test_integration_service.py | Python | mit | 293 |
#!/usr/bin/env python3
# imports go here
import threading
#
# Free Coding session for 2015-04-09
# Written by Matt Warren
#
data = threading.local()
def message():
print(data.name)
class Foo(threading.Thread):
def run(self):
data.name = self.getName()
message()
if __name__ == '__main__':
... | mfwarren/FreeCoding | 2015/04/fc_2015_04_09.py | Python | mit | 378 |
__author__ = 'Tom Schaul, tom@idsia.ch and Daan Wiertra, daan@idsia.ch'
from scipy import zeros, array, mean, randn, exp, dot, argmax
from pybrain.datasets import ReinforcementDataSet, ImportanceDataSet, SequentialDataSet
from pybrain.supervised import BackpropTrainer
from pybrain.utilities import drawIndex
from pybr... | rbalda/neural_ocr | env/lib/python2.7/site-packages/pybrain/rl/learners/directsearch/rwr.py | Python | mit | 9,259 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/agfood/azure-mgmt-agfood/azure/mgmt/agfood/aio/_configuration.py | Python | mit | 3,236 |
from typing import List
from test_framework import generic_test
def get_max_trapped_water(heights: List[int]) -> int:
# TODO - you fill in here.
return 0
if __name__ == '__main__':
exit(
generic_test.generic_test_main('max_trapped_water.py',
'max_trapped_w... | shobhitmishra/CodingProblems | epi_judge_python/max_trapped_water.py | Python | mit | 394 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
#
# written by Shotaro Fujimoto
# 2016-05-30
import os
import sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from triangular import LatticeTriangular as LT
from base import Main as base
import numpy as np
import random
from tqdm import tq... | ssh0/growing-string | triangular_lattice/moving_string/moving_string_deadlock.py | Python | mit | 5,500 |
# -*- coding: utf-8 -*-
"""
Created on Fri Oct 7 13:10:05 2016
@author: thasegawa
"""
import os
import pandas as pd
economic_list = list(pd.read_excel('data\\fields\\economicIndicators_Real.xlsx', header=None)[0])
#fuel_list = list(pd.read_excel('data\\fields\\fuel_binary.xlsx', header=None)[0]) + [None]
fuel_list ... | tzechiop/PANYNJ-Regression-Analysis-for-Toll-Traffic-Elasticity | mergeResults.py | Python | mit | 2,928 |
from math import *
import math
import random, time
import BuildGeometry
from direct.directnotify import DirectNotifyGlobal
from direct.distributed import DistributedObjectAI
from pandac.PandaModules import *
from toontown.golf import PhysicsWorldBase
from toontown.toonbase import ToontownGlobals
class DistributedPhy... | ToonTownInfiniteRepo/ToontownInfinite | toontown/golf/DistributedPhysicsWorldAI.py | Python | mit | 2,425 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ComboBox.ui'
#
# Created by: PyQt5 UI code generator 5.6
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_comboBoxDialog(object):
def setupUi(self, comboBoxDialog):
co... | AndrewReynen/Lazylyst | lazylyst/UI/ComboBox.py | Python | mit | 2,055 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting model 'Category'
db.delete_table('blogs_category')
# Deleting model 'Tag'
db.del... | carquois/blobon | blobon/blogs/migrations/0008_auto__del_category__del_tag__del_field_blog_status.py | Python | mit | 6,240 |
import sys
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
class Visualizer():
def __init__(self, *args):
pass
def show_performance(self, list_of_tuples, fig_size=(9,9), font_scale=1.1, file=''):
"""
Parameters: list_of_tuples:
... | magnusax/ml-meta-wrapper | gazer/visualize.py | Python | mit | 1,824 |
import numpy
scale = 1000
def unit(v):
return (v / numpy.linalg.norm(v))
def angle(v1, v2):
v1_u = unit(v1)
v2_u = unit(v2)
angle = numpy.arccos(numpy.dot(v1_u, v2_u))
if numpy.isnan(angle):
if (v1_u == v2_u).all():
return 0.0
else:
return numpy.pi
retu... | bepo13/destinydb-stl-generator-v0 | src/DestinyModelGenStl.py | Python | mit | 6,240 |
# coding=utf-8
from django.shortcuts import render
from django.contrib.auth.decorators import login_required
from django.views.decorators.debug import sensitive_post_parameters
from django.views.decorators.csrf import csrf_protect
from django.contrib.auth.forms import AuthenticationForm,PasswordChangeForm
from django.s... | Pabjimcas/produccionEcologica | ecologica/views.py | Python | mit | 158,738 |
import datetime
from django.db import models
from django.utils import timezone
class Question(models.Model):
question_text = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
def __str__(self):
return self.question_text
def was_published_recently(self):
... | gnhuy91/django-tutorial-docker | apps/polls/models.py | Python | mit | 696 |
"""Strict and non strict symboldict feature tests."""
from __future__ import (absolute_import, division,
print_function, unicode_literals)
from functools import partial
import pytest
from pytest_bdd import (
given,
scenario,
then,
when,
)
import symboldict as sd
scenario = part... | Gribouillis/symboldict | tests/various/test_strict.py | Python | mit | 6,420 |
class vEB_Tree():
import math
def __init__(self, u):
self.min = None
self.max = None
self.u = u
self.summary = None
self.ul = math.floor(math.sqrt(self.u))
self.uh = math.ceil(math.sqrt(self.u))
#self.cluster = [None] * self.uh
if not self.is_leaf(... | JasonVann/CLRS | S5_AdvancedDataStructures/C20_vanEmdeBoasTrees/vEB_Tree.py | Python | mit | 3,635 |
import tkinter as tk
#Stack frame implementation provided by jonrsharpe on Stack overflow
#https://stackoverflow.com/questions/26213549/switching-between-frames-in-tkinter-menu
#Base Frame Template
class Base(tk.Frame):
def __init__(self, parent, controller):
tk.Frame.__init__(self, parent)
self.controller = co... | SanSanchez/Beaver | beaver_gui.py | Python | mit | 4,414 |
# -*- coding: utf-8 -*-
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from Ui_load import Ui_Load
class Loading(QDialog, Ui_Load):
"""
little loading screen
"""
def __init__(self, maximum, parent=None):
"""
Constructor
"""
QDialog.__init__(self, parent)
s... | cedi4155476/musicmanager | music_manager/load.py | Python | mit | 547 |
# streetlight
# Example for the code of an IoT device that is still in development but must be tested.
# This is the SUT - System Under Test
import RPi.GPIO as GPIO
import paho.mqtt.client as mqtt
import json
## CONSTANTS ##################################################################
MQTT_HOST = "<MQTT_HOST>"
ST... | scyv/testing-iot | streetlight/main.py | Python | mit | 3,281 |
from app.entity.human.human_data import *
from core.entity.entity import *
class Human(Entity):
def __init__(self, human_data=None):
# type: (HumanData) -> None
Entity.__init__(self)
self.data = human_data or HumanData()
def update(self, delta):
pass
| Diralf/evolution | app/entity/human/human.py | Python | mit | 295 |
import unittest
import os
from xml.etree.ElementTree import ParseError
from programy.parser.aiml_parser import AIMLParser
from programy.parser.exceptions import ParserException
from programy.parser.pattern.nodes.root import PatternRootNode
from programy.parser.pattern.nodes.topic import PatternTopicNode
from programy.... | dkamotsky/program-y | src/test/parser/test_aiml_parser.py | Python | mit | 30,276 |
from .models import Task, TaskPrototype, TaskPrototypeProgeny, Verb
from django.contrib.auth.models import User
from django.test import TestCase
from django.test.client import Client
from unittest import expectedFailure
from what_apps.people.models import GenericParty
def make_task_tree(test_case):
test_case.user... | SlashRoot/WHAT | what_apps/do/tests.py | Python | mit | 5,116 |
import json
from geoalchemy2 import Geometry
from sqlalchemy import BigInteger, Boolean, Column, DateTime, Float, ForeignKey, ForeignKeyConstraint, String, Table, \
func as sqla_fn
from sqlalchemy.dialects.postgresql import DOUBLE_PRECISION, JSONB
from sqlalchemy.orm import relationship
from plenario.database imp... | UrbanCCD-UChicago/plenario | plenario/models/SensorNetwork.py | Python | mit | 8,829 |
def phone_num_lists():
"""
Gets a dictionary of 0-9 integer values (as Strings) mapped to their potential Backpage ad manifestations, such as "zer0" or "seven".
Returns:
dictionary of 0-9 integer values mapped to a list of strings containing the key's possible manifestations
"""
all_nums = {}
all_nu... | usc-isi-i2/etk | etk/data_extractors/htiExtractors/misc.py | Python | mit | 1,773 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('coding', '0006_auto_20150619_2103'),
]
operations = [
migrations.AlterField(
model_name='code',
name... | michaelbrooks/uw-message-coding | message_coding/apps/coding/migrations/0007_auto_20150619_2106.py | Python | mit | 744 |
import os, subprocess
from component import Component
from config import OPENSCAD, OPENSCAD_OLD, CHECK_INTERSECT_SCRIPT, SUB_COMPONENT_SCRIPT, \
PART_SCRIPT, BOSS_CHECK_COMPS_SCRIPT, BOSS_PUT_SCRIPT, SHELL_SCRIPT, DEFORM_SHELL_SCRIPT, \
MINKOWSKI_TOP, MINKOWSKI_BOT, BUTTON_CAP_SCRIPT, SCRATCH
'''
We will give ... | valkyriesavage/makers-marks | openscad.py | Python | mit | 20,842 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | AutorestCI/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/ipv6_express_route_circuit_peering_config.py | Python | mit | 2,366 |
#!/usr/bin/env python
# Copyright (c) 2015 Angel Terrones (<angelterrones@gmail.com>)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the r... | AngelTerrones/Algol | Core/regfile.py | Python | mit | 2,952 |
import cv2
import sys
import datetime
import numpy
import subprocess
def makeThug(frame,faces,mouths,eyes):
glasses = cv2.imread("glasses.png",-1)
joint = cv2.imread("joint.png",-1)
t=datetime.datetime.now().time()
filename="Saved/"+str(t.hour)+str(t.minute)+str(t.second)+".jpg"
#work only inside f... | SlashDK/Memify | Main/Memify.py | Python | mit | 4,703 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from hwt.interfaces.std import VectSignal
from hwt.interfaces.utils import addClkRstn
from hwt.simulator.simTestCase import SimTestCase
from hwt.synthesizer.unit import Unit
from hwtHls.hlsStreamProc.streamProc import HlsStreamProc
from hwtHls.platform.virtual import Virt... | Nic30/hwtHls | tests/utils/alapAsapDiffExample.py | Python | mit | 2,761 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import re
from six import text_type
from sacremoses.corpus import Perluniprops
from sacremoses.corpus import NonbreakingPrefixes
from sacremoses.util import is_cjk
from sacremoses.indic import VIRAMAS, NUKTAS
perluniprops = Perluniprops()
nonbreaking_prefixes = Nonbrea... | alvations/sacremoses | sacremoses/tokenize.py | Python | mit | 31,370 |
import logging
import psycopg2
from patroni.dcs import DCSError
logger = logging.getLogger(__name__)
class Ha:
def __init__(self, state_handler, etcd):
self.state_handler = state_handler
self.dcs = etcd
self.cluster = None
self.old_cluster = None
def load_cluster_from_dcs(s... | sean-/patroni | patroni/ha.py | Python | mit | 4,394 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2018-02-20 04:32
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('studygroups', '0084_auto_20180215_0747'),
]
operations = [
migrations.AddField(
model_name='studygroup... | p2pu/learning-circles | studygroups/migrations/0085_studygroup_place_id.py | Python | mit | 433 |
#!/bin/python
import praw
import re
import os
import sqlite3
import time
from config_bot import *
import datetime
header = "Type|Artist(s)/Event|Venue|Price|Time\n---|---|---|---|---|---|---|\n"
footer1 = "------------------------\n[Link to next week's draft post]("
footer2 = "). If you know of something awesome hap... | robertbarrett/eventsottawabot | eventsOttawaBot.py | Python | mit | 7,649 |
# -*- coding: utf-8 -*-
"""
morphsnakes
===========
This is a Python implementation of the algorithms introduced in the paper
Márquez-Neila, P., Baumela, L., Álvarez, L., "A morphological approach
to curvature-based evolution of curves and surfaces". IEEE Transactions
on Pattern Analysis and Machine Intelligence... | braysia/CellTK | celltk/utils/morphsnakes.py | Python | mit | 11,905 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.12 on 2017-01-30 14:30
from __future__ import unicode_literals
import enum
from django.db import migrations
import enumfields.fields
class TrxType(enum.Enum):
FINALIZED = 0
PENDING = 1
CANCELLATION = 2
class TrxStatus(enum.Enum):
PENDING = 0
FIN... | uppsaladatavetare/foobar-api | src/wallet/migrations/0006_auto_20170130_1430.py | Python | mit | 899 |
import sys
from cx_Freeze import setup, Executable
# Dependencies are automatically detected, but it might need fine tuning.
build_exe_options = {"packages": ["math", "json"], "excludes": ["tkinter"]}
# GUI applications require a different base on Windows (the default is for a
# console application).
setup( name = ... | renatopp/liac-soccer | clients/python/setup.py | Python | mit | 495 |
# ----- Info ------------------------------------------------------------------
__author__ = 'Michael Montero <mcmontero@gmail.com>'
# ----- Imports ---------------------------------------------------------------
from tinyAPI.base.config import ConfigManager
import logging
import random
import tinyAPI
__all__ = [
... | mcmontero/tinyAPI | base/stats_logger.py | Python | mit | 1,579 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | lmazuel/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2017_11_01/models/application_gateway_redirect_configuration_py3.py | Python | mit | 3,957 |
import io
import logging
from collections import defaultdict
from numpy import linspace
from scipy import interp
from sklearn.metrics import (auc, average_precision_score,
precision_recall_curve)
from tabulate import tabulate
from .test_statistic import ClassifierStatistic, TestStatistic
... | yafeunteun/wikipedia-spam-classifier | revscoring/revscoring/scorer_models/test_statistics/precision_recall.py | Python | mit | 3,506 |
"""ELASPIC RUN
"""
import os
import os.path as op
import logging
import argparse
from elaspic import conf, pipeline
logger = logging.getLogger(__name__)
def validate_args(args):
if args.config_file and not os.path.isfile(args.config_file):
raise Exception('The configuration file {} does not exist!'.form... | ostrokach/elaspic | elaspic/cli/elaspic_run.py | Python | mit | 7,164 |
import os
import logging
from flask import Flask
from flask_seasurf import SeaSurf
from flask_mail import Mail
from werkzeug.middleware.proxy_fix import ProxyFix
from flask_session import Session
from .lib import utils
def create_app(config=None):
from . import models, routes, services
from .assets import as... | ngoduykhanh/PowerDNS-Admin | powerdnsadmin/__init__.py | Python | mit | 4,275 |
# pylint: disable=I0011, C0111, bare-except, no-self-use, too-many-ancestors
import json
from irc.dispatcher import BaseDispatcher
from irc.factory_naming import Mixin as FactoryNamingMixin
from irc.protocol import DispatchableIrcClient
from parsers.camxes_ilmen import Parser
from transformers.camxes_morphology impo... | teleological/camxes-py | irc/morphology.py | Python | mit | 1,582 |
#!/usr/bin/env python
from setuptools import setup
from ipwb import __version__
with open('README.md') as f:
long_description = f.read()
desc = """InterPlanetary Wayback (ipwb): Web Archive integration with IPFS"""
setup(
name='ipwb',
version=__version__,
url='https://github.com/oduwsdl/ipwb',
do... | oduwsdl/ipwb | setup.py | Python | mit | 2,128 |
import talkey
from gtts import gTTS
import vlc
import time
import wave
import contextlib
class Speaker:
def __init__(self):
self.engine =talkey.Talkey()
def say(self, text_to_say):
self.engine.say(text_to_say)
def google_say(self, text_to_say, fname="1.mp3"):
tts = gTTS(text=text... | codebhendi/alfred-bot | speaker.py | Python | mit | 490 |
"""
Module used to keep settings such as IP addresses and ports.
"""
import random
class EllidaSettings(object):
ENGINE_SOCKET = 27999
MANAGER_SOCKET = 27998
UI_SOCKET = 27997
DAEMON_SOCKET = 27990
EXTERN = {
'u': "ellida.go.ro",
'd': "192.168.160.137",
'e': "ellida.go.ro... | VoltBit/ellida | settings.py | Python | mit | 2,756 |
from collections import defaultdict
from modules.simple_wires_common import WireColor
def get_wire_index_to_cut(colors, sides_info):
return _get_wire_position_to_cut(colors, sides_info) - 1
def _get_wire_position_to_cut(colors, sides_info):
""" Note that this returns the 1-indexed "position" (rather than t... | FuegoFro/KeepTalkingBot | src/modules/simple_wires_solution.py | Python | mit | 2,191 |
# Copyright (c) 1999 John Aycock
# Copyright (c) 2000-2002 by hartmut Goebel <h.goebel@crazy-compilers.com>
# Copyright (c) 2005 by Dan Pascu <dan@windowmaker.org>
#
# See main module for license.
#
__all__ = ['Token', 'Scanner', 'getscanner']
import types
import dis
from collections import namedtuple
from array ... | Katharsis/unfrozen_binary | uncompyle2/Scanner.py | Python | mit | 37,532 |