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 aiohttp import ClientSession
from aiowing import settings
async def test_unauthenticated_records(test_app, test_client):
cli = await test_client(test_app)
resp = await cli.get(test_app.router['admin_records'].url(),
allow_redirects=False)
assert resp.headers.get('Location') ... | embali/aiowing | aiowing/apps/admin/tests/test_admin.py | Python | mit | 2,851 |
# -*- coding: utf-8 -*-
class Slot(object):
"""
To use comb, you should create a python module file. we named *slot*.
A legal slot must be named 'Slot' in your module file and it must be at least contain four method:
* `initialize`
initial resource, e.g: database handle
* `__enter__`
g... | nextoa/comb | comb/slot.py | Python | mit | 2,027 |
from biohub.core.plugins import PluginConfig
class TestConfig(PluginConfig):
name = 'tests.core.plugins.test'
title = ''
author = ''
description = ''
| lsj1292/Abacus | tests/core/plugins/expected/apps.py | Python | mit | 169 |
from flask.ext.wtf import Form
from wtforms import TextField
from wtforms.validators import Required
class NameForm(Form):
name = TextField('What is your name?', validators = [ Required() ])
| miguelgrinberg/Flask-Intro | 07-ScalableStructure/app/forms.py | Python | mit | 197 |
# -*- coding: utf-8 -*-
from django.test import TestCase
from django.core.urlresolvers import reverse
class TestHomePage(TestCase):
def test_uses_index_template(self):
response = self.client.get(reverse("home"))
self.assertTemplateUsed(response, "home/index.html")
def test_uses_base_temp... | janusnic/dj-21v | unit_02/mysite/home/test.py | Python | mit | 439 |
import os
import sys
import warnings
from setuptools import setup
version_contents = {}
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, "shippo", "version.py"), encoding="utf-8") as f:
exec(f.read(), version_contents)
setup(
name='shippo',
version=version_contents['VERSION... | goshippo/shippo-python-client | setup.py | Python | mit | 1,408 |
from __future__ import absolute_import
from functools import partial
from pkg_resources import Requirement, resource_filename
import re
from mako.template import Template
from sqlalchemy import MetaData, select, create_engine, text
from sqlalchemy.exc import ArgumentError
from fixturegen.exc import (
NoSuchTable,... | anton44eg/fixturegen | fixturegen/generator.py | Python | mit | 2,782 |
"""
Django settings for gamesapi project.
Generated by 'django-admin startproject' using Django 1.10.5.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
import o... | tiagoprn/experiments | django/drf_book/gamesapi/gamesapi/settings.py | Python | mit | 5,648 |
import time
from typing import List, Optional
from utils import tasks
from zirc.event import Event
from utils.database import Database
from zirc.wrappers import connection_wrapper
def chunks(l: List, n: int):
"""Yield successive n-sized chunks from l."""
for i in range(0, len(l), n):
yield l[i:i + n... | wolfy1339/Python-IRC-Bot | utils/irc.py | Python | mit | 2,432 |
from base64 import b64decode, b64encode
from hashlib import sha256
from Crypto import Random
from Crypto.Cipher import AES
from frontstage import app
class Cryptographer:
"""Manage the encryption and decryption of random byte strings"""
def __init__(self):
"""
Set up the encryption key, thi... | ONSdigital/ras-frontstage | frontstage/common/cryptographer.py | Python | mit | 2,059 |
'''
Created on 22/ago/2011
@author: norby
'''
from core.moduleexception import ModuleException, ProbeException, ExecutionException, ProbeSucceed
from core.moduleguess import ModuleGuess
from core.argparse import ArgumentParser, StoredNamespace
from core.argparse import SUPPRESS
from ast import literal_eval
import rand... | JeyZeta/Dangerous | Dangerous/Weevely/modules/shell/sh.py | Python | mit | 3,972 |
# Generated by Django 1.11.11 on 2018-08-27 21:51
from django.db import migrations
def update_domain_forward(apps, schema_editor):
"""Set site domain and name."""
Domain = apps.get_model("domains", "Domain")
Domain.objects.update_or_create(pk=1, name="fedrowanie.siecobywatelska.pl")
class Migration(mig... | watchdogpolska/feder | feder/domains/migrations/0002_initial-domain.py | Python | mit | 454 |
from django.http import HttpResponse
from django.shortcuts import render
from django.views import generic
import api.soql
import json
from api.soql import *
# Create your views here.
def indexView(request):
context = {
"vehicleAgencies": getUniqueValuesWithAggregate("gayt-taic", "agency", "max(postal... | jthidalgojr/greengov2015-TeamAqua | TeamAqua/views.py | Python | mit | 1,091 |
# -*- coding=utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
from ..actions.install import install
from ._base import BaseCommand
from .options import dev, no_check, no_clean
class Command(BaseCommand):
name = "install"
description = "Generate Pipfile.lock to synchronize ... | kennethreitz/pipenv | pipenv/vendor/passa/cli/install.py | Python | mit | 598 |
#!/usr/bin/env python
# Copyright (c) 2014 The Bitcoin Core developers
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
# Test for -rpcbind, as well as -rpcallowip and -rpcconnect
# Add python-bitcoinrpc to module search path:... | langerhans/dogecoin | qa/rpc-tests/rpcbind_test.py | Python | mit | 5,804 |
import copy
class Solution:
# @param strs: A list of strings
# @return: A list of strings
def anagrams(self, strs):
# write your code here
str1=copy.deepcopy(strs)
def hashLize(s):
dicts1= dict()
for i in range(26):
dicts1[chr(i+ord("a"... | jonathanxqs/lintcode | 171.py | Python | mit | 1,786 |
#coding:utf-8
"""
functionモジュールのparticle_resampling関数をテストする
"""
from functions import particles_resampling
import pfoe
robot1 = pfoe.Robot(sensor=4,choice=3,particle_num=100)
#case1:パーティクルの分布・重みは等分
for i in range(100):
robot1.particles.distribution[i] = i % 5
robot1.particles.weight[i] = 1.0 / 100.0
robot1.... | kato-masahiro/particle_filter_on_episode | PFoE_module/.test_particles_resampling.py | Python | mit | 889 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-04-10 10:00
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('Course', '0005_coursegroup'),
]
operations = [
... | IEEEDTU/CMS | Course/migrations/0006_auto_20160410_1530.py | Python | mit | 572 |
# vim:ts=4:sts=4:sw=4:expandtab
"""Package. Manages event queues.
Writing event-driven code
-------------------------
Event-driven procedures should be written as python coroutines (extended generators).
To call the event API, yield an instance of the appropriate command. You can use
sub-procedures - just yield the a... | zielmicha/satori | satori.events/satori/events/__init__.py | Python | mit | 1,410 |
from setuptools import setup
from setuptools import find_packages
setup(name='gym_square',
version='0.0.1',
author='Guillaume de Chambrier',
author_email='chambrierg@gmail.com',
description='A simple square world environment for openai/gym',
packages=find_packages(),
url='https://gi... | gpldecha/gym-square | setup.py | Python | mit | 407 |
#!/usr/bin/env python
"""
Read the list of chimeric interactions and generate a file that can be read
by circos.
"""
import sys
import argparse
from collections import defaultdict
from math import log
import pro_clash
def process_command_line(argv):
"""
Return a 2-tuple: (settings object, args list).
`a... | asafpr/pro_clash | bin/plot_circos_plot.py | Python | mit | 2,380 |
from __future__ import unicode_literals
from django.db import models
import datetime
from django.db.models.signals import pre_save
from django.urls import reverse
from django.utils.text import slugify
from django.utils.translation import ugettext_lazy as _
from source_utils.starters import CommonInfo, GenericCategor... | michealcarrerweb/LHVent_app | stock/models.py | Python | mit | 4,911 |
import logging
import os
import shlex
import unittest
import sys
from toil.common import toilPackageDirPath
from toil.lib.bioio import getBasicOptionParser, parseSuiteTestOptions
log = logging.getLogger(__name__)
class ToilTest(unittest.TestCase):
"""
A common base class for our tests. Please have every tes... | BD2KGenomics/toil-old | src/toil/test/__init__.py | Python | mit | 1,203 |
from setuptools import setup, find_packages
from pip.req import parse_requirements
version = "6.27.20"
requirements = parse_requirements("requirements.txt", session="")
setup(
name='frappe',
version=version,
description='Metadata driven, full-stack web framework',
author='Frappe Technologies',
author_email='info... | Amber-Creative/amber-frappe | setup.py | Python | mit | 532 |
<<<<<<< HEAD
<<<<<<< HEAD
from . import client, rest, session
=======
from . import client, rest, session
>>>>>>> b875702c9c06ab5012e52ff4337439b03918f453
=======
from . import client, rest, session
>>>>>>> b875702c9c06ab5012e52ff4337439b03918f453
| ArcherSys/ArcherSys | archersys/Lib/site-packages/dropbox/__init__.py | Python | mit | 254 |
import os
import subprocess
from pathlib import Path
from time import sleep
PACKAGES = Path('packages')
class Module:
def __init__(self, name, path=None, files=None, dependencies=None):
self.name = name
if path is None:
path = PACKAGES / name
self.path = path
self.file... | gems-uff/noworkflow | npm/watch.py | Python | mit | 2,623 |
#! /usr/bin/env python
"""pandoc-fignos: a pandoc filter that inserts figure nos. and refs."""
# Copyright 2015, 2016 Thomas J. Duck.
# All rights reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Softwa... | alexin-ivan/zfs-doc | filters/pandoc_fignos.py | Python | mit | 11,034 |
"""
Encapsulate the absence of an object by providing a substitutable
alternative that offers suitable default do nothing behavior.
"""
import abc
class AbstractObject(metaclass=abc.ABCMeta):
"""
Declare the interface for Client's collaborator.
Implement default behavior for the interface common to all c... | zitryss/Design-Patterns-in-Python | behavioral/null_object.py | Python | mit | 965 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'ModelFieldData.foreign'
db.alter_column('blogs_modelfielddata', 'foreign_id', self.gf('dj... | carquois/blobon | blobon/blogs/migrations/0125_auto__chg_field_modelfielddata_foreign.py | Python | mit | 31,918 |
import filecmp
from transfert import Resource
from transfert.actions import copy
def estimate_nb_cycles(len_data, chunk_size):
return (len_data // chunk_size) + [0, 1][(len_data % chunk_size) > 0]
def test_simple_local_copy(tmpdir):
src = tmpdir.join('alpha')
dst = tmpdir.join('beta')
src.write('s... | rbernand/transfert | tests/unit/test_copy.py | Python | mit | 1,619 |
import json
from django.db.models import Q, Subquery
from django.core.management.base import BaseCommand
from readthedocs.oauth.models import RemoteRepository
from readthedocs.oauth.services import registry
from readthedocs.oauth.services.base import SyncServiceError
from readthedocs.projects.models import Project
fr... | rtfd/readthedocs.org | readthedocs/oauth/management/commands/reconnect_remoterepositories.py | Python | mit | 4,783 |
'''
@author: lockrecv@gmail.com
A pure python ping implementation using raw socket.
Note that ICMP messages can only be sent from processes running as root.
Inspired by Matthew Dixon Cowles <http://www.visi.com/~mdc/>.
'''
import os
import select
import socket
import struct
import time
class Ping:
''' Power On... | ylcrow/poweron | src/thirdparty/Ping.py | Python | mit | 5,859 |
# 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/deviceupdate/azure-mgmt-deviceupdate/azure/mgmt/deviceupdate/aio/operations/_private_link_resources_operations.py | Python | mit | 8,870 |
#!/usr/bin/env python
#*****************************************************************************
# $Id$
#
# Project: OpenGIS Simple Features Reference Implementation
# Purpose: Python port of a simple client for viewing OGR driver data.
# Author: Even Rouault, <even dot rouault at mines dash paris dot org>
#
# ... | worldbank/cv4ag | utils/ogrinfo.py | Python | mit | 20,768 |
# 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 model 'Contact'
db.create_table('storybase_user_contact', (
('id', self.gf('django.db... | denverfoundation/storybase | apps/storybase_user/migrations/0006_auto__add_contact.py | Python | mit | 14,929 |
from setuptools import setup, find_packages
setup(name='monsql',
version='0.1.7',
packages = find_packages(),
author='firstprayer',
author_email='zhangty10@gmail.com',
description='MonSQL - Mongodb-style way for using mysql.',
url='https://github.com/firstprayer/monsql.git',
i... | firstprayer/monsql | setup.py | Python | mit | 371 |
# -*- coding: utf-8 -*-
u"""
.. module:: organizations
"""
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.core.urlresolvers import reverse
from django.shortcuts import get_object_or_404
from django.shortcuts import redirect
from django.shortcuts import render... | stxnext-csr/volontulo | apps/volontulo/views/organizations.py | Python | mit | 6,645 |
import _plotly_utils.basevalidators
class TicktextsrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(self, plotly_name="ticktextsrc", parent_name="layout.xaxis", **kwargs):
super(TicktextsrcValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_na... | plotly/plotly.py | packages/python/plotly/plotly/validators/layout/xaxis/_ticktextsrc.py | Python | mit | 410 |
#!/usr/bin/env python
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# ---------------------------------------------... | Azure/azure-sdk-for-python | sdk/servicebus/azure-servicebus/samples/sync_samples/schedule_topic_messages_and_cancellation.py | Python | mit | 2,305 |
import pytest
# TODO: use same globals for reverse operations such as add, remove
GRAPHS = [
({},
[],
[]),
({'nodeA': {}},
['nodeA'],
[]),
({'nodeA': {'nodeB': 'weight'},
'nodeB': {}},
['nodeA', 'nodeB'],
[('nodeA', 'nodeB')]),
({'nodeA': {'nodeB': 'weight'},
'... | palindromed/data-structures | src/test_graph.py | Python | mit | 10,017 |
# -*- coding: utf-8 -*-
{
'# selected': '# được lựa chọn',
"'Cancel' will indicate an asset log entry did not occur": "'Hủy' sẽ chỉ dẫn một lệnh nhập không thực hiện được",
"A location that specifies the geographic area for this region. This can be a location from the location hierarchy, or a 'group location', or a... | flavour/ifrc_qa | languages/vi.py | Python | mit | 374,132 |
# -*- coding: utf-8 -*-
'''
Crea un programa que analice el fichero y muestre:
- Los años y sus temperaturas (máxima, mínima y media), ordenados por año
- Los años y su tempertura media, ordenados por temperatura en orden descendente
- Crea un fichero html:
Encabezado: Temperaturas de Zaragoza
Fuente: (la url,... | txtbits/daw-python | ficheros/temperaturas.py | Python | mit | 1,471 |
'''
Scripts for automatically setting clean parameters
'''
import numpy as np
from warnings import warn
import os
from taskinit import tb
from cleanhelper import cleanhelper
def set_imagermode(vis, source):
tb.open(os.path.join(vis, 'FIELD'))
names = tb.getcol('NAME')
tb.close()
moscount = 0
... | e-koch/VLA_Lband | CASA_functions/imaging_utils.py | Python | mit | 13,393 |
"""
Tests for the Woopra template tags and filters.
"""
import pytest
from django.contrib.auth.models import AnonymousUser, User
from django.http import HttpRequest
from django.template import Context
from django.test.utils import override_settings
from utils import TagTestCase
from analytical.templatetags.woopra imp... | jcassee/django-analytical | tests/unit/test_tag_woopra.py | Python | mit | 3,458 |
from .StateBase import StateBase
from neo.Core.Fixed8 import Fixed8
from neo.Core.IO.BinaryReader import BinaryReader
from neo.IO.MemoryStream import StreamManager
from neo.Core.AssetType import AssetType
from neo.Core.UInt160 import UInt160
from neo.Core.Cryptography.Crypto import Crypto
from neo.Core.Cryptography.ECC... | hal0x2328/neo-python | neo/Core/State/AssetState.py | Python | mit | 6,477 |
# author: brian dillmann
# for rscs
from Devices.Input import Input
from Devices.Timer import Timer
from Devices.AnalogInput import AnalogInput
from Devices.Output import Output
class DeviceManager:
def __init__(self):
self.inputs = {}
self.outputs = {}
def addSimpleInput(self, name, location, invert = False):
... | dillmann/rscs | lib/DeviceManager.py | Python | mit | 1,683 |
# Ensure variable is defined
try:
x
except NameError:
x = None
# Test whether variable is defined to be None
if x is None:
some_fallback_operation()
else:
some_operation(x)
| ActiveState/code | recipes/Python/59892_Testing_if_a_variable_is_defined/recipe-59892.py | Python | mit | 190 |
# -*- coding: utf-8 -*-
dCellSize = 20
WindowWidth = 400
WindowHeight = 400
class SCell(object):
def __init__(self, xmin, xmax, ymin, ymax):
self._iTicksSpentHere = 0
self._left = xmin
self._right = xmax
self._top = ymin
self.bottom = ymax
def Update(self):
self._iTicksSpentHere... | crazyskady/ai-game-python | Chapter08/CMapper.py | Python | mit | 1,821 |
# License: MIT License https://github.com/passalis/sef/blob/master/LICENSE.txt
from __future__ import absolute_import, division, print_function, unicode_literals
import numpy as np
import sklearn
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
from sef_dr.classification import evaluate_svm
from se... | passalis/sef | examples/supervised_reduction.py | Python | mit | 2,019 |
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'db', # Or path to databas... | nvbn/deploy_trigger | deploy_trigger/settings/local_nvbn.py | Python | mit | 1,371 |
'''
Yescoin base58 encoding and decoding.
Based on https://yescointalk.org/index.php?topic=1026.0 (public domain)
'''
import hashlib
# for compatibility with following code...
class SHA256:
new = hashlib.sha256
if str != bytes:
# Python 3.x
def ord(c):
return c
def chr(n):
return byte... | thormuller/yescoin2 | contrib/testgen/base58.py | Python | mit | 2,818 |
# encoding: utf8
from __future__ import unicode_literals
from ..symbols import *
TAG_MAP = {
# Explanation of Unidic tags:
# https://www.gavo.t.u-tokyo.ac.jp/~mine/japanese/nlp+slp/UNIDIC_manual.pdf
# Universal Dependencies Mapping:
# http://universaldependencies.org/ja/overview/morphology.html
#... | raphael0202/spaCy | spacy/ja/tag_map.py | Python | mit | 4,024 |
# -*- coding: UTF-8 -*-
DOWNLOADER_VERSION = "0.0.1"
DOWNLOADER_LOG_FILE = "downloader.log"
DOWNLOADER_LOG_SIZE = 10485760
DOWNLOADER_LOG_COUNT = 10
DOWNLOADER_LOG_FORMAT = "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
DOWNLOADER_REQUIREMENTS_PATH = "requirements.txt"
| arsenypoga/ImageboardDownloader | DownloaderConstants.py | Python | mit | 278 |
class mmpmon(object):
def __init__(self):
self.name = 'mmpmon'
self.nodefields = { '_n_': 'nodeip', '_nn_': 'nodename',
'_rc_': 'status', '_t_': 'seconds', '_tu_': 'microsecs',
'_br_': 'bytes_read', '_bw_': 'bytes_written',
'_oc_': 'opens', '_cc_': 'closes', '_r... | stevec7/gpfs | gpfs/mmpmon.py | Python | mit | 1,059 |
from keras.models import model_from_json
import theano.tensor as T
from utils.readImgFile import readImg
from utils.crop import crop_detection
from utils.ReadPascalVoc2 import prepareBatch
import os
import numpy as np
def Acc(imageList,model,sample_number=5000,thresh=0.3):
correct = 0
object_num = 0
cou... | PatrickChrist/CDTM-Deep-Learning-Drones | Yolonese/utils/MeasureAccuray.py | Python | mit | 2,954 |
# -*- encoding: utf-8 -*-
from supriya.tools import osctools
from supriya.tools.requesttools.Request import Request
class GroupQueryTreeRequest(Request):
r'''A /g_queryTree request.
::
>>> from supriya.tools import requesttools
>>> request = requesttools.GroupQueryTreeRequest(
... ... | andrewyoung1991/supriya | supriya/tools/requesttools/GroupQueryTreeRequest.py | Python | mit | 1,918 |
#!/usr/bin/env python
"""
The pyligadb module is a small python wrapper for the OpenLigaDB webservice.
The pyligadb module has been released as open source under the MIT License.
Copyright (c) 2014 Patrick Dehn
Due to suds, the wrapper is very thin, but the docstrings may be helpful.
Most of the methods of pyligadb ... | pedesen/pyligadb | pyligadb.py | Python | mit | 11,013 |
from django.contrib import admin
from app.models import Home, Room, Thermostat, Door, Light, Refrigerator
"""
Administrator interface customization
This module contains customization classes to the admin interface
rendered by Django. This file is interpreted at run time to serve
the custom administrator actions that ... | brabsmit/home-control | homecontrol/app/admin.py | Python | mit | 2,233 |
"""
Annotates Old Bird call detections in the BirdVox-70k archive.
The annotations classify clips detected by the Old Bird Tseep and Thrush
detectors according to the archive's ground truth call clips.
This script must be run from the archive directory.
"""
from django.db.models import F
from django.db.utils import... | HaroldMills/Vesper | scripts/old_bird_detector_eval/annotate_old_bird_calls.py | Python | mit | 6,952 |
from django.shortcuts import render
from django.http import HttpResponseRedirect
from django.core.urlresolvers import reverse
import datetime, time, requests, re, os
import bs4
from django.contrib.admin.views.decorators import staff_member_required
from decimal import *
# Create your views here.
from .models import Ga... | inspectorbean/gasbuddy | home/views.py | Python | mit | 14,960 |
#!/usr/bin/env python3
""" 2018 AOC Day 09 """
import argparse
import typing
import unittest
class Node(object):
''' Class representing node in cyclic linked list '''
def __init__(self, prev: 'Node', next: 'Node', value: int):
''' Create a node with explicit parameters '''
self._prev = prev
... | devonhollowood/adventofcode | 2018/day09.py | Python | mit | 3,328 |
from django.conf.urls import patterns, include, url
from django.conf.urls.static import static
from django.conf import settings
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'app.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
... | sheeshmohsin/shopping_site | app/cart/urls.py | Python | mit | 546 |
from __future__ import absolute_import
from __future__ import unicode_literals
import json
from django.test import TestCase
from django.test.client import Client
from webhook.base import WebhookBase
class TestIntegration(TestCase):
def setUp(self):
"""initialize the Django test client"""
self.... | raiderrobert/django-webhook | tests/test_base.py | Python | mit | 942 |
#Mitch Zinser
#CSCI 3202 Assignment 8
#Worked with the Wikipedia Example and Brady Auen
from math import log2 #For converting numbers to log base 2
'''PIPE TO EXTERNAL FILE WITH > filename.txt'''
letters = 'abcdefghijklmnopqrstuvwxyz'
'''File to read in data from, change this name to read from other files'''
file_name ... | mitchtz/ai3202 | Assignment 8 - Hidden Markov Models/Zinser_Assignment8.py | Python | mit | 10,004 |
import os
from djangomaster.core import autodiscover
from djangomaster.sites import mastersite
def get_version():
path = os.path.dirname(os.path.abspath(__file__))
path = os.path.join(path, 'version.txt')
return open(path).read().strip()
__version__ = get_version()
def get_urls():
autodiscover()
... | django-master/django-master | djangomaster/__init__.py | Python | mit | 404 |
import urllib2
import json
import time
import threading
import Queue
from utils import make_random_id, LOGINFO, LOGDEBUG, LOGERROR
class CommBase(object):
def __init__(self):
self.agents = []
def add_agent(self, agent):
self.agents.append(agent)
class HTTPComm(CommBase):
def __init__(s... | elkingtowa/alphacoin | Bitcoin/ngcccbase-master/ngcccbase/p2ptrade/comm.py | Python | mit | 3,132 |
from kivy.core.window import Window
from kivy.uix.textinput import TextInput
__author__ = 'woolly_sammoth'
from kivy.config import Config
Config.set('graphics', 'borderless', '1')
Config.set('graphics', 'resizable', '0')
Config.set('graphics', 'fullscreen', '1')
from kivy.app import App
from kivy.uix.boxlayout impo... | inuitwallet/plunge_android | main.py | Python | mit | 10,983 |
# coding=utf-8
class _Webhooks:
def __init__(self, client=None):
self.client = client
def create_webhook(self, params=None, **options):
"""Establish a webhook
:param Object params: Parameters for the request
:param **options
- opt_fields {list[str]}: Defines fields... | Asana/python-asana | asana/resources/gen/webhooks.py | Python | mit | 7,089 |
import sqlite3
import os
def init():
"""
Creates and initializes settings database.
Doesn't do anything if the file already exists. Remove the local copy to recreate the database.
"""
if not os.path.isfile("settings.sqlite"):
app_db_connection = sqlite3.connect('settings.sqlite')
... | Pasotaku/Anime-Feud-Survey-Backend | Old Python Code/settings_db_init.py | Python | mit | 617 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | lmazuel/azure-sdk-for-python | azure-mgmt-web/azure/mgmt/web/models/reissue_certificate_order_request.py | Python | mit | 2,522 |
# Filename: filter.py
"""
LendingClub2 Filter Module
"""
# Standard libraries
import collections
from abc import abstractmethod
from abc import ABC
# lendingclub2
from lendingclub2.error import LCError
# pylint: disable=too-few-public-methods
class BorrowerTrait(ABC):
"""
Abstract base class to define bor... | ahartoto/lendingclub2 | lendingclub2/filter.py | Python | mit | 6,246 |
import _plotly_utils.basevalidators
class XValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(self, plotly_name="x", parent_name="splom.marker.colorbar", **kwargs):
super(XValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
ed... | plotly/plotly.py | packages/python/plotly/plotly/validators/splom/marker/colorbar/_x.py | Python | mit | 474 |
import re
osm = open("stops.txt", 'r', encoding="utf-8")
bugs = open("BAD-STOPS.txt", 'r', encoding="utf-8")
still = open("BUGS-NOT-IN-OSM.txt", 'w')
bugi = []
for line in bugs:
line = line.split(' ')
bugi.append(line[0])
print(len(bugi))
for line in osm:
line = line.split(',')
if line[0].isnumeric()... | javnik36/ZTMtoGTFS | bugs_checker_osm.py | Python | mit | 547 |
import tornado.web
from datetime import date
from sqlalchemy.orm.exc import NoResultFound
from pyprint.handler import BaseHandler
from pyprint.models import User, Link, Post
class SignInHandler(BaseHandler):
def get(self):
return self.background_render('login.html')
def post(self):
username ... | RicterZ/pyprint | pyprint/views/background.py | Python | mit | 3,116 |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2016 Pi-Yueh Chuang <pychuang@gwu.edu>
#
# Distributed under terms of the MIT license.
"""convert the output file in a batch"""
import os
import os.path as op
import sys
import argparse
if os.getenv("PyFR") is None:
raise Environmen... | piyueh/PyFR-Cases | utils/batch_conversion.py | Python | mit | 6,025 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from flask import render_template, request, redirect, session, flash, url_for
from functools import wraps
from user import app
import services2db
import log2db
import users
import json
import time
import sys
import asset
reload(sys)
sys.setdefaultencoding('gb18030')
# 登录验... | 51reboot/actual_09_homework | 09/tanshuai/cmdb_v6/user/views.py | Python | mit | 8,533 |
# -*- coding: utf-8 -*-
# Scrapy settings for saymedia project
#
# For simplicity, this file contains only the most important settings by
# default. All the other settings are documented here:
#
# http://doc.scrapy.org/en/latest/topics/settings.html
#
BOT_NAME = 'saymedia'
SPIDER_MODULES = ['saymedia.spiders']
N... | saymedia/SaySpider | saymedia/saymedia/settings.py | Python | mit | 1,287 |
""" Contains functions to fetch info from different simple online APIs."""
import util.web
def urbandictionary_search(search):
"""
Searches urbandictionary's API for a given search term.
:param search: The search term str to search for.
:return: defenition str or None on no match or error.
"""
... | nortxort/tinybot-rtc | apis/other.py | Python | mit | 3,454 |
def main() -> None:
N = int(input())
A = [int(x) for x in input().split()]
rev_A = A[:]
left = [-1] * N
left_cnt = [0] * N
A_left = [A[0]]
for i in range(1, N):
if rev_A[i-1] < rev_A[i]:
cnt = 0
while rev_A[i-1]
pass
elif rev_A[i-1] < rev_A... | knuu/competitive-programming | atcoder/corp/caddi2018_e.py | Python | mit | 1,094 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
from itertools import izip
from tacit import tac
ordered_list_path = 'data/ordered.list'
expected_lines = open(ordered_list_path).read().splitlines(True)
expected_lines.reverse()
expected_count = len(expected_lines)
for bsize in range(10):
count = 0
... | moskytw/tacit | tests/test_correctness.py | Python | mit | 884 |
EXPECTED = {'CAM-PDU-Descriptions': {'extensibility-implied': False,
'imports': {'ITS-Container': ['AccelerationControl',
'CauseCode',
'CenDsrcTollingZone',
... | eerimoq/asn1tools | tests/files/etsi/cam_pdu_descriptions_1_3_2.py | Python | mit | 19,027 |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import random
print random.uniform(10, 30)
| tomhaoye/LetsPython | practice/practice50.py | Python | mit | 87 |
from daisychain.steps.outputs.file import OutputFile
from daisychain.steps.input import InMemoryInput
import tempfile
import os
TEST_STRING = 'THIS OUTPUT STRING IS COMPLETELY UNIQUE AND WILL NOT EXIST EVER AGAIN'
def test_output_file():
t = tempfile.NamedTemporaryFile(dir=os.path.dirname(__file__), delete=False)... | python-daisychain/daisychain | test/test_steps__outputs_file.py | Python | mit | 964 |
from twistedbot.plugins.base import PluginChatBase
from twistedbot.behavior_tree import InventorySelectActive
class Debug(PluginChatBase):
@property
def command_verb(self):
return "debug"
@property
def help(self):
return "help for debug"
def command(self, sender, command, args):... | lukleh/TwistedBot | twistedbot/plugins/core/chat_debug.py | Python | mit | 1,061 |
# coding: utf8
{
' Assessment Series Details': ' Assessment Series Details',
'"update" is an optional expression like "field1=\'newvalue\'". You cannot update or delete the results of a JOIN': '"update" is an optional expression like "field1=\'newvalue\'". You cannot update or delete the results of a JOIN',
'# of Inter... | flavour/cedarbluff | languages/en-gb.py | Python | mit | 261,644 |
import math
import numpy
class NEB(object):
""" A Nudged Elastic Band implementation
This NEB implementation is based on http://dx.doi.org/10.1063/1.1323224
by Henkelman et al.
"""
def __init__(self, path, k):
""" Initialize the NEB with a predefined path and force
con... | cstein/neb | neb/neb.py | Python | mit | 7,489 |
from django.db import models
from django.utils import timezone
from django.contrib import admin
from packages.generic import gmodels
from packages.generic.gmodels import content_file_name,content_file_name_same
from datetime import datetime
from django.core.validators import MaxValueValidator, MinValueValidator
from dj... | sariyanidi/academics-webpage | mysite/blog/models.py | Python | mit | 7,189 |
# Creates graph of restaurant reviews for yelp or trip advisor.
# writes graph to gml file for use in gephi
#
# Rob Churchill
#
# NOTE: I learned to do this in my data science class last semester. If you are looking for plagiarism things, you will almost certainly find similar clustering code.
# I did not copy it, I l... | rchurch4/georgetown-data-science-fall-2015 | analysis/graph/graph_creation.py | Python | mit | 1,784 |
#!/usr/bin/env python
"""
@file HybridVAControl.py
@author Craig Rafter
@date 19/08/2016
class for fixed time signal control
"""
import signalControl, readJunctionData, traci
from math import atan2, degrees
import numpy as np
from collections import defaultdict
class HybridVAControl(signalControl.signalContro... | cbrafter/TRB18_GPSVA | codes/sumoAPI/HybridVAControl_PROFILED.py | Python | mit | 14,996 |
"""Module containing character feature extractors."""
import string
from unstyle.features.featregister import register_feat
@register_feat
def characterSpace(text):
"""Return the total number of characters."""
return len(text)
@register_feat
def letterSpace(text):
"""Return the total number of letters ... | pagea/unstyle | unstyle/features/characterfeatures.py | Python | mit | 526 |
from django.db import models
from django.contrib.auth.models import User
from police.models import Stationdata
class general_diary(models.Model):
ref_id = models.CharField(max_length=40,unique=True,default="00000")
firstname = models.CharField(max_length=20)
lastname = models.CharField(max_length=20)
m... | Ghost-script/Online-FIR-General-Diary-lodging-System | Web_App/Web_App/models.py | Python | mit | 2,567 |
"""
pyexcel_xls
~~~~~~~~~~~~~~~~~~~
The lower level xls/xlsm file format handler using xlrd/xlwt
:copyright: (c) 2016-2017 by Onni Software Ltd
:license: New BSD License
"""
import sys
import math
import datetime
import xlrd
from xlwt import Workbook, XFStyle
from pyexcel_io.book import BookReade... | caspartse/QQ-Groups-Spider | vendor/pyexcel_xls/xls.py | Python | mit | 8,380 |
# The MIT License (MIT)
#
# Copyright (c) 2014 Muratahan Aykol
#
# 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, m... | aykol/mean-square-displacement | xdatcar2xyz.1.04.py | Python | mit | 2,939 |
#!/usr/bin/env python
from setuptools import setup, find_packages
classifiers = [
# Get more strings from
# http://pypi.python.org/pypi?%3Aaction=list_classifiers
"License :: OSI Approved :: MIT License",
"Natural Language :: English",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programmi... | ryanvade/nanpy | setup.py | Python | mit | 1,020 |
# -*- coding: utf-8 -*-
from sitemaps import SiteMapRoot, SiteMap
from datetime import datetime
def generate_sitemap():
"""
build the sitemap
"""
sitemap = SiteMap()
sitemap.append("http://www.xxx.com", datetime.now(), "weekly", 0.9)
sitemap.append("http://www.xxx.com/a1", datetime.now(), "mo... | nooperpudd/sitemap | simples/simple.py | Python | mit | 895 |
# -*- coding: utf-8 -*-
# Resource object code
#
# Created by: The Resource Compiler for PyQt5 (Qt v5.8.0)
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore
qt_resource_data = b"\
\x00\x00\x04\x31\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\
\x00\x00\x20\x0... | kunz07/fyp2017 | GUI/lockscreen_rc.py | Python | mit | 22,062 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "sim.settings.local")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv) | CodeRaising/sim | sim/manage.py | Python | mit | 251 |
class NotSupportedDayError(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
return repr(" ".join([" Day ", value, " is not supported "]))
| rakeshsingh/trend-in | trendin/exceptions.py | Python | mit | 193 |
# vim: fdm=indent
# author: Fabio Zanini
# date: 09/08/17
# content: Sparse table of gene counts
# Modules
import numpy as np
import pandas as pd
# Classes / functions
class CountsTableSparse(pd.SparseDataFrame):
'''Sparse table of gene expression counts
- Rows are features, e.g. genes.
- Co... | iosonofabio/singlet | singlet/counts_table/counts_table_sparse.py | Python | mit | 10,070 |
#!/usr/bin/env python
# coding: utf8
"""
Dropbox Authentication for web2py
Developed by Massimo Di Pierro (2011)
Same License as Web2py License
"""
# mind here session is dropbox session, not current.session
import os
import re
import urllib
from dropbox import client, rest, session
from gluon import *
fro... | SEA000/uw-empathica | empathica/gluon/contrib/login_methods/dropbox_account.py | Python | mit | 3,886 |