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 |
|---|---|---|---|---|---|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""\
pph2_and_rank.py
Submits a list of genes with SNPs to PolyPhen2 and orders them by
a score measuring the overall deleteriousness of the mutations,
normalized for protein length.
LICENSE
Written by Ted Pak for the Roth Laboratory (http://llama.mshri.on.ca).
Releas... | powerpak/pph2_and_rank | pph2_and_rank.py | Python | mit | 11,921 |
'''
PathwayGenie (c) GeneGenie Bioinformatics Ltd. 2018
PathwayGenie is licensed under the MIT License.
To view a copy of this license, visit <http://opensource.org/licenses/MIT/>.
@author: neilswainston
'''
# pylint: disable=too-many-arguments
# pylint: disable=too-many-locals
import random
import sys
... | neilswainston/PathwayGenie | twist/client.py | Python | mit | 7,797 |
from django.contrib import admin
# Register your models here.
from .models import Source
from .actions import doGraphMerveille
class MySource( admin.ModelAdmin ):
actions = [ doGraphMerveille ]
admin.site.register( Source, MySource )
| DarioGT/docker-carra | src/rqEirq/admin.py | Python | mit | 247 |
from marshmallow_jsonapi import Schema, fields
from marshmallow import validate
from flask.ext.sqlalchemy import SQLAlchemy
from sqlalchemy.exc import SQLAlchemyError
db = SQLAlchemy(session_options={"autoflush": False})
class CRUD():
def add(self, resource):
db.session.add(resource)
return db... | konstantinKim/vd-backend | app/materials/models.py | Python | mit | 2,427 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import hashid_field.field
class Migration(migrations.Migration):
dependencies = [
('library', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Editor',
... | nshafer/django-hashid-field | sandbox/library/migrations/0002_auto_20170221_1833.py | Python | mit | 1,004 |
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
DEBUG = False
ALLOWED_HOSTS = ['localhost', '127.0.0.1']
SECRET_KEY = 'my-key'
ROOT_URLCONF = 'tests.urls'
INSTALLED_APPS = [
'tests',
'cloudinary_storage',
# 'django.contrib.admin',
'django.contrib.auth',
'django.con... | klis87/django-cloudinary-storage | tests/settings.py | Python | mit | 2,246 |
"""
Revision ID: 0178_add_filename
Revises: 0177_add_virus_scan_statuses
Create Date: 2018-03-14 16:15:01.886998
"""
from alembic import op
import sqlalchemy as sa
revision = '0178_add_filename'
down_revision = '0177_add_virus_scan_statuses'
def upgrade():
# Deleting the data here is ok because a full migrati... | alphagov/notifications-api | migrations/versions/0178_add_filename.py | Python | mit | 1,400 |
from django.conf.urls import patterns, include, url
urlpatterns = patterns('',
# Examples:
url(r'^upload/$', 'easy_avatar.views.upload'),
) | chawk/django-easy-avatar | easy_avatar/urls.py | Python | mit | 148 |
from django.contrib.sitemaps import Sitemap
from .models import Letter
class LetterSitemap(Sitemap):
def items(self):
return Letter.objects.all()
def lastmod(self, obj):
return obj.modified
| watchdogpolska/feder | feder/letters/sitemaps.py | Python | mit | 218 |
# -*- coding: utf-8 -*-
# -- General configuration -----------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.imgmath', 'rst2pdf.pdfbuilder']
# The ma... | rst2pdf/rst2pdf | rst2pdf/tests/input/sphinx-issue252/conf.py | Python | mit | 1,417 |
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 15 08:28:46 2015
@author: Chris Simpson
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np
def plane_strain(e_xx, e_yy, E, v):
""" Stress calcul... | Simclass/EDXD_Analysis | pyxe/fitting_functions.py | Python | mit | 3,690 |
from stagecraft.apps.datasets.models import DataGroup, DataSet, DataType
from django.test import TestCase
from stagecraft.libs.mass_update import DataSetMassUpdate
from nose.tools import assert_equal
class TestDataSetMassUpdate(TestCase):
@classmethod
def setUpClass(cls):
cls.data_group1 = DataGroup.... | alphagov/stagecraft | stagecraft/libs/mass_update/test_data_set_mass_update.py | Python | mit | 3,422 |
import clr
def create_cs_function(name, code, dependencies = None):
clr.AddReference("clrmagic")
from MagicIPython import MagicCS
from System import String
from System.Collections.Generic import List
if dependencies is not None and len(dependencies) > 0 :
myarray = List[String]()
... | denfromufa/clrmagic | clrmagic.py | Python | mit | 2,540 |
from . import Model, CollectionModel
class Contact(Model):
"""
A Contact object model
.. attribute:: id
.. attribute:: phone
.. attribute:: email
.. attribute:: firstName
.. attribute:: lastName
.. attribute:: companyName
.. attribute:: country
Dictionary like this:... | textmagic/textmagic-rest-python | textmagic/rest/models/contacts.py | Python | mit | 8,232 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#-------------------------------------------------------------------------------
# This file is part of Pynspect package (https://pypi.python.org/pypi/pynspect).
# Originally part of Mentat system (https://mentat.cesnet.cz/).
#
# Copyright (C) since 2016 CESNET, z.s.p.o (h... | honzamach/pynspect | pynspect/filters.py | Python | mit | 10,618 |
# -*- coding: utf-8 -*-
#
# ELLIPTIc documentation build configuration file, created by
# sphinx-quickstart on Sat Mar 25 15:56:12 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# ... | padmec-reservoir/ELLIPTIc | docs/source/conf.py | Python | mit | 5,213 |
import nengo.nef_theano as nef
net=nef.Network('Single Neuron') # Create the network
net.make_input('input',[-0.45]) # Create a controllable input
# with a starting value of -.45
net.make('neuron',neurons=1,dimensions=1, # ... | ctn-waterloo/nengo_theano | examples/singleneuron.py | Python | mit | 977 |
import cv2
face_cascade_path = '/usr/local/opt/opencv/share/'\
'OpenCV/haarcascades/haarcascade_frontalface_default.xml'
eye_cascade_path = '/usr/local/opt/opencv/share/'\
'OpenCV/haarcascades/haarcascade_eye.xml'
face_cascade = cv2.CascadeClassifier(face_cascade_path)
eye_casca... | nkmk/python-snippets | notebook/opencv_face_eye_detection.py | Python | mit | 1,633 |
from OpenGL import GL
import numpy as np
import math
def drawLine(start, end, color, width=1):
GL.glLineWidth(width)
GL.glColor3f(*color)
GL.glBegin(GL.GL_LINES)
GL.glVertex3f(*start)
GL.glVertex3f(*end)
GL.glEnd()
def drawCircle(center, radius, color, rotation=np.array([0,0,0]), axis=np.arra... | g-rauhoeft/scrap-cap | motioncapture/gui/GL/Shapes.py | Python | mit | 1,040 |
#!/usr/bin/env python3
# The MIT License (MIT)
#
# Copyright (c) 2016 Benedikt Schmitt
#
# 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... | benediktschmitt/py-jsonapi | jsonapi/flask/api.py | Python | mit | 4,513 |
"""Cli for matching samples"""
import logging
import math
import click
from genotype.constants import TYPES
from genotype.match.core import compare_analyses
from genotype.store import api
from genotype.store.models import Analysis
LOG = logging.getLogger(__name__)
def log_result(sample_id, result, hide_fail=False... | Clinical-Genomics/taboo | genotype/cli/match_cmd.py | Python | mit | 3,397 |
from .UnsupervisedRanker import MasseyRanker, ColleyRanker, KeenerRanker, MarkovRanker, ODRanker, DifferenceRanker
from .TimeSeriesRanker import EloRanker, TrueSkillRanker, GlickoRanker
__all__ = ["MasseyRanker", "ColleyRanker", "KeenerRanker", "MarkovRanker", "ODRanker", "DifferenceRanker", "EloRanker", "TrueSkill... | wattlebird/ranking | rankit/Ranker/__init__.py | Python | mit | 344 |
#!/usr/bin/env python
"""
Copyright (C) 2013 Legoktm
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, publi... | legoktm/mtirc | tests/main.py | Python | mit | 4,313 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
import frappe
import unittest, copy
from frappe.test_runner import make_test_objects
from frappe.core.doctype.version.version import get_diff
class TestVersion(unittest.TestCase):
def test_get_diff(self):
frappe.set_user('Adminis... | mhbu50/frappe | frappe/core/doctype/version/test_version.py | Python | mit | 1,227 |
from .models import Budget, Reimburse
from django.forms import ModelForm
class BudgetForm(ModelForm):
'''Form for expense.models.Budget model.'''
class Meta: # pylint: disable=missing-docstring
model = Budget
fields = [
'value',
'description',
]
label... | bewareoftheapp/fluxapp | expense/forms.py | Python | mit | 749 |
"""
Write out magic strings to magicPlotDocDecorator
"""
from os.path import join
from sys import version_info
import serpentTools
pyVersion = '{}.{}.{}'.format(*version_info[:3])
magicStrings = serpentTools.plot.PLOT_MAGIC_STRINGS
magicOpts = [
'#. ``{key}``: {value}'.format(key=key, value=magicStrings[key])
... | CORE-GATECH-GROUP/serpent-tools | docs/magicPlotDoc.py | Python | mit | 646 |
# -*- coding: utf-8 -*-
#
# Copyright 2011, Alexandre Strzelewicz
# Licensed under the MIT Version
#
#########################################################
#
# Widget generic controller
#
#########################################################
xss = local_import('xss')
def can_modify():
if session.can_mo... | Unitech/Skytoop | controllers/widget.py | Python | mit | 3,369 |
import datetime
import requests
import time
import xml.etree.ElementTree as ET
class TimeoutError(Exception):
pass
class ApiError(Exception):
pass
def parse_skey(skey):
if len(skey) == 0:
# Just a value
value = skey.text
else:
child = skey[0] # Should only have one child
... | HurricaneLabs/check_splunk | splunk.py | Python | mit | 13,554 |
#!/usr/bin/env python
#
# latin2ascii.py - converts latin1 characters into ascii.
#
import sys
""" Mappings from Latin-1 characters to ASCII.
This is an in-house mapping table for some Latin-1 characters
(acutes, umlauts, etc.) to ASCII strings.
"""
LATIN2ASCII = {
#0x00a0: '',
#0x00a7: '',
# iso-8859-1
0... | euske/pdfminer | tools/latin2ascii.py | Python | mit | 2,305 |
from django.test import TestCase
from django.test.client import Client
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
from .forms import LoginForm
class LoginViewTest(TestCase):
def setUp(self):
self.client = Client()
self.response = self.client.get(reve... | delete/estofadora | estofadora/login/tests.py | Python | mit | 3,269 |
r"""Functions for the radiative baryonic decay $\Lambda_b\to\Lambda\gamma."""
def BR(wc_obj, par):
return prefac * (ff)**2 * (abs(C)**2)
| flav-io/flavio | flavio/physics/bdecays/lambdablambdagamma.py | Python | mit | 143 |
"""
Django settings for mysite project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
imp... | HayaoSuzuki/django-tutorial | mysite/mysite/settings.py | Python | mit | 2,134 |
# -*- coding:utf-8 -*-
from django.shortcuts import render
def index(request):
return render(request, 'djign/index.html') | ghilbut/djign | djign/__init__.py | Python | mit | 128 |
"""
Interface module for the C-version of davis.
Molecular Dynamics Simulation on a Sphere
Please see README.md for details.
MIT license
Copyright(c) 2015 - 2019 Tim Scheffler
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Softw... | tscheff/Davis | davis_c.py | Python | mit | 10,939 |
import inspect
import os
import re
import sys
import nbformat
import numpy as np
from hyperopt import fmin
from nbconvert import PythonExporter
from .ensemble import VotingModel
from .utils import (
remove_imports, remove_all_comments, extract_imports, temp_string,
write_temp_files, determine_indent, with_lin... | maxpumperla/hyperas | hyperas/optim.py | Python | mit | 11,301 |
from pprint import pprint
import pytest
from ethereum import blocks
from ethereum.db import DB
from ethereum.config import Env
from pyethapp.utils import merge_dict
from pyethapp.config import update_config_from_genesis_json
import pyethapp.config as konfig
from pyethapp.profiles import PROFILES
def test_genesis_conf... | RomanZacharia/pyethapp | pyethapp/tests/test_genesis.py | Python | mit | 1,593 |
'''
Created on 03/02/2014
@author: Marc Lopez Roca
@version: 0.8
Conversio d'interficie a py: pyuic4 -x Multipass.ui -o Multipass.py
'''
# -*- coding: utf-8 -*-
import sys, hashlib, base64
from PyQt4 import QtGui
from Multipass import Ui_Multipass
class StartQT4(QtGui.QMainWindow):
def __init__(self, parent=Non... | marclr/passwordGenerator | Main.py | Python | mit | 3,263 |
""" flags.py - Various constants that have special meaning in describe.
INIT - Represents a matcher be instanciated for initialization purposes only
NO_ARG - Represents no argument. This is Noner than None.
"""
__all__ = (
'NO_ARG', 'NO_ARGS', 'ANY_ARG', 'ANYTHING', 'ANY_ARGS', 'ANY_KWARGS', 'is_flag',
... | jeffh/describe | describe/flags.py | Python | mit | 5,303 |
from utils.haversine import haversine
from utils.geo import llaToECEF
from utils.geo import ECEFTolla
from utils.median import getmedian
from utils.graph import draw_partitioned_graph
from utils.fancy_dendrogram import fancy_dendrogram | getsmarter/bda | utils/__init__.py | Python | mit | 235 |
# coding=utf-8
# This will force all string to be unicode strings, even if we don't
# set the 'u'
from __future__ import unicode_literals
# Django modules imports
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Frontend URLs
... | TonyEight/tundle | tundle/urls.py | Python | mit | 428 |
#!/usr/bin/env python
import sys
from os.path import dirname, abspath, join
from django.conf import settings
if not settings.configured:
settings.configure(
DATABASES={
'default': {
'NAME': 'ticketing_test',
'ENGINE': 'django.db.backends.sqlite3',
}
... | streeter/django-ticketing | runtests.py | Python | mit | 1,704 |
import sqlite3
import time
conn = sqlite3.connect('log.db')
c = conn.cursor()
# Create table
c.execute("CREATE TABLE if not exists log (log_timestamp DECIMAL(12,8), "
"log_source text, msg_sequence integer, log_message text, status text)")
for x in range(0, 1000):
insertquery = "INSERT INTO log (log_ti... | bundgus/python-playground | sqlite-playground/sqlite_logfile_write.py | Python | mit | 511 |
# -*- coding: utf-8 -*-
# pep8: disable-msg=E501
# pylint: disable=C0301
from app import __version__, log
import argparse
def main():
log.info("app v" + __version__)
| staudt/python-template | app/start.py | Python | mit | 172 |
#!/usr/bin/env python3
import pyglet
from random import shuffle, randint
import sys
import math
import time
from threading import Thread
import resources
from board import Board
from chicken import Chicken
# Prepare winner screen
trigger_winner = False
STATE = "intro"
player = pyglet.media.Player()
def show_winner... | n2o/chicken-roulette | chickenrun.py | Python | mit | 4,411 |
import matplotlib.pyplot as plt
def func(x):
return x**4 - 2
def secant(a, b, thresh, max_step, f):
itr = []
diffs = []
x_old = a
x_new = b
x_old_val = f(x_old)
x_new_val = f(x_new)
for i in range(max_step):
dx = (x_old - x_new) * x_new_val / ( x_new_val - x_old_val )
x_old = x_new
x_old_va... | dankolbman/NumericalAnalysis | Homeworks/HW1/Problem4b.py | Python | mit | 759 |
#/u/GoldenSights
import praw
import time
import datetime
import sqlite3
'''USER CONFIGURATION'''
APP_ID = ""
APP_SECRET = ""
APP_URI = ""
APP_REFRESH = ""
# https://www.reddit.com/comments/3cm1p8/how_to_make_your_bot_use_oauth2/
USERAGENT = ""
#This is a short description of what the bot does. For example "/u/GoldenS... | TacticalGoat/reddit | FlairTimer/flairtimer.py | Python | mit | 3,977 |
from django.conf.urls import patterns, include, url
from newspaper.views.userAuthenticated import addSubSection, editSubSection, remSubSection
urlpatterns = patterns('',
url(r'^add/$', addSubSection),
url(r'^edit/(?P<id_subsection>\d+)/$', editSubSection),
url(r'^rem/(?P<id_subsection>\d+)/$', remSubSection),
) | saraivaufc/jornalEletronico | newspaper/urls/userAuthenticated/subsection.py | Python | mit | 316 |
import numpy
import tables
import scipy
import matplotlib
import matplotlib.pyplot as plt
import collections
import scipy.signal
import csv
import egan_vorpalUtil as egan
import os
from mpl_toolkits.axes_grid1 import host_subplot
import mpl_toolkits.axisartist as AA
import sys
#sys.path.append('/scr_verus/wernerg/vrun/... | akegan/plasmoids | pplot.py | Python | mit | 13,037 |
#!/usr/bin/python
import os
from mconverter.avcodecs import video_codec_list, audio_codec_list, subtitle_codec_list
from mconverter.formats import format_list
from mconverter.ffmpeg import FFMpeg, FFMpegError, FFMpegConvertError
class ConverterError(Exception):
pass
class Converter(object):
"""
Conver... | mattcongy/movie-converter | mconverter/__init__.py | Python | mit | 9,117 |
'''Biblioteca que contém as rotinas de coversão dos diferentes tipos
de máquinas.
Autor: Lucas Possatti
'''
import re
import collections
def mealy_to_moore(me):
'''Converte o parâmetro 'me' (que deve ser uma máquina Mealy) para
uma máquina de Moore, que é retornada.
'''
# Verifica se a máquina recebida, realemen... | possatti/memoo | converter.py | Python | mit | 6,467 |
from __future__ import unicode_literals
import os
from .. import VENDOR_PATH
from .abstract import AbstractNotifier
class ToasterNotifier(AbstractNotifier):
notifier_cmd = os.path.join(VENDOR_PATH, 'toaster', 'toast.exe')
def get_cmd_options(self, options):
options = self._map_app_icon(options)
... | expobrain/python-unotifier | unotifier/notifiers/toaster.py | Python | mit | 935 |
# Copyright (c) Jeroen Van Steirteghem
# See LICENSE
from twisted.internet import interfaces, protocol, reactor, tcp
from zope.interface import implements
import twunnel.logger
class HTTPSInputProtocol(protocol.Protocol):
implements(interfaces.IPushProducer)
def __init__(self):
twunnel.logger.log... | jvansteirteghem/twunnel | twunnel/local_proxy_server__https.py | Python | mit | 7,810 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
if sys.argv[-1] == 'publish':
os.system('python setup.py sdist upload')
sys.exit()
readme = open('README.rst').read()
history = open('HISTORY.rst... | koirikivi/mutationtest | setup.py | Python | mit | 1,330 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import re
import requests
import shutil
import xmltodict
from maven import Maven
from mavencoord import MavenCoord
from mavenversiondb import MavenVersionDb
import mavenversioncmp as mavenvercmp
import mavenparser
class MavenRepo:
""" Manages the dependencies... | pausan/python-maven | mavenrepo.py | Python | mit | 9,533 |
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# For details: https://github.com/PyCQA/pylint/blob/master/LICENSE
import collections
from astroid import nodes
class ASTWalker:
def __init__(self, linter):
# callbacks per node types
self.nbstatements = 0
s... | ruchee/vimrc | vimfiles/bundle/vim-python/submodules/pylint/pylint/utils/ast_walker.py | Python | mit | 3,263 |
# coding=utf-8
import functools
import re
import stat
import sys
if sys.version_info >= (3,0):
import io
StringIO = io.StringIO
else:
import cStringIO
StringIO = cStringIO.StringIO
import csbuild
from . import log
try:
from PyQt5 import QtCore, QtGui, QtWidgets
QMainWindow = QtWidgets.QMainWindow
QApplication =... | brandonmbare/csbuild | csbuild/_gui.py | Python | mit | 88,329 |
from DebugChannel import DebugChannel
from unittest import TestCase
from model.Person import Person
class DebugChannelTest(TestCase):
def setUp(self):
self.d = DebugChannel('http://192.168.2.17', '1025', 'hello/world')
def testLogStringDoesNotThrowException(self):
self.d.log("hello")
de... | debugchannel/debugchannel-python-client | test/DebugChannelTest.py | Python | mit | 891 |
from __future__ import absolute_import, unicode_literals
try:
from itertools import zip_longest
except ImportError:
from itertools import izip_longest as zip_longest
import django
from django.db.models.sql import compiler
import re
NEEDS_AGGREGATES_FIX = django.VERSION[:2] < (1, 7)
# query_clas... | theoriginalgri/django-mssql | sqlserver_ado/compiler.py | Python | mit | 10,087 |
"""
WSGI config for test_project 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/stable/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO... | mgrouchy/django-stronghold | test_project/test_project/wsgi.py | Python | mit | 402 |
# Copyright (c) 2020 Greg Pintilie - pintilie@mit.edu
# 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, me... | gregdp/segger | Segger/iseg_dialog.py | Python | mit | 43,661 |
from functools import wraps
import numpy
from theano import scalar as scal, Constant
from theano.gof import local_optimizer
from theano.tensor import (DimShuffle, get_scalar_constant_value,
NotScalarConstantError)
from .basic_ops import GpuFromHost, HostFromGpu
from .elemwise import GpuDim... | nke001/attention-lvcsr | libs/Theano/theano/sandbox/gpuarray/opt_util.py | Python | mit | 4,761 |
import re
"""
batch sub \s
"""
sub_s = re.compile('[ \t\n\x0B\f\r]{2,}')
"""
wang yi news's regex expressions
"""
wy_regex_doc_id = re.compile('(\w+)\.html')
wy_regex_time = re.compile('\d{4}-\d{1,2}-\d{1,2}\s+\d{1,2}:\d{1,2}:\d{1,2}')
wy_regex_source = re.compile('来源:\s+(.*?)$')
| jeffreyzzh/MYZXcrawler | MYZXcrawler/MYZXcrawler/regex_expression.py | Python | mit | 287 |
import sys
from sklearn.metrics import roc_curve
from sklearn.metrics import auc
# Function for All Models to produce Metrics ---------------------
def produce_model_metrics(fit, test_set, test_class_set, estimator):
"""
Purpose
----------
Function that will return predictions and probability metrics ... | raviolli77/machineLearning_breastCancer_Python | src/python/produce_model_metrics.py | Python | mit | 2,206 |
#!/usr/bin/python
#####################################################
# example.py - a program to .... #
# #
# Author: Dave Wheeler #
# #
# Purpose: merge count tables ... | cckim47/kimlab | general/merge_tables2.py | Python | mit | 2,357 |
from distutils.core import setup
from catkin_pkg.python_setup import generate_distutils_setup
d = generate_distutils_setup(
packages=['am_bno055_gyro'],
package_dir={'': 'src'}
)
setup(**d)
| HusqvarnaResearch/hrp | am_bno055_gyro/setup.py | Python | mit | 196 |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
# @param {TreeNode} root
# @param {TreeNode} p
# @param {TreeNode} q
# @return {TreeNode}
def lowestCommonAncestor(self, ... | itsmeolivia/code_eval | practice/lc235.py | Python | mit | 645 |
#!/usr/bin/env python3
"""Project Euler - Problem 11 Module"""
from numpy import *
def problem11(grid, nr_adjacent):
"""Problem 11 - Largest product in a grid"""
result = 0
GRID_SHAPE = grid.shape
for row in range(0, GRID_SHAPE[0] - (nr_adjacent-1)):
for col in range(0, GRID_SHAPE[1] - (nr_ad... | rado0x54/project-euler | python/problem0011.py | Python | mit | 2,145 |
from django.db.models.signals import post_save
from django.dispatch import receiver
from django.core.signals import request_finished
from django.contrib.auth.models import User
from .models import Profile
@receiver(post_save, sender=User)
def create_profile_receiver(sender, **kwargs):
if kwargs['created']:
... | caleblogan/twitter-scheduler | twitterscheduler/signals.py | Python | mit | 371 |
from setuptools import setup
import sys
revision = None
# must match PEP 440
_MAJOR_VERSION = 0
_MINOR_VERSION = 5
_MICRO_VERSION = None
_PRE_RELEASE_TYPE = 'a' # a | b | rc
_PRE_RELEASE_VERSION = 5
_DEV_RELEASE_VERSION = None
version = '{}.{}'.format(_MAJOR_VERSION, _MINOR_VERSION... | datamachine/twx | setup.py | Python | mit | 1,804 |
from django.utils.translation import ugettext as _
#=========================================================================
# HELPERS
#=========================================================================
def get_display(key, list):
d = dict(list)
if key in d:
return d[key]
return None
def ... | marco-lancini/Showcase | app_collaborations/options.py | Python | mit | 5,831 |
#!flask/bin/python
from flask import Flask, request
from flask_cors import cross_origin
import os
from subprocess import Popen, PIPE
app = Flask(__name__)
def play_video(url):
os.system('killall omxplayer.bin')
os.system('mkfifo /tmp/omx')
os.system('omxplayer -b "' + url + '" < /tmp/omx &')
os.system('echo ... | arnef/airpi | server/server.py | Python | mit | 1,658 |
# Based on http://d2l.ai/chapter_computer-vision/transposed-conv.html
import superimport
import torch
from torch import nn
import numpy as np
def trans_conv(X, K):
h, w = K.shape
Y = torch.zeros((X.shape[0] + h - 1, X.shape[1] + w - 1))
for i in range(X.shape[0]):
for j in range(X.shape[1]):
... | probml/pyprobml | scripts/transposed_conv_torch.py | Python | mit | 1,546 |
"""
Progress bar encapsulation
"""
# Copyright (c) Timur Iskhakov.
# Distributed under the terms of the MIT License.
import progressbar
class UIProgressBar:
__widgets = [' ', progressbar.Percentage(), ' ', progressbar.Bar(), ' ', progressbar.ETA()]
def __init__(self, message):
"""
:param m... | cs-hse-projects/profanity-filter | profanity_filter/ui_progress_bar.py | Python | mit | 1,153 |
class Solution(object):
def followup(self,s,k):
"""
the question follow up is data char, only can read one char
"""
if not s or k==0:
return 0
# using the maxheap to save the lastoccurence of the char
maxheap=[]
# window size record the k distince ... | Tanych/CodeTracking | 340-Longest-Substring-with-At-Most-K-Distinct-Characters/solution.py | Python | mit | 1,759 |
#produces lemmata!
import json
import glob
import codecs
import sys
import os
if len(sys.argv) != 3:
raise Exception("Provide 2 arguments:\n\t1,Source directory with CAB responses\n\t2,Result file")
cab_files = sys.argv[1]
result_path = sys.argv[2]
with codecs.open(result_path, mode="w", buffering=10000, encoding="... | hellrich/JeSemE | pipeline/preprocessing/google/parse_normalized.py | Python | mit | 712 |
from SuperDiffer import app, db
from SuperDiffer.id import controllers as ID
from flask import Flask, render_template, request, abort, jsonify
import json,base64,pdb
"""Routes to allow clients to add left and right base64 encoded on JSON values and fetch their diff"""
#References: https://blog.miguelgrinberg.com/post... | gpaOliveira/SuperDiffer | SuperDiffer/routes.py | Python | mit | 2,533 |
def helper(m):
if m < 10:
return (m, 0)
count = 1
k = m//10
k -= 2 * (m % 10)
if k > 100:
a = helper(k)
count += a[1]
k = a[0]
return (k, count)
def seven(m):
return helper(m)
# your code
| NendoTaka/CodeForReference | CodeWars/7kyu/divisibleBySeven.py | Python | mit | 262 |
import attr
import pandas as pd
import re
from ..base import TohuBaseGenerator
from ..logging import logger
__all__ = ['get_tohu_items_name', 'make_tohu_items_class']
def make_tohu_items_class(clsname, attr_names):
"""
Parameters
----------
clsname: string
Name of the class to be created
... | maxalbert/tohu | tohu/v6/custom_generator/utils.py | Python | mit | 3,014 |
import errors
def validate_num_arguments_eq(num_args):
"""Validate that the number of supplied args is equal to some number"""
def decorator(func):
def wrapped_func(*args, **kwargs):
if len(args[1]) != num_args:
raise errors.InvalidArgumentError
else:
... | dansackett/Todooo | todooo/validators.py | Python | mit | 1,462 |
from urlparse import urlparse, parse_qs
from datetime import datetime
from atom.logger import get_logger
from atom.http.exceptions import HTTPSyntaxError
log = get_logger(__name__)
status_codes = {
100: 'Continue',
200: 'OK',
302: 'Found',
400: 'Bad Request',
403: 'Forbidden',
404: 'Not Found... | shaneoc/atom | atom/http/headers.py | Python | mit | 7,250 |
import struct
boolean = struct.Struct("<?")
uint8 = struct.Struct("<B")
uint16 = struct.Struct("<H")
uint32 = struct.Struct("<I")
uint64 = struct.Struct("<Q")
int8 = struct.Struct("<b")
int16 = struct.Struct("<h")
int24 = struct.Struct("<L")
int32 = struct.Struct("<i")
int64 = struct.Struct("<q")
float32 = struct.S... | SkippsDev/Py-Slither | src/packet/BufferTypes.py | Python | mit | 442 |
import django
if django.VERSION >= (1, 5):
from django.conf.urls import patterns, url
else:
from django.conf.urls.defaults import patterns, url
def simpleAction(request):
pass
urlpatterns = patterns(
'',
url(r'^simple/action/$', simpleAction, name='simpleAction'),
)
| uranusjr/django-crispy-forms-ng | crispy_forms/tests/urls.py | Python | mit | 292 |
import os
import sys
from configparser import NoSectionError
from simple_monitor_alert.alerts import Alerts
from simple_monitor_alert.lines import Observable, ItemLine
from simple_monitor_alert.monitor import Monitors
from simple_monitor_alert.sma import Results, Config, MonitorsInfo
from simple_monitor_alert.utils.fi... | Nekmo/simple-monitor-alert | simple_monitor_alert/tests/base.py | Python | mit | 3,106 |
#
# Copyright (c) 2013 Chris Manton <cmanton@gmail.com> www.onesockoff.org
# See the file LICENSE.txt for your full rights.
#
# Special recognition to Lars de Bruin <l...@larsdebruin.net> for contributing
# packet decoding code.
#
# pylint parameters
# suppress global variable warnings
# pylint: disable-msg=W0603
# ... | tony-rasskazov/meteo | weewx/bin/weewx/drivers/wmr200.py | Python | mit | 77,782 |
import os
from itertools import ifilter, ifilterfalse
from ast.utils import utils
from ast.body.classorinterfacedeclaration import ClassOrInterfaceDeclaration
import glob2
"""
regarding paths and files
"""
# clean all the contents in the designated path, excluding that path
def clean_dir(path):
for root, dirs, ... | plum-umd/java-sketch | java_sk/util.py | Python | mit | 2,237 |
"""
In this case, imputing helps the classifier get close to the original score.
Cross Validation Link:
http://scikit-learn.org/stable/auto_examples/model_selection/grid_search_digits.html#sphx-glr-auto-examples-model-selection-grid-search-digits-py
"""
##############################
# Module imports and dependencie... | kizzen/Baller-Shot-Caller | ModelFitting/single_Kmeans.py | Python | mit | 3,462 |
import logging
import sys
from functools import reduce
from os.path import relpath
from pathlib import Path
from typing import Dict, List, Any
from argparse import ArgumentParser
from dogebuild.common import DOGE_FILE, DirectoryContext, sanitize_name
from dogebuild.dependencies_functions import resolve_dependency_tree... | dogebuild/dogebuild | dogebuild/dogefile.py | Python | mit | 6,192 |
# position/views_admin.py
# Brought to you by We Vote. Be good.
# -*- coding: UTF-8 -*-
from .controllers import generate_position_sorting_dates_for_election, positions_import_from_master_server, \
refresh_cached_position_info_for_election, \
refresh_positions_with_candidate_details_for_election, \
refresh... | wevote/WeVoteServer | position/views_admin.py | Python | mit | 50,531 |
import json
import numbers
import html
import config
class command:
"""
Used to store an incoming player command
"""
def __init__(self, message):
"""
Called with a raw message string from a client
:raise: ValueError if the message isn't a valid command
"""
# Try... | JoelEager/pyTanks.Server | dataModels/command.py | Python | mit | 2,194 |
# -*- coding: utf-8 -*-
#
# This file is part of Karesansui Core.
#
# Copyright (C) 2009-2012 HDE, Inc.
#
# 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 withou... | karesansui/karesansui | karesansui/lib/conf.py | Python | mit | 9,611 |
#!/usr/bin/python3
"""
================================================
ABElectronics Delta-Sigma Pi V2 8-Channel ADC
Version 1.0 Created 29/02/2015
Requires python 3 smbus to be installed
================================================
"""
class DeltaSigma:
# internal variables
__address = 0x68 # defau... | abelectronicsuk/ABElectronics_Python3_Libraries | DeltaSigmaPi/ABE_DeltaSigmaPi.py | Python | mit | 11,044 |
"""
Define a few commands
"""
from .meeseeksbox.utils import Session, fix_issue_body, fix_comment_body
from .meeseeksbox.scopes import admin, write, everyone
from textwrap import dedent
def _format_doc(function, name):
if not function.__doc__:
doc = " "
else:
doc = function.__doc__.splitli... | MeeseeksBox/MeeseeksDev | meeseeksdev/commands.py | Python | mit | 6,864 |
# -*- coding:utf-8 -*-
def fib(num):
'fibs function'
fibs = [0,1]
for x in range(num):
fibs.append(fibs[-2]+fibs[-1])
print fibs
print callable(fib)
fib(15)
print fib.__doc__
print help(fib) | dedelost/py-demoList | python基础教程/第六章抽象/抽象.py | Python | mit | 215 |
# coding=utf-8
# 1. generate velocity and force nodes of sphere using MATLAB,
# 2. for each force node, get b, solve surrounding velocity boundary condition (pipe and cover, named boundary velocity) using formula from Liron's paper, save .mat file
# 3. read .mat file, for each boundary velocity, solve associated bounda... | pcmagic/stokes_flow | ecoli_in_pipe/ecoliInPipe_singletail.py | Python | mit | 4,799 |
#!/usr/bin/env python
#Copyright (C) 2011 by Benedict Paten (benedictpaten@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 rig... | BD2KGenomics/toil-old | src/toil/batchSystems/combinedBatchSystem.py | Python | mit | 4,039 |
#Graph data structure for input graph
from node import Node
class Graph:
def __init__(self, n):
self.numnodes = n
self.vertices = [] #container for nodes
self.edges = []
for i in range(0,n):
self.vertices.append(Node(i))
self.edges.append([])
self.m... | emmanuj/dials_shortest_path | graph.py | Python | mit | 1,382 |
from rl_toolbox import Runner
from rl_toolbox.agent import PPOAgent
from rl_toolbox.policy import VAEPolicy, CNNPolicy
def main():
for fun in (VAEPolicy, CNNPolicy):
runner = Runner(
'CarRacing-v0',
PPOAgent,
fun,
record_data=False,
data_path=Non... | qsheeeeen/Self-Driving-Car | 06_have_fun.py | Python | mit | 501 |
from core.himesis import Himesis, HimesisPreConditionPatternLHS
import uuid
class HAssignmentInstance_CompleteLHS(HimesisPreConditionPatternLHS):
def __init__(self):
"""
Creates the himesis graph representing the AToM3 model HAssignmentInstance_CompleteLHS.
"""
... | levilucio/SyVOLT | mbeddr2C_MM/Contracts/HAssignmentInstance_CompleteLHS.py | Python | mit | 94,636 |
# -*- coding: utf-8 -*-
"""
Highmaps Demos
Drilldown: http://www.highcharts.com/maps/demo/map-drilldown
"""
from highcharts import Highmap
from highcharts.highmaps.highmap_helper import jsonp_loader, js_map_loader, geojson_handler
"""
Drilldown is a techique to present data in different detail level.
This example i... | kyper-data/python-highcharts | examples/highmaps/map-drilldown.py | Python | mit | 5,831 |
from node import DotXMLDoc, AttributeParsingError
class SimpleXmlApi(object):
"""
The main API class, comprising a map of attributes to dotted path names.
Accessing an attribute that has been mapped to a dotted name will return
the text value of that node/attribute. If an attribute is passed that
... | iancmcc/simplexmlapi | simplexmlapi/api.py | Python | mit | 3,090 |