code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2019.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modif... | QISKit/qiskit-sdk-py | qiskit/visualization/pulse/matplotlib.py | Python | apache-2.0 | 22,579 |
# -*- coding: utf-8 -*-
'''
This module (mostly) uses the XenAPI to manage Xen virtual machines.
Big fat warning: the XenAPI used in this file is the one bundled with
Xen Source, NOT XenServer nor Xen Cloud Platform. As a matter of fact it
*will* fail under those platforms. From what I've read, little work is needed
t... | victorywang80/Maintenance | saltstack/src/salt/modules/xapi.py | Python | apache-2.0 | 24,954 |
#
# Author : Manuel Bernal Llinares
# Project : trackhub-creator
# Timestamp : 03-07-2017 11:10
# ---
# © 2017 Manuel Bernal Llinares <mbdebian@gmail.com>
# All rights reserved.
#
"""
Pipeline related exceptions
"""
from exceptions import AppException
class PipelineDirectorException(AppException):
def __i... | Proteogenomics/trackhub-creator | pipelines/exceptions.py | Python | apache-2.0 | 551 |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | iemejia/incubator-beam | sdks/python/apache_beam/pipeline_test.py | Python | apache-2.0 | 29,763 |
import re
filename = "equality.html"
f = open(filename,'r')
dump = f.read()
results = re.findall(r'<!--(.*?)-->',dump,re.DOTALL)
print results[1]
chrlist = re.findall(r'[a-z][A-Z]{3}([a-z])[A-Z]{3}[a-z]',results[1])
chrdict = {}
for charac in chrlist:
if charac in chrdict:
chrdict[charac] +=1
else:
ch... | oasisvali/pythonchallenge | ch3.py | Python | apache-2.0 | 390 |
##
# Copyright (c) 2013-2015 Apple 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 by applicable l... | red-hood/calendarserver | txdav/caldav/datastore/scheduling/test/test_work.py | Python | apache-2.0 | 30,721 |
__author__ = 'saeedamen'
#
# Copyright 2015 Thalesians Ltd. - http//www.thalesians.com / @thalesians
#
# 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
... | poeticcapybara/pythalesians | pythalesians-examples/marketliquidity_examples.py | Python | apache-2.0 | 758 |
# coding=utf-8
# Copyright 2021 Google Health Research.
#
# 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 la... | google/ehr-predictions | ehr_prediction_modeling/types.py | Python | apache-2.0 | 4,391 |
#!/usr/bin/env python
from manager import Plugin
from operator import itemgetter
import GeoIP
class GeoIPStats(Plugin):
def __init__(self, **kwargs):
self.gi = GeoIP.new(GeoIP.GEOIP_MEMORY_CACHE)
self.countries = {}
def process(self, **kwargs):
if 'remote_host' in kwargs:
... | rytis/Apache-access-log-parser | plugins/plugin_geoip_stats.py | Python | apache-2.0 | 767 |
"""
Test mock script that installs a test method provider for CIM method
AllTypesMethod() in CIM class PyWBEM_AllTypes, using the old setup approach
with global variables.
Note: This script and its method provider perform checks because their purpose
is to test the provider dispatcher. A real mock script with a real m... | pywbem/pywbemtools | tests/unit/pywbemcli/all_types_method_mock_v1old.py | Python | apache-2.0 | 2,630 |
"""Deletes an image store or Secondary Storage."""
from baseCmd import *
from baseResponse import *
class deleteImageStoreCmd (baseCmd):
typeInfo = {}
def __init__(self):
self.isAsync = "false"
"""The image store ID or Secondary Storage ID."""
"""Required"""
self.id = None
... | MissionCriticalCloud/marvin | marvin/cloudstackAPI/deleteImageStore.py | Python | apache-2.0 | 752 |
# Copyright 2018 Red Hat, 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 ... | openstack/python-tripleoclient | tripleoclient/tests/v1/tripleo/test_tripleo_upgrade.py | Python | apache-2.0 | 5,026 |
class Scheduler(object):
"""Define a domain."""
def __init__(self, matches, problem):
""".
PARAMETERS TYPE Potential Arguments
-----------------------------------------------
"""
self.matches = matches
schedule = []
self.allSchedules = []... | renatorangel/scheduler | src/structures/scheduler.py | Python | apache-2.0 | 566 |
import os
import sys
from direct.showbase.ShowBase import ShowBase
import panda3d.core as p3d
import blenderpanda
import inputmapper
from nitrogen import gamestates
if hasattr(sys, 'frozen'):
APP_ROOT_DIR = os.path.dirname(sys.executable)
else:
APP_ROOT_DIR = os.path.dirname(__file__)
if not APP_ROOT_DIR:
... | Moguri/prototype-nitrogen | game/main.py | Python | apache-2.0 | 1,902 |
def action_vakai_load_more(context, action, parent_entity_bundle, last_id, parent_entity_id, **args):
try:
parent_entity_type = 'Vakai'
parent_entity_id = int(parent_entity_id)
last_id = int(last_id)
output = Object()
db = IN.db
connection = db.connection
# TODO: paging
# get total
... | vinoth3v/In | In/vakai/page/load_more.py | Python | apache-2.0 | 2,553 |
#!/usr/bin/python
#_*_coding:utf-8_*_
"""makeTextFile.py -- create text file"""
import os
ls = os.linesep
fname = 'test.txt'
# get file name
while True:
if os.path.exists(fname):
print "ERROR: '%s already exists" % fname
else:
break
# get file content (text) line
all = []
print "\nEnter li... | git-ning/core-python-programming | makeTextFile.py | Python | apache-2.0 | 647 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack LLC.
# 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/... | kwminnick/rackspace-dns-cli | dnsclient/openstack/common/setup.py | Python | apache-2.0 | 12,670 |
#-------------------------------------------------------------------------------
# Name: Step 2 in map matching
# Purpose: Finds the links likely corresponding to each GPS ping
#
# Author: Pedro Camargo
#
# Created: 09/04/2017
# Copyright: (c) pcamargo 2017
# Licence: APACHE 2.0
#-------------... | pedrocamargo/map_matching | map_matching/finding_network_links.py | Python | apache-2.0 | 3,468 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
File: auth_check.py
Author: fangfei
Email: fangfei@youku.com
Description: jwt token processing and ldap Authorization
"""
from datetime import datetime, timedelta
import os
import sys
from functools import wraps
import logging
from flask import request, jsonify, g
im... | TifaSky/zenoss_midrest | app/utils/auth_check.py | Python | apache-2.0 | 3,684 |
import subprocess
from threading import Timer
def send_alert(message, log=None):
""" This function is used by ping_server.py to send alert
Do NOT change this function name.
:param message: Mess to be sent out
:param log: logger object passed from ping_server.py
:return: None
"""
try:
... | tuaminx/ping_server | send_alert.py | Python | apache-2.0 | 732 |
from flask import flash, redirect, render_template, url_for, request
from sqlalchemy.exc import IntegrityError
from app import app, db
from app.forms import AddGuestForm
from app.models import Guest
from app.util import flash_form_errors
@app.route('/guests/create', methods=['GET', 'POST'])
def add_guest():
add_... | Manuel7AP/dobc_web_app | app/views/add_guest.py | Python | apache-2.0 | 676 |
#
# Copyright (c) 2017 Intel Corporation
#
# 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 t... | NervanaSystems/coach | rl_coach/agents/n_step_q_agent.py | Python | apache-2.0 | 6,933 |
PLUGINS = (
'actions',
'filters',
'bookmark',
'export',
'layout',
'refresh',
'details',
'editable',
'relate',
'chart',
'ajax',
'relfield',
'inline',
'topnav',
'portal',
'quickform',
'wizard',
'images',
'auth',
'multiselect'... | shishengjia/OnlineCourses | extra_apps/xadmin/plugins/__init__.py | Python | apache-2.0 | 771 |
# -*- coding: utf-8 -*-
"""A plugin that gather extension IDs from Chrome history browser."""
import logging
import re
import requests
from plaso.analysis import interface
from plaso.analysis import manager
from plaso.lib import event
class ChromeExtensionPlugin(interface.AnalysisPlugin):
"""Convert Chrome exten... | 8u1a/plaso | plaso/analysis/chrome_extension.py | Python | apache-2.0 | 5,758 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
import matplotlib.pyplot as plt2
from numpy import *
from scipy import interpolate
from matplotlib import rcParams, rcParamsDefault
import argparse
from nema_common import *
outputformat = ""
def plot_rates(geometry,float_activity,N_true,... | JPETTomography/j-pet-gate-tools | examples/python_scripts/plot_sf_and_necr.py | Python | apache-2.0 | 7,141 |
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (C) 2013 Rackspace Hosting Inc. All Rights Reserved.
# Copyright (C) 2013 Yahoo! Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance wi... | jessicalucci/TaskManagement | taskflow/task.py | Python | apache-2.0 | 9,682 |
from abc import ABCMeta, abstractmethod
from django.conf import settings
from util.broker import BrokerDetails
class MessagingBackend(object):
__metaclass__ = ABCMeta
def __init__(self, backend_type):
"""Instantiates backend specific settings
"""
# Unique type of MessagingBackend, ... | ngageoint/scale | scale/messaging/backends/backend.py | Python | apache-2.0 | 2,030 |
import exception
import logging
import os
import shlex
import subprocess
import time
import yaml
LOG = logging.getLogger('roadrunner.core')
class DefinitionSet(object):
"Set of definitions"
log = logging.getLogger('roadrunner.core.DefinitionSet')
def __init__(self, fpath):
self.dry_run = False... | juju-blender/roadrunner | roadrunner/core.py | Python | apache-2.0 | 5,171 |
# Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use ... | elastic/elasticsearch-py | elasticsearch/_async/client/graph.py | Python | apache-2.0 | 3,806 |
# Copyright 2015 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 by applicable la... | google/sample-sql-translator | rfmt/blocks.py | Python | apache-2.0 | 13,911 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from datetime import date
import tornado.escape
import tornado.ioloop
import tornado.web
import urllib
import mimetypes
import re
import threading
from urllib2 import quote
from sqlalchemy import desc
from sqlalchemy.orm import joinedload,subqueryload,aliased
from sqlal... | Tristan79/ComicStreamer | comicstreamerlib/server.py | Python | apache-2.0 | 80,525 |
#
# Author:
# - Dmitry Golubkov, <dmitry.v.golubkov@cern.ch>, 2016-2018
#
# Updates by:
# - Mikhail Titov, <mikhail.titov@cern.ch>, 2018
#
import json
try:
import requests
import urllib
except ImportError:
pass
API_VERSION = 'v1'
class DEFTClient(object):
API_BASE_PATH = '/api/{0}'.format(API_VERS... | XDatum/prodsys-pa-model | p2pamodel/providers/deftclient.py | Python | apache-2.0 | 4,707 |
from base64 import b64encode
from collections import namedtuple
from email.header import decode_header
import logging
from mailviews.helpers import should_use_staticfiles
from mailviews.utils import split_docstring, unimplemented
import os
import pprint
from django.core.urlresolvers import reverse
from django.http imp... | joshowen/django-mailviews | mailviews/previews.py | Python | apache-2.0 | 8,746 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2011 Justin Santa Barbara
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
#... | rossella/neutron | quantum/openstack/common/jsonutils.py | Python | apache-2.0 | 5,314 |
from wharf import app
from flask import send_from_directory
from os import path
@app.route('/favicon.ico')
def favicon():
return send_from_directory(path.join(app.root_path, 'static'),
'favicon.ico', mimetype='image/vnd.microsoft.icon')
| cglewis/wharf | wharf/favicon.py | Python | apache-2.0 | 274 |
# coding: utf-8
#
# Copyright 2014 The Oppia 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 requi... | souravbadami/oppia | core/domain/value_generators_domain.py | Python | apache-2.0 | 4,266 |
# 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 writing, software
# d... | Mirantis/mos-horizon | openstack_dashboard/test/integration_tests/steps.py | Python | apache-2.0 | 1,572 |
import pytest
import logging
@pytest.mark.asyncio
async def test_confirmation(rpc_context):
# setup rpc
async def test_method(request):
a = await request.confirm('just say yes!', timeout=1)
logging.debug('a = %s', a)
return a
rpc_context.rpc.add_methods(('', test_method))
#... | pengutronix/aiohttp-json-rpc | tests/test_forms.py | Python | apache-2.0 | 530 |
from datetime import datetime
import time
import os, json
import requests
import urllib
from . import app
from app.cloudant_db import cloudant_client
from app.redis_db import get_next_user_id
from typing import List, Dict, Optional
from cloudant.document import Document
from cloudant.database import CloudantDatabase
C... | snowch/movie-recommender-demo | web_app/app/dao.py | Python | apache-2.0 | 12,507 |
#---------------------------------------------------------------------------
# Copyright 2012 The Open Source Electronic Health Record Agent
#
# 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
#
... | jasonli2000/VistA | Scripts/VistATestClient.py | Python | apache-2.0 | 10,240 |
import argparse
import json
import os
import nltk
# data: q, cq, (dq), (pq), y, *x, *cx
# shared: x, cx, (dx), (px), word_counter, char_counter, word2vec
# no metadata
from collections import Counter
from tqdm import tqdm
from squad.utils import get_word_span, process_tokens, get_word_idx
def prepro(par... | Incogniiito/Chrononaut | squad/demo_prepro.py | Python | apache-2.0 | 1,321 |
#!/usr/bin/env python
"""models.py
Udacity conference server-side Python App Engine data & ProtoRPC models
$Id: models.py,v 1.1 2014/05/24 22:01:10 wesc Exp $
created/forked from conferences.py by wesc on 2014 may 24
"""
__author__ = 'wesc+api@google.com (Wesley Chun)'
import httplib
import endpoints
from protor... | anudhagat/ConferenceCentral | models.py | Python | apache-2.0 | 4,844 |
# coding: utf-8
from __future__ import absolute_import
from swagger_server.models.error_model import ErrorModel
from swagger_server.models.taxonomy import Taxonomy
from . import BaseTestCase
from six import BytesIO
from flask import json
class TestTaxonomyController(BaseTestCase):
""" TaxonomyController integra... | EarthLifeConsortium/elc_api | swagger_server/test/test_taxonomy_controller.py | Python | apache-2.0 | 995 |
# -*- coding: utf-8 -*-
# @COPYRIGHT_begin
#
# Copyright [2010-2014] Institute of Nuclear Physics PAN, Krakow, Poland
#
# 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.apac... | Dev-Cloud-Platform/Dev-Cloud | dev_cloud/cc1/src/wi/tests/cm_networks_test.py | Python | apache-2.0 | 4,435 |
# -*- 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... | napalm-automation/napalm-yang | napalm_yang/models/openconfig/network_instances/network_instance/protocols/protocol/isis/interfaces/interface/levels/level/packet_counters/iih/__init__.py | Python | apache-2.0 | 11,666 |
#!/usr/bin/env python
# Copyright 2015-2016 ARM Limited
#
# 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... | JaviMerino/trappy | setup.py | Python | apache-2.0 | 2,559 |
#!/usr/bin/env python
# coding: utf-8
from oslo_config import cfg
import oslo_messaging as messaging
import oslo_messaging.rpc as rpc
import logging
import time
import sys
import eventlet
eventlet.monkey_patch()
logging.basicConfig()
log = logging.getLogger()
log.addHandler(logging.StreamHandler())
log.setLevel(lo... | muroi/sample-rpc | server.py | Python | apache-2.0 | 1,588 |
"""
Copyright (c) 2009 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 and the following... | sushi-irc/tekka | tekka/dialogs/colorTable.py | Python | bsd-2-clause | 2,420 |
from jinja2 import Environment, PackageLoader
import json
env = Environment(loader=PackageLoader('core_serializers', 'templates'))
class FormRenderer:
template_name = 'form.html'
def render_field(self, field_result, **options):
field, value, error = field_result
class_name = field.__class__.... | pombredanne/core-serializers | core_serializers/renderers.py | Python | bsd-2-clause | 2,026 |
import unittest
import os
import csv
from orangecontrib.text.scraper import _get_info
from unittest.mock import patch
from contextlib import contextmanager
import tempfile
class MockUrlOpen:
def __init__(self, filepath):
self.data = []
with open(filepath, 'r') as f:
reader=csv.reader(f... | cheral/orange3-text | orangecontrib/text/tests/test_newspaper.py | Python | bsd-2-clause | 1,311 |
import serial,time,socket
import hart_protocol
import sys
port = 3
if len(sys.argv) < 4:
print "Error, usage " + sys.argv[0] + " port long_address new_longtag"
print "Usage hex string (5 hex digits) as address and LATIN-1 string as new long tag"
quit()
address = sys.argv[2].decode('hex')
if len(addr... | Darkkey/hartinsecurity | hart_change_longtag.py | Python | bsd-2-clause | 1,068 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
Functions in this script produce figures in various manuscripts.
"""
import os.path as op
import sys
import logging
import numpy as np
from jcvi.graphics.base import Polygon, normalize_axes, panel_labels, plt, savefig
from jcvi.graphics.glyph import GeneGlyph, Round... | tanghaibao/jcvi | jcvi/projects/misc.py | Python | bsd-2-clause | 22,201 |
import psycopg2
import scipy.io
import os
# Set to true if you want to query tables before adding data:
queryConfigs = False
queryTimeSeries = False
# Create a connection to RoboticBicycle database
conn = psycopg2.connect(database="robot_bicycle_parameters", user="hazelnusse")
cur = conn.cursor()
def insert_statemen... | hazelnusse/robot.bicycle | data/physicalparameters/RawData/PeriodMeasurements/Rod/populateTable.py | Python | bsd-2-clause | 1,425 |
# coding: utf-8
import flask
from flask import url_for
from .base import BaseTestCase
from . import utils
class TOCTestCase(BaseTestCase):
# TOC
def test_the_title_of_the_article_list_when_language_pt(self):
"""
Teste para verificar se a interface do TOC esta retornando o título no
... | jamilatta/opac | opac/tests/test_interface_TOC.py | Python | bsd-2-clause | 8,985 |
from datetime import date, timedelta
from django.db.models import Q
from django.contrib import admin
from django.contrib.admin import FieldListFilter, ListFilter, SimpleListFilter
from django.utils.translation import (
ungettext,
ugettext_lazy as _
)
from django.http import HttpResponse, HttpResponseRedirect
... | chrisspen/django-feeds | djangofeeds/admin.py | Python | bsd-2-clause | 7,712 |
from joommf.energies.baseenergy import energy
import textwrap
class Exchange(energy):
def __init__(self, A):
energy.__init__(self, "Exchange")
self.A = A
def get_mif(self):
exchange_mif = textwrap.dedent("""\
Specify Oxs_UniformExchange {{
... | ryanpepper/oommf-python | joommf/energies/exchange.py | Python | bsd-2-clause | 413 |
#!/usr/bin/env python
import re
import time
import getopt
import imp
import sys
import types
import errno
__version__ = 0.5
from xml.etree import cElementTree as ElementTree
INDENT = 4*" "
DEBUG = False
XMLSCHEMA = "http://www.w3.org/2001/XMLSchema"
XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace'
CLASS_PRO... | rohe/pysaml2-3 | tools/parse_xsd2.py | Python | bsd-2-clause | 68,704 |
from transifex.projects.models import Project
from transifex.teams.models import Team
from transifex.txcommon.tests import base
class TestTeamModels(base.BaseTestCase):
def test_available_teams(self):
"""
Test whether monkey-patch of Project class with a 'available_teams'
instance method r... | rvanlaar/easy-transifex | src/transifex/transifex/teams/tests/models.py | Python | bsd-2-clause | 1,066 |
# -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import
from .decorators import Vectorize, GUVectorize, vectorize, guvectorize
from ._internal import PyUFunc_None, PyUFunc_Zero, PyUFunc_One
from . import _internal, array_exprs
if hasattr(_internal, 'PyUFunc_ReorderableNone'):
PyUFu... | stefanseefeld/numba | numba/npyufunc/__init__.py | Python | bsd-2-clause | 809 |
#coding: utf8
import os
from django.db import transaction
def rel(*x):
return os.path.abspath(os.path.join(os.path.abspath(os.path.dirname(__file__)), os.pardir, *x))
def nested_commit_on_success(func):
"""Like commit_on_success, but doesn't commit existing transactions.
This decorator is used to ... | dicos/smirik | smirik/common_helpers.py | Python | bsd-2-clause | 1,076 |
from __future__ import print_function, division
import numpy as np
from astropy import units as u
from astropy.table import Table
from ..utils.validator import validate_array
__all__ = ['Extinction']
class Extinction(object):
def __init__(self):
self.wav = None
self.chi = None
@property
... | astrofrog/sedfitter | sedfitter/extinction/extinction.py | Python | bsd-2-clause | 3,289 |
# INTIALISATION
import pygame, math, sys
from pygame.locals import *
screen = pygame.display.set_mode((1024, 768))
car = pygame.image.load('car.jpg')
clock = pygame.time.Clock()
k_up = k_down = k_left = k_right = 0
speed = direction = 0
position = (100, 100)
TURN_SPEED = 5
ACCELERATION = 2
MAX_FORWARD_SPEED = 10
MAX_RE... | andersx/myrpg | src/test.py | Python | bsd-2-clause | 1,605 |
from .registry import Registry
from drole.types import Permission
def action(f):
"""
mark a method as being an action.
"""
if isinstance(f, Permission):
def decorator(decorated):
decorated.action = True
decorated.permission = f
return decorated
re... | wheelcms/wheelcms_axle | wheelcms_axle/actions.py | Python | bsd-2-clause | 3,462 |
"""
Pygments test package
~~~~~~~~~~~~~~~~~~~~~
:copyright: Copyright 2006-2022 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
| dscorbett/pygments | tests/__init__.py | Python | bsd-2-clause | 176 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault(
"DJANGO_SETTINGS_MODULE", "garelay.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| smn/garelay | manage.py | Python | bsd-2-clause | 259 |
#!/usr/bin/python -Wall
# ================================================================
# John Kerl
# kerl.john.r@gmail.com
# 2008-02-06
# ================================================================
from __future__ import division # 1/2 = 0.5, not 0.
import sys
import randc_m # For random complex scalars
impo... | johnkerl/scripts-math | pythonlib/randmatc_m.py | Python | bsd-2-clause | 1,088 |
"""
Simulate geomorphic scenarios along with CN production.
"""
from __future__ import division, print_function, unicode_literals
import numpy as np
import scipy.integrate
from cosmogenic import production
def nexpose(n, z, ti, tf=0, p=None, tol=1e-4, thickness=None):
"""
Calculate concentrations for an arb... | cosmolab/cosmogenic | cosmogenic/sim.py | Python | bsd-2-clause | 6,358 |
from allauth.socialaccount import providers
from allauth.socialaccount.providers.base import ProviderAccount
from allauth.socialaccount.providers.oauth2.provider import OAuth2Provider
from helusers.user_utils import oidc_to_user_data
from helusers.utils import uuid_to_username
class HelsinkiOIDCAccount(ProviderAccou... | City-of-Helsinki/django-helusers | helusers/providers/helsinki_oidc/provider.py | Python | bsd-2-clause | 1,192 |
from django.shortcuts import render, HttpResponse, get_object_or_404
from django.http import Http404
from django.utils.decorators import method_decorator
from django.contrib.auth.decorators import login_required
from django.contrib.admin.views.decorators import staff_member_required
from django.urls import reverse,reve... | devalfrz/django-image-styles | image_styles/views.py | Python | bsd-2-clause | 8,038 |
"""The anti-commutator: {A,B} = A*B + B*A."""
from sympy import S, Expr, Mul, Integer
from sympy.printing.pretty.stringpict import prettyForm
from sympy.physics.quantum.qexpr import split_commutative_parts
from sympy.physics.quantum.operator import Operator
from sympy.physics.quantum.dagger import Dagger
__all__ = [... | tarballs-are-good/sympy | sympy/physics/quantum/anticommutator.py | Python | bsd-3-clause | 4,489 |
#!/usr/bin/env python
from setuptools import setup, find_packages
setup(
name='salmon',
version='0.3.0-dev',
description="A simple metric collector with alerts.",
long_description=open('README.rst').read(),
author="Peter Baumgarter",
author_email='pete@lincolnloop.com',
url='https://github.... | lincolnloop/salmon | setup.py | Python | bsd-3-clause | 801 |
from setuptools import setup, find_packages
from nani import __version__ as version
setup(
name = 'django-hvad',
version = version,
description = 'A translations framework for django integrated automatically in the normal ORM. Removes the pain of having to think about translations in a django project.',
... | andialbrecht/django-hvad | setup.py | Python | bsd-3-clause | 1,175 |
"""Tools for working with epoched data"""
# Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Matti Hamalainen <msh@nmr.mgh.harvard.edu>
# Daniel Strohmeier <daniel.strohmeier@tu-ilmenau.de>
# Denis Engemann <denis.engemann@gmail.com>
# Mainak Jas <mainak@neuro... | andyh616/mne-python | mne/epochs.py | Python | bsd-3-clause | 98,756 |
from pkgconf import Conf
class FooMixin(object):
FOO = 'foo'
@property
def BAR(self):
if self.FOO == 'foo':
return 'original bar'
return 'new bar'
class MyApp(FooMixin, Conf):
BAZ = 'baz'
| byashimov/django-pkgconf | test_project/mymixinconf.py | Python | bsd-3-clause | 237 |
from django.db import models
class EntryHash(models.Model):
'''Model for storing hashes of seen entries.'''
hash = models.CharField(max_length=255, primary_key=True)
class Channel(models.Model):
'''Model for channels to crawl.'''
url = models.URLField(max_length=255)
modified = models.DateTimeFiel... | praus/django-rssmailer | rssmailer/models.py | Python | bsd-3-clause | 662 |
# -*- coding: utf-8 -*-
import os
os_env = os.environ
class Config(object):
SECRET_KEY = os_env.get('SLEDZENIE_LISTOW_SECRET', 'secret-key') # TODO: Change me
APP_DIR = os.path.abspath(os.path.dirname(__file__)) # This directory
PROJECT_ROOT = os.path.abspath(os.path.join(APP_DIR, os.pardir))
BCRYP... | ad-m/sledzenie_listow | sledzenie_listow/settings.py | Python | bsd-3-clause | 1,203 |
def extractRumorsBlock(item):
"""
"""
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or 'preview' in item['title'].lower():
return None
if "Rumor's Block" in item['tags'] and 'chapter' in item['title'].lower():
return buildReleaseMessageWithType(item, "Rumor's Bl... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractRumorsBlock.py | Python | bsd-3-clause | 393 |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['BoxCox'] , ['MovingAverage'] , ['Seasonal_Hour'] , ['LSTM'] ); | antoinecarme/pyaf | tests/model_control/detailed/transf_BoxCox/model_control_one_enabled_BoxCox_MovingAverage_Seasonal_Hour_LSTM.py | Python | bsd-3-clause | 158 |
from Chip import OpCodeDefinitions
from Tests.OpCodeTests.OpCodeTestBase import OpCodeTestBase
class TestNopOpCode(OpCodeTestBase):
def test_nop_implied_command_calls_nop_method(self):
self.assert_opcode_execution(OpCodeDefinitions.nop_implied_command, self.target.get_nop_command_executed)
| jeroanan/Nes2 | Tests/OpCodeTests/TestNopOpCode.py | Python | bsd-3-clause | 306 |
##########################################################################
#
# Copyright (c) 2012, John Haddon. All rights reserved.
# Copyright (c) 2012-2014, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provi... | davidsminor/gaffer | python/GafferSceneUI/__init__.py | Python | bsd-3-clause | 3,021 |
# This file contains default settings for this project.
# If you want to customize this settings, use command line arguments
# to do so, instead of modifying this file.
# Although Thunderpush server supports multiple server clients,
# at the moment we make it single-client.
# Public API key for server client.
APIKEY ... | thedeadofblackfire/livepush | thunderpush/settings.py | Python | bsd-3-clause | 765 |
import logging
import socket
from functools import wraps
from django.conf import settings
from django.http import (
Http404,
HttpResponse,
HttpResponseForbidden,
HttpResponseRedirect
)
from django.shortcuts import render
from django.utils.http import is_safe_url
from django.views.decorators.cache impor... | DESHRAJ/fjord | fjord/base/views.py | Python | bsd-3-clause | 6,831 |
# -*- coding: utf-8 -*-
# Author: Tal Linzen <linzen@nyu.edu>
# License: BSD (3-clause)
# Linzen, Kasyanenko, & Gouskova (2013). (Lexical and phonological
# variation in Russian prepositions, Phonology 30(3).)
import re
import random
import time
import sys
import urllib
import urllib2
from gzip import GzipFile
fro... | TalLinzen/russian-preps | code/python/yandex_capped.py | Python | bsd-3-clause | 2,238 |
DEPS = [
'chromium',
'chromium_android',
'gsutil',
'recipe_engine/json',
'recipe_engine/path',
'recipe_engine/properties',
'recipe_engine/python',
'recipe_engine/step',
]
| eunchong/build | scripts/slave/recipe_modules/cronet/__init__.py | Python | bsd-3-clause | 187 |
"""Affine measure"""
import numpy as np
from py_stringmatching import utils
from six.moves import xrange
from py_stringmatching.similarity_measure.sequence_similarity_measure import \
SequenceSimilarityMeasure
def sim_ident(char1, char2):
return int(char1 == ... | Anson-Doan/py_stringmatching | py_stringmatching/similarity_measure/affine.py | Python | bsd-3-clause | 5,192 |
# Standard Library
import datetime
import json
# Third Party
import mixingboard
from sqlalchemy import create_engine, types, event, exc, Text
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.ext.mutable import Mutable
from sqlalchemy.orm import scoped_session, sessionmaker
from sqlalchemy.pool i... | cheddarfinancial/quarry-platform | chassis/database.py | Python | bsd-3-clause | 7,076 |
from setuptools import setup, find_packages # Always prefer setuptools over distutils
from os import path
here = path.abspath(path.dirname(__file__))
setup(
name='dicom2fem',
description='Generation of finite element meshes from DICOM images',
long_desctioption="Generation of finite element meshes using c... | mjirik/dicom2fem | setup.py | Python | bsd-3-clause | 3,561 |
#!/usr/bin/env python
from ATK.EQ import DoubleCustomFIRFilter, DoubleCustomIIRFilter
import numpy as np
from nose.tools import raises
sampling = 48000
@raises(ValueError)
def customFIR_bad_dim_test():
import numpy as np
filter = DoubleCustomFIRFilter()
filter.coefficients_in = np.ones(())
@raises(ValueErro... | mbrucher/AudioTK | tests/Python/EQ/PyATKEQ_custom_test.py | Python | bsd-3-clause | 1,779 |
# coding: utf-8
from base import Manager
from riotpy.resources.team import TeamResource
class TeamManager(Manager):
def get_team_list_by_summoner_ids(self, summoner_ids):
"""
Get a list of teams by summoner ids.
:param ids: list of summoner_ids to look or all the ids separated by... | jarussi/riotpy | riotpy/managers/team.py | Python | bsd-3-clause | 1,661 |
from typing import Optional, Dict
import unittest
from autosklearn.pipeline.util import _test_classifier, \
_test_classifier_predict_proba, _test_classifier_iterative_fit
from autosklearn.pipeline.constants import SPARSE
import sklearn.metrics
import numpy as np
from test.test_pipeline.ignored_warnings import i... | automl/auto-sklearn | test/test_pipeline/components/classification/test_base.py | Python | bsd-3-clause | 13,012 |
import inspect
import sys
import types
from copy import deepcopy
import pickle as pypickle
try:
import cPickle as cpickle
except ImportError:
cpickle = None
if sys.version_info < (2, 6):
# cPickle is broken in Python <= 2.5.
# It unsafely and incorrectly uses relative instead of absolute imports,
... | mitsuhiko/celery | celery/serialization.py | Python | bsd-3-clause | 4,714 |
# -*- coding:utf-8 -*-
from __future__ import (
absolute_import, division, print_function, unicode_literals
)
from unittest import SkipTest
import pytest
from django.db import connection, migrations, models, transaction
from django.db.migrations.state import ProjectState
from django.test import TransactionTestCas... | nickmeharry/django-mysql | tests/testapp/test_operations.py | Python | bsd-3-clause | 11,174 |
#Reading HST ACS filters
from astropy import units as u, constants as const
from numpy import genfromtxt, asscalar
import pandas as pd
import os
from glob import glob
def read_hst_filter(fname):
"""
Reading the gemini filter file into a dataframe
Parameters
----------
fname: ~str
path to... | wkerzendorf/wsynphot | wsynphot/data/hst/acs/convert_filters.py | Python | bsd-3-clause | 1,562 |
# Copyright (c) 2015, Artem Osadchyi
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Versi... | smithsane/openstack-env | openstack_env/openstack.py | Python | bsd-3-clause | 3,248 |
# -*- coding: utf-8 -*-
"""
This module allows running system commands directly
from Rabbithole. This can be good for simple commands
such as ping. There is currently no way to filter arguments
given to wrapped commands. For that kind of functionality,
a separate module should be created,
"""
import rh.common as common... | dragonrider23/rabbithole | modules/cmd_wrappers.py | Python | bsd-3-clause | 673 |
# encoding: utf-8
from __future__ import absolute_import, division, print_function
import numpy as np
import pytest as pt
from numpy.testing import (assert_almost_equal, assert_array_almost_equal)
import mpnum.factory as factory
import mpnum.mparray as mp
import mpnum.special as mpsp
from mpnum._testing import assert... | dseuss/mpnum | tests/special_test.py | Python | bsd-3-clause | 6,072 |
from melta.dynamic.propertyMaker import PropertyMaker
property_maker = PropertyMaker()
class Person:
pass
person1 = Person()
property_maker.buildProperty(person1, "edad", 20) \
.buildProperty(person1, "altura", 180) \
.buildProperty(person1, "sexo", "male")
class House:
pass
house1 = House()
p... | bossiernesto/melta | test/fixture/class_repositories.py | Python | bsd-3-clause | 637 |
# coding: utf-8
'''
tag.py
~~~~~~
'''
from fine import db
class Tag(db.Model):
__tablename__ = 'tags'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(32), unique=True)
weight = db.Column(db.Integer)
note = db.Column(db.String(140))
def __init__(self, *args, *... | finron/finepy | fine/models/tag.py | Python | bsd-3-clause | 1,612 |
from rest_framework.viewsets import ReadOnlyModelViewSet
from accounts.models import HierarchicUser
from ...models import *
from ...views import PublishedMixin
from .serializers import (
IndividuSerializer, EnsembleSerializer, LieuSerializer, OeuvreSerializer,
SourceSerializer, EvenementSerializer, PartieSeria... | dezede/dezede | libretto/api/rest/viewsets.py | Python | bsd-3-clause | 2,128 |
from django.db import models
import uuid
class UUIDField(models.CharField) :
def __init__(self, *args, **kwargs):
kwargs['max_length'] = kwargs.get('max_length', 64 )
kwargs['blank'] = True
super(UUIDField, self).__init__(*args, **kwargs)
def _generate_uuid(self):
return str(... | dalou/django-extended | django_extended/fields/uuid_field.py | Python | bsd-3-clause | 815 |