repo_name
stringlengths
5
104
path
stringlengths
4
248
content
stringlengths
102
99.9k
cgeoffroy/son-analyze
utils/ci/fixtures/sonata-integration/sources/image/p.py
import sys import gc import time import math from twisted.internet import epollreactor epollreactor.install() from twisted.internet import reactor from twisted.web.client import HTTPConnectionPool import treq pool = HTTPConnectionPool(reactor) loop_counter = 0 acc = [] p = 60 sp = 40 def c(x_in_period): # tmp...
mapr/sahara
sahara/plugins/mapr/services/yarn/yarn.py
# Copyright (c) 2015, MapR Technologies # # 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...
google-research/google-research
aav/util/residue_encoding.py
# coding=utf-8 # Copyright 2022 The Google Research Authors. # # 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 applicab...
InformaticsMatters/squonk
components/rdkit-camel/src/main/python/mol_fps/mol_fps.py
# Functions to calculate molecular fingerprints, find similarities and do clustering from java import lang from java.lang import Class lang.System.loadLibrary('GraphMolWrap') # Pull it in as a stream of string from org.RDKit import * class GetFP(): def __init__(self): self.description = "Class to find Fi...
treethought/flask-assistant
flask_assistant/core.py
import inspect import sys import os from functools import wraps, partial import aniso8601 from flask import current_app, json, request as flask_request, _app_ctx_stack from werkzeug.local import LocalProxy from flask_assistant import logger from flask_assistant.response import _Response from flask_assistant.manager i...
openbiosd/PrecisionFda-Test-App
dbNSFP_parser2.py
''' Missense variant miner: find missense variants in ExAC, score them using PROVEAN, MutPred and dbNSFP return csv file. ''' from __future__ import print_function import os import sys import pandas as pd import csv import zipfile Chr = sys.argv[1] ENSG = sys.argv[2] OUT_FILE = "ExAC_OUT.csv" FILENAME4 = "dbN...
RedHatInsights/insights-core
insights/parsers/qemu_xml.py
""" QemuXML - file ``/etc/libvirt/qemu/*.xml`` and ``/var/run/libvirt/qemu/*.xml`` ============================================================================== Parsers provided by this module are: QemuXML - file ``/etc/libvirt/qemu/*.xml`` ------------------------------------------ VarQemuXML - file ``/var/run/lib...
foglamp/FogLAMP
tests/unit/python/foglamp/services/core/interest_registry/test_change_callback.py
from unittest.mock import MagicMock, patch, Mock, call import pytest import aiohttp from foglamp.common.configuration_manager import ConfigurationManager from foglamp.services.core.service_registry.service_registry import ServiceRegistry from foglamp.common.storage_client.storage_client import StorageClientAsync from ...
rahiel/supervisor-alert
setup.py
#!/usr/bin/env python from setuptools import setup from supervisor_alert import __version__ try: import pypandoc import re long_description = pypandoc.convert("README.md", "rst") # remove raw html blocks, they're not supported on pypi long_description = re.sub("\s+\.\. raw:: html\s*.+? -->", "", ...
felinx/poweredsites
poweredsites/libs/pagination.py
# -*- coding: utf-8 -*- # # Copyright(c) 2010 poweredsites.org # # 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 applic...
caedm/cabs
broker/app/cabsbroker.py
#!/usr/bin/python2 ## CABS_Server.py # This is the webserver that is at the center of the CABS system. # It is asynchronous, and as such the callbacks and function flow can be a bit confusing # The basic idea is that the HandleAgentFactory and HandleClienFactory make new HandleAgents and Handle Clients # There is one ...
joehack3r/aws
scripts/s3/getS3BucketSize.py
#!/usr/bin/env python import argparse import boto3 import logging import os def main(): # Arguments parser = argparse.ArgumentParser(description='Go through S3 buckets to determine size') parser.add_argument('-b', '--buckets', action='store', metavar='<S3 Bucket>', nargs='+', dest='bucket_filter', required=...
DataONEorg/d1_python
client_onedrive/src/d1_onedrive/impl/drivers/dokan/const.py
# This work was created by participants in the DataONE project, and is # jointly copyrighted by participating institutions in DataONE. For # more information on DataONE, see our web site at http://dataone.org. # # Copyright 2009-2017 DataONE # # Licensed under the Apache License, Version 2.0 (the "License"); # you ma...
hfp/tensorflow-xsmm
tensorflow/contrib/distributions/python/ops/bijectors/fill_triangular.py
# Copyright 2018 The TensorFlow Authors. 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 required by applica...
Dreamacro/Razord
CTFd/admin.py
from flask import render_template, request, redirect, abort, jsonify, url_for, session, Blueprint from CTFd.utils import sha512, is_safe_url, authed, admins_only, is_admin, unix_time, unix_time_millis, get_config, set_config, sendmail, rmdir from CTFd.models import db, Teams, Solves, Challenges, WrongKeys, Keys, Tags, ...
napalm-automation/napalm-yang
napalm_yang/models/openconfig/network_instances/network_instance/mpls/te_global_attributes/mpls_admin_groups/admin_group/state/__init__.py
# -*- coding: utf-8 -*- from operator import attrgetter from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType from pyangbind.lib.yangtypes import RestrictedClassType from pyangbind.lib.yangtypes import TypedListType from pyangbind.lib.yangtypes import YANGBool from pyangbind.lib.yangtypes import YANGListTy...
jdilallo/jdilallo-test
examples/dfa/v1_20/create_user_role.py
#!/usr/bin/python # # Copyright 2014 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 required b...
agdsn/pycroft
pycroft/model/logging.py
# Copyright (c) 2015 The Pycroft Authors. See the AUTHORS file. # This file is part of the Pycroft project and licensed under the terms of # the Apache License, Version 2.0. See the LICENSE file for details. """ pycroft.model.logging ~~~~~~~~~~~~~~ This module contains the classes LogEntry, UserLogEntry, T...
curtiswest/pepi
server/tests/test_stream.py
import pytest from server import MJPGStreamer def _random_image_gen(resolution=(704, 528)): import numpy as np return (np.random.rand(resolution[1], resolution[0], 3) * 255).astype(np.uint8) def test_newest_file_in_folder_generator(tmpdir): second_newest = str(tmpdir) + '/0.txt' newest = str(tmpdir...
pz325/hornbook
wsgi/hornbook/lexicon/migrations/0001_initial.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ] operations = [ migrations.CreateModel( name='Hanzi', fields=[ ('content', models.CharField(m...
pahaz/fabtools
fabtools/require/mysql.py
""" MySQL ===== This module provides high-level tools for installing a MySQL server and creating MySQL users and databases. """ from __future__ import with_statement from fabtools.mysql import * from fabtools.deb import is_installed, preseed_package from fabtools.require.deb import package from fabtools.require.serv...
albertz/music-player
mac/pyobjc-framework-Quartz/Examples/Programming with Quartz/BasicDrawing/Images.py
import sys import DataProvidersAndConsumers import Utilities from Quartz import * import Quartz from LaunchServices import * # kUTType* constants def drawJPEGImage(context, url): # Create a Quartz data provider for the supplied URL. jpgProvider = CGDataProviderCreateWithURL(url) if jpgProvider is None:...
shichao-an/ctci
chapter4/question4.7.py
from __future__ import print_function from tree import create_tree def lowest_common_ancestor_aux(root, p, q): """Assume both `p` and `q` exist in `root`""" if root is None: return None if p == root or q == root: return root left_lca = lowest_common_ancestor_aux(root.left, p, q) ri...
angr/angr
angr/storage/memory_mixins/paged_memory/pages/__init__.py
import typing from angr.storage.memory_mixins import MemoryMixin from .cooperation import CooperationBase, MemoryObjectMixin from .ispo_mixin import ISPOMixin from .refcount_mixin import RefcountMixin from .permissions_mixin import PermissionsMixin from .history_tracking_mixin import HistoryTrackingMixin class PageB...
opalytics/opalytics-ticdat
examples/expert_section/engine_generic/fantop.py
# # Author: Pete Cacioppi Opalytics.com https://lnkd.in/bUhfyNn # # Solves a fantasy football drafting problem. Tries to maximize the weighted # expected points of a draft, while obeying min/max restrictions for different # positions (to include a maximum-flex-players constraint). # # Pre-computes the expected draft po...
erickt/pygments
tests/test_token.py
# -*- coding: utf-8 -*- """ Test suite for the token module ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import unittest import StringIO import sys from pygments import token class TokenTest(unittest.T...
SectorLabs/pytest-benchmark
src/pytest_benchmark/cli.py
import argparse import py from pytest_benchmark.csv import CSVResults from . import plugin from .logger import Logger from .plugin import add_csv_options from .plugin import add_display_options from .plugin import add_global_options from .plugin import add_histogram_options from .table import TableResults from .util...
pusscat/refNes
nesCart.py
# http://fms.komkon.org/EMUL8/NES.html#LABM import sys import os code_path = os.path.dirname(__file__) code_path = os.path.join(code_path, "nesMappers") sys.path.append(code_path) import struct import mapper class Rom(object): def __init__(self, romPath, cpu): self.path = romPath romData = open(...
jriehl/numba
numba/cuda/tests/cudapy/test_array_methods.py
from __future__ import print_function, absolute_import, division from numba import unittest_support as unittest import numpy as np from numba import cuda from numba.cuda.testing import SerialMixin def reinterpret_array_type(byte_arr, start, stop, output): # Tested with just one thread val = byte_arr[start:st...
danirus/django-comments-xtd
example/custom/mycomments/admin.py
from django.contrib import admin from django.utils.translation import gettext_lazy as _ from django_comments_xtd.admin import XtdCommentsAdmin from custom.mycomments.models import MyComment class MyCommentAdmin(XtdCommentsAdmin): list_display = ('thread_level', 'title', 'cid', 'name', 'content_type', ...
ubccr/pinky
pinky/canonicalization/traverse.py
""" FROWNS LICENSE Copyright (c) 2001-2003, Brian Kelley 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...
dokato/connectivipy
connectivipy/aec/utils.py
import numpy as np import scipy.signal as ss FQ_BANDS = {'theta': [6, 7], 'alpha': [8, 13], 'beta': [15, 25], 'low-gamma': [30, 45], 'high-gamma': [55, 70]} def check_bands_correct(band): return band in FQ_BANDS.keys() def design_band_filter(lowcut, highcut, fs, rp...
aterrel/dynd-python
dynd/tests/test_lowlevel.py
import sys import unittest import ctypes from dynd import nd, ndt, _lowlevel class TestLowLevel(unittest.TestCase): def type_id_of(self, dt): assert isinstance(dt, ndt.type) bd = _lowlevel.get_base_type_ptr(dt) if bd < _lowlevel.type_id.BUILTIN_TYPE_ID_COUNT: return bd e...
windelbouwman/ppci-mirror
test/lang/c/test_c.py
import unittest import io from ppci.common import CompilerError from ppci.lang.c import CBuilder, render_ast, print_ast, COptions from ppci.arch.example import ExampleArch from ppci import ir from ppci.irutils import verify_module class CFrontendTestCase(unittest.TestCase): """ Test if various C-snippets build co...
jbn/ipython-magic
gvmagic.py
""" Graphviz IPython magic extensions Magic methods: %dot <dot graph> %%dot <dot ... ... graph> %dotstr "<dot graph>" %dotobj obj.to_dot() %dotobjs obj[0].to_dot(), obj[1].to_dot(), ... also: %twopi, %neato, %sdp, %fsdp, and %circo magic families. Usage: %load_ext gvmagic """ from sub...
jdfekete/progressivis
progressivis/table/intersection.py
""" Range Query module. """ from __future__ import annotations from progressivis.core.module import ReturnRunStep from progressivis.core.utils import indices_len from progressivis.core.bitmap import bitmap from progressivis.table.nary import NAry from progressivis.table.table_base import BaseTable, TableSelectedView ...
tyb0807/angr
tests/test_checkbyte.py
import angr import logging l = logging.getLogger("angr.tests") import os test_location = str(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../binaries/tests')) arches = ( "armel", "i386", "mips", "mipsel", "ppc64", "ppc", "x86_64" ) # TODO: arches += ( "armhf", ) def run_checkbyte(arch): p = ang...
hexlism/xx_net
launcher/web_control.py
#!/usr/bin/env python # coding:utf-8 import os, sys current_path = os.path.dirname(os.path.abspath(__file__)) if __name__ == "__main__": python_path = os.path.abspath( os.path.join(current_path, os.pardir, 'python27', '1.0')) noarch_lib = os.path.abspath( os.path.join(python_path, 'lib', 'noarch')) sys.pa...
nicholasserra/sentry
setup.py
#!/usr/bin/env python """ Sentry ====== Sentry is a realtime event logging and aggregation platform. It specializes in monitoring errors and extracting all the information needed to do a proper post-mortem without any of the hassle of the standard user feedback loop. Sentry is a Server ------------------ The Sentry ...
kreeger/etcetera
checkout/forms.py
import urllib from django import forms from django.contrib.localflavor.us import forms as lfus from django.contrib.auth import models as auth from django.contrib.admin import widgets as adminwidgets from etcetera.structure import models as structure from etcetera.checkout import models as checkout from etcetera.extra...
sdss/marvin
tests/tools/test_query.py
# !usr/bin/env python2 # -*- coding: utf-8 -*- # # Licensed under a 3-clause BSD license. # # @Author: Brian Cherinka # @Date: 2017-05-25 10:11:21 # @Last modified by: Brian Cherinka # @Last Modified time: 2018-11-20 13:29:52 from __future__ import absolute_import, division, print_function from imp import reload ...
puttarajubr/commcare-hq
corehq/apps/data_interfaces/forms.py
from couchdbkit import ResourceNotFound from crispy_forms.bootstrap import StrictButton, InlineField, FormActions, FieldWithButtons from django import forms from crispy_forms.helper import FormHelper from crispy_forms.layout import Layout, Field, HTML, Div, Fieldset from django.utils.safestring import mark_safe from dj...
yymax/x509test
src/Certificate.py
""" This file contains all generation logic and data structure relating to the X509 certificate. Class Certificate represents a single certificate. Other peripheral classes supply information to the Certificate object. @author: Calvin Jia Liang Created on May 15, 2014 """ from pyasn1.codec.der import decoder, encoder...
tryolabs/luminoth
luminoth/utils/image_vis.py
import io import numpy as np import os import logging import PIL.Image as Image import PIL.ImageDraw as ImageDraw import PIL.ImageFont as ImageFont import tensorflow as tf from .bbox_overlap import bbox_overlap from .bbox_transform import decode from base64 import b64encode from sys import stdout # flake8: noqa font...
volkandkaya/trading
config/urls.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.conf import settings from django.conf.urls import include, url from django.conf.urls.static import static from django.contrib import admin from django.views.generic import TemplateView urlpatterns = [ url(r'^$', TemplateView.as_view(templ...
ashchristopher/django-concurrent-server
concurrent_server/management/commands/runcserver.py
import django from django.core.management.base import BaseCommand, CommandError from django.conf import settings from optparse import make_option import os import sys class Command(BaseCommand): option_list = BaseCommand.option_list + ( make_option('--noreload', action='store_false', dest='use_reloader', ...
qedsoftware/commcare-hq
corehq/ex-submodules/pillow_retry/migrations/0003_auto_20151002_0944.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, IntegrityError from corehq.sql_db.operations import HqRunPython def rename_static_data_source_pillow_errors(apps, schema_editor): PillowError = apps.get_model("pillow_retry", "PillowError") old_name = 'corehq.a...
acrisci/i3ipc-python
test/test_ticks.py
from ipctest import IpcTest class TestTicks(IpcTest): events = [] def on_tick(self, i3, e): self.events.append(e) if len(self.events) == 3: i3.main_quit() def test_tick_event(self, i3): i3.on('tick', self.on_tick) i3._event_socket_setup() i3.send_tick(...
dgraziotin/libckan
tests/logic/action/get/test_term.py
import nose.tools import libckan.logic.action.get as get import libckan.model.client as client import libckan.model.exceptions as exceptions def test_vocabulary_list(): results = get.vocabulary_list(client=client.Client()) assert results['success'] is True assert isinstance(results['result'], list) #TOD...
rockymeza/ymrj
ingress/migrations/0001_initial.py
# -*- coding: utf-8 -*- # Generated by Django 1.10.4 on 2017-03-28 01:42 from __future__ import unicode_literals from django.db import migrations, models import phonenumber_field.modelfields class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations....
rfleschenberg/django-shop
shop/models/address.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals """ Holds all the information relevant to the client (addresses for instance) """ from six import with_metaclass from django.db import models from django.template import Context from django.template.loader import select_template from django.utils.translati...
josenavas/QiiTa
qiita_pet/test/tornado_test_base.py
# ----------------------------------------------------------------------------- # 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. # ------------------------------------------------...
Pylons/kai
kai/lib/base.py
"""The base Controller API Provides the BaseController class for subclassing. """ from babel import Locale, UnknownLocaleError from babel.support import Format from babel.util import UTC from couchdb import Database from paste.deploy.converters import asbool from pylons.controllers import WSGIController from pylons.co...
benthomasson/cookiecutter
cookiecutter/prompt.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ cookiecutter.prompt --------------------- Functions for prompting the user for project info. """ from collections import OrderedDict import click from .compat import iteritems, is_string from jinja2.environment import Environment def read_user_variable(var_name, ...
bryanwweber/UConnRCMPy
docs/conf.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # UConnRCMPy documentation build configuration file, created by # sphinx-quickstart on Sat Jan 9 10:26:33 2016. # # 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 #...
dimagi/commcare-hq
corehq/ex-submodules/casexml/apps/case/xml/parser.py
""" This isn't really a parser, but it's the code that generates case-like objects from things from xforms. """ import datetime from casexml.apps.case import const from casexml.apps.case.xml import DEFAULT_VERSION, V1, V2, NS_REVERSE_LOOKUP_MAP from dimagi.utils.logging import notify_error from dimagi.utils.parsing im...
roijo/C-PAC_complexitytools
CPAC/community/utils/split.py
import glob import shutil files = glob.glob('*.1D') dest_list = ['group1', 'group2'] all_count = 0 bad_count = 0 not_found = [] with open('Yalegroups.txt', 'r') as grouplist: for line in grouplist.read().splitlines(): if line.strip(): if 'Group 1' in line: dest_flag = 0 continue if 'Group 2' in line:...
m-sanders/wagtail
wagtail/tests/testapp/models.py
from __future__ import unicode_literals from django.db import models from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger from django.utils.encoding import python_2_unicode_compatible from taggit.models import TaggedItemBase from modelcluster.fields import ParentalKey from modelcluster.tags impor...
yfpeng/pengyifan-bllip
bllipbioc/bllip_wrapper.py
from __future__ import print_function __author__ = 'Yifan Peng' import logging import sys import tempfile import os from bllipparser.ModelFetcher import download_and_install_model from bioc import * def init_model(): """Downloads and installs model if necessary. :return: model path :rtype: str """ ...
tvincentNuoDB/nuodb-python
pynuodb/encodedsession.py
"""A module for housing the EncodedSession class. Exported Classes: EncodedSession -- Class for representing an encoded session with the database. """ __all__ = [ 'EncodedSession' ] import uuid import struct import decimal import sys from .crypt import toByteString, fromByteString, toSignedByteString, fromSignedBy...
rackerlabs/django-DefectDojo
dojo/tools/openvas_csv/parser.py
import csv import hashlib import io from dateutil.parser import parse from dojo.models import Endpoint, Finding class ColumnMappingStrategy(object): mapped_column = None def __init__(self): self.successor = None def map_column_value(self, finding, column_value): pass @staticmeth...
infrae/moai
moai/provider/oai.py
import os from zope.interface import implements from oaipmh.client import Client from oaipmh.metadata import MetadataRegistry from oaipmh.error import NoRecordsMatchError from lxml import etree from moai.interfaces import IContentProvider from moai.provider.file import FileBasedContentProvider class OAIBasedContentP...
guorendong/iridium-browser-ubuntu
third_party/chromite/scripts/cros_sysroot_utils.py
# Copyright 2015 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Collection of tools to create sysroots.""" from __future__ import print_function import os import sys from chromite.lib import brick_lib from chrom...
shaunokeefe/gigs
gigs/gig_registry/migrations/0009_copy_comment_to_tmp.py
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import DataMigration from django.db import models class Migration(DataMigration): def forwards(self, orm): "Write your forwards methods here." # Note: Remember to use orm['appname.ModelName'] rather than "from appname.mo...
cedadev/mistamover
lib/DatasetArrivalMonitor.py
# BSD Licence # Copyright (c) 2012, Science & Technology Facilities Council (STFC) # All rights reserved. # # See the LICENSE file in the source distribution of this software for # the full license text. import os import time from AbstractDatasetController import AbstractDatasetController import ReceiptFile import Co...
lovette/flask_shadowsession
flask_shadowsession.py
# -*- coding: utf-8 -*- from flask.sessions import SecureCookieSessionInterface, SecureCookieSession, total_seconds from flask_redisdict import RedisDict from redis import StrictRedis SHADOW_KEY_NAME = 'shadow_key' class ShadowSessionDict(RedisDict): """Acts like a dictionary but reflects item access to Redis....
adamfast/faadata
faadata/awoses/models.py
from django.conf import settings from django.contrib.gis.db import models from faadata.airports.models import Airport class AWOS(models.Model): identifier = models.CharField(max_length=5) sensor_type = models.CharField(max_length=10) commissioned = models.BooleanField(default=False) point = models.Poin...
rsalmaso/django-cms
cms/tests/test_static_placeholder.py
from django.contrib.admin.sites import site from django.template import Context from django.template.base import Template from cms.api import add_plugin from cms.models import Placeholder, StaticPlaceholder, UserSettings from cms.tests.test_plugins import PluginsTestBaseCase from cms.utils.urlutils import admin_rever...
janvanrijn/openml-pimp
openmlpimp/utils/search.py
import collections import openmlpimp from ConfigSpace.hyperparameters import UniformFloatHyperparameter, \ UniformIntegerHyperparameter, CategoricalHyperparameter from scipy.stats import gaussian_kde from sklearn.model_selection._search import BaseSearchCV from sklearn.model_selection._search import ParameterSam...
kitmonisit/microlab-instruments
microlab_instruments/base_classes.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ .. module:: base_classes :synopsis: Defines the base classes from which all instruments are derived. """ import aardvark_py as aapy import gpib import serial import socket import time from random import randint from array import array from struct import unpack cla...
groupe-conseil-nutshimit-nippour/django-geoprisma
geoprisma/core/widgets/widgetbase.py
import json import re from django.utils.safestring import mark_safe class WidgetBase(object): """ Classe de base pour les widgets """ def __init__(self, widgetModel=None): if widgetModel: self.id = widgetModel.id self.name = widgetModel.name s...
KozikR/wirelessHome_local_panel
gui.py
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'MainWindow.ui' # # Created: Thu Oct 29 18:47:29 2015 # by: pyside-uic 0.2.13 running on PySide 1.1.1 # # WARNING! All changes made in this file will be lost! from PySide import QtCore, QtGui class Ui_MainWindow(object): def setupU...
lavish205/olympia
src/olympia/search/tests/test_views.py
# -*- coding: utf-8 -*- import json import urlparse from django.http import QueryDict from django.test.client import RequestFactory import mock import pytest from elasticsearch import Elasticsearch from pyquery import PyQuery as pq from olympia import amo from olympia.addons.models import ( Addon, AddonCategory...
followthesheep/galpy
nose/test_streamdf.py
from __future__ import print_function, division import functools import nose import numpy from scipy import interpolate sdf_bovy14= None #so we can set this up and then use in other tests sdft_bovy14= None #so we can set this up and then use in other tests, trailing # Decorator for expected failure def expected_failur...
vascotenner/holoviews
tests/testrenderclass.py
# -*- coding: utf-8 -*- """ Test cases for rendering exporters """ from io import BytesIO from hashlib import sha256 from unittest import SkipTest import numpy as np from holoviews.plotting.mpl.renderer import MPLRenderer from holoviews import HoloMap, Image, ItemTable from holoviews.element.comparison import Comparis...
photocrowd/dj-stripe
djstripe/middleware.py
# -*- coding: utf-8 -*- from django.conf import settings from django.urls import resolve from django.shortcuts import redirect from .utils import subscriber_has_active_subscription from .settings import subscriber_request_callback DJSTRIPE_SUBSCRIPTION_REQUIRED_EXCEPTION_URLS = getattr( settings, "DJSTRIPE_S...
h5py/h5py
h5py/_hl/selections.py
# This file is part of h5py, a Python interface to the HDF5 library. # # http://www.h5py.org # # Copyright 2008-2013 Andrew Collette and contributors # # License: Standard 3-clause BSD; see "license.txt" for full license terms # and contributor agreement. """ High-level access to HDF5 dataspace selectio...
ernestoarbitrio/django-highcharts
highcharts/views/speedometer.py
from django.views.generic import View from highcharts.views.common import HighChartsDualAxisView class HighChartsSpeedometerView(HighChartsDualAxisView, View): chart_type = 'gauge' _series = [] _yaxis = [] _pane = [] def get_data(self): data = super(HighChartsSpeedometerView, self).get_d...
stscieisenhamer/glue
glue/plugins/dendro_viewer/layer_artist.py
from __future__ import absolute_import, division, print_function import numpy as np from glue.utils import defer_draw from glue.core.exceptions import IncompatibleAttribute from glue.core.subset import Subset # from glue.core.layer_artist import MatplotlibLayerArtist, ChangedTrigger from glue.viewers.matplotlib.laye...
tgavankar/unifolio
apps/portfolio/models.py
from datetime import datetime from django import forms from django.conf import settings from django.contrib.auth.models import User from django.core.urlresolvers import reverse from django.db import models from portfolio.utils import auto_delete_files from upload.models import UploadedFile class Gallery(models.Mode...
jimfmunro/djangodash2013
dash/search/utils.py
import re from string import split from users.models import User from music.models import MusicProfile def parse_search(search_string): # remove all non-alpha chars cleaned_string = re.sub(r'\W+', ' ', search_string) # split search string on whitespace terms = split(cleaned_string) return terms ...
menglewis/raffle_manager
tests/test_auth.py
import unittest from raffle import create_app, db from raffle.settings import TestingConfig from raffle.auth.models import User from raffle.auth.views import load_user from raffle.auth.forms import RegisterForm, LoginForm class UserModelTestCase(unittest.TestCase): def setUp(self): self.app = create_app(...
kaushik94/sympy
sympy/physics/matrices.py
"""Known matrices related to physics""" from __future__ import print_function, division from sympy import Matrix, I, pi, sqrt from sympy.functions import exp from sympy.core.compatibility import range def msigma(i): r"""Returns a Pauli matrix `\sigma_i` with `i=1,2,3` References ========== .. [1] ...
guillermooo/Vintageous_Plugin_Dart
cmds.py
import sublime import sublime_plugin from Vintageous import plugins from Vintageous.vi.cmd_defs import ViOperatorDef from Vintageous.vi.utils import modes @plugins.register(seq='<C-.><C-.>', modes=(modes.NORMAL,)) class ViDartOpenCommandPalette(ViOperatorDef): def __init__(self, *args, **kwargs): super()...
Intelworks/OpenTAXII
tests/services/test_subscription_management.py
import pytest from libtaxii.constants import ( RT_FULL, CB_STIX_XML_111, ACT_PAUSE, ACT_RESUME, ACT_UNSUBSCRIBE, ACT_SUBSCRIBE, SS_ACTIVE, SS_PAUSED, SS_UNSUBSCRIBED) from opentaxii.taxii import exceptions from utils import ( prepare_headers, as_tm, prepare_subscription_request as prepare_request) f...
OstapHEP/ostap
ostap/math/sp_interpolation.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # ============================================================================= ## @file ostap/math/sp_interpolation.py # Module with some useful scipy-based utilities for dealing with interpolation. # @author Vanya BELYAEV Ivan.Belyaev@cern.ch # @date 2020-02-28 # ===...
WaveBlocks/WaveBlocksND
examples/double_well/double_well_1D_f_2.py
algorithm = "fourier" propagator = "fourier" T = 2 * 4.4 dt = 0.0005 dimension = 1 ncomponents = 1 eps = 0.1 potential = {} potential["variables"] = ["x"] potential["potential"] = "x**4 - x**2" # The grid of our simulation domain limits = [(-6.283185307179586, 6.283185307179586)] number_nodes = [4096] # The param...
danakj/chromium
third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/views/printing_unittest.py
# Copyright (C) 2010, 2012 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 list of conditions an...
mogoweb/chromium-crosswalk
build/android/pylib/flag_changer.py
# 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. import constants import logging import traceback class FlagChanger(object): """Changes the flags Chrome runs with. There are two different use cas...
glasnt/voc
tests/datatypes/test_list.py
from .. utils import TranspileTestCase, UnaryOperationTestCase, BinaryOperationTestCase, InplaceOperationTestCase class ListTests(TranspileTestCase): def test_setattr(self): self.assertCodeExecution(""" x = [1, 2, 3] x.attr = 42 print('Done.') """) def ...
Uran198/med
med/questions/migrations/0012_auto_20151231_0830.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models import autoslug.fields from django.conf import settings class Migration(migrations.Migration): dependencies = [ ('questions', '0011_question_is_closed'), ] operations = [ migrations....
vlegoff/tsunami
src/primaires/salle/commandes/addroom/__init__.py
# -*-coding:Utf-8 -* # Copyright (c) 2010-2017 LE GOFF Vincent # 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 # ...
ReekenX/django-bodystat
urls.py
from django.conf.urls.defaults import * from settings import MEDIA_ROOT # Administration from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', (r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': MEDIA_ROOT}), (r'^admin/', include(admin.site.urls)), ) urlpattern...
hydratk/hydratk-lib-network
src/hydratk/lib/data/xml.py
# -*- coding: utf-8 -*- """Utilities for advanced work and validation of xml data format .. module:: lib.data.xmlgen :platform: Unix :synopsis: Utilities for advanced work and validation of xml data format .. moduleauthor:: Petr Czaderna <pc@hydratk.org> """ from lxml import etree from hydratk.lib.system import...
AvneeshSarwate/DBD
wizard.py
''' Created on May 1, 2013 @author: avneeshsarwate ''' ''' Created on Mar 23, 2013 @author: avneeshsarwate ''' #!/usr/bin/python # repository.py import wx import sys from wx.lib.mixins.listctrl import CheckListCtrlMixin, ListCtrlAutoWidthMixin import OSC packages = [('abiword', '5.8M', 'base'), ('adie', '145k', 'b...
Suor/django-pickling
tests/test_db.py
import pytest try: import cPickle as pickle except ImportError: import pickle from .models import Post pytestmark = pytest.mark.django_db @pytest.mark.django_db @pytest.fixture def post(): return Post.objects.create(title='Pickling') def test_equal(post): restored = pickle.loads(pickle.dumps(post...
xenim/django-radioportal-news
radioportal_news/admin.py
from django.contrib import admin from markitup.widgets import AdminMarkItUpWidget from models import * class EntryAdmin(admin.ModelAdmin): list_display = ('title', 'date', 'is_active',) ordering = ('-date',) search_fields = ('title',) list_filter = ('is_active', 'date',) list_editable = ('is_act...
ashmastaflash/halocelery
apputils/halo.py
import cloudpassage import os from .utility import Utility as util from .formatter import Formatter as fmt from .utility import Utility class Halo(object): def __init__(self): self.halo_api_key = os.getenv("HALO_API_KEY") self.halo_api_secret = os.getenv("HALO_API_SECRET_KEY") self.halo_ap...
mixman/djangodev
tests/regressiontests/utils/feedgenerator.py
import datetime from django.utils import feedgenerator, tzinfo, unittest class FeedgeneratorTest(unittest.TestCase): """ Tests for the low-level syndication feed framework. """ def test_get_tag_uri(self): """ Test get_tag_uri() correctly generates TagURIs. """ self.ass...
awesomebytes/etherdream_tools
web_engine/translation_dxf.py
#!/usr/bin/env python #coding:utf-8 # Based on the example copydxf from mozman -- <mozman@gmx.at> import sys import time from ezdxf import readfile def translation_dxf(fromfile, tofile, x, y): starttime = time.time() dwg = readfile(fromfile) #print "dwg is type:" + str(type(dwg)) translation_x_y(dw...