repo_name
stringlengths
5
104
path
stringlengths
4
248
content
stringlengths
102
99.9k
laurenbarker/SHARE
share/migrations/0008_auto_20161207_1535.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.7 on 2016-12-07 15:35 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion import share.models.fields class Migration(migrations.Migration): dependencies = [ ('share', '0007_auto_20161122_1810'...
sassoftware/rbuild
rbuild/productstore/__init__.py
# # Copyright (c) SAS Institute Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in w...
julien6387/supvisors
supvisors/test/scripts/check_starting_strategy.py
#!/usr/bin/python # -*- coding: utf-8 -*- # ====================================================================== # Copyright 2017 Julien LE CLEACH # # 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 Lice...
gsnedders/Template-Python
t/string_test.py
from template.test import TestCase, main class StringTest(TestCase): def testString(self): self.Expect(DATA) DATA = r""" -- test -- [% USE String -%] string: [[% String.text %]] -- expect -- string: [] -- test -- [% USE String 'hello world' -%] string: [[% String.text %]] -- expect -- string: [hello world] ...
Fauxmoehawkeen/soundcloud-python-master
soundcloud/tests/test_resource.py
try: import json except ImportError: import simplejson as json from soundcloud.resource import wrapped_resource, ResourceList, Resource from soundcloud.tests.utils import MockResponse from nose.tools import eq_ def test_json_list(): """Verify that a json list is wrapped in a ResourceList object.""" ...
incuna/incuna-groups
groups/migrations/0016_attachedfile.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models from django.conf import settings import django.utils.timezone class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('groups', '00...
Yubico/yubiadmin
yubiadmin/util/app.py
# Copyright (c) 2013 Yubico AB # 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 of conditi...
HERA-Team/hera_mc
hera_mc/cm_revisions.py
# -*- mode: python; coding: utf-8 -*- # Copyright 2017 the HERA Collaboration # Licensed under the 2-clause BSD license. """ Functions to handle various cm revision queries and checks. LAST, ACTIVE, ALL, <specific> are handled (typically) via get_revisions_of_type. FULL revisions are called directly (get_full_revisio...
angr/angr
angr/procedures/linux_kernel/getrlimit.py
import logging import angr ###################################### # getrlimit ###################################### l = logging.getLogger(name=__name__) #pylint:disable=redefined-builtin,arguments-differ class getrlimit(angr.SimProcedure): def run(self, resource, rlim): if self.state.solver.eval(resour...
navin-bhaskar/NewsReader-on-Linkit7688
config.py
#The audio card number to be used; use "aplay -l" output to determine the card number AUDIO_CARD_NUMBER = 1 # Define the IR/button input pin INP_PIN = 2 # Speed with which the converted text is to be spoken TTS_SPEED = 70 # Config server to spawned ot not, set to false if you do not want the config server CONF...
dps/simplescheduler
tests/test_scheduler.py
# -*- coding: utf-8 -*- from simplescheduler import Scheduler, Job from datetime import timedelta import unittest class FakeRedis(object): def __init__(self): self._r = {} self._ledger = [] def sadd(self, key, member): self._ledger.append('SADD %s:%s' % (key, member)) if n...
jmcnamara/XlsxWriter
xlsxwriter/test/comparison/test_chart_line02.py
############################################################################### # # Tests for XlsxWriter. # # SPDX-License-Identifier: BSD-2-Clause # Copyright (c), 2013-2022, John McNamara, jmcnamara@cpan.org # from ..excel_comparison_test import ExcelComparisonTest from ...workbook import Workbook class TestCompar...
sushi-irc/tekka
signal_handler.py
# coding:UTF-8 """ Copyright (c) 2009-2010 Marian Tietz 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 of conditions...
KrisKennaway/pyapple2disk
src/apple2disk/process.py
import disk import dos33disk import os import sys def main(): disks = {} for root, dirs, files in os.walk(sys.argv[1]): for f in files: if not f.lower().endswith('.dsk') and not f.lower().endswith('.do'): continue print f b = bytearray(open(os.path....
hackerberry/ooni-probe
old-to-be-ported-code/old-api/httpt.py
""" This is a self genrated test created by scaffolding.py. you will need to fill it up with all your necessities. Safe hacking :). """ from zope.interface import implements from twisted.python import usage from twisted.plugin import IPlugin from ooni.plugoo.tests import ITest, OONITest from ooni.plugoo.assets import A...
rbirger/OxfordHCVNonSpatial
Non-Spatial Model Outline and Code_old.py
# -*- coding: utf-8 -*- # <nbformat>3.0</nbformat> # <markdowncell> # ###Description and preliminary code for Continuous-Time Markov Chain Model # # This model will test the importance of including a spatial component in the system. We will use ODEs to describe the dynamics of each lineage and competition between li...
pizzapanther/GAE-Bulk-Mailer
bulkmail/middleware.py
from django import http from django.conf import settings from google.appengine.api import users from .exceptions import ParameterRequired, ApiException class User (object): def __init__ (self): self._email = None self._is_super = None self._is_auth = None self._userid = None self.user = No...
fbennett/legal-resource-registry
attic/WALK-FILES.py
#!/usr/bin/python import os,sys,json,re for dirpath,dirnames,filenames in os.walk("data/courts/us"): indexPath = os.path.join(dirpath,"index.txt") if not os.path.exists(indexPath): print "Oops: %s" % indexPath sys.exit() fh = open(indexPath) lines = [] template = None firstCon...
mindbody/API-Examples
SDKs/Python/test/test_client_api.py
# coding: utf-8 """ MINDBODY Public API No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501 OpenAPI spec version: v6 Generated by: https://github.com/swagger-api/swagger-codegen.git """ from __future__ import absolute_import impo...
thedrow/invoke
invoke/parser/context.py
from ..vendor.lexicon import Lexicon from .argument import Argument def to_flag(name): name = name.replace('_', '-') if len(name) == 1: return '-' + name return '--' + name def sort_candidate(arg): names = arg.names # TODO: is there no "split into two buckets on predicate" builtin? s...
cloudtools/troposphere
troposphere/detective.py
# Copyright (c) 2012-2022, Mark Peek <mark@peek.org> # All rights reserved. # # See LICENSE file for full license. # # *** Do not modify - this file is autogenerated *** from . import AWSObject, PropsDictType, Tags from .validators import boolean class Graph(AWSObject): """ `Graph <http://docs.aws.amazon.co...
iamahuman/angr
tests/test_concrete_packed_elf32.py
import angr import claripy import nose import os import subprocess try: import avatar2 from angr_targets import AvatarGDBConcreteTarget except ImportError: raise nose.SkipTest() binary_x86 = os.path.join(os.path.dirname(os.path.realpath(__file__)), os.path.join('..', '..', 'bina...
sgagnon/lyman-tools
roi/extract_copes.py
#! /usr/bin/env python """ Extract mean parameter estimates from ROI """ import os import sys import re import os.path as op from textwrap import dedent import argparse from subprocess import call from scipy import stats import scipy as sp import numpy as np import pandas as pd import nibabel as nib import lyman fro...
jeffrobots/senseRF
app/add_data.py
from datetime import datetime import peewee import itertools import random from time import sleep from models import Sensor, SensorData, init_db sensors = [{"id": 1, "location": "Living Room", "late_updated": datetime.now(), "name": "greenpi", "refresh_rate": 30} ...
access-missouri/am-django-project
am/legislative/migrations/0002_auto_20170705_2126.py
# -*- coding: utf-8 -*- # Generated by Django 1.11 on 2017-07-05 21:26 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('legislative', '0001_initial'), ] operations = [ migrations.AlterField( ...
scikit-image/skimage-demos
mm_color_cluster.py
# Auto-clustering, suggested by Matt Terry from skimage import io, color, exposure from sklearn import cluster, preprocessing import numpy as np import matplotlib.pyplot as plt url = 'http://blogs.mathworks.com/images/steve/2010/mms.jpg' import os if not os.path.exists('mm.jpg'): print("Downloading M&M's...") ...
lastweek/gem5
src/mem/Bus.py
# Copyright (c) 2012 ARM Limited # All rights reserved. # # The license below extends only to copyright in the software and shall # not be construed as granting a license to any other intellectual # property including but not limited to intellectual property relating # to a hardware implementation of the functionality ...
FranzSchubert92/cw
python/powers_of_3.py
""" Powers of Three: Given a positive integer N, return the largest integer k such that 3**k < N. For example, >>> largestPower(3) 0 >>> largestPower(4) 1 >>> largestPower(28) 3 >>> largestPower(80) 3 >>> largestPower(82) 4 >>> largestPower(20700) 9 >>> largestPower(10**7) 14 >>> largestPower(10**8) 16 """ from mat...
mistermatti/plugz
setup.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import sys from setuptools.command.test import test as TestCommand try: from setuptools import setup except ImportError: from distutils.core import setup import plugz readme = open('README.rst').read() history = open('HISTORY.rst').read().replace('.. ...
matthiaskramm/corepy
examples/spu_interspu.py
# Copyright (c) 2006-2009 The Trustees of Indiana University. # All rights reserved. # # Redistribution and use in source and binary forms, with or without ...
20tab/django-taggit-live
setup.py
import os from setuptools import setup, find_packages from setuptools.dist import Distribution import pkg_resources import taggit_live setup(name='django-taggit-live', version=taggit_live.__version__, description="It's an autocomplete widget for django-taggit TagField", author='20tab srl: Raffaele Co...
watsonpy/watson-auth
watson/auth/providers/abc.py
import abc from sqlalchemy.orm import exc from watson.auth import crypto from watson.auth.providers import exceptions from watson.common import imports from watson.common.decorators import cached_property class Base(object): config = None session = None def __init__(self, config, session): self....
hsoft/aurdiff
update.py
# Copyright 2013 Virgil Dupras (http://www.hardcoded.net) # # This software is licensed under the "BSD" License as described in the "LICENSE" file, # which should be included with this package. import os.path as op from urllib.request import urlopen import subprocess import json from bs4 import BeautifulSoup HERE =...
jonathanmeier5/teamstore
saleor/teamstore/migrations/0004_teamstore_shipping_method.py
# -*- coding: utf-8 -*- # Generated by Django 1.10.7 on 2017-06-25 15:19 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('shipping', '0005_auto_20170616_1351'), ('teamstore'...
kiddhustle/wiardfmblog
wiardfmblog/management/commands/gruntserver.py
import os import subprocess import atexit import signal from django.conf import settings from django.contrib.staticfiles.management.commands.runserver import Command\ as StaticfilesRunserverCommand class Command(StaticfilesRunserverCommand): def inner_run(self, *args, **options): self.start_grunt() ...
rmvanhees/pys5p
src/pys5p/ckd_io.py
""" This file is part of pyS5p https://github.com/rmvanhees/pys5p.git Provides access to the S5P Tropomi CKD (static and dynamic) ToDo ---- - access to UVN CKD, still incomplete - identify latest Static CKD product, e.g. using the validity period Copyright (c) 2018-2021 SRON - Netherlands Institute for Space Rese...
qedsoftware/commcare-hq
corehq/messaging/smsbackends/push/models.py
import requests from corehq.apps.sms.models import SQLSMSBackend from corehq.messaging.smsbackends.push.forms import PushBackendForm from django.conf import settings from lxml import etree from xml.sax.saxutils import escape OUTBOUND_REQUEST_XML = """<?xml version="1.0" encoding="UTF-8"?> <methodCall> <methodName...
robinson96/GRAPE
test/testGrape.py
#!/usr/bin/env python import sys import os import inspect import unittest import StringIO import shutil import tempfile curPath = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) if not curPath in sys.path: sys.path.insert(0, curPath) grapePath = os.path.join(curPath, "..") if grapePath n...
GuessWhoSamFoo/pandas
pandas/core/indexes/timedeltas.py
""" implement the TimedeltaIndex """ from datetime import datetime import warnings import numpy as np from pandas._libs import ( NaT, Timedelta, index as libindex, join as libjoin, lib) import pandas.compat as compat from pandas.util._decorators import Appender, Substitution from pandas.core.dtypes.common import...
wangjeaf/CSSCheckStyle
ckstyle/command/args.py
class CommandArgs(): def __init__(self): self.operation = None self.errorLevel = 2 self.recursive = False self.printFlag = False self.extension = '.ckstyle.txt' self.include = 'all' self.exclude = 'none' self.standard = '' self.exportJson = Fal...
bjodah/mpmath
mpmath/__init__.py
__version__ = '0.19' from .usertools import monitor, timing from .ctx_fp import FPContext from .ctx_mp import MPContext from .ctx_iv import MPIntervalContext fp = FPContext() mp = MPContext() iv = MPIntervalContext() fp._mp = mp mp._mp = mp iv._mp = mp mp._fp = fp fp._fp = fp mp._iv = iv fp._iv = iv iv._iv = iv # ...
gferreira/hTools2_extension
hTools2.roboFontExt/lib/hTools2/extras/equalize.py
# -*- coding: utf-8 -*- # equalize.py # by Jens Kutilek # https://github.com/jenskutilek/Curve-Equalizer #----------------------- # EQMethods/geometry.py #----------------------- from math import atan2, cos, pi, sin, sqrt # helper functions def getTriangleArea(a, b, c): return (b.x - a.x) * (c.y - a.y) - (c.x...
fake-name/ReadableWebProxy
WebMirror/management/rss_parser_funcs/feed_parse_extractShibbsdenCom.py
def extractShibbsdenCom(item): ''' Parser for 'shibbsden.com' ''' vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title']) if not (chp or vol) or "preview" in item['title'].lower(): return None tagmap = [ ('GOOD CHILD', 'Reborn as a Good Child', 'translated'), (...
JoltLabs/django-web-sugar
web_sugar/templatetags/jslint.py
import os.path import subprocess from django import template from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.templatetags.static import StaticNode from django.contrib.staticfiles import finders from django.contrib.staticfiles.storage import staticfiles_storage from...
OpenEntityMap/oem-client-anidb
examples/anidb_incremental_local_server.py
from argparse import ArgumentParser from flask import Flask, abort, send_from_directory import json import logging import os app = Flask(__name__) log = logging.getLogger(__name__) packages = {} @app.route('/<package>/<version>/<database>/<collection>/index.<extension>') def serve_index(package, version, database, c...
tjsavage/rototutor_djangononrel
django/forms/fields.py
""" Field classes. """ import datetime import os import re import time import urlparse import warnings from decimal import Decimal, DecimalException try: from cStringIO import StringIO except ImportError: from StringIO import StringIO from django.core.exceptions import ValidationError from django.core import valida...
alexlovelltroy/django-avatar
avatar/settings.py
from django.conf import settings try: from PIL import Image dir(Image) # Placate PyFlakes except ImportError: import Image AVATAR_DEFAULT_SIZE = getattr(settings, 'AVATAR_DEFAULT_SIZE', 80) AUTO_GENERATE_AVATAR_SIZES = getattr(settings, 'AUTO_GENERATE_AVATAR_SIZES', (AVATAR_DEFAULT_SIZE,)) AVATAR_RESIZE_M...
schoolie/bokeh
bokeh/core/property/tests/test_containers.py
from mock import patch import pytest from bokeh.models import ColumnDataSource import bokeh.core.property.containers as pc def test_notify_owner(): result = {} class Foo(object): @pc.notify_owner def test(self): pass def _notify_owners(self, old): result['old'] = old ...
1GHL/PythonLearn
study/use-function.py
a=['abc' ,'123' ,'ABDD'] for i in range(len(a)): print i ,a[i] ,len(a) ,len(a[i]) for i in range(10): print i #while True: # pass def fib(n): """Print a Fib """ a ,b = 0 ,1 while b < n: print b, a ,b = b ,a+b fib(30)
alexandermendes/pybossa-github-builder
tests/__init__.py
# -*- coding: utf8 -*- import sys import os import pybossa_github_builder as plugin from mock import patch # Use the PyBossa test suite sys.path.append(os.path.abspath("./pybossa/test")) from default import with_context def setUpPackage(): """Setup the plugin.""" from default import flask_app with flask...
jaredhoney/pyrad
pyrad/packet.py
# packet.py # # Copyright 2002-2005,2007 Wichert Akkerman <wichert@wiggy.net> # # A RADIUS packet as defined in RFC 2138 import struct import random try: import hashlib md5_constructor = hashlib.md5 except ImportError: # BBB for python 2.4 import md5 md5_constructor = md5.new import six from pyrad...
Amandil/django-tech-test
loans/tests/tests_model_business.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.test import TestCase from django.contrib.auth.models import User from django.db.utils import IntegrityError from django.core.exceptions import ValidationError from loans.models import Business class BusinessTestCase(TestCase): ''' Cr...
deanproxy/register
expenses/views.py
import logging import json import datetime import math from django.http import HttpResponse from django.shortcuts import render, get_object_or_404 from expenses.forms import ExpenseForm, SignupForm from expenses.models import Expense, Balance from django.core import serializers from django.db import IntegrityError fro...
homeworkprod/byceps
tests/integration/blueprints/admin/orga_team/test_team_views.py
""" :Copyright: 2006-2021 Jochen Kupperschmidt :License: Revised BSD (see `LICENSE` file for details) """ from byceps.services.orga_team import service as orga_team_service from byceps.services.party import service as party_service from tests.helpers import create_party def test_teams_for_party(orga_team_admin_clie...
FredLoney/nipype
nipype/interfaces/io.py
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """ Set of interfaces that allow interaction with data. Currently available interfaces are: DataSource: Generic nifti to named Nifti interface DataSink: Generic named output from interfaces to ...
clouserw/olympia
apps/search/forms.py
from django import forms from django.conf import settings from django.forms.util import ErrorDict import happyforms from tower import ugettext_lazy as _lazy import amo from amo import helpers from search.utils import floor_version collection_sort_by = ( ('weekly', _lazy(u'Most popular this week')), ('monthly...
antoinecarme/pyaf
tests/basic_checks/test_temporal_demo_hourly_D_H_ErrorMessage.py
# %matplotlib inline import pyaf import numpy as np import pandas as pd DATA_FREQ = 'H' PERIODS = ["D" , "H"] H = 365 N = H * 10 lDateColumn = "Date" lSignalVar = "Signal"; START_TIME = "2001-01-25" # generate a daily signal covering one year 2016 in a pandas dataframe np.random.seed(seed=1960) df_train = pd.DataFra...
sebalander/sebaPhD
dev/intrinsicCalibFullPyMC3.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Jan 2018 do metropolis sampling to estimate PDF of chessboard calibration. this involves intrinsic and extrinsic parameters, so it's a very high dimensional search space (before it was only intrinsic) @author: sebalander """ # %% # import glob import os i...
RobotWebTools/rosbridge_suite
rosbridge_library/test/internal/test_cbor_conversion.py
#!/usr/bin/env python3 import struct import unittest import rostest from rosbridge_library.internal.cbor_conversion import ( TAGGED_ARRAY_FORMATS, extract_cbor_values, ) try: from cbor import Tag except ImportError: from rosbridge_library.util.cbor import Tag from std_msgs.msg import ( Bool, ...
stuglaser/pychan
examples/ajmani-adv-patt.py
#!/usr/bin/env python # # Examples from the talk: # Sameer Ajmani - Advanced Go Concurrency Patterns - Google I/O 2013 # https://www.youtube.com/watch?v=QDDwwePbDtw # https://code.google.com/p/go/source/browse/2013/advconc?repo=talks import argparse import collections import random import threading import time f...
stuycs-softdev-fall-2013/proj3-7-cartwheels
utils/load.py
#!/usr/local/bin/python from website import carts import urllib2 import json def load(): carts.remove_all() request = 'http://data.cityofnewyork.us/resource/akqf-qv4n.json' for i in range(0, 24000, 1000): query = '?$offset=%d' % i data = urllib2.urlopen(request + query) results =...
ifduyue/sentry
tests/sentry/models/test_organization.py
from __future__ import absolute_import import copy import mock from sentry.models import ( ApiKey, AuditLogEntry, AuditLogEntryEvent, Commit, File, OrganizationMember, OrganizationMemberTeam, OrganizationOption, Project, Release, ReleaseCommit, ReleaseEnvironment, ReleaseFile, Team, TotpInterface, User, )...
serzans/wagtail
wagtail/wagtailsearch/tests/test_elasticsearch_backend.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals import os import unittest import datetime import json import mock from elasticsearch.serializer import JSONSerializer from django.test import TestCase from django.db.models import Q from wagtail.wagtailsearch.backends import get_search_backend from wag...
vikingco/django-advanced-reports
advreport_test_project/advreport_test_project/settings.py
# Django settings for advreport_test_project project. import importlib DEBUG = True TEMPLATE_DEBUG = DEBUG ADMINS = ( # ('Your Name', 'your_email@example.com'), ) MANAGERS = ADMINS DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or '...
sandialabs/BioCompoundML
bcml/Parser/read_training.py
""" This process takes in the training dataset and outputs a data structure that includes the name of the molecule, the predictor, and the CAS number Attributes: input_file (str): This is the training file that is read by the output Instance (class): This is a private class which structures each instan...
intake/filesystem_spec
fsspec/implementations/arrow.py
import errno import io import os import secrets import shutil from contextlib import suppress from functools import wraps from fsspec.spec import AbstractFileSystem from fsspec.utils import infer_storage_options, mirror_from, stringify_path def wrap_exceptions(func): @wraps(func) def wrapper(*args, **kwargs)...
Anber/django-extended-messages
setup.py
import os, extended_messages from setuptools import setup, find_packages if extended_messages.VERSION[-1] == 'final': CLASSIFIERS = ['Development Status :: 5 - Stable'] elif 'beta' in extended_messages.VERSION[-1]: CLASSIFIERS = ['Development Status :: 4 - Beta'] else: CLASSIFIERS = ['Development Status ::...
loopCM/chromium
tools/perf/perf_tools/dom_perf.py
# Copyright (c) 2013 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 json import math import os from telemetry.core import util from telemetry.page import page_measurement from telemetry.page import page_set def ...
AustereCuriosity/astropy
astropy/tests/helper.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ This module provides the tools used to internally run the astropy test suite from the installed astropy. It makes use of the `pytest` testing framework. """ from __future__ import (absolute_import, division, print_function, uni...
flask-admin/flask-admin
flask_admin/tests/mongoengine/__init__.py
from unittest import SkipTest from wtforms import __version__ as wtforms_version if int(wtforms_version[0]) < 2: raise SkipTest('MongoEngine does not support WTForms 1.') from flask import Flask from flask_admin import Admin from flask_mongoengine import MongoEngine def setup(): app = Flask(__name__) ap...
sosey/ginga
ginga/qtw/plugins/Catalogs.py
# # Catalogs.py -- Catalogs plugin for fits viewer # # Eric Jeschke (eric@naoj.org) # # Copyright (c) Eric R. Jeschke. All rights reserved. # This is open-source software licensed under a BSD license. # Please see the file LICENSE.txt for details. # from __future__ import print_function from ginga.qtw.QtHelp import ...
astrofrog/ginga
ginga/misc/Callback.py
# # Callback.py -- Mixin class for programmed callbacks. # # Eric Jeschke (eric@naoj.org) # # Copyright (c) Eric R. Jeschke. All rights reserved. # This is open-source software licensed under a BSD license. # Please see the file LICENSE.txt for details. # import sys, traceback class CallbackError(Exception): pass...
softak/webfaction_demo
vendor-local/lib/python/kombu/serialization.py
""" kombu.serialization =================== Serialization utilities. :copyright: (c) 2009 - 2011 by Ask Solem :license: BSD, see LICENSE for more details. """ import codecs import sys import pickle as pypickle try: import cPickle as cpickle except ImportError: cpickle = None # noqa from kombu.utils.encodi...
webadmin87/midnight
midnight_catalog/services.py
from django.conf import settings from django.db.models import Prefetch from midnight_catalog.models import Product, ParamValue def get_all(slug=None): """ Возвращает QuerySet содержащий выборку товаров :param slug: символьный код категории каталога, если не задан выбираются товары в не зависимости от кате...
fake-name/ReadableWebProxy
WebMirror/management/rss_parser_funcs/feed_parse_extractAhgashonixnoveltranslationWordpressCom.py
def extractAhgashonixnoveltranslationWordpressCom(item): ''' Parser for 'ahgashonixnoveltranslation.wordpress.com' ''' vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title']) if not (chp or vol) or "preview" in item['title'].lower(): return None tagmap = [ ('PRC', 'PRC', ...
sdss/marvin
python/marvin/web/controllers/__init__.py
# !usr/bin/env python2 # -*- coding: utf-8 -*- # # Licensed under a 3-clause BSD license. # # @Author: Brian Cherinka # @Date: 2016-12-08 14:24:58 # @Last modified by: Brian Cherinka # @Last Modified time: 2018-07-13 18:21:26 from __future__ import print_function, division, absolute_import from flask_classful impo...
automl/paramsklearn
ParamSklearn/components/data_preprocessing/balancing.py
import numpy as np from HPOlibConfigSpace.configuration_space import ConfigurationSpace from HPOlibConfigSpace.hyperparameters import CategoricalHyperparameter from ParamSklearn.components.base import \ ParamSklearnPreprocessingAlgorithm from ParamSklearn.constants import * class Balancing(ParamSklearnPreproces...
Nirvedh/CoarseCoherence
configs/tutorial/simple.py
# -*- coding: utf-8 -*- # Copyright (c) 2015 Jason Power # 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 con...
sbaechler/simpleshop
simpleshop/content.py
import plata from django.db import models from django.template import RequestContext from django.template.loader import render_to_string from django.utils.translation import ugettext_lazy as _ from feincms.admin.item_editor import FeinCMSInline from django import forms class ProductInline(FeinCMSInline): raw_id_fi...
jean/sentry
src/sentry/utils/samples.py
""" sentry.utils.samples ~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2013 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ from __future__ import absolute_import import os.path import random from datetime import datetime, timedelta import six from sentry.constants import D...
ainmosni/jolly_roger
jolly_roger/core/forms.py
# -*- coding: utf-8 -*- from django.contrib.auth import authenticate from django.forms import ValidationError import floppyforms as forms class LoginForm(forms.Form): """ Simple login form. """ username = forms.CharField() password = forms.CharField(widget=forms.widgets.PasswordInput) redir_...
florentbr/SeleniumBasic
FirefoxAddons/build-implicit-wait.py
"""Script to build the xpi add-in for firefox Usage : python build-implicit-wait.py "x.x.x.x" """ import os, re, sys, shutil, datetime, zipfile, glob CD = os.path.dirname(os.path.abspath(__file__)) SRC_DIR = CD + r'\implicit-wait' OUT_DIR = CD + r'\bin' RDF_PATH = CD + r'\implicit-wait\install.rdf' def main(args):...
Warvito/pydeeplearn
code/lib/cnnLayers.py
""" Types of conv net layers that pydeeplearn supports now.""" __author__ = "Mihaela Rosca" __contact__ = "mihaela.c.rosca@gmail.com" import numpy as np import numpy.random as random import theano from theano import tensor as T from theano.tensor.nnet import conv from theano.tensor.signal import downsample from act...
g2p/tranquil
tranquil/__init__.py
import re from django.core.exceptions import ImproperlyConfigured from sqlalchemy import create_engine, MetaData from sqlalchemy.orm import sessionmaker from tranquil.models import Importer __all__ = ( 'engine', 'meta', 'Session', ) class EngineCache(object): __shared_state = dict( engine = None, meta = None, ...
JonathonReinhart/killerbee
killerbee/kbutils.py
# Import USB support depending on version of pyUSB try: import usb.core import usb.util #import usb.backend.libusb01 #backend = usb.backend.libusb01.get_backend() USBVER=1 except ImportError: import usb #print("Warning: You are using pyUSB 0.x, future deprecation planned.") USBVER=0 imp...
mishbahr/django-connected
connected_accounts/providers/google.py
import logging from django.utils.translation import ugettext_lazy as _ from connected_accounts.conf import settings from connected_accounts.provider_pool import providers from .base import OAuth2Provider, ProviderAccount logger = logging.getLogger('connected_accounts') class GoogleAccount(ProviderAccount): de...
RDFLib/rdflib
test/test_n3.py
import os import pytest from rdflib.graph import Graph, ConjunctiveGraph import unittest from rdflib.term import Literal, URIRef from rdflib.plugins.parsers.notation3 import BadSyntax, exponent_syntax import itertools from urllib.error import URLError from test import TEST_DIR test_data = """ # Definitions of term...
rhcarvalho/kombu
kombu/tests/async/http/test_curl.py
# -*- coding: utf-8 -*- from __future__ import absolute_import from kombu.async.http.curl import READ, WRITE, CurlClient from kombu.tests.case import ( HubCase, Mock, call, patch, case_requires, set_module_symbol, ) @case_requires('pycurl') class test_CurlClient(HubCase): class Client(CurlClient): ...
petrilli/pkpserver
tests/test_pin_validation_error.py
# -*- coding: utf-8 -*- import unittest from flask import Flask from flask.ext.testing import TestCase from pkpserver import app as application class BaseTest(TestCase): def create_app(self): app = Flask(__name__) app.config['TESTING'] = True application.configure_api(app) return a...
davemerwin/django-oneforty
setup.py
from setuptools import setup, find_packages setup( name='django-oneforty', version=__import__('oneforty').__version__, description='django-oneforty is designed to be a simple, lightweight status/update engine.', long_description=open('README.txt').read(), author='Pure Blue Inc', author_email='d...
anhaidgroup/py_entitymatching
py_entitymatching/dask/dask_black_box_blocker.py
from collections import OrderedDict import logging import time import sys import pandas as pd import numpy as np import pyprind import dask from dask import delayed from dask.diagnostics import ProgressBar import cloudpickle as cp import pickle from py_entitymatching.blocker.blocker import Blocker import py_entitym...
mikulcak/forsyde_psopc
source_code/system_creation/lib/modify_arbiters.py
#!/usr/bin/python ## # # @file ## This script modifies the VHDL system code generated by SOPC Builder. # It parses the basic system description to find all slave modules that are connected to more than one master module and # modifies the SOPC-generated arbitrators to support a TDMA access scheme. # @copyright BSD N...
colour-science/colour-hdri
colour_hdri/generation/tests/test_radiance.py
# !/usr/bin/env python """Defines the unit tests for the :mod:`colour_hdri.generation.radiance` module.""" from __future__ import annotations import numpy as np import os import unittest from colour import RGB_COLOURSPACES from colour.hints import List from colour_hdri import TESTS_RESOURCES_DIRECTORY from colour_h...
hylje/Lyra
lyra/forms.py
# -*- encoding: utf-8 -*- import datetime from django import forms from django.db.models import Q from django.utils.translation import ugettext_lazy as _ from django.core import exceptions as django_exceptions from lyra import models class Reservation(forms.ModelForm): def __init__(self, *args, **kw...
fos/fos
examples/microcircuit_multi.py
import h5py import sys import os.path as op from fos import * import numpy as np a=np.loadtxt(op.join(op.dirname(__file__), "data", "rat-basal-forebrain.swc") ) pos = a[:,2:5].astype( np.float32 ) radius = a[:,5].astype( np.float32 ) * 4 # extract parent connectivity and create full connectivity parents = a[1:,6] - ...
dwillcox/pyreaclib
util/grid.py
""" Integrate a grid of dens and temp using the defaults in net.par.default This could use some updating to be more user-friendly Donald Willcox """ from __future__ import print_function import numpy as np import subprocess import re num_dens = 100 num_temp = 100 dens = np.logspace(8.0, 11.0, num=num_dens, endpoint=...
Idematica/django-oscar
oscar/apps/dashboard/orders/views.py
import datetime from decimal import Decimal as D, InvalidOperation from django.contrib import messages from django.utils.translation import ugettext_lazy as _ from django.core.urlresolvers import reverse from django.core.exceptions import ObjectDoesNotExist from django.db.models.loading import get_model from django.db...
psiinon/addons-server
src/olympia/versions/tests/test_views.py
# -*- coding: utf-8 -*- import os from django.conf import settings from django.utils.encoding import smart_text from django.core.files import temp from django.core.files.base import File as DjangoFile from django.utils.http import urlquote from unittest import mock from pyquery import PyQuery from olympia import am...
bastings/neuralmonkey
neuralmonkey/encoders/encoder_wrapper.py
"""Attention combination strategies. This modules implements attention combination strategies for multi-encoder scenario when we may want to combine the hidden states of the encoders in more complicated fashion. Currently there are two attention combination strategies flat and hierarchical (see paper `Attention Combi...
gjost/foxtabs
tests/test_foxtabs.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ test_foxtabs ---------------------------------- Tests for `foxtabs` module. """ import unittest from foxtabs import foxtabs class TestFoxtabs(unittest.TestCase): def setUp(self): pass def test_something(self): pass def tearDown(self)...