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 |
|---|---|---|---|---|---|
"""
Benchmarking and performance tests.
"""
import pytest
from pluggy import (_multicall, _legacymulticall, HookImpl, HookspecMarker,
HookimplMarker)
hookspec = HookspecMarker("example")
hookimpl = HookimplMarker("example")
def MC(methods, kwargs, callertype, firstresult=False):
hookfuncs = [... | UK992/servo | tests/wpt/web-platform-tests/tools/third_party/pluggy/testing/benchmark.py | Python | mpl-2.0 | 1,328 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import time
from openerp.osv import osv
from openerp.report import report_sxw
def titlize(journal_name):
words = journal_name.split()
while words.pop() != 'journal':
continue
return ' '.join(words)
... | vileopratama/vitech | src/addons/point_of_sale/report/pos_receipt.py | Python | mit | 2,154 |
import bench
from ucollections import namedtuple
T = namedtuple("Tup", ["num", "bar"])
def test(num):
t = T(20000000, 0)
i = 0
while i < t.num:
i += 1
bench.run(test)
| pozetroninc/micropython | tests/internal_bench/var-8-namedtuple-1st.py | Python | mit | 190 |
"""Python part of the warnings subsystem."""
# Note: function level imports should *not* be used
# in this module as it may cause import lock deadlock.
# See bug 683658.
import linecache
import sys
__all__ = ["warn", "showwarning", "formatwarning", "filterwarnings",
"resetwarnings", "catch_warnings"]
def... | dya2/python-for-android | python3-alpha/python3-src/Lib/warnings.py | Python | apache-2.0 | 13,836 |
import sys
from unicode_parse_common import *
# http://www.unicode.org/Public/5.1.0/ucd/Scripts.txt
script_to_harfbuzz = {
# This is the list of HB_Script_* at the time of writing
'Common': 'HB_Script_Common',
'Greek': 'HB_Script_Greek',
'Cyrillic': 'HB_Script_Cyrillic',
'Armenian': 'HB_Script_Armenian',
... | zcbenz/cefode-chromium | third_party/harfbuzz/contrib/tables/scripts-parse.py | Python | bsd-3-clause | 2,516 |
# Licensed to the Software Freedom Conservancy (SFC) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The SFC licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | jerome-jacob/selenium | py/test/selenium/webdriver/firefox/ff_select_support_class_tests.py | Python | apache-2.0 | 1,419 |
# Copyright 2013 IBM Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | denismakogon/trove-guestagent | trove_guestagent/openstack/common/rpc/serializer.py | Python | apache-2.0 | 1,600 |
# Generated by h2py from /usr/include/netinet/in.h
# Included from sys/feature_tests.h
# Included from sys/isa_defs.h
_CHAR_ALIGNMENT = 1
_SHORT_ALIGNMENT = 2
_INT_ALIGNMENT = 4
_LONG_ALIGNMENT = 8
_LONG_LONG_ALIGNMENT = 8
_DOUBLE_ALIGNMENT = 8
_LONG_DOUBLE_ALIGNMENT = 16
_POINTER_ALIGNMENT = 8
_MAX_ALIGNMENT = 16
_A... | xbmc/xbmc-antiquated | xbmc/lib/libPython/Python/Lib/plat-sunos5/IN.py | Python | gpl-2.0 | 28,151 |
from django import forms
from django.contrib import admin
from django.contrib.flatpages.models import FlatPage
from django.utils.translation import ugettext_lazy as _
class FlatpageForm(forms.ModelForm):
url = forms.RegexField(label=_("URL"), max_length=100, regex=r'^[-\w/]+$',
help_text = _("Example: '/a... | ychen820/microblog | y/google-cloud-sdk/platform/google_appengine/lib/django-1.2/django/contrib/flatpages/admin.py | Python | bsd-3-clause | 1,072 |
#-*- coding: utf-8 -*-
from reportlab.lib.colors import Color
from unittest import TestCase
from xhtml2pdf.util import getCoords, getColor, getSize, getFrameDimensions, \
getPos, getBox
from xhtml2pdf.tags import int_to_roman
class UtilsCoordTestCase(TestCase):
def test_getCoords_simple(self):
... | zenx/xhtml2pdf | tests/test_utils.py | Python | apache-2.0 | 8,136 |
import os
import re
import sys
from distutils import log
import xml.dom.pulldom
import shlex
import locale
import codecs
import unicodedata
import warnings
from setuptools.compat import unicode
from setuptools.py31compat import TemporaryDirectory
from xml.sax.saxutils import unescape
try:
import url... | cortext/crawtextV2 | ~/venvs/crawler/lib/python2.7/site-packages/setuptools/svn_utils.py | Python | mit | 18,879 |
# -*- coding: utf-8 -*-
"""
Copyright (C) 2012 Dariusz Suchojad <dsuch at zato.io>
Licensed under LGPLv3, see LICENSE.txt for terms and conditions.
"""
| ivaano/zato | code/zato-web-admin/test/zato/admin/web/views/__init__.py | Python | gpl-3.0 | 154 |
#!/usr/bin/env python
# Copyright (c) 2014 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Checks that msvs_system_include_dirs works.
"""
import TestGyp
import sys
if sys.platform == 'win32':
test = TestGyp.TestGyp(format... | ibc/MediaSoup | worker/deps/gyp/test/win/gyptest-system-include.py | Python | isc | 476 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# (c) 2014, Matt Martz <matt@sivel.net>
# (c) 2016, Justin Mayer <https://justinmayer.com/>
#
# This file is part of Ansible.
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Fre... | GustavoHennig/ansible | contrib/vault/vault-keyring.py | Python | gpl-3.0 | 3,430 |
import logging as log
import sys
import getopt
import os
import subprocess
import shutil
def RunCMake(workspace, target, platform):
# run CMake
print "\n==================================================\n"
returncode = 0
if platform == "windows":
print "Running: vcvarsall.bat x86_amd64 && " +... | Godin/coreclr | src/pal/automation/compile.py | Python | mit | 2,660 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | solintegra/addons | sale/wizard/sale_line_invoice.py | Python | agpl-3.0 | 6,126 |
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redi... | cherrishes/weilai | xingxing/protobuf/python/lib/Python3.4/google/protobuf/internal/enum_type_wrapper.py | Python | apache-2.0 | 3,554 |
from __future__ import absolute_import
from django.conf.urls import url
from . import views as test_views
urlpatterns = [
url(r'^no-logging$', test_views.MockNoLoggingView.as_view()),
url(r'^logging$', test_views.MockLoggingView.as_view()),
url(r'^slow-logging$', test_views.MockSlowLoggingView.as_view())... | frankie567/drf-tracking | tests/urls.py | Python | isc | 1,472 |
#!/usr/bin/env python3
from struct import pack, unpack
from datetime import date
from pathlib import Path
import os.path
import argparse
import sys
import re
configFilename = 'openmw.cfg'
configPaths = { 'linux': '~/.config/openmw',
'freebsd': '~/.config/openmw',
'darwin': '~/Libra... | jmelesky/omwllf | omwllf.py | Python | isc | 17,912 |
#!/bin/python3
import sys
def solve(a0, a1, a2, b0, b1, b2):
score = [0, 0]
alist = [a0, a1, a2]
blist = [b0, b1, b2]
clist = zip(alist, blist)
for pair in clist:
if pair[0] > pair[1]:
score[0] += 1
elif pair[0] < pair[1]:
score[1] += 1
else:
... | Krakn/learning | src/python/hackerrank/algorithms/compare_the_triplets/compare_the_triplets.py | Python | isc | 597 |
import os, re, traceback
from dirtree_node import get_file_info
from util import is_text_file
class SearchAborted(Exception):
pass
def null_filter(info):
return True
class Search(object):
def __init__(self, path, match, output, file_filter=null_filter, dir_filter=null_filter):
self.path = path
... | shaurz/devo | search.py | Python | mit | 3,549 |
#! /usr/bin/env python
class ParserError(Exception):
pass
class Sentence(object):
def __init__(self, subject, verb, object):
# remember we take ('noun', 'princess') tuples and convert them
self.subject = subject[1]
self.verb = verb[1]
self.object = object[1]
def get_sente... | pedrogideon7/spy_quest | parser.py | Python | mit | 1,938 |
"""Contains code for an FadeCandy hardware for RGB LEDs."""
from typing import List
import logging
import json
import struct
from mpf.core.utility_functions import Util
from mpf.platforms.openpixel import OpenPixelClient
from mpf.platforms.openpixel import OpenpixelHardwarePlatform
MYPY = False
if MYPY: # pragma: ... | missionpinball/mpf | mpf/platforms/fadecandy.py | Python | mit | 4,250 |
from setuptools import setup, find_packages
import os
import sys
# This monstrous hack is to support /etc generation for the Debian package
# with fpm.
if sys.argv[1] == 'install' and os.environ.get('JACQUARD_DEBIAN_HACK'):
def debian_etc_hack(root):
import pathlib
root_path = pathlib.Path(root)
... | prophile/jacquard | setup.py | Python | mit | 4,910 |
from operator import itemgetter
from typing import Optional, cast
from libsyntyche.widgets import HBoxLayout, Label, Stretch, mk_signal1
from PyQt5 import QtGui, QtWidgets
from PyQt5.QtCore import Qt
from ..common import Settings
class TagInfoList(QtWidgets.QScrollArea):
error = mk_signal1(str)
print_ = mk_... | nycz/sapfo | sapfo/index/taginfolist.py | Python | mit | 4,351 |
GnuXzPackage ('clutter', '1.10.6',
sources = [ 'http://source.clutter-project.org/sources/clutter/1.10/%{name}-%{version}.tar.xz' ],
)
| bl8/bockbuild | packages/clutter.py | Python | mit | 136 |
# -*- encoding: utf-8 -*-
import hashlib
import json
import os
import re
import magic
from perpetualfailure.db import session
from pyramid.authentication import (
Authenticated,
Everyone,
)
from pyramid.httpexceptions import (
HTTPException,
HTTPBadRequest,
HTTPFound,
HTTPNotFound,
HTTPForb... | 404d/Temporals-Web | temporals_web/gmod/views.py | Python | mit | 7,019 |
"""Functions for accessing HDF5 files."""
from __future__ import division
from __future__ import print_function
import re
import h5py as h5
import numpy as np
import six
from six.moves import range
from ..utils import filter_regex, to_list
def _ls(item, recursive=False, groups=False, level=0):
keys = []
i... | cangermueller/deepcpg | deepcpg/data/hdf.py | Python | mit | 6,707 |
"""
Link prediction algorithms.
"""
from math import log
import networkx as nx
from networkx.utils import not_implemented_for
__all__ = ['resource_allocation_index',
'jaccard_coefficient',
'adamic_adar_index',
'preferential_attachment',
'cn_soundarajan_hopcroft',
... | sserrot/champion_relationships | venv/Lib/site-packages/networkx/algorithms/link_prediction.py | Python | mit | 16,714 |
#!/usr/bin/env python3
# Copyright (c) 2014-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
def ge... | elysiumd/windows-wallet-13.2 | qa/rpc-tests/fundrawtransaction.py | Python | mit | 28,411 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-06-20 18:35
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('hamask', '0011_auto_20170615_1520'),
]
operations = [
migrations.AddField(
... | rawenihcam/BER-SERKR | hamask/migrations/0012_auto_20170620_1435.py | Python | mit | 780 |
import os
import requests
import json
import pandas as pd
import numpy as np
import time
from datetime import datetime
TMDB_KEY = "60027f35df522f00e57a79b9d3568423"
"""
def get_tmdb_id_list():
#function to get all Tmdb_id between 06-16
import requests
import json
# from year 1996-2016
year = ran... | andurilhuang/Movie_Income_Prediction | paper/historycode/toAnna/get_test.py | Python | mit | 1,236 |
"""Start a tcp gateway."""
import click
from mysensors.cli.helper import (
common_gateway_options,
handle_msg,
run_async_gateway,
run_gateway,
)
from mysensors.gateway_tcp import AsyncTCPGateway, TCPGateway
def common_tcp_options(func):
"""Supply common tcp gateway options."""
func = click.op... | theolind/pymysensors | mysensors/cli/gateway_tcp.py | Python | mit | 1,102 |
# -*- coding: utf-8 -*-
from double_linked import DoubleLinkedList
class Deque(object):
'''Deque is a composition of Double Linked List'''
def __init__(self, input=None):
'''create doubly linked list'''
self.deque = DoubleLinkedList(input)
def append(self, val):
self.deque.appen... | paulsheridan/data-structures | src/deque.py | Python | mit | 964 |
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
import numpy as np
import os
sourcefiles = [ 'fast_likelihood.pyx']
ext_modules = [Extension("fast_likelihood",
sourcefiles,
include_dirs = [np.get_inclu... | jeremy-ma/gmmmc | gmmmc/fastgmm/setup_fast_likelihood.py | Python | mit | 597 |
# -*- coding: utf-8 -*-
# Copyright (c) 2015, thumbor-community
# Use of this source code is governed by the MIT license that can be
# found in the LICENSE file.
from pyvows import Vows, expect
from tc_shortener.generators.short_generator import Generator
from tc_core.context import Context
from thumbor.config impo... | thumbor-community/shortener | vows/generators/short_generator_vows.py | Python | mit | 1,326 |
import mutable_attr
import unittest
class T(unittest.TestCase):
def test_foo(self):
mutable_attr.y = 3
| github/codeql | python/ql/test/query-tests/Imports/general/mutates_in_test.py | Python | mit | 117 |
"""This module contains a prototype implementation of the
TT-cross-based minimization procedure
"""
import numpy as np
import math
import tt
from ..maxvol import maxvol
from ..utils.rect_maxvol import rect_maxvol
def reshape(a, sz):
return np.reshape(a, sz, order = 'F')
def mkron(a, b):
return np.kron(a, b)
... | gasongjian/ttpy | tt/optimize/tt_min.py | Python | mit | 9,368 |
# coding: utf-8
"""
labeled_images文件夹中:
1. 包含的文件夹名为标记名
2. 标记名下的文件夹中包含了学习图片
"""
import os
from sklearn import svm
from PIL import Image
from numpy import array
from utils import *
clf = None
def get_image_fit_data(dir_name):
"""读取labeled_images文件夹的图片,返回图片的特征矩阵及相应标记"""
X = []
Y = []
... | mythkiven/python | demo/CET查询/learn_images.py | Python | mit | 1,312 |
# -*- coding: utf-8 -*-
from django.utils.translation import ugettext
from django.utils import simplejson as json
from django.conf import settings
from StringIO import StringIO
from gitdb import IStream
from git import *
from git.exc import InvalidGitRepositoryError
from collections import defaultdict
from datetime ... | 9h37/pompadour-wiki | pompadour_wiki/pompadour_wiki/apps/utils/git_db.py | Python | mit | 10,263 |
from __future__ import absolute_import, division, print_function, unicode_literals
import numpy as np
import pandas as pd
import matplotlib
matplotlib.use("TkAgg") # important to call this right after
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg
from matplotlib import style
i... | Auquan/auquan-toolbox-python | auquanToolbox/resultviewer.py | Python | mit | 13,093 |
# -*- coding: utf-8 -*-
"""Module providing base class migration for blog entry content"""
import lxml
from Acquisition import aq_inner
from Products.CMFCore.utils import getToolByName
from Products.Five.browser import BrowserView
from meetshaus.blog.blogpost import IBlogPost
from plone import api
from plone.portlets.i... | potzenheimer/meetshaus | src/meetshaus.blog/meetshaus/blog/browser/migration.py | Python | mit | 8,180 |
#!/usr/bin/python
################
# The MIT License (MIT)
#
# Copyright (c) <2013> <Martin de Bruyn>
#
# 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... | grimfang/quickShadows | src/game/input.py | Python | mit | 4,080 |
"""
WSGI config for cv project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_M... | cthtuf/django-cv | cv/wsgi.py | Python | mit | 381 |
import json
import math
__author__ = 'apostol3'
class Map:
def __init__(self, w, h):
self.max_time = 120
self.size = (w, h)
self.walls = []
self.headline = []
self.cars = []
self.finish = []
self.objects = []
self.car_size = (1.8/2, 4.6/2)
def ... | Apostol3/race_env_editor | map.py | Python | mit | 1,833 |
from gym import envs
print(envs.registry.all()) | GitYiheng/reinforcement_learning_test | test00_previous_files/gym_test5.py | Python | mit | 47 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Usuarios',
fields=[
('id', models.AutoField(ver... | diego-d5000/Estudiala | estudiala/estudiala/usuarios/migrations/0001_initial.py | Python | mit | 1,127 |
"""Settings that need to be set in order to run the tests."""
import os
DEBUG = True
SITE_ID = 1
DATABASES = {
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": ":memory:",
}
}
ROOT_URLCONF = 'linklist.tests.urls'
STATIC_URL = '/static/'
MEDIA_URL = '/media/'
STATIC_ROOT = os.pa... | bitmazk/django-linklist | linklist/tests/test_settings.py | Python | mit | 2,306 |
import _plotly_utils.basevalidators
class DeltaValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(self, plotly_name="delta", parent_name="indicator", **kwargs):
super(DeltaValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | plotly/python-api | packages/python/plotly/plotly/validators/indicator/_delta.py | Python | mit | 1,527 |
#!/usr/bin/env python
import json, time
from flask import Flask, request, render_template, Response
from gevent import pywsgi, monkey
from helpers.generateCalibration import GenerateCalibration
#monkey.patch_all()
app = Flask(__name__)
#cameraInstance = Camera()
runCalibration = GenerateCalibration('frames', 'calib... | 3299/visioninabox | server.py | Python | mit | 2,744 |
from .User import User
class Comment(object):
def __init__(self, commentData):
self.status = None
self.username_id = None
self.created_at_utc = None
self.created_at = None
self.bit_flags = None
self.user = None
self.comment = None
self.pk = None
... | danleyb2/Instagram-API | InstagramAPI/src/http/Response/Objects/Comment.py | Python | mit | 1,671 |
from django.contrib import messages
from django.db.models import Q
from django.http import Http404
from django.views.generic.detail import DetailView
from django.views.generic.list import ListView
from django.shortcuts import render, get_object_or_404, redirect
from django.utils import timezone
# Create your views he... | insta-code1/ecommerce | src/products/views.py | Python | mit | 3,661 |
from pathlib import Path
from subprocess import (PIPE, Popen)
import fnmatch
import shutil
import os
def test_distribute(tmp_path):
"""
Check that the scripts to compute a trajectory are generated correctly
"""
cmd1 = "distribute_jobs.py -i test/test_files/input_test_distribute_derivative_couplings.ym... | felipeZ/nonAdiabaticCoupling | test/test_distribute.py | Python | mit | 1,556 |
# This is just a simple example of how to inspect ASTs visually.
#
# This can be useful for developing new operators, etc.
import ast
from cosmic_ray.mutating import MutatingCore
from cosmic_ray.operators.comparison_operator_replacement import MutateComparisonOperator
code = "((x is not y) ^ (x is y))"
node = ast.par... | sixty-north/cosmic-ray | tools/inspector.py | Python | mit | 491 |
"""empty message
Revision ID: 399106d8a6ad
Revises: None
Create Date: 2015-03-06 03:55:19.157958
"""
# revision identifiers, used by Alembic.
revision = '399106d8a6ad'
down_revision = None
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please adjust! ###... | enixdark/im-r-e-d-i-s | flask-cook/migrations/versions/399106d8a6ad_.py | Python | mit | 1,071 |
# Hangman for real tho(t)
import random
def pickWord(words):
toReturn = random.choice(lol)
return toReturn
def drawHangman(parts):
if parts >= 1:
print(" O")
if parts >= 4:
print("/|\\")
elif parts >= 3:
print("/|")
elif parts >= 2:
print(" |")
if parts >= 6:
print("/ \\")
elif parts == 5:
prin... | daniLOLZ/variaRoba | Python/32.py | Python | mit | 1,364 |
#!/usr/bin/env python
# coding: UTF-8
from __future__ import division
import numpy as np
def left_multiplication(g, x):
"""
Multiplication action of a group and a vector.
"""
return np.dot(g, x)
def trans_adjoint(g, x):
return np.dot(np.dot(g,x),g.T)
class RungeKutta(object):
def __init__(... | olivierverdier/homogint | homogint/homogint.py | Python | mit | 1,957 |
__author__ = 'Fabrizio Lungo<fab@lungo.co.uk>'
import os
import yaml
from __exceptions__.FileNotFound import FileNotFound
from section import ConfigurationSection
class Configuration(ConfigurationSection):
def __init__(self, fn='config.yml', name=None, create=False):
self._fn = fn
self._create ... | flungo/python-yaml-config | lib/yamlconfig/config.py | Python | mit | 821 |
"""
Django settings for magnet project.
Generated by 'django-admin startproject' using Django 1.10.4.
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/
"""
import os
... | SeiryuZ/magnet | magnet/settings.py | Python | mit | 4,246 |
import torch
import torch.autograd as autograd
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
# Datos de Prueba
data = [("me gusta comer en la cafeteria".split(), "SPANISH"),
("Give it to me".split(), "ENGLISH"),
("No creo que sea una buena idea".split(), "SPANISH"),
... | josdaza/deep-toolbox | PyTorch/LogisticClassifier.py | Python | mit | 2,935 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# (c) 2014 Rajat Agarwal
import os, sys
import unittest
import sqoot
if 'PUBLIC_API_KEY' in os.environ and 'PRIVATE_API_KEY' in os.environ:
PUBLIC_API_KEY = os.environ['PUBLIC_API_KEY']
PRIVATE_API_KEY = os.environ['PRIVATE_API_KEY']
else:
try:
from _... | ragarwal6397/sqoot | sqoot/tests/__init__.py | Python | mit | 757 |
# $Id: TestWebDAVAccess.py 1047 2009-01-15 14:48:58Z graham $
#
# Unit testing for FileAccess module
#
import os
# Make sure python-kerberos package is installed
import kerberos
import sys
import httplib
import urllib2
import urllib2_kerberos
import re
import base64
import unittest
from urlparse import urlparse
sys.p... | bhavanaananda/DataStage | test/FileShare/tests/TestWebDAVAccess.py | Python | mit | 7,828 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2016-11-02 21:54
from __future__ import unicode_literals
from decimal import Decimal
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('round', '0013_plot_batch'),
]
operations = [
mi... | adminq80/Interactive_estimation | game/round/migrations/0014_auto_20161102_2154.py | Python | mit | 509 |
from office365.runtime.paths.service_operation import ServiceOperationPath
from office365.sharepoint.base_entity import BaseEntity
class Principal(BaseEntity):
"""Represents a user or group that can be assigned permissions to control security."""
@property
def id(self):
"""Gets a value that speci... | vgrem/Office365-REST-Python-Client | office365/sharepoint/principal/principal.py | Python | mit | 2,099 |
import csv
import os
import random
import svm_classifier
def get_classifier_filename(classifier_name):
dir_name = os.path.dirname(os.path.realpath(__file__))
return os.path.join(dir_name, 'classifiers', classifier_name + '.pkl')
def get_image_split(csv_filename, image_folder):
# Get image names and cla... | chinmayhegde/retinopathy-detection | retinopathy/helpers.py | Python | mit | 2,286 |
# Copyright (C) 2009 Ashley J. Wilson
# This software is licensed as described in the file COPYING in the root
# directory of this distribution.
from storenode import StoreNode
from bundlenode import BundleNode
from packagenode import PackageNode
class RootNode(StoreNode):
"""The virtual root of a Store repositor... | smashwilson/strac | strac/rootnode.py | Python | mit | 2,306 |
"""Add archived field to custom form
Revision ID: 391b3fa1471
Revises: 473f91b5874
Create Date: 2016-01-23 15:51:40.304025
"""
# revision identifiers, used by Alembic.
revision = '391b3fa1471'
down_revision = '473f91b5874'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
def upg... | viaict/viaduct | migrations/versions/2016_01_23_391b3fa1471_add_archived_field_to_custom_form.py | Python | mit | 1,019 |
import sys
import pigpio
import time
from colorama import Fore, Back, Style
def set_speed(lspeed, rspeed):
pi.hardware_PWM(left_servo_pin, 800, int(lspeed)*10000)
pi.hardware_PWM(right_servo_pin, 800, int(rspeed)*10000)
pi = pigpio.pi()
left_servo_pin = 13
right_servo_pin = 12
dead_pin = 17
die_distance = 8
... | yanadsl/ML-Autocar | test.py | Python | mit | 519 |
# Generated by Django 2.0.2 on 2018-03-13 02:52
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cc', '0003_auto_20180228_1145'),
]
operations = [
migrations.AlterField(
model_name='creditcard',
name='tail_no',
... | largetalk/tenbagger | capital/reactor/cc/migrations/0004_auto_20180313_1052.py | Python | mit | 386 |
from django.http import HttpResponse
from django.test import TestCase
from django.utils import unittest
from django.conf.urls import patterns
from rest_framework import permissions, status
try:
from rest_framework_oauth.authentication import OAuth2Authentication
except ImportError:
try:
from rest_frame... | coUrbanize/django-rest-framework-jwt | tests/test_authentication.py | Python | mit | 9,810 |
#!/usr/bin/env python
# -*- coding: ascii -*-
"""
package.module
~~~~~~~~~~~~~
A description which can be long and explain the complete
functionality of this module even with indented code examples.
Class/Function however should not be documented here.
:copyright: year by my name, see AUTHORS for more details
:licen... | EPiCS/soundgates | hardware/tools/to_rawdata.py | Python | mit | 1,000 |
from gensim.corpora import MmCorpus
from gensim.utils import unpickle
class MetaMmCorpusWrapper:
"""Wrapper which loads MM corpus with metadata."""
def __init__(self, filename):
self.corpus = MmCorpus(filename)
self.metadata = unpickle(filename + ".metadata.cpickle")
def __iter__(self):
... | vanam/clustering | clustering_system/corpus/MetaMmCorpusWrapper.py | Python | mit | 406 |
import pandas as pd
from pandas import DataFrame
from matplotlib import pyplot as plt
from matplotlib import style
style.use('ggplot')
df = pd.read_csv('sp500_ohlc.csv', index_col = 'Date', parse_dates=True)
#print df.head()
df['STD'] = pd.rolling_std(df['Close'], 25, min_periods=1)
ax1 = plt.subplot(2, 1, 1)
df[... | PythonProgramming/Pandas-Basics-with-2.7 | pandas 8 - Standard Deviation.py | Python | mit | 486 |
#
# ida_kernelcache/offset.py
# Brandon Azad
#
# Functions for converting and symbolicating offsets.
#
import re
import idc
import idautils
import ida_utilities as idau
import internal
import kernel
import stub
_log = idau.make_log(1, __name__)
def initialize_data_offsets():
"""Convert offsets in data segments... | bazad/ida_kernelcache | ida_kernelcache/offset.py | Python | mit | 4,124 |
#Final Exam Problem 4-2
import random, pylab
# You are given this function
def getMeanAndStd(X):
mean = sum(X)/float(len(X))
tot = 0.0
for x in X:
tot += (x - mean)**2
std = (tot/len(X))**0.5
return mean, std
# You are given this class
class Die(object):
def __init__(self, valList):
... | johntauber/MITx6.00.2x | Final/Final_P4_1and2.py | Python | mit | 2,453 |
from __future__ import unicode_literals
import six
from rbtools.utils.encoding import force_unicode
class APIError(Exception):
def __init__(self, http_status, error_code, rsp=None, *args, **kwargs):
Exception.__init__(self, *args, **kwargs)
self.http_status = http_status
self.error_code ... | reviewboard/rbtools | rbtools/api/errors.py | Python | mit | 1,777 |
"""Tool specific version checking to identify out of date dependencies.
This provides infrastructure to check version strings against installed
tools, enabling re-installation if a version doesn't match. This is a
lightweight way to avoid out of date dependencies.
"""
from __future__ import print_function
from distuti... | chapmanb/cloudbiolinux | cloudbio/custom/versioncheck.py | Python | mit | 2,864 |
from google.appengine.ext.webapp import template
from models.user import User
from models.page import Page
import webapp2
import json
class PageHandler(webapp2.RequestHandler):
def get(self, page_id):
template_params = {}
user = None
if self.request.cookies.get('session'):
user = User.checkToken(self.re... | racheliel/My-little-business | MyLittleBuisness/web/pages/page.py | Python | mit | 648 |
from django.conf.urls import patterns, include, url
from django.conf.urls.static import static
from django.conf import settings
from django.contrib import admin
from wagtail.wagtailadmin import urls as wagtailadmin_urls
from wagtail.wagtailsearch import urls as wagtailsearch_urls
from wagtail.wagtaildocs import urls a... | niceguydave/wagtail-cookiecutter-foundation | {{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/urls.py | Python | mit | 1,301 |
from __future__ import absolute_import
from unittest import TestCase
from plotly.graph_objs import (Data, Figure, Layout, Line, Margin, Marker,
Scatter, XAxis, YAxis)
class TestGetData(TestCase):
fig = None
def setUp(self):
super(TestGetData, self).setUp()
se... | ee-in/python-api | plotly/tests/test_core/test_graph_objs/test_get_data.py | Python | mit | 6,703 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.16 on 2019-02-18 11:36
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('basicviz', '0088_auto_20190218_1136'),
('motifdb',... | sdrogers/ms2ldaviz | ms2ldaviz/motifdb/migrations/0002_auto_20190218_1136.py | Python | mit | 1,323 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-05-26 15:47
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_depende... | ortutay/23andme-phenotypes-hackathon | my_app/my_app/migrations/0006_phenotype_user.py | Python | mit | 689 |
#!/usr/bin/env python
# Copyright (c) 2016, Daniel Liew
# This file is covered by the license in LICENSE-SVCB.txt
# vim: set sw=4 ts=4 softtabstop=4 expandtab:
"""
Read a result info describing a set of KLEE test case replays.
"""
from load_klee_runner import add_KleeRunner_to_module_search_path
from load_klee_analysis... | delcypher/klee-runner | tools/result-info-native-replay-summary.py | Python | mit | 3,311 |
from __future__ import unicode_literals
"""
product initialization stuff
"""
import os
import featuremonkey
from .composer import get_composer
from django_productline import compare_version
_product_selected = False
def select_product():
"""
binds the frozen context the selected features
should be cal... | henzk/django-productline | django_productline/startup.py | Python | mit | 2,282 |
"""
Nodes that use web services to do something.
"""
import json
import httplib2
import urllib
from BeautifulSoup import BeautifulSoup
from nodetree import node, exceptions
from . import base
from .. import stages
class WebServiceNodeError(exceptions.NodeError):
pass
class BaseWebService(node.Node, base.TextW... | mikesname/python-ocrlab | ocrsite/ocrlab/nodes/web.py | Python | mit | 3,561 |
from unittest import skip
from django.shortcuts import resolve_url as r
from django.test import TestCase
@skip
class BotViewTest(TestCase):
def setUp(self):
fake_message = {
'data': [{
'entry': [
{
'messaging': {
... | tyagow/FacebookBot | src/bot/tests_bot/test_view.py | Python | mit | 870 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import os
import StringIO
from pytest import raises
from aspen.website import Website
from aspen.http.response import Response
from aspen.exceptions import BadLocation
... | jaraco/aspen | tests/test_website.py | Python | mit | 14,886 |
###
# Copyright (c) 2013, Nicolas Coevoet
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditio... | ncoevoet/ChanReg | test.py | Python | mit | 1,737 |
from flask import render_template, flash, redirect, request, url_for, abort
from flask_login import login_user, logout_user, login_required, current_user
from . import loans
from forms import LoanApplicationForm, ApproveLoan, RepayLoan
from ..models import db
from ..models import Loan, User
from datetime import date
... | Kimanicodes/wananchi | app/loans/views.py | Python | mit | 4,187 |
import re
import click
from lancet.utils import hr
@click.command()
@click.argument("query", required=False)
@click.pass_obj
def projects(lancet, query):
"""List Harvest projects, optionally filtered with a regexp."""
projects = lancet.timer.projects()
if query:
regexp = re.compile(query, flags... | GaretJax/lancet | lancet/commands/harvest.py | Python | mit | 1,408 |
"""
VerseBot for Reddit
By Matthieu Grieger
Continued By Team VerseBot
response.py
Copyright (c) 2015 Matthieu Grieger (MIT License)
"""
MAXIMUM_MESSAGE_LENGTH = 4000
class Response:
""" Class that holds the properties and methods of a comment
response. """
def __init__(self, message, parser, link=None)... | Matthew-Arnold/slack-versebot | versebot/response.py | Python | mit | 5,650 |
#!/usr/bin/env python3
'''
Make a stream emit at the pace of a slower stream
Pros:
Introduce a delay between events in an otherwise rapid stream (like range)
Cons:
When the stream being delayed runs out of events to push, the zipped stream
will keep pushing events, defined with the lambda fn ... | Pysellus/streaming-api-test | rx-tests/rx-stream-pacing.py | Python | mit | 1,709 |
from __future__ import absolute_import
# encoding: UTF-8
from six import iteritems
from collections import defaultdict
from json import dumps
from ..config import CONFIG
class MissedKeys(object):
""" Object append missed key"""
def __init__(self, client):
self.client = client
self.key_folder =... | translationexchange/tml-python | tml/translation/missed.py | Python | mit | 1,569 |
# -*- coding: utf-8 -*-
# Scrapy settings for appstore project
#
# For simplicity, this file contains only the most important settings by
# default. All the other settings are documented here:
#
# http://doc.scrapy.org/en/latest/topics/settings.html
#
BOT_NAME = 'appstore'
SPIDER_MODULES = ['appstore.spiders']
N... | brucexiejiaming/App_store | part1_crawler/appstore/appstore/settings.py | Python | mit | 579 |
#!/bin/python3
import sys
n = int(input().strip())
arr = [int(arr_temp) for arr_temp in input().strip().split(' ')]
total = sum(arr)
print(total)
| costincaraivan/hackerrank | algorithms/warmup/python3/simple_array_sum.py | Python | mit | 149 |
import math
import sys
sys.path.append('..')
import Analyse.AFX as AFX
class State:
def __init__(self):
self.SenShifterState = True
self.MoodStrength = 1.0
self.positive = 0.0
self.negative = 0.0
def Process(self, score):
if self.SenShifterState is True:
self.positive += score
else:
self.negative ... | MyRookie/SentimentAnalyse | src/Algorithm/ScoreCaculating.py | Python | mit | 1,593 |
import _plotly_utils.basevalidators
class TokenValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(self, plotly_name="token", parent_name="area.stream", **kwargs):
super(TokenValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | plotly/python-api | packages/python/plotly/plotly/validators/area/stream/_token.py | Python | mit | 537 |
from django.shortcuts import render
from django.views.generic import View
from django.http import HttpResponseBadRequest
class GreetingsView(View):
template_name = 'greeting.html'
def get(self, request):
gender = request.GET.get('gender', None)
last_name = request.GET.get('last_name', None)
... | SergePhil/RSOI_2017 | WebAppOne/custom_views/GreetingsView.py | Python | mit | 800 |
print str(range(5,0,-3))[:5]
print len(range(5,0,-3))
print range(5,0,-3)[0]
print range(5,0,-3)[1]
print range(5,0,-3)[-1]
| ArcherSys/ArcherSys | skulpt/test/run/t152.py | Python | mit | 124 |
# # # # #
# MOVE THE NEWLY DOWNLOADED TAS / PR CMIP5 data from work desktop to /Shared
# # # # #
def move_new_dir( fn, output_dir ):
dirname, basename = os.path.split( fn )
elems = basename.split('.')[0].split( '_' )
variable, cmor_table, model, scenario, experiment, years = elems
new_dir = os.path.join( output_... | ua-snap/downscale | snap_scripts/epscor_sc/move_raw_cmip5_tas_pr.py | Python | mit | 1,039 |