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 -*-
import json
import sys
from importlib import import_module
from importlib.util import find_spec
from owlmixin import OwlMixin, TOption
from owlmixin.util import load_json
from jumeaux.addons.res2res import Res2ResExecutor
from jumeaux.logger import Logger
from jumeaux.models import Res2ResAddOn... | tadashi-aikawa/gemini | jumeaux/addons/res2res/json.py | Python | mit | 2,536 |
#!/usr/bin/env python
"""
Prototype to DOT (Graphviz) converter by Dario Gomez
Table format from django-extensions
"""
from protoExt.utils.utilsBase import Enum, getClassName
from protoExt.utils.utilsConvert import slugify2
class GraphModel():
def __init__(self):
self.tblStyle = False
... | DarioGT/docker-carra | src/prototype/actions/graphModel.py | Python | mit | 8,442 |
#!/usr/bin/python
import json
f = file('treasures.json', 'r')
try:
foo = json.load(f)
json_contents = foo
except ValueError:
json_contents = dict()
f.close()
print 'Type \'q\' to [q]uit'
while True:
name = raw_input('Treasure Name: ')
if name == 'q':
break
print 'Type \'n\' to stop e... | mosbasik/dotatreasures | create_treasures_json.py | Python | mit | 794 |
import json
from tornado import httpclient as hc
from tornado import gen
from graphite_beacon.handlers import LOGGER, AbstractHandler
class HipChatHandler(AbstractHandler):
name = 'hipchat'
# Default options
defaults = {
'url': 'https://api.hipchat.com',
'room': None,
'key': No... | klen/graphite-beacon | graphite_beacon/handlers/hipchat.py | Python | mit | 1,328 |
"""
Task description (in Estonian):
3. Maatriksi vähendamine (6p)
Kirjuta funktsioon vähenda, mis võtab argumendiks arvumaatriksi, milles ridu ja
veerge on paarisarv, ning tagastab uue maatriksi, milles on kaks korda vähem
ridu ja kaks korda vähem veerge, ja kus iga element on esialgse maatriksi nelja
elemendi keskmin... | macobo/python-grader | tasks/MTAT.03.100/2013/Midterm_1_resit/KT2_J1_vahenda_tester.py | Python | mit | 1,967 |
from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np
import xgboost as xgb
import argparse
from os import path
import os
from hyperopt import fmin, tpe, hp, STATUS_OK, Trials
from utils import *
import pi... | jingxiang-li/kaggle-yelp | model/level3_model.py | Python | mit | 5,368 |
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
from builtins import * # NOQA
from future import standard_library
standard_library.install_aliases() # NOQA
import chainer
from chainer import functions as F
from chain... | toslunar/chainerrl | tests/agents_tests/basetest_pgt.py | Python | mit | 3,966 |
import os
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'esite.settings')
import django
django.setup()
from auto.models import Car
#
def add_car(make, model, km, year, color, eng, drive,trans, icolor):
c = Car.objects.get_or_create(make=make, model=model, kilometers=km, year=year, color=color, engine_size=eng,... | vollov/django-template | django/esite/populate_auto.py | Python | mit | 2,560 |
import aioamqp
import asyncio
import umsgpack as msgpack
import logging
from functools import wraps
from uuid import uuid4
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
logger.addHandler(logging.StreamHandler())
class RemoteException(Exception):
pass
class Client(object):
def __init__(se... | jjacobson93/aiorpc | aiorpc/client.py | Python | mit | 3,036 |
def my_max(a, b):
if a > b:
return a
elif b > a:
return b
else:
return None
x = my_max(1, 2)
print x
print my_max(3, 2)
| Akagi201/learning-python | pyramid/Pyramid Web开发入门/2. Python语言基础/fun_return.py | Python | mit | 172 |
import pandas as pd
import pytest
from athletic_pandas.algorithms import heartrate_models
def test_heartrate_model():
heartrate = pd.Series(range(50))
power = pd.Series(range(0, 100, 2))
model, predictions = heartrate_models.heartrate_model(heartrate, power)
assert model.params['hr_rest'].value == ... | AartGoossens/athletic_pandas | tests/algorithms/test_heartrate_models.py | Python | mit | 701 |
#!/usr/bin/env python
__all__ = ['acfun_download']
from ..common import *
from .letv import letvcloud_download_by_vu
from .qq import qq_download_by_vid
from .sina import sina_download_by_vid
from .tudou import tudou_download_by_iid
from .youku import youku_download_by_vid
import json, re
def get_srt_json(id):
... | lilydjwg/you-get | src/you_get/extractors/acfun.py | Python | mit | 3,211 |
import math
from autoprotocol import UserError
from modules.utils import *
def transform(protocol, params):
# general parameters
constructs = params['constructs']
num_constructs = len(constructs)
plates = list(set([construct.container for construct in constructs]))
if len(plates) != 1:
ra... | dacarlin/TSkunkel | transform.py | Python | mit | 2,849 |
#!/usr/bin/env python3
##
# Copyright (c) 2007 Apple Inc.
#
# This is the MIT license. This software may also be distributed under the
# same terms as Python (the PSF license).
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "... | brainysmurf/xattr3 | xattr/tool.py | Python | mit | 6,510 |
# -*- coding: UTF-8 -*-
from datetime import datetime
from threading import Timer
from queue import Queue
import uuid
import logging
#Fallbacl for python < 3.3
try:
from time import perf_counter
except ImportError:
from time import clock as perf_counter
log = logging.getLogger(__name__)
class _Task:
_proc... | weddige/moneypenny | pywcl/scheduler/__init__.py | Python | mit | 3,088 |
# These tests are all based on the tutorial at http://killer-web-development.com/
# if registration is successful this may work but lets
# try and get user logged in first
from functional_tests import FunctionalTest, ROOT, USERS
import time
from selenium.webdriver.support.ui import WebDriverWait
class AddBasicAction... | NewGlobalStrategy/NetDecisionMaking | fts/test_addaction.py | Python | mit | 2,203 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2017-02-21 01:07
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('clients', '0002_contact'),
]
operations = [
migrations.AlterField(
... | fernandolobato/balarco | clients/migrations/0003_auto_20170221_0107.py | Python | mit | 804 |
#!/usr/bin/env python
from blob import Blob
from foreground_processor import ForegroundProcessor
import cv2
import operator
import rospy
from blob_detector.msg import Blob as BlobMsg
from blob_detector.msg import Blobs as BlobsMsg
import numpy as np
class BlobDetector(ForegroundProcessor):
def __init__(self, nod... | light-swarm/blob_detector | scripts/blob_detector_.py | Python | mit | 1,685 |
import ctypes
import numpy as np
import os
libpath = os.path.dirname(os.path.realpath(__file__))
lib = ctypes.cdll.LoadLibrary(libpath+'\libscatt_bg.so')
scatt_bg_c = lib.scatt_bg
scatt_bg_c.restype = ctypes.c_void_p # reset return types. default is c_int
scatt_bg_c.argtypes = [ctypes.c_double, ctypes.POINTER(ctypes.... | gromitsun/sim-xrf-py | others/scatt_bg/scatt_bg_c.py | Python | mit | 1,042 |
"""Tests for forms in eCommerce app."""
from django.test import TestCase
from ecommerce.forms import OrderForm
required_fields = {
'phone': '123456789',
'email': 'valid@email.ru',
}
invalid_form_email = {
'email': 'clearly!not_@_email',
'phone': '123456789'
}
no_phone = {'email': 'sss@sss.sss'}
cla... | fidals/refarm-site | tests/ecommerce/tests_forms.py | Python | mit | 1,163 |
## Automatically adapted for numpy.oldnumeric Apr 14, 2008 by -c
from builtins import range
def writeMeshMatlabFormat(mesh,meshFileBase):
"""
build array data structures for matlab finite element mesh representation
and write to a file to view and play with in matlatb
in matlab can then print mesh wi... | erdc/proteus | scripts/ppmatlab.py | Python | mit | 3,523 |
def test_root(client):
response = client.get('/')
assert response.status_code == 200
assert response.data.decode('utf-8') == 'Hey enlil'
| EliRibble/enlil | tests/api/test_root.py | Python | mit | 150 |
import os.path
from subprocess import call
class InstallerTools(object):
@staticmethod
def update_environment(file_path,environment_path):
update_file = open(file_path, 'r')
original_lines = update_file.readlines()
original_lines[0] = environment_path+'\n'
update_file.close()
update_file = open(file_path,... | femmerling/backyard | builder/installer_tools.py | Python | mit | 1,906 |
# coding: utf-8
import http.server
import socketserver
PORT = 8000
Handler = http.server.SimpleHTTPRequestHandler
httpd = socketserver.TCPServer(("0.0.0.0", PORT), Handler)
print("serving at port", PORT)
httpd.serve_forever() | telminov/raspberry-car | frontend/ui.py | Python | mit | 229 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'toolsforbiology.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^admin/', include(admin.site.urls)),
)
| washimimizuku/tools-for-biology | toolsforbiology/urls.py | Python | mit | 306 |
from django.conf import settings
from django.db import models
from .ticket import Ticket
class Attachment(models.Model):
"""Ticket attachment model."""
ticket = models.ForeignKey(
Ticket, blank=False, related_name='attachments', db_index=True,
on_delete=models.DO_NOTHING)
user = models.F... | occrp/id-backend | api_v3/models/attachment.py | Python | mit | 887 |
import unittest
from juggling.notation import siteswap
class SiteswapUtilsTests(unittest.TestCase):
def test_siteswap_char_to_int(self):
self.assertEqual(siteswap.siteswap_char_to_int('0'), 0)
self.assertEqual(siteswap.siteswap_char_to_int('1'), 1)
self.assertEqual(siteswap.siteswap_char_... | PacketPerception/pyjuggling | tests/siteswap_tests.py | Python | mit | 2,919 |
#!/usr/bin/env python
"""Run pytest with coverage and generate an html report."""
from sys import argv
from os import system as run
# To run a specific file with debug logging prints:
# py -3 -m pytest test_can.py --log-cli-format="%(asctime)s.%(msecs)d %(levelname)s: %(message)s (%(filename)s:%(lineno)d)" -... | cmcerove/pyvxl | pyvxl/tests/run.py | Python | mit | 884 |
from copy import deepcopy
class IModel():
def __init__(self):
self.list = []
def __getitem__(self, index):
'''
Getter for the [] operator
'''
if index >= len(self.list):
raise IndexError("Index out of range.")
return self.list[index]
def __seti... | Zephyrrus/ubb | YEAR 1/SEM1/FP/LAB/l6-l9/Domain/IModel.py | Python | mit | 1,500 |
#
# Copyright (C) 2011 - 2015 Satoru SATOH <ssato @ redhat.com>
# License: MIT
#
# Some XML modules may be missing and Base.{load,dumps}_impl are not overriden:
# pylint: disable=import-error
"""XML files parser backend, should be available always.
.. versionchanged:: 0.1.0
Added XML dump support.
- Format to supp... | pmquang/python-anyconfig | anyconfig/backend/xml.py | Python | mit | 6,370 |
"""
Hannah Aizenman
10/13/2013
Generates a random subset of size 10^P for p in [1,MAX_P) from [0, 10^8)
"""
import random
MAX_P = 8
max_value = 10**MAX_P
large_set = range(max_value)
for p in xrange(1,MAX_P):
print "list of size: 10^{0}".format(p)
f = open("p{0}.txt".format(p), 'w')
sample = random.samp... | story645/hpcc | set_partition/sets/gensets.py | Python | mit | 414 |
#!/usr/bin/env python
#
# $Id: get_code_stats.py 9318 2011-06-10 02:37:10Z nathan_george $
#
# Proprietary and confidential.
# Copyright $Date:: 2011#$ Perfect Search Corporation.
# All rights reserved.
#
import sys
import os
import re
import optparse
import math
buildscriptDir = os.path.dirname(__file__)
buildscriptDi... | perfectsearch/sandman | code/buildscripts/codescan/get_code_stats.py | Python | mit | 12,831 |
#==============================================================================
# Principles of the new `climlab` API design:
#
# * `climlab.Process` object has several iterable dictionaries of named,
# gridded variables:
#
# * `process.state`
#
# * state variables, usually time-dependent... | cjcardinale/climlab | climlab/process/process.py | Python | mit | 34,601 |
from debug_toolbar.panels.templates import TemplatesPanel as BaseTemplatesPanel
class TemplatesPanel(BaseTemplatesPanel):
def generate_stats(self, *args):
template = self.templates[0]['template']
if not hasattr(template, 'engine') and hasattr(template, 'backend'):
template.engine = tem... | grvty-labs/A1-136 | contrib/django_debug_toolbar/panels.py | Python | mit | 379 |
from django.shortcuts import render, get_object_or_404
# import the custom context processor
from vehicles.context_processor import global_context_processor
from vehicles.models import Vehicle, VehicleMake, Category
from settings.models import SliderImage
from django.core.paginator import Paginator, InvalidPage, Empty... | sitture/trade-motors | src/vehicles/views.py | Python | mit | 3,897 |
#!/usr/bin/env python2
# transpiled with BefunCompile v1.3.0 (c) 2017
import sys
import zlib, base64
_g = ("Ah+LCAAAAAAABACT7+ZgAAEWhre3/LNvG0iwP1i/yPTlUbXVqdvzlJoi+a3Lj8v6RJl1JZacmaK7/Otuf07ZXEnrN/zZZ+cdV4iexrfrz59Tftsevr0tcO7wz0oLK678"
+ "PLvaHVX/Lff8K6otFRbb/W/369X9D7+oMAiXlZWJlbEzGIQaM4yCUTAKRsEoGPzgnzcjw4w9ejJ3... | Mikescher/Project-Euler_Befunge | compiled/Python2/Euler_Problem-075.py | Python | mit | 4,387 |
# -*- coding: utf-8 -*-
__version__ = '0.8.0'
__author__ = 'Steven Loria'
__license__ = 'MIT'
from webargs.core import Arg, WebargsError, ValidationError, Missing
__all__ = ['Arg', 'WebargsError', 'ValidationError', 'Missing']
| jmcarp/webargs | webargs/__init__.py | Python | mit | 231 |
import numpy
import numpy.linalg
def training(inputs, minvar=0.1):
"""Trains a naive-bayes classifier using inputs
Returns means and variances of the classifiers
"""
return numpy.mean(inputs, axis=0), numpy.maximum(minvar, numpy.var(inputs, axis=0))
def gaussian(input, mu, sigma2):
"""Calculates ... | pymir3/pymir3 | mir3/lib/naive_bayes.py | Python | mit | 1,643 |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.home),
url(r'^interviewer/$', views.interviewer),
url(r'^candidate/$', views.candidate),
]
| VRSandeep/icrs | website/urls.py | Python | mit | 191 |
# Created: 16.03.2011, 2018 rewritten for pytest
# Copyright (C) 2011-2019, Manfred Moitzi
# License: MIT License
import pytest
from ezdxf.entities.appid import AppID
@pytest.fixture
def appid():
return AppID.new(
"FFFF",
dxfattribs={
"name": "EZDXF",
},
)
def test_name(... | mozman/ezdxf | tests/test_01_dxf_entities/test_118_appid_table_entry.py | Python | mit | 365 |
# Download the Python helper library from twilio.com/docs/python/install
import os
from twilio.rest import Client
# Your Account Sid and Auth Token from twilio.com/user/account
# To set up environmental variables, see http://twil.io/secure
account = os.environ['TWILIO_ACCOUNT_SID']
token = os.environ['TWILIO_AUTH_TOKE... | TwilioDevEd/api-snippets | ip-messaging/rest/roles/update-role/update-role.6.x.py | Python | mit | 644 |
# views are handlers that respond to requests from web browsers or other clients
# Each view function maps to one or more request URLs
from flask import render_template, flash, redirect
from app import app
from .forms import Deck
#./run.py
@app.route('/submit', methods=('GET', 'POST'))
def submit():
form = Deck()
i... | ecotg/Flash-Card-App | app/views.py | Python | mit | 1,100 |
# -*- coding: utf-8 -*-
"""
rio.blueprints.api_1
~~~~~~~~~~~~~~~~~~~~~
"""
from flask import Blueprint
bp = Blueprint('api_1', __name__)
| soasme/rio | rio/blueprints/api_1.py | Python | mit | 139 |
import math
from ..df import DocumentFrequencyVectorCreator
from . import InverseDocumentFrequencyVector
class InverseDocumentFrequencyVectorCreator(DocumentFrequencyVectorCreator):
"""Creates inverse-document-frequency vectors
Inherits from :class:`recommender.vector.abstractvector.VectorCreator`
:par... | dustywind/bachelor-thesis | impl/recommender/vector/idf/inversedocumentfrequencyvectorcreator.py | Python | mit | 2,882 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from scripts.db_api import accident
def usa_query(hour):
return '''
SELECT count(*), (select count(*) from accident
join vehicle on(acc_id = accident.id)
where country = 'USA'
and vehicle.speed > accident.speed_limit
and vehicle.speed > -1
and acciden... | lopiola/integracja_wypadki | scripts/statistics/speed_limit_exceeded_by_hour.py | Python | mit | 817 |
# noinspection PyMethodMayBeStatic
class TestDevice:
def __init__(self, cf):
self.type = cf.get('device_test_type', 'test')
self.host = ('test', 80)
self.mac = [1, 2, 3, 4, 5, 6]
def auth(self):
pass
# RM2/RM4
def check_temperature(self):
return 23.5
# RM4
... | eschava/broadlink-mqtt | test.py | Python | mit | 1,269 |
import os
import stat
import socket
import paramiko
from transfert.statresult import stat_result
from transfert.resources._resource import _Resource
from transfert.exceptions import TransfertFileExistsError, TransfertFileNotFoundError
class SftpResource(_Resource):
KNOW_HOSt_FILE = '~/.ssh/known_hosts'
GSS_A... | rbernand/transfert | transfert/resources/sftp.py | Python | mit | 4,113 |
import unittest
import numpy as np
from collections import Counter
from diogenes.utils import remove_cols,cast_list_of_list_to_sa
import utils_for_tests
import unittest
import numpy as np
from numpy.random import rand
import diogenes.read
import diogenes.utils
from diogenes.modify import remove_cols_where
from diog... | jamestwhedbee/diogenes | tests/test_modify.py | Python | mit | 8,979 |
# Copyright (c) 2015 Tanium Inc
#
# Generated from console.wsdl version 0.0.1
#
#
from .base import BaseType
class SavedActionApproval(BaseType):
_soap_tag = 'saved_action_approval'
def __init__(self):
BaseType.__init__(
self,
simple_properties={'id': int,
... | tanium/pytan | lib/taniumpy/object_types/saved_action_approval.py | Python | mit | 654 |
import unittest
import os
from os.path import dirname
import sys
import json
from rtree import index
from . import ROOT
from geotweet.mapreduce.utils.lookup import project, SpatialLookup
testdata = os.path.join(dirname(os.path.abspath(__file__)), 'testdata')
def read(geojson):
return json.loads(open(os.path.joi... | meyersj/geotweet | geotweet/tests/unit/mapreduce/utils/lookup_tests.py | Python | mit | 3,949 |
#!/usr/local/bin/python3
# This work is licensed under the Creative Commons Attribution 3.0 United
# States License. To view a copy of this license, visit
# http://creativecommons.org/licenses/by/3.0/us/ or send a letter to Creative
# Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
# f... | ohnorobo/pokemon | transparent.py | Python | mit | 1,475 |
# coding: utf-8
"""
Fields represent CronTrigger options which map to :class:`~datetime.datetime`
fields.
"""
from calendar import monthrange
from apscheduler.triggers.cron.expressions import (
AllExpression, RangeExpression, WeekdayPositionExpression, LastDayOfMonthExpression, WeekdayRangeExpression)
__all__ =... | cychenyin/windmill | apscheduler/triggers/cron/fields.py | Python | mit | 3,059 |
from django.utils.translation import ugettext_lazy as _
from reviewboard.admin.read_only import is_site_read_only_for
from reviewboard.reviews.actions import (BaseReviewRequestAction,
BaseReviewRequestMenuAction)
from reviewboard.reviews.features import general_comments_feature... | reviewboard/reviewboard | reviewboard/reviews/default_actions.py | Python | mit | 9,922 |
#!/usr/bin/env python
"""
Retrieves menu from Drupal site
"""
from aashestrap.models import Menu
from django.core.management.base import BaseCommand
import urllib2
from django.http import HttpResponse
from BeautifulSoup import BeautifulSoup
from django.core.exceptions import ObjectDoesNotExist
class Command(BaseC... | AASHE/django-aashestrap | aashestrap/management/commands/get_menu.py | Python | mit | 1,101 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.apps import AppConfig
class FileuploadConfig(AppConfig):
name = 'fileupload'
| pcecconi/mapground | fileupload/apps.py | Python | mit | 160 |
"""
Django settings for blog project.
Generated by 'django-admin startproject' using Django 1.9.
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
# Buil... | Dingo5733/djangoblog19 | src/trydjango19/settings.py | Python | mit | 3,453 |
import cPickle
import logging
import numpy
import os
import time
from collections import deque
from copy import deepcopy
from datetime import datetime
from pytz import timezone
from threading import Event, Thread
from coinbase.wallet.client import Client
from jarvis.utils.messaging.client import TwilioMessenger
from ... | kahuang/jarvis | jarvis/modules/coinbase/watcher.py | Python | mit | 8,706 |
#!/usr/bin/env python
def NUMBER(value):
return ("NUMBER", value)
def NAME(value):
return ("NAME", value)
def SYMBOL(value):
return ("SYMBOL", value)
def SEMICOLON():
return ("SEMICOLON", )
def OPENPAREN():
return ("OPENPAREN", )
def CLOSEPAREN():
return ("CLOSEPAREN", )
def OPENBR... | rumblesan/diddy-vm | puff/tokens.py | Python | mit | 598 |
# coding: utf-8
"""
Talon.One API
The Talon.One API is used to manage applications and campaigns, as well as to integrate with your application. The operations in the _Integration API_ section are used to integrate with our platform, while the other operations are used to manage applications and campaigns. #... | talon-one/talon_one.py | test/test_update_loyalty_program.py | Python | mit | 2,231 |
import os
import re
from . import utils
PARTIAL = re.compile('(?P<tag>{{>\s*(?P<name>.+?)\s*}})')
PARTIAL_CUSTOM = re.compile('^(?P<whitespace>\s*)(?P<tag>{{>\s*(?P<name>.+?)\s*}}(?(1)\r?\n?))', re.M)
# def get_template(path, ext='html', partials=None):
# path = os.path.join(TEMPLATES_DIR, '{}.{}'.format(path, ... | mylokin/mustache | mustache/template.py | Python | mit | 1,242 |
import socket as sk
from kivy.logger import Logger
def getWebsite():
return "www.google.com"
def getIpPort():
sock_info=sk.getaddrinfo(getWebsite(),80,proto=sk.IPPROTO_TCP)
return sock_info[0][-1]
def checkInternet():
sock=sk.socket()
sock.settimeout(1)
try:
sock.connect(getIpPort())
... | udaykrishna/unCap | checks.py | Python | mit | 1,028 |
# Copyright 2014 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file acc... | mnahm5/django-estore | Lib/site-packages/awscli/customizations/emr/ssh.py | Python | mit | 7,731 |
from __future__ import absolute_import
from __future__ import unicode_literals
import io
import os.path
import sqlite3
import mock
import pytest
import six
from pre_commit.store import _get_default_directory
from pre_commit.store import Store
from pre_commit.util import cmd_output
from pre_commit.util import cwd
fro... | Lucas-C/pre-commit | tests/store_test.py | Python | mit | 5,138 |
# -*- coding: utf-8 -*-
import sys, logging
import numpy as np
from math import ceil
from gseapy.stats import multiple_testing_correction
from joblib import delayed, Parallel
def enrichment_score(gene_list, correl_vector, gene_set, weighted_score_type=1,
nperm=1000, seed=None, single=False, sca... | BioNinja/gseapy | gseapy/algorithm.py | Python | mit | 31,007 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import csv
from collections import (
defaultdict as dd,
OrderedDict as od
)
from math import log
import datetime
from flask import (
Flask,
render_template,
g,
request,
redirect,
url_for,
send_from_directory,
flash,
j... | globalwordnet/OMW | omw/__init__.py | Python | mit | 35,734 |
from datetime import timedelta
import logging
from django.utils.timezone import now
from django.core.management.base import BaseCommand
from TWLight.users.models import Editor
from TWLight.users.helpers.editor_data import (
editor_global_userinfo,
editor_valid,
editor_enough_edits,
editor_not_blocked,
... | WikipediaLibrary/TWLight | TWLight/users/management/commands/user_update_eligibility.py | Python | mit | 5,266 |
# -*- coding: utf-8 -*-
import os
import shutil
from jinja2 import Environment, FileSystemLoader
from webassets import Environment as AssetsEnvironment
from webassets.ext.jinja2 import AssetsExtension
from webassets.loaders import YAMLLoader
class TemplateBuilder(object):
def __init__(self, path, output,
... | regadas/presstatic | presstatic/builder.py | Python | mit | 3,269 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import string
from time import strftime
def append_new_end(word,user_end):
space_count = word.count('~') # count number of placeholders
if space_count > 0:
total_word = word[:-space_count] + user_end # supplied from raw input
else:
total_word = word
return t... | kekeller/german_endings | analyze_data/user_input.py | Python | mit | 1,854 |
#!/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/Platform.py | Python | mit | 2,185 |
"""Run Monte Carlo simulations."""
from joblib import Parallel, delayed
from frbpoppy import Survey, CosmicPopulation, SurveyPopulation, pprint
from datetime import datetime
from copy import deepcopy
from glob import glob
import frbpoppy.paths
import os
import numpy as np
import pandas as pd
from tqdm import tqdm
impo... | davidgardenier/frbpoppy | tests/monte_carlo/simulations.py | Python | mit | 14,711 |
try: from setuptools import setup
except: from distutils.core import setup
setup( long_description=open("README.rst").read(),
name="""tinypath""",
license="""MIT""",
author="""Karim Bahgat""",
author_email="""karim.bahgat.norway@gmail.com""",
py_modules=['tinypath'],
url="""http://github.com/karimbahgat/tinypat... | karimbahgat/TinyPath | setup.py | Python | mit | 816 |
from south.db import db
from django.db import models
from askmeanything.models import *
class Migration:
def forwards(self, orm):
"Write your forwards migration here"
def backwards(self, orm):
"Write your backwards migration here"
models = {
'askmeanything.... | MidwestCommunications/django-askmeanything | askmeanything/migrations/0004_rmpub.py | Python | mit | 4,171 |
import os
from shutil import copyfile
from photomanip.metadata import ImageExif, SetExifTool
from nose import tools
ORIGINAL_IMAGE_FILENAME = 'photomanip/tests/turd_ferguson.jpeg'
TEST_IMAGE_FILENAME = 'photomanip/tests/image_exif_test.jpg'
ORIGINAL_PHOTO_FILENAME = 'photomanip/tests/test_photo_0.jpg'
TEST_PHOTO_01... | whlteXbread/photoManip | photomanip/tests/test_metadata.py | Python | mit | 3,503 |
__author__ = 'jhala'
import types
import os.path, time
import json
import logging
import logging.config
logging.config.fileConfig('logging.conf')
logger = logging.getLogger(__name__)
import re
appInfo='appinfo.json'
''' Helper Functions '''
''' get the file as an array of arrays ( header + rows and columns) '''
def... | dbk138/ImageRegionRecognition-FrontEnd | app/python - Copy/Helpers.py | Python | mit | 4,339 |
from django.contrib.sites.models import Site
from django.utils._os import safe_join
from django.views.generic import TemplateView
from skin.conf import settings
from skin.template.loaders.util import get_site_skin
class TemplateSkinView(TemplateView):
"""
A view that extends Djangos base TemplateView to allo... | dwatkinsweb/django-skin | skin/views/views.py | Python | mit | 1,288 |
from direct.directnotify.DirectNotifyGlobal import *
from otp.ai.AIBaseGlobal import *
from toontown.building import DistributedBuildingAI
from toontown.building import GagshopBuildingAI
from toontown.building import HQBuildingAI
from toontown.building import KartShopBuildingAI
from toontown.building import PetshopBuil... | ToonTownInfiniteRepo/ToontownInfinite | toontown/building/DistributedBuildingMgrAI.py | Python | mit | 9,120 |
#!/usr/bin/python3
__author__ = 'ivan.shynkarenka'
import argparse
from TTWebClient.TickTraderWebClient import TickTraderWebClient
def main():
parser = argparse.ArgumentParser(description='TickTrader Web API sample')
parser.add_argument('web_api_address', help='TickTrader Web API address')
args = parser... | SoftFx/TTWebClient-Python | TTWebClientSample/public_currencies.py | Python | mit | 796 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-04-17 17:14
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import spectator.core.fields
class Migration(migrations.Migration):
initial = True
dependencies = [
("spectator_co... | philgyford/django-spectator | spectator/reading/migrations/0001_initial.py | Python | mit | 10,589 |
# - Coding UTF8 -
#
# Networked Decision Making
# Site: http://code.google.com/p/global-decision-making-system/
#
# License Code: GPL, General Public License v. 2.0
# License Content: Creative Commons Attribution 3.0
#
# Also visit: www.web2py.com
# or Groups: http://groups.google.com/group/web2py
# For d... | NewGlobalStrategy/NetDecisionMaking | models/0.py | Python | mit | 1,624 |
#! /usr/bin/python
import bottle
import settings
from controller import admin as admin_controller
from controller import email as email_controller
app = application = bottle.Bottle()
# Base url for regular users
app.route(settings.BASEPATH, 'GET', admin_controller.index)
app.route(settings.BASEPATH + '/', 'GET', adm... | TeachBoost/ansible | ansible.py | Python | mit | 1,499 |
import vk
import json
from sentiment_classifiers import SentimentClassifier, binary_dict, files
class VkFeatureProvider(object):
def __init__(self):
self._vk_api = vk.API(vk.Session())
self._vk_delay = 0.3
self._clf = SentimentClassifier(files['binary_goods'], binary_dict)
def _vk_grac... | ArtemMIPT/sentiment_analysis | vk_parser.py | Python | mit | 2,902 |
# flake8: noqa
"""Settings to be used for running tests."""
from settings import *
INSTALLED_APPS.append('integration_tests')
DATABASES = {
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": ":memory:",
}
}
EMAIL_SUBJECT_PREFIX = '[test] '
EMAIL_BACKEND = 'django.core.mail.backend... | bitmazk/webfaction-django-boilerplate | website/webapps/django/project/settings/test_settings.py | Python | mit | 371 |
import sublime, sublime_plugin, re
class EmmetCssFromOneLineCommand(sublime_plugin.TextCommand):
def run(self, edit):
view = self.view
line_region = view.line(view.sel()[0])
line_str = view.substr(line_region)
left_padding = re.findall(r'^(\s+)', line_str)[0]
... | kakRostropovich/EmmetOneLine | emmet_css_from_one_line.py | Python | mit | 908 |
# 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/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/models/__init__.py | Python | mit | 1,545 |
# -*- coding: utf-8 -*-
"""
https://mitpress.mit.edu/sicp/full-text/book/book-Z-H-16.html#%_thm_2.60
"""
from Chapter2.themes.lisp_list_structured_data import car, cdr, cons, lisp_list, nil, print_lisp_list
from Chapter2.themes.sequences_as_conventional_interfaces import accumulate
def element_of_set(x, set):
"""... | aoyono/sicpy | Chapter2/exercises/exercise2_60.py | Python | mit | 3,259 |
""" You've recently read "The Gold-Bug" by Edgar Allan Poe, and was so impressed by the cryptogram in it that
decided to try and decipher an encrypted text yourself. You asked your friend to encode a piece of text using
a substitution cipher, and now have an encryptedText that you'd like to decipher.
The encryption ... | ntthuy11/CodeFights | Arcade/04_Python/07_CaravanOfCollections/frequencyAnalysis.py | Python | mit | 1,131 |
# Requires trailing commas in Py2 but syntax error in Py3k
def True(
foo
):
True(
foo
)
def False(
foo
):
False(
foo
)
def None(
foo
):
None(
foo
)
def nonlocal (
foo
):
nonlocal(
foo
)
| zedlander/flake8-commas | test/data/keyword_before_parenth_form/py2_bad.py | Python | mit | 273 |
import tensorflow as tf
from tensorflow.contrib import slim as slim
from avb.ops import *
import math
def encoder(x, config, is_training=True):
df_dim = config['df_dim']
z_dim = config['z_dim']
a_dim = config['iaf_a_dim']
# Center x at 0
x = 2*x - 1
net = flatten_spatial(x)
net = slim.ful... | LMescheder/AdversarialVariationalBayes | avb/iaf/models/full0.py | Python | mit | 698 |
# -*- coding: UTF-8 -*-
import sys
sys.path.append("./")
import pandas as pd
import gensim
from utility.mongodb import MongoDBManager
from utility.sentence import segment, sent2vec
class Doc2Vector(object):
"""
文本转向量
"""
def __init__(self):
"""
:param keep_val: 设定的阈值
"""
... | jarvisqi/learn_python | flaskweb/core/doc2vector.py | Python | mit | 1,476 |
from __future__ import unicode_literals
from future.builtins import int
from collections import defaultdict
from django.core.urlresolvers import reverse
from django.template.defaultfilters import linebreaksbr, urlize
from mezzanine import template
from mezzanine.conf import settings
from mezzanine.generic.forms impo... | aptuz/mezzanine_onepage_theme | one_page/customapp/templatetags/testtag.py | Python | mit | 1,240 |
import _plotly_utils.basevalidators
class ComputedValidator(_plotly_utils.basevalidators.AnyValidator):
def __init__(self, plotly_name="computed", parent_name="layout", **kwargs):
super(ComputedValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | plotly/plotly.py | packages/python/plotly/plotly/validators/layout/_computed.py | Python | mit | 395 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
""" sysdiag
Pierre Haessig — September 2013
"""
from __future__ import division, print_function
def _create_name(name_list, base):
'''Returns a name (str) built on `base` that doesn't exist in `name_list`.
Useful for automatic creation of subsystems or wires
... | pierre-haessig/sysdiag | sysdiag.py | Python | mit | 21,428 |
import _plotly_utils.basevalidators
class HoverlabelValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(self, plotly_name="hoverlabel", parent_name="sankey", **kwargs):
super(HoverlabelValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | plotly/python-api | packages/python/plotly/plotly/validators/sankey/_hoverlabel.py | Python | mit | 2,055 |
import ConfigParser
import os
import sys
import utils
## Create global names and functions ##
# Load file locations and configuration options
site_list_location = os.path.dirname(__file__) + '/sitelist.txt'
parser = ConfigParser.RawConfigParser()
parser.read(os.path.dirname(__file__) + '/config.cfg')
general = dict... | christianrenier/dynamic-dns-updater | __main__.py | Python | mit | 3,280 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#important: before running this demo, make certain that you import the library
#'paho.mqtt.client' into python (https://pypi.python.org/pypi/paho-mqtt)
#also make certain that ATT_IOT is in the same directory as this script.
import traceback ... | ATT-JBO/RPICameraRemote | RPICamera/RPICamera/RPICameraRemote.py | Python | mit | 7,821 |
from time import sleep
import unittest2 as unittest
from tweepy.api import API
from tweepy.auth import OAuthHandler
from tweepy.models import Status
from tweepy.streaming import Stream, StreamListener
from config import create_auth
from test_utils import mock_tweet
from mock import MagicMock, patch
class MockStreamL... | dnr2/fml-twitter | tweepy-master/tests/test_streaming.py | Python | mit | 4,635 |
import sys, math, os
import matplotlib.pyplot as plt
def main():
# Check that there's at least one argument
if len(sys.argv) < 2:
print("Usage python {} <file1> [<file2> ...]".format(sys.argv[0]))
return 1
# Automatically detect if decayed
if "decayed" in sys.argv[1]:
plotD... | AndresYague/Snuppat | output/figuresAndTables/finalGraph.py | Python | mit | 7,072 |
#http://codeforces.com/problemset/problem/71/A
T = int(raw_input())
while(not T == 0):
word = str(raw_input())
if len(word)>10:
print word[0]+str(len(word[1:len(word)-1]))+word[len(word)-1]
else:
print word
T-=1
| creativcoder/AlgorithmicProblems | codeforces/long_words.py | Python | mit | 227 |
# -*- coding: utf-8 -*-
# Scrapy settings for aCloudGuru project
#
# For simplicity, this file contains only settings considered important or
# commonly used. You can find more settings consulting the documentation:
#
# http://doc.scrapy.org/en/latest/topics/settings.html
# http://scrapy.readthedocs.org/en/lat... | miztiik/scrapy-Demos | aCloudGuru/aCloudGuru/settings.py | Python | mit | 3,160 |
import asyncio
import functools
import random
import time
from testing import Client
from testing import default_test_setup
from testing import gen_data
from testing import gen_points
from testing import gen_series
from testing import InsertError
from testing import PoolError
from testing import QueryError
from testing... | transceptor-technology/siridb-server | itest/test_compression.py | Python | mit | 3,689 |