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 |
|---|---|---|---|---|---|
# Copyright 2015 OpenStack Foundation
#
# 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 ... | samsu/neutron | db/migration/alembic_migrations/versions/38462bfd9dc_fortinet_plugin_database.py | Python | apache-2.0 | 9,904 |
#!/usr/bin/env python3
#
# Copyright 2014 Ryan Peck
#
# 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 ... | RyPeck/python-ipgroup | ipgroup.py | Python | apache-2.0 | 5,777 |
# -*- 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/ospfv2/areas/area/interfaces/interface/timers/__init__.py | Python | apache-2.0 | 18,500 |
#/***********************************************************************
# * Licensed Materials - Property of IBM
# *
# * IBM SPSS Products: Statistics Common
# *
# * (C) Copyright IBM Corp. 1989, 2020
# *
# * US Government Users Restricted Rights - Use, duplication or disclosure
# * restricted by GSA ADP Sch... | IBMPredictiveAnalytics/SCRIPTEX | src/scriptwparams.py | Python | apache-2.0 | 4,446 |
# -*- coding: utf-8 -*-
'''
Manage ini files
================
:maintainer: <akilesh1597@gmail.com>
:maturity: new
:depends: re
:platform: all
use section as DEFAULT_IMPLICIT if your ini file does not have any section
for example /etc/sysctl.conf
'''
__virtualname__ = 'ini'
def __virtual__():
'''
Only load... | smallyear/linuxLearn | salt/salt/states/ini_manage.py | Python | apache-2.0 | 7,011 |
import os, sys, subprocess, shutil
import unittest
sys.path.append(os.path.realpath(os.path.join(
os.path.dirname(os.path.realpath(__file__)), '..', 'bench')))
from vard import Client
import time
VARDLOG = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', 'vardlog.native')
class TestVard(unittest.Te... | uwplse/verdi-raft | extraction/vard-log/test/integration.py | Python | bsd-2-clause | 2,450 |
# 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... | Yubico/python-u2flib-host | u2flib_host/register.py | Python | bsd-2-clause | 4,482 |
"""
Utility classes
---------------
"""
from collections import namedtuple
from collections.abc import Set
__all__ = ['NameTitle', 'LabeledEnum', 'InspectableSet', 'classmethodproperty']
NameTitle = namedtuple('NameTitle', ['name', 'title'])
class _LabeledEnumMeta(type):
"""Construct labeled enumeration"""
... | hasgeek/coaster | coaster/utils/classes.py | Python | bsd-2-clause | 10,952 |
from django.conf import settings
from django.db.models import F
from geotrek.api.v2 import serializers as api_serializers, \
viewsets as api_viewsets, filters as api_filters
from geotrek.signage import models as signage_models
from geotrek.api.v2.functions import Transform
class SignageViewSet(api_viewsets.Geotre... | makinacorpus/Geotrek | geotrek/api/v2/views/signage.py | Python | bsd-2-clause | 2,113 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# -------------------------------------------------------------------------------
# Copyright (c) 2012 Michael Hull.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions... | mikehulluk/morphforge | src/morphforge/morphology/errors/__init__.py | Python | bsd-2-clause | 1,704 |
import pickle
import pytest
from praw.models import Draft, Subreddit
from ... import UnitTest
class TestDraft(UnitTest):
def test_construct_failure(self):
message = "Exactly one of `id` or `_data` must be provided."
with pytest.raises(TypeError) as excinfo:
Draft(self.reddit)
... | praw-dev/praw | tests/unit/models/reddit/test_draft.py | Python | bsd-2-clause | 4,823 |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2016, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""... | jkyeung/XlsxWriter | xlsxwriter/test/comparison/test_button05.py | Python | bsd-2-clause | 1,181 |
import webracer
from wolis import utils
from wolis.test_case import WolisTestCase
class PruneGroupTestCase(WolisTestCase):
def test_prune_group(self):
username = 'prune1'
group_name = 'testgroup1'
self.login_and_nav()
db = utils.current.db or utils.instantiate_db(s... | p/wolis-phpbb | tests/prune_group.py | Python | bsd-2-clause | 2,176 |
import numpy as np
import random
import json
import os
import copy
import progressbar
params = {'step': 10, # step은 한번 sample을 뽑고 몇 frame 이동 후에 뽑을지 결정합니다.
'interval': 30, # interval은 sample을 최대 몇 frame 연속으로 이어 붙일지를 결정합니다.
'threshold': 30, # sample을 만들 때 투기 pose가 threshold값 이상이라면 sample도 투... | neohanju/GarbageDumping | EventEncoder/make_sample.py | Python | bsd-2-clause | 9,327 |
from rex.exploit.cgc import CGCType1Exploit
class CGCType1RopExploit(CGCType1Exploit):
'''
A CGC type1 exploit object, which sets a register via Rop.
'''
def __init__(self, crash, register, reg_bitmask, ip_bitmask, ch_mem, value_var, ip_var):
'''
:param crash: a crash object which has ... | shellphish/rex | rex/exploit/cgc/type1/cgc_type1_rop_exploit.py | Python | bsd-2-clause | 1,157 |
#
# Incremental request parser.
#
# Author: Max Kellermann <mk@cm4all.com>
#
from __future__ import print_function
import six
import array, struct
try:
from urllib.parse import unquote
except ImportError:
from urllib import unquote
from .protocol import *
import beng_proxy.translation.uri
def _parse_port(ad... | CM4all/beng-proxy | python/beng_proxy/translation/request.py | Python | bsd-2-clause | 8,915 |
import sys
import os
import subprocess as sp
import numpy
from distutils.core import setup, Extension
git_version = sp.check_output('git rev-parse HEAD', shell=True)
git_changed = sp.check_output('git diff | wc -l', shell=True)
if git_changed != '0':
print("Git has changed. Please build first!")
sys.exit(0)
... | aaalgo/picpac | setup-static.py | Python | bsd-2-clause | 1,454 |
import time
sendOut("i am here to slow things down")
sendOut("i am also", __prog_name)
time.sleep(10)
sendOut("now I am done")
| AsherGlick/Olympus-Server-Management | RemoteServer/plugins/delayLoad.py | Python | bsd-2-clause | 127 |
"""
App configuration
=================
"""
from typing import Callable, List, NamedTuple, Optional
import json
from flask import Flask
from flask.sessions import SecureCookieSessionInterface
import itsdangerous
import toml
import yaml
from . import logger
from .auth import current_auth
from .views import current_v... | hasgeek/coaster | coaster/app.py | Python | bsd-2-clause | 6,555 |
# LARC code from NVIDIA apex project, which was released under BSD 3-Clause "New" or "Revised" License
# Retrieved on 26 February 2019
# https://github.com/NVIDIA/apex/blob/d74fda260c403f775817470d87f810f816f3d615/apex/parallel/LARC.py
import torch
from torch.optim import Optimizer
class LARC(Optimizer):
"""
... | probprog/pyprob | pyprob/nn/optimizer_larc.py | Python | bsd-2-clause | 4,264 |
from cno.admin import install
import nose
import logging
import sys
from nose.plugins.attrib import attr
@attr('skip_travis')
def test_install():
install.install_all_cellnopt_dependencies(verbose=True)
| cellnopt/cellnopt | test/admin/test_install.py | Python | bsd-2-clause | 212 |
#!/usr/bin/python3
# coding: utf-8
import os
import string
import sys
import time
try:
import serial
except ImportError:
print("Error importing pyserial. Please check if it is installed.")
sys.exit(1)
class Uploader(object):
"""Uploads a XSVF file to the arduino board.
"""
# Create a transl... | mrjimenez/JTAG | extras/python/Uploader.py | Python | bsd-2-clause | 4,930 |
# -*- coding: UTF-8 -*-
# Copyright 2013-2018 by Luc Saffre.
# License: BSD, see file LICENSE for more details.
"""
This defines the :manage:`dump2py` management command.
.. management_command:: dump2py
Write a dump of your database to a set of Python modules. This dump
is useful for creating a daily backup or befo... | khchine5/lino | lino/management/commands/dump2py.py | Python | bsd-2-clause | 19,997 |
'''
Created by auto_sdk on 2015.04.21
'''
from aliyun.api.base import RestApi
class Mts20140618QueryMediaAnalysisRequest(RestApi):
def __init__(self,domain='mts.aliyuncs.com',port=80):
RestApi.__init__(self,domain, port)
self.MediaId = None
def getapiname(self):
return 'mts.aliyuncs.com.QueryMediaAna... | wanghe4096/website | aliyun/api/rest/Mts20140618QueryMediaAnalysisRequest.py | Python | bsd-2-clause | 339 |
#!/usr/bin/env python
"""Run a query on youtube and save the top x video search results with meta variables"""
__author__ = "Peter J Usherwood"
__python_version__ = "3.5"
import os
import time
from usherwood_ds.data_imports.youtube_api.api_class import YoutubeAPI
from usherwood_ds.data_imports.youtube_import import... | Usherwood/usherwood_ds | usherwood_ds/data_imports/youtube_api/run_scripts/video_query_to_excel.py | Python | bsd-2-clause | 1,108 |
# Django settings for cigar_example project.
from os.path import dirname, abspath, join
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
)
MANAGERS = ADMINS
DJANGO_ROOT = dirname(dirname(abspath(__file__)))
root = lambda *x: abspath(join(abspath(DJANGO_ROOT), *x))
DATABASES = {
'default': {
'ENGINE': 'dj... | 18F/django-rest-swagger | tests/cigar_example/cigar_example/settings.py | Python | bsd-2-clause | 6,008 |
"""
Set up the plot figures, axes, and items to be done for each frame.
This module is imported by the plotting routines and then the
function setplot is called to set the plot parameters.
This plotting function is for plotting when the adjoint-flagging method
is used.
The main difference is that the inner product ... | clawpack/adjoint | paper1_examples/tsunami_Alaska/compare/setplot_compare.py | Python | bsd-2-clause | 11,089 |
#!/usr/bin/env python3
import sys, os, signal, time, getopt
BASE_DIR = os.path.dirname(sys.argv[0])
if not BASE_DIR: BASE_DIR = "."
sys.path.append(BASE_DIR)
PID_PATH = "/tmp/LANd.pid"
LOG_FILE = "/tmp/LANd.log"
ERR_FILE = "/tmp/LANd_err.log"
CFG_FILE = "%s/fdslight_etc/LANd.ini" % BASE_DIR
import pywind.evtframew... | fdslight/fdslight | LANd_pass.py | Python | bsd-2-clause | 7,614 |
from dumptruck import DumpTruck
import datetime
import re
import os
def _connect(dbname = 'data.sqlite'):
'Initialize the database (again). This is mainly for testing'
global dt
dt = DumpTruck(dbname = dbname, adapt_and_convert = False)
_connect()
def execute(sqlquery, data=[], verbose=1):
""" Emulate scr... | abdulla16/yp_python_scraper | scraperwiki/sqlite.py | Python | bsd-2-clause | 3,270 |
import competition_utilities as cu
import csv
import datetime
import basic_features as features
import numpy as np
import pandas as pd
import re
def camel_to_underscores(name):
s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name)
return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower()
def words(text):
return... | mattalcock/stack-kaggle | basic_features.py | Python | bsd-2-clause | 2,121 |
#!/usr/bin/env python
#
# Copyright (c) 2009 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... | mbitsnbites/viewer | tools/cpplint.py | Python | bsd-2-clause | 242,295 |
import unittest
from troposphere.route53 import AliasTarget
class TestAliasTarget(unittest.TestCase):
def test_bucket_template(self):
AliasTarget("zone", "dnsname", True)
AliasTarget(hostedzoneid="zone", dnsname="dnsname", evaluatetargethealth=True)
AliasTarget(HostedZoneId="zone", DNSNam... | cloudtools/troposphere | tests/test_route53.py | Python | bsd-2-clause | 409 |
from app import app
if __name__ == "__main__":
app.run('0.0.0.0')
| toolmakers/ahoy | application/web/manage.py | Python | bsd-2-clause | 71 |
"""Leetcode 929. Unique Email Addresses
Easy
URL: https://leetcode.com/problems/unique-email-addresses/
Every email consists of a local name and a domain name, separated by the @ sign.
For example, in alice@leetcode.com, alice is the local name, and
leetcode.com is the domain name.
Besides lowercase letters, these ... | bowen0701/algorithms_data_structures | lc0929_unique_email_addresses.py | Python | bsd-2-clause | 2,625 |
"""
서비스 관리 도구 국제화 지원 모듈.
`django-modeltranslation` 을 이용하여 다국어 지원을 하는 모듈입니다.
"""
from modeltranslation.translator import TranslationOptions, register
from .models import Category, BaseService, Service, TopBanner
@register(Category)
class CategoryTranslationOptions(TranslationOptions):
"""
:class:`Category` ... | hangpark/kaistusc | apps/manager/translation.py | Python | bsd-2-clause | 965 |
# -*- coding: utf-8 -*-
import os
import platform
import pytest
from grep import print_helper
from grep import file_helper
from grep.grep import Searcher
from tests.helper_for_tests import *
def test_run_with_empty_str_not_regex_line_by_line(with_f_write):
with_f_write.write('docopt\nasdfwer')
with_f_write.... | florianbegusch/simple_grep | tests/test_grep_edge_cases.py | Python | bsd-2-clause | 4,515 |
# --------------------------------------------------------
# Theano @ Dragon
# Copyright(c) 2017 SeetaTech
# Written by Ting Pan
# --------------------------------------------------------
import sys
import copy
import numpy as np
from collections import OrderedDict
from six.moves import xrange
import dragon.core.mpi ... | neopenx/Dragon | Dragon/python/dragon/vm/theano/compile/function.py | Python | bsd-2-clause | 11,266 |
# Copyright 2008 Owen Taylor
#
# This file is part of Reinteract and distributed under the terms
# of the BSD license. See the file COPYING in the Reinteract
# distribution for full details.
#
########################################################################
from ConfigParser import RawConfigParser, ParsingErro... | rschroll/reinteract | lib/reinteract/notebook_info.py | Python | bsd-2-clause | 3,421 |
#
# Candelabra
#
# Copyright Alvaro Saurin 2013 - All right Reserved
#
"""
Plugins infrastructure for Candelabra..
You can add a plugin by defining an entry-point in your software distribution. For example, for a provider
for VMware, you should define an entry point like this in your `setup.py` file:
>>> entry_po... | inercia/candelabra | candelabra/plugins.py | Python | bsd-2-clause | 9,282 |
"""
Cache interface for Google Cloud Store
Copyright (c) 2013 Clarinova. This file is licensed under the terms of the
Revised BSD License, included in this distribution as LICENSE.txt
"""
from . import Cache
from s3 import S3Cache
from . import copy_file_or_flo, get_logger
import os
global_logger = get_logger(__nam... | CivicKnowledge/ckcache | ckcache/gcs.py | Python | bsd-2-clause | 1,357 |
#coding: utf-8
from sua import *
data = {
'order': latin['order'],
'order_triple': latin['order_triple'],
'plural': {
'suffix': {'':'s'}, # Noun classes, key-length = 1
},
'conjugate': {
'suffix': {
'ar': {
'inf': 'ar',
'tdy': {JE:'o', TU:'as', ELLE:'a', IT:'a... | kasahorow/kwl | data/sua_espanyol.py | Python | bsd-2-clause | 713 |
#! /usr/bin/env python
import abc
def ident(x):
"""
Identity function - Just returns whatever is passed in.
'id' is a built-in function, in Python, which doesn't give what we
want.
"""
return x
def compose(*functions):
"""
Function composition for arbitrary number of inputs.
... | capn-freako/Haskell_Misc | Category_Theory_for_Programmers/bifunctor.py | Python | bsd-3-clause | 3,475 |
##
# @package RAMS.NXT
# @file NXTLightSensor.py
# @author Brian Kim
# @date 7/24/14
# @brief a python wrapper around the LightSensorAssembly to interface with
# the NXT light sensors
from NXTSensor import NXTSensor
class NXTLightSensor( NXTSensor ):
def getIntensity( self ):
light = self.a... | briansan/rams | RAMS/nxt/NXTLightSensor.py | Python | bsd-3-clause | 415 |
import os
import tempfile
import pytest
from astropy.io.fits.tests import FitsTestCase
from stsci.tools import fileutil as F
from stsci.tools import stpyfits
class TestIsFits(FitsTestCase):
def setup(self):
self.data_dir = os.path.join(os.path.dirname(__file__), 'data')
self.temp_dir = tempfile.... | spacetelescope/stsci.tools | lib/stsci/tools/tests/test_isfits.py | Python | bsd-3-clause | 1,326 |
"""empty message
Revision ID: 232a843e636b
Revises: 427922082575
Create Date: 2015-10-26 14:35:17.299786
"""
# revision identifiers, used by Alembic.
revision = '232a843e636b'
down_revision = '427922082575'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - ... | codeforamerica/rva-screening | migrations/versions/232a843e636b_.py | Python | bsd-3-clause | 1,712 |
# -*-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
... | vlegoff/tsunami | src/primaires/pnj/commandes/ppurge/__init__.py | Python | bsd-3-clause | 3,426 |
"""
PowerSwitch graphics tests
"""
cases = [
('Generate FSM from PowerSwitch model program',
'pma PowerSwitch'),
('Generate dot graphics commands from generated PowerSwitchFSM',
'pmg PowerSwitchFSM'),
('Generate SVG file from dot commands',
'dotsvg PowerSwitchFSM'),
('Generate dot com... | jon-jacky/PyModel | samples/PowerSwitch/test_graphics.py | Python | bsd-3-clause | 843 |
#!/usr/bin/env python
import os
import sys
try:
from setuptools import setup
from setuptools.extension import Extension
except ImportError:
raise RuntimeError('setuptools is required')
import versioneer
DESCRIPTION = ('A set of functions and classes for simulating the ' +
'performance o... | pvlib/pvlib-python | setup.py | Python | bsd-3-clause | 4,223 |
"""The user resource."""
from __future__ import unicode_literals
from . import Resource
class User(Resource):
"""An authorized user of the Helium API.
A user represents a single developer using the Helium API. Each
user gets their own API key, which gives them access to all the
resources in the :cla... | helium/helium-python | helium/user.py | Python | bsd-3-clause | 383 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import mock
from django.core import mail
from django.utils import timezone
from exam import fixture
from mock import Mock
from sentry.digests.notifications import (
build_digest,
event_to_record,
)
from sentry.interfaces.stacktrace import Stackt... | imankulov/sentry | tests/sentry/plugins/mail/tests.py | Python | bsd-3-clause | 8,500 |
"""
Utilities to help solve Python path/directory/file issues regarding files being
installed in either the dist-packages or the site-packages folder.
"""
from pathlib import Path
from hutts_verification.utils.hutts_logger import logger
__author__ = "Andreas Nel"
__copyright__ = "Copyright 2017, Java the Hutts"
__lic... | javaTheHutts/Java-the-Hutts | src/main/python/hutts_verification/utils/pypath.py | Python | bsd-3-clause | 2,135 |
# coding: utf-8
"""
update the host record in database.
"""
import UniDomain.udPolicy.udPolicy as udPolicy
import logging
class updateDbPolicy(udPolicy.udPolicy):
""" just a wrapper for a cfengine policy."""
def __init__(self, engine, db, data, config):
udPolicy.udPolicy.__init__(self, engine, db, da... | spahan/unixdmoain | lib/udPolicy/updateDbPolicy.py | Python | bsd-3-clause | 493 |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 32 , FREQ = 'D', seed = 0, trendtype = "ConstantTrend", cycle_length = 5, transform = "Quantization", sigma = 0.0, exog_count = 0, ar_order = 12); | antoinecarme/pyaf | tests/artificial/transf_Quantization/trend_ConstantTrend/cycle_5/ar_12/test_artificial_32_Quantization_ConstantTrend_5_12_0.py | Python | bsd-3-clause | 270 |
# -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import
from sqlalchemy import Column, Integer, DateTime, UniqueConstraint
from sqlalchemy.sql import functions, expression
from sqlalchemy.exc import DataError, IntegrityError, ProgrammingError
from app.models.base import Model
from ap... | Damnever/2L | app/models/action.py | Python | bsd-3-clause | 11,235 |
# -*- coding: utf8 -*-
"""
.. module:: burpui.exceptions
:platform: Unix
:synopsis: Burp-UI exceptions module.
.. moduleauthor:: Ziirish <hi+burpui@ziirish.me>
"""
# Agent does not need "real" HTTP errors
try:
from werkzeug.exceptions import HTTPException
WERKZEUG = True
except ImportError:
HTTPE... | ziirish/burp-ui | burpui/exceptions.py | Python | bsd-3-clause | 871 |
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from telemetry import value
from telemetry.web_perf.metrics import timeline_based_metric
_PROCESS_CREATION = 'Startup.BrowserProcessCreation'
_MAIN_ENTRY_PO... | Workday/OpenFrame | tools/telemetry/telemetry/web_perf/metrics/startup.py | Python | bsd-3-clause | 3,064 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-08-15 17:00
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.Creat... | tecnicatura-villa-el-libertador/mentemaestra | juego/migrations/0001_initial.py | Python | bsd-3-clause | 1,775 |
from datetime import (
datetime,
timedelta,
)
import re
import numpy as np
import pytest
from pandas._libs import iNaT
from pandas.errors import InvalidIndexError
import pandas.util._test_decorators as td
from pandas.core.dtypes.common import is_integer
import pandas as pd
from pandas import (
Categoric... | pandas-dev/pandas | pandas/tests/frame/indexing/test_indexing.py | Python | bsd-3-clause | 54,218 |
# Copyright (c) 2009-2010 Six Apart Ltd.
# 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... | eelias/typepadapp | doc/exts/set_up_django.py | Python | bsd-3-clause | 1,742 |
# coding: utf-8
"""
"""
import pytest
import numpy as np
from pysteps import motion, verification
from pysteps.tests.helpers import get_precipitation_fields
lk_arg_names = (
"lk_kwargs",
"fd_method",
"dense",
"nr_std_outlier",
"k_outlier",
"size_opening",
"decl_scale",
"verbose",
)
... | pySTEPS/pysteps | pysteps/tests/test_motion_lk.py | Python | bsd-3-clause | 2,738 |
import responses
from django.test import TestCase
from blinky.core.tests.utils import BlinkMixin, reload_record
from ..models import JunebugInstance
from ..tasks import update_workers_junebug_info
class JunebugTestCase(BlinkMixin, TestCase):
def setUp(self):
self.junebug = JunebugInstance.objects.create(... | smn/blinky | blinky/junebug/tests/test_models.py | Python | bsd-3-clause | 3,540 |
import os
from rpy2 import robjects
from rpy2.robjects import pandas2ri
library = robjects.r['library']
library('xcms')
pandas2ri.activate()
def get_xmcs_set(files, **kwargs):
"""Get an xmcs set for a group of files
Parameters
-----------------
files : list of strings
mzML files for extrac... | aitatanit/metatlas | metatlas/xcms.py | Python | bsd-3-clause | 3,008 |
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import sys
def _RunArgs(args, input_api):
p = input_api.subprocess.Popen(args, stdout=input_api.subprocess.PIPE,
stderr=i... | sahiljain/catapult | tracing/PRESUBMIT.py | Python | bsd-3-clause | 1,916 |
"""mysite URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-bas... | MatheusDaeuble/admsolucoesblog | mysite/urls.py | Python | bsd-3-clause | 2,029 |
import os
# Size of every image tile.
TILE_SIZE = 160, 240
RESIZE = True # Resize files that don't match the above?
# Column width of image grid. Rows will be determined automatically.
COLS = 5
# Tile offset.
# 0 will start at the top right, 1 will leave one empty tile, etc.
TILE_OFFSET = 0
# Outside padding (in ... | fwenzel/collage | settings.py | Python | bsd-3-clause | 1,039 |
# __init__.py vi:ts=4:sw=4:expandtab:
#
# Copyright (c) 2006-2008 Three Rings Design, 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:
# 1. Redistributions of source code must retain the abo... | threerings/farbot | farb/test/__init__.py | Python | bsd-3-clause | 2,482 |
from django.db import models
from google.appengine.api import images
class Page(models.Model):
content = models.TextField(blank=True)
subcontent = models.TextField(blank=True)
title = models.CharField(max_length=200)
photo = models.ImageField(upload_to='about', blank=True)
def photo_url(self):
return im... | adamjmcgrath/glancydesign | glancy/models.py | Python | bsd-3-clause | 1,280 |
import sys
import os
import os.path
import readInput
from os.path import join as pj
def write_tickle_script(conname, swd, hem, pval, thresh):
"""
Writes out the m file with matlab calls to surfrend_canonical.m.
"""
tcl_script = pj(swd, conname+"-"+hem+".tcl")
commands = []
## commands.append("s... | KuperbergLab/MRI_scripts | write_tickle_script.py | Python | bsd-3-clause | 2,277 |
"""Get useful information from live Python objects.
This module encapsulates the interface provided by the internal special
attributes (co_*, im_*, tb_*, etc.) in a friendlier fashion.
It also provides some help for examining source code and class layout.
Here are some of the useful functions provided by this module:... | wdv4758h/ZipPy | lib-python/3/inspect.py | Python | bsd-3-clause | 47,368 |
"""Module calculates interactions between two molecules (proein-protein, protein-ligand, small-small).
Currently following interacions are implemented:
* hydrogen bonds
* halogen bonds
* pi stacking (parallel and perpendicular)
* salt bridges
* hydrophobic contacts
* pi-cation
* metal coordi... | mwojcikowski/opendrugdiscovery | oddt/interactions.py | Python | bsd-3-clause | 17,473 |
"""Perform regular monitoring of the COS FUV and NUV dark rates
"""
from __future__ import print_function, absolute_import, division
import os
import datetime
import numpy as np
import shutil
import glob
import math
import logging
logger = logging.getLogger(__name__)
from astropy.io import fits
from astropy.time im... | mfixstsci/peewee4cosmo | cosmo_peewee/dark/monitor.py | Python | bsd-3-clause | 18,295 |
from __future__ import absolute_import
from sentry.auth.system import is_system_auth, SystemToken
from sentry.testutils import TestCase
class TestSystemAuth(TestCase):
def test_is_system_auth(self):
token = SystemToken()
assert is_system_auth(token)
assert not is_system_auth({})
| beeftornado/sentry | tests/sentry/auth/test_system.py | Python | bsd-3-clause | 311 |
#!/usr/bin/env python
from django.core.management import execute_manager
try:
import settings # Assumed to be in the same directory.
except ImportError,e:
import sys
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have t... | ubgarbage/gae-blog | manage.py | Python | bsd-3-clause | 586 |
import director.applogic as app
from director import lcmUtils
from director import transformUtils
from director import visualization as vis
from director import filterUtils
from director import drcargs
from director.shallowCopy import shallowCopy
from director.timercallback import TimerCallback
from director import vtk... | patmarion/director | src/python/director/cameraview.py | Python | bsd-3-clause | 32,796 |
from __future__ import (
unicode_literals,
absolute_import,
print_function,
division,
)
str = type('')
import sys
import pytest
from mock import patch
from collections import namedtuple
try:
from math import isclose
except ImportError:
from gpiozero.compat import isclose
from gpiozero.pin... | MrHarcombe/python-gpiozero | tests/test_spi_devices.py | Python | bsd-3-clause | 13,991 |
"""
wiki-fetcher.py
Script to download MediaWiki pages and all embedded
documents, like images, PDFs, etc.
(c) 2015 by Manuel Peuster
manuel (dot) peuster (at) upb (dot) de
"""
"""
TODO:
* add recursive mode "-r": Download all content linked
from a given page (maybe with max_... | hkarl/mw2pdf | wikiconnector.py | Python | bsd-3-clause | 6,941 |
from AuthHandler import AuthHandler
import json
class BaseHandler(AuthHandler):
def serve_json(self, dict):
self.response.write(json.dumps(dict))
| Trupal00p/polymer-template | app/BaseHandler.py | Python | bsd-3-clause | 162 |
#!/usr/bin/python
# $Id:$
import ctypes
import pyglet
lib = ctypes.windll.wintab32
LONG = ctypes.c_long
BOOL = ctypes.c_int
UINT = ctypes.c_uint
WORD = ctypes.c_uint16
DWORD = ctypes.c_uint32
WCHAR = ctypes.c_wchar
FIX32 = DWORD
WTPKT = DWORD
LCNAMELEN = 40
class AXIS(ctypes.Structure):
_fields_ = (
... | bitcraft/pyglet | contrib/experimental/input/wintab.py | Python | bsd-3-clause | 13,714 |
# coding: utf-8
"""
Main script for dbpedia quepy.
"""
import quepy
dbpedia = quepy.install("dbpedia")
target, query, metadata = dbpedia.get_query("what is a blowtorch?")
print query | apostolosSotiropoulos/interQuepy | dbpedia/main.py | Python | bsd-3-clause | 184 |
from getpass import getpass
from util_config import config
from flask import Flask, render_template, request, g
from werkzeug.security import generate_password_hash
app = Flask(__name__)
# DB support
import MySQLdb
# returns a database connection for MySQL
def connect_to_database_mysql(database=None):
if database:
... | ax-rwnd/E-dot | utils/database_setup.py | Python | bsd-3-clause | 8,436 |
import sys
import re
from optparse import OptionParser
from nomination.models import Value, ValueSet, Valueset_Values
from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned
from django.db import IntegrityError
def addToValset(inputfile, valset):
"""Add a batch of valuesets to database."""
... | unt-libraries/django-nomination | user_scripts/batch_valuesets.py | Python | bsd-3-clause | 1,956 |
#!/usr/bin/env python
"""This script shows another example of using the PyWavefront module."""
# This example was created by intrepid94
import ctypes
import sys
sys.path.append('..')
import pyglet
from pyglet.gl import *
from pywavefront import visualization
from pywavefront import Wavefront
rotation = 0.0
meshes = ... | greenmoss/PyWavefront | examples/globe_complex.py | Python | bsd-3-clause | 1,763 |
# Author: Darius Sullivan <darius.sullivan@thermo.com>
# Thermo Fisher Scientific (Cambridge, UK).
# $Rev: 151 $
# $Date: 2013-12-17 18:29:25 +0000 (Tue, 17 Dec 2013) $
from __future__ import print_function
import random
import re
import numpy as np
from itertools import count
from collections import namedtuple
from ... | dariussullivan/libzmx | libzmx.py | Python | bsd-3-clause | 27,411 |
import numpy as np
file = '../../example/keres_cnn/keras/output/convolution2d_2_W_z.npy'
data = np.load(file)
print('weight data')
print(data.shape)
print(" f = data[0,i,:,:]")
for i in range(32):
f = data[0,i,:,:]
print(f) | natsutan/NPU | tools/nnn_numpy_dump/nnn_numpy_dump.py | Python | bsd-3-clause | 234 |
#!/usr/bin/env python
from setuptools import setup, Extension
with open("README.rst", "r") as f:
LONG_DESCRIPTION = f.read().strip()
with open("VERSION", "r") as f:
VERSION = f.read().strip()
SOURCES = ['jellyfishmodule.c', 'jaro.c', 'hamming.c', 'levenshtein.c',
'nysiis.c', 'damerau_levenshtein.... | achernet/jellyfish | setup.py | Python | bsd-3-clause | 1,343 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""An extensible ASCII table reader and writer.
fixedwidth.py:
Read or write a table with fixed width columns.
:Copyright: Smithsonian Astrophysical Observatory (2011)
:Author: Tom Aldcroft (aldcroft@head.cfa.harvard.edu)
"""
from . import core
from ... | bsipocz/astropy | astropy/io/ascii/fixedwidth.py | Python | bsd-3-clause | 15,255 |
"""Defines the unit tests for the :mod:`colour.characterisation.aces_it` module."""
from __future__ import annotations
import numpy as np
import os
import unittest
from colour.characterisation import (
MSDS_ACES_RICD,
MSDS_CAMERA_SENSITIVITIES,
SDS_COLOURCHECKERS,
sd_to_aces_relative_exposure_values,... | colour-science/colour | colour/characterisation/tests/test_aces_it.py | Python | bsd-3-clause | 48,076 |
# Copyright 2019 Verily Life Sciences LLC
#
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
import unittest
from typing import List, Tuple, Union # noqa: F401
from ddt import data, ddt, unpack
from purplequery.binary_expression import BinaryExpression
from purpl... | verilylifesciences/purplequery | purplequery/grammar_test.py | Python | bsd-3-clause | 16,590 |
#-*- coding: utf-8 -*-
from PIL import Image as PILImage
from datetime import datetime
from django.core import urlresolvers
from django.db import models
from django.utils.translation import ugettext_lazy as _
from filer import settings as filer_settings
from filer.models.filemodels import File
from filer.utils.filer_ea... | ryanbagwell/django-filer | filer/models/imagemodels.py | Python | bsd-3-clause | 6,912 |
from phovea_server.dataset_def import ATable, ADataSetProvider, AColumn, AVector, AMatrix
from logging import getLogger
import requests
import phovea_server
import numpy as np
__author__ = 'Samuel Gratzl'
_log = getLogger(__name__)
config = phovea_server.config.view('phovea_data_opencpu')
def _to_url(path):
return... | sgratzl/phovea_data_opencpu | phovea_data_opencpu/data_provider.py | Python | bsd-3-clause | 12,141 |
#! /usr/bin/env python3
import os, sys, time
pid = os.getpid()
os.write(1, ("About to fork (pid:%d)\n" % pid).encode())
rc = os.fork()
if rc < 0:
os.write(2, ("fork failed, returning %d\n" % rc).encode())
sys.exit(1)
elif rc == 0: # child
os.write(1, ("Child: My pid==%d. Parent's pid... | robustUTEP/os-shell | demos/p2-wait.py | Python | bsd-3-clause | 811 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# test_simulated_psfs.py
#
# Copyright 2016 Bruno S <bruno@oac.unc.edu.ar>
#
# This file is part of ProperImage (https://github.com/toros-astro/ProperImage)
# License: BSD-3-Clause
# Full Text: https://github.com/toros-astro/ProperImage/blob/master/LICENSE.txt
#
import ... | toros-astro/ProperImage | drafts/test_simulated_psfs.py | Python | bsd-3-clause | 2,650 |
# -*- coding: utf-8 -*-
"""Django page CMS ``managers``."""
from pages import settings
from pages.cache import cache
from pages.utils import normalize_url, get_now
from pages.phttp import get_slug
from django.db import models
from django.db.models import Q
from django.db.models import Max
from django.conf import setti... | batiste/django-page-cms | pages/managers.py | Python | bsd-3-clause | 11,982 |
"""
byceps.services.board.category_query_service
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2020 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from typing import Optional, Sequence
from ...database import db
from .models.category import Category as DbCategory
from .tra... | m-ober/byceps | byceps/services/board/category_query_service.py | Python | bsd-3-clause | 3,382 |
# 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 logging
import os
import xml.dom.minidom
from devil.utils import cmd_helper
from pylib.constants import host_paths
_FINDBUGS_HOME = os.path.joi... | chrisdickinson/nojs | build/android/pylib/utils/findbugs.py | Python | bsd-3-clause | 6,601 |
import logging.config
# Set up a verbose debugger level for tracing
TRACE_LEVEL_NUM = 5
logging.addLevelName(TRACE_LEVEL_NUM, "TRACE")
def trace(self, message, *args, **kws):
# Yes, logger takes its '*args' as 'args'.
if self.isEnabledFor(TRACE_LEVEL_NUM):
self._log(TRACE_LEVEL_NUM, message, args, **k... | bburan/cochlear | cochlear/__init__.py | Python | bsd-3-clause | 1,762 |
from django.conf.urls import patterns, url
from . views import SubscribersIntersection, FetchGroupView, FetchGroupMembersMonitorView, GetIntersectionsView
urlpatterns = patterns('',
url(r'^$', SubscribersIntersection.as_view(), name="subscribers_intersection"),
url(r'^fetch_group/$', FetchGroupView.as_view(), ... | Andertaker/django-intersections | intersections/urls.py | Python | bsd-3-clause | 659 |
# -*- coding: utf-8 -*-
"""
gitdict.author
"""
from .exceptions import NoGlobalAuthor
from time import altzone, daylight, timezone
from time import time as curtime
from pygit2 import Signature
import subprocess
def get_default_author():
"""Find the default author on this system.
:returns:
The defaul... | talos/gitdict | gitdict/author.py | Python | bsd-3-clause | 2,243 |
from __future__ import absolute_import
import six
import copy
import logging
from django.conf import settings
from sentry.similarity.features import FeatureSet
from sentry.similarity.encoder import Encoder
logger = logging.getLogger(__name__)
# We need this list of known labels generated from all grouping compone... | beeftornado/sentry | src/sentry/similarity/featuresv2.py | Python | bsd-3-clause | 3,446 |
# Copyright 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 subprocess
from telemetry.core.platform import desktop_platform_backend
from telemetry.core.platform import proc_util
class PosixPlatformBackend(de... | mogoweb/chromium-crosswalk | tools/telemetry/telemetry/core/platform/posix_platform_backend.py | Python | bsd-3-clause | 1,655 |