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 |
|---|---|---|---|---|---|
from django.test import TestCase
from .utils import is_holiday
from datetime import date, timedelta
class HolidaysTests(TestCase):
longMessage = True
fixtures = ['demo']
def fullYearTest(self, group, year, holidays):
it = date(year, 1, 1)
end = date(year, 12, 31)
delta = timedelta... | fopina/django-holidays | holidays/tests.py | Python | mit | 1,476 |
def greetings(msg):
print(msg)
#greetings("hi!") | jw6dz/cs3240-labdemo | helper.py | Python | mit | 53 |
"""
Django settings for remembermyseries 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... | niksolaz/TvApp | remembermyseries/settings.py | Python | mit | 2,156 |
from sys import version, exit
from setuptools import setup
requirements = open("requirements.txt").read().split()
with open("README.md") as f:
long_description = f.read()
setup(
name = 'bagcat',
version = '0.0.6',
url = 'https://github.com/umd-mith/bagcat/',
author = 'Ed Summers',
author_emai... | umd-mith/bagcat | setup.py | Python | mit | 647 |
import cv2
import numpy as np
import matplotlib.pyplot as plt
img = cv2.imread('bookpage.jpg')
_, threshold = cv2.threshold(img, 5, 255, cv2.THRESH_BINARY)
plt.subplot(2,1,1)
plt.imshow(img)
plt.subplot(2,1,2)
plt.imshow(threshold)
plt.show()
#
| miltonsarria/dsp-python | dsp2018/images/example2.py | Python | mit | 250 |
"""empty message
Revision ID: 82edf10df5bc
Revises: 94538cbba222
Create Date: 2017-02-04 22:52:25.279228
"""
# revision identifiers, used by Alembic.
revision = '82edf10df5bc'
down_revision = '94538cbba222'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - ... | whittlbc/jarvis | migrations/versions/82edf10df5bc_.py | Python | mit | 1,956 |
#!/usr/bin/env python
import agate
from csvkit.cli import CSVKitUtility, parse_column_identifiers
class CSVSort(CSVKitUtility):
description = 'Sort CSV files. Like the Unix "sort" command, but for tabular data.'
def add_arguments(self):
self.argparser.add_argument(
'-n', '--names', dest... | wireservice/csvkit | csvkit/utilities/csvsort.py | Python | mit | 2,282 |
import time
from threading import Thread
import RPi
from RPi import GPIO
from collections import Iterable
import itertools
HIGH = GPIO.HIGH
LOW = GPIO.LOW
def set_pin_mode(mode):
"""
Set pin numbering mode for all pins.
Args:
mode (str): mode to set, must be 'BOARD' or 'BCM'
"""
GPIO.set... | mgk/thingpin | src/thingpin/pin.py | Python | mit | 3,219 |
# Copyright (c) 2015 dmpayton
#
# 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, distribute... | cortesi/qtile | docs/sphinx_qtile.py | Python | mit | 6,730 |
"""Contains RichPage class"""
from __future__ import print_function
from kivy.uix.listview import ListView, CompositeListItem, ListItemButton, ListItemLabel
from kivy.adapters.simplelistadapter import SimpleListAdapter
from kivy.uix.label import Label
from kivy.uix.rst import RstDocument
from kivy.uix.boxlayout import ... | jdfreder/testandroid | helpguide/rich.py | Python | mit | 4,830 |
from django.db import models
from django.contrib.contenttypes.models import ContentType
try:
from django.contrib.contenttypes.generic import GenericForeignKey
except ImportError:
from django.contrib.contenttypes.fields import GenericForeignKey
from django.core.exceptions import ObjectDoesNotExist
def _get_per... | somcomltd/django-rbac | rbac/models.py | Python | mit | 5,119 |
from django import forms
from django.core.files import File
from django.conf import settings
from .widgets import FPFileWidget
import urllib2
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
class FPFieldMixin():
widget = FPFileWidget
default_mimetypes = "*/*"
... | thethomaseffect/travers-media-tools | django_filepicker/forms.py | Python | mit | 4,508 |
#!/usr/bin/env python
from django.conf.urls.defaults import patterns, url
from sirens import views
urlpatterns = patterns('',
url(r'^$', views.index, name='index'),
url(r'^pusher/auth$', views.pusher_user_auth, name='pusher_user_auth')
)
| hacktyler/hacktyler_crime | sirens/urls.py | Python | mit | 250 |
from mqttsqlite.orm.models import Topic
import json
from mqttsqlite.settings.private_settings import MANAGEMENT_PASSWORD, QUERY_PASSWORD
from .utils import Payload, Utils
class TopicsController (object):
def add_topic(self, msg):
received_data = json.loads(msg.payload)
payload = Utils().validate_... | rdiaz82/mqttSqlLite | mqttsqlite/core/topics_controller.py | Python | mit | 2,034 |
"""
Django settings for hello project.
Generated by 'django-admin startproject' using Django 1.9.5.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
# B... | AlexRiina/django-s3direct | example/example/settings.py | Python | mit | 4,212 |
from xbmcswift2 import Plugin, xbmcgui
plugin = Plugin()
@plugin.route('/')
def main_menu():
items = [
{'label': plugin.get_string(30000), 'path': "http://www.abc.net.au/res/streaming/audio/mp3/radio_national.pls",
'is_playable': True},
{'label': plugin.get_string(30001), 'path': "htt... | techyteach-s/plugin.audio.abcradioaustralia | addon.py | Python | mit | 3,454 |
import os
import ntpath
import xlrd
import openpyxl
from openpyxl.utils import coordinate_from_string, column_index_from_string
from openpyxl.utils.exceptions import CellCoordinatesException
class ExcelManager:
"""
Wrapper that opens and operates on .xls, .xlsx or .xlsm excel files. By
default we take in ... | erik-sn/xlwrap | xlwrap.py | Python | mit | 14,765 |
from Config import Config
from Distro import Distro
| maier/repo-mirror-mgr | Mirror/__init__.py | Python | mit | 52 |
import nussl
import numpy as np
import pytest
def test_pan_audio_signal(mix_and_sources):
mix, sources = mix_and_sources
sources = list(sources.values())
panned_audio = nussl.mixing.pan_audio_signal(sources[0], -45)
zeros = np.zeros_like(panned_audio.audio_data[0])
sum_ch = np.sum(panned_audio.a... | interactiveaudiolab/nussl | tests/core/test_mixing.py | Python | mit | 1,683 |
# flake8: noqa
"""
下载通达信可转债1分钟bar => vnpy项目目录/bar_data/
上海股票 => SSE子目录
深圳股票 => SZSE子目录
"""
import os
import sys
import csv
import json
from collections import OrderedDict
import pandas as pd
vnpy_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..'))
if vnpy_root not in sys.path:
sys.path.appe... | msincenselee/vnpy | prod/jobs/refill_tdx_cb_stock_bars.py | Python | mit | 3,556 |
import json
import serial
class PrometheusSerial:
portPrefix = '/dev/ttyUSB'
portNumber = 0
connected = False
connection = None
socket = None
reactor = None
def __init__(self, reactor):
print "PrometheusSerial: Starting serial communication"
self.reactor = reactor
self.init()
def init(self):
seri... | gcc-robotics/prometheus | software/narthex/PrometheusSerial.py | Python | mit | 4,234 |
# encoding: utf8
from __future__ import unicode_literals
import pytest
SV_TOKEN_EXCEPTION_TESTS = [
('Smörsåsen används bl.a. till fisk', ['Smörsåsen', 'används', 'bl.a.', 'till', 'fisk']),
('Jag kommer först kl. 13 p.g.a. diverse förseningar', ['Jag', 'kommer', 'först', 'kl.', '13', 'p.g.a.', 'diverse', 'fö... | banglakit/spaCy | spacy/tests/sv/test_tokenizer.py | Python | mit | 882 |
import sys
sys.path.append("..")
import math
import heapq
import numpy as np
import copy
from scipy import optimize
global nodes, edges, M, BaseMatrix
global left_edges, selected_edges, last_score, Hessian, record_inv_matrix, record_current_matrix
global crowdgauss_estimation_edges
global num_workers
normal_pdf = la... | guanhuamai/DPM | PythonSource/DecisionMakerLib/ApollingSelect.py | Python | mit | 9,439 |
from utils import CanadianJurisdiction
class Brossard(CanadianJurisdiction):
classification = 'legislature'
division_id = 'ocd-division/country:ca/csd:2458007'
division_name = 'Brossard'
name = 'Conseil municipal de Brossard'
url = 'http://www.ville.brossard.qc.ca'
| opencivicdata/scrapers-ca | ca_qc_brossard/__init__.py | Python | mit | 288 |
# -*- coding: utf8 -*-
# Copyright (c) 2017-2021 THL A29 Limited, a Tencent company. All Rights Reserved.
#
# 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... | tzpBingo/github-trending | codespace/python/tencentcloud/tia/v20180226/tia_client.py | Python | mit | 13,462 |
# -*- coding: utf-8 -*-
import decimal
import hashlib
import json
import zipfile
from io import BytesIO
from M2Crypto import SMIME
from M2Crypto import X509
from M2Crypto.X509 import X509_Stack
class Alignment:
LEFT = 'PKTextAlignmentLeft'
CENTER = 'PKTextAlignmentCenter'
RIGHT = 'PKTextAl... | devartis/passbook | passbook/models.py | Python | mit | 15,345 |
from __future__ import absolute_import
from panphon.featuretable import FeatureTable
from panphon._panphon import pat
| dmort27/panphon | panphon/__init__.py | Python | mit | 118 |
from django.core.management import BaseCommand
from gameboard.models import Entries
#The class must be named Command, and subclass BaseCommand
class Command(BaseCommand):
# Show this when the user types help
help = "Stop CTF! Disable all problem entries... (set is_active=False)"
# A command must define ha... | L34p/HeXA-CTF-2015 | gameboard/management/commands/gamestop.py | Python | mit | 513 |
from bs4 import BeautifulSoup
from datetime import datetime
from scraper import *
from general import General
def get_arrival_time(arrival_time_str):
time = datetime.strptime(arrival_time_str.strip(), '%H:%M:%S').time()
now = datetime.now()
arrival_time = datetime.combine(now, time)
return arrival_tim... | winiciuscota/OG-Bot | ogbot/scraping/movement.py | Python | mit | 3,821 |
"""Implements a character based lcd connected via PCF8574 on i2c."""
from pyb import Pin
from pyb import delay, millis
from pyb_gpio_lcd import GpioLcd
# Wiring used for this example:
#
# 1 - Vss (aka Ground) - Connect to one of the ground pins on you pyboard.
# 2 - VDD - I connected to VIN which is 5 volts when yo... | wuub/python_lcd | lcd/pyb_gpio_lcd_test8.py | Python | mit | 2,352 |
'''
Extract Ways from OSM PBF files
'''
import osmium as o
import json, os, requests, sys, time
import shapely.wkb as wkblib
# http://docs.osmcode.org/pyosmium/latest/intro.html
# A global factory that creates WKB from a osmium geometry
wkbfab = o.geom.WKBFactory()
# set in Dockerfile as env variable
GEO_DATA_DIR = ... | silberman/Deep-OSM | src/download_labels.py | Python | mit | 4,752 |
# Python - 3.6.0
circle_area = lambda circle: round(circle.radius ** 2 * __import__('math').pi, 6)
| RevansChen/online-judge | Codewars/8kyu/geometry-basics-circle-area-in-2d/Python/solution1.py | Python | mit | 100 |
# based on killer algo found here:
# http://codereview.stackexchange.com/questions/12922/inversion-count-using-merge-sort
import sys, bisect
input_list = map(int,open(sys.argv[1]))
sorted_list = sorted(input_list)
inversions = 0
# we compare the unsorted list to the sorted list
# to compute inversion count, neat!
for... | zmcartor/Algorithms | Python/better_inversion_count.py | Python | mit | 485 |
from functools import total_ordering
from .base import PydeckType
@total_ordering
class String(PydeckType):
"""Indicate a string value in pydeck
Parameters
----------
value : str
Value of the string
"""
def __init__(self, s: str, quote_type: str = ""):
self.value = f"{quote... | uber-common/deck.gl | bindings/pydeck/pydeck/types/string.py | Python | mit | 531 |
from django.apps import AppConfig
class Phase1Config(AppConfig):
name = 'phase1'
| Kianoosh76/fop-project | phase1/apps.py | Python | mit | 87 |
# -*- encoding:utf8 -*-
import cStringIO
import qrcode
class QRCodeCreator():
def __init__(self):
pass
def create(self, message):
qr = qrcode.QRCode(
version=1,
error_correction=qrcode.constants.ERROR_CORRECT_L,
box_size=10,
border=4,
... | supistar/Botnyan | model/qrcreator.py | Python | mit | 520 |
# -*- coding: utf-8 -*-
#Import libraries
from sys import exit
from math import sqrt
#Print title (http://patorjk.com/software/taag/#p=display&f=Small%20Slant&t=Equation%20Solver%20V2.1)
print " ____ __ _ ____ __ _ _____ ___"
print " / __/__ ___ _____ _/ /_(_)__ ___ ... | V3sth4cks153/Python-Programs | equation_solver.py | Python | mit | 1,645 |
"""
File Strip.
Licensed under MIT
Copyright (c) 2012 - 2016 Isaac Muse <isaacmuse@gmail.com>
"""
import re
from .comments import Comments
JSON_PATTERN = re.compile(
r'''(?x)
(
(?P<square_comma>
, # trailing comma
(?P<square_ws>[\s\r\n]*) ... | facelessuser/TabsExtra | lib/file_strip/json.py | Python | mit | 2,064 |
f = 123.456
print(round(f))
# 123
print(type(round(f)))
# <class 'int'>
print(round(f, 1))
# 123.5
print(round(f, 2))
# 123.46
print(round(f, -1))
# 120.0
print(round(f, -2))
# 100.0
print(round(f, 0))
# 123.0
print(type(round(f, 0)))
# <class 'float'>
i = 99518
print(round(i))
# 99518
print(round(i, 2))
# 9... | nkmk/python-snippets | notebook/round_test.py | Python | mit | 1,076 |
# -*- coding:utf-8 -*-
# installed helper list
INSTALLED_HELPERS = (
'dc',
)
| tao12345666333/Talk-Is-Cheap | python/hayate/helpers/settings.py | Python | mit | 82 |
import numpy as np
from scipy import stats
def Bartlett (matrix):
n = np.array([len(i) for i in matrix])
k = len(matrix)
N = n.sum()
Si2 = np.var(matrix, axis=1, ddof=1)
Sp2 = (np.array([(n[i]-1) * Si2[i] for i in range(k)]).sum() / (N - k))
term_1 = (N-k)*np.log(Sp2)
term_2 = np.array([... | Cesarmerjan/Pystatistic | Bartletts_test.py | Python | mit | 2,271 |
import functools
import re
import os
from flask import Flask, render_template, request, jsonify
from extensions import db, login_manager, csrf
import config
from sentiment_classifiers import SentimentClassifier, files, binary_dict
from vk_parser import VkFeatureProvider
app = Flask(__name__)
########################... | ArtemMIPT/sentiment_analysis | app.py | Python | mit | 4,310 |
from encodings import normalize_encoding, aliases
from types import MappingProxyType
from psycopg2.extensions import encodings as _PG_ENCODING_MAP
PG_ENCODING_MAP = MappingProxyType(_PG_ENCODING_MAP)
# python to postgres encoding map
_PYTHON_ENCODING_MAP = {
v: k for k, v in PG_ENCODING_MAP.items()
}
def get_... | portfoliome/postpy | postpy/pg_encodings.py | Python | mit | 627 |
from .trainsession import TrainSession
from .helper import FixedNoise
class SmurffSession(TrainSession):
def __init__(self, Ytrain, priors, is_scarce = True, Ytest=None, side_info=None, direct=True, *args, **kwargs):
TrainSession.__init__(self, priors=priors, *args, **kwargs)
self.addTrainAndTest(Y... | ExaScience/smurff | python/smurff/smurff.py | Python | mit | 3,868 |
#!/usr/bin/python
"""
This example demonstrates several features of PyLaTeX.
It includes plain equations, tables, equations using numpy objects, tikz plots,
and figures.
.. :copyright: (c) 2014 by Jelte Fennema.
:license: MIT, see License for more details.
"""
# begin-doc-include
import numpy as np
from pylate... | bjodah/PyLaTeX | examples/full.py | Python | mit | 2,838 |
"""
Implements a feature set based off of a set of regexes applied to strings.
.. autoclass:: revscoring.languages.features.RegexMatches
:members:
:member-order: bysource
Supporting classes
------------------
.. autoclass:: revscoring.languages.features.regex_matches.Revision
:members:
:member-order:... | he7d3r/revscoring | revscoring/languages/features/regex_matches/__init__.py | Python | mit | 560 |
import _plotly_utils.basevalidators
class ColorsrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(
self, plotly_name="colorsrc", parent_name="funnel.hoverlabel.font", **kwargs
):
super(ColorsrcValidator, self).__init__(
plotly_name=plotly_name,
parent... | plotly/python-api | packages/python/plotly/plotly/validators/funnel/hoverlabel/font/_colorsrc.py | Python | mit | 470 |
#!/usr/bin/env python
from app import app
app.run(debug=True, port=5000) | MITPERG/oilsands-mop | run.py | Python | mit | 74 |
#!/usr/bin/env python2.7
"""Docker From Scratch Workshop - Level 4: Add overlay FS.
Goal: Instead of re-extracting the image, use it as a read-only layer
(lowerdir), and create a copy-on-write layer for changes (upperdir).
HINT: Don't forget that overlay fs also requires a workdir.
Read more on overlay FS here... | Fewbytes/rubber-docker | levels/04_overlay/rd.py | Python | mit | 5,063 |
# -*- coding: utf-8 -*-
"""
quinoa.py
=========
Create QUINOA compressed dataset.
QUINOA (QUasi Integer Noise Offset Adjustment) compression is a lossy compression
algorithm for floating point data, and is similar to the RICE-based compression
technique that FPACK uses on floating point data.
The FITS compression pa... | telegraphic/fits2hdf | aadnc_benchmarks/quinoa_idea/quinoa.py | Python | mit | 4,834 |
from typing import *
class Sommet:
def __init__(self, pere, etiquette=None):
self.pere = pere
self.fils = []
self.label = etiquette
if pere:
pere.fils.append(self)
class Arbre:
def __init__(self):
self.root = Sommet(None)
def fils(arbre: Arbre, sommet: S... | bros-bioinfo/bros-bioinfo.github.io | COURS/M1/SEMESTRE2/ALGO/TD_Arbres.py | Python | mit | 817 |
commands = (
('walk', '1.3.6.1.2.1.2.2.1.2'),
('walk', '1.3.6.1.2.1.2.2.1.10'),
('get', '1.3.6.1.2.1.2.2.1.2.1'),
)
destinations = (
'ada-xem1', 'ona-xem1', 'alo-xem1', 'otm-xem1',
'c2k-xem1', 'vtr-xem1', 'tom-xem1',
'onr-xem1', 'vco-xem1', 'inm-xem1', 'gtr-xem1',
'ram-xem1', 'vir-xem1', 't... | aleasoluciones/gosnmpquerier | tools/data.py | Python | mit | 397 |
""" The access backend object base class """
from collections import defaultdict
from passlib.apps import custom_app_context as pwd_context
from pyramid.security import (Authenticated, Everyone,
effective_principals, Allow, Deny,
ALL_PERMISSIONS)
from pyramid.... | rubikloud/pypicloud | pypicloud/access/base.py | Python | mit | 19,233 |
from django.test import TestCase, Client
from bookstore.models import Book, Category
from django.core.urlresolvers import reverse
class BookStoreViewTestCase(TestCase):
def setUp(self):
self.client = Client()
self.category = Category.objects.create(name="programming", description="for the geeks")
... | andela-ijubril/book-search | booker/bookstore/tests/test_views.py | Python | mit | 1,271 |
# 2017, Andrei N., Tudor B.
from sphinx.addnodes import centered
from ._ignore_Agent import Agent
from ._ignore_Agent import Transition
import matplotlib.pyplot as plt
from random import choice
import logging
import os
import numpy as np
import math
import random
import torch
import torch.nn as nn
import torch.opti... | village-people/flying-pig | ai_challenge/agents/_ignorebeta_dqn_agent_batch.py | Python | mit | 3,884 |
#!/usr/bin/env python
class BaseException(Exception):
def __init__(self, message=None, **kwargs):
pass
class InvalidResults(BaseException):
pass
class InvalidConfigurationValue(BaseException):
pass
class VolumeBackendAPIException(BaseException):
pass
class InvalidSnapshot(BaseException... | softlayer/softlayer-cinder-driver | slos/test/mocks/cinder/exception.py | Python | mit | 425 |
__author__ = 'jatwood'
import sys
import numpy as np
from sklearn.metrics import f1_score, accuracy_score
from sklearn.linear_model import LogisticRegression
import data
import util
import kernel
import structured
from baseline_graph_experiment import GraphDecompositionModel
def graph_proportion_baseline_experiment... | jcatw/scnn | scnn/graph_proportion_baseline_experiment.py | Python | mit | 6,889 |
class Solution:
def canMakeArithmeticProgression(self, arr: List[int]) -> bool:
arr.sort()
diff = arr[1] - arr[0]
for i in range(2, len(arr)):
if arr[i] - arr[i - 1] != diff:
return False
return True
| jiadaizhao/LeetCode | 1501-1600/1502-Can Make Arithmetic Progression From Sequence/1502-Can Make Arithmetic Progression From Sequence.py | Python | mit | 264 |
def environment(request):
from django.conf import settings
return {
'environment': getattr(settings, 'ENVIRONMENT', None),
'shackspace': getattr(settings, 'SHACKSPACE', None),
}
| letsmeet-click/letsmeet.click | letsmeet/letsmeet/context_processors.py | Python | mit | 208 |
# -*- coding: utf-8 -*-
""" Sphinx configuration file. """
#
# Coredata API client documentation build configuration file, created by
# sphinx-quickstart on Mon Oct 6 19:20:17 2014.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration value... | koddsson/coredata-python-client | docs/conf.py | Python | mit | 8,383 |
__version__='0.2.0'
from .pallet import * | lucidlylogicole/pallet | pallet/__init__.py | Python | mit | 41 |
'''
Created on Aug 31, 2011
@author: Iftach
'''
from linkedin.tests import *
from linkedin import linkedin
class LinkedInRequestTest(LinkedInTestBase):
def test_request_token(self):
self._test_request_token(False)
def test_request_token_gae(self):
self._init_gae()
... | vaidhy/python-linkedin-fork | linkedin/tests/linkedin_request_test.py | Python | mit | 592 |
# Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.
#
# Do not allocate extra space for another array, you must do this in place with constant memory.
#
# For example,
# Given input array nums = [1,1,2],
#
# Your function should return length = 2, wi... | menghanY/LeetCode-Python | Array/RemoveDuplicatesfromSortedArray.py | Python | mit | 841 |
# -*- coding: utf-8 -*-
"""Family module for Vikidia."""
#
# (C) Pywikibot team, 2010-2018
#
# Distributed under the terms of the MIT license.
#
from __future__ import absolute_import, division, unicode_literals
from pywikibot import family
class Family(family.SubdomainFamily):
"""Family class for Vikidia."""
... | PersianWikipedia/pywikibot-core | pywikibot/families/vikidia_family.py | Python | mit | 661 |
"""
Model for the edition.
"""
# pylint: disable=too-few-public-methods
from django.db import models
from .mixins import TimestampMixin, DescriptionNotesMixin
class Edition(models.Model, TimestampMixin, DescriptionNotesMixin):
"""
Model for the edition.
"""
name = models.CharField(max_length=128)
| petertrotman/adventurelookup | server/adventures/models/edition.py | Python | mit | 317 |
from django import forms
from .models import MemberRSVP
class EventAttendeeForm(forms.ModelForm):
id = forms.IntegerField(widget=forms.HiddenInput)
worked_on = forms.CharField(widget=forms.Textarea(attrs={
'cols': '35',
'rows': '5'
}))
class Meta:
model = MemberRSVP
... | DjangoNYC/squid | squid/core/forms.py | Python | mit | 352 |
"""Lower level API, configuration, and HTTP stuff."""
import six
import time
from ubersmith.compat import total_ordering, file_type
import requests
from ubersmith.exceptions import (
RequestError,
ResponseError,
UpdatingTokenResponse,
MaintenanceResponse,
)
from ubersmith.utils import (
append_qs,... | jasonkeene/python-ubersmith | ubersmith/api.py | Python | mit | 21,356 |
#!/usr/bin/env python3
# Copyright (c) 2014-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the RPC HTTP basics."""
from test_framework.test_framework import BitcoinTestFramework
from test_... | cevap/ion | test/functional/interface_http.py | Python | mit | 4,781 |
from pudzu.charts import *
df = pd.read_csv("datasets/flagstriband.csv")
df = pd.concat([pd.DataFrame(df.colours.apply(list).tolist(), columns=list("TMB")), df], axis=1).set_index("colours")
FONT, SIZE = calibri, 24
fg, bg = "black", "#EEEEEE"
default_img = "https://s-media-cache-ak0.pinimg.com/736x/0d/36/e7/0d36e7a4... | Udzu/pudzu | dataviz/flagstriband.py | Python | mit | 3,039 |
"""
WSGI config for alex 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.10/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTING... | xualex/DjangoTutorial | alex/alex/wsgi.py | Python | mit | 386 |
"""Setup for HDD-indexer
This module provides the setup for ``hdd-indexer`` by downloading its
`dependencies`, creating the `database`, createing a sampel `user`.
Usage:
$ python setup.py
Dependencies:
The dependencies are installed with pip.
$ pip install -r requirements.txt
Database:
The d... | coolharsh55/hdd-indexer | setup.py | Python | mit | 8,480 |
# -*- coding: utf-8 -*
PROVINCE_CHOICES = (
('AG', 'Agrigento'),
('AL', 'Alessandria'),
('AN', 'Ancona'),
('AO', 'Aosta'),
('AR', 'Arezzo'),
('AP', 'Ascoli Piceno'),
('AT', 'Asti'),
('AV', 'Avellino'),
('BA', 'Bari'),
# ('BT', 'Barletta-Andria-Trani'), # active starting from 2009... | jonaustin/advisoryscan | django/django/contrib/localflavor/it/it_province.py | Python | mit | 2,747 |
# -*- coding: utf-8 -*-
#
# {{ cookiecutter.project_repo }} documentation build configuration file, created by
# sphinx-quickstart on Sat Dec 19 13:16:21 2015.
#
# 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
# aut... | bstinsonmhk/python-template | {{cookiecutter.project_repo}}/docs/conf.py | Python | mit | 8,153 |
# ============================================================================
# FILE: converter_truncate_menu.py
# AUTHOR: Shougo Matsushita <Shougo.Matsu at gmail.com>
# License: MIT license
# ============================================================================
from .base import Base
from deoplete.util impor... | killuazhu/vimrc | sources_non_forked/deoplete.nvim/rplugin/python3/deoplete/filter/converter_truncate_menu.py | Python | mit | 1,019 |
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | DailyActie/Surrogate-Model | 01-codes/tensorflow-master/tensorflow/models/image/mnist/convolutional.py | Python | mit | 13,852 |
#!/usr/bin/python
# mk_ErrorModel.py -m 0.125
# Example
# By Simon H. Rasmussen
# Bioinformatics Centre
# University of Copenhagen
#
def wLines(mutP):
# range of qualities 0...41
for qual in range(42):
for base in ["A","C","G","T"]:
# quality base P(a|base) P(c|base) P(g|base... | simras/CLAP | scripts/mk_ErrorModel.py | Python | mit | 1,940 |
import webapp2
import re
import weakref
from webapp2 import cached_property
from webapp2_extras import sessions
from google.appengine.api import users
from ferris.core.ndb import encode_key, decode_key
from ferris.core.uri import Uri
from ferris.core import inflector, auth, events, views, request_parsers, response_hand... | yowmamasita/social-listener-exam | ferris/core/controller.py | Python | mit | 13,807 |
#
# The MIT License
#
# Copyright (c) 2009 Ben Morris
#
# 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, modi... | bnmrrs/runkeeper-api | runkeeper/httpclient.py | Python | mit | 1,887 |
"""This module helps for uploading and downloading listings from/to play."""
import os
import json
from file_util import mkdir_p
from file_util import list_dir_abspath
def upload(client, source_dir):
"""Upload listing files in source_dir. folder herachy."""
print('')
print('upload store listings')
pri... | wooga/play-deliver | playdeliver/listing.py | Python | mit | 1,526 |
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
from sklearn.datasets import load_sample_image
from sklearn.datasets import load_sample_images
# Utility functions
def plot_image(image):
plt.imshow(image, cmap="gray", interpolation="nearest")
plt.axis("off")
def plot_color_image(image... | KT12/hands_on_machine_learning | convnets.py | Python | mit | 1,271 |
from __future__ import print_function
try:
import atpy
atpyOK = True
except ImportError:
atpyOK = False
# rewrite this garbage
class write_txt(object):
def __init__(self, Spectrum):
self.Spectrum = Spectrum
def write_data(self, clobber = True):
"""
Write all fit informatio... | mikelum/pyspeckit | pyspeckit/spectrum/writers/txt_writer.py | Python | mit | 1,770 |
from django import forms
from django_measurement.forms import MeasurementField
from tests.custom_measure_base import DegreePerTime, Temperature, Time
from tests.models import MeasurementTestModel
class MeasurementTestForm(forms.ModelForm):
class Meta:
model = MeasurementTestModel
exclude = []
c... | coddingtonbear/django-measurement | tests/forms.py | Python | mit | 556 |
import sys
sys.path.insert(0,'../')
if sys.version_info[:2] == (2,6):
import unittest2 as unittest
else:
import unittest
import os
import lean
import shutil
import datetime
import time
from rivets_test import RivetsTest
import rivets
CACHE_PATH = os.path.relpath("../../.sass-cache", __file__)
COMPASS_PATH = os.path... | OiNutter/rivets | test/test_scss.py | Python | mit | 6,467 |
from selfdrive.car import dbc_dict
from cereal import car
Ecu = car.CarParams.Ecu
class CarControllerParams:
def __init__(self, CP):
if CP.carFingerprint == CAR.IMPREZA_2020:
self.STEER_MAX = 1439
else:
self.STEER_MAX = 2047
self.STEER_STEP = 2 # how often we update the steer c... | commaai/openpilot | selfdrive/car/subaru/values.py | Python | mit | 11,405 |
from main_handler import Handler
from ..models import Posts
from .. import utils
class NewPost(Handler):
"""Handler for new post page"""
@utils.login_required
def get(self):
self.render("newpost.html")
@utils.login_required
def post(self):
subject = self.request.get("subject")
... | stonescar/multi-user-blog | blogmods/handlers/new_post.py | Python | mit | 772 |
#!/usr/bin/python
# ex:ts=4:sw=4:sts=4:et
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
# The unittest framwork doesn't play nice with pylint:
# pylint: disable-msg=C0103
from __future__ import absolute_import
import unittest
from svtplay_dl.service.oppetarkiv import OppetArkiv
from svtplay_dl.se... | olof/svtplay-dl | lib/svtplay_dl/service/tests/oppetarkiv.py | Python | mit | 591 |
from tkinter import ttk
from ozopython.colorLanguageTranslator import ColorLanguageTranslator
from .ozopython import *
from tkinter import *
def run(filename):
code = ozopython.compile(filename)
colorcode = ColorLanguageTranslator.translate(code)
def load(prog, prog_bar):
colormap = {
... | Kaarel94/Ozobot-Python | ozopython/__init__.py | Python | mit | 1,375 |
"""
:mod:`papy.util.codefile`
=========================
Provides template strings for saving **PaPy** pipelines directly as Python
source code.
"""
# imap call signature
I_SIG = ' %s = NuMap(worker_type="%s", worker_num=%s, stride=%s, buffer=%s, ' + \
'ordered =%s, skip =%s, name ="%s")\n'
# pi... | mcieslik-mctp/papy | src/papy/util/codefile.py | Python | mit | 1,160 |
try:
import configparser
except:
import ConfigParser as configparser
def test_config(config):
assert config.templates_dir == '~/.latest/templates/'
assert config.pyexpr_entry == r'\{\$'
assert config.pyexpr_exit == r'\$\}'
assert config.env_entry == r'<<<'
assert config.env_exit == r'>>>'
... | bluephlavio/latest | test/test_config.py | Python | mit | 438 |
import sys
import os.path
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'lib'))
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'py'))
| kyungkoo/gae-ota-plist-maker | appengine_config.py | Python | mit | 160 |
"""nox-poetry configuration file."""
from calcipy.dev.noxfile import build_check, build_dist, check_safety, coverage, tests # noqa: F401
| KyleKing/recipes | noxfile.py | Python | mit | 139 |
import cv2
import numpy as np
import imutils
from utils import util
import dlib
import itertools
class DLIBTracker:
def __init__(self):
self._tracker = dlib.correlation_tracker()
self.detector = cv2.BRISK_create(10)
# self.detector = cv2.AKAZE_create()
# self.detector = cv2.xfeatur... | zooliet/UWTracking | src/trackers/dlib_tracker/dlib_tracker.py | Python | mit | 1,652 |
# -*- coding: utf-8 -*-
# request helpers
def _cleanValue(value):
mapping = {
"True": True,
"False": False,
"None": None,
}
return mapping.get(value, value)
def lookupToString(lookup_dict):
"""
Convert the lookup dict into a string.
e.g.:
{"field1": "a", "field2": "b"} -> "field1=a,field2=b"
"""
ret... | gista/django-selectfilter | selectfilter/utils.py | Python | mit | 1,579 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# jacquard documentation build configuration file, created by
# sphinx-quickstart on Fri Jan 13 04:43:44 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
# a... | prophile/jacquard | doc/conf.py | Python | mit | 4,856 |
# -*- coding: utf-8 -*-
#
# Peony documentation build configuration file, created by
# sphinx-quickstart on Tue Aug 30 16:36:34 2016.
#
# 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.
#
# All... | odrling/peony-twitter | docs/conf.py | Python | mit | 10,839 |
"""Tests for the wmtmetadata package."""
import os
test_dir = os.path.dirname(__file__)
data_dir = os.path.join(test_dir, 'data')
| csdms/wmt-metadata | wmtmetadata/tests/__init__.py | Python | mit | 133 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns(
'',
url(r'^$', 'inventory.views.home', name='home'),
url(r'^admin/', include(admin.site.urls)),
)
| tomhsx/django-inventory | inventory/urls.py | Python | mit | 242 |
import os
DATABASE = {
'drivername': os.environ['NBA_DB_DRIVER'],
'host': os.environ['NBA_DB_HOST'],
'port': os.environ['NBA_DB_PORT'],
'username': os.environ['NBA_DB_USER'],
'password': os.environ['NBA_DB_PW'],
'database': os.environ['NBA_DB_NAME'],
}
| arosenberg01/asdata | settings.py | Python | mit | 279 |
import json
from django import http
from django.conf import settings
from rmr.types import JsonDict
class RequestDecoder:
content_type = 'application/json'
allowed_methods = {
'POST', 'PUT', 'PATCH',
}
def process_request(self, request):
if request.method not in self.allowed_metho... | RedMadRobot/rmr_django | rmr/middleware/json.py | Python | mit | 1,109 |
# -*- coding: utf-8 -*-
# Copyright © 2012-2013 Roberto Alsina and others.
# 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 t... | Proteus-tech/nikola | nikola/plugins/task/rss.py | Python | mit | 3,784 |