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 |
|---|---|---|---|---|---|
import rfc822
from flanker.addresslib import address
def canonicalize_address(addr):
"""Gmail addresses with and without periods are the same."""
parsed_address = address.parse(addr, addr_spec_only=True)
if not isinstance(parsed_address, address.EmailAddress):
return addr
local_part = parsed_a... | EthanBlackburn/sync-engine | inbox/util/addr.py | Python | agpl-3.0 | 857 |
# Copyright (c) 2010 Google Inc. All rights reserved.
# Copyright (c) 2009 Apple 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... | youfoh/webkit-efl | Tools/Scripts/webkitpy/common/host.py | Python | lgpl-2.1 | 7,333 |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from __future__ import print_function
import argparse
import sys
from six import iteritems
import llnl.util.tty as tty
... | LLNL/spack | lib/spack/spack/cmd/compiler.py | Python | lgpl-2.1 | 7,261 |
# ***************************************************************************
# * *
# * Copyright (c) 2016 - Frantisek Loeffelmann <LoffF@email.cz> *
# * *
# * Th... | usakhelo/FreeCAD | src/Mod/Fem/importInpMesh.py | Python | lgpl-2.1 | 9,765 |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
class Bcftools(AutotoolsPackage):
"""BCFtools is a set of utilities that manipulate variant calls in the
Varia... | iulian787/spack | var/spack/repos/builtin/packages/bcftools/package.py | Python | lgpl-2.1 | 3,898 |
#!/usr/bin/env python
""" Subscribe to the public gateway N times.
It echoes a command to watch a count of file descriptors. Run it. When its
maxxed out, that's when its time to echo a message remotely.
scp this to remote worker nodes and launch them all at the same time with
"./master.sh"
"""
import sys
import o... | chaiku/fedmsg | extras/stress/mass-sub.py | Python | lgpl-2.1 | 1,249 |
from response.mms.InboundMMSMessage import InboundMMSMessage
class InboundMessageList:
"""inboundMMSMessageList object contains an array of inboundSMSMessage objects along with associated information about the request"""
def __init__(self):
"""Default class constructor"""
self.inboundMessage=None
self.number... | OneAPI/GSMA-OneAPI | Python/response/mms/InboundMessageList.py | Python | lgpl-3.0 | 2,978 |
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
| yelizariev/addons-yelizariev | web_multi_attachment_base/__init__.py | Python | lgpl-3.0 | 70 |
#!/usr/bin/python
import struct
import array
class WChunk: #Chunk Basic Class for World Data (like adt,wmo etc.)
def __init__(self):
self.magic = 0
self.size = 0
def unpack(self,f):
self.magic, = struct.unpack("i",f.read(4))
self.size, = struct.unpack("i",f.read(4))
self.un... | GanjaNoel/pym2 | wdt/chunk.py | Python | lgpl-3.0 | 2,490 |
# -*- coding: UTF-8 -*-
##############################################################################
#
# OERPLib
# Copyright (C) 2011-2013 Sébastien Alix.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# ... | osiell/oerplib | oerplib/rpc/__init__.py | Python | lgpl-3.0 | 10,786 |
import numpy as np
import code
from imagernn.utils import merge_init_structs, initw, accumNpDicts
from imagernn.lstm_generator import LSTMGenerator
from imagernn.rnn_generator import RNNGenerator
def decodeGenerator(generator):
if generator == 'lstm':
return LSTMGenerator
if generator == 'rnn':
return RNNG... | arasdar/DL | impl-dl/etc/rnns/impl_imagernn_karpathy/generic_batch_generator.py | Python | unlicense | 5,701 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Book.price_net'
db.add_column(u'demo1_book', 'price_net',... | kohout/drf-demo | src/demo1/migrations/0002_auto__add_field_book_price_net.py | Python | unlicense | 1,122 |
#
# Copyright (c) 2013-2020 Contributors to the Eclipse Foundation
#
# See the NOTICE file distributed with this work for additional information regarding copyright
# ownership. All rights reserved. This program and the accompanying materials are made available
# under the terms of the Apache License, Version 2.0 whic... | locationtech/geowave | python/src/main/python/pygw/statistics/statistic.py | Python | apache-2.0 | 5,623 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.16 on 2019-03-13 11:54
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('views', '0014_data_migration'),
]
operations = [
migrations.AlterField(
... | rdmorganiser/rdmo | rdmo/views/migrations/0015_remove_null_true.py | Python | apache-2.0 | 4,097 |
# Copyright 2014 IBM Corp.
# 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 app... | jamielennox/tempest | tempest/tests/test_auth.py | Python | apache-2.0 | 15,978 |
import warnings as __warnings
__warnings.warn("unqualified module names deprecated, use whyis.search", DeprecationWarning)
from whyis.search import *
| tetherless-world/satoru | search.py | Python | apache-2.0 | 152 |
# Copyright 2017 Battelle Energy Alliance, LLC
#
# 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... | joshua-cogliati-inl/raven | tests/framework/ensembleModelTests/EM_C_dummy.py | Python | apache-2.0 | 692 |
import argparse
import sys
import pytest
from aioworkers.core.plugin import ProxyPlugin, search_plugins
class plugin:
configs = ('a',)
@pytest.mark.parametrize('name', [__name__, 'tests'])
def test_proxy_plugin(name, mocker):
del sys.modules[name]
assert name not in sys.modules
(p,) = search_plugi... | aioworkers/aioworkers | tests/test_plugins.py | Python | apache-2.0 | 498 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright 2016 Kitware 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 cop... | manthey/girder | plugins/authorized_upload/plugin_tests/upload_test.py | Python | apache-2.0 | 5,434 |
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
import shu... | dturner-tw/pants | tests/python/pants_test/task/test_task.py | Python | apache-2.0 | 3,831 |
#
# 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
# ... | pratikmallya/heat | heat/engine/resources/openstack/keystone/role_assignments.py | Python | apache-2.0 | 15,791 |
# Copyright (c) 2017 rmbar
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribu... | capergroup/bayou | tool_files/acceptpy_1_3_0/accept.py | Python | apache-2.0 | 9,670 |
import copy
# flake8: noqa
LSPCI = """
0000:00:00.0 "Host bridge" "Intel Corporation" "Haswell-E DMI2" -r02 "Intel Corporation" "Device 0000"
0000:00:03.0 "PCI bridge" "Intel Corporation" "Haswell-E PCI Express Root Port 3" -r02 "" ""
0000:00:03.2 "PCI bridge" "Intel Corporation" "Haswell-E PCI Express Root Port 3" -r0... | coreycb/charms.openstack | unit_tests/pci_responses.py | Python | apache-2.0 | 10,045 |
from argparse import ArgumentParser
from typing import Any
from zerver.lib.actions import create_stream_if_needed
from zerver.lib.management import ZulipBaseCommand
class Command(ZulipBaseCommand):
help = """Create a stream, and subscribe all active users (excluding bots).
This should be used for TESTING only, u... | tommyip/zulip | zerver/management/commands/create_stream.py | Python | apache-2.0 | 919 |
# -*- coding:utf-8 -*-
"""
Description:
Binary Writer
Usage:
from AntShares.IO.BinaryWriter import BinaryWriter
"""
import struct
import binascii
class BinaryWriter(object):
"""docstring for BinaryWriter"""
def __init__(self, stream):
super(BinaryWriter, self).__init__()
self.stream ... | AntSharesSDK/antshares-python | sdk/AntShares/IO/BinaryWriter.py | Python | apache-2.0 | 2,641 |
# Copyright 2016-2020 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
#
# or in the "license" f... | gregbdunn/aws-ec2rescue-linux | tools/moduletests/unit/test_selinuxpermissive.py | Python | apache-2.0 | 8,783 |
#
# 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... | tgroh/incubator-beam | sdks/python/apache_beam/io/range_trackers.py | Python | apache-2.0 | 14,379 |
# Copyright (c) 2010 Cloud.com, Inc
# Copyright 2012 Cloudbase Solutions Srl
# 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/... | vmturbo/nova | nova/virt/hyperv/vmops.py | Python | apache-2.0 | 48,910 |
import base64
import logging
import re
import subprocess
from typing import Optional
import orjson
from django.conf import settings
from django.http import HttpRequest, HttpResponse
from django.utils.translation import ugettext as _
from zerver.decorator import authenticated_json_view
from zerver.lib.ccache import ma... | brainwane/zulip | zerver/views/zephyr.py | Python | apache-2.0 | 2,693 |
# Copyright (c) 2018 PaddlePaddle 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 app... | luotao1/Paddle | python/paddle/fluid/tests/unittests/test_profiler.py | Python | apache-2.0 | 8,547 |
# Copyright 2017 Battelle Energy Alliance, LLC
#
# 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... | idaholab/raven | tests/framework/AnalyticModels/sudret_sobol_poly.py | Python | apache-2.0 | 1,356 |
from clients.flow_control import FlowController
from concurrent.futures import Executor, ThreadPoolExecutor
import time
from threading import Condition
class RateLimiterFlowController(FlowController):
"""
A FlowController that allows actions at a given per second rate.
"""
def __init__(self, per_seco... | GoogleCloudPlatform/pubsub | load-test-framework/python_src/clients/flow_control/rate_limiter_flow_controller.py | Python | apache-2.0 | 1,001 |
import numpy as np
from sklearn.preprocessing import LabelEncoder
from sklearn.preprocessing.label import _check_numpy_unicode_bug
from sklearn.utils import column_or_1d
from ..base import SparkBroadcasterMixin, SparkTransformerMixin
class SparkLabelEncoder(LabelEncoder, SparkTransformerMixin,
... | lensacom/sparkit-learn | splearn/preprocessing/label.py | Python | apache-2.0 | 3,089 |
# Copyright (c) 2019 PaddlePaddle 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 appli... | PaddlePaddle/Paddle | python/paddle/fluid/tests/unittests/test_parallel_executor_seresnext_base_gpu.py | Python | apache-2.0 | 1,457 |
#!/usr/bin/env python3
import unittest
from framework import VppTestCase, VppTestRunner
from util import ppp
from scapy.packet import Raw
from scapy.layers.inet import IP, UDP
from syslog_rfc5424_parser import SyslogMessage, ParseError
from syslog_rfc5424_parser.constants import SyslogFacility, SyslogSeverity
from vpp... | FDio/vpp | test/test_syslog.py | Python | apache-2.0 | 8,129 |
from unittest import TestCase
from pypika import Tables, functions as fn
import fireant as f
from fireant import DataSet, DataType, Database, Field, ReactTable
from fireant.tests.database.mock_database import TestDatabase
class DataSetBlenderIntegrationTests(TestCase):
maxDiff = None
def test_select_only_a... | mikeengland/fireant | fireant/tests/queries/test_data_blending_integration.py | Python | apache-2.0 | 55,610 |
# Copyright (c) 2014 NetApp, 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... | alex8866/cinder | cinder/volume/drivers/netapp/eseries/iscsi.py | Python | apache-2.0 | 35,860 |
import time
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
#GPIO.setup(4, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
#GPIO.setup(25, GPIO.OUT, initial=GPIO.LOW)
#GPIO.add_event_detect(4, GPIO.BOTH)
#def my_callback():
# GPIO.output(25, GPIO.input(4))
#GPIO.add_event_callback(4, my_callback)
def call(x):
print "some... | Nocturnal42/runmyrobot | test/gpio_test.py | Python | apache-2.0 | 566 |
#
# Copyright 2014-2016 MessageMedia
# 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, s... | infoxchange/messagemedia-python | mmsoap/client.py | Python | apache-2.0 | 13,370 |
# SPDX-License-Identifier: Apache-2.0
# Copyright Contributors to the Rez Project
"""
Get a list of a package's plugins.
"""
from __future__ import print_function
def setup_parser(parser, completions=False):
parser.add_argument(
"--paths", type=str, default=None,
help="set package search path")
... | instinct-vfx/rez | src/rez/cli/plugins.py | Python | apache-2.0 | 1,176 |
# Copyright 2017 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... | manipopopo/tensorflow | tensorflow/contrib/gan/python/estimator/python/gan_estimator_impl.py | Python | apache-2.0 | 13,797 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""This module implements mass worker by AWS SWF.
"""
# built-in modules
from __future__ import print_function
from functools import reduce, wraps
from multiprocessing import Event, Process, Queue
import json
import signal
import socket
import sys
import time
import trac... | badboy99tw/mass | mass/scheduler/swf/__init__.py | Python | apache-2.0 | 12,898 |
import json
import time
import re
import subprocess
import collections
import logging
import signal
from functools import partial
from mininet.cli import CLI
from mininet.node import RemoteController, OVSSwitch
from mininet.net import Mininet
from mininet.link import Link
from mininet.link import Intf
import patch_node... | brackjoker/test_l1_pj_rp | scenario_tester.py | Python | apache-2.0 | 8,201 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (... | cloudera/hue | desktop/core/src/desktop/converter_tests.py | Python | apache-2.0 | 23,357 |
"""
Provide pre-made queries on top of the recorder component.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/history/
"""
import asyncio
from collections import defaultdict
from datetime import timedelta
from itertools import groupby
import logging
imp... | kyvinh/home-assistant | homeassistant/components/history.py | Python | apache-2.0 | 12,100 |
# coding: utf-8
"""
Copyright 2015 SmartBear Software
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... | jianajavier/pnc-cli | pnc_cli/swagger_client/models/user.py | Python | apache-2.0 | 6,614 |
# Copyright (c) 2012 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 or agreed to... | openstack/tacker | tacker/common/constants.py | Python | apache-2.0 | 813 |
"""The test for binary_sensor device automation."""
from datetime import timedelta
import pytest
from unittest.mock import patch
from homeassistant.components.binary_sensor import DOMAIN, DEVICE_CLASSES
from homeassistant.components.binary_sensor.device_condition import ENTITY_CONDITIONS
from homeassistant.const impor... | joopert/home-assistant | tests/components/binary_sensor/test_device_condition.py | Python | apache-2.0 | 8,656 |
# 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... | tombstone/models | research/object_detection/models/ssd_mobilenet_v1_fpn_feature_extractor_tf1_test.py | Python | apache-2.0 | 8,728 |
#!/usr/bin/env python
# ROS IMPORTS
import roslib; roslib.load_manifest('simple_ur_driver')
import rospy
import tf; import tf_conversions as tf_c
import PyKDL
# MSGS and SERVICES
from simple_ur_msgs.srv import *
from sensor_msgs.msg import JointState
from geometry_msgs.msg import PoseStamped
from predicator_msgs.msg im... | futureneer/simple_ur | simple_ur_driver/src/simple_ur_driver/ur_driver_study.py | Python | bsd-2-clause | 19,251 |
import os
import sys
from spec import Spec, skip, eq_, raises
from invoke.loader import Loader
from invoke.collection import Collection
from invoke.exceptions import CollectionNotFound
from _utils import support
class Loader_(Spec):
def exposes_discovery_root(self):
root = '/tmp/'
eq_(Loader(ro... | alex/invoke | tests/loader.py | Python | bsd-2-clause | 2,196 |
#! /usr/bin/env python
import argparse
from compare_collections import MismatchLogger
from faster_ordered_dict import FasterOrderedDict
import gevent
import gevent.monkey
from gevent.pool import Pool
from pymongo.read_preferences import ReadPreference
import time
import utils
log = utils.get_logger(__name__)
POOL_SIZ... | gamechanger/hydra | copy_stragglers.py | Python | bsd-2-clause | 4,159 |
#!/usr/bin/python
#
# Copyright (C) 2008, 2011, 2012, 2013 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:
#
# 1. Redistributions of source code must retain the above copyright noti... | andir/ganeti | test/py/cmdlib/cluster_unittest.py | Python | bsd-2-clause | 96,615 |
import unittest
import os.path
from contextlib import contextmanager
from streamlink.plugin.plugin import UserInputRequester
from tests.mock import MagicMock, patch
from streamlink import Streamlink, PluginError
from streamlink_cli.console import ConsoleUserInputRequester
import streamlink_cli.console
from tests.plug... | back-to/streamlink | tests/test_plugins_input.py | Python | bsd-2-clause | 2,652 |
"""
Unit tests for yaml.
"""
import os,tempfile
from nose import SkipTest
from nose.tools import assert_true,assert_equal
import networkx as nx
class TestYaml(object):
@classmethod
def setupClass(cls):
global yaml
try:
import yaml
except ImportError:
raise ... | rainest/dance-partner-matching | networkx/readwrite/tests/test_yaml.py | Python | bsd-2-clause | 1,300 |
# DO NOT EDIT THIS FILE. This file will be overwritten when re-running go-raml.
from .User import User
from .users_service import UsersService
from .oauth2_client_itsyouonline import Oauth2ClientItsyouonline
from .http_client import HTTPClient
class Client:
def __init__(self, base_uri="http://localhost:5000"):... | Jumpscale/go-raml | docs/tutorial/python/requests_client/goramldir/__init__.py | Python | bsd-2-clause | 639 |
import os
# ***********************************
# Settings common to all environments
# ***********************************
# Application settings
APP_NAME = "Game Valet"
APP_SYSTEM_ERROR_SUBJECT_LINE = APP_NAME + " system error"
# Flask settings
CSRF_ENABLED = True
# Flask-User settings
USER_APP_NAME = APP_NAME... | teirce/game-valet | app/startup/common_settings.py | Python | bsd-2-clause | 957 |
"""Utilities to evaluate the clustering performance of models.
Functions named as *_score return a scalar value to maximize: the higher the
better.
"""
# Authors: Olivier Grisel <olivier.grisel@ensta.org>
# Wei LI <kuantkid@gmail.com>
# Diego Molla <dmolla-aliod@gmail.com>
# Arnaud Fouchet ... | herilalaina/scikit-learn | sklearn/metrics/cluster/supervised.py | Python | bsd-3-clause | 31,399 |
from urlparse import urlparse
from django.core.paginator import Paginator
from django.http import QueryDict
from nose.tools import eq_
from test_utils import RequestFactory
from amo.tests import ESTestCase, TestCase
from mkt.api.paginator import MetaSerializer, ESPaginator
from mkt.webapps.indexers import WebappInd... | andymckay/zamboni | mkt/api/tests/test_paginator.py | Python | bsd-3-clause | 4,864 |
import functools
import operator
import sys
import warnings
import numbers
from collections import namedtuple
from multiprocessing import Pool
import inspect
import math
import numpy as np
try:
from numpy.random import Generator as Generator
except ImportError:
class Generator(): # type: ignore[no-redef]
... | nmayorov/scipy | scipy/_lib/_util.py | Python | bsd-3-clause | 16,576 |
# -*- coding: utf-8 -*-
#
# Pinax Symposion documentation build configuration file, created by
# sphinx-quickstart on Sun Feb 5 17:31:13 2012.
#
# 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
# autogenerated file.... | smellman/sotmjp-website | docs/conf.py | Python | bsd-3-clause | 8,580 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
from auto_nag.scripts.workflow.p1_no_activity import P1NoActivity
from auto_nag.scripts.workflow.p1_no_assignee import P... | mozilla/bztools | auto_nag/scripts/workflow/p1.py | Python | bsd-3-clause | 410 |
import cv2
import skimage.data
import instance_occlsegm_lib
def test_resize():
for interpolation in [cv2.INTER_NEAREST, cv2.INTER_LINEAR]:
_test_resize(interpolation)
def _test_resize(interpolation):
img = skimage.data.astronaut()
H_dst, W_dst = 480, 640
ret = instance_occlsegm_lib.image.r... | start-jsk/jsk_apc | demos/instance_occlsegm/tests/image_tests/test_resize.py | Python | bsd-3-clause | 1,334 |
DATETIME_FORMAT = '%Y-%m-%dT%H%M%SZ'
| dimagi/commcare-hq | corehq/apps/dump_reload/const.py | Python | bsd-3-clause | 37 |
################################# LICENSE ##################################
# Copyright (c) 2009, South African Astronomical Observatory (SAAO) #
# All rights reserved. #
# #
############... | crawfordsm/pysalt | saltred/salt2iraf.py | Python | bsd-3-clause | 2,648 |
import os
import sys
import imp
import multiprocessing
from setuptools import setup, find_packages
version = imp.load_source('version', os.path.join('flask_appbuilder', 'version.py'))
def fpath(name):
return os.path.join(os.path.dirname(__file__), name)
def read(fname):
return open(fpath(fname)).read()
def... | rpiotti/Flask-AppBuilder | setup.py | Python | bsd-3-clause | 1,758 |
import os
import urlparse
from SocketServer import ThreadingMixIn
from wsgiref.util import setup_testing_defaults
from wsgiref.simple_server import make_server, WSGIServer
from lightningjs.http.gzipper import GzipperMiddleware
class ThreadedWsgiServer(ThreadingMixIn, WSGIServer):
pass
class RoutableApplication... | FocusLab/willie | vendor/lightningjs/lib/python/lightningjs/http/__init__.py | Python | bsd-3-clause | 2,265 |
"""
:mod:`django-append-url-to-sql` --- Appends the request URL to SQL statements in Django
=======================================================================================
Whilst the `Django Debug Toolbar
<https://github.com/robhudson/django-debug-toolbar>`_ is invaluable for
development in a local environment... | lamby/django-append-url-to-sql | append_url_to_sql/models.py | Python | bsd-3-clause | 2,204 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
=============
TAP plus
=============
@author: Juan Carlos Segovia
@contact: juan.carlos.segovia@sciops.esa.int
European Space Astronomy Centre (ESAC)
European Space Agency (ESA)
Created on 30 jun. 2016
"""
import os
from astropy.table import Table... | ceb8/astroquery | astroquery/utils/tap/model/modelutils.py | Python | bsd-3-clause | 1,243 |
#
# CvHelp.py -- help classes for the Cv drawing
#
# This is open-source software licensed under a BSD license.
# Please see the file LICENSE.txt for details.
import math
import numpy
import cv2
from ginga import colors
class Pen(object):
def __init__(self, color='black', linewidth=1, alpha=1.0):
self.c... | stscieisenhamer/ginga | ginga/cvw/CvHelp.py | Python | bsd-3-clause | 4,985 |
import pandas as pd
import pytest
from statsmodels.datasets import co2, macrodata
from statsmodels.tsa.x13 import (
_find_x12,
x13_arima_analysis,
x13_arima_select_order,
)
x13path = _find_x12()
pytestmark = pytest.mark.skipif(x13path is False,
reason='X13/X12 not availabl... | statsmodels/statsmodels | statsmodels/tsa/tests/test_x13.py | Python | bsd-3-clause | 1,501 |
# Copyright 2014 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.
class TimelineBasedMetricException(Exception):
"""Exception that can be thrown from metrics that implements
TimelineBasedMetric to indicate a problem... | Bysmyyr/chromium-crosswalk | tools/telemetry/telemetry/web_perf/metrics/timeline_based_metric.py | Python | bsd-3-clause | 3,168 |
import datetime
import factory
from django.utils.timezone import utc
from openbudget.apps.accounts.models import Account
class AccountFactory(factory.DjangoModelFactory):
FACTORY_FOR = Account
password = 'letmein'
email = factory.Sequence(lambda n: 'p{0}@here.com'.format(n))
first_name = factory.Seq... | nborwankar/open-budgets | openbudget/apps/accounts/factories.py | Python | bsd-3-clause | 1,107 |
#__docformat__ = "restructuredtext en"
# ******NOTICE***************
# optimize.py module by Travis E. Oliphant
#
# You may copy and use this module as you see fit with no
# guarantee implied provided you keep this notice in all copies.
# *****END NOTICE************
# A collection of optimization algorithms. Version ... | teoliphant/scipy | scipy/optimize/optimize.py | Python | bsd-3-clause | 101,264 |
# Generated by Django 2.1.2 on 2018-10-24 09:54
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("tests", "0038_singletonpageviamaxcount"),
]
operations = [
migrations.AddField(
model_name="customdocument",
name="d... | rsalmaso/wagtail | wagtail/tests/testapp/migrations/0039_customdocument_description.py | Python | bsd-3-clause | 398 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
__init__
---------
Contains testing helpers.
"""
import os
import shutil
import stat
import sys
if sys.version_info[:2] < (2, 7):
import unittest2 as unittest
else:
import unittest
def force_delete(func, path, exc_info):
"""
Error handler for `shuti... | ericholscher/cookiecutter | tests/__init__.py | Python | bsd-3-clause | 3,893 |
__description__ = "Librato Silverline process monitoring and management"
__config__ = {
"librato.api_token": dict(
description = "API token for account",
default = "0",
),
"librato.server_id_cmd": dict(
description = "Command to run to generate server ID",
default = None,
... | samuel/kokki | kokki/cookbooks/librato/metadata.py | Python | bsd-3-clause | 560 |
# -*- coding: utf-8 -*-
import validator.unicodehelper as unicodehelper
COMPARISON = 'täst'.decode('utf-8')
def _do_test(path):
'Performs a test on a JS file'
text = open(path).read()
utext = unicodehelper.decode(text)
print utext.encode('ascii', 'backslashreplace')
assert utext == COMPARISON
... | mozilla/amo-validator | tests/test_unicodehelper.py | Python | bsd-3-clause | 1,282 |
"""Migration for a given Submitty course database."""
def up(config, database, semester, course):
"""
Run up migration.
:param config: Object holding configuration details about Submitty
:type config: migrator.config.Config
:param database: Object for interacting with given database for environme... | RCOS-Grading-Server/HWserver | migration/migrator/migrations/course/20200704004101_gradeable_access.py | Python | bsd-3-clause | 1,205 |
# Author: Eric Larson <larson.eric.d@gmail.com>
#
# License: BSD (3-clause)
import os.path as op
import matplotlib
import numpy as np
from numpy.testing import (assert_array_almost_equal, assert_allclose,
assert_equal)
import pytest
from mne import find_events, Epochs, pick_types, channels... | teonlamont/mne-python | mne/io/array/tests/test_array.py | Python | bsd-3-clause | 4,770 |
"""
Defines common types and type related utilities: Singleton, etc.
These types can be shared by other utils modules and imported into util main namespace for use by other pymel modules
"""
import inspect, types, operator, sys, warnings
class Singleton(type):
""" Metaclass for Singleton classes.
>>> cl... | CountZer0/PipelineConstructionSet | python/maya/site-packages/pymel-1.0.3/pymel/util/utilitytypes.py | Python | bsd-3-clause | 43,474 |
import logging
import io
from pathlib import Path
from rdflib import URIRef, RDF
from dipper.graph.RDFGraph import RDFGraph
LOG = logging.getLogger(__name__)
class TestUtils:
@staticmethod
def test_graph_equality(turtlish, graph):
"""
:param turtlish: file path or string of triples in turtl... | TomConlin/dipper | dipper/utils/TestUtils.py | Python | bsd-3-clause | 2,394 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Question'
db.create_table('qa_question', (
('id', self.gf('django.db.models.fiel... | amirnissim/okqa | qa/migrations/0001_initial.py | Python | bsd-3-clause | 6,711 |
from __future__ import unicode_literals
from distutils.spawn import find_executable
from django.utils.functional import cached_property
from require.conf import settings as require_settings
from require.helpers import import_module_attr
def load_environment():
environment = require_settings.REQUIRE_ENVIRONMENT... | thijstriemstra/django-require | require/environments.py | Python | bsd-3-clause | 1,816 |
#! /usr/bin/env python2
# -*- coding: utf-8 -*-
from __future__ import (unicode_literals, absolute_import, division)
import datetime as dt
import xbmc
import xbmcgui
from threading import Thread
from lib import constants as const
from lib import kodi
if const.os == "win":
import pywin32setup
from lib import playb... | eirki/script.service.koalahbonordic | service.py | Python | mit | 2,275 |
############################################################
#The MIT License (MIT)
#Copyright (c) 2015 Yuta KItagami
#Project: https://github.com/nonNoise/akilib
############################################################
import mraa
import time
from struct import *
class AKI_SPI_AQM1248A:
def __init__(sel... | nonNoise/akilib | pypi/akilib/edison/AKI_SPI_AQM1248A.py | Python | mit | 3,569 |
import CatalogItem
from toontown.toonbase import ToontownGlobals
from toontown.toonbase import TTLocalizer
from otp.otpbase import OTPLocalizer
from direct.interval.IntervalGlobal import *
from direct.gui.DirectGui import *
class CatalogNametagItem(CatalogItem.CatalogItem):
sequenceNumber = 0
def makeNewItem(... | Spiderlover/Toontown | toontown/catalog/CatalogNametagItem.py | Python | mit | 3,528 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'acq4/util/DirTreeWidget/DirTreeTemplate.ui'
#
# Created by: PyQt5 UI code generator 5.8.2
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Form(object):
def setupUi(self, Form... | pbmanis/acq4 | acq4/util/DirTreeWidget/DirTreeTemplate_pyqt5.py | Python | mit | 4,684 |
#<ImportSpecificModules>
import ShareYourSystem as SYS
#</ImportSpecificModules>
#print(SYS.SumClass().insert('Parameter').hdfview().HdformatedConsoleStr)
#print(SYS.SumClass().insert('Result').hdfview().HdformatedConsoleStr)
#print(SYS.Sum.attest_insert())
#print(SYS.Sum.attest_retrieve())
#print(SYS.Sum.attest_find(... | Ledoux/ShareYourSystem | Pythonlogy/ShareYourSystem/Standards/Tutorials/Sumer/Test.py | Python | mit | 388 |
import sys, os, yaml, glob
import subprocess
import argparse
def main(args):
workingDir = os.getcwd()
assemblers = sum(args.assemblers, [])
samples_data_dir = args.sample_data_dir
checkSupportedAssemblers(assemblers, args.global_config)
#The specified assembler are supported, at least they are pr... | senthil10/NouGAT | utils/prepare_de_novo_assembly.py | Python | mit | 6,340 |
# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
This module helps emulate Visual Studio 2008 behavior on top of other
build systems, primarily ninja.
"""
import collections
import os
import re
import subpro... | nodejs/node-gyp | gyp/pylib/gyp/msvs_emulation.py | Python | mit | 54,358 |
#!/usr/bin/env python3
import argparse
import socket
import time
print("hello")
parser = argparse.ArgumentParser(description="Network Testing Tools");
parser.add_argument('-a', '--address', nargs=1, help='ip or dns address of host',
default='192.168.0.99')
parser.add_argument('-p', '--port', narg... | travisg/lk | tools/nettool.py | Python | mit | 727 |
from django.views.generic import ListView, DetailView, CreateView, \
DeleteView, UpdateView, \
ArchiveIndexView, DateDetailView, \
DayArchiveView, MonthArchiveView, \
TodayArchiveView, Wee... | tnemis/staging-server | baseapp/views/class_studying_views.py | Python | mit | 3,912 |
# Our real numbers will default to float.
x = 1.1
y = 2.2
print("x, %s, %.17f") % (type(x), x)
print("y, %s, %.17f") % (type(y), y)
#Ok, everything looks good... now add them together to get 3.3
z = x + y
print("z, %s: %.15f at 15 decimals") % (type(z), z)
print("z, %s: %.17f at 17 decimals") % (type(z), z)
print("... | razzius/PyClassLessons | instructors/lessons/numbers/examples/ex1_floatvdec.py | Python | mit | 381 |
# https://app.codesignal.com/arcade/code-arcade/corner-of-0s-and-1s/b5z4P2r2CGCtf8HCR
def killKthBit(n, k):
# Use bit operators to turn off the k-th bit from the right.
# First create a value with the bit at the position turned on
# and everything else off. Then flip that value so all bits
# are 1 excep... | zubie7a/Algorithms | CodeSignal/Arcade/The_Core/Level_03_Corner_Of_Zeros_And_Ones/017_Kill_Kth_Bit.py | Python | mit | 492 |
import unreal_engine as ue
from unreal_engine.classes import SceneCaptureComponent2D, PyHUD
from unreal_engine.enums import ESceneCaptureSource
class Sight:
def __init__(self):
self.what_i_am_seeing = ue.create_transient_texture_render_target2d(512, 512)
def pre_initialize_components(self):
... | getnamo/UnrealEnginePython | tutorials/FaceRecognitionWithOpenCVAndUnrealEnginePython_Assets/eyes_fourth.py | Python | mit | 1,501 |
#!/usr/bin/env python3
# Copyright (c) 2017-2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Class for bitcoind node under test"""
import contextlib
import decimal
import errno
from enum import E... | Christewart/bitcoin | test/functional/test_framework/test_node.py | Python | mit | 17,404 |
import sys
import os
import os.path
from jinja2 import Template
from ConfigParser import ConfigParser
import StringIO
if __name__ == "__main__":
if len(sys.argv) != 3:
print("Usage: <program> <deploy_cfg_template_file> <file_with_properties>")
print("Properties from <file_with_properties> will be a... | pranjan77/kb_go_express | scripts/prepare_deploy_cfg.py | Python | mit | 2,069 |
# coding=utf-8
from django.conf import settings
from storages.backends.s3boto import S3BotoStorage
class StaticStorage(S3BotoStorage):
location = settings.STATICFILES_LOCATION
class MediaStorage(S3BotoStorage):
location = settings.MEDIAFILES_LOCATION
| vinipachecov/django-ecommerce | djangoecommerce/s3util.py | Python | cc0-1.0 | 266 |
def label_amdpar_from(instruction_xml):
label_parts = instruction_xml.get('label', '').split('-')
# <AMDPAR><EREGS_INSTRUCTIONS><INSTRUCTION>...
amdpar = instruction_xml.getparent().getparent()
return label_parts, amdpar
| tadhg-ohiggins/regulations-parser | regparser/notice/amendments/utils.py | Python | cc0-1.0 | 237 |