repo_name
stringlengths
5
104
path
stringlengths
4
248
content
stringlengths
102
99.9k
ihor-pyvovarnyk/oae-sound-processing-tool
app/modules/fft_analysis.py
import numpy as np import matplotlib.pyplot as plt import matplotlib.mlab as mlab import pysox import subprocess as sp import time import os import re from ._base_module import BaseModule class FftAnalysis(BaseModule): def __init__(self, connector): super(FftAnalysis, self).__init__(connector) sel...
fdr/pg_corrupt
pg_corrupt/scan_page.py
import psycopg2 from pg_corrupt.ctid import Ctid def items(conn, qrelname, base_page): sql = ("SELECT ctid FROM {0} WHERE ctid >= %s and ctid < %s" .format(qrelname)) params = (base_page, base_page.next_page()) with conn.cursor() as cur: cur.execute(sql, params) return [t[0] fo...
rvause/django-changes
setup.py
import os from setuptools import setup, find_packages from changes import __doc__, __version__, __author__, __email__ desc = open(os.path.join(os.path.dirname(__file__), 'README.rst')).read() setup( name='django-changes', version=__version__, author=__author__, author_email=__email__, url='http...
bjodah/pykinsol
pykinsol/core.py
# -*- coding: utf-8 -*- from __future__ import (absolute_import, division, print_function) import numpy as np from ._kinsol_numpy import solve as _solve def solve(f_cb, j_cb, x0, fnormtol=1e-6, scsteptol=1e-12, x_scale=None, f_scale=None, constraints=None, lband=-1, uband=-1, mxiter=200): """ Solv...
bowen0701/algorithms_data_structures
lc0767_reorganize_string.py
"""Leetcode 767. Reorganize String Medium URL: https://leetcode.com/problems/reorganize-string/ Given a string S, check if the letters can be rearranged so that two characters that are adjacent to each other are not the same. If possible, output any possible result. If not possible, return the empty string. Example...
cloudtools/troposphere
tests/test_codebuild.py
import unittest from troposphere import codebuild class TestCodeBuild(unittest.TestCase): def test_linux_environment(self): environment = codebuild.Environment( ComputeType="BUILD_GENERAL1_SMALL", Image="aws/codebuild/ubuntu-base:14.04", Type="LINUX_CONTAINER", ...
kn65op/cli-toolkit
tools/cli2java.py
# -*- coding: ISO-8859-1 -*- # Copyright (c) 2006-2013, Alexis Royer, http://alexis.royer.free.fr/CLI # # 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 c...
mikeboers/Nitrogen
nitrogen/websocket.py
""" Originally lifted from various files at: https://bitbucket.org/Jeffrey/gevent-websocket/src/fabf03111c73/geventwebsocket """ from errno import EINTR from hashlib import md5, sha1 from socket import error as socket_error from threading import Semaphore from urllib import quote import base64 import re import stru...
JoKaWare/WTL-DUI
tools/grit/grit/format/interface.py
#!/usr/bin/env python # Copyright (c) 2012 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. '''Base classes for item formatters and file formatters. ''' import re class ItemFormatter(object): """Base class for a forma...
yeraydiazdiaz/nonrel-blog
django_mongodb_engine/base.py
import copy import datetime import decimal import sys from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.db.backends.signals import connection_created from django.db.utils import DatabaseError from pymongo.collection import Collection from pymongo.connection import Co...
jandom/rdkit
rdkit/Chem/Draw/UnitTestDraw.py
# $Id$ # # Copyright (C) 2011 greg Landrum # # @@ All Rights Reserved @@ # This file is part of the RDKit. # 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 RDKit source tree. # """ unit testing code for molecule drawing """ from r...
rlkelly/tango-with-django-17
tango_with_django_project/rango/forms.py
from django import forms from rango.models import Page, Category class CategoryForm(forms.ModelForm): name = forms.CharField(max_length=128, help_text="Please enter the category name.") views = forms.IntegerField(widget=forms.HiddenInput(), initial=0) likes = forms.IntegerField(widget=forms.HiddenInput(), ...
endlessm/chromium-browser
third_party/catapult/dashboard/dashboard/change_internal_only_test.py
# Copyright 2015 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. from __future__ import print_function from __future__ import division from __future__ import absolute_import import unittest from dashboard import change_i...
sbuss/TigerShark
tests/test_navigation.py
#!/usr/bin/env python """Test :mod:`X12.message` Xpath-like navigation. The :mod:`X12.message` Factory is used to build one set of objects. This works in a stand-alone mode. """ import unittest import logging, sys from tigershark.X12.message import Factory as MessageFactory from tigershark.X12.parse import SegmentTok...
SalesforceFoundation/CumulusCI
cumulusci/tasks/salesforce/tests/test_UninstallPackagedIncremental.py
import io from unittest import mock import os import unittest import zipfile from cumulusci.tasks.salesforce import UninstallPackagedIncremental from cumulusci.tests.util import create_project_config from cumulusci.utils import temporary_dir from .util import create_task class TestUninstallPackagedIncremental(unitte...
fresskarma/tinyos-1.x
tools/java/net/tinyos/sim/pyscripts/objmover.py
# This script is in the public domain and has no copyright # # ObjMover is a utility class that handles various movement patterns # for SimObjects # import simcore import simutil import simtime import math from net.tinyos.sim.event import InterruptEvent # there should be only a single instance objmover = None; clas...
decimalbell/yyproto
python/yyproto/tests/test_packer.py
import string import unittest from yyproto.dict import Dict from yyproto.list import List from yyproto.packer import Packer from yyproto.set import Set class TestPacker(unittest.TestCase): def test_integer(self): buf = bytearray(1024) packer = Packer(buf) packer.pack_integer('b', 42) ...
kefin/django-garage
garage/help_text.py
# -*- coding: utf-8 -*- """ garage.help_text Helper function to retrieve help text for backend admin form views. * created: 2011-03-18 Kevin Chan <kefin@makedostudio.com> * updated: 2014-11-21 kchan """ from __future__ import (absolute_import, unicode_literals) import warnings # issue deprecation warning # * This ...
Autoplectic/dit
dit/profiles/tests/test_schneidman.py
""" Tests for dit.profiles.ConnectedInformations. Known examples taken from http://arxiv.org/abs/1409.4708 . """ from __future__ import division import pytest import numpy as np from dit import Distribution from dit.profiles import ConnectedInformations, ConnectedDualInformations ex1 = Distribution(['000', '001', ...
all-of-us/raw-data-repository
rdr_service/lib_fhir/fhirclient_4_0_0/models/medicinalproductinteraction_tests.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07. # 2019, SMART Health IT. import os import io import unittest import json from . import medicinalproductinteraction from .fhirdate import FHIRDate class MedicinalProductInteractionTests(unittest.TestCase): def...
languagelab/Django-Currencies
currencies/templatetags/currency.py
from django import template from django.template.defaultfilters import stringfilter from currencies.models import Currency from currencies.utils import calculate_price register = template.Library() @register.filter(name='currency') @stringfilter def set_currency(value, arg): return calculate_price(value, arg) cla...
tadejs/crab
setup.py
#!/usr/bin/env python import os descr = """Crab is a flexible, fast recommender engine for Python. The engine aims to provide a rich set of components from which you can construct a customized recommender system from a set of algorithms.""" DISTNAME = 'scikits.crab' DESCRIPTION = 'A recommender engine for Python...
metaperl/sbldr
src/main.py
#!/usr/bin/env python from __future__ import print_function import os import sys sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0) # system from datetime import datetime, timedelta from functools import wraps import pprint import random import re import sys import time # pypi import argh import click from cl...
yuuki0xff/nvpy
nvpy/utils.py
# nvPY: cross-platform note-taking app with simplenote syncing # copyright 2012 by Charl P. Botha <cpbotha@vxlabs.com> # new BSD license import datetime import random import re from urllib.error import URLError from urllib.request import urlopen from queue import Queue, Empty as QueueEmpty from .p3port import unicode ...
asttra/pysces
pysces/lib/FirstDerivatives.py
# Automatic first-order derivatives # # Written by Konrad Hinsen <hinsen@cnrs-orleans.fr> # last revision: 2002-6-13 # # Adapted slightly to work independently and use numpy - bgoli # Brett Olivier 20070308 """This module provides automatic differentiation for functions with any number of variables. Instanc...
karpierz/libpcap
tests/findalldevstest_perf.py
#!/usr/bin/env python # Copyright (c) 2016-2022, Adam Karpierz # Licensed under the BSD license # https://opensource.org/licenses/BSD-3-Clause import sys import ctypes as ct import libpcap as pcap from pcaptestutils import * # noqa def main(argv=sys.argv[1:]): exit_status = 0 if is_windows: star...
Jet-Streaming/gyp
test/rules/gyptest-default.py
#!/usr/bin/env python # Copyright (c) 2011 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. """ Verifies simple rules when using an explicit build target of 'all'. """ import TestGyp test = TestGyp.TestGyp() test.ru...
williamyangcn/iBlah_py
libiblah/contact_crud.py
from PyQt4 import QtGui from PyQt4 import QtCore from libblah.strutils import to_unicode_obj from libblah.utils import qstr_to_unicode_obj from ui.ui_add_buddy_dialog import Ui_AddBuddyDialog from ui.ui_reply_add_buddy_dialog import Ui_ReplyAddBuddyDialog from ui.ui_delete_buddy_dialog import Ui_DeleteBuddyDialog cl...
nickpack/reportlab
tools/pythonpoint/styles/horrible.py
#Copyright ReportLab Europe Ltd. 2000-2012 #see license.txt for license details #history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/tools/pythonpoint/styles/horrible.py __version__=''' $Id: horrible.py 3959 2012-09-27 14:39:39Z robin $ ''' # style_modern.py __doc__="""This is a...
Letractively/aha-gae
plugins/aha.plugin.twitteroauth/twitteroauth/oauth.py
# -*- coding: utf-8 -*- """ tipfy.ext.auth.oauth ~~~~~~~~~~~~~~~~~~~~ Implementation of OAuth authentication scheme. Ported from `tornado.auth <http://github.com/facebook/tornado/blob/master/tornado/auth.py>`_. :copyright: 2009 Facebook. :copyright: 2010 tipfy.org. :license: Apache Licens...
ifduyue/sentry
src/sentry/api/endpoints/group_integration_details.py
from __future__ import absolute_import from django.db import IntegrityError, transaction from rest_framework.response import Response from sentry import analytics, features from sentry.api.bases import GroupEndpoint from sentry.api.serializers import serialize from sentry.api.serializers.models.integration import In...
ddanier/django_url_alias
django_url_alias/aliases.py
from django.core.exceptions import ImproperlyConfigured from django.utils.importlib import import_module from .settings import URL_ALIAS_MODULES def get_url_alias_modules(collect=None): if collect is None: collect = URL_ALIAS_MODULES alias_modules = [] for path in collect: i = path.rfind('...
udox/django-social-tools
socialtool/social/views.py
import twitter import urllib from datetime import datetime from django.db.utils import IntegrityError from django.http import HttpResponse from django.views.generic import TemplateView, View from rest_framework import generics, viewsets from socialtool.loading import get_classes, get_model PostSerializer, Paginated...
astropy/astropy
astropy/io/misc/asdf/tags/time/timedelta.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst # -*- coding: utf-8 -*- import functools import numpy as np from astropy.time import TimeDelta from astropy.io.misc.asdf.types import AstropyType __all__ = ['TimeDeltaType'] allclose_jd = functools.partial(np.allclose, rtol=2. ** -52, atol=0) allclose_...
sergeyf/scikit-learn
sklearn/svm/_base.py
import warnings import numbers from abc import ABCMeta, abstractmethod import numpy as np import scipy.sparse as sp # mypy error: error: Module 'sklearn.svm' has no attribute '_libsvm' # (and same for other imports) from . import _libsvm as libsvm # type: ignore from . import _liblinear as liblinear # type: ignore ...
Ecotrust/nplcc
deploy/wsgi.py
import sys import site import os project = '/usr/local/apps/nplcc/nplcc' ve = '/usr/local/apps/nplcc/env' vepath = os.path.join(ve, 'lib/python2.7/site-packages') prev_sys_path = list(sys.path) # add the site-packages of our virtualenv as a site dir site.addsitedir(vepath) # add the app's directory to the PYTHONPATH ...
CJ-Wright/pyIID
pyiid/tests/test_scatter_internals.py
""" Rigorously test the flattened CPU kernel against the NXN kernel, step by step. """ from __future__ import print_function from pyiid.experiments.elasticscatter import ElasticScatter from pyiid.experiments.elasticscatter.kernels.cpu_flat import ( get_d_array as k_d, get_r_array as k_r, get_normalization_...
daxm/fmcapi
unit_tests/upgrades.py
import logging import fmcapi import time from unit_tests import wait_for_task def test__upgrades(fmc): logging.info( "Test UpgradePackages/ApplicableDevices/Upgrades with Task." " This will copy the listed upgrade file to registered devices" ) package_name = "Cisco_FTD_Patch-6.3.0.3-77.s...
mhvk/numpy
numpy/f2py/tests/test_return_character.py
import pytest from numpy import array from numpy.testing import assert_ from . import util import platform IS_S390X = platform.machine() == 's390x' class TestReturnCharacter(util.F2PyTest): def check_function(self, t, tname): if tname in ['t0', 't1', 's0', 's1']: assert_(t(23) == b'2') ...
Neurita/boyle
boyle/files/search.py
# coding=utf-8 """ Function helpers to search for files using glob, re and os.walk. """ #------------------------------------------------------------------------------- #Author: Alexandre Manhaes Savio <alexsavio@gmail.com> #Grupo de Inteligencia Computational <www.ehu.es/ccwintco> #Universidad del Pais Vasco UPV/EHU ...
all-of-us/raw-data-repository
rdr_service/alembic/versions/7aed6936ccee_new_pm_resource.py
"""new pm resource Revision ID: 7aed6936ccee Revises: 7aad615d6979 Create Date: 2020-01-29 08:51:35.381339 """ from alembic import op import sqlalchemy as sa import model.utils from sqlalchemy.dialects import mysql from rdr_service.participant_enums import PhysicalMeasurementsStatus, QuestionnaireStatus, OrderStatus...
tommy-u/enable
kiva/fonttools/sstruct.py
"""sstruct.py -- SuperStruct Higher level layer on top of the struct module, enabling to bind names to struct elements. The interface is similar to struct, except the objects passed and returned are not tuples (or argument lists), but dictionaries or instances. Just like struct, we use format strings to describe a da...
DemocracyClub/EveryElection
every_election/apps/organisations/migrations/0038_copy_org_data.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [("organisations", "0037_organisationgeography")] operations = [ migrations.RunSQL( """ INSERT INTO organisations_organisati...
pprett/statsmodels
statsmodels/robust/norms.py
import numpy as np #TODO: add plots to weighting functions for online docs. class RobustNorm(object): """ The parent class for the norms used for robust regression. Lays out the methods expected of the robust norms to be used by statsmodels.RLM. Parameters ---------- None : Some ...
binarydud/almanac
almanac/models.py
from urllib import quote_plus from sqlalchemy import ( Column, Integer, Text, String, DateTime, ForeignKey, Boolean, Numeric ) from sqlalchemy.orm import relationship, backref from sqlalchemy.ext.declarative import declarative_base, declared_attr from sqlalchemy.orm import ( scoped...
kcompher/FreeDiscovUI
freediscovery/server/tests/test_various.py
# -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import os import pytest import json import itertools from unittest import SkipTest from numpy.testing import assert_equal, assert_almost_equal f...
BlueDragonX/formalchemy_mustache
tests/test_init.py
# Copyright (c) 2011-2012 Ryan Bourgeois <bluedragonx@gmail.com> # # This project is free software according to the BSD-modified license. Refer to # the LICENSE file for complete details. """ Tests for formalchemy_mustache.__init__. """ import os import unittest from formalchemy import config from formalchemy_mustache...
JazzeYoung/VeryDeepAutoEncoder
theano/gof/tests/test_fg.py
from __future__ import absolute_import, print_function, division import os import pickle import sys import unittest from nose.plugins.skip import SkipTest import theano from theano.compat import PY3 from theano.gof import CachedConstantError, FunctionGraph from theano import tensor as tt class TFunctionGraph(unitte...
atztogo/phonopy
phonopy/harmonic/dynmat_to_fc.py
"""Transform dynamical matrix to force constants.""" # Copyright (C) 2014 Atsushi Togo # All rights reserved. # # This file is part of phonopy. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Redistributions of ...
toastdriven/eliteracing
docs/tests/test_views.py
import mock import os from django.core.urlresolvers import reverse from django.test import TestCase class TestDocsViews(TestCase): def test_list(self): resp = self.client.get(reverse('docs_list')) self.assertEqual(resp.status_code, 200) def test_api_v1_courses(self): resp = self.clie...
nuagenetworks/vspk-python
vspk/v6/nuikeencryptionprofile.py
# -*- coding: utf-8 -*- # # Copyright (c) 2015, Alcatel-Lucent Inc, 2017 Nokia # 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 copyrigh...
ocefpaf/conda-smithy
conda_smithy/configure_feedstock.py
import glob from itertools import product, chain import logging import os import subprocess import textwrap import yaml import warnings from collections import OrderedDict, namedtuple import copy import hashlib import requests # The `requests` lib uses `simplejson` instead of `json` when available. # In consequence th...
nschloe/python4gmsh
src/pygmsh/_cli.py
import argparse from sys import version_info import meshio from .__about__ import __gmsh_version__, __version__ from ._optimize import optimize def optimize_cli(argv=None): parser = argparse.ArgumentParser( description=("Optimize mesh."), formatter_class=argparse.RawTextHelpFormatter, ) ...
koparasy/faultinjection-gem5
src/python/m5/params.py
# Copyright (c) 2004-2006 The Regents of The University of Michigan # Copyright (c) 2010 Advanced Micro Devices, Inc. # 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 co...
dimagi/commcare-hq
corehq/apps/sms/migrations/0029_daily_outbound_sms_limit_reached.py
# Generated by Django 1.11.8 on 2018-02-02 12:12 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('sms', '0028_messagingevent_source'), ] operations = [ migrations.CreateModel( name='DailyOutboundSMSLimitReached', ...
Rethought/globaldict
build.py
#!/usr/bin/env python # -*- coding: utf8 -*- """ Creates a country database with ISO 2 and ISO 3 character codes, ISO number, name and international dialing codes. The data comes from three sources: * United Nations statistics * WorldAtlas.com * Wikipedia This code merges data from the three sources, con...
atztogo/phonopy
phonopy/interface/turbomole.py
"""CRYSTAL calculator interface.""" # Copyright (C) 2019 Antti J. Karttunen (antti.j.karttunen@iki.fi) # All rights reserved. # # This file is part of phonopy. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Red...
UT-CHG/PolyADCIRC
examples/run_framework/poly_walls/poly_walls5.py
#! /usr/bin/env python # import necessary modules import polyadcirc.run_framework.domain as dom import polyadcirc.run_framework.random_wall as rmw import numpy as np run_no = 4 walls_per_run = 3 adcirc_dir = '/work/01837/lcgraham/v50_subdomain/work' grid_dir = adcirc_dir + '/ADCIRC_landuse/Inlet/inputs/poly_walls' sa...
owlfish/pubtal
lib/pubtal/plugins/markdown.py
""" Classes to handle HTMLText and Catalogues in PubTal. Copyright (c) 2015 Colin Stewart (http://www.owlfish.com/) All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source c...
jupyter/nbgrader
setup.py
#!/usr/bin/env python # coding: utf-8 # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. import os from setuptools import setup, find_packages # get paths to all the extension files extension_files = [] for (dirname, dirnames, filenames) in os.walk("nbgrader/nbextens...
marcua/qurk_experiments
qurkexp/join/sort-results.py
#!/usr/bin/env python import sys, os ROOT = os.path.abspath('%s/../..' % os.path.abspath(os.path.dirname(__file__))) sys.path.append(ROOT) os.environ['DJANGO_SETTINGS_MODULE'] = 'qurkexp.settings' from django.core.management import setup_environ from django.conf import settings from qurkexp.join.models import * from q...
CarterBain/Medici
ib/ext/EClientErrors.py
#!/usr/bin/env python """ generated source for module EClientErrors """ # # Original file copyright original author(s). # This file copyright Troy Melhase, troy@gci.net. # # WARNING: all changes to this file will be lost. # # * EClientErrors.java # * # # package: com.ib.client class EClientErrors(object): """...
bokeh/bokeh
bokeh/settings.py
#----------------------------------------------------------------------------- # Copyright (c) 2012 - 2022, Anaconda, Inc., and Bokeh Contributors. # All rights reserved. # # The full license is in the file LICENSE.txt, distributed with this software. #-------------------------------------------------------------------...
sprockets/sprockets.mixins.json_error
sprockets/mixins/json_error/__init__.py
""" mixins.json_error Handler mixin for writing JSON errors """ version_info = (1, 0, 0) __version__ = '.'.join(str(v) for v in version_info) class JsonErrorMixin(object): """Mixin to write errors as JSON.""" def write_error(self, status_code, **kwargs): """Suppress the automatic rendering of HTML ...
lcamacho/airmozilla
airmozilla/main/tests/test_context_processors.py
import datetime from nose.tools import eq_, ok_ from django.contrib.auth.models import User, AnonymousUser from django.test import TestCase from django.test.client import RequestFactory from django.conf import settings from django.utils import timezone from django.core.cache import cache from funfactory.urlresolvers...
avastjohn/maventy_new
search/views.py
# -*- coding: utf-8 -*- from django.conf import settings from django.core.paginator import Paginator, InvalidPage from django.db import models from django.http import Http404, HttpResponseRedirect, HttpResponse from django.template.defaultfilters import force_escape from django.utils.translation import ugettext_lazy as...
jamespacileo/django-france
django/db/backends/mysql/base.py
""" MySQL database backend for Django. Requires MySQLdb: http://sourceforge.net/projects/mysql-python """ import re import sys try: import MySQLdb as Database except ImportError, e: from django.core.exceptions import ImproperlyConfigured raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e) ...
ProjectNugget/Project-Nugget
nugget/nuggetbase/NuggetBase.py
""" * Copyright (C) The Project "Nugget" Team - All Rights Reserved * Written by Jordan Maxwell <jordanmax@nxt-studios.com>, May 1st, 2017 * Licensing information can found in 'LICENSE', which is part of this source code package. """ from panda3d.core import Filename, ExecutionEnvironment, WindowProperties, CullBi...
robot527/Algorithms
python/quick_sort.py
#! /usr/bin/python def generate_random_integer_list(n, stop=100): from random import randrange lst = [] for i in range(n): lst.append(randrange(stop)) return lst def quick_sort(lst): if len(lst) <= 1: return lst else: pivot = lst[0] return quick_sort([item for...
matteobachetti/srt-single-dish-tools
setup.py
#!/usr/bin/env python # Licensed under a 3-clause BSD style license - see LICENSE.rst # NOTE: The configuration for the package, including the name, version, and # other information are set in the setup.cfg file. import os import sys from setuptools import setup # First provide helpful messages if contributors try...
cornell-brg/pymtl
pymtl/tools/translation/verilog.py
#======================================================================= # verilog.py #======================================================================= from __future__ import print_function import sys import collections import tempfile from subprocess import check_output, STDOUT, CalledProcessError f...
Youwotma/splash
splash/browser_tab.py
# -*- coding: utf-8 -*- from __future__ import absolute_import import base64 import functools import os import weakref import uuid from PyQt5.QtCore import QObject, QSize, Qt, QTimer, pyqtSlot, QEvent, QPointF from PyQt5.QtGui import QMouseEvent from PyQt5.QtNetwork import QNetworkRequest from PyQt5.QtWebKitWidgets im...
keflavich/gaussfitter
gaussfitter/tests/test_gaussfitter.py
from __future__ import division,absolute_import import unittest import numpy as np import gaussfitter as gf class GaussfitCase(unittest.TestCase): def test_simple_fit(self): # fit a 2D gaussian function centered at (64, 64) with width 8 # inpars = [height,amplitude,center_x,center_y,width_x,width_y...
SUNET/eduid-webapp
src/eduid_webapp/actions/tests/test_app.py
# -*- coding: utf-8 -*- # # Copyright (c) 2018 NORDUnet A/S # All rights reserved. # # Redistribution and use in source and binary forms, with or # without modification, are permitted provided that the following # conditions are met: # # 1. Redistributions of source code must retain the above copyright # ...
madongfly/grpc
test/core/end2end/gen_build_yaml.py
#!/usr/bin/env python2.7 # Copyright 2015, Google Inc. # 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 lis...
dholstein/elephant
elephant/test/test_spike_train_correlation.py
# -*- coding: utf-8 -*- """ Unit tests for the spike_train_correlation module. :copyright: Copyright 2015 by the Elephant team, see AUTHORS.txt. :license: Modified BSD, see LICENSE.txt for details. """ import unittest import numpy as np from numpy.testing.utils import assert_array_equal, assert_array_almost_equal im...
rolfmichelsen/Just4Fun
crypto/test_frequencyanalysis.py
#! /usr/bin/env python3 # # See https://github.com/rolfmichelsen/Just4Fun for latest # version, licensing terms and more. # # © Rolf Michelsen, 2018. All rights reserved. import frequencyanalysis import unittest class FrequencyAnalysisTest(unittest.TestCase): def testFrequencyAnalysis1(self): """ ...
jeremyjbowers/nba_py
nba_py/player.py
from nba_py import _api_scrape, _get_json, CURRENT_SEASON from nba_py.constants import * class PlayerList: _endpoint = 'commonallplayers' def __init__(self, league_id=League.NBA, season=CURRENT_SEASON, only_current=1): self.json = _get_json(endpoint=...
cbertinato/pandas
pandas/tests/indexing/multiindex/test_xs.py
from itertools import product import numpy as np import pytest from pandas import DataFrame, Index, MultiIndex, Series, concat, date_range import pandas.core.common as com from pandas.util import testing as tm @pytest.fixture def four_level_index_dataframe(): arr = np.array([[-0.5109, -2.3358, -0.4645, 0.05076,...
benregn/cookiecutter-django-ansible
{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/config/wsgi.py
""" WSGI config for {{ cookiecutter.project_name }} project. This module contains the WSGI application used by Django's development server and any production WSGI deployments. It should expose a module-level variable named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover this application via t...
chromium2014/src
tools/perf/measurements/page_cycler.py
# Copyright 2012 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. """The page cycler measurement. This measurement registers a window load handler in which is forces a layout and then records the value of performance.now()...
voidshard/pywysteria
examples/07/main.py
""" Example07: Search everything """ import wysteria def main(): client = wysteria.Client() with client: search = client.search() search.params() # Although generally not good practice, we don't have to give query args # Most likely one should use pagination here! # A...
CJ-Wright/pyIID
pyiid/asa.py
import math from builtins import range from ase.data import vdw_radii import numpy as np __doc__ = """ Calculate the accessible-surface area of atoms. Uses the simple Shrake-Rupley algorithm, that generates a relatively uniform density of dots over every atoms and eliminates those within the sphere of another atom....
SEL-Columbia/commcare-hq
corehq/apps/reports/tests/test_time_and_date_manipulations.py
from django.test import TestCase from corehq.apps.reports.views import calculate_hour, recalculate_hour, calculate_day class TimeAndDateManipulationTest(TestCase): def calculate_hour_test(self): self.assertEqual(calculate_hour(10, 2, 0), (12, 0)) self.assertEqual(calculate_hour(10, -2, 0), (8, 0))...
paepcke/json_to_relation
scripts/lookupOpenEdxHash.py
#!/usr/bin/env python # Copyright (c) 2014, Stanford University # All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: # 1. Redistributions of source code must retain the above copyright notice, this list ...
dragonrider23/rabbithole
rh/common.py
# -*- coding: utf-8 -*- """ This modules contains functions and utilities used throughout the application. This module is also responsible for fulfilling command invokations. """ from __future__ import print_function from subprocess import Popen from datetime import datetime import os import os.path import errno import...
endlessm/chromium-browser
third_party/catapult/third_party/gsutil/gslib/tests/test_requester_pays.py
# -*- coding: utf-8 -*- # Copyright 2017 Google Inc. 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. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless require...
endlessm/chromium-browser
third_party/catapult/dashboard/dashboard/services/isolate_test.py
# Copyright 2017 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. from __future__ import print_function from __future__ import division from __future__ import absolute_import import base64 import unittest import zlib impo...
benjaminestes/countgrab-client
countgrab.py
#!/usr/bin/python3 import argparse import sys import json import urllib.request import csv KEYLIST = ['Pinterest', 'LinkedIn', 'Facebook like_count', 'StumbleUpon', 'Facebook share_count', 'Facebook total_count', 'GooglePlusOne', 'Delicious', 'Twitter', 'Facebook commentsbox_count', ...
frkasper/MacroUtils
tests/common/star.py
# -*- coding: utf-8 -*- """ Created on Fri Apr 27 08:47:26 2018 @author: Fabio Kasper """ import os import sys def _assert_exists(f): assert os.path.exists(f), 'File does not exist: %s' % f def _executable(starhome): """Return full path to STAR-CCM+""" if _is_linux(): star_exe = os.path.join(st...
puttarajubr/commcare-hq
settingshelper.py
import os import tempfile import uuid class SharedDriveConfiguration(object): def __init__(self, shared_drive_path, restore_dir, transfer_dir, temp_dir): self.shared_drive_path = shared_drive_path self.restore_dir_name = restore_dir self.transfer_dir_name = transfer_dir self.temp_d...
noamelf/Open-Knesset
laws/models.py
# encoding: utf-8 import re, logging, random, sys, traceback from datetime import date, timedelta from django.db import models, IntegrityError from django.contrib.contenttypes import generic from django import forms from django.utils.translation import ugettext_lazy as _ from django.utils.safestring import mark_safe f...
junmin-zhu/chromium-rivertrail
chrome/installer/util/prebuild/create_string_rc.py
#!/usr/bin/env python # Copyright (c) 2012 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. """This script generates an rc file and header (setup_strings.{rc,h}) to be included in setup.exe. The rc file includes translation...
rogerhoward/hasbabyhbeenborn
config.py
"""Application configuration file. Load by 'import config', not 'from config import *' Access properties as 'config.property' """ import os, json log = True debug = True host = '0.0.0.0' port = 5000 project_directory = os.path.dirname(os.path.realpath(__file__)) modules_directory_name = 'modules' modules_directory...
ENCODE-DCC/snovault
src/snovault/tests/test_authentication.py
import unittest from pyramid.testing import DummyRequest class TestNamespacedAuthenticationPolicy(unittest.TestCase): """ This is a modified version of TestRemoteUserAuthenticationPolicy """ def _getTargetClass(self): from snovault.authentication import NamespacedAuthenticationPolicy retur...
indro/t2c
apps/external_apps/schedule/models.py
from django.contrib.contenttypes import generic from django.db import models from django.db.models import Q from django.contrib.auth.models import User from django.contrib.contenttypes.models import ContentType from django.core.urlresolvers import reverse from schedule.periods import Month from schedule.occurrence impo...
ronaldahmed/SLAM-for-ugv
neural-navigation-with-lstm/MARCO/nltk/draw/chart.py
# Natural Language Toolkit: Chart Parser Demo # # Copyright (C) 2001 University of Pennsylvania # Author: Edward Loper <edloper@gradient.cis.upenn.edu> # URL: <http://nltk.sf.net> # For license information, see LICENSE.TXT # # $Id: chart.py,v 1.1.1.2 2004/09/29 21:58:04 adastra Exp $ """ A graphical tool for exploring...
pgmpy/pgmpy
pgmpy/metrics/bn_inference.py
import numpy as np import pandas as pd from pgmpy.sampling import BayesianModelInference class BayesianModelProbability(BayesianModelInference): """ Class to calculate probability (pmf) values specific to Bayesian Models """ def __init__(self, model): """ Class to calculate probabili...
clicheio/cliche
tests/name_test.py
from sqlalchemy.schema import Column, ForeignKey from sqlalchemy.types import Integer, String from cliche.name import Name, Nameable from cliche.sqltypes import HashableLocale as Locale class NameableNumber(Nameable): __tablename__ = 'nameable_numbers' __mapper_args__ = { 'polymorphic_identity': 'nam...
humbhenri/pyOthello
setup.py
from distutils.core import setup import py2exe, glob, os origIsSystemDLL = py2exe.build_exe.isSystemDLL # save the orginal before we edit it def isSystemDLL(pathname): # checks if the freetype and ogg dll files are being included if os.path.basename(pathname).lower() in ("libfreetype-6.dll", "libogg-0.dll", "s...