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 |
|---|---|---|---|---|---|
"""
A script to walk through all commits of a repository.
Works with `number_of_strategies.py` to get the number of strategies in the
library at each commit.
"""
from git import Repo
from tqdm import tqdm
import os
import subprocess
path_to_repo = "~/src/Axelrod"
repo = Repo(path_to_repo)
all_commits = [c for c in ... | Axelrod-Python/An-open-reproducible-framework-for-the-study-of-the-iterated-prisoners-dilemma | scripts/scrape_repo.py | Python | mit | 1,161 |
'''
Tests for nrg mapping procedures.
'''
from numpy import *
from numpy.testing import dec,assert_,assert_raises,assert_almost_equal,assert_allclose
from matplotlib.pyplot import *
from scipy import sparse as sps
from scipy.linalg import qr,eigvalsh,norm
import time,pdb,sys
from ..utils import *
from ..discretizatio... | GiggleLiu/nrg_mapping | nrgmap/tests/test_checkscale.py | Python | mit | 2,657 |
import nose
import unittest
from soap.datatype import auto_type, int_type, float_type, IntegerArrayType
from soap.expression import expression_factory, operators, Variable, Subscript
from soap.semantics import IntegerInterval, ErrorSemantics
from soap.program.flow import (
AssignFlow, IfFlow, WhileFlow, ForFlow, C... | admk/soap | tests/test_parser.py | Python | mit | 8,996 |
#!/usr/bin/env python3
import time
from multiprocessing import Process
import selfdrive.crash as crash
from common.params import Params
from selfdrive.launcher import launcher
from selfdrive.swaglog import cloudlog
from selfdrive.version import version, dirty
ATHENA_MGR_PID_PARAM = "AthenadPid"
def main():
params... | vntarasov/openpilot | selfdrive/athena/manage_athenad.py | Python | mit | 1,020 |
from rx.disposable import CompositeDisposable
from rx.observable import Producer
import rx.linq.sink
from threading import RLock
class TakeCount(Producer):
def __init__(self, source, count):
self.source = source
self.count = count
def omega(self, count):
if self.count <= count:
return self
... | akuendig/RxPython | rx/linq/take.py | Python | mit | 2,452 |
__author__ = 'isparks'
import unittest
from rwslib.builders import *
from xml.etree import cElementTree as ET
def obj_to_doc(obj,*args, **kwargs):
"""Convert an object to am XML document object"""
builder = ET.TreeBuilder()
obj.build(builder, *args, **kwargs)
return builder.close()
class TestInheri... | Oli76/rwslib | rwslib/tests/test_builders.py | Python | mit | 25,505 |
class Solution(object):
def simplifyPath(self, path):
"""
:type path: str
:rtype: str
"""
parts = path.strip().strip("/").split("/")
stack = []
for p in parts:
if p == "." or not p: continue
elif p == "..": stack.pop(len(stack)-1) if st... | scaugrated/leetcode | algorithm/Simplify_Path.py | Python | mit | 403 |
import numbers # noqa: E402
try:
basestring # basestring was removed in Python 3
except NameError:
basestring = str
def test_trade(exchange, trade, symbol, now):
assert trade
sampleTrade = {
'info': {'a': 1, 'b': 2, 'c': 3}, # the original decoded JSON as is
'id': '12345-67890:098... | ccxt/ccxt | python/ccxt/test/test_trade.py | Python | mit | 3,336 |
from queue import Queue
from threading import Event, Thread
from usb import USBError, ENDPOINT_OUT, ENDPOINT_IN
from usb.control import get_interface
from usb.core import find
from usb.util import find_descriptor, endpoint_direction, claim_interface, dispose_resources
from libAnt.drivers.driver import Driver, DriverE... | half2me/libant | libAnt/drivers/usb.py | Python | mit | 5,017 |
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 1.3.38
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
# This file is compatible with both classic and new-style classes.
from sys import version_info
if version_info >= ... | peterlharding/PDQ | python/pdq.py | Python | mit | 16,835 |
"""
###############################################################################
Controller: Overall controller class
###############################################################################
"""
import pickle as _pickle
import copy as _copy
import time
import random
import string
import OpenPNM
from OpenPNM.... | amdouglas/OpenPNM | OpenPNM/Base/__Controller__.py | Python | mit | 18,622 |
import _plotly_utils.basevalidators
class CautoValidator(_plotly_utils.basevalidators.BooleanValidator):
def __init__(self, plotly_name="cauto", parent_name="bar.marker.line", **kwargs):
super(CautoValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | plotly/plotly.py | packages/python/plotly/plotly/validators/bar/marker/line/_cauto.py | Python | mit | 458 |
# -*- coding: utf-8 -*-
import psycopg2
from psycopg2 import errorcodes as codes
class PgClientError(Exception):
""" Common pgclient exception class"""
CLASS_CODE = None
def __init__(self, **kwargs):
for k, v in kwargs.items():
setattr(self, k, v)
def __str__(self):
retur... | prawn-cake/pgclient | pgclient/exceptions.py | Python | mit | 6,638 |
from django import template
from froide.foirequestfollower.forms import FollowRequestForm
register = template.Library()
def followrequest(context, foirequest, user, name):
form = FollowRequestForm(foirequest, user)
following = False
if user.is_authenticated:
if foirequest.followed_by(user):
... | CodeforHawaii/froide | froide/foirequestfollower/templatetags/follower_tags.py | Python | mit | 471 |
#!/usr/bin/env python2.6
import numpy
m = numpy.array([[1, 2, 3], [2, 4, 6], [3, 5, 2]])
print m[m == 2]
| rik0/rk-exempla | algorithms/python/matrix_substitution.py | Python | mit | 107 |
#note: using this for user input
import sys
from time import sleep
class Input():
def __init__(self, pygame):
self.pygame = pygame
self.left = 0
self.right = 0
self.paused = 0
def checkInput(self):
#needs to run at least once each game loop
for event in self.py... | golddiamonds/BreakOuttaHere | game/input.py | Python | mit | 1,395 |
import math
previous = 1
iterator = 0
total = 0
for x in range(9):
iterator=iterator + 2 if x % 4 == 0 else iterator
total += previous
previous += iterator
print total
| DavidOStewart/ProjectEuler | 28.py | Python | mit | 185 |
import sys
import os
import stat
import re
import copy
import shutil
from pwd import getpwnam
if __name__ == "__main__":
import docassemble.base.config
docassemble.base.config.load(arguments=sys.argv)
from docassemble.base.config import daconfig, S3_ENABLED, s3_config, AZURE_ENABLED, azure_config
import docasse... | jhpyle/docassemble | docassemble_webapp/docassemble/webapp/install_certs.py | Python | mit | 3,811 |
from django.test import RequestFactory
from test_plus.test import TestCase
from ..views import (
EventUpdate,
EventCreate
)
class BaseUserTestCase(TestCase):
def setUp(self):
self.user = self.make_user()
self.factory = RequestFactory()
class TestEventUpdateView(BaseUserTestCase):
... | mansonul/events | events/tests/test_views.py | Python | mit | 1,794 |
# -*- coding: utf-8 -*-
import random, time, sys, dht, bootstrap
random.seed(time.time())
class MyNetwork(dht.DHT):
def __init__(self, *args, **kwargs):
self._my_db = {}
super(MyNetwork, self).__init__(*args, **kwargs)
def handle_save(self, key, value):
self._my_db[key] = value
... | flosch/libdht | example.py | Python | mit | 1,929 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-05-03 20:21
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependen... | PXL-CF2016/pxl-master-server | pxl/migrations/0002_auto_20160503_2021.py | Python | mit | 1,453 |
__author__ = 'nightfade'
from example.echo_service_pb2 import IEchoService, IEchoClient_Stub
import logger
class EchoService(IEchoService):
def echo(self, rpc_controller, echo_string, callback):
""" called by RpcChannel.receive when a complete request reached.
"""
logger.get_logger('Echo... | nightfade/protobuf-RPC | example/echo_service.py | Python | mit | 594 |
import math
import pyglet
def clamp(x, min_x, max_x):
return min(max(x, min_x), max_x)
def float_to_ubyte(f):
return clamp(int(f * 256.0), 0, 255)
def float_to_byte(f):
return clamp(int(math.floor(f * 128.0)), -128, 127)
def char_to_float(c):
assert isinstance(c, str) and len(c) == 1
return floa... | elemel/boxlet | lib/boxlet/utils.py | Python | mit | 2,714 |
# -*- coding: utf-8 -*-
#__init__.py中创建蓝本
from flask import Blueprint
auth=Blueprint('auth',__name__)#参数是蓝本名字
from . import views
| wangxiaoyangwz/WANG | app/auth/__init__.py | Python | mit | 157 |
# -*- coding: utf-8 -*-
from django.contrib.auth.models import User
from allauth.socialaccount.models import SocialAccount
from rest_framework import serializers
class UserSerializer(serializers.ModelSerializer):
username = serializers.CharField(source='username', read_only=True)
avatar_url = serializers.URLFi... | woojing/pairgramming | dj_backend/api/serializers.py | Python | mit | 468 |
# This file is part of Indico.
# Copyright (C) 2002 - 2021 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from blinker import Namespace
_signals = Namespace()
print_badge_template = _signals.signal('print-badg... | ThiefMaster/indico | indico/core/signals/event/designer.py | Python | mit | 534 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# matrixscreener documentation build configuration file, created by
# sphinx-quickstart on Fri Nov 21 17:05:46 2014.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in th... | arve0/matrixscreener | doc/conf.py | Python | mit | 6,271 |
from django.apps import AppConfig
class FeedsConfig(AppConfig):
name = 'feeds'
def ready(self):
import feeds.signals # noqa
| drgarcia1986/pbb | pbb/feeds/apps.py | Python | mit | 144 |
def initialize(time):
pass
def apply_rate(time):
return [(0, 1)] # Rate 0 (1 Mbps), 1 attempt
def process_feedback(status, timestamp, delay, tries):
pass
| pavpanchekha/bitrate-lab | pysim/minimal.py | Python | mit | 168 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: ai ts=4 sts=4 et sw=4 nu
from __future__ import (unicode_literals, absolute_import,
division, print_function)
import logging
from django.contrib import admin
from ivr.models import Report
logger = logging.getLogger(__name__)
admin.site.r... | yeleman/cline | ivr/admin.py | Python | mit | 336 |
import sys, os
def _component_backend_module():
module_name = os.environ.get('AKUNA_COMPONENT_BACKEND') or 'akuna.component.backends.basic'
__import__(module_name)
return sys.modules[module_name]
def register_comp(*args, **kwargs):
component_mod = _component_backend_module()
component_mod.register... | stana/akuna-component | akuna/component/_api.py | Python | mit | 1,284 |
"""Base Resource classes for Tastypie-based API"""
# Significant portions of this code are based on Tastypie
# (http://tastypieapi.org)
#
# This is mostly because I had to patch methods in the Tastypie API
# to provide additional hooks or workarounds.
#
# Tastypie's license is as follows:
#
# Copyright (c) 2010, Dani... | denverfoundation/storybase | apps/storybase/api/resources.py | Python | mit | 22,939 |
# -*- coding:utf-8 -*-
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
from functools import wraps
from flask import abort
from flask.ext.login import current_user
from .models import Permission
def permission_required(permission):
def decorator(f):
@wraps(f)
def decorated_function(*args, *... | Kopei/manualscore | app/decorators.py | Python | mit | 581 |
#!venv/bin/python
from FlaskMedia import app
app.run(debug=True, port=5001)
| samcheck/PyMedia | runFlaskMedia.py | Python | mit | 76 |
# -*- coding: utf-8 -*-
import re
from .constants import (
PUNCT_SYMBOLS,
ABBR,
MONTHS,
UNDECIDED,
SHOULD_SPLIT,
SHOULD_NOT_SPLIT
)
from .regular_expressions import (
word_with_period,
no_punctuation,
numerical_expression,
repeated_dash_converter,
dash_converter,
pure_whi... | JonathanRaiman/xml_cleaner | ciseau/word_tokenizer.py | Python | mit | 9,036 |
import pytest
from tadman import path_tools
def test_ending_slash_removal():
tests = ['/home/squid', '/path/to/something/', '/var/lib/foo/bar']
results = ['/home/squid', '/path/to/something', '/var/lib/foo/bar']
for x in range(len(tests)):
assert path_tools.last_slash_check(tests[x]) == ... | KeepPositive/Tadman | tests/test_path.py | Python | mit | 570 |
# flake8: noqa
import sys
import codecs
import array
from functools import reduce
import numpy as np
def ensure_ndarray(buf):
"""Convenience function to coerce `buf` to a numpy array, if it is not already a
numpy array.
Parameters
----------
buf : array-like or bytes-like
A numpy array o... | zarr-developers/numcodecs | numcodecs/compat.py | Python | mit | 4,557 |
# coding: utf-8
# (c) 2015-2020 Teruhisa Okada
from add_masklines import add_masklines
from basemap import basemap
from cmap import cmap
from dataset import Dataset
from edit_nc_var import edit_nc_var
from get_time import get_time
from get_vnames import get_vnames
from initialize import initialize
from levels import l... | okadate/romspy | romspy/__init__.py | Python | mit | 1,042 |
#!/usr/bin/env python
from math import sqrt, cos, pi, sin
from .trajectory import Trajectory
class LemniscateTrajectory(object, Trajectory):
def __init__(self, radius, period):
Trajectory.__init__(self)
self.radius = radius
self. period = period
def get_position_at(self, t):
... | bit0001/trajectory_tracking | src/trajectory/lemniscate_trajectory.py | Python | mit | 746 |
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.http import HttpResponseRedirect, Http404
from django.core.urlresolvers import reverse
from tweets.forms import TweetForm
import cass
NUM_PER_PAGE = 40
def timeline(request):
form = TweetForm(request.POST or N... | adhish20/TwitterWithCassandra | tweets/views.py | Python | mit | 2,293 |
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
PAGE_SIZE ... | Azure/azure-sdk-for-python | sdk/appconfiguration/azure-appconfiguration/tests/consts.py | Python | mit | 658 |
import datetime
from sqlalchemy.inspection import inspect
def to_dict(model):
d = {'entity': model.__tablename__}
for column in model.__table__.columns:
d[column.name] = getattr(model, column.name)
for relation in inspect(model.__class__).relationships:
try:
d[relation.key] = ... | saltpy/planner | planner/model/translate.py | Python | mit | 1,017 |
# Copyright (c) 2011-2013 Simplistix Ltd
# See license.txt for license details.
from nose.plugins.skip import SkipTest
try:
from testfixtures.components import TestComponents
except ImportError: # pragma: no cover
raise SkipTest('zope.component is not available')
from mock import Mock, call
from testfixture... | beblount/Steer-Clear-Backend-Web | env/Lib/site-packages/testfixtures/tests/test_components.py | Python | mit | 1,275 |
# 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 ... | rjschwei/azure-sdk-for-python | azure-batch/azure/batch/models/start_task_information.py | Python | mit | 4,264 |
"""
Builds out an arugment parser based on function signatures in various modules.
Each module is mapped to a sub-command name space, and each function of that
module is mapped to an operation of that sub command. Parameters to that
function are made into command line arguments. Invocation looks like:
command sub-c... | saltmine/newman-cli | newman/newman.py | Python | mit | 9,343 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This file is part of rdlm-py released under the MIT license.
# See the LICENSE file for more information.
import argparse
import sys
from rdlmpy import RDLMClient
from urlparse import urlparse
parser = argparse.ArgumentParser(description='Release a lock')
parser.add_a... | thefab/rdlm-py | lock-release.py | Python | mit | 862 |
# -*- coding: utf-8 -*-
"""
irc.server
This server has basic support for:
* Connecting
* Channels
* Nicknames
* Public/private messages
It is MISSING support for notably:
* Server linking
* Modes (user and channel)
* Proper error reporting
* Basically everything else
It is mostly useful as a testing tool or perha... | jaraco/irc | irc/server.py | Python | mit | 17,996 |
#!/usr/bin/python
import signal
import subprocess
import os
import sys
class Program():
def __init__(self):
self.pid = ''
def call(self):
argv = sys.argv[1]
process = subprocess.Popen(argv,shell=True)
self.pid = process.pid
... | broonie89/loadify-1 | lib/ohdevtools/remote_wrapper.py | Python | mit | 930 |
"""
Revision ID: 0109_rem_old_noti_status
Revises: 0108_change_logo_not_nullable
Create Date: 2017-07-10 14:25:15.712055
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
revision = '0109_rem_old_noti_status'
down_revision = '0108_change_logo_not_nullable'
def upgrade():... | alphagov/notifications-api | migrations/versions/0109_rem_old_noti_status.py | Python | mit | 1,224 |
# Palindrome Checker
from Deque import Deque
def palindrome_checker(alist):
p = Deque()
# deal with a null list
if len(alist) == 0:
return None
# add each element into the queue
for item in alist:
p.addRear(item)
# initialize the flag
flag = True
# if the list has ... | rush2catch/algorithms-leetcode | Basic Data Structures/queue/PalindromeChecker.py | Python | mit | 839 |
"""
GhProject.py - (C) Copyright - 2017
This software is copyrighted to contributors listed in CONTRIBUTIONS.md.
SPDX-License-Identifier: MIT
Author(s) of this file:
J. Harding
GitHub project model.
A Github project has two relationships to commits. A many to many and a foreign key.
Unsure the intention of the dua... | jakeharding/repo-health | repo_health/gh_projects/models/GhProject.py | Python | mit | 1,778 |
import os
import dj_database_url
from .base import *
INSTALLED_APPS += (
'djangosecure',
)
PRODUCTION_MIDDLEWARE_CLASSES = (
'djangosecure.middleware.SecurityMiddleware',
)
MIDDLEWARE_CLASSES = PRODUCTION_MIDDLEWARE_CLASSES + MIDDLEWARE_CLASSES
DATABASES = {'default': dj_database_url.config()}
SECRET_KE... | jpadilla/feedleap | feedleap/settings/production.py | Python | mit | 893 |
import os
from click import UsageError
from click.testing import CliRunner
import numpy as np
import pytest
import rasterio
from rasterio.enums import Compression
from rio_color.scripts.cli import color, atmos, check_jobs
def equal(r1, r2):
with rasterio.open(r1) as src1:
with rasterio.open(r2) as src2:... | mapbox/rio-color | tests/test_cli.py | Python | mit | 6,115 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
This module implements Trello to JIRA importer.
"""
import os
import argparse
import json
# from io import StringIO
from io import BytesIO
from jira import JIRA
from urllib import request
import res.t2jstrings as strings
import log.mylogging as mylogging
import exc.myexce... | iamleeky/pytrello2jira | t2j/trello2jira.py | Python | mit | 18,256 |
from rpython.translator.backendopt import removenoops
from rpython.translator.backendopt import inline
from rpython.translator.backendopt.malloc import remove_mallocs
from rpython.translator.backendopt.constfold import constant_fold_graph
from rpython.translator.backendopt.constfold import replace_we_are_jitted
from rp... | oblique-labs/pyVM | rpython/translator/backendopt/all.py | Python | mit | 6,949 |
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 17 21:31:48 2015
@author: andrew_woizesko
"""
###########################################################################
## Imports
###########################################################################
import dill
from conf import settings
#######################... | georgetown-analytics/dc-crimebusters | crimebusters/classify.py | Python | mit | 2,787 |
import corner as triangle
import numpy as np
from matplotlib import rcParams
run_name='model1_nax20_DE'
chain=np.load(run_name+'.npy')
nwalkers, nsteps,ndim = np.shape(chain)
burnin = nsteps/4
# Make sample chain removing burnin
combinedUSE=chain[:,burnin:,:].reshape((-1,ndim))
# Priors, for plotting limits and binn... | DoddyPhysics/AxionNet | Chains/model1_DE_triangle.py | Python | mit | 1,718 |
# -*- coding: utf-8 -*-
"""
General utilities
"""
import http.client
import json
import socket
import time
from functools import wraps
from itertools import chain
from flask import flash, redirect, request, url_for
from flask_login import current_user
def timetag_today():
"""Return the timetag for today"""
... | lukasjuhrich/sipa | sipa/utils/__init__.py | Python | mit | 4,684 |
"""
Django settings for bibbutler project.
Generated by 'django-admin startproject' using Django 1.9.6.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
... | dolonnen/bibbutler | bibbutler/settings.py | Python | mit | 3,374 |
#recommender.py includes a class 'Recommender' which provides
#basic functions of a certain recommender
from __future__ import division
import os
import pprint
import similarity
import cPickle as pickle
import tool
class Recommender:
def __init__(self, outputFile, similarityMeasure, pathStr, trainingSet, predict... | clasnake/recommender | recommender.py | Python | mit | 9,170 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import functools
import sys
from . import utils
from .helper import jinja2_env
__author__ = 'banxi'
_generators_map = {}
def _make_gkey(target, platform, lang):
return "%s:%s:%s" % (target, platform, lang)
def as_generator(target, platform="ios... | banxi1988/iOSCodeGenerator | ios_code_generator/generators.py | Python | mit | 3,737 |
# Doesn't work yet
from time import sleep
import os
import PIL
import scipy.misc
import math
import chi
import tensortools as tt
from tensortools import Function
import numpy as np
import gym
import tensorflow as tf
from tensorflow.contrib import layers
from chi.rl.util import pp, to_json, show_all_variables
import ar... | rmst/chi | chi/rl/dcgan.py | Python | mit | 25,425 |
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Cells(_BaseTraceHierarchyType):
# class properties
# --------------------
_parent_path_str = "table"
_path_str = "table.cells"
_valid_props = {
"align",
"alignsrc",
... | plotly/plotly.py | packages/python/plotly/plotly/graph_objs/table/_cells.py | Python | mit | 17,748 |
# Configurables
ADMIN_ID = 'rsk8'
DEBUG = True
# URIS
MAIN_URI = '/main'
DASHBOARD_URI = '/dashboard'
DASHBOARD_ADMIN_URI = '/dashboard/admins'
DASHBOARD_ELECTIONS_URI = '/dashboard/elections'
ERROR_URI = '/error'
ORGANIZATION_URI = '/organizations'
PETITIONS_URI = '/petitions'
PETITIONS_SIGN_URI = '/petitions/sign'
P... | rice-apps/petition-app | config.py | Python | mit | 419 |
# -*- coding: utf-8 -*-
import riprova
# Custom error object
class MyCustomError(Exception):
pass
# Whitelist of errors that should not be retried
whitelist = riprova.ErrorWhitelist([
ReferenceError,
ImportError,
IOError,
SyntaxError,
IndexError
])
def error_evaluator(error):
"""
U... | h2non/riprova | examples/whitelisting_errors.py | Python | mit | 1,229 |
# 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.
# --------------------------------------------------------------------... | Azure/azure-sdk-for-python | sdk/communication/azure-communication-networktraversal/samples/network_traversal_samples_async.py | Python | mit | 2,887 |
# -*- coding: utf-8 -*-
#
# Bottle documentation build configuration file, created by
# sphinx-quickstart on Thu Feb 18 18:09:50 2010.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All ... | adragomir/bottle | docs/conf.py | Python | mit | 7,025 |
import csv
import os
DIR = 'MTA_Subway_turnstile'
def fix_turnstile_data(filenames):
"""
Filenames is a list of MTA Subway turnstile text files. A link to an example
MTA Subway turnstile text file can be seen at the URL below:
http://web.mta.info/developers/data/nyct/turnstile/turnstile_110507.txt
... | angelmtenor/IDSFC | L2_Data_Wrangling/P5_fixing_turnstyle_data.py | Python | mit | 2,224 |
import glob
import os
from components import *
MEMORY_SIZE = 500
files = glob.glob(os.path.join(
os.path.dirname(os.path.abspath(__file__)),
"example_programs", "*.txt"))
filedict = {}
for i, c in enumerate(files):
print("{}: {}".format(i, c.split(os.pathsep)[-1]))
filedict[str(i)] = c # generate ... | nitros12/Cpu_emulator | main.py | Python | mit | 668 |
a, b = map(int, input().split())
print(a*4+b*2)
| knuu/competitive-programming | atcoder/corp/codethxfes2014a_a.py | Python | mit | 49 |
from default import *
import theano
import theano.tensor as T
import lasagne as nn
import deep_learning_layers
import layers
import preprocess
import postprocess
import objectives
import theano_printer
import updates
cached = None
# Save and validation frequency
validate_every = 10
validate_train_set = False
save_e... | 317070/kaggle-heart | configurations/j4_iranet2.py | Python | mit | 6,950 |
import pytest
def test_eval(workbench):
expected = [
dict(repetitions=2, level=60, fc=32e3/2),
dict(repetitions=10, level=60, fc=32e3/10),
dict(repetitions=15, level=60, fc=32e3/15),
dict(repetitions=20, level=60, fc=32e3/20),
dict(repetitions=20, level=60, fc=32e3/20),
... | bburan/psiexperiment | tests/workbench/test_context.py | Python | mit | 2,838 |
import os
import sys
"""
Outputs empty files when Valve removes interfaces so that people upgrading don't have old bad data.
"""
def main():
list_of_files = (
("autogen", "isteamunifiedmessages.cs"),
("types/SteamUnifiedMessages", "ClientUnifiedMessageHandle.cs"),
("types/SteamClient", "Ste... | rlabrecque/Steamworks.NET-CodeGen | output_dummy_files.py | Python | mit | 1,047 |
from zope.interface import Interface, Attribute
class ICachedItemMapper(Interface):
"""Manage attribute mappings between ICachableItem and ICachedItem
For simple maps that contains only strings and integers, map is simply a key value
pair of the mapped items. If the ICachableItem contains complex at... | davisd50/sparc.cache | sparc/cache/interfaces.py | Python | mit | 5,906 |
# Quiz#5
# Eloy Sánchez
# Instrucciones: Promedio de notas
print ("Escriba el nombre del alumno")
input ("nombre")
print ("Escriba las notas del alumno")
nota1 = float(input('Nota1 '))
nota2 = float(input('Nota2 '))
nota3 = float(input('Nota3 '))
nota4 = float(input('Nota4 '))
nota5 = float(input('Nota5 '))
prome... | Eloy2918/uip-prog3 | Laboratorios/Semana6/Quiz#5.py | Python | mit | 792 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from pymongo import MongoClient
class OSMDataImporter(object):
'''
OSMDataImporter.
'''
def __init__(self, db_name='osm_data_import', db_collection_name='jakarta'):
self.client = MongoClient()
self.db = self.client[db_name]
... | joashxu/JakartaOSMData | osm_dataimporter.py | Python | mit | 559 |
# Your are given an array of integers prices, for which the i-th element is the price of a given stock on day i; and a non-negative integer fee representing a transaction fee.
# You may complete as many transactions as you like, but you need to pay the transaction fee for each transaction. You may not buy more than 1 ... | youhusky/Facebook_Prepare | 714. Best Time to Buy and Sell Stock with Transaction Fee.py | Python | mit | 4,579 |
# :) :| :(
| connorsempek/splice | splice/__init__.py | Python | mit | 11 |
from functools import wraps
from bson.objectid import ObjectId
from flask import request, abort
from location.api.errors import bad_request
def ensure_json_content_type(f):
"""Ensure the 'Content-Type' header is 'application/json'.
Wraps views. If the check fails, returns a 400 bad request.
"""
@wra... | zackdever/location | location/api/utils.py | Python | mit | 844 |
#! /usr/bin/python
# -*- coding: utf-8 -*-
from BeautifulSoup import BeautifulSoup
import errno
import HTMLParser
import re
import socket
import sys
import urllib
import urllib2
import db_wrapper
RESUME_ID = 0
PAGE_ID = 0
US_STATES = {
'AK': 'Alaska',
'AL': 'Alabama',
'AR': 'Arkansas',
... | maximeh/spiderwave | scrappers/scrape_vtuner.py | Python | mit | 12,090 |
import pandas as pd
import lxml.html
import re
def removeNonAscii(data):
return "".join(i for i in data if ord(i)<128)
def lxmlProcess(document):
page = lxml.html.document_fromstring(document)
page = page.cssselect('body')[0].text_content()
return " ".join(page.replace('\n', ' ').replace('\r', ' ').lo... | dtsukiyama/suits | named-entity-recognizer/helper.py | Python | mit | 1,052 |
def shift_people(danger, safety, is_lantern_safe, clock):
if len(danger) == 0:
return (clock, [])
min_time = None
min_chain = [ ]
if not is_lantern_safe:
for i in range(len(danger)):
for j in range(i + 1, len(danger)):
i_time = danger[i]
j_time = danger[j]
travel_time = min(i_time, j_time)
... | ssangervasi/python-playground | riddle/reddit/bridge_riddle.py | Python | mit | 1,593 |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import operator
import re
import csv
from unicodedata import normalize
import os
from io import open
import xml.etree.ElementTree as ET
import sys
reload(sys) # Reload does the trick!
sys.setdefaultencoding('UTF8')
import getopt
import time
import pickle
impor... | jozsinakhivnak/diacriticrestoration | accent_ngram.py | Python | mit | 3,832 |
"""
Author: Marusa Zerjal, 2019 - 08 - 20
Compare two sets of components for a given association: one where all stellar radial velocities are known, and one where
some of their radial velocities are broken.
"""
from astropy.table import Table
todo=True | mikeireland/chronostar | projects/fit_comps_stars_with_missing_RV/compare_components.py | Python | mit | 255 |
from talent_match import db
class Category(db.Model):
__tablename__ = 'category'
id = db.Column(
db.INTEGER, primary_key=True, autoincrement=True, nullable=False, index=True)
name = db.Column(db.String(80), nullable=False, index=True, unique=True)
description = db.Column(db.String(256), nullab... | jordan-wright/talent-match | talent_match/models/talentInfo.py | Python | mit | 2,643 |
#!/usr/bin/env python2
# -*- coding: utf-8-*-
import os
import wave
import json
import tempfile
import logging
import urllib
import urlparse
import re
import subprocess
from abc import ABCMeta, abstractmethod
import requests
import yaml
import jasperpath
import diagnose
import vocabcompiler
class AbstractSTTEngine(ob... | JeremieSamson/jasper | client/stt.py | Python | mit | 23,750 |
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
from ._models import DecryptResult, EncryptResult, SignResult, WrapResult, VerifyResult, UnwrapResult
from ._enums import EncryptionAlgorithm, KeyWrapAlgorithm, Signatur... | Azure/azure-sdk-for-python | sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/crypto/__init__.py | Python | mit | 608 |
#!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# 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 o... | Serag8/Bachelor | google_appengine/google/appengine/tools/devappserver2/dispatcher_test.py | Python | mit | 30,824 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# A Solution to "Cubic permutations" – Project Euler Problem No. 62
# by Florian Buetow
#
# Sourcecode: https://github.com/fbcom/project-euler
# Problem statement: https://projecteuler.net/problem=62
permutations = {}
n = 0
while True:
n = n + 1
cube = str(n**3)
... | fbcom/project-euler | 062_cubic_permutations.py | Python | mit | 724 |
# pinspect_support_module_9.py
# Copyright (c) 2013-2019 Pablo Acosta-Serafini
# See LICENSE for details
# pylint: disable=C0103,C0111,R0201,R0903,W0212,W0621
def simple_property_generator(): # noqa: D202
"""Test if properties done via enclosed functions are properly detected."""
def fget(self):
"""... | pmacosta/pexdoc | tests/support/pinspect_support_module_9.py | Python | mit | 401 |
import numpy as np
import glob, pickle
import os,inspect,sys
try:
os.environ['SESNPATH']
os.environ['SESNCFAlib']
except KeyError:
print "must set environmental variable SESNPATH and SESNCfAlib"
sys.exit()
RIri = False
cmd_folder = os.getenv("SESNCFAlib")
if cmd_folder not in sys.path:
sys.p... | fedhere/SESNCfAlib | readlcv_func.py | Python | mit | 15,303 |
from vanilla import *
from defconAppKit.windows.baseWindow import BaseWindowController
from mojo.events import addObserver, removeObserver
from mojo.UI import UpdateCurrentGlyphView
from mojo.drawingTools import *
class GlobalMaks(BaseWindowController):
def __init__(self, font):
# create a window
... | typemytype/RoboFontExamples | observers/theMask.py | Python | mit | 2,844 |
#!/usr/bin/python
# encoding: utf-8
"""
schema.py
Functions for working with database schemas.
The MySQLSchema class requires sqlfairy. To install this on Ubuntu, run:
sudo apt-get install sqlfairy
Created by Shane O'Connor 2013
"""
import sys
import os
import re
import subprocess
import getpass
import time
import... | Kortemme-Lab/klab | klab/db/schema.py | Python | mit | 8,698 |
from django.conf.urls.i18n import i18n_patterns
from django.conf.urls.static import static
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.contrib import admin
from django.views.static import serve
from django.contrib.auth.decorators import login_required
from landing.v... | fga-gpp-mds/2017.2-Receituario-Medico | medical_prescription/medical_prescription/urls.py | Python | mit | 2,354 |
from time import time
start = time()
ROW = 0
COL = 1
def read_in_triangle(file_name):
triangle = []
with open(file_name) as f:
for line in f:
mini_list = line.split()
triangle.append(mini_list)
triangle = turn_into_numbers(triangle)
return triangle
def turn_into_num... | ctlewitt/Project-Euler | prob18_maximum-path-sum-i.py | Python | mit | 2,059 |
from will.plugin import WillPlugin
from will.decorators import respond_to, periodic, hear, randomly, route, rendered_template, require_settings
import requests
import json
class DefinitionPlugin(WillPlugin):
@respond_to("^urban dictionary (?P<word>.*)$")
def definition(self, message, word):
r = request... | Ironykins/will | will/plugins/fun/definition.py | Python | mit | 1,027 |
#!/bin/python3
import os
import sys
#
# Complete the gradingStudents function below.
#
def gradingStudents(grades):
# another elegant solution with a lambda function
# map(lambda x: 5*(1 + x//5) if (x > 37 and ((x%5) > 2)) else x, grades)
# but we will use this for the solution
result = []
for i i... | bluewitch/Code-Blue-Python | HR_gradingStudents.py | Python | mit | 772 |
import contextlib
import json
import logging
import pathlib
import time
import uuid
import bottle
from ..apps import BaseApp
from ..ccfile import CCFile
from ..nodes import Manager as NodesManager, AlreadyRegisteredError, Node, NotConnectedError
from ..plugin.session import SessionPlugin
from ..proxy import Proxy as ... | ralphwetzel/theonionbox | theonionbox/tob/apps/controlcenter.py | Python | mit | 34,287 |
"""Take some of the labour out of building autoencoders/"""
| rikkhill/four-letter-words | helpers/autoencoder.py | Python | mit | 60 |
import logging
import importlib
_module_cache = {}
def get_module(module_type: str, module_id: str):
module_name = '{}.{}'.format(module_type.replace(' ', '_'), module_id.lower())
logging.debug('Searching for {} module {}...'.format(module_type, module_name))
try:
module = _module_cache[module_n... | einsfr/autoarchive | utils/module_import.py | Python | mit | 930 |