code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
# Generated by Django 1.9.8 on 2016-07-26 19:49
from __future__ import unicode_literals
from decimal import Decimal
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations ... | IQSS/miniverse | dv_apps/installations/migrations/0001_initial.py | Python | mit | 1,887 |
# Copyright 2017, 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 ... | ammarkhann/FinalSeniorCode | lib/python2.7/site-packages/google/cloud/gapic/logging/v2/metrics_service_v2_client.py | Python | mit | 16,784 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.test import TestCase
from django.template import Template, Context
from django.utils import six
from powerpages.models import Page
class TemplateTagsTestCase(TestCase):
maxDiff = None
def test_page_url_alias(self):
Page.o... | Open-E-WEB/django-powerpages | powerpages/tests/test_template_tags.py | Python | mit | 2,434 |
from helpers import *
import org.bukkit.Bukkit as Bukkit
from java.util.UUID import fromString as juuid
toggle_dict = {}
permission = "utils.pmtoggle"
@hook.command("pmtoggle",
aliases = ["tm", "mt", "tmsg", "msgt", "pmt", "tpm"],
usage = "/<command> [player]",
description = ... | RedstonerServer/redstoner-utils | pmtoggle.py | Python | mit | 2,037 |
from Animations import alternation, bouncing_lazer, glimmer, glow
from bibliopixel.drivers.LPD8806 import *
from bibliopixel import led
class LEDManager():
def __init__(self):
self._driver = DriverLPD8806(
160, c_order=ChannelOrder.RGB, use_py_spi=True, dev="/dev/spidev0.0", SPISpeed=2)
... | KyleKaniecki/CarPC | LEDs/LEDManager.py | Python | mit | 1,365 |
from django.db import models
class Way(models.Model):
steps = models.IntegerField(default=0)
duration = models.IntegerField(default=0)
class DailySteps(models.Model):
day = models.CharField(max_length=8)
steps = models.IntegerField(default=0)
| Kesel/django | jsontest/models.py | Python | mit | 263 |
import entity
from symlib.bit import MAGNETIC, THERMAL
from symlib.terminal import ITERM
from symlib.limit import LSW_NO, LSW_NO_LINE_END , LSW_NO_LINE_INTERSECT
import config as cfg
class OL(entity.CodedSymbol):
min_pole = 1
max_pole = 4
def __init__(self, *args, **kwargs):
super().__init__(*arg... | kozbot/kecb | symlib/protect.py | Python | mit | 2,865 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""The setup script."""
from setuptools import setup, find_packages
with open('README.rst') as readme_file:
readme = readme_file.read()
with open('HISTORY.rst') as history_file:
history = history_file.read()
requirements = [
'Click>=6.0',
# TODO: put pa... | krishnab-datakind/mining-data-acquisition | setup.py | Python | mit | 1,667 |
## pygame - Python Game Library
## Copyright (C) 2007 Marcus von Appen
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Library General Public
## License as published by the Free Software Foundation; either
## version 2 of the License, or (at ... | dev-coop/plithos | src/plithos/numpy_surfarray.py | Python | mit | 14,740 |
# Copyright (c) 2006-2021 Andrey Golovizin
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publi... | live-clones/pybtex | tests/database_test/database_test.py | Python | mit | 5,978 |
#!/usr/bin/env python2.7
# By Dan Russell, November 2016
"""
Requires python2.7+ for the argparse module.
Arguments:
fastq # Required. The file of reads in fastq format.
genome_name # Optional. Specify the name of this genome. Default will be the input fastq file before any special characters.
... | Danos2000/phageAssembler | phageAssembler.py | Python | mit | 15,387 |
from settings.settings import Settings
from utils.file_system import FileSystem
class AppSettings(Settings):
_settings = Settings('loki.cfg')
language = Settings(_settings.language_file)
temp_folder = _settings.temp_folder
FileSystem.ensure_dir_exists(temp_folder)
log_folder = _settings.log_folde... | fpohtmeh/loki | settings/app_settings.py | Python | mit | 385 |
"""An implementation of a neural network without classes (just a module)
"""
import numpy
import scipy.optimize
import itertools
def create_training_dict(X, y):
"""Take a set of input features and their labels and package them
along with some useful quantities into a dictionary. This could
be a training,... | galtay/neural_learner | nn.py | Python | mit | 8,224 |
from . import __version__
def version(request):
data = {'amy_version': __version__}
return data
| swcarpentry/amy | amy/workshops/context_processors.py | Python | mit | 106 |
# -*- coding: utf-8 -*-
"""
Import aedat version 1 or 2.
"""
import numpy as np
def import_aedat_dataversion1or2(info):
"""
Parameters
----------
info :
"""
# The formatVersion dictates whether there are 6 or 8 bytes per event.
if info['formatVersion'] == 1:
num_bytes_per_event... | NeuromorphicProcessorProject/snn_toolbox | snntoolbox/datasets/aedat/ImportAedatDataVersion1or2.py | Python | mit | 5,296 |
# -*- coding: utf-8 -*-
"""
originally from http://www.djangosnippets.org/snippets/828/ by dnordberg
"""
import logging
import django
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
from six.moves import input
from django_extensions.management.mysql import parse_mysq... | haakenlid/django-extensions | django_extensions/management/commands/reset_db.py | Python | mit | 7,936 |
"""
Brume
"""
VERSION = "2.0.1"
| flou/brume | brume/__init__.py | Python | mit | 33 |
"""Order 31: simple read and write excel
1. Write simple table data to excel;
2. Read the simple table data from excel;
"""
from faker import Faker
import xlrd
import xlwt
class SimpleReadAndWriteExcel(object):
@staticmethod
def read_excel_data(file_name):
workbook = xlrd.open_workbook(file_name)
... | flyingSprite/spinelle | task_inventory/order_31_to_60/order_31_simple_read_and_write_excel.py | Python | mit | 1,923 |
from grappa import GrappaExperiment, MPIRunGrappaExperiment
tpch_bigdatann_debug = MPIRunGrappaExperiment({
'trial': range(1, 3 + 1),
'qn': [18,19],
'exe': lambda qn: "grappa_tpc_q{0}.exe".format(qn),
... | bmyerz/log2sqlite | projects/radish_paper/run_tpch_radish_debug.py | Python | mit | 915 |
"""
This module add the class needed for creating custom chat command
:Example:
Here's a simple ChatPlugin which will send a HelloWorld on use::
class ChatHelloWorld(ChatPlugin):
helper = "Display Hello World"
command = "hello"
def __call__(self, serv, message... | ningirsu/stepmania-server | smserver/chatplugin.py | Python | mit | 2,029 |
"""
Markdown.py
0. just print whatever is passed in to stdin
0. if filename passed in as a command line parameter,
then print file instead of stdin
1. wrap input in paragraph tags
2. convert single asterisk or underscore pairs to em tags
3. convert double asterisk or underscore pairs to strong tags
... | djpetti/csci2963-DanielPetti | code/unittest/markdown.py | Python | mit | 1,870 |
# -*- coding: utf-8 -*-
import psutil
import time
import json
def system_monitoring(Socket):
"""Pushes system monitoring data to client"""
while True:
cameraProcessingFPS = []
# for camera in HomeSurveillance.cameras:
# cameraProcessingFPS.append("{0:.2f}".format(camera.processingFP... | golden-tech-native/gd_facerecognize | facelib/monitor/osstatus.py | Python | mit | 1,005 |
"""Test suite for the pytest-doctest-custom plugin."""
import re, os, sys, platform, pytest, pytest_doctest_custom
pytest_plugins = "pytester" # Enables the testdir fixture
PYPY = platform.python_implementation() == "PyPy"
JYTHON = platform.python_implementation() == "Jython"
PY2 = sys.version_info[0] == 2
SPLIT_DOC... | danilobellini/pytest-doctest-custom | test_pytest_doctest_custom.py | Python | mit | 22,753 |
from django.db import models
from network.exceptions import MacNotFound
from network.providers import registry
class SwitchManager(models.Manager):
def flip_vlan(self, mac, vlan_number=None):
found_mac = False
enabled_switches = super(SwitchManager, self).get_queryset().filter(enabled=True)
... | BCGamer/CheckIn-Server | network/models.py | Python | mit | 4,543 |
# (c) 2017 Gregor Mitscha-Baude
import numpy as np
from nanopores.tools.polygons import Ball, Polygon, MultiPolygon, MultiPolygonPore
from nanopores.geometries.cylpore import MultiPore
from nanopores import user_params
params = user_params(
R = 100.,
R0 = 60.,
H0 = 70.,
H = 150.,
x0 = [0, 0, 46],
... | mitschabaude/nanopores | scripts/wei/test_geo.py | Python | mit | 1,625 |
import numpy as np
import argparse
from pprint import pprint
from sklearn import mixture
from sklearn import datasets
import matplotlib.pyplot as plt
from sklearn import decomposition
from LogEntry import LogEntry
from LogEntry import db
from datetime import datetime
from matplotlib.dates import DayLocator, HourLocator... | jpinsonault/android_sensor_logger | python_scripts/cluster_light.py | Python | mit | 2,894 |
# =================================================================
#
# Authors: Tom Kralidis <tomkralidis@gmail.com>
#
# Copyright (c) 2014 Tom Kralidis
#
# 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 ... | geopython/geolinks | geolinks/__init__.py | Python | mit | 3,712 |
# Sebastian Raschka, 2016
"""
source: http://adventofcode.com/2016/day/2
DESCRIPTION
--- Day 2: Bathroom Security ---
You arrive at Easter Bunny Headquarters under cover of darkness.
However, you left in such a rush that you forgot to use the bathroom!
Fancy office buildings like this one usually have keypad locks ... | rasbt/advent-of-code-2016 | python_code/aoc_02_02.py | Python | mit | 7,033 |
from webscraper import TradeList
from datacleaner import DataCleaner
from analysis import MarketValue
def main():
# Web scraper instance
listings = TradeList('Toyota', 'Yaris', 'OX12JD', '100')
# Initiate loop
price_array, attributes, url_ids, urls, category = listings.run(listings, pages=3, start_pa... | lukexyz/Market-Analysis-Project | main.py | Python | mit | 1,243 |
from setuptools import setup, find_packages
version = '0.2'
setup(name='arduino-sketch',
version=version,
description="Compile and upload Arduino sketches from command line",
long_description="""""",
# Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers
classifiers=[
"D... | ktt-ol/arduino-sketch | setup.py | Python | mit | 1,135 |
import os
from elrond.ui import SaveAs
from elrond.util import Object
class Callback(Object):
def f(self, selection):
print 'selection =', selection
chooser.exit()
callback = Callback()
chooser = SaveAs()
chooser.callback = callback.f
chooser.get_selection(path=os.environ['... | cdsi/elrond | bin/elrond-saveas.py | Python | mit | 524 |
# 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/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_03_01/operations/_action_groups_operations.py | Python | mit | 25,115 |
"""
A module for plotting experimental results
"""
__author__ = 'wittawat'
from builtins import range
import freqopttest.ex.exglobal as exglo
import freqopttest.glo as glo
import matplotlib.pyplot as plt
import autograd.numpy as np
def plot_prob_stat_above_thresh(ex, fname, h1_true, func_xvalues, xlabel,
fu... | wittawatj/interpretable-test | freqopttest/plot.py | Python | mit | 5,055 |
import pytest
import testinfra
def test_uninstall_rpm(Command):
cmd = Command('yum remove -y apache-storm')
@pytest.mark.parametrize('name', [
'apache-storm',
])
def test_packages_should_not_be_installed(Package, name):
p = Package(name)
assert p.is_installed == False
def test_opt_apache_storm_does_not_e... | codylane/storm-installer | tests/test_uninstall.py | Python | mit | 1,320 |
# region Description
"""
test_network.py: Unit tests for Raw-packet network classes
Author: Vladimir Ivanov
License: MIT
Copyright 2020, Raw-packet Project
"""
# endregion
# region Import
from sys import path
from os.path import dirname, abspath
import unittest
# endregion
# region Authorship information
__author__ =... | Vladimir-Ivanov-Git/raw-packet | raw_packet/Tests/Unit_tests/Utils/test_network.py | Python | mit | 74,709 |
# coding: utf-8
import flask
import auth
import config
import model
import util
from app import app
dropbox_config = dict(
access_token_method='POST',
access_token_url='https://api.dropbox.com/1/oauth2/token',
authorize_url='https://www.dropbox.com/1/oauth2/authorize',
base_url='https://www.dropbox... | gmist/1businka2 | main/auth/dropbox.py | Python | mit | 1,429 |
#!/usr/bin/env python
from FilteredCollection import FilteredCollection
__author__ = 'kinpa200296'
| kinpa200296/python_labs | lab2/mycollections/lab2_task10/__init__.py | Python | mit | 101 |
# -*- coding: utf-8 -*-
"""
Get Europe WeatherAlarms as offered by Meteoalarm.eu
"""
import StringIO
import re
import urllib2
import xml.dom.minidom
import datetime
import json
import argparse
import logging
import logging.handlers
import unicodedata
import contextlib
awareness_type_dict = {
'1': 'wind',
'2'... | Fiware/dataModels | specs/Weather/WeatherAlert/harvest/meteoalarm_harvest.py | Python | mit | 9,117 |
from PIL import Image
from StringIO import StringIO
from django.core.files.uploadedfile import SimpleUploadedFile
def resize_attachment(file_):
size = (960, 9999)
try:
temp = StringIO()
image = Image.open(file_)
image.thumbnail(size, Image.ANTIALIAS)
image.save(temp, 'jpeg')
... | ilvar/lotien | pages/utils.py | Python | mit | 475 |
import unittest
import sys
sys.path.append('./')
solutions = __import__('solutions.136_single_number', fromlist='*')
class Test(unittest.TestCase):
def test_singleNumber(self):
s = solutions.Solution()
nums = [1, 2, 3, 3, 2]
self.assertEqual(s.singleNumber(nums), 1)
nums = [1,... | abawchen/leetcode | tests/136.py | Python | mit | 617 |
__author__ = 'Tony Beltramelli www.tonybeltramelli.com - 19/08/2016'
| tonybeltramelli/Deep-Lyrics | modules/__init__.py | Python | mit | 69 |
from deluge.log import LOG as log
from deluge.ui.client import client
from deluge import component
from deluge.plugins.pluginbase import WebPluginBase
from common import get_resource
class WebUI(WebPluginBase):
scripts = [get_resource("sqsnotify.js")]
def enable(self):
log.debug("SQSNotify Web plugi... | AbleCoder/deluge-sqsnotify | sqsnotify/webui.py | Python | mit | 409 |
"""
Each geolocation service you might use, such as Google Maps, Bing Maps, or
Yahoo BOSS, has its own class in ``geopy.geocoders`` abstracting the service's
API. Geocoders each define at least a ``geocode`` method, for resolving a
location from a string, and may define a ``reverse`` method, which resolves a
pair of co... | XBMC-Addons/script.module.geopy | lib/geopy/geocoders/__init__.py | Python | mit | 3,357 |
"""
Deprecated: This is included only to support the use of the old v1 client
class. It will be removed once v2 is at parity with v1. Do not use this for any
new functionality.
A simple JSON REST request abstraction layer that is used by the
``dropbox.client`` and ``dropbox.session`` modules. You shouldn't need to use... | smarx/dropbox-sdk-python | dropbox/rest.py | Python | mit | 15,065 |
from flask import render_template, redirect, url_for
from . import main
@main.app_errorhandler(404)
def page_not_found(e):
return redirect(url_for('main.index'))
@main.app_errorhandler(500)
def internal_server_error(e):
return render_template('500.html'), 500
| TheNathanBlack/tell-me-to | app/main/errors.py | Python | mit | 272 |
# -*- coding: utf-8 -*-
"""
Colormaps
=========
Different colormaps.
"""
import matplotlib.pyplot as plt
from matplotlib import cm
import WrightTools as wt
from WrightTools import datasets
fig, gs = wt.artists.create_figure(width="double", cols=[1, 1, "cbar"], nrows=3)
p = datasets.wt5.v1p0p1_MoS2_TrEE_movie
data ... | wright-group/WrightTools | examples/colormaps.py | Python | mit | 1,140 |
DEBUG = False
BORDER = '#'
FILLED = '■'
EMPTY = ' '
GAP = 4 # gap between spawn zone and sides
ROWS = 25
COLUMNS = 25
FPS = 60
FRAME_LENGTH = 1 / FPS
FALL_SPEED = 30 if not DEBUG else 0 | BobWhitelock/termtris | termtris/config.py | Python | mit | 191 |
# coding: utf-8
from django.db import models
from django.utils.translation import ugettext_lazy as _
from filebrowser.fields import FileBrowseField
class Entry(models.Model):
created = models.DateTimeField(_(u'Data de Criação'), auto_now_add=True)
modified = models.DateTimeField(_(u'Data de Modificação'), au... | klebercode/modelpage | modelpage/bid/models.py | Python | mit | 1,226 |
# !/usr/bin/env python
# -*- coding: UTF-8 -*-
# Copyright (c) 2012-2015 Christian Schwarz
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitat... | T-002/pycast | pycast/common/matrix.py | Python | mit | 40,814 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import djangopress.pages.models
class Migration(migrations.Migration):
dependencies = [
('pages', '0008_auto_20150730_0004'),
]
operations = [
migrations.AddField(
model_... | codefisher/djangopress | djangopress/pages/migrations/0009_page_image.py | Python | mit | 487 |
from web import app
if __name__ == '__main__':
app.run(host='127.0.0.1', port=5320, debug=True) | xavierskip/LANinfo | runserver.py | Python | mit | 100 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Steamfront documentation build configuration file, created by
# sphinx-quickstart on Wed Jan 25 17:45:24 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
#... | 4Kaylum/Steamfront | docs/conf.py | Python | mit | 5,020 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import torch
from fairseq.data import MonolingualDataset
from fairseq.tasks.language_modeling import LanguageModelingConfig,... | pytorch/fairseq | tests/test_lm_context_window.py | Python | mit | 1,865 |
from helpers import database as db
from subapps.auth.models import login
from helpers.erorrs import BadRequest
def register(user, pas):
sql_insert_query = 'INSERT INTO users'
username = "'" + str(user) + "'"
password = "'" + str(pas) + "'"
sel_q = "SELECT id FROM users WHERE username="+username
... | rapkin/data-vis | subapps/auth/models/register.py | Python | mit | 771 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('elitedata', '0002_auto_20150617_1312'),
]
operations = [
migrations.AddField(
model_name='stationcommodity',
... | Jingyu-Yao/elitetraderoutes | elitedata/migrations/0003_stationcommodity_demand_level.py | Python | mit | 470 |
"""
Django settings for testproj project.
Generated by 'django-admin startproject' using Django 3.2.8.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.2/ref/settings/
"""
from pathli... | github/codeql | python/ql/test/library-tests/frameworks/rest_framework/testproj/settings.py | Python | mit | 3,331 |
# MIT License
#
# Copyright (c) 2017, Stefan Webb. All Rights Reserved.
#
# 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 us... | stefanwebb/tensorflow-models | tensorflow_models/evaluation/hmc_relaxed_bernoulli.py | Python | mit | 7,019 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
from twisted.internet import reactor, defer
def not_call_deferred(result):
print("not_call_deferred {}".format(result));
def getDummyData(inputData):
print('getDummyData called')
deferred = defer.Deferred()
# deferred.callback 会进一步调用deferred添加进去的cb
reac... | qrsforever/workspace | python/learn/twisted/onecallback.py | Python | mit | 1,472 |
# Copyright 2017 Merkulov Alexey
#
# The MIT License
#
# 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, mer... | steelart/ask-navalny | django-backend/askp/urls.py | Python | mit | 2,757 |
"""
Tools for generating masks.
"""
__license__ = 'MIT License <http://www.opensource.org/licenses/mit-license.php>'
__author__ = 'Lucas Theis <lucas@theis.io>'
__docformat__ = 'epytext'
__version__ = '0.1.0'
from numpy import max, iterable, squeeze, zeros, zeros_like, any
def generate_masks(input_size, output_size=... | lucastheis/cmt | code/cmt/python/tools/masks.py | Python | mit | 2,635 |
import unittest
import lob
# Setting the API key
lob.api_key = 'test_0dc8d51e0acffcb1880e0f19c79b2f5b0cc'
class BankAccountFunctions(unittest.TestCase):
def setUp(self):
lob.api_key = 'test_0dc8d51e0acffcb1880e0f19c79b2f5b0cc'
self.addr = lob.Address.list(count=1).data[0]
def test_list_bankAcc... | ami/lob-python | tests/test_bankaccount.py | Python | mit | 3,374 |
"""ShortUrlApi API implemented using Google Cloud Endpoints."""
import appengine_config
import endpoints
from endpoints import api_config
from protorpc import remote
from api import service_impl
from api.proto_api import CreateRequest
from api.proto_api import GetRequest
from api.proto_api import RegisterRequest
from... | PredictionGuru/pgurin | api/service.py | Python | mit | 2,579 |
import psycopg2
import psycopg2.extras
import twitter
import os
def insert_tweet_into_db(timestamp, text):
'DY Mon DD HH24:MI:SS +0000 YYYY'
def deconstruct_twitter_json(tweet_dict):
time_created = tweet_dict['created_at']
text = tweet_dict['text']
return (time_created, text)
def get_credentials(... | jdwinkler/trumpbot | py_twitter_testbed.py | Python | mit | 2,600 |
from django.conf import settings
from django.conf.urls import patterns, include, url
from django.conf.urls.static import static
from django.views.generic import TemplateView
from django.contrib import admin
from filebrowser.sites import site
from mysite import views
urlpatterns = patterns("",
... | zurawiki/advert-crm | mysite/urls.py | Python | mit | 1,022 |
# coding: utf-8
from StringIO import StringIO
from PIL import Image
DEFAULT_FORMAT = 'PNG'
CONTENT_TYPES = {
'PNG': 'image/png',
'JPEG': 'image/jpeg',
}
EXT_NAMES = {
'PNG': 'png',
'JPEG': 'jpg',
}
def get_content_type_from_format(format):
return CONTENT_TYPES[format]
def get_ext_from_format(... | alt-core/sheetbot | convert_image.py | Python | mit | 3,337 |
from sys import stdin, stdout
for cse, n in enumerate(stdin.read().split()):
if int(n):
stdout.write('Case {}: {}\n'.format(cse+1, int(n)//2))
| arash16/prays | UVA/vol-115/11597.py | Python | mit | 151 |
import discord
from discord.ext import commands
import urllib.request
import json
import redisInterface
class xplog():
def __init__(self, bot):
self.bot = bot
@commands.command(pass_context=True)
async def logxp(self, ctx, id, character, event, experience : int):
if "dungeon master" in [y.... | Eylesis/Botfriend | Cogs/XPlog.py | Python | mit | 4,757 |
# 2014.04.29
# S.Rodney
# HST Filter transmission curves: plotting and such
import numpy as np
from matplotlib import pylab as pl
import os
topdir = os.path.abspath( '.' )
try :
sndataroot = os.environ['SNDATA_ROOT']
os.chdir( sndataroot+'/filters/HST_CANDELS')
w435, f435 = np.loadtxt( 'ACS_WFC_F435W.da... | srodney/hstsntools | filters.py | Python | mit | 9,454 |
# -*- coding: utf-8 -*-
from django import forms
from djspace.core.models import GenericChoice
from djspace.registration.choices import GRADUATE_DEGREE
from djspace.registration.choices import UNDERGRADUATE_DEGREE
from djspace.registration.models import Faculty
from djspace.registration.models import Graduate
from djs... | carthage-college/django-djspace | djspace/registration/forms.py | Python | mit | 12,987 |
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
config = {
'description': 'My Project',
'author': 'My Name',
'url': 'URL to get it at.',
'download_url': 'Where to download it.',
'author_email': 'My email.',
'version': '0.1',
'install_requires'... | adamkal/pyconstant | setup.py | Python | mit | 428 |
from crow2.irc import main
from crow2 import hook, log
from crow2.events.handlerclass import handlerclass, instancehandler
import re
# TODO: rewrite back to using re_gen; re_gen needs work first
space = r"\ +"
prefix = """
(?P<prefix>
{servername} | {nick} (?:!{user})? (?:@{host})?
)
"""
message = r... | lahwran/crow2 | crow2/irc/protocol.py | Python | mit | 1,223 |
#http://stackoverflow.com/questions/4662759/how-to-change-folder-icons-with-python-on-windows
import os
import ctypes
from ctypes import POINTER, Structure, c_wchar, c_int, sizeof, byref
from ctypes.wintypes import BYTE, WORD, DWORD, LPWSTR, LPSTR
##import win32api
# in case it wasnt apparent, this will only work ... | NeverDecaf/Alastore | iconchange.py | Python | mit | 4,145 |
"""
Support for Speedtest.net based on speedtest-cli.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.speedtest/
"""
import logging
import re
import sys
from datetime import timedelta
from subprocess import check_output
import homeassistant.util.d... | coteyr/home-assistant | homeassistant/components/sensor/speedtest.py | Python | mit | 3,949 |
from __future__ import absolute_import
from __future__ import unicode_literals
import subprocess
import sys
from xiami_downloader._compat import request
def get_downloader(name=None):
if not name:
name = {
'win32': 'urllib2'
}.get(sys.platform, 'wget')
return {
'urllib2'... | timothyqiu/xiami-downloader | xiami_downloader/adapters.py | Python | mit | 1,238 |
__author__ = 'brad'
import pygame
from resourceman import ResourceManager
from spritesheet import Spritesheet
from gameobject import GameObject
import xml.etree.ElementTree as ET
class Map(object):
def __init__(self, filename, tile_set):
"""Takes an XML world file and a tile set and creates a map from it... | branderson/PyZelda | src/engine/map.py | Python | mit | 13,218 |
import pytest
from django.core.urlresolvers import reverse
pytestmark = pytest.mark.django_db
def test_public_urls(client):
public_urls = [
reverse("page-home"),
"/nimda/login/",
]
for url in public_urls:
response = client.get(url)
assert response.status_code == 200
| pythonindia/junction | tests/integrations/test_permissions.py | Python | mit | 316 |
"""
This is an example showing how to call the mgd2d solver.
"""
import numpy as np
import time
from mgd2d import V_cycle
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
from matplotlib import cm
#analytical solution
def Uann(x,y):
return (x**3-x)*(y**3-y)
#RHS corresponding to above
def so... | AbhilashReddyM/GeometricMultigrid | example_Vcycle.py | Python | mit | 1,821 |
# This file is NOT licensed under the GPLv3, which is the license for the rest
# of YouCompleteMe.
#
# Here's the license text for this file:
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either... | mrdunk/game_of_tides_4 | backend/.ycm_extra_conf.py | Python | mit | 5,364 |
from jobber.app import app
if __name__ == '__main__':
app.run(host='0.0.0.0', port=8000) | hackcyprus/jobber | runserver.py | Python | mit | 93 |
#!/usr/bin/env/ python
# encoding: utf-8
"""
Configuration logic.
"""
import configparser
import logging
import RedditWallpaperChooser.utils
__author__ = 'aldur'
logger = logging.getLogger(__name__)
SECTION_REDDIT = "reddit"
REDDIT_SUBREDDITS = "subreddits"
REDDIT_RESULT_LIMIT = "result_limit"
REDDIT_SORTING = "... | aldur/RedditWallpaperChooser | RedditWallpaperChooser/config.py | Python | mit | 3,161 |
#!/usr/bin/python
#Neil A. Patel
#20150112
import zipfile
file = open("channel/90052.txt", "r")
zfile = zipfile.ZipFile('channel.zip', 'r')
line = "nothing"
while "nothing" in line:
for line in file:
if "nothing" in line:
if line[-3] == " ":
nothingNum = line[-2:]
elif line[-4] == " ":
... | neil92/MiscScripts2 | PythonChallengeCom/Problem6.py | Python | mit | 631 |
from modules.chart_module import ChartModule
import tornado.web
import logging
class LineChartModule(ChartModule):
def render(self, header, color, chart_data, chart_id="linechart"):
self.chart_id = chart_id
self.chart_data = chart_data
return self.render_string('modules/linechart.html',
... | antsankov/cufcq-new | modules/linechart_module.py | Python | mit | 842 |
import scipy.sparse as sparse
import matplotlib.pyplot as plt
import scipy.io as io
from math import sqrt, atan, cos, sin, pi, atan2
import numpy as np
from nutils import *
cc = list('gbcmy')
def plot_opt_splitting2(e, w, W):
df = 0.01
w_span = np.arange(w,W+2.0*pi*df,2.0*pi*df)
J_span2 = np.em... | ManuelMBaumann/opt_tau | num_exper/plot_misc.py | Python | mit | 12,667 |
from datetime import datetime, timedelta
import os
import tempfile
import unittest
from flask import Flask
from lark.auth.models import User, Client, Grant, Token
from lark.auth.api import lark_admin_api
from lark.auth.database import db
class ModelTests(unittest.TestCase):
def setUp(self):
app = Flask(... | voidfiles/lark | lark/auth/tests/test_models.py | Python | mit | 5,731 |
import _plotly_utils.basevalidators
class FamilyValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(self, plotly_name="family", parent_name="pie.textfont", **kwargs):
super(FamilyValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | plotly/python-api | packages/python/plotly/plotly/validators/pie/textfont/_family.py | Python | mit | 593 |
import scrapy
class ResultPage(scrapy.Item):
apartments = scrapy.Field()
page = scrapy.Field()
| pawod/gis-berlin-rents | is24crawler/resultpage.py | Python | mit | 105 |
import gym
from gym.wrappers import SkipWrapper
import pickle as pick
# from gym.utils.replay_buffer import ReplayBuffer #IN CASE WE NEED IT LATER!!!
from gym.utils.json_utils import json_encode_np
from PIL import Image
import gym
import pygame
import sys
import time
import matplotlib
import matplotlib.pyplot as plt
i... | jemdwood/cs234_proj | record_mont.py | Python | mit | 11,368 |
import mock
from shpkpr.vault import resolve_secrets
@mock.patch("shpkpr.cli.options.hvac.Client")
def test_resolve_secrets(mock_vault_client_class):
mock_vault_data = {
'secret/my_project/my_path': {
'my_key': 'some_secret_info'
}
}
mock_rendered_template = {
'secrets... | shopkeep/shpkpr | tests/test_resolve_secrets.py | Python | mit | 961 |
from GraphWidget import GraphWidget
from motioncapture.app import scrapcap
from motioncapture.gui.GL.Shapes import *
import cv2
import numpy as np
class CalibrationGraphWidget(GraphWidget):
def __init__(self):
GraphWidget.__init__(self)
def timerEvent(self, event):
GraphWidget.timerEv... | g-rauhoeft/scrap-cap | motioncapture/gui/CalibrationGraphWidget.py | Python | mit | 926 |
from django.apps import AppConfig
class UsersConfig(AppConfig):
name = 'swagger_ui.users'
verbose_name = "Users"
def ready(self):
"""Override this to put in:
Users system checks
Users signal registration
"""
pass
| cuongnb14/swagger-ui | swagger_ui/users/apps.py | Python | mit | 276 |
# SPDX-License-Identifier: MIT
# Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs
# Copyright (C) 2012-2014 Bastian Kleineidam
# Copyright (C) 2015-2021 Tobias Gruetzmacher
# Copyright (C) 2019-2020 Daniel Ring
from re import compile
from ..scraper import _BasicScraper, _ParserScraper
from ..helpers impor... | webcomics/dosage | dosagelib/plugins/l.py | Python | mit | 7,222 |
# -*- coding: utf-8 -*-
import six
from calendar import timegm
from decimal import Decimal as MyDecimal, ROUND_HALF_EVEN
from email.utils import formatdate
try:
from urlparse import urlparse, urlunparse
except ImportError:
from urllib.parse import urlparse, urlunparse # python3
from flask import url_for, requ... | fernandojunior/anerp | anerp/lib/marshal/fields.py | Python | mit | 12,980 |
from . import TheInternetTestCase
from helium.api import start_chrome, S, get_driver, set_driver, write, click, \
Text, Link, kill_browser, wait_until
class ForgotPasswordTest(TheInternetTestCase):
def get_page(self):
return "http://the-internet.herokuapp.com/forgot_password"
def test_retrieve_password(self):
e... | bugfree-software/the-internet-solution-python | tests/test_forgot_password.py | Python | mit | 1,125 |
#encoding:utf-8
subreddit = 'remotejs'
t_channel = '@r_remotejs'
def send_post(submission, r2t):
return r2t.send_simple(submission)
| Fillll/reddit2telegram | reddit2telegram/channels/~inactive/r_remotejs/app.py | Python | mit | 139 |
from django import template
register = template.Library()
@register.inclusion_tag('account/tags/login_tag.html')
def login_tag():
return {"test": "test"}
| acdh-oeaw/totetiroler | account/templatetags/account_extras.py | Python | mit | 161 |
from __future__ import unicode_literals
from __future__ import absolute_import, division, print_function
"""
Base class for renderers
"""
__author__ = "Graham Klyne (GK@ACM.ORG)"
__copyright__ = "Copyright 2014, G. Klyne"
__license__ = "MIT (http://opensource.org/licenses/MIT)"
import logging
log = loggin... | gklyne/annalist | src/annalist_root/annalist/views/fields/render_base.py | Python | mit | 1,335 |
import re
import subprocess
import DefaultModule
import locale
class RpmLint(DefaultModule.DefaultModule):
"""
Uses rpmlint utility and parses its output.
"""
_errors_to_ignore = [ ]
_errors_to_ignore_scl = [ "dir-or-file-in-opt" ]
_errors_multiplyer = { "E": 75, "W": 95 }
_log_file="rpmli... | hhorak/rpmquality | rpmquality/modules/RpmLint.py | Python | mit | 2,239 |
from django.contrib.sitemaps import Sitemap
from scuole.regions.models import Region, RegionCohorts
class RegionCohortSitemap(Sitemap):
changefreq = 'yearly'
priority = 0.5
protocol = 'https'
limit = 1000
def items(self):
return Region.objects.all()
def location(self, obj):
f... | texastribune/scuole | scuole/cohorts/sitemaps_region.py | Python | mit | 438 |
#!/usr/bin/env python
# -*- coding: utf8 -*-
# *****************************************************************
# ** PTS -- Python Toolkit for working with SKIRT **
# ** © Astronomical Observatory, Ghent University **
# *****************************************************************
# ... | Stargrazer82301/CAAPR | CAAPR/CAAPR_AstroMagic/PTS/pts/evolve/__init__.py | Python | mit | 1,376 |
'''
evaluate result
'''
from keras.models import load_model
from keras.utils import np_utils
import numpy as np
import os
import sys
# add path
sys.path.append('../')
sys.path.append('../tools')
from tools import conf
from tools import load_data
from tools import prepare
# input sentence dimensions
step_length =... | danche354/Sequence-Labeling | ner/evaluate-senna-hash-pos-gazetteer-128-64-rmsprop5.py | Python | mit | 3,327 |