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 |
|---|---|---|---|---|---|
import os
from fs import enums
import unittest
class TestEnums(unittest.TestCase):
def test_enums(self):
self.assertEqual(enums.Seek.current, os.SEEK_CUR)
self.assertEqual(enums.Seek.end, os.SEEK_END)
self.assertEqual(enums.Seek.set, os.SEEK_SET)
self.assertEqual(enums.ResourceTy... | PyFilesystem/pyfilesystem2 | tests/test_enums.py | Python | mit | 335 |
from .. import Provider as LoremProvider
class Provider(LoremProvider):
"""Implement lorem provider for ``de_DE`` locale.
Word list is based on the source below, and some words have been removed
because of some duplications.
Sources:
- https://www.gut1.de/grundwortschatz/grundwortschatz-500/
... | joke2k/faker | faker/providers/lorem/de_DE/__init__.py | Python | mit | 9,092 |
from polyphony import testbench
def cube(x):
return x * x * x
def abs(x):
if x < 0 :
return -x
else:
return x
def cubic_root(x):
ans = 0
for ans in range(0, abs(x) + 1):
if cube(ans) >= abs(x):
break
print("ans is ", ans)
if cube(ans) != abs(x):
... | ryos36/polyphony-tutorial | Tutorial_1/false/cubic_root_false.py | Python | mit | 740 |
#!/usr/bin/env python3
import logging
import multiprocessing
import time
logging.basicConfig(level = logging.DEBUG, format = '%(asctime)s.%(msecs)03d [%(levelname)s] (%(process)d) %(message)s', datefmt='%Y-%m-%d %H:%M:%S')
def worker(n, a, l):
logging.debug("lock.acquire()")
l.acquire()
logging.debug(" lock ac... | dubrayn/dubrayn.github.io | examples/multiprocessing/example9.py | Python | mit | 747 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from collections import Counter
import frappe
from frappe import _
from frappe.model.document import Document
from frappe.utils import validate_email_address, strip_html, cstr, time_diff_in_seconds
from frappe.core.doct... | mhbu50/frappe | frappe/core/doctype/communication/communication.py | Python | mit | 17,315 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import division, print_function, absolute_import, unicode_literals
from .value_types import find_value_type, TypeBase
from six import string_types
import re
from qtpy.QtCore import *
from qtpy.QtGui import *
from qtpy.QtWidgets import *
from .default_value_d... | pashango2/sphinx-explorer | sphinx_explorer/property_widget/property_model.py | Python | mit | 24,672 |
class Solution:
def reorderedPowerOf2(self, N):
"""
:type N: int
:rtype: bool
"""
if N is None or N == 0:
return False
binary = []
while N > 0:
binary.append(N%2)
N = N//2
binary.sort()
binary.pop() # remov... | euccas/CodingPuzzles-Python | leet/source/pickone/recordered_power_of_2.py | Python | mit | 690 |
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render
from django.db import models
from api.interact import get_ip
from api.latest import latest
from api.account import pre_load
from api.config import config
def home(request):
if 'teamid' not in request.session:
return rende... | bobbyluig/CCTF-Platform | ctf/ctf/views.py | Python | mit | 1,888 |
#! /usr/bin/python2
# -*- coding: utf8 -*-
# utopical_brotherhood/
# __init__.py
# actors/
# Big_brother.py
# Manager.py
# Fetcher.py
# Parser.py
# Learner.py
from actors import *
__all__ = ["actors"] | MaryanMorel/utopical-brotherhood | __init__.py | Python | mit | 251 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db.models import Q
from django.http.request import QueryDict
import re
class DjangoSearchParser(object):
'''
Query string Format:
q=key1__eq__value1|key2__lt__value2|key3__co__value3&s=order&extrafield=value
Syntax:
... | enix223/djolar | djolar/parser.py | Python | mit | 10,356 |
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'project.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
r... | integree/hello-world | manage.py | Python | mit | 648 |
class MutableValue:
"""
Used to avoid warnings (and in future errors) from aiohttp when the app context is modified.
"""
__slots__ = 'value',
def __init__(self, value=None):
self.value = value
def change(self, new_value):
self.value = new_value
def __len__(self):
... | samuelcolvin/aiohttp-devtools | aiohttp_devtools/runserver/utils.py | Python | mit | 732 |
"""
You can modify and use one of the functions below to test the gateway
service with your account.
"""
import logbook
import logbook.more
from threema.gateway import (
Connection,
GatewayError,
util,
)
from threema.gateway.simple import TextMessage
def send_via_id(connection):
"""
Send a messag... | threema-ch/threema-msgapi-sdk-python | examples/simple_blocking.py | Python | mit | 1,625 |
#!/usr/bin/env python
# -*- coding: utf8 -*-
# *****************************************************************
# ** PTS -- Python Toolkit for working with SKIRT **
# ** © Astronomical Observatory, Ghent University **
# *****************************************************************
##... | Stargrazer82301/CAAPR | CAAPR/CAAPR_AstroMagic/PTS/pts/do/evolve/reference.py | Python | mit | 4,813 |
#!/usr/bin/env python
#
# Generate pnSeed[] from Pieter's DNS seeder
#
NSEEDS=600
import re
import sys
from subprocess import check_output
def main():
lines = sys.stdin.readlines()
ips = []
pattern = re.compile(r"^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3}):26198")
for line in lines:
m = patt... | BelligerentFool/MelaniaCoin | contrib/seeds/makeseeds.py | Python | mit | 709 |
from weakref import WeakValueDictionary
from rpython.annotator import model as annmodel
from rpython.rlib import jit, types
from rpython.rlib.debug import ll_assert
from rpython.rlib.objectmodel import (malloc_zero_filled, we_are_translated,
_hash_string, keepalive_until_here, specialize, enforceargs)
from rpython... | jptomo/rpython-lang-scheme | rpython/rtyper/lltypesystem/rstr.py | Python | mit | 43,498 |
from flask import Flask, request, redirect, url_for, render_template, flash, abort, Response, jsonify
from flask.ext.pymongo import PyMongo
from flask.ext.login import LoginManager, UserMixin, login_user, logout_user, login_required, current_user
from flask.ext.bcrypt import Bcrypt
from bson import ObjectId
from flask_... | rye761/fDict | fdict.py | Python | mit | 7,906 |
"""
PynamoDB Connection classes
~~~~~~~~~~~~~~~~~~~~~~~~~~~
"""
from .base import Connection
class TableConnection(object):
"""
A higher level abstraction over botocore
"""
def __init__(self, table_name, region=None, host=None):
self._hash_keyname = None
self._range_keyname = None
... | mtsgrd/PynamoDB2 | pynamodb/connection/table.py | Python | mit | 7,391 |
from django.contrib.auth import get_user_model
from django.contrib.auth.models import AnonymousUser
from django.test import TestCase
from github3.repos.repo import Repository as GithubRepository
from buildservice.models import Repository, Webhook
from buildservice.utils import views
class ViewsUtilsTestCase(TestCase... | m-vdb/github-buildservice-boilerplate | buildservice/tests/utils/test_views.py | Python | mit | 1,795 |
import _plotly_utils.basevalidators
class ShowticklabelsValidator(_plotly_utils.basevalidators.BooleanValidator):
def __init__(
self,
plotly_name="showticklabels",
parent_name="contourcarpet.colorbar",
**kwargs
):
super(ShowticklabelsValidator, self).__init__(
... | plotly/plotly.py | packages/python/plotly/plotly/validators/contourcarpet/colorbar/_showticklabels.py | Python | mit | 476 |
from mimetypes import guess_type
from django.conf import settings
from django.contrib.syndication.views import Feed
from django.core.urlresolvers import reverse
from django.shortcuts import get_object_or_404
from django.utils.text import Truncator
from django.utils.translation import ugettext as _
from storybase_asse... | denverfoundation/storybase | apps/storybase_story/feeds.py | Python | mit | 4,815 |
# -*- coding: utf-8 -*-
import sys
import os
from datetime import date
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.... | california-civic-data-coalition/django-calaccess-processed-data | docs/conf.py | Python | mit | 8,077 |
from datetime import datetime
from channels.generic.websockets import JsonWebsocketConsumer
from channels import Group, Channel
from channels.message import Message
from ..models import Room
class ChatServer(JsonWebsocketConsumer):
# Set to True if you want them, else leave out
strict_ordering = False
sl... | k-pramod/channel.js | examples/chatter/chat/consumers/base.py | Python | mit | 1,649 |
import hashlib
import json
import os
from core.helper.pdf2string import text_blob_tokenise
from flask import render_template, request, current_app, jsonify, session, redirect, url_for
from app import db
from app.models import RecommendationResult
from app.modules.main.views import requires_auth
from core.matching.key... | conferency/find-my-reviewers | app/api/results.py | Python | mit | 12,128 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
''' Lyndor runs from here - contains the main functions '''
import sys, time, os
import module.message as message
import module.save as save
import module.cookies as cookies
import module.read as read
import install
import module.move as move
import module.draw as draw
im... | ankitsejwal/Lyndor | run.py | Python | mit | 6,128 |
from django.contrib import admin
from .models import Link, LinkCategory
from dpb.admin import PageDownAdmin
class LinkAdmin(PageDownAdmin):
list_display = ('title', 'state', 'category', 'website')
list_filter = ('category',)
search_fields = ['title']
admin.site.register(Link, LinkAdmin)
admin.site.regi... | n2o/dpb | links/admin.py | Python | mit | 339 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | AutorestCI/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2017_08_01/models/application_gateway_sku.py | Python | mit | 1,526 |
# 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/compute/azure-mgmt-compute/azure/mgmt/compute/v2020_09_30/operations/_disk_encryption_sets_operations.py | Python | mit | 40,114 |
import asyncio
import datetime
import discord
from discord.ext import commands
import utils
import checks
class Moderation:
"""Moderation commands."""
def __init__(self, bot: commands.Bot):
self.bot = bot
if 'jails' not in self.bot.status:
self.bot.status['jails'] = {}
... | Drowrin/Weeabot | cogs/moderation.py | Python | mit | 5,452 |
# import the necessary packages
import numpy as np
import glob
import cv2
import os
class AgeGenderHelper:
def __init__(self, config):
# store the configuration object and build the age bins used
# for constructing class labels
self.config = config
self.ageBins = self.buildAgeBins()
def buildAgeBins(self):
... | CyberLabs-BR/face_detect | pyimagesearch/utils/agegenderhelper.py | Python | mit | 5,618 |
import heapq
with open("day-15.txt") as f:
lines = [line for line in f.read().rstrip().splitlines()]
graph = {}
for i, row in enumerate(lines):
for j, n in enumerate(row):
graph[i, j] = int(n)
DELTAS = (
(0, 1),
(1, 0),
(-1, 0),
(0, -1),
)
def find_lowest_risk(graph, start, end):
... | scorphus/sparring | advent-of-code/2021/day-15-part-1.py | Python | mit | 803 |
import _plotly_utils.basevalidators
class SelectedpointsValidator(_plotly_utils.basevalidators.AnyValidator):
def __init__(
self, plotly_name="selectedpoints", parent_name="scatterternary", **kwargs
):
super(SelectedpointsValidator, self).__init__(
plotly_name=plotly_name,
... | plotly/plotly.py | packages/python/plotly/plotly/validators/scatterternary/_selectedpoints.py | Python | mit | 435 |
from django.test import Client, TestCase
from django.core.urlresolvers import reverse
from breach.models import Target, Victim, Round, SampleSet
from breach.views import TargetView, VictimListView
import json
from binascii import hexlify
class ViewsTestCase(TestCase):
def setUp(self):
self.client = Client... | esarafianou/rupture | backend/breach/tests/test_views.py | Python | mit | 8,595 |
# 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-servicefabric/azure/servicefabric/models/fabric_error.py | Python | mit | 1,580 |
# -*- coding: utf-8 -*-
# -----------------------------
# COMMON CONFIG
# -----------------------------
# ENVIRONMENT (development, production)
ENVIRONMENT = 'development'
# DEFAULT URL
DEFAULT_URL = 'http://0.0.0.0:5000'
# LOGGER FORMATTING
LOGGER_FORMAT = '[%(levelname)s][%(filename)s:%(lineno)s] %(message)s'
... | h4wldev/Frest | app/config.py | Python | mit | 1,244 |
from game_state import BOX, COLS, ROWS, SCREEN
import levels
from random import randint
import pygame
from time import sleep
class Level(object):
def __init__(self):
self.size = 1
self.color = 255,120,0
self.x = 0
self.y = 0
self.layout = []
self.wall = []
... | BradleyMoore/Snake | game_objects.py | Python | mit | 3,550 |
# -*- coding: utf-8 -*-
"""
fudcon.ui.backend
------
fudcon ui backend application package
"""
| echevemaster/fudcon | fudcon/ui/backend/__init__.py | Python | mit | 107 |
# 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/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_machine_extensions_operations.py | Python | mit | 30,060 |
#! /usr/bin/env python
import numpy as np
import libhdp as bnp
A=np.zeros((4,4), dtype=np.uint32)
Aa=np.zeros(34)
Dir=bnp.Dir(Aa)
bnp.HDP_Dir(Dir,10.0,10.0)
| jstraub/bnp | python/testLibhdp.py | Python | mit | 163 |
import requests
from allauth.socialaccount.providers.oauth2.views import (
OAuth2Adapter,
OAuth2CallbackView,
OAuth2LoginView,
)
from .provider import FakeProvider
class FakeOAuth2Adapter(OAuth2Adapter):
provider_id = FakeProvider.id
access_token_url = 'https://localhost/o/oauth2/token'
auth... | AltSchool/django-allauth | allauth/socialaccount/providers/fake/views.py | Python | mit | 910 |
from __future__ import absolute_import
import os
from celery import Celery
from celery.schedules import crontab
from django.conf import settings
from kombu import Exchange, Queue
from datetime import timedelta
# set the default Django settings module for the 'celery' program.
os.environ.setdefault('DJANGO_SETTINGS_M... | triump0870/mysana | src/mysana/settings/celery.py | Python | mit | 1,116 |
import numpy as np
import cv2
import time
start = time.time()
end = start + 3 #show video for three seconds - I do this to make sure your stream doesn't get stuffed up by a bad exit. Remove in future.
cap = cv2.VideoCapture(0)
#while time.time() < end: #
while(True):
# Capture frame-by-frame
ret, frame = cap... | ngalin/Illumimateys | InterviewPrepScripts/videoCapture.py | Python | mit | 760 |
#!/usr/bin/env python3
import requests
from database import is_in_db
import database
__author__ = 'flshrmb'
def handle(some_story, conn):
cursor = conn.cursor()
database.insert(some_story, cursor)
cursor.close()
conn.commit()
def main():
top_list = requests.get('https://hacker-news.firebaseio.co... | nielsole/ycombinator_newsletter | code/crawl.py | Python | mit | 916 |
#!/usr/bin/env python
import optparse
from sys import *
import os,sys,re
from optparse import OptionParser
import glob
import subprocess
from os import system
import linecache
import time
#=========================
def setupParserOptions():
parser = optparse.OptionParser()
parser.set_usage("%prog -i <... | leschzinerlab/ISAC | ISAC.py | Python | mit | 8,169 |
""" Title: Ch3LpfPlotResponse - Chapter 3: Plot filter response
Author: Ricardo Alejos
Date: 2016-09-20
Description: Plots the micro-strip filter response against the specifications
Version: 1.0.0
Comments: -
"""
# Import Python's built-in modules
import csv as _csv
import logging as _... | ricardoalejos/RalejosMsrElcDsn | SmdAngPtnSnt/pkg/ExpFlows/Ch3LpfPlotSaEvoVsRes.py | Python | mit | 5,718 |
"""Trains many CNNs with 2-D and 3-D MYRORSS images.
The 2-D images contain azimuthal shear, and the 3-D images contain reflectivity.
"""
import os
import pickle
import argparse
import traceback
from multiprocessing import Pool, Manager
import numpy
from gewittergefahr.gg_utils import time_conversion
from gewittergef... | thunderhoser/GewitterGefahr | gewittergefahr/scripts/train_many_cnns_2d3d_myrorss.py | Python | mit | 14,391 |
from django.test import TestCase, Client
from django.urls import resolve
from django.core.urlresolvers import reverse
from django.utils import timezone
from findyour3d.users.models import User
class DashboardTests(TestCase):
def setUp(self):
self.starter_user = User.objects.create(username='test', is_act... | hqpr/findyour3d | findyour3d/quote/tests.py | Python | mit | 814 |
# coding: utf-8
# ## Reading and writing shapefiles
#
# Recall the [qgis lesson 1 tutorial](https://github.com/a301-teaching/a301_code/blob/master/notebooks/qgis/qgis_lesson_1.ipynb)
#
# In that lesson, you used qgis to plot volcanoe data that was stored as
# [shapefiles](https://en.wikipedia.org/wiki/Shapefile)
# ... | a301-teaching/a301_code | notebooks/python/shapefiles.py | Python | mit | 3,397 |
from django import forms
# from django.core import validators
from django.contrib.auth.models import User
from django.contrib.auth.forms import AuthenticationForm
class LoginForm(AuthenticationForm):
username = forms.CharField(
label="Username", max_length=30,
widget=forms.... | benwilburn/fitist | FITist_project/user_profiles/forms.py | Python | mit | 1,871 |
from pbxproj import PBXGenericObject
class XCConfigurationList(PBXGenericObject):
def _get_comment(self):
info = self._get_section()
return f'Build configuration list for {info[0]} "{info[1]}"'
def _get_section(self):
objects = self.get_parent()
target_id = self.get_id()
... | kronenthaler/mod-pbxproj | pbxproj/pbxsections/XCConfigurationList.py | Python | mit | 821 |
__author__ = 'Jonas Eberle <jonas.eberle@eberle-mail.de>'
from pyEOM.sources import *
class GEE(GEESource):
dataset = None
start = '1900-01-01'
end = '2100-01-01'
epsg = 'EPSG:4326'
scale = 30
def __init__(self, task):
self.task = task
if 'dataset' not in task:
rais... | jonas-eberle/pyEOM | pyEOM/datasets/Landsat.py | Python | mit | 1,358 |
# (c) Crown Owned Copyright, 2016. Dstl.
import os
from django.conf import settings
from django.contrib.auth import get_user_model
from django.core.urlresolvers import reverse
from django.http import JsonResponse
from django.utils.decorators import method_decorator
from django.views.decorators.csrf import csrf_exempt... | dstl/lighthouse | apps/api/views.py | Python | mit | 3,467 |
"""Module: base.py
Classes:
Analysis - Generic analysis root class.
Test - Generic statistical test class.
GroupTest - Perform a test on multiple vectors that are passed as a tuple of arbitrary length.
Comparison - Perform a test on two independent vectors of equal length.
NormTest - Tests for wheth... | cmmorrow/sci-analysis | sci_analysis/analysis/base.py | Python | mit | 5,281 |
"""wrapper for cmake tool"""
import subprocess
from subprocess import PIPE
import platform
from mod import log,util
from mod.tools import ninja
name = 'cmake'
platforms = ['linux', 'osx', 'win']
optional = False
not_found = 'please install cmake 2.8 or newer'
#--------------------------------------------------------... | code-disaster/fips | mod/tools/cmake.py | Python | mit | 4,302 |
import numpy as np
import matplotlib.pyplot as plt
import pdb
import traces.sources as sources
import traces.transformations as tran
import traces.surfaces as surf
#Set up incident beam trace and determine sensitivity to beam
#impact location.
#Trace nominal geometry (function of incidence angle) and
#record location... | rallured/PyXFocus | examples/arcus/uvYaw.py | Python | mit | 3,901 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import uuid
import pytest
import datetime
@pytest.fixture
def pubmed_record(conn):
record = {
'meta_id': uuid.uuid1().hex,
'... | opentrials/processors | tests/fixtures/warehouse/pubmed.py | Python | mit | 1,721 |
import unittest
from mock import patch, call
from chaser.controller import MotorController, LEFT_KEY, RIGHT_KEY, UP_KEY, DOWN_KEY, MotorInputError
class ControllerTestCase(unittest.TestCase):
@patch('chaser.controller.gpio')
def test_init(self, io):
io.OUT = True
calls = [call(4, True), call(... | mmilkin/cchaser | chaser/tests/test_controller.py | Python | mit | 4,019 |
"""empty message
Revision ID: 34223fdff008
Revises: b4bcea5528b6
Create Date: 2017-08-22 10:19:27.959749
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '34223fdff008'
down_revision = 'b4bcea5528b6'
branch_labels = None
depends_on = None
def upgrade():
# ... | CapitalD/taplist | migrations/versions/34223fdff008_.py | Python | mit | 807 |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
from monty.json import MSONable
from pymatgen.core import PeriodicSite
from pymatgen.analysis.defects.corrections import FreysoldtCorrection, \
BandFillingCorrection, BandEdgeShiftingCorrection
from pymatg... | montoyjh/pymatgen | pymatgen/analysis/defects/defect_compatibility.py | Python | mit | 25,384 |
"""
An estimator for modelling data from a mixture of Gaussians,
using an objective function based on minimum message length.
"""
__all__ = [
"GaussianMixture",
"kullback_leibler_for_multivariate_normals",
"responsibility_matrix",
"split_component", "merge_component", "delete_component",
]
import ... | andycasey/snob | snob/nips_search.py | Python | mit | 67,954 |
#!/usr/bin/python3
"""
Copyright (c) 2014 Guillaume Havard - BVS
"""
import tkinter as tk
from application import *
root = tk.Tk()
app = Application(master=root)
app.mainloop()
| guillaume-havard/com_elements_gui | src/interface.py | Python | mit | 182 |
"""
Driver classes for Juniper devices.
- JunOS - driver for Juniper JunOS operating system
"""
import logging
from nocexec.drivers.base import NOCExecDriver
from nocexec.exception import NOCExecError, NetConfClientError, \
NetConfClientExecuteCmdError
LOG = logging.getLogger('nocexec.drivers.juniper')
__all_... | velp/nocexec | nocexec/drivers/juniper.py | Python | mit | 5,883 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
# The original author of this program, Danmaku2ASS, is StarBrilliant.
# This file is released under General Public License version 3.
# You should have received a copy of General Public License text alongside with
# this program. If not, you can obtain it at http://gnu.or... | power12317/Biligrab | danmaku2ass2.py | Python | mit | 38,418 |
import requests
import time
import json
# ------------ Do data need to roll
def roll_data_if_needed(secondsAllowed):
# calculate last time
last_roll_time = get_status()
now = int(time.time())
time_since_roll = now - last_roll_time
# do I need to roll?
if time_since_roll > secondsAllowed:
... | mrnohr/pi-temperature-firebase | firebase_log_roll.py | Python | mit | 1,702 |
import os
from celery.schedules import crontab
import djcelery
__copyright__ = "Copyright 2011 Red Robot Studios Ltd."
__license__ = "GPL v3.0 http://www.gnu.org/licenses/gpl.html"
djcelery.setup_loader()
DEBUG = False
TEMPLATE_DEBUG = DEBUG
ADMINS = (
('Panic Stations', 'panic@redrobotstudios.com'),
)
MAN... | andrewgleave/OpenElm | web/openelm/settings.py | Python | mit | 6,211 |
#!venv/bin/python
from flask import Flask, render_template, request, Response
import os
import time
import subprocess
app = Flask(__name__, template_folder='.', static_folder='.')
@app.route('/')
def root():
time_in_secs = os.path.getmtime('pyth.py')
time_in_python = time.gmtime(time_in_secs)
formatted_t... | gcq/pyth | server.py | Python | mit | 2,516 |
#-*- coding: utf-8 -*-
import numpy as np
from sklearn.cluster import AgglomerativeClustering as sk_AgglomerativeClustering
from sklearn.externals.joblib import Memory
from .clustering import Clustering
class AgglomerativeClustering(Clustering):
"""docstring for AgglomerativeClustering."""
def __init__(self, d... | netoaraujjo/hal | clustering/agglomerative_clustering.py | Python | mit | 1,946 |
"""
WSGI config for familityTree 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... | yuyan7/FamilyTree | familityTree/familityTree/wsgi.py | Python | mit | 402 |
from pysv import ast_utils
from pysv import ssa_converter
from pysv import utils
from pysv import loops
from pysv import interm
from pysv.smt2 import ProgramSmt2
def get_code_in_smt2(code, code_pre, code_post, program_vars, env, holes_decls = None):
"""Converts source codes of specification elements into program ... | iwob/pysv | pysv/smt_common.py | Python | mit | 3,263 |
import unittest
import sys
sys.path.append(".")
from mnl_elo_bot import elo_bot # noqa
class IntegrationTest(unittest.TestCase):
# Just see if it initializes and runs...
def test_process(self):
teams = elo_bot.main(False, None, '')
for team in teams.values():
self.assertIsNotNon... | kevswanberg/mnl_elo_bot | tests/test_elo_bot.py | Python | mit | 519 |
"""Compare gas/elec demand on Local Authority Districts with modelled demand
"""
import os
import operator
import logging
import copy
import numpy as np
import matplotlib.pyplot as plt
from scipy import stats
from energy_demand.basic import lookup_tables
from energy_demand import enduse_func
from energy_demand.profile... | nismod/energy_demand | energy_demand/validation/lad_validation.py | Python | mit | 33,133 |
import notorm
import momoko
from tornado import gen
import psycopg2.extras
class AsyncRecord(notorm.record):
@gen.coroutine
def update(self, **args):
for k,v in args.items():
setattr(self, k, v)
cursor = yield notorm.db.execute(
self.update_... | subssn21/notorm | notorm/momoko.py | Python | mit | 919 |
from django.utils import timezone
from django.conf import settings
from django.test import TestCase
from django.core.files import File
from django.contrib.auth.models import User, AnonymousUser
from rest_framework.test import APITestCase
from rest_framework import status
import os
import shutil
import subprocess
imp... | gustavomazevedo/tbackup-server | server/tests.py | Python | mit | 8,897 |
from loaderio.resources.client import Client
class Servers(Client):
"""
"""
def __init__(self, api_key):
Client.__init__(self, api_key)
pass
def list(self):
return self.request('GET', 'servers') | kenyaapps/loaderio | loaderio/resources/servers.py | Python | mit | 207 |
import os
from blessings import Terminal
class Cursor(object):
"""Common methods for cursor manipulation
:type term: NoneType|blessings.Terminal
:param term: Terminal instance; if not given, will be created by the class
"""
def __init__(self, term=None):
self.term = Terminal() if term ... | hfaran/progressive | progressive/cursor.py | Python | mit | 1,718 |
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
from django.contrib.auth.models import User
class UserAdmin(BaseUserAdmin):
list_display = ('username', 'email',
'first_name', 'last_name',
'is_staff', 'is_active',
)
admin.site.unregi... | art-solopov/mdwiki | common/admin.py | Python | mit | 369 |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import os
import unittest
sys.path.insert(0, os.path.abspath('..'))
import dxpad._contest as _contest
class SignalMonitor:
signal_received = False
signal_value = None
def __init__(self, signal):
signal.connect(self.signal_receiver)
... | ftl/dxpad | tests/test_contest.py | Python | mit | 3,821 |
import smbl
| karel-brinda/smbl | smbl/utils/clean.py | Python | mit | 12 |
# Create your views here.
from django import forms
from django.template import RequestContext
from django.http import HttpResponse, HttpResponseRedirect
from django.template.loader import get_template
from django.core.paginator import Paginator
from django.core.urlresolvers import reverse
import datetime
from... | HarrisonHDU/myerp | apps/depot/views.py | Python | mit | 4,631 |
#Section 1: Terminology
# 1) What is a recursive function?
#A recursive function is a defined function that calls itself and only is completed when the requirements of the base case is met. Usually a parameter is used
#
#
# 2) What happens if there is no base case defined in a recursive function?
#The recursive functi... | jaejun1679-cmis/jaejun1679-cmis-cs2 | cs2quiz3.py | Python | cc0-1.0 | 1,995 |
from tests.unit.dataactcore.factories.staging import DetachedAwardFinancialAssistanceFactory
from tests.unit.dataactvalidator.utils import number_of_errors, query_columns
_FILE = 'fabs45_detached_award_financial_assistance'
def test_column_headers(database):
expected_subset = {'row_number', 'indirect_federal_sha... | fedspendingtransparency/data-act-broker-backend | tests/unit/dataactvalidator/test_fabs45_detached_award_financial_assistance.py | Python | cc0-1.0 | 3,014 |
import numpy as np
from armor import pattern
dbz = pattern.DBZ
a=pattern.a
a.invar = a.invariantMoments()
results = []
for i in range(200, 500, 100):
for j in range(0, 60, 10):
print '\n................\n', i+j
b = dbz('20120612.0%d'% (i+j))
b.load()
b.invar = b.invariantMoments()
... | yaukwankiu/armor | geometry/momentsTest.py | Python | cc0-1.0 | 1,881 |
"""
Output a normalized vegetative index
"""
import gdal, gdalnumeric, ogr
import Image, ImageDraw
def imageToArray(i):
"""
Converts a Python Imaging Library
array to a gdalnumeric image.
"""
a=gdalnumeric.numpy.fromstring(i.tostring(),'b')
a.shape=i.im.size[1], i.im.size[0]
return a
... | nchaparr/Geospatial-Analysis-with-Python | 1138_08_01-ndvi.py | Python | cc0-1.0 | 3,886 |
from click.testing import CliRunner
from contextlib import contextmanager
from metapkg import main as metapkg_main
from unittest import TestCase, main
import os
import metapkg as mp
class TestBuilds(TestCase):
def setUp(self):
self.maxDiff = None
def assertValidPKGBUILD(self, directory):
meta... | Undeterminant/archlinux-metapkg | run_tests.py | Python | cc0-1.0 | 5,479 |
#!/usr/bin/python
import imaplib
import sys
import random
import os
import threading
import time
import types
import subprocess
SERVER = "localhost"
USER = ["ftfstest1", "ftfstest2", "ftfstest3", "ftfstest4", "ftfstest5", "ftfstest6", "ftfstest7", "ftfstest8", "ftfstest9", "ftfstest10", "ftfstest11", "ftfstest12", "ft... | oscarlab/betrfs | benchmarks/aging/mailserver/mailserver-aging.py | Python | gpl-2.0 | 2,672 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 4 2013
@author: talifero
Module for imeges template convertation.
Tamplates:
HD 1920x1080
720p 1280x720
PAL 720x380
300 300x120
"""
import os, locale
from PIL import Image
import pyexiv2
locale.setlocale(lo... | Talifero/Main | sortfiles.py | Python | gpl-2.0 | 6,925 |
# encoding: utf-8
# module PyKDE4.kdeui
# from /usr/lib/python2.7/dist-packages/PyKDE4/kdeui.so
# by generator 1.135
# no doc
# imports
import PyKDE4.kdecore as __PyKDE4_kdecore
import PyQt4.QtCore as __PyQt4_QtCore
import PyQt4.QtGui as __PyQt4_QtGui
import PyQt4.QtSvg as __PyQt4_QtSvg
from KComboBox import KComboB... | ProfessorX/Config | .PyCharm30/system/python_stubs/-1247972723/PyKDE4/kdeui/KTimeComboBox.py | Python | gpl-2.0 | 3,363 |
__author__ = 'ryan'
WTF_CSRF_ENABLED = True
SECRET_KEY='WmSH67P70mM89PuTMawZE06PWvWH0034'
| schulmanworks/pySiteUtils | config.py | Python | gpl-2.0 | 90 |
'''
Created on 24/05/2009
@author: akathorn
'''
import os
os.environ['SDL_VIDEO_CENTERED'] = '1'
import pygame
from pygame.locals import *
pygame.init()
from fonts import *
from scene import *
from basicScenes import *
import time
import data
class SceneManager(object):
def __init__(self, screen_size=(800,60... | akathorn/pyrus | sceneManager/sceneManager.py | Python | gpl-2.0 | 4,331 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2016-2018 University of Oslo, Norway
#
# This file is part of Cerebrum.
#
# Cerebrum 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 Software Foundation; either version 2... | unioslo/cerebrum | Cerebrum/rest/api/__init__.py | Python | gpl-2.0 | 2,970 |
class MyStuff(object):
def __init__(self):
self.tangerine = "And now a thousand years between"
def apple(self):
print "I am classy apples!"
| mrniranjan/python-scripts | reboot/practice6.py | Python | gpl-2.0 | 149 |
"""
Module that handles the loading of parsers
written by Glenn De Backer < glenn at simplicity dot be>
License: GPLv2
"""
import glob
import os
class LoaderParsers(object):
""" Parsers loader class """
def __init__(self):
""" Default constructor """
self.available_parsers = {}
... | simplicitylab/doc2source | modules/loader_parsers.py | Python | gpl-2.0 | 2,064 |
from feat.common.serialization import base
from feat.common import defer
from feat.database import client, document, common as dcommon, emu, migration
from feat.test import common
class Inside(document.VersionedFormatable):
type_name = 'dummy'
version = 2
document.field("field", None)
document.field... | f3at/feat | src/feat/test/test_database_client.py | Python | gpl-2.0 | 2,476 |
import fnmatch
import os
import json
import argparse
import re
parser = argparse.ArgumentParser()
parser.add_argument("template_data")
args = parser.parse_args()
template_data = json.loads(args.template_data)
folder = template_data['app_name']
template_data = json.loads(args.template_data)
for (dirpath, dirnames, ... | MattyO/start-cms | reverse.py | Python | gpl-2.0 | 1,062 |
from setuptools import setup, find_packages
setup(
name = 'rtsh.srv',
version = '0.1',
description = 'Python Server for the Real Time Strategy Shell Game',
author = 'wtjerry, mogria',
author_email = 'wtjerry123@gmail.com, m0gr14@gmail.com',
keywords = 'real-time strategy game server',
url =... | mogria/rtsh | srv/setup.py | Python | gpl-2.0 | 512 |
#!/usr/bin/env python
import sys
import re
import subprocess
import cmd
error_regexps = [
"error:",
"warning:",
]
print_error_format = "{id}) {summary}"
class Error():
def __init__(self,
id,
error_type,
match_position):
self.id = id
self... | mfergie/errorless | errorless.py | Python | gpl-2.0 | 3,992 |
from django.contrib.auth import authenticate,login
from django.contrib import messages
from django.http import HttpResponse, HttpResponseForbidden, HttpResponseRedirect
from django.core.urlresolvers import reverse
from django.shortcuts import render_to_response
from django.template import RequestContext
def user_logi... | paleocore/paleocore | login/views.py | Python | gpl-2.0 | 1,470 |
from __future__ import unicode_literals
from django.db import transaction
from django.db import models
from django.contrib.auth.models import User
# Create your models here.
class UserProfile(models.Model):
user = models.OneToOneField(User, unique=True, verbose_name=('user'))
phone = models.CharField(max_leng... | passren/Roxd | member/models.py | Python | gpl-2.0 | 727 |
'''
Created on Sep 2, 2013
@author: u5682
'''
from sqlalchemy import *
import base
from base import Base
from sqlalchemy.orm import relationship, backref
import Bessel
class PilotResource(Base):
'''
classdocs
'''
__tablename__ = 'pilotResources'
id = Column(Integer, primary_key=True)
workerNode = Column(Strin... | supermanue/montera | PilotResource.py | Python | gpl-2.0 | 1,450 |
# This script gives an example of how to scrape a webpage
import requests
from BeautifulSoup import BeautifulSoup
url = "http://chicagofoodtruckfinder.com/weekly-schedule"
truck_data_list = []
soup = BeautifulSoup(requests.post(url).text)
table = soup.find("table").findAll("tr")
days = [d.text for d in table[0].find... | lbybee/Python-for-Econ | Chap_4/scraper_example.py | Python | gpl-2.0 | 1,393 |