code stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 226 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k |
|---|---|---|---|---|---|
"""
Post processing (subset of columns) to calculate intermediate sum edit counts
and other variables. Date sorted.
Usage:
calculate_intermediate_sums (-h|--help)
calculate_intermediate_sums <input> <output>
[--debug]
[--verbose]
Options:
-h... | hall1467/wikidata_usage_tracking | python_analysis_scripts/longitudinal_misalignment/calculate_intermediate_sums.py | Python | mit | 2,652 |
from collections import defaultdict
from django import template
from django.utils.safestring import mark_safe
from censusreporter.apps.census.utils import parse_table_id, generic_table_description, table_link
register = template.Library()
@register.filter
def format_subtables_for_results(table_ids):
parts = [... | censusreporter/censusreporter | censusreporter/apps/census/templatetags/results.py | Python | mit | 1,848 |
# -*- coding: utf8 -*-
import os
import os.path
import flask
import flask_assets
import flask_sqlalchemy
from .cross_domain_app import CrossDomainApp
from zeeguu.util.configuration import load_configuration_or_abort
import sys
if sys.version_info[0] < 3:
raise "Must be using Python 3"
# *** Starting the App *** ... | MrAlexDeluxe/Zeeguu-Web | zeeguu_web/app.py | Python | mit | 1,825 |
import re
import os
import struct
import sys
import numbers
from collections import namedtuple, defaultdict
def int_or_float(s):
# return number, trying to maintain int format
if s.isdigit():
return int(s, 10)
else:
return float(s)
DBCSignal = namedtuple(
"DBCSignal", ["name", "start_bit", "size", "i... | vntarasov/openpilot | opendbc/can/dbc.py | Python | mit | 8,588 |
"""Provides helper classes for testing option handling in pip
"""
import os
from pip._internal.cli import cmdoptions
from pip._internal.cli.base_command import Command
from pip._internal.commands import commands_dict
class FakeCommand(Command):
name = 'fake'
summary = name
def main(self, args):
... | techtonik/pip | tests/lib/options_helpers.py | Python | mit | 792 |
# -*- coding: utf-8 -*-
# 3章 ニューラルネットワーク
import numpy as np
class NeuralTrain:
def step_function(self, x):
return np.array(x > 0, dtype=np.int)
def sigmoid_function(self, x):
return 1 / (1 + np.exp(-x))
def relu_function(self, x):
return np.maximum(0, x) | Arahabica/NNTrain | train/neural/NeuralTrain.py | Python | mit | 318 |
from __future__ import unicode_literals
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class TanitJobsCategory(models.Model):
name = models.CharField(max_length=255, unique=True)
def __str__(self):
return "%s" % self.name
cla... | firasbenmakhlouf/JobLookup | metadata/models.py | Python | mit | 467 |
# -*- coding: utf-8 -*-
""" OneLogin_Saml2_Utils class
Copyright (c) 2014, OneLogin, Inc.
All rights reserved.
Auxiliary class of OneLogin's Python Toolkit.
"""
import base64
from datetime import datetime
import calendar
from hashlib import sha1, sha256, sha384, sha512
from isodate import parse_duration as duratio... | jkgneu12/python3-saml | src/onelogin/saml2/utils.py | Python | mit | 32,408 |
#!/usr/bin/env python
#
# Protein Engineering Analysis Tool DataBase (PEATDB)
# Copyright (C) 2010 Damien Farrell & Jens Erik Nielsen
#
# 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 Software Foundation, either ver... | dmnfarrell/peat | PEATDB/Ekin/Ekin_map.py | Python | mit | 23,383 |
from temp_tools import TestClient
from test_template import ApiTestTemplate
class TokensTest(ApiTestTemplate):
def setUp(self):
super(TokensTest, self).setUp()
TestClient.execute("""TRUNCATE auth_token""")
self.test_token_data = {'description': 'Test token 1',
... | InfraBox/infrabox | infrabox/test/api/tokens_test.py | Python | mit | 2,458 |
import six
#==============================================================================
# https://docs.python.org/2/library/csv.html
#==============================================================================
if six.PY2:
import csv
import codecs
import cStringIO
class UTF8Recoder:
"""... | memee/py-tons | pytons/files.py | Python | mit | 2,232 |
from app import db
class Alternative(db.Model):
id = db.Column(db.Integer, primary_key=True)
experiment = db.Column(db.String(500), unique=True)
copy = db.Column(db.String(2500))
def __init__(self, id, experiment, copy):
self.id = id
self.experiment = experiment
self.copy = co... | kwikiel/bounce | models.py | Python | mit | 427 |
from rest_framework import serializers
from .models import User, Activity, Period
class UserSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = User
fields = ('url', 'username', 'email')
extra_kwargs = {
'url': {'view_name': 'timeperiod:user-detail'},
... | maurob/timeperiod | serializers.py | Python | mit | 1,063 |
#
# Metrix++, Copyright 2009-2013, Metrix++ Project
# Link: http://metrixplusplus.sourceforge.net
#
# This file is a part of Metrix++ Tool.
#
# Metrix++ is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the ... | vijaysm/mmodel-software-analysis | contrib/metrixplusplus-1.3.168/metrix++.py | Python | mit | 860 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
from frappe.utils.minify import JavascriptMinify
"""
Build the `public` folders and setup languages
"""
import os, frappe, json, shutil, re
# from cssmin import cssmin
app_pat... | rohitwaghchaure/frappe | frappe/build.py | Python | mit | 5,802 |
import hashlib
import os
import tempfile
import zipfile
from bs4 import BeautifulSoup
from django.test import Client
from django.test import TestCase
from mock import patch
from ..models import LocalFile
from ..utils.paths import get_content_storage_file_path
from kolibri.core.auth.test.helpers import provision_devic... | mrpau/kolibri | kolibri/core/content/test/test_zipcontent.py | Python | mit | 12,256 |
from django.http import HttpResponse
from django.shortcuts import render
from survey.models import Choice
from survey.forms import ChoiceForm
import csv
import random
# Create your views here.
def index(request):
examples = ['controlling Exposure', 'changing Temperature', 'modifying Highlights', 'changing Shadows... | thegouger/django-quicksurvey | surveyapp/survey/views.py | Python | mit | 1,774 |
"""
Run on cluster
"""
import argparse
import os
import itertools
import networkx as nx
import pandas as pd
from . import compare_cases
def generate_run(graph, iterations, epsilon_control, epsilon_damage,
out_dir, nodes=None, mem=6000, runtime=120, activate=''):
"""
Generate bash scripts ... | sjpfenninger/sandpile | sandpile/cluster.py | Python | mit | 4,792 |
#!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
# This file is only used if you use `make publish` or
# explicitly specify it as your config file.
import os
import sys
sys.path.append(os.curdir)
from pelicanconf import *
SITEURL = 'http://mpdev.mattew.se'
RELATIVE_URLS = False... | mattew/mattew.github.io-src | publishconf.py | Python | mit | 531 |
'''
Created on Feb 20, 2013
@author: Maribel Acosta
@author: Fabian Floeck
'''
from wmf import dump
from difflib import Differ
from time import time
from structures.Revision import Revision
from structures.Paragraph import Paragraph
from structures.Sentence import Sentence
from structures.Word import Word
from str... | wikiwho/whovis | WikiwhoRelationships.py | Python | mit | 45,341 |
"""
The MIT License (MIT)
Copyright (c) <2015> <sarangis>
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,... | ssarangi/spiderjit | src/optimizer/inst_combining.py | Python | mit | 1,791 |
import unittest
import os
from unittest.mock import patch
import migration
from configuration import Builder
import configuration
from tests import testhelper
class MigrationTestCase(unittest.TestCase):
def setUp(self):
self.rootfolder = os.path.dirname(os.path.realpath(__file__))
@patch('migration.... | akchinSTC/rtc2git | tests/test_migration.py | Python | mit | 1,445 |
from flask import Blueprint
error = Blueprint('error', __name__, )
from . import view
| XiMuYouZi/PythonDemo | Web/zhihu/error/__init__.py | Python | mit | 88 |
# 1. del: funkcije
#gender: female = 2, male = 0
def calculate_score_for_gender(gender):
if gender == "male":
return 0
else: return 2
#age: 0-100 if age < 10 --> 0, 11 < age < 20 --> 5, 21 < age < 35 --> 2, 36 < age < 50 --> 4, 50+ --> 1
def calculate_score_for_age(age):
if (age > 11 and age <= 20) or (age >... | CodeCatz/litterbox | ajda/complicajda.py | Python | mit | 5,477 |
"""Angles and anomalies.
"""
from astropy import units as u
from poliastro.core.angles import (
D_to_M as D_to_M_fast,
D_to_nu as D_to_nu_fast,
E_to_M as E_to_M_fast,
E_to_nu as E_to_nu_fast,
F_to_M as F_to_M_fast,
F_to_nu as F_to_nu_fast,
M_to_D as M_to_D_fast,
M_to_E as M_to_E_fast,
... | poliastro/poliastro | src/poliastro/twobody/angles.py | Python | mit | 6,419 |
import sys
sys.path.append("/mnt/moehlc/home/idaf_library")
#import mahotas
import vigra
import libidaf.idafIO as io
import numpy as np
from scipy import ndimage
from scipy.stats import nanmean
#import matplotlib.pyplot as plt
import time
import pickle
import os
import multiprocessing as mp
def gaussWeight(dat,sigma,... | cmohl2013/140327 | parallel_nanmeanGaussWeightedFilterOptimizedSize20.py | Python | mit | 3,450 |
#!/usr/bin/env python
import sys
import os
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "api.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| desec-io/desec-stack | api/manage.py | Python | mit | 248 |
import numpy as np
import scipy.io as sio
import matplotlib.pyplot as plt
from matplotlib import path
from quadr import quadr
from LapSLPmatrix import LapSLPmatrix
def test_SLPn():
# test data dir
import os
dir_path = os.path.dirname(os.path.realpath(__file__)) + "/TestData/"
circle = sio.loadmat(di... | bobbielf2/ners590_final_project | python_code/test_SLPn.py | Python | mit | 2,019 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from ..client import MODE_CHOICES
from ..client.tasks import ReadChannelValues, WriteChannelValue
from ..client.worker import Worker
from ..utils.command import BaseCommand
from ..values.channel import Channel
from ..values.signals import ValueChangeEvent
from optparse impo... | gaftech/fmanalyser | fmanalyser/commands/fmlogger.py | Python | mit | 4,946 |
from unittest import TestCase
from plivo import plivoxml
from tests import PlivoXmlTestCase
class RecordElementTest(TestCase, PlivoXmlTestCase):
def test_set_methods(self):
expected_response = '<Response><Record action="https://foo.example.com" callbackMethod="GET" ' \
'callbac... | plivo/plivo-python | tests/xml/test_recordElement.py | Python | mit | 1,989 |
#!/usr/local/munkireport/munkireport-python2
# encoding: utf-8
from . import display
from . import prefs
from . import constants
from . import FoundationPlist
from munkilib.purl import Purl
from munkilib.phpserialize import *
import subprocess
import pwd
import sys
import hashlib
import platform
from urllib import ur... | munkireport/munkireport-php | public/assets/client_installer/payload/usr/local/munkireport/munkilib/reportcommon.py | Python | mit | 17,507 |
#!/usr/bin/python
from pcitweak.bitstring import BitString
for n in range(0x10):
b = BitString(uint=n, length=4)
print " % 3d 0x%02x %s" % (n, n, b.bin)
| luken/pcitweak | examples/printbin.py | Python | mit | 166 |
import luhn
def test_checksum_len1():
assert luhn.checksum('7') == 7
def test_checksum_len2():
assert luhn.checksum('13') == 5
def test_checksum_len3():
assert luhn.checksum('383') == 3
def test_checksum_len4():
assert luhn.checksum('2827') == 3
def test_checksum_len13():
assert luhn.checksum('... | mmcloughlin/luhn | test.py | Python | mit | 693 |
import unittest2
from zounds.util import simple_in_memory_settings
from .preprocess import MeanStdNormalization, PreprocessingPipeline
import featureflow as ff
import numpy as np
class MeanStdTests(unittest2.TestCase):
def _forward_backward(self, shape):
@simple_in_memory_settings
class Model(ff.B... | JohnVinyard/zounds | zounds/learn/test_meanstd.py | Python | mit | 1,301 |
"""
Django settings for expense_tracker project.
Generated by 'django-admin startproject' using Django 1.10.2.
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/
"""
i... | yusuf-musleh/Expense-Tracker | expense_tracker/expense_tracker/settings.py | Python | mit | 3,157 |
def create_pos_n_neg():
for file_type in ['neg']:
for img in os.listdir(file_type):
if file_type == 'pos':
line = file_type+'/'+img+' 1 0 0 50 50\n'
with open('info.dat','a') as f:
f.write(line)
elif file_type == 'neg':
... | Tianyi94/EC601Project_Somatic-Parkour-Game-based-on-OpenCV | Old Code/ControlPart/Create_pos&neg.py | Python | mit | 444 |
import socket
import nlp
class NLPServer(object):
def __init__(self, ip, port):
self.sock = socket.socket()
self.sock.bind((ip, port))
self.processor = nlp.NLPProcessor()
print "Established Server"
def listen(self):
import thread
self.sock.listen(5)
print "Started listening at port."
while True:
... | jeffw16/elephant | nlp/nlpserver.py | Python | mit | 849 |
#!/usr/bin/python
# -- Content-Encoding: UTF-8 --
"""
Tests the pooled server
:license: Apache License 2.0
"""
# JSON-RPC library
from jsonrpclib import ServerProxy
from jsonrpclib.SimpleJSONRPCServer import PooledJSONRPCServer
from jsonrpclib.threadpool import ThreadPool
# Standard library
import random
import thre... | CloudI/CloudI | src/service_api/python/jsonrpclib/tests/test_server.py | Python | mit | 1,597 |
import re, random, string
from Service import Service
class StringHelper(Service):
articles = ["a", "an", "the", "of", "is"]
def randomLetterString(self, numCharacters = 8):
return "".join(random.choice(string.ascii_letters) for i in range(numCharacters))
def tagsToTuple(self, tags):
return tuple(self.titleCa... | adampresley/trackathon | model/StringHelper.py | Python | mit | 668 |
import unittest
from katas.kyu_6.help_the_bookseller import stock_list
class StockListTestCase(unittest.TestCase):
def setUp(self):
self.a = ['ABAR 200', 'CDXE 500', 'BKWR 250', 'BTSQ 890', 'DRTY 600']
self.b = ['A', 'B']
def test_equals(self):
self.assertEqual(stock_list(self.a, sel... | the-zebulan/CodeWars | tests/kyu_6_tests/test_help_the_bookseller.py | Python | mit | 518 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2019 Radim Rehurek <me@radimrehurek.com>
#
# This code is distributed under the terms and conditions
# from the MIT License (MIT).
#
import unittest
import smart_open.utils
class ClampTest(unittest.TestCase):
def test_low(self):
self.assertEqual(smart_open.utils... | piskvorky/smart_open | smart_open/tests/test_utils.py | Python | mit | 528 |
# -*- coding: utf-8 -*-
import os, argparse
from flask import Flask
parser = argparse.ArgumentParser() #настройка аргументов принимаемых с консоли
parser.add_argument("--port", default='7000', type=int, help='Port to listen'),
parser.add_argument("--hash-algo", default='sha1', type=str, help='Hashing algorithm to ... | radioteria/file-server | config.py | Python | mit | 1,264 |
# -*- coding: utf-8 -*-
"""
Python module for generating fake total emission in a magnitude band along a sightline.
This uses the Arepo/Illustris output GFM_Photometrics to get photometric band data,
which may or may not be accurate.
"""
from __future__ import print_function
import math
import os.path as path
import ... | sbird/fake_spectra | fake_spectra/emission.py | Python | mit | 6,065 |
#!/usr/bin/env python3
from django.shortcuts import render
# Create your views here.
from CnbetaApis.datas.Models import *
from CnbetaApis.datas.get_letv_json import get_letv_json
from CnbetaApis.datas.get_youku_json import get_youku_json
from django.views.decorators.csrf import csrf_exempt
from django.http import... | kagenZhao/cnBeta | CnbetaApi/CnbetaApis/views.py | Python | mit | 3,183 |
# -*- coding: utf-8 -*-
from django.utils import six
from sortedone2many.fields import SortedOneToManyField
def inject_extra_field_to_model(from_model, field_name, field):
if not isinstance(from_model, six.string_types):
field.contribute_to_class(from_model, field_name)
return
raise Exception... | ShenggaoZhu/django-sortedone2many | sortedone2many/utils.py | Python | mit | 1,509 |
from subprocess import *
import gzip
import string
import os
import time
import ApplePythonReporter
class ApplePythonReport:
vendorId = YOUR_VENDOR_ID
userId = 'YOUR_ITUNES_CONNECT_ACCOUNT_MAIL'
password = 'ITUNES_CONNECT_PASSWORD'
account = 'ACCOUNT_ID'
mode = 'Robot.XML'
dateType = 'Daily'
... | Acimaz/Google_Apple_Financial_Reporter | AppleReporter.py | Python | mit | 4,732 |
from django_evolution.mutations import AddField, RenameField
from django.db import models
MUTATIONS = [
RenameField('FileDiff', 'diff', 'diff64', db_column='diff_base64'),
RenameField('FileDiff', 'parent_diff', 'parent_diff64',
db_column='parent_diff_base64'),
AddField('FileDiff', 'diff_ha... | reviewboard/reviewboard | reviewboard/diffviewer/evolutions/add_diff_hash.py | Python | mit | 542 |
import os
from setuptools import setup, find_packages
with open(os.path.join(os.path.dirname(__file__), 'README.md')) as readme:
README = readme.read()
# allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
setup(
name='poloniex',
version=... | absortium/poloniex-api | setup.py | Python | mit | 909 |
from __future__ import absolute_import
from __future__ import print_function
import sys
import glob
import time
import numpy as np
import pandas as pd
import os.path
import time
import datetime
import re
from keras.preprocessing import sequence
from keras.optimizers import SGD, RMSprop, Adagrad
from keras.utils impor... | lukovkin/ufcnn-keras | models/UFCNN1_REPO_V16_TESTMODE.py | Python | mit | 51,403 |
from sklearn.linear_model import Lasso
def get_lasso_prediction(train_data, train_truth, test_data, test_truth, alpha=1.0, iter_id=0):
clf = Lasso(alpha=alpha)
clf.fit(train_data, train_truth)
predicted = clf.predict(test_data)
return predicted.ravel()
| rileymcdowell/genomic-neuralnet | genomic_neuralnet/methods/lasso_regression.py | Python | mit | 270 |
import sqlite3
from typing import List
from pyspatial.cs import CoordinatesSystem, Axis, CoordinatesSystemType, AxisOrientation, AxisType
from pyspatial.uom import UnitOfMeasure
from . import db, EPSGException, make_id, parse_id
from .uom import get_unit
def get_coordinates_system(uid: str) -> CoordinatesSystem:
... | applequist/pyspatial | pyspatial/epsg/cs.py | Python | mit | 3,473 |
from datetime import datetime
import webapp2
from google.appengine.ext.webapp.mail_handlers import InboundMailHandler
from google.appengine.ext import ndb
from models import Email, Subscriber
from google.appengine.api import mail
class LogSenderHandler(InboundMailHandler):
def receive(self, message):
... | LaercioAsano/gae-filtered-forwarding | handle_email.py | Python | mit | 1,480 |
from model import User
from geo.geomodel import geotypes
def get(handler, response):
lat1 = handler.request.get('lat1')
lon1 = handler.request.get('lng1')
lat2 = handler.request.get('lat2')
lon2 = handler.request.get('lng2')
response.users = User.bounding_box_fetch(
User.all(),
geotypes.Box(float(lat... | globalspin/haemapod | haemapod/handlers/people/bounding_box.py | Python | mit | 365 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Dummy conftest.py for graph_stix.
If you don't know what this is for, just leave it empty.
Read more about conftest.py under:
https://pytest.org/latest/plugins.html
"""
from __future__ import print_function, absolute_import, division
import pytest
| arangaraju/graph-stix | tests/conftest.py | Python | mit | 316 |
from io import BytesIO
from itertools import groupby
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
from flask import make_response, render_template, abort
from webapp import app
from webapp.evaluation import *
from ... | dssg/cincinnati2015-public | evaluation/webapp/views.py | Python | mit | 3,341 |
import logging
from django.core.management.base import BaseCommand
from notifications.engine import send_all
class Command(BaseCommand):
help = "Emit queued notices."
def handle(self, *args, **options):
logging.basicConfig(level=logging.DEBUG, format="%(message)s")
logging.info("-" * 72)
... | haystack/eyebrowse-server | notifications/management/commands/emit_notices.py | Python | mit | 342 |
from __future__ import annotations
import abc
import shutil
import functools
from pathlib import Path
import urllib.parse
from typing import (
Callable, Any, TypeVar, cast, Tuple, Dict, Optional,
Union, Hashable,
)
import logging
from edgar_code.types import PathLike, Serializer, UserDict
from edgar_code.util.p... | charmoniumQ/EDGAR-research | edgar_code/cache.py | Python | mit | 9,951 |
# -*- coding: utf-8 -*-
"""
A function f is defined by the rule that f(n) = n if n<3 and f(n) = f(n - 1) + 2f(n - 2) + 3f(n - 3) if n> 3. Write a
procedure that computes f by means of a recursive process. Write a procedure that computes f by means of an iterative
process.
"""
from operator import lt, sub, add, mul
de... | aoyono/sicpy | Chapter1/exercises/exercise1_11.py | Python | mit | 1,681 |
from __future__ import absolute_import, division, print_function
import os
from idaskins import UI_DIR
from PyQt5 import uic
from PyQt5.Qt import qApp
from PyQt5.QtCore import Qt
from PyQt5.QtGui import QCursor, QFont, QKeySequence
from PyQt5.QtWidgets import QShortcut, QWidget
Ui_ObjectInspector, ObjectInspectorBas... | zyantific/IDASkins | plugins/idaskins/objectinspector.py | Python | mit | 2,576 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# uzmq documentation build configuration file, created by
# sphinx-quickstart on Wed Nov 7 00:32:37 2012.
#
# 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
# autogen... | benoitc/uzmq | docs/conf.py | Python | mit | 9,957 |
from app.core.helper import create_app
from app.core.db import db
from app.core.json import json_respon
from app.user.views import user_views
from app.user.models import*
from app.user.loginmanager import login_manager
from app.hotel.views import hotel_views
from app.hotel.models import*
from app.reservation.views i... | dwisulfahnur/hotel-reservation | app/__init__.py | Python | mit | 1,026 |
"""Support to interface with the Plex API."""
from __future__ import annotations
from functools import wraps
import json
import logging
import plexapi.exceptions
import requests.exceptions
from homeassistant.components.media_player import DOMAIN as MP_DOMAIN, MediaPlayerEntity
from homeassistant.components.media_pla... | rohitranjan1991/home-assistant | homeassistant/components/plex/media_player.py | Python | mit | 19,911 |
'''
Tests of output_plots.py module
'''
import pytest
import os
import numpy as np
import matplotlib.image as mpimg
from ogusa import utils, output_plots
# Load in test results and parameters
CUR_PATH = os.path.abspath(os.path.dirname(__file__))
base_ss = utils.safe_read_pickle(
os.path.join(CUR_PATH, 'test_io_d... | OpenSourcePolicyCenter/dynamic | ogusa/tests/test_output_plots.py | Python | mit | 9,699 |
# -*- coding: utf-8 -*-
"""
The MIT License (MIT)
Copyright (c) 2015-2019 Rapptz
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 u... | gnmiller/craig-bot | craig-bot/lib/python3.6/site-packages/discord/player.py | Python | mit | 10,909 |
from __future__ import print_function
import datetime
import os
from keras.callbacks import ModelCheckpoint, EarlyStopping, ReduceLROnPlateau
from keras.engine.training import Model
from keras.initializers import RandomUniform
from keras.layers import Convolution1D, MaxPooling1D
from keras.layers import Dense, Dropou... | jcavalieri8619/siamese_sentiment | CNN_model.py | Python | mit | 11,371 |
"Utility functions for the tests."
import json
def get_settings(**defaults):
"Update the default settings by the contents of the 'settings.json' file."
result = defaults.copy()
with open("settings.json", "rb") as infile:
data = json.load(infile)
for key in result:
try:
res... | pekrau/Publications | tests/utils.py | Python | mit | 606 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "myinventory.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| tianz/MyInventory | manage.py | Python | mit | 254 |
import numpy as np
import os
import random
import threading
import time
import traceback
from util import cmudict, textinput
from util.infolog import log
import chainer
_batches_per_group = 32
_p_cmudict = 0.5
_pad = 0
# https://github.com/chainer/chainer/blob/1ad6355f8bfe4ccfcf0efcfdb5bd048787069806/examples/imagene... | tosaka2/tacotron | datasets/preprocessed_dataset.py | Python | mit | 4,099 |
from typing import Dict
from urllib.parse import quote
def request_path(env: Dict):
return quote('/' + env.get('PATH_INFO', '').lstrip('/'))
| bugsnag/bugsnag-python | bugsnag/wsgi/__init__.py | Python | mit | 147 |
from django.contrib import admin
from .models import Organization
admin.site.register(Organization)
| vladimiroff/humble-media | humblemedia/organizations/admin.py | Python | mit | 103 |
#!/usr/bin/env python
import sys
import argparse
import regrws
import regrws.method.org
try:
from apikey import APIKEY
except ImportError:
APIKEY = None
epilog = 'API key can be omitted if APIKEY is defined in apikey.py'
parser = argparse.ArgumentParser(epilog=epilog)
parser.add_argument('-k', '--key', help=... | RhubarbSin/arin-reg-rws | org_delete.py | Python | mit | 839 |
#!/usr/bin/env python2
# Copyright (c) 2015 The Aureus Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Test mulitple rpc user config option rpcauth
#
from test_framework.test_framework import AureusTestFramewo... | hideoussquid/aureus-12-bitcore | qa/rpc-tests/multi_rpc.py | Python | mit | 4,609 |
#!/usr/bin/env python
#
# Translation of videogamena.me javascript to python
#
# http://videogamena.me/vgng.js
# http://videogamena.me/video_game_names.txt
#
# (C) 2014 Dustin Knie <dustin@nulldomain.com>
import argparse
import os
import random
from math import floor, trunc
_word_list_file = 'video_game_names.txt'
_... | nullpuppy/vgng | vgng.py | Python | mit | 2,102 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from glob import glob
from io import open
import os
import re
import sys
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
if sys.argv[-1] == 'publish':
os.system('python setup.py sdist upload')
os.system('python setup... | mozillazg/python-shanbay-team-assistant | setup.py | Python | mit | 3,146 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2016-09-20 05:49
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('photos', '0003_rover'),
]
operations = [
m... | WillWeatherford/mars-rover | photos/migrations/0004_photo_rover.py | Python | mit | 589 |
#!/usr/bin/python
import os
import sys
import argparse
import requests
import subprocess
import shutil
class bcolors:
HEADER = '\033[90m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
class Console:
def __init__(self):
self.verbos... | ajdale/jstool | jstool.py | Python | mit | 5,509 |
"""
Decorators
"""
from __future__ import unicode_literals
from functools import wraps
from django.http import HttpResponseBadRequest
from django.utils.decorators import available_attrs
from django_ajax.shortcuts import render_to_json
def ajax(function=None, mandatory=True, **ajax_kwargs):
"""
Decorator wh... | furious-luke/django-ajax | django_ajax/decorators.py | Python | mit | 2,485 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import pla
import numpy as np
def read_data(filename):
with open(filename, 'r') as infile:
X = []
y = []
for line in infile:
fields = line.strip().split()
X.append([float(x) for x in fields[:-1]])
y.append(0... | pjhades/coursera | ml1/1.py | Python | mit | 1,752 |
"""
PynamoDB Connection classes
~~~~~~~~~~~~~~~~~~~~~~~~~~~
"""
from typing import Any, Dict, Mapping, Optional, Sequence
from pynamodb.connection.base import Connection, MetaTable, OperationSettings
from pynamodb.constants import DEFAULT_BILLING_MODE, KEY
from pynamodb.expressions.condition import Condition
from pyn... | jlafon/PynamoDB | pynamodb/connection/table.py | Python | mit | 12,792 |
#!/usr/bin/env python
#
# Copyright (c) 2001 - 2016 The SCons Foundation
#
# 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... | EmanueleCannizzaro/scons | test/SWIG/SWIGOUTDIR.py | Python | mit | 2,897 |
import re
from unittest import TestCase
def mark_quoted_strings(sql):
"""Mark all quoted strings in the SOQL by '@' and get them as params,
with respect to all escaped backslashes and quotes.
"""
pm_pattern = re.compile(r"'[^\\']*(?:\\[\\'][^\\']*)*'")
bs_pattern = re.compile(r"\\([\\'])")
out_... | chromakey/django-salesforce | salesforce/backend/subselect.py | Python | mit | 4,158 |
#!/usr/local/bin/python
# -*-coding:Utf-8 -*
import os
import math
def GA_settings():
"""Provides the view for the user setting of the GA experiments and returns the settings set"""
options = {}
os.system("clear")
print('===== OPTIONS =====\n')
preset = int(raw_input(
"PRESET\n"
... | goujonpa/jeankevin | views/settingsView.py | Python | mit | 7,278 |
import pygame
from pygame.locals import *
from Constants import Constants
from FadeTransition import FadeTransition
from Menu import Menu
from GW_Label import GW_Label
from GuiWidgetManager import GuiWidgetManager
from xml.sax import make_parser
from Localization import Localization
import os
class ExitMenu(Menu... | reality3d/molefusion | modules/ExitMenu.py | Python | mit | 1,885 |
"""
Classes for char-to-int mapping and int-to-int mapping.
:Author: James Taylor (james@bx.psu.edu)
The char-to-int mapping can be used to translate a list of strings
over some alphabet to a single int array (example for encoding a multiple
sequence alignment).
The int-to-int mapping is particularly useful for crea... | bxlab/bx-python | lib/bx/seqmapping.py | Python | mit | 2,856 |
# -*- coding: utf-8 -*-
"""
<DefineSource>
@Date : Fri Nov 14 13:20:38 2014 \n
@Author : Erwan Ledoux \n\n
</DefineSource>
An Eulerer
"""
#<DefineAugmentation>
import ShareYourSystem as SYS
BaseModuleStr="ShareYourSystem.Specials.Simulaters.Populater"
DecorationModuleStr="ShareYourSystem.Standards.Classors.Classe... | Ledoux/ShareYourSystem | Pythonlogy/draft/Eulerer/__init__.py | Python | mit | 1,369 |
import os
import signal
import subprocess
import beanstalkc
import time
import pexpect
try:
import unittest2 as unittest
except ImportError:
import unittest
from beanstalkctl.util import BeanstalkdMixin
class BaseSpec(unittest.TestCase, BeanstalkdMixin):
beanstalkd_instance = None
beanstalkd_host =... | OldhamMade/beanstalkctl | specs/base_spec.py | Python | mit | 3,511 |
########################################
# Automatically generated, do not edit.
########################################
from pyvisdk.thirdparty import Enum
HostDiskPartitionInfoPartitionFormat = Enum(
'gpt',
'mbr',
'unknown',
)
| xuru/pyvisdk | pyvisdk/enums/host_disk_partition_info_partition_format.py | Python | mit | 247 |
# -*- coding: utf-8 -*-
"""Status effect data."""
from components.status_effect import StatusEffect
from status_effect_functions import damage_of_time
# todo: generate new object not copy
STATUS_EFFECT_CATALOG = {
'POISONED':
{
'name': 'poisoned',
'tile_path': 'status_effect/poisoned.png',
... | kuraha4/roguelike-tutorial-python | src/data/status_effect.py | Python | mit | 1,577 |
# In the 20x20 grid below, four numbers along a diagonal line have been marked in red.
# 08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08
# 49 49 99 40 17 81 18 57 60 87 17 40 98 43 69 48 04 56 62 00
# 81 49 31 73 55 79 14 29 93 71 40 67 53 88 30 03 49 13 36 65
# 52 70 95 23 04 60 11 42 69 24 68 56 01 32 56... | cloudzfy/euler | src/11.py | Python | mit | 3,512 |
#!/usr/bin/env python
import os
import sys
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
setup(
name='MKS',
version='0.1.0',
description="A unit system based on meter, kilo, and second",
author='Roderic Day',
author_email='roderic.day@gmail.com',
... | RodericDay/MKS | setup.py | Python | mit | 375 |
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
setup(
cmdclass = {'build_ext': build_ext},
ext_modules = [Extension("capture", ["capture.pyx"])]
)
| hirolovesbeer/sekiwake | src/setup.py | Python | mit | 223 |
# Generated by Django 2.0 on 2018-02-08 11:45
from django.db import migrations
def forwards(apps, schema_editor):
"""
Change all DancePiece objects into Work objects, and their associated
data into WorkRole and WorkSelection models, then delete the DancePiece.
"""
DancePiece = apps.get_model("spe... | philgyford/django-spectator | spectator/events/migrations/0028_dancepieces_to_works.py | Python | mit | 1,326 |
from __future__ import division
from __future__ import print_function
import numpy as np
import numpy.testing as npt
import pandas as pd
from deepcpg.data import annotations as annos
def test_join_overlapping():
f = annos.join_overlapping
s, e = f([], [])
assert len(s) == 0
assert len(e) == 0
... | cangermueller/deepcpg | tests/deepcpg/data/test_annos.py | Python | mit | 2,793 |
SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://root@localhost:3306/microblog'
SQLALCHEMY_TRACK_MODIFICATIONS = False
REDIS_HOST = 'localhost'
REDIS_PORT = 6379
DEBUG = False
| yejianye/microblog | asura/conf/dev.py | Python | mit | 170 |
#empty file
| benno16/extraFiles | FlaskApp/__init__.py | Python | mit | 49 |
# Copyright (C) 2014 Rémi Bèges
# For conditions of distribution and use, see copyright notice in the LICENSE file
from distantio.DistantIO import DistantIO
from distantio.DistantIOProtocol import distantio_protocol
from distantio.SerialPort import SerialPort
from distantio.crc import crc16
| Overdrivr/DistantIO | distantio/__init__.py | Python | mit | 295 |
import datetime
import logging
from unittest.mock import patch
from django.test import TestCase
from django.test.utils import override_settings
from konfera import models
from payments import utils
from payments.models import ProcessedTransaction
def make_payment(new_data):
data = {
'date': datetime.dat... | kapucko/django-konfera | payments/tests.py | Python | mit | 7,832 |
"""
Django settings for news_project 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/
"""
impo... | julienawilson/news-project | news_project/news_project/settings.py | Python | mit | 3,887 |
"""
Python Interchangeable Virtual Instrument Library
Copyright (c) 2014-2016 Alex Forencich
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... | Diti24/python-ivi | ivi/agilent/agilentE4431B.py | Python | mit | 1,495 |
import random, sys
if len(sys.argv)!= 2:
print "Usage: python generate.py <how many instructions you want>"
sys.exit()
choices = ("(", ")")
output = ""
for x in range(int(sys.argv[1])):
output += random.choice(choices)
f = open("randout", "w")
f.write(output)
f.close
print "Created an instruction set... | b4ux1t3/adventofcode2015 | day1/generate.py | Python | mit | 366 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.