code stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 226 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k |
|---|---|---|---|---|---|
from __future__ import unicode_literals
try:
import unittest2 as unittest
except ImportError:
import unittest
from rpaths import unicode, PY3, AbstractPath, PosixPath, WindowsPath
class TestAbstract(unittest.TestCase):
def test_construct(self):
"""Tests building an AbstractPath."""
with ... | remram44/rpaths | tests/test_abstract.py | Python | bsd-3-clause | 15,818 |
import unittest
from exporters.readers.base_reader import BaseReader
from exporters.readers.random_reader import RandomReader
from .utils import meta
class BaseReaderTest(unittest.TestCase):
def setUp(self):
self.reader = BaseReader({}, meta())
def test_get_next_batch_not_implemented(self):
... | scrapinghub/exporters | tests/test_readers.py | Python | bsd-3-clause | 2,129 |
"""Accessors for Amber TI datasets.
"""
from os.path import dirname, join
from glob import glob
from .. import Bunch
def load_bace_improper():
"""Load Amber Bace improper solvated vdw example
Returns
-------
data: Bunch
Dictionary-like object, the interesting attributes are:
- 'd... | alchemistry/alchemtest | src/alchemtest/amber/access.py | Python | bsd-3-clause | 3,102 |
import sys
from django.core.management.base import BaseCommand
from ietf.community.constants import SIGNIFICANT_STATES
from ietf.community.models import DocumentChangeDates
from ietf.doc.models import Document
class Command(BaseCommand):
help = (u"Update drafts in community lists by reviewing their rules")
... | wpjesus/codematch | ietf/community/management/commands/update_doc_change_dates.py | Python | bsd-3-clause | 1,440 |
"""
Utilities and helper functions
"""
def get_object_or_none(model, **kwargs):
try:
return model.objects.get(**kwargs)
except model.DoesNotExist:
return None | chhantyal/exchange | uhura/exchange/utils.py | Python | bsd-3-clause | 183 |
""" Utility module to determine the OS Python running on
--------------------------------------------------------------------------
File: utilsOsType.py
Overview: Python module to supply functions and an enumeration to
help determine the platform type, bit size and OS cur... | youtube/cobalt | third_party/llvm-project/lldb/scripts/utilsOsType.py | Python | bsd-3-clause | 3,130 |
#!/usr/bin/env python2
from taptaptap.proc import plan, ok, not_ok, out
plan(first=1, last=13)
ok('Starting the program')
ok('Starting the engine')
ok('Find the object')
ok('Grab it', todo=True)
ok('Use it', todo=True)
2 * 2 == 4 and ok('2 * 2 == 4') or not_ok('2 * 2 != 4')
out()
## validity: -1
## ok testc... | meisterluk/taptaptap | tests/proc_005.py | Python | bsd-3-clause | 472 |
import logging
import matplotlib as mpl
from .tools import get_figure_size
_logger = logging.getLogger("mpl_settings")
orig_settings = {**mpl.rcParams}
latex_settings = {
# change this if using contex, xetex or lualatex
"pgf.texsystem": "pdflatex",
# use LaTeX to write all text
"text.usetex": True,
... | cklb/PyMoskito | pymoskito/mpl_settings.py | Python | bsd-3-clause | 1,697 |
{% if cookiecutter.use_celery == 'y' %}
import os
from celery import Celery
from django.apps import apps, AppConfig
from django.conf import settings
if not settings.configured:
# set the default Django settings module for the 'celery' program.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings.l... | asyncee/cookiecutter-django | {{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/taskapp/celery.py | Python | bsd-3-clause | 1,701 |
import numpy as np
def multiprod(A, B):
"""
Inspired by MATLAB multiprod function by Paolo de Leva. A and B are
assumed to be arrays containing M matrices, that is, A and B have
dimensions A: (M, N, P), B:(M, P, Q). multiprod multiplies each matrix
in A with the corresponding matrix in B, using ma... | tingelst/pymanopt | pymanopt/tools/multi.py | Python | bsd-3-clause | 2,443 |
import os
import sys
import json
import time
import numpy
import dendropy
from collections import defaultdict
import pdb
def parse_site_rates(rate_file, correction = 1, test = False, count = 0):
"""Parse the site rate file returned from hyphy to a vector of rates"""
# for whatever reason, when run in a virt... | faircloth-lab/rhino | rhino/core.py | Python | bsd-3-clause | 2,759 |
# python filter_transcript_counts.py < transcript_counts.txt > active_transcripts.txt
import sys
print "Gene\tTranscript\tExpression"
for l in sys.stdin:
t = l.strip().split('\t')
if float(t[2]) > 1.1:
print '\t'.join(t[0:3])
| ahonkela/pol2rna | python/filter_transcript_counts.py | Python | bsd-3-clause | 244 |
from django.shortcuts import render
from django.views.generic.base import TemplateView
from django.views.generic.list import ListView
from django.views.generic.detail import DetailView
from django.contrib.syndication.views import Feed
from django.utils.feedgenerator import Atom1Feed
from blog.models import Post
from t... | brandonw/personal-site | personal-site/blog/views.py | Python | bsd-3-clause | 1,941 |
"""Polynomial factorization routines in characteristic zero. """
from __future__ import print_function, division
from sympy.polys.galoistools import (
gf_from_int_poly, gf_to_int_poly,
gf_lshift, gf_add_mul, gf_mul,
gf_div, gf_rem,
gf_gcdex,
gf_sqf_p,
gf_factor_sqf, gf_factor)
from sympy.poly... | kaushik94/sympy | sympy/polys/factortools.py | Python | bsd-3-clause | 34,338 |
# -*- coding: utf-8 -*-
from djangocms_text_ckeditor.models import Text
from django.contrib.admin.sites import site
from django.contrib.admin.utils import unquote
from django.contrib.auth import get_user_model
from django.contrib.auth.models import AnonymousUser, Group, Permission
from django.contrib.sites.models impor... | czpython/django-cms | cms/tests/test_permmod.py | Python | bsd-3-clause | 44,347 |
import logging
class Error(Exception):
def __init__(self, message, data = {}):
self.message = message
self.data = data
def __str__(self):
return self.message + ": " + repr(self.data)
@staticmethod
def die(code, error, message = None):
if isinstance(error, Exception):
... | hiqdev/reppy | heppy/Error.py | Python | bsd-3-clause | 580 |
# -*- coding: utf-8 -*-
"""
flask.ctx
~~~~~~~~~
Implements the objects required to keep the context.
:copyright: (c) 2014 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
from __future__ import with_statement
import sys
from functools import update_wrapper
from werkzeug.excep... | MjAbuz/flask | flask/ctx.py | Python | bsd-3-clause | 14,399 |
# -*- coding: utf-8 -*-
from gevent import Greenlet
from gevent import sleep
from .base import SchedulerMixin
class Scheduler(SchedulerMixin, Greenlet):
"""
Gevent scheduler. Only replaces the sleep method for correct
context switching.
"""
def sleep(self, seconds):
sleep(seconds)
... | niwinz/django-greenqueue | greenqueue/scheduler/gevent_scheduler.py | Python | bsd-3-clause | 437 |
from __future__ import absolute_import, division, print_function
from collections import Iterator
from flask import Flask, request, jsonify, json
from functools import partial, wraps
from .index import parse_index
class Server(object):
__slots__ = 'app', 'datasets'
def __init__(self, name='Blaze-Server', da... | aterrel/blaze | blaze/serve/server.py | Python | bsd-3-clause | 2,462 |
# Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.
import time
import os.path
from collections import OrderedDict, namedtuple
import gevent
import flask
from digits import device_query
from digits.task import Task
from digits.utils import subclass, override
# NOTE: Increment this everytime the pic... | batra-mlp-lab/DIGITS | digits/model/tasks/train.py | Python | bsd-3-clause | 19,069 |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['Anscombe'] , ['Lag1Trend'] , ['Seasonal_WeekOfYear'] , ['SVR'] ); | antoinecarme/pyaf | tests/model_control/detailed/transf_Anscombe/model_control_one_enabled_Anscombe_Lag1Trend_Seasonal_WeekOfYear_SVR.py | Python | bsd-3-clause | 161 |
from setuptools import setup, find_packages
from orotangi import __version__ as version
install_requires = [
'Django==1.11.18',
'djangorestframework==3.6.2',
'django-cors-headers==2.0.2',
'django-filter==1.0.2',
'python-dateutil==2.6.0'
]
setup(
name='orotangi',
version=version,
descri... | foxmask/orotangi | setup.py | Python | bsd-3-clause | 1,297 |
# -*- coding: utf-8 -*-
#
# zhuyin_table.py
# cjktools
#
"""
An interface to the zhuyin <-> pinyin table.
"""
from functools import partial
from . import cjkdata
from cjktools.common import get_stream_context, stream_codec
def _default_stream():
return open(cjkdata.get_resource('tables/zhuyin_pinyin_conv_tab... | larsyencken/cjktools | cjktools/resources/zhuyin_table.py | Python | bsd-3-clause | 2,155 |
import tests.periodicities.period_test as per
per.buildModel((24 , 'BH' , 50));
| antoinecarme/pyaf | tests/periodicities/Business_Hour/Cycle_Business_Hour_50_BH_24.py | Python | bsd-3-clause | 82 |
from django.http import HttpRequest
import mock
import pytest
from nose.tools import assert_false
from olympia import amo
from olympia.amo.tests import TestCase, req_factory_factory
from olympia.amo.urlresolvers import reverse
from olympia.addons.models import Addon, AddonUser
from olympia.users.models import UserPro... | jpetto/olympia | src/olympia/access/tests.py | Python | bsd-3-clause | 9,223 |
import collections
import difflib
import inspect
import logging
import os.path
import warnings
import os
import importlib
import cherrypy
import yaml
from yaml import load
try:
from yaml import CLoader as Loader
except ImportError:
from yaml import Loader
json = None
for pkg in ['ujson', 'yajl', 'simplejson'... | open-craft-guild/blueberrypy | src/blueberrypy/config.py | Python | bsd-3-clause | 18,173 |
#!/usr/bin/env python
# Remove .egg-info directory if it exists, to avoid dependency problems with
# partially-installed packages (20160119/dphiffer)
import os
import sys
import shutil
setup = os.path.abspath(sys.argv[0])
parent = os.path.dirname(setup)
pkg = os.path.basename(parent)
if pkg.startswith("py-mapzen"):... | whosonfirst/py-mapzen-whosonfirst-mapshaper-utils | setup.py | Python | bsd-3-clause | 1,496 |
from productos.models import Categoria, Imagen
from django.contrib import admin
from imagekit.admin import AdminThumbnail
# Register your models here.
class ImagenAdmin(admin.ModelAdmin):
imagen = AdminThumbnail(image_field='imagen_miniatura')
list_display = ('nombre', 'categoria','imagen')
admin.site.reg... | gabrielf10/Soles-pythonanywhere | productos/admin.py | Python | bsd-3-clause | 378 |
# -----------------------------------------------------------------------------
# Copyright (c) 2014--, The Qiita Development Team.
#
# Distributed under the terms of the BSD 3-clause License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... | squirrelo/qiita | qiita_db/test/test_base.py | Python | bsd-3-clause | 5,463 |
import datetime
from mock import patch
from pretend import stub
from gurtel import session
def test_annotates_request():
"""Annotates request with ``session`` property."""
request = stub(
cookies={},
app=stub(secret_key='secret', is_ssl=True, config={}),
)
session.session_middle... | oddbird/gurtel | tests/test_session.py | Python | bsd-3-clause | 1,572 |
# -*- coding: utf-8 -*-
"""
Django settings for LittleSportsBiscuit project.
For more information on this file, see
https://docs.djangoproject.com/en/dev/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/dev/ref/settings/
"""
from __future__ import absolute_import,... | maninmotion/LittleSportsBiscuit | config/settings/common.py | Python | bsd-3-clause | 9,768 |
"""ZFS based backup workflows."""
import datetime
import shlex
import gflags
import lvm
import workflow
FLAGS = gflags.FLAGS
gflags.DEFINE_string('rsync_options',
'--archive --acls --numeric-ids --delete --inplace',
'rsync command options')
gflags.DEFINE_string('rsync_path'... | rbarlow/ari-backup | ari_backup/zfs.py | Python | bsd-3-clause | 9,110 |
from django.contrib import admin
from workflow.models import State, StateLog, NextState, Project, Location
from workflow.activities import StateActivity
class NextStateInline(admin.StackedInline):
model = NextState
fk_name = 'current_state'
extra = 0
class StateAdmin(admin.ModelAdmin):
inlines = [N... | django-stars/dash2011 | presence/apps/workflow/admin.py | Python | bsd-3-clause | 703 |
# -*- coding: utf-8 -*-
# Copyright (c) 2016-2017, Zhijiang Yao, Jie Dong and Dongsheng Cao
# All rights reserved.
# This file is part of the PyBioMed.
# The contents are covered by the terms of the BSD license
# which is included in the file license.txt, found at the root
# of the PyBioMed source tree.
"""
#####... | gadsbyfly/PyBioMed | PyBioMed/Pymolecule.py | Python | bsd-3-clause | 16,673 |
import datetime
import Adafruit_BBIO.GPIO as GPIO
import tornado.gen
class Baster(object):
"""
Controller for the baster
"""
def __init__(self, baster_pin):
"""
Initializes the controller for a baster and sets it closed
:param baster_pin: The BBB GPIO to use, e.g. P8_14
... | Caligatio/smokematic | smokematic/baster.py | Python | bsd-3-clause | 2,697 |
"""
WSGI config for jobboardscraper 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.10/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJA... | richardcornish/timgorin | jobboardscraper/jobboardscraper/wsgi.py | Python | bsd-3-clause | 408 |
# -*- coding: utf-8 -*-
import datetime
import json
import os
import shutil
from django.conf import settings
from django.core.files.storage import default_storage as storage
from django.core.urlresolvers import reverse
import mock
from nose.tools import eq_, ok_
from pyquery import PyQuery as pq
import mkt
from mkt.... | eviljeff/zamboni | mkt/submit/tests/test_views.py | Python | bsd-3-clause | 38,831 |
import json
from djpcms import test
from djpcms.plugins.text import Text
class Editing(test.TestCase):
def setUp(self):
super(Editing,self).setUp()
p = self.get()['page']
p.set_template(p.create_template('thre-columns',
'{{ content0... | strogo/djpcms | tests/regression/editing/tests.py | Python | bsd-3-clause | 4,078 |
default_app_config = 'wagtail_commons.core.apps.WagtailCommonsCoreConfig' | bgrace/wagtail-commons | wagtail_commons/core/__init__.py | Python | bsd-3-clause | 73 |
"""
Filename: robustlq.py
Authors: Chase Coleman, Spencer Lyon, Thomas Sargent, John Stachurski
Solves robust LQ control problems.
"""
from __future__ import division # Remove for Python 3.sx
import numpy as np
from lqcontrol import LQ
from quadsums import var_quadratic_sum
from numpy import dot, log, sqrt, identit... | 28ideas/quant-econ | quantecon/robustlq.py | Python | bsd-3-clause | 8,434 |
from omnibus.factories import websocket_connection_factory
def mousemove_connection_factory(auth_class, pubsub):
class GeneratedConnection(websocket_connection_factory(auth_class, pubsub)):
def close_connection(self):
self.pubsub.publish(
'mousemoves', 'disconnect',
... | moccu/django-omnibus | examples/mousemove/example_project/connection.py | Python | bsd-3-clause | 485 |
# -*- coding: utf-8 -*-
from reports.accidents.models import *
| k-vinogradov/noclite | reports/models.py | Python | bsd-3-clause | 66 |
"""
Client for the library API.
"""
class LibraryClient(object):
"""
Library API client.
"""
def __init__(self,axilent_connection):
self.content_resource = axilent_connection.resource_client('axilent.library','content')
self.api = axilent_connection.http_client('axilent.library')
... | aericson/Djax | pax/library.py | Python | bsd-3-clause | 3,541 |
from __future__ import print_function, absolute_import, division
import numpy as np
import pandas as pd
from toolz import partition
def loc(df, ind):
return df.loc[ind]
def index_count(x):
# Workaround since Index doesn't implement `.count`
return pd.notnull(x).sum()
def mean_aggregate(s, n):
try... | cowlicks/dask | dask/dataframe/methods.py | Python | bsd-3-clause | 1,788 |
#-*- coding: utf-8 -*-
from __future__ import unicode_literals
import itertools
import os
import re
from django import forms
from django.conf import settings as django_settings
from django.contrib import messages
from django.contrib.admin import helpers
from django.contrib.admin.util import quote, unquote, capfirst
fr... | o-zander/django-filer | filer/admin/folderadmin.py | Python | bsd-3-clause | 53,477 |
import sys
import time
import json
import logging
import random
import tornado.options
from tornado.options import define, options
from tornado import gen
define('srp_root',default='http://192.168.56.1')
#define('srp_root',default='https://remote-staging.utorrent.com')
#define('srp_root',default='https://remote.utorre... | leiferikb/bitpop-private | bitpop_specific/extensions/bittorrent_surf/app/lib/falcon-api/python/falcon_api/test/classic.py | Python | bsd-3-clause | 2,962 |
from __future__ import absolute_import
import os
import time
from math import pi
import numpy as nm
from sfepy.base.base import Struct, output, get_default
from sfepy.applications import PDESolverApp
from sfepy.solvers import Solver
from six.moves import range
def guess_n_eigs(n_electron, n_eigs=None):
"""
G... | lokik/sfepy | sfepy/physics/schroedinger_app.py | Python | bsd-3-clause | 7,582 |
"""
calabar.tunnels
This module encapsulates various tunnel processes and their management.
"""
import signal
import os
import sys
import psi.process
TUN_TYPE_STR = 'tunnel_type' # Configuration/dictionary key for the type of tunnel
# Should match the tunnel_type argument to Tunnel __init__ methods
PROC_NOT_RUNNING... | winhamwr/calabar | calabar/tunnels/__init__.py | Python | bsd-3-clause | 6,085 |
__author__ = 'swhite'
"""
This package contains the test modules for the repository app of the ReFlow project,
organized by test type (unit, integration, etc.)
To run all the tests in the repository app, using the manage.py command:
"python manage.py test repository".
Notes:
- add new test constants in the constants... | whitews/ReFlow | repository/tests/test.py | Python | bsd-3-clause | 391 |
from django.conf.urls.defaults import *
from availablejob.views import *
urlpatterns = patterns("availablejob.views",
url(r"^sendcv/$",send_cv),
url(r"^detail/(?P<id>\d+)/$", 'detail',name="job-detail"),
url(r"^apply/(?P<id>\d+)/$", 'show_form',name="show-form"),
url(r"^$", 'index', name="vacancy-i... | interalia/cmsplugin_availablejobs | availablejob/urls.py | Python | bsd-3-clause | 330 |
# -*- coding: utf-8 -*-
"""
Image processing and feature extraction functions.
"""
import cv2
import numpy as np
def pad_image(im, width, height, border=255):
"""pad char image in a larger image"""
xoff = abs(int((im.shape[1] - width) / 2))
yoff = abs(int((im.shape[0] - height) / 2))
if width >= ... | bdzimmer/handwriting | handwriting/improc.py | Python | bsd-3-clause | 7,094 |
#!/usr/bin/env vpython
# Copyright 2019 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import argparse
import contextlib
import logging
import os
import subprocess
import sys
_SRC_ROOT = os.path.abspath(
os.path.joi... | endlessm/chromium-browser | tools/android/asan/third_party/with_asan.py | Python | bsd-3-clause | 3,894 |
# Copyright 2013 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.
"""A simple, direct connection to the vtgate proxy server, using gRPC.
"""
import logging
import re
from urlparse import urlparse
# Import main protobuf library firs... | AndyDiamondstein/vitess | py/vtdb/grpc_vtgate_client.py | Python | bsd-3-clause | 9,838 |
# -*- coding: utf-8 -*-
import json
import logging
import os
import pickle
import sys
import uuid
from unittest.mock import Mock, PropertyMock, patch, MagicMock, ANY
import celery
import yaml
from billiard.einfo import ExceptionInfo
from django.conf import settings
from django.contrib.auth.models import Group, User
f... | terranodo/eventkit-cloud | eventkit_cloud/tasks/tests/test_export_tasks.py | Python | bsd-3-clause | 86,451 |
import polyadcirc.run_framework.domain as dom
import polyadcirc.pyGriddata.manufacture_gap as manu
grid_dir = '.'
domain = dom.domain(grid_dir)
domain.read_spatial_grid()
x_values = [n.x for n in domain.node.values()]
y_values = [n.y for n in domain.node.values()]
xr = max(x_values)
xl = min(x_values)
yu = max(y_val... | UT-CHG/PolyADCIRC | examples/pyGriddata/manufactureGAP_vertical.py | Python | bsd-3-clause | 610 |
import zlib
import struct
import time
def parse_encoding_header(header):
"""
Break up the `HTTP_ACCEPT_ENCODING` header into a dict of the form,
{'encoding-name':qvalue}.
"""
encodings = {'identity':1.0}
for encoding in header.split(","):
if(encoding.find(";") > -1):
encodi... | btubbs/spa | spa/gzip_util.py | Python | bsd-3-clause | 2,754 |
from django.contrib import admin
from .models import Topping, Pizza
class ToppingInlineAdmin(admin.TabularInline):
model = Topping
extra = 1
class PizzaAdmin(admin.ModelAdmin):
fieldsets = (
('', {
'fields': ('description',),
}),
('Advanced', {
'classes': ... | vxsx/djangocms-text-ckeditor | djangocms_text_ckeditor/test_app/admin.py | Python | bsd-3-clause | 466 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2008-2019 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://trac.edgewall.org/wiki/TracLicense.
#
# This software consi... | rbaumg/trac | trac/tests/functional/tester.py | Python | bsd-3-clause | 18,151 |
import numpy as np
from numpy.testing import assert_equal, assert_array_equal
from scipy.stats import rankdata, tiecorrect
class TestTieCorrect(object):
def test_empty(self):
"""An empty array requires no correction, should return 1.0."""
ranks = np.array([], dtype=np.float64)
c = tiecor... | aeklant/scipy | scipy/stats/tests/test_rank.py | Python | bsd-3-clause | 7,448 |
"""
COMMAND-LINE SPECIFIC STUFF
=============================================================================
"""
import markdown
import sys
import optparse
import logging
from logging import DEBUG, INFO, CRITICAL
logger = logging.getLogger('MARKDOWN')
def parse_options():
"""
Define and parse `optparse` ... | leafnode/npp_markdown_script | lib/markdown/__main__.py | Python | bsd-3-clause | 3,376 |
'''
Created on 2013-7-21
@author: hujin
'''
import sys
from PySide.QtGui import QApplication
from mdeditor.ui.window import MainWindow
class Application(QApplication):
def __init__(self):
'''
Constructor
'''
super(Application, self).__init__(sys.argv)
def run(sel... | bixuehujin/mdeditor | mdeditor/application.py | Python | bsd-3-clause | 472 |
from rauth import OAuth1Service, OAuth2Service
from flask import current_app, url_for, request, redirect, session
import json
class OAuthSignIn(object):
providers = None
def __init__(self, provider_name):
self.provider_name = provider_name
credentials = current_app.config['OAUTH_CREDENTIALS'][... | sandeep6189/Pmp-Webapp | oauth.py | Python | bsd-3-clause | 5,795 |
#!/usr/bin/env python3
# Copyright (c) 2014-present, The osquery authors
#
# This source code is licensed as defined by the LICENSE file found in the
# root directory of this source tree.
#
# SPDX-License-Identifier: (Apache-2.0 OR GPL-2.0-only)
import glob
import os
import signal
import shutil
import time
import uni... | hackgnar/osquery | tools/tests/test_osqueryd.py | Python | bsd-3-clause | 9,307 |
import os
import sys
import time
import itertools
def get_sleeper():
if os.isatty(sys.stdout.fileno()):
return PrettySleeper()
return Sleeper()
_PROGRESS_WIDTH = 50
_WATCHING_MESSAGE = "Watching for changes... "
_PROGRESS_BAR = [
_WATCHING_MESSAGE + "".join('>' if offset == position else ' ' for o... | vmalloc/redgreen | redgreen/sleeper.py | Python | bsd-3-clause | 960 |
"""Code for performing requests"""
import json
import logging
import urllib.request
import zlib
from urllib.error import HTTPError
import requests
from defusedxml import ElementTree
from scout.constants import CHROMOSOMES, HPO_URL, HPOTERMS_URL
from scout.utils.ensembl_rest_clients import EnsemblBiomartClient
LOG = ... | Clinical-Genomics/scout | scout/utils/scout_requests.py | Python | bsd-3-clause | 13,130 |
emails = sorted(set([line.strip() for line in open("email_domains.txt")]))
for email in emails:
print("'{email}',".format(email=email)) | aaronbassett/DisposableEmailChecker | build_list.py | Python | bsd-3-clause | 141 |
#!/usr/bin/python
# Copyright (c) Arni Mar Jonsson.
# See LICENSE for details.
import rocksdb, pointless, random, string, itertools, collections
from twisted.internet import reactor, defer, threads
def compare(a, b):
return cmp(a, b)
c = 'bytewise'
c = ('rocksdb.BytewiseComparator', compare)
kw = {
'create_if_m... | botify-labs/py-rocksdb | test/try.py | Python | bsd-3-clause | 2,259 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
Copyright (c) 2014, Kersten Doering <kersten.doering@gmail.com>, Bjoern Gruening <bjoern.gruening@gmail.com>
"""
#Kersten Doering 16.06.2014
#check http://xapian.org/docs/queryparser.html for syntax and functions
import xappy
searchConn = xappy.SearchConnection("x... | telukir/PubMed2Go | full_text_index/search_near_title.py | Python | isc | 3,208 |
import argparse
import docker
import logging
import os
import docket
logger = logging.getLogger('docket')
logging.basicConfig()
parser = argparse.ArgumentParser(description='')
parser.add_argument('-t --tag', dest='tag', help='tag for final image')
parser.add_argument('--verbose', dest='verbose', action='store_true',... | clarete/docket | docket/command_line.py | Python | mit | 1,369 |
# Bug in 2.7 base64.py
_b32alphabet = {
0: 'A', 9: 'J', 18: 'S', 27: '3',
1: 'B', 10: 'K', 19: 'T', 28: '4',
2: 'C', 11: 'L', 20: 'U', 29: '5',
3: 'D', 12: 'M', 21: 'V', 30: '6',
4: 'E', 13: 'N', 22: 'W', 31: '7',
5: 'F', 14: 'O', 23: 'X',
6: 'G', 15: 'P', 24: 'Y',
7: 'H', 16: 'Q', 25: ... | moagstar/python-uncompyle6 | test/simple_source/expression/03_map.py | Python | mit | 361 |
#! /usr/bin/env python
from openturns import *
TESTPREAMBLE()
RandomGenerator.SetSeed(0)
try:
# Instanciate one distribution object
dimension = 3
meanPoint = NumericalPoint(dimension, 1.0)
meanPoint[0] = 0.5
meanPoint[1] = -0.5
sigma = NumericalPoint(dimension, 1.0)
sigma[0] = 2.0
sig... | sofianehaddad/ot-svn | python/test/t_Mixture_std.py | Python | mit | 7,198 |
doTimingAttackMitigation = False
import base64
import errno
import math
import time
import threading
import shared
import hashlib
import os
import select
import socket
import random
import ssl
from struct import unpack, pack
import sys
import traceback
from binascii import hexlify
#import string
#from subprocess impor... | timothyparez/PyBitmessage | src/class_receiveDataThread.py | Python | mit | 46,068 |
#!/usr/bin/env python
from iris_sdk.models.maps.base_map import BaseMap
class CitiesMap(BaseMap):
result_count = None
cities = None | scottbarstow/iris-python | iris_sdk/models/maps/cities.py | Python | mit | 142 |
#!/usr/bin/env python3
# Copyright (c) 2017-2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test various fingerprinting protections.
If a stale block more than a month old or its header are requ... | Flowdalic/bitcoin | test/functional/p2p_fingerprint.py | Python | mit | 5,771 |
# -*- coding: utf-8 -*-
import unittest
from wechatpy.replies import TextReply, create_reply
class CreateReplyTestCase(unittest.TestCase):
def test_create_reply_with_text_not_render(self):
text = "test"
reply = create_reply(text, render=False)
self.assertEqual("text", reply.type)
... | jxtech/wechatpy | tests/test_create_reply.py | Python | mit | 4,741 |
"""
tests specific to "pip install --user"
"""
import os
import textwrap
from os.path import curdir, isdir, isfile
import pytest
from pip._internal.compat import cache_from_source, uses_pycache
from tests.lib import pyversion
from tests.lib.local_repos import local_checkout
def _patch_dist_in_site_packages(script):... | zvezdan/pip | tests/functional/test_install_user.py | Python | mit | 11,608 |
from flask_restplus import Namespace, Resource
from flask import current_app
from cea.glossary import read_glossary_df
api = Namespace('Glossary', description='Glossary for variables used in CEA')
@api.route('/')
class Glossary(Resource):
def get(self):
glossary = read_glossary_df(plugins=current_app... | architecture-building-systems/CEAforArcGIS | cea/interfaces/dashboard/api/glossary.py | Python | mit | 692 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Landing pages administration module
===============================================
.. module:: landingpages.admin
:platform: Django
:synopsis: Landing pages administration module
.. moduleauthor:: (C) 2015 Oliver Gutiérrez
"""
# Django imports
fr... | R3v1L/django-landingpages | landingpages/admin.py | Python | mit | 813 |
#!/usr/bin/env python3
## Copyright (c) 2011 Steven D'Aprano.
## See the file __init__.py for the licence terms for this software.
"""
General utilities used by the stats package.
"""
__all__ = ['add_partial', 'coroutine','minmax']
import collections
import functools
import itertools
import math
# === Excepti... | tnotstar/pycalcstats | src/stats/utils.py | Python | mit | 3,781 |
import _plotly_utils.basevalidators
class TickformatstopsValidator(_plotly_utils.basevalidators.CompoundArrayValidator):
def __init__(
self, plotly_name="tickformatstops", parent_name="contour.colorbar", **kwargs
):
super(TickformatstopsValidator, self).__init__(
plotly_name=plotly... | plotly/python-api | packages/python/plotly/plotly/validators/contour/colorbar/_tickformatstops.py | Python | mit | 2,290 |
from requests import Request
from oauthlib.common import unquote
from requests_oauthlib import OAuth1
from requests_oauthlib.oauth1_auth import SIGNATURE_TYPE_BODY
from tool_base import ToolBase
from launch_params import LAUNCH_PARAMS_REQUIRED
from utils import parse_qs, InvalidLTIConfigError, generate_identifier
cl... | brainheart/dce_lti_py | dce_lti_py/tool_consumer.py | Python | mit | 2,381 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
import re
import json
import tempfile
import toml
import os
class RequirementsTXTUpdater(object):
SUB_REGEX = r"^{}(?=\s*\r?\n?$)"
@classmethod
def update(cls, content, dependency, version, spec="==", hashes... | kennethreitz/pipenv | pipenv/vendor/dparse/updater.py | Python | mit | 4,566 |
"""Ttk wrapper.
This module provides classes to allow using Tk themed widget set.
Ttk is based on a revised and enhanced version of
TIP #48 (http://tip.tcl.tk/48) specified style engine.
Its basic idea is to separate, to the extent possible, the code
implementing a widget's behavior from the code implementing its
ap... | MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-3.3.0/Lib/tkinter/ttk.py | Python | mit | 56,245 |
# -*- coding: utf-8 -*-
"""Doctest for method/function calls.
We're going the use these types for extra testing
>>> from UserList import UserList
>>> from UserDict import UserDict
We're defining four helper functions
>>> def e(a,b):
... print a, b
>>> def f(*a, **k):
... print a, t... | wang1352083/pythontool | python-2.7.12-lib/test/test_extcall.py | Python | mit | 7,975 |
from asposebarcode import Settings
from com.aspose.barcoderecognition import BarCodeReadType
from com.aspose.barcoderecognition import BarCodeReader
class GetBarcodeRecognitionQuality:
def __init__(self):
dataDir = Settings.dataDir + 'WorkingWithBarcodeRecognition/AdvancedBarcodeRecognitionFeatures/GetBar... | asposebarcode/Aspose_BarCode_Java | Plugins/Aspose.BarCode Java for Jython/asposebarcode/WorkingWithBarcodeRecognition/AdvancedBarcodeRecognitionFeatures/GetBarcodeRecognitionQuality.py | Python | mit | 998 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('imager_profile', '0004_auto_20150802_0153'),
]
operations = [
migrations.RemoveField(
model_name='imagerprofile'... | tpeek/bike_safety | imagersite/imager_profile/migrations/0005_auto_20150802_0303.py | Python | mit | 1,491 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# hello.py
# A Hello World program using Tkinter package.
#
# Author: Billy Wilson Arante
# Created: 2016/10/29 EDT
#
# Attribution: http://effbot.org/tkinterbook/tkinter-hello-tkinter.htm
from Tkinter import *
def main():
"""Main"""
root = Tk()
label = Lab... | arantebillywilson/python-snippets | py2/tkinter/hello.py | Python | mit | 465 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Creature()
result.template = "object/mobile/shared_dressed_marooned_pirate_tran_m.iff"
result.attribute_template_... | anhstudios/swganh | data/scripts/templates/object/mobile/shared_dressed_marooned_pirate_tran_m.py | Python | mit | 460 |
"""Query the switch for configured queues on a port."""
# System imports
# Third-party imports
# Local source tree imports
from pyof.foundation.base import GenericMessage
from pyof.foundation.basic_types import Pad, UBInt32
from pyof.v0x04.common.header import Header, Type
from pyof.v0x04.common.port import PortNo
... | kytos/python-openflow | pyof/v0x04/controller2switch/queue_get_config_request.py | Python | mit | 1,105 |
# encoding: utf-8
" This sub-module provides 'sequence awareness' for blessed."
__author__ = 'Jeff Quast <contact@jeffquast.com>'
__license__ = 'MIT'
__all__ = ('init_sequence_patterns', 'Sequence', 'SequenceTextWrapper',)
# built-ins
import functools
import textwrap
import warnings
import math
import sys
import re
... | AccelAI/accel.ai | flask-aws/lib/python2.7/site-packages/blessed/sequences.py | Python | mit | 26,038 |
# Copyright (c) 2014 Tycho Andersen
# Copyright (c) 2014 dequis
# Copyright (c) 2014-2015 Joseph Razik
# Copyright (c) 2014 Sean Vig
# Copyright (c) 2015 reus
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
... | frostidaho/qtile | libqtile/widget/launchbar.py | Python | mit | 9,146 |
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
DEBUG = True
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/
# SECURITY WAR... | gavinmcgimpsey/deckofcards | spades/settings.py | Python | mit | 1,928 |
"""Provides all the generic data related to the personal information."""
from typing import Tuple
BLOOD_GROUPS = (
"O+",
"A+",
"B+",
"AB+",
"O−",
"A−",
"B−",
"AB−",
)
GENDER_SYMBOLS: Tuple[str, str, str] = (
"♂",
"♀",
"⚲",
)
USERNAMES = [
"aaa",
"aaron",
"aban... | lk-geimfari/elizabeth | mimesis/data/int/person.py | Python | mit | 140,388 |
from agrc import logging
import unittest
import sys
import datetime
import os
import shutil
from mock import Mock, patch
class LoggerTests(unittest.TestCase):
logTxt = 'test log text'
erTxt = 'test error text'
def setUp(self):
self.logger = logging.Logger()
def tearDown(self):
del se... | ZachBeck/agrc.python | agrc/test/test_logging.py | Python | mit | 1,666 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'LaunchWindow'
db.create_table(u'launch_window_launchwindo... | naphthalene/fabric-bolt | fabric_bolt/launch_window/migrations/0001_initial.py | Python | mit | 1,427 |
# -*- coding: utf-8 -*-
import logging
logger = logging.getLogger("sikteeri.views")
from django.conf import settings
from django.shortcuts import render_to_response, redirect
from django.template import RequestContext
from django.utils.translation import ugettext_lazy as _
from sikteeri.version import VERSION
def f... | AriMartti/sikteeri | sikteeri/views.py | Python | mit | 1,066 |
# -*- coding: utf-8 -*-
#
# Nikola documentation build configuration file, created by
# sphinx-quickstart on Sun Sep 22 17:43:37 2013.
#
# 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.
#
# Al... | agustinhenze/nikola.debian | docs/sphinx/conf.py | Python | mit | 8,386 |
"""
********************************************************************************
Learn Python the Hard Way Third Edition, by
Zed A. Shaw
ISBN: 978-0321884916
********************************************************************************
"""
import random
from urllib import urlopen
import sys
#debug ... | msnorm/projects | zspy2/ex41/ex41.py | Python | mit | 2,749 |
import logging
from math import isclose
try: # pragma: no cover
import torch
optim = torch.optim
except ImportError: # pragma: no cover
optim = None
def pinverse(t):
"""
Computes the pseudo-inverse of a matrix using SVD.
Parameters
----------
t: torch.tensor
The matrix wh... | pgmpy/pgmpy | pgmpy/utils/optimizer.py | Python | mit | 3,651 |
# author: Milan Kubik
| apophys/ipaqe-provision-hosts | ipaqe_provision_hosts/backend/__init__.py | Python | mit | 22 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.