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 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('account', '0009_auto_20150517_0922'),
]
operations = [
migrations.RemoveField(
model_name='user',
na... | NTsystems/NoTes-API | notes/apps/account/migrations/0010_remove_user_is_admin.py | Python | mit | 352 |
# Code generated by cfonts_to_trans_py.py
import TFTfont
_dejavu10lean = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'\
b'\x00\x30\xc3\x0c\x30\xc3\x0c\x30\xc0\x00\x00\x03\x00\x00\x00\x00\x00'\
b'\x00\x33\x33\x33\x33\x33\x33\x00\x00\x00\x00\x00\x00\x0... | robert-hh/SSD1963-TFT-Library-for-PyBoard | fonts/dejavu10lean.py | Python | mit | 13,426 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault(
"DJANGO_SETTINGS_MODULE",
"owndb.settings"
)
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| ofilipowicz/owndb | manage.py | Python | mit | 251 |
"""
stringjumble.py
Author: Dina
Credit: Me and Jazzy and Anoushka
Assignment:
The purpose of this challenge is to gain proficiency with
manipulating lists.
Write and submit a Python program that accepts a string from
the user and prints it back in three different ways:
* With all letters in reverse.
* With words... | dina-hertog/String-Jumble | stringjumble.py | Python | mit | 1,281 |
# Copyright(c) 2017, Dimitar Venkov
# @5devene, dimitar.ven@gmail.com
# www.badmonkeys.net
def tolist(x):
if hasattr(x,'__iter__'): return x
else : return [x]
def n2s(n, digits):
if digits is not None:
n = round(n, digits)
s1 = str(n)
if s1[-2:] == '.0':
s1 = s1[:-2]
return s1
def p2s(p, sep=IN[1], digits=I... | dimven/SpringNodes | py/Point.ToString.py | Python | mit | 473 |
from wtforms import Form, StringField, DateField, RadioField, BooleanField, validators
class TaskForm(Form):
name = StringField('Name', [validators.InputRequired()])
date = DateField('Date', [validators.InputRequired()])
done = BooleanField('Done')
priority = RadioField('Priority', coerce=int,
... | roxel/planner | app/planner/forms.py | Python | mit | 476 |
from distutils.core import setup
import py2exe
setup(console=['main.py'], py_modules=['main', 'friendship']) | DenBaum/lolm8guesser | setup.py | Python | mit | 112 |
import unittest
import os
import logging
from datetime import date
from decimal import Decimal
from ibrokersflex import parse_flex_accounts, parse_flex_positions, parse_flex_flows
class LoadFlexResultsTestCase(unittest.TestCase):
def setUp(self):
self.tree = None
example_file_path = os.path.abs... | chris-ch/lemvi-risk | tests/test_load_flex.py | Python | mit | 2,329 |
import _plotly_utils.basevalidators
class TickformatValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(
self, plotly_name="tickformat", parent_name="indicator.gauge.axis", **kwargs
):
super(TickformatValidator, self).__init__(
plotly_name=plotly_name,
... | plotly/python-api | packages/python/plotly/plotly/validators/indicator/gauge/axis/_tickformat.py | Python | mit | 478 |
#!/usr/bin/env python
import os
import json
import re
from pymongo import MongoClient
import config
def connect():
client = MongoClient()
db = client['disasters']
return db
db = connect()
data_dir = config.data_dir
def get_dpla(item):
if "object" not in item:
return None
if item... | lwrubel/disasterview | load.py | Python | mit | 3,738 |
"""Provides helpers for Z-Wave JS device automations."""
from __future__ import annotations
from typing import cast
import voluptuous as vol
from zwave_js_server.const import ConfigurationValueType
from zwave_js_server.model.node import Node
from zwave_js_server.model.value import ConfigurationValue
NODE_STATUSES = ... | rohitranjan1991/home-assistant | homeassistant/components/zwave_js/device_automation_helpers.py | Python | mit | 1,521 |
#!/usr/bin/python
# coding: utf-8
import sys
class Solution(object):
def increasingTriplet(self, nums):
"""
:type nums: List[int]
:rtype: bool
"""
m1, m2 = sys.maxint, sys.maxint
for n in nums:
if m1 >= n:
m1 = n
elif m2 >= n:... | Lanceolata/code-problems | python/leetcode_medium/Question_334_Increasing_Triplet_Subsequence.py | Python | mit | 411 |
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 18 20:12:52 2016
@author: Hunter
"""
from scipy import misc
from scipy import ndimage
import os
import numpy as np
def crop(img_array, size):
lx, ly, lz = img_array.shape
if lx > ly + 1:
crop_img = img_array[int((lx-ly)/2): - int((... | hprovyn/keras-experiments | hough_img_prep.py | Python | mit | 6,506 |
# coding: utf8
# Copyright 2014-2015 Vincent Jacques <vincent@vincent-jacques.net>
"""
When given a :class:`UpdateTable`, the connection will return a :class:`UpdateTableResponse`:
.. testsetup::
table = "LowVoltage.Tests.Doc.UpdateTable.1"
table2 = "LowVoltage.Tests.Doc.UpdateTable.2"
table3 = "LowVolt... | jacquev6/LowVoltage | LowVoltage/actions/update_table.py | Python | mit | 22,948 |
'''
Created on Dec 3, 2014
Based on the work from the roverplot project ().
@author: gearsad
'''
from roverpylot import rover
import LCMRover
import time
import pygame
import sys
import signal
def _signal_handler(signal, frame):
frame.f_locals['rover'].close()
sys.exit(0)
if __name__ == '__main__':
... | GearsAD/semisorted_arnerve | arnerve_bot/arnerve_bot/arnerve_bot.py | Python | mit | 828 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Order.reference'
db.add_column('orders', 'reference',
... | upptalk/uppsell | uppsell/migrations/0029_auto__add_field_order_reference.py | Python | mit | 19,572 |
# -*- coding: utf-8 -*-
from django.db import models
from django.core.urlresolvers import reverse
from django.utils.safestring import mark_safe
from django.utils.encoding import force_unicode
from django.utils.html import escape
from django.forms.widgets import ClearableFileInput
def change_widget_to_NoFullPathLinkFil... | arruda/amao | AMAO/libs/forms_amao/widgets.py | Python | mit | 1,947 |
# Project Euler Problem 7
# Created on: 2012-06-13
# Created by: William McDonald
import math
import time
# Short list of prime numbers under 20
primeList = [2, 3, 5, 7, 9, 11, 13, 17, 19]
# Returns True if n is prime, otherwise False
def isPrime(n):
prime = True
for i in primeList:
if ... | WalrusCow/euler | Solutions/problem07.py | Python | mit | 912 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2016 France-IOI, MIT license
#
# http://opensource.org/licenses/MIT
# This companion tool to the taskgrader prints an evaluation report in a
# human-readable form.
import json, os, sys
def showCaptureReport(report):
"""Print a captureReport."""
... | France-ioi/taskgrader | tools/stdGrade/fullReport.py | Python | mit | 4,579 |
#!c:\python36\python.exe
# -*- coding: UTF-8 -*-
"""
expander.py: this is the pyexpander application.
NOTE: THIS IS A MODIFIED VERSION OF PYEXPANDER as of July 2018
License: https://bitbucket.org/goetzpf/pyexpander/src/b466de6fd801545650edfa790a18f022dc7e151a/LICENSE?at=default&fileviewer=file-view-default
Original: h... | Aquafina-water-bottle/Command-Compiler-Unlimited | fena_pyexpander_rewrite/expander3.py | Python | mit | 5,013 |
#!python
# -*- coding: utf-8 -*-
"""File: smoothing.py
Description:
Smoothing techniques are included here
History:
0.1.0 The first version.
"""
__version__ = '0.1.0'
__author__ = 'SpaceLis'
import dataset
from anatool.dm.db import GEOTWEET
def smoothing_by_city(twt_lst, city):
"""Smooth th... | spacelis/anatool | anatool/analysis/smoothing.py | Python | mit | 2,088 |
#Autor: Arturo
#Fecha: 20/Agosto/2017
#Descripcion: Variables y tipos de datos
#Contacto: @Jav_Arturo
x = "Hola"
for i in range(len(x)-1,-1,-1):
print(x[i])
print(range(len(x)-1,-1,-1))
print("data camp")
# Create the areas list
areas = ["hallway", 11.25, "kitchen", 18.0, "living room", 20.0, "bedroom"... | Jav10/Python | C-digosPython/docPrueba.py | Python | mit | 522 |
# Uses python3
def calc_fib(n):
if (n <= 1):
return n
fibs = [1 for i in range(n+1)]
for i in range(2, n+1):
fibs[i] = fibs[i-1] + fibs[i-2]
return fibs[n-1]
n = int(input())
print(calc_fib(n))
| euccas/CodingPuzzles-Python | course/ucsd_algorithm_toolbox/fibonacci_small_dp.py | Python | mit | 228 |
from ..entry import Entry
from .csv import load as _load
from .csv import dump as _dump
from .csv import Writer as _Writer
content_type = 'text/tab-separated-values; charset=utf-8'
def load(self, text, fieldnames=None):
"""Entry from TSV representation."""
_load(self, text, delimiter="\t", quotechar="", lin... | byrondover/entry | entry/representations/tsv.py | Python | mit | 731 |
#
# Copyright (c) 2012 Atis Elsts
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#... | IECS/MansOS | tools/seal/components/atmega.py | Python | mit | 1,393 |
# pylint: disable=C0111
# pylint: disable=W0401
# pylint: disable=W0614
"""
Development settings.
In the development environment:
- Debug mode is enabled
- The secret key is hardcoded in the file
- The django-debug-toolbar is configured
"""
from .base import * # noqa
# DEBUG
# ---------------------------------------... | chaosdorf/chaospizza | src/config/settings/dev.py | Python | mit | 1,078 |
#coding=utf-8
from redis import Redis
from qpush.conf import redis as rds_conf
class AppDao(object):
def get_appkey_by_appid(self, appid):
rds = Redis(rds_conf['host'], rds_conf['port'], rds_conf['db'])
return rds.get("qpush:appid:%d:appkey" % appid)
def delete_app_by_appid(self, appid):
... | tiaotiao/qpush | qpush/models/app.py | Python | mit | 450 |
from .exceptions import (NotZippedError, NotIndexedError) | moonso/filter_variants | filter_variants/warnings/__init__.py | Python | mit | 57 |
#!/usr/bin/env python
"""
Your task is to complete the 'porsche_query' function and in particular the query
to find all autos where the manufacturer field matches "Porsche".
Please modify only 'porsche_query' function, as only that will be taken into account.
Your code will be run against a MongoDB instance that we ha... | onyb/mooca | Udacity/UD032_Data_Wrangling_with_MongoDB/Lesson_4/10-Finding_Porsche/find_porsche.py | Python | mit | 1,246 |
"""
Django settings for ibc project.
Generated by 'django-admin startproject' using Django 1.11.12.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
import os
im... | sauli6692/ibc-server | ibc/settings/common.py | Python | mit | 3,865 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# python-boilerplate documentation build configuration file, created by
# sphinx-quickstart on Tue Jul 9 22:26:36 2013.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in... | jlant/playground | python/hello-cookiecutter/python-boilerplate/docs/conf.py | Python | mit | 8,534 |
#!/usr/bin/python
"""
Author:rockylinux
E-mail:Jingzheng.W@gmail.com
"""
import commands
import time
#display ethe's bandwidth of each interface
#return a list containning bandwidth of each interfaces
#[interface, rx_bytes, tx_bytes]
#the bandwidth is bytes
class BANDWIDTH:
"""
constructor function
"""
... | china-x-orion/infoeye | tools/bandwidth.py | Python | mit | 2,017 |
from BaseHTTPServer import BaseHTTPRequestHandler,HTTPServer
from SocketServer import ThreadingMixIn
import threading
import argparse
import re
import cgi
import os
class HTTPRequestHandler(BaseHTTPRequestHandler):
def do_GET(self):
if None != re.search('/api/values/*', self.path):
recordID = int(self.path.spli... | orviwan/ControlR-for-Pebble---Mac-Companion | ControlR.py | Python | mit | 3,462 |
# Code generated by cfonts_to_trans_py.py
import TFTfont
_dejavu12 = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'\
b'\x00\xc6\x31\x8c\x63\x18\xc6\x30\x00\x63\x00\x00\x00\x00'\
b'\x00\x33\x33\x33\x33\x33\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0... | robert-hh/SSD1963-TFT-Library-for-PyBoard | fonts/dejavu12.py | Python | mit | 12,278 |
# -*- coding: utf-8 -*-
#******************************************************************************
# (C) 2008 Ableton AG
#******************************************************************************
__docformat__ = "restructuredtext en"
from turbomail.message import Message
from turbomail.control import interf... | AbletonAG/abl.robot | abl/robot/mail.py | Python | mit | 3,077 |
# -*- coding: utf-8 -*-
from datetime import datetime as dt
import traceback, os, sys, random
# turbogears imports
from tg import expose, redirect, validate, flash, request, response
from tg.controllers import CUSTOM_CONTENT_TYPE
# third party imports
from paste.fileapp import FileApp
from pylons.controllers.util imp... | LamCiuLoeng/jcp | ordering/controllers/report.py | Python | mit | 11,714 |
UP = b'\x01'
DEL = b'\x02'
MOV = b'\x03'
| onitu/onitu | onitu/referee/cmd.py | Python | mit | 41 |
from django.conf.urls import patterns, url
from webapp.testapp.views import hello
urlpatterns = patterns('',
url('^$', hello),
)
| tctimmeh/embed-cherrypy-django | webapp/testproj/urls.py | Python | mit | 135 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import json
import yaml
def merge_dicts(a, b):
if not (isinstance(a, dict) and isinstance(b, dict)):
raise ValueError("Error merging variables: '{}' and '{}'".format(
type(a).__name__, type(b).__name__
))
result ... | gov-cjwaszczuk/notifications-admin | scripts/generate_manifest.py | Python | mit | 1,590 |
#!/usr/bin/python
'''
Computer Club of WMU Mailer
by cpg
This is a library of functions for managing an email list and sending out
emails to the proper list.
It uses a json file to store the email list in an array called "mailing_list".
This array is composed of objects containing a key for "email" and
"subscriptio... | cpgillem/markdown_publisher | mailer.py | Python | mit | 2,094 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import random
import sys
import math
class ServoClass:
'''
Representer of a servo connected at pin "pin"
'''
def save_decorator(f):
def inner_func(self, *args, **kw):
try:
return f(self, *args, **kw)
fi... | twistedretard/LaserSimulatedSecurityTurret | src/turret/servo.py | Python | mit | 2,812 |
# copied from http://docs.sqlalchemy.org/en/latest/orm/tutorial.html to spare
# creation of a pretend table.
from .base import BaseB
from sqlalchemy import Column, Integer, String
class Person (BaseB):
__tablename__ = 'person'
id = Column(Integer, primary_key=True)
nameb = Column(String(32))
full... | whiteavian/data_compare | data_compare/test/model/db_b/person.py | Python | mit | 380 |
# -*- coding: utf-8 -*-
try:
from django.db.models import Model
from django.db.models.query import QuerySet
has_django = True
except:
has_django = False
try:
import mongoengine
has_mongoengine = True
except ImportError:
has_mongoengine = False
from serializer import SerializedObject
__al... | flosch/simpleapi | simpleapi/server/preformat.py | Python | mit | 1,523 |
#!/usr/bin/env python
"""Sorts results by max-age, ignoring preloaded entries."""
import sys
import json
import ast
from urlparse import urlparse
import re
import operator
def get_hsts_preloads():
"""Get the latest HSTS preloads in Chromium HEAD."""
preloads = []
# This is just the latest from
# https... | diracdeltas/sniffly | util/process.py | Python | mit | 2,731 |
iTunes = {
'artists' : {
'The Neighbourhood':
#album name
'Wiped Out!': {
#title of song : duration
'Prey' : 3.22,
'Cry Baby' : 4.02,
'A Moment of Silence' : 2.05
},
'Kendrick Lamar':
'To Pimp a Butterfly': {
'King Kunta': 3.54,
'Alright': 3.39,
... | ArtezGDA/text-IO | Heike/iTunes.py | Python | mit | 726 |
from django.conf import settings
GATEWAY_URL = ""
#GATEWAY_TEST_URL = u"http://shopping.maroctelecommerce.com/test/gateway/paiement.asp"
GATEWAY_TEST_URL = settings.MT_URL
STORE_ID = settings.MT_STORE_ID
SECRET = settings.MT_SECRET
LANG = getattr(settings, "MT_LANG", "EN")
| coulix/django-maroc-telecommerce | maroc_telecommerce/settings.py | Python | mit | 277 |
"""jiphy/parser.py
Contains the basic Jiphy code parser.
Copyright (C) 2015 Timothy Edmund Crosley
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 limitat... | timothycrosley/jiphy | jiphy/parser.py | Python | mit | 4,548 |
# Django settings for test_project project.
import os
PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__))
DEBUG = True
TEMPLATE_DEBUG = DEBUG
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'test.db',
},
}
# Make this unique, and don't share it with anybody.
... | grampajoe/django-tenant-templates | tests/integration/test_project/settings.py | Python | mit | 1,287 |
#!/usr/bin/env python
"""Test suite for rstcheck."""
from __future__ import unicode_literals
import unittest
import rstcheck
# We don't do this in the module itself to avoid mutation.
rstcheck.ignore_sphinx()
class Tests(unittest.TestCase):
def assert_lines_equal(self, line_numbers, results):
self.... | sameersingh7/rstcheck | test_rstcheck.py | Python | mit | 8,793 |
from django.conf.urls import patterns, include, url
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# courses :
url(r'^', include('teacher.apps.public.urls')),
# dashboard:
url(r'^js/accounts/', include('teacher.apps.... | houssemFat/MeeM-Dev | teacher/urls.py | Python | mit | 1,930 |
from django import template
from Grundgeruest.models import Nutzer
register = template.Library()
@register.inclusion_tag('Grundgeruest/kopfzeile_knopf.html')
def kopfleiste_knoepfe(user):
""" Der tag erwartet von der Funktion ein dict, in dem die Liste der
url-text-Paare für die Knöpfe der Kopfleiste steht "... | wmles/olymp | Grundgeruest/templatetags/nutzerdaten.py | Python | mit | 645 |
# -*- coding: utf-8 -*-
from unittest import TestCase
from sklearn.tree import DecisionTreeClassifier
from tests.estimator.classifier.Classifier import Classifier
from tests.language.Go import Go
class DecisionTreeClassifierGoTest(Go, Classifier, TestCase):
def setUp(self):
super(DecisionTreeClassifie... | nok/sklearn-porter | tests/estimator/classifier/DecisionTreeClassifier/DecisionTreeClassifierGoTest.py | Python | mit | 493 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from unittest import TestCase
import numpy as np
import easytile.core as mut
def feature_to_div_bounds(dim_ranges, n_tilings, n_divss, offsetss, feature):
indices = np.arange(feature.shape[0], dtype=np.int)[feature]
div_coords = np.unravel
c... | rmoehn/cartpole | easytile/tests/test_core.py | Python | mit | 1,152 |
#!/bin/python3
import sys
n,k,q = input().strip().split(' ')
n,k,q = [int(n),int(k),int(q)]
a = [int(a_temp) for a_temp in input().strip().split(' ')]
for i in range(q):
m = int(input().strip())
print(a[(m-k)%len(a)]) | vipmunot/HackerRank | Algorithms/Circular Array Rotation.py | Python | mit | 228 |
# -*- coding: utf-8 -*-
"""
Created on Sat Apr 16 15:02:05 2016
@author: Ryan Jones
"""
import os
import csv
import pandas as pd
import numpy as np
import shutil
import pdb
directory = os.getcwd()
# from the database
Geographies = pd.read_csv(os.path.join(directory, 'inputs', 'Geographies.csv'))
Geograp... | energyPATHWAYS/energyPATHWAYS | model_building_tools/create_geography_tables/create_geography_tables.py | Python | mit | 3,480 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import unittest
import frappe
from frappe.utils import global_search
from frappe.test_runner import make_test_objects
import frappe.utils
class TestGlobalSearch(unittest.TestCas... | RicardoJohann/frappe | frappe/tests/test_global_search.py | Python | mit | 7,852 |
"""
ADD A DESCRIPTION OF WHAT THIS FILE IS FOR
"""
__author__ = 'brendan'
import os
import numpy as np
import csv
import ast
import requests
import json
username = 'unc_networks'
password = 'UNCSTATS'
def json_to_dict(json_path):
with open(json_path) as data_file:
data = json.load(data_file)
r... | brschneidE3/LegalNetworks | python_code/helper_functions.py | Python | mit | 11,787 |
# coding=utf-8
from .simulator import Simulator
| vialette/ultrastorage | ultrastorage/simulator/__init__.py | Python | mit | 49 |
import copy
def heap_sort(sorting_list):
step = 0
ls = copy.deepcopy(sorting_list)
def sift_down(start, end, step):
root = start
while True:
child = 2 * root + 1
if child > end:
break
if child + 1 <= end and ls[child] < ls[child+1]:
... | JoshOY/DataStructureCourseDesign | PROB10/my_sort/heapSort.py | Python | mit | 948 |
# 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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/aio/_configuration.py | Python | mit | 3,020 |
# -*- coding: utf-8 -*
from django import forms
from sgce.models import Event
from decimal import Decimal
class EnrollmentForm(forms.Form):
event_id = forms.CharField(required=False)
total_price = forms.DecimalField(required=False)
off_price = forms.DecimalField(required=False)
total_points = forms.DecimalField(r... | ramonsaraiva/sgce | sgce/sgceusr/forms.py | Python | mit | 1,547 |
"""
Anyone who've tried to get through the A Song of Ice and Fire books written by George R.R. Martin (the basis for the HBO
show Game of Thrones) knows that while the books are generally excellent, there are a lot of characters. A staggering
number, in fact, and it can be very hard to remember who's who and who is rel... | DayGitH/Python-Challenges | DailyProgrammer/DP20120615B.py | Python | mit | 11,381 |
# -*- coding: utf-8 -*-
from .gni import parse, search, details
from .gnr import datasources, resolve
| sckott/pytaxize | pytaxize/gn/__init__.py | Python | mit | 103 |
"""
Serialization functions for the SimpleMRS format.
"""
# Author: Michael Wayne Goodman <goodmami@uw.edu>
from __future__ import print_function
from collections import deque, defaultdict
import re
from warnings import warn
from delphin.mrs import Xmrs, Mrs
from delphin.mrs.components import (
ElementaryPred... | matichorvat/pydelphin | delphin/mrs/simplemrs.py | Python | mit | 16,588 |
import pytest
import skitai
import confutil
import threading
import time
import sys
def enforce ():
time.sleep (2)
ex = skitai.was.executors
ex.executors [1].maintern (time.time ())
ex.executors [1].shutdown ()
def foo (a, timeout = 0):
time.sleep (timeout)
return a
def test_... | hansroh/skitai | tests/level3/test_executors_then.py | Python | mit | 2,268 |
import unittest
import hail as hl
from hail.utils.java import Env, scala_object
from ..helpers import *
setUpModule = startTestHailContext
tearDownModule = stopTestHailContext
def create_backward_compatibility_files():
import os
all_values_table, all_values_matrix_table = create_all_values_datasets()
... | hail-is/hail | hail/python/test/hail/matrixtable/test_file_formats.py | Python | mit | 4,479 |
import json
import sublime
import subprocess
import os
import sys
from .helpers import fmtpos
main_protocol_version = 3
class MerlinExc(Exception):
""" Exception returned by merlin. """
def __init__(self, value):
self.value = value
def __str__(self):
return repr(self.value)
class Fai... | def-lkb/sublime-text-merlin | merlin/process.py | Python | mit | 10,719 |
from django.core.management.base import BaseCommand
from django.utils import autoreload
import os
import sys
import time
INPROGRESS_FILE = 'testing.inprogress'
def get_test_command():
"""
Return an instance of the Command class to use.
This method can be patched in to run a test command other than the on... | garethr/django-test-extensions | src/test_extensions/management/commands/runtester.py | Python | mit | 2,305 |
# vim: fdm=marker
'''
author: Fabio Zanini/Richard Neher
date: 25/04/2015
content: Data access module HIV patients.
'''
# Modules
from collections import Counter
from operator import itemgetter
import numpy as np
import pandas as pd
from Bio import SeqIO,Seq
from .samples import *
from .af_tools import *
f... | neherlab/HIVEVO_access | hivevo/patients.py | Python | mit | 35,292 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
def gcd(a, b):
'''
Calculate the greatest common divisor use Euclid's gcd algorithm.
Ref: http://www.cut-the-knot.org/blue/Euclid.shtml
'''
if a == 0 or b == 0:
return 0
while(b != 0):
if a > b:
a -= b
else:
... | weichen2046/algorithm-study | algorithms/python/miscellaneous/gcd.py | Python | mit | 1,303 |
from time import sleep
dick = '''
-----------------------
----------OO-----------
-------OOOOOOOO--------
------OOOOOOOOOO-------
------OOOOOOOOOO-------
------OOOOOOOOOO-------
-----OOOOOOOOOOOO------
------OOOOOOOOOO-------
------OOOOOOOOOO-------
------OOOOOOOOOO-------
------OOOOOOOOOO-------
------... | mitchrule/Miscellaneous | Misc/dick.py | Python | mit | 731 |
from __future__ import print_function
from google.cloud import vision
client = vision.Client()
image = client.image(filename='res/text.jpg')
texts = image.detect_text()
print(texts[0].locale)
for text in texts:
print(text.description)
| y-wan/cloud-vision-python | text_detection.py | Python | mit | 239 |
from collections import defaultdict
from datetime import timedelta
import time
from django.conf import settings
from django.utils import timezone
from django.contrib.auth import get_user_model
from channels.db import database_sync_to_async
try:
import aioredis
except ImportError:
aioredis = None
User = get_... | stefanw/froide | froide/helper/presence.py | Python | mit | 4,757 |
# encoding: 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 field 'User.middle_name'
db.add_column('fandjango_user', 'middle_name', self.gf('django.db.models... | jgorset/fandjango | fandjango/migrations/0005_auto__add_field_user_middle_name__add_field_user_timezone__add_field_u.py | Python | mit | 4,458 |
"""
Piezo sensitivity analysis module.
"""
import warnings
import numpy as np
from monty.dev import requires
import pymatgen.io.phonopy
from pymatgen.core.tensors import Tensor
from pymatgen.symmetry.analyzer import SpacegroupAnalyzer as sga
try:
from phonopy import Phonopy
from phonopy.harmonic import dynm... | gmatteo/pymatgen | pymatgen/analysis/piezo_sensitivity.py | Python | mit | 27,600 |
import requests
from bs4 import BeautifulSoup
from datetime import datetime
from elasticsearch import Elasticsearch
def count_words_at_url(url):
resp = requests.get(url)
return len(resp.text.split())
def simplework(url):
return url
def indexpage(url):
try:
resp = requests.get(url)
so... | andreydelpozo2/breadcrumbs | src/indexworker.py | Python | mit | 821 |
from camera import Camera
from database import COLMAPDatabase
from image import Image
from scene_manager import SceneManager
from rotation import Quaternion, DualQuaternion
| trueprice/pycolmap | pycolmap/__init__.py | Python | mit | 173 |
# djangocms_concurrent_users/__init__.py
__version__ = '0.0.5'
default_app_config = 'djangocms_concurrent_users.apps.ConcurrentUsersConfig' | Blueshoe/djangocms-concurrent-users | djangocms_concurrent_users/__init__.py | Python | mit | 139 |
from django.conf import settings
from django.contrib import auth
from django.contrib.auth import load_backend
from django.core.exceptions import ImproperlyConfigured
from serverauth.backends import ServerAuthBackend
class ServerAuthMiddleware(object):
"""
Middleware for utilizing Web-server-provided authentic... | btidor/django-serverauth | serverauth/middleware.py | Python | mit | 3,099 |
import glob
from PIL import Image
File_list = glob.glob('C:/PythonImage/*.png')
for i in File_list:
print(i)
| BD823/pcover | Work/Work3/6imageload&face detection using openCV (nam,yang)/Image_Load_Test.py | Python | mit | 112 |
#!/usr/bin/python
'''
ispuapi test script
'''
__author__ = 'vickydasta'
try:
from lib.ispuapi import aqi
except ImportError:
print "ispuapi is not on this dir, see doc/README.md"
import matplotlib.pyplot as plt
# city kode for Pekanbaru is 'PKU'.lower()
kota = 'pku'
data = aqi(kota)
plt.plot(data)
plt.x... | vickydasta/ispuapi | test.py | Python | mit | 415 |
"""
~~~~~~~~~~~~~~~~~~~~
A simple GIF encoder
~~~~~~~~~~~~~~~~~~~~
Structure of a GIF file: (in the order they appear in the file)
1. always begins with the logical screen descriptor.
2. then follows the global color table.
3. then follows the loop control block (specify the number of loops).
for a ... | neozhaoliang/pywonderland | src/gifmaze/gifmaze/encoder.py | Python | mit | 8,012 |
from django.template.defaultfilters import filesizeformat
"""
Human readable file size
source: http://stackoverflow.com/questions/1094841/reusable-library-to-get-human-readable-version-of-file-size
"""
unit_prefixes1 = ['','Ki','Mi','Gi','Ti','Pi','Ei','Zi']
unit_prefixes2 = ['','K','M','G','T','P','E','Z']
def siz... | IQSS/miniverse | dv_apps/utils/byte_size.py | Python | mit | 777 |
import asyncio
import aiohs2
import pandas as pd
import subprocess
import urllib
import re
import logging
from functools import wraps
coroutine = asyncio.coroutine
logger = logging.getLogger(__name__)
hive_type_map = {
'BOOLEAN': pd.np.dtype(bool),
'BINARY': pd.np.dtype(bytes),
'TINYINT': pd.np.dtype(i... | wabu/pyhive | hive/__init__.py | Python | mit | 15,462 |
# 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/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/_configuration.py | Python | mit | 3,231 |
#!/usr/bin/env python2.7
from __future__ import print_function
import sys
import time
from threading import Thread
from pymesos import MesosExecutorDriver, Executor, decode_data
class JupyterHubExecutor(Executor):
"""
May not be necessary
"""
def launchTask(self, driver, task):
def run_task(t... | tanderegg/mesos-spawner | mesos_spawner/executor.py | Python | mit | 1,027 |
from flask import Flask
import flask.ext.testing as testing
from mould.app import create_app
from mould.migration import Migration
import config
class TestCaseDBException(BaseException):
pass
class TestCase(testing.TestCase):
def create_app(self):
app = Flask(config.APP_NAME)
app = create_app... | kates/mould | mould/testcase.py | Python | mit | 755 |
#!/usr/bin/env python
# Copyright (c) 2014 Eugene Zhuk.
# Use of this source code is governed by the MIT license that can be found
# in the LICENSE file.
"""Checks AWS usage.
This script retrieves and displays an estimated total statement amount for
the specified billing period.
Usage:
./check_usage.py [options]... | ezhuk/aws-tools | billing/check_usage.py | Python | mit | 17,533 |
class Player(object):
"""Holds player information and scores"""
def __init__(self, name):
self.current_score = 0
self.name = name
| johnoleary/Farkel | player.py | Python | mit | 136 |
__author__ = 'parker'
import unittest
from src.parsers.base_parser import *
class BaseParserTest(unittest.TestCase):
def setUp(self):
self.mp = BaseParser()
def test_title_cleaner(self):
t, y = self.mp.clean_title('"!Next?" (1994)')
self.assertEqual(t, "!Next?")
self.assert... | parkercoleman/imdb_parser | test/parsers/base_parser_test.py | Python | mit | 2,602 |
from random import randint
from random import choice
def montyhall(playerchoice):
prize = randint(1,3)
if (prize == 1):
noluck1 = randint(2,3)
if (noluck1 == 2):
noluck2 = 3
else:
noluck2 = 2
if (prize == 2):
noluck1 = choice([1,3])
... | BrilliantLC/monty-hall-py | montyhall.py | Python | mit | 2,293 |
import requests as r
from bs4 import BeautifulSoup as bs
import json
from queue import Queue
import threading
import re
import time
import random
import os
pageUrl_pattern = '(http(s)?://)(www\.ipeen.com.tw/search/taiwan/000/1-0-0-0/\?p=)(\d+)'
def all_restaurant_list(page_url):
print(page_url)
i... | nick800608/TeamProject-FoodRecipe | ipeen_allRestaurantList_crawler_block4.py | Python | mit | 3,811 |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^route/', views.route, name='route'),
]
| davideberdin/ocr-navigator | backend/navigator/urls.py | Python | mit | 122 |
# coding: utf-8
"""
Qc API
Qc API # noqa: E501
The version of the OpenAPI document: 3.0.0
Contact: cloudsupport@telestream.net
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
from telestream_cloud_qc.configuration import Configuration
class... | Telestream/telestream-cloud-python-sdk | telestream_cloud_qc_sdk/telestream_cloud_qc/models/embedded_xml_documents.py | Python | mit | 2,848 |
#!/usr/bin/env python
import os
import sys
import warnings
import django
from django.conf import settings
from django.test.utils import get_runner
# Make deprecation warnings errors to ensure no usage of deprecated features.
warnings.simplefilter("error", DeprecationWarning)
warnings.simplefilter("error", PendingDepr... | nshafer/django-hashid-field | runtests.py | Python | mit | 1,404 |
"""Test configuration."""
import mock
import pytest
from fixtures.common import *
@pytest.fixture(scope="session")
def mocked_get_context():
"""Mock argo.schema._get_context for returning empty dict."""
patcher = mock.patch("argo.schema._get_context")
patcher.start()
patcher.return_value = {}
| olegpidsadnyi/argo | tests/conftest.py | Python | mit | 313 |
# .. _persister_example:
import os
from ..serialize import serialize, deserialize
class FilesystemPersister(object):
@classmethod
def load_cassette(cls, cassette_path, serializer):
try:
with open(cassette_path) as f:
cassette_content = f.read()
except IOError:
... | Azure/azure-sdk-for-python | tools/vcrpy/vcr/persisters/filesystem.py | Python | mit | 801 |
"""
This helper command will import any python callable on your python path and
call it with the supplied arguments.
Use `yawn.task.decorators.make_task` to
"""
import importlib
from django.core.management.base import BaseCommand
class Command(BaseCommand):
help = 'Execute a python callable'
def add_argume... | aclowes/yawn | yawn/management/commands/exec.py | Python | mit | 1,112 |
"""Filename globbing utility."""
import sys
import os
import re
import fnmatch
__all__ = ["glob", "iglob"]
def glob(pathname):
"""Return a list of paths matching a pathname pattern.
The pattern may contain simple shell-style wildcards a la fnmatch.
"""
return list(iglob(pathname))
def iglob(pathna... | MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-3.0/Lib/glob.py | Python | mit | 2,272 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'gupiao3.ui'
#
# Created by: PyQt5 UI code generator 5.5.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
import sys
import db_mysql
class Ui_Stock(object):
def setupUi(self, Stock):
... | yangzijian000/gupiao_spider | gupiao_ui_3.0.py | Python | mit | 24,439 |