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 (c) 2011-2012, John Haddon. All rights reserved.
# Copyright (c) 2011-2013, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted prov... | goddardl/gaffer | python/GafferTest/TypedObjectPlugTest.py | Python | bsd-3-clause | 8,984 |
# -*- coding: utf-8 -*-
import sys, os
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
from builder.shared_conf import * # pyflakes:ignore (API import)
paths = ['../param/', '.', '..']
add_paths(paths)
# General information about the project.
project = u'Lancet'
copyright = u'2014, IOAM'
ioam_project =... | ioam/lancet | doc/conf.py | Python | bsd-3-clause | 2,993 |
from gpiozero import LEDBarGraph
from time import sleep
from __future__ import division # required for python 2
graph = LEDBarGraph(5, 6, 13, 19, 26, 20)
graph.value = 1 # (1, 1, 1, 1, 1, 1)
sleep(1)
graph.value = 1/2 # (1, 1, 1, 0, 0, 0)
sleep(1)
graph.value = -1/2 # (0, 0, 0, 1, 1, 1)
sleep(1)
graph.value = 1/4... | waveform80/gpio-zero | docs/examples/led_bargraph_1.py | Python | bsd-3-clause | 400 |
"""Module containing the logic for our debugging logic."""
from __future__ import print_function
import json
import platform
import setuptools
def print_information(option, option_string, value, parser,
option_manager=None):
"""Print debugging information used in bug reports.
:param o... | vicky2135/lucious | oscar/lib/python2.7/site-packages/flake8/main/debug.py | Python | bsd-3-clause | 2,017 |
# Copyright 2015, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the f... | larsonmpdx/grpc | src/python/grpcio/grpc/framework/core/_interfaces.py | Python | bsd-3-clause | 10,428 |
# Licensed under a 3-clause BSD style license - see PYFITS.rst
import math
import os
import re
import time
import warnings
import pytest
import numpy as np
from numpy.testing import assert_equal
from astropy.io import fits
from astropy.tests.helper import catch_warnings, ignore_warnings
from astropy.io.fits.hdu.comp... | MSeifert04/astropy | astropy/io/fits/tests/test_image.py | Python | bsd-3-clause | 76,391 |
import os
import time
import threading
import warnings
from django.conf import settings
from django.db import connections
from django.dispatch import receiver, Signal
from django.utils import timezone
from django.utils.functional import empty
template_rendered = Signal(providing_args=["template", "context"])
setting... | TimBuckley/effective_django | django/test/signals.py | Python | bsd-3-clause | 4,520 |
import unittest
from payment_terminal.tests import test_loader
import payment_terminal.drivers.bbs.tests as test_bbs
def suite():
loader = unittest.TestLoader()
suite = unittest.TestSuite((
loader.loadTestsFromModule(test_bbs),
loader.loadTestsFromModule(test_loader),
))
return suite
| bwhmather/python-payment-terminal | payment_terminal/tests/__init__.py | Python | bsd-3-clause | 320 |
"""Generated client library for bigquery version v2."""
# NOTE: This file is autogenerated and should not be edited by hand.
from googlecloudapis.apitools.base.py import base_api
from googlecloudapis.bigquery.v2 import bigquery_v2_messages as messages
class BigqueryV2(base_api.BaseApiClient):
"""Generated client l... | ychen820/microblog | y/google-cloud-sdk/lib/googlecloudapis/bigquery/v2/bigquery_v2_client.py | Python | bsd-3-clause | 25,939 |
from cog.models import *
from django.forms import ModelForm, ModelMultipleChoiceField, NullBooleanSelect
from django.db import models
from django.contrib.admin.widgets import FilteredSelectMultiple
from django import forms
from django.forms import ModelForm, Textarea, TextInput, Select, SelectMultiple, FileInput, Check... | sashakames/COG | cog/forms/forms_project.py | Python | bsd-3-clause | 9,756 |
# -*- coding: utf-8 -*-
from collections import defaultdict
import re
import numpy as np
from pyfr.readers import BaseReader, NodalMeshAssembler
from pyfr.readers.nodemaps import GmshNodeMaps
def msh_section(mshit, section):
endln = '$End{}\n'.format(section)
endix = int(next(mshit)) - 1
for i, l in e... | Aerojspark/PyFR | pyfr/readers/gmsh.py | Python | bsd-3-clause | 6,856 |
#!/usr/bin/env python
def main():
import sys
raw_data = load_csv(sys.argv[1])
create_table(raw_data)
def get_stencil_num(k):
# add the stencil operator
if k['Stencil Kernel coefficients'] in 'constant':
if int(k['Stencil Kernel semi-bandwidth'])==4:
stencil = 0
else:
... | tareqmalas/girih | scripts/sisc/paper_bytes_requirement_analysis.py | Python | bsd-3-clause | 6,160 |
import pytest # isort:skip
pytest.importorskip("django") # isort:skip
from os.path import join
import django
from django.test import TestCase
import mock
import pytest
from conftest import BASE_TEMPLATE_DIR
from opbeat.contrib.django.models import get_client, opbeat
try:
# Django 1.10+
from django.urls i... | patrys/opbeat_python | tests/instrumentation/django_tests/template_tests.py | Python | bsd-3-clause | 5,153 |
from __future__ import absolute_import
from .differential_operators import (
make_vjp, grad, multigrad_dict, elementwise_grad, value_and_grad,
grad_and_aux, hessian_tensor_product, hessian_vector_product, hessian,
jacobian, tensor_jacobian_product, vector_jacobian_product, grad_named,
checkpoint, make_h... | HIPS/autograd | autograd/__init__.py | Python | mit | 504 |
"""
For any given number, we only need to test the primes below it.
e.g. 9 -- we need only test 1,2,3,5,7
e.g. 8 -- we need only test 1,2,3,5,7
for example, the number 12 has factors 1,2,3,6,12.
We could find the six factor but we will find the two factor first.
The definition of a composite number is that it is co... | razzius/PyClassLessons | instructors/course-2015/errors_and_introspection/project/primetester3.py | Python | mit | 969 |
import numpy
from chainer import configuration
from chainer import functions
from chainer import link
from chainer.utils import argument
class DecorrelatedBatchNormalization(link.Link):
"""Decorrelated batch normalization layer.
This link wraps the
:func:`~chainer.functions.decorrelated_batch_normaliza... | tkerola/chainer | chainer/links/normalization/decorrelated_batch_normalization.py | Python | mit | 5,209 |
# -*- coding: utf-8 -*-
from .main import app
from . import views
"""
Initialize the package
"""
| stxnext-kindergarten/presence-analyzer-agrochowski | src/presence_analyzer/__init__.py | Python | mit | 97 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('deck', '0013_proposal_more_information'),
]
operations = [
migrations.AddField(
model_name='event',
... | mauricioabreu/speakerfight | deck/migrations/0014_event_anonymous_voting.py | Python | mit | 485 |
import logging
import re
from varapp.samples.samples_factory import *
def samples_selection_from_request(request, db, from_ped=True):
"""Parse a GET request to make the samples groups and return a SamplesSelection.
:param from_ped: read groups info based on 'phenotype' attribute in the Samples table.
"""
... | 444thLiao/VarappX-flask | varappx/samples/samples_service.py | Python | mit | 1,401 |
#!/usr/bin/env python
# Reports a summary of Kraken's results
# and optionally creates a newick Tree
# Copyright (c) 2016 Daniel Blankenberg
# Licensed under the Academic Free License version 3.0
# https://github.com/blankenberg/Kraken-Taxonomy-Report
import sys
import os
import optparse
import re
__VERSION__ = '0.0... | nturaga/tools-iuc | tools/kraken_taxonomy_report/kraken_taxonomy_report.py | Python | mit | 11,752 |
import os
import sys
path = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
sys.path.insert(0, path)
| phha/taskwiki | tests/__init__.py | Python | mit | 115 |
import Street
class DLStreet(Street.Street):
def __init__(self, loader, parentFSM, doneEvent):
Street.Street.__init__(self, loader, parentFSM, doneEvent)
def load(self):
Street.Street.load(self)
def unload(self):
Street.Street.unload(self)
| ksmit799/Toontown-Source | toontown/town/DLStreet.py | Python | mit | 280 |
# https://app.codesignal.com/arcade/intro/level-3/JKKuHJknZNj4YGL32
from collections import Counter
def commonCharacterCount(s1, s2):
# When counter is initialized with a String, since its a
# sequence it will store counts for each of its characters.
c1 = Counter(s1)
c2 = Counter(s2)
common = 0
... | zubie7a/Algorithms | CodeSignal/Arcade/Intro/Level_03/02_Common_Character_Count.py | Python | mit | 637 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import socialregistration.models
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('sites', '0001_initial'),
migrations.swappable_dependency(settings.A... | minlex/django-socialregistration | socialregistration/contrib/openid/migrations/0001_initial.py | Python | mit | 2,204 |
"""
Compute the principal eigenvector of a matrix using power iteration.
See also numpy.linalg.eig which calculates all the eigenvalues and
eigenvectors.
"""
import numpy
def normalise(nvec):
"""Normalises the given numpy array."""
return nvec / numpy.sqrt(numpy.dot(nvec, nvec))
def squared_error(vector_1,... | mojones/Axelrod | axelrod/eigen.py | Python | mit | 2,189 |
# Time: O(m + n)
# Space: O(min(m, n))
# Given two arrays, write a function to compute their intersection.
#
# Example:
# Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2].
#
# Note:
# Each element in the result must be unique.
# The result can be in any order.
# Hash solution.
class Solution(object):
def... | githubutilities/LeetCode | Python/intersection-of-two-arrays.py | Python | mit | 2,721 |
# coding: utf8
from ...symbols import (
ADJ, DET, NOUN, NUM, PRON, PROPN, PUNCT, VERB, POS
)
from ...lemmatizer import Lemmatizer
class RussianLemmatizer(Lemmatizer):
_morph = None
def __init__(self):
super(RussianLemmatizer, self).__init__()
try:
from pymorphy2 import MorphAn... | recognai/spaCy | spacy/lang/ru/lemmatizer.py | Python | mit | 6,860 |
# coding: utf-8
from app import db
class Content(db.Model):
__tablename__ = "contents"
session = db.session
data = db.Column(db.Text())
_type = db.Column(db.String(80), primary_key=True)
def __init__(self, data, type):
self.data = data
self._type = type
def to_dict(self):
... | pygamebrasil/pygame-site | src/app/contents/models.py | Python | mit | 969 |
# -*- coding: utf-8 -*-
from interpparser import tree
from regparser.citations import Label
def test_text_to_labels():
text = u"9(c)(2)(iii) Charges not Covered by § 1026.6(b)(1) and "
text += "(b)(2)"
result = tree.text_to_labels(text, Label(part='1111', comment=True))
assert result == [['1111', '9',... | tadhg-ohiggins/regulations-parser | tests/interpparser/tree_tests.py | Python | cc0-1.0 | 1,202 |
# -*- coding: utf-8 -*-
#
# Copyright © 2013-2015 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions
# of the GNU General Public License v.2, or (at your option) any later
# version. This program is distributed... | crobinso/pkgdb2 | pkgdb2/api/extras.py | Python | gpl-2.0 | 20,250 |
#! /usr/bin/python
import collections
import sys
import json
DepEntry = collections.namedtuple('DepEntry', 'widget dep enable die hide')
dep_map = (
DepEntry("title", "queue_add", "none", True, False),
DepEntry("title", "queue_add_menu", "none", True, False),
DepEntry("title", "queue_add_multiple_menu", "... | utensil-star/HandBrake | gtk/src/makedeps.py | Python | gpl-2.0 | 5,589 |
"""
A ribbon gallery is like a :class:`ListBox`, but for bitmaps rather than strings.
Description
===========
It displays a collection of bitmaps arranged in a grid and allows the user to
choose one. As there are typically more bitmaps in a gallery than can be displayed
in the space used for a ribbon, a gallery alwa... | garrettcap/Bulletproof-Backup | wx/lib/agw/ribbon/gallery.py | Python | gpl-2.0 | 32,914 |
from typing import (
Iterable,
Mapping,
Union,
)
from pcs.cli.common.errors import (
SEE_MAN_CHANGES,
CmdLineInputError,
)
from pcs.common.str_tools import (
format_list,
format_plural,
)
from pcs.common.tools import timeout_to_seconds
ModifierValueType = Union[None, bool, str]
ARG_TYPE_D... | tomjelinek/pcs | pcs/cli/common/parse_args.py | Python | gpl-2.0 | 21,092 |
import unittest
from PyFoam.Basics import Helpers
theSuite=unittest.TestSuite()
| Unofficial-Extend-Project-Mirror/openfoam-extend-Breeder-other-scripting-PyFoam | unittests/Basics/test_Helpers.py | Python | gpl-2.0 | 82 |
"""
This is a Pure Python module to hyphenate text.
It is inspired by Ruby's Text::Hyphen, but currently reads standard *.dic files,
that must be installed separately.
In the future it's maybe nice if dictionaries could be distributed together with
this module, in a slightly prepared form, like in Ruby's Text::Hyphe... | brownian/frescobaldi | frescobaldi_app/hyphenator.py | Python | gpl-2.0 | 8,884 |
# -*- encoding: utf-8 -*-
# $File: session.py
# $Date: Sun Mar 04 19:27:38 2012 +0800
#
# Copyright (C) 2012 the pynojo development team <see AUTHORS file>
#
# Contributors to this file:
# PWX <airyai@gmail.com>
#
# This file is part of pynojo
#
# pynojo is free software: you can redistribute it and/or modify
#... | jia-kai/pynojo | pynojo/mp/session.py | Python | gpl-3.0 | 7,080 |
### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed... | Microvellum/Fluid-Designer | win64-vc/2.78/Python/bin/2.78/scripts/addons_contrib/data_overrides/util.py | Python | gpl-3.0 | 3,986 |
# Copyright (C) 2009-2012 by the Free Software Foundation, Inc.
#
# This file is part of GNU Mailman.
#
# GNU Mailman is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at you... | hcs/mailman | src/mailman/commands/cli_version.py | Python | gpl-3.0 | 1,359 |
"""Ansible integration test infrastructure."""
from __future__ import annotations
import contextlib
import datetime
import json
import os
import re
import shutil
import tempfile
import time
import typing as t
from ...encoding import (
to_bytes,
)
from ...ansible_util import (
ansible_environment,
)
from ...... | sysadmin75/ansible | test/lib/ansible_test/_internal/commands/integration/__init__.py | Python | gpl-3.0 | 36,116 |
# coding: utf-8
"""Tests for the elpy.server module"""
import os
import tempfile
import unittest
import mock
from elpy import rpc
from elpy import server
from elpy.tests import compat
from elpy.tests.support import BackendTestCase
import elpy.refactor
class ServerTestCase(unittest.TestCase):
def setUp(self):
... | birkenfeld/elpy | elpy/tests/test_server.py | Python | gpl-3.0 | 14,270 |
#
# Author: Travis Oliphant, 2002
#
from numpy import pi, asarray, floor, isscalar, iscomplex, real, imag, sqrt, \
where, mgrid, cos, sin, exp, place, seterr, issubdtype, extract, \
complexfloating, less, vectorize, inexact, nan, zeros, sometrue
from _cephes import ellipkm1, mathieu_a, mathieu_b, iv, ... | ygenc/onlineLDA | onlineldavb_new/build/scipy/scipy/special/basic.py | Python | gpl-3.0 | 27,910 |
# Copyright 2014-2017 The ODL contributors
#
# This file is part of ODL.
#
# 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 https://mozilla.org/MPL/2.0/.
from __future__ import absolute_import
__al... | kohr-h/odl | odl/contrib/solvers/functional/__init__.py | Python | mpl-2.0 | 416 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP - Account renumber wizard
# Copyright (C) 2009 Pexego Sistemas Informáticos. All Rights Reserved
# $Id$
#
# This program is free software: you can redistribute it and/or modify
# it under th... | nareshppts/account_chart_update | account_renumber/test/create_moves.py | Python | agpl-3.0 | 5,324 |
"""
Django admin dashboard configuration for LMS XBlock infrastructure.
"""
from django.contrib import admin
from config_models.admin import ConfigurationModelAdmin
from .models import (
AppVersionConfig,
MobileApiConfig,
IgnoreMobileAvailableFlagConfig
)
admin.site.register(MobileApiConfig, Configuration... | fintech-circle/edx-platform | lms/djangoapps/mobile_api/admin.py | Python | agpl-3.0 | 946 |
# -*- Mode: Python -*-
# vi:si:et:sw=4:sts=4:ts=4
# Flumotion - a streaming media server
# Copyright (C) 2004,2005,2006,2007,2008,2009 Fluendo, S.L.
# Copyright (C) 2010,2011 Flumotion Services, S.A.
# All rights reserved.
#
# This file may be distributed and/or modified under the terms of
# the GNU Lesser General Pub... | flumotion-mirror/flumotion | flumotion/component/effects/videoscale/admin_gtk.py | Python | lgpl-2.1 | 4,782 |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | lgarren/spack | var/spack/repos/builtin/packages/fixesproto/package.py | Python | lgpl-2.1 | 1,847 |
#############################################################################
##
## Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
## Contact: http://www.qt-project.org/legal
##
## This file is part of Qt Creator.
##
## Commercial License Usage
## Licensees holding valid commercial Qt licenses may use this f... | farseerri/git_code | tests/system/shared/workarounds.py | Python | lgpl-2.1 | 12,374 |
#!/usr/bin/env python3
###############################################################
# Copyright 2021 Lawrence Livermore National Security, LLC
# (c.f. AUTHORS, NOTICE.LLNS, COPYING)
#
# This file is part of the Flux resource manager framework.
# For details, see https://github.com/flux-framework.
#
# SPDX-License-Id... | chu11/flux-core | t/scripts/stats-listen.py | Python | lgpl-3.0 | 2,126 |
# encoding: utf-8
from __future__ import unicode_literals
import json
import re
import itertools
from .common import InfoExtractor
from ..compat import (
compat_HTTPError,
compat_urlparse,
)
from ..utils import (
determine_ext,
ExtractorError,
InAdvancePagedList,
int_or_none,
RegexNotFound... | nandhp/youtube-dl | youtube_dl/extractor/vimeo.py | Python | unlicense | 33,081 |
# -*- coding: utf-8 -*-
#
# This file is part of PyBuilder
#
# Copyright 2011-2020 PyBuilder Team
#
# 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/l... | pybuilder/pybuilder | samples/pybuilder_external_plugin_demo/build.py | Python | apache-2.0 | 1,076 |
"""Tests for homekit_controller config flow."""
from unittest import mock
import unittest.mock
from unittest.mock import patch
import aiohomekit
from aiohomekit.model import Accessories, Accessory
from aiohomekit.model.characteristics import CharacteristicsTypes
from aiohomekit.model.services import ServicesTypes
impo... | partofthething/home-assistant | tests/components/homekit_controller/test_config_flow.py | Python | apache-2.0 | 22,205 |
# -*- coding: utf-8 -*-
# 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... | smerritt/swift | doc/source/conf.py | Python | apache-2.0 | 8,171 |
#! /usr/bin/python
#
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# http://code.google.com/p/protobuf/
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# ... | alokc83/metasyntactic | protobuf-2.0.3/python/google/protobuf/internal/decoder_test.py | Python | apache-2.0 | 10,635 |
#
# Copyright (c) 2008-2015 Citrix Systems, 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 l... | benfinke/ns_python | nssrc/com/citrix/netscaler/nitro/resource/config/snmp/snmpoid.py | Python | apache-2.0 | 6,179 |
# Copyright 2014 The Swarming Authors. All rights reserved.
# Use of this source code is governed by the Apache v2.0 license that can be
# found in the LICENSE file.
"""Imports groups from some external tar.gz bundle or plain text list.
External URL should serve *.tar.gz file with the following file structure:
<ext... | pombreda/swarming | appengine/auth_service/common/importer.py | Python | apache-2.0 | 14,804 |
# 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
# distributed under th... | sijie/bookkeeper | stream/clients/python/tests/unit/bookkeeper/test_futures.py | Python | apache-2.0 | 3,929 |
# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
# Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect 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 Lice... | AnshulYADAV007/Lean | Algorithm.Python/OptionDataNullReferenceRegressionAlgorithm.py | Python | apache-2.0 | 1,485 |
# Copyright 2014 ARM Limited
#
# Licensed under the Apache License, Version 2.0
# See LICENSE file for details.
# standard library modules, , ,
import logging
import os
import threading
from collections import OrderedDict
# fsutils, , misc filesystem utils, internal
import fsutils
# Ordered JSON, , read & write json,... | BlackstoneEngineering/yotta | yotta/lib/settings.py | Python | apache-2.0 | 5,218 |
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
"""
This module contains all the constants that our experiments need
"""
GPS_LOCATIONS = {
'Rathmines': (53.3265199,-6.2648571),
'Santry': (53.3944773,-6.2468027),
'Sandyford': (53.2698337,-6.2245713),
'IKEA': (53.40741905,-6.275007... | DIVERSIFY-project/SMART-GH | daemon-wservice/experiments/constants.py | Python | apache-2.0 | 2,244 |
#
# 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... | airbnb/airflow | airflow/contrib/hooks/discord_webhook_hook.py | Python | apache-2.0 | 1,175 |
#!/usr/bin/env python3
# ****************************************************************************
# Copyright 2019 The Apollo 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... | xiaoxq/apollo | cyber/python/cyber_py3/examples/timer.py | Python | apache-2.0 | 1,385 |
#
#
# Copyright (C) 2014 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 notice,
# this list of conditions and ... | apyrgio/ganeti | lib/jqueue/exec.py | Python | bsd-2-clause | 5,254 |
"""IPython terminal interface using prompt_toolkit in place of readline"""
from __future__ import print_function
import base64
import errno
from getpass import getpass
from io import BytesIO
import os
import signal
import subprocess
import sys
import time
from warnings import warn
try:
from queue import Empty # ... | unnikrishnankgs/va | venv/lib/python3.5/site-packages/jupyter_console/ptshell.py | Python | bsd-2-clause | 32,196 |
#!/usr/bin/env python
def fix(word):
ret = ""
flag = False
for c in word:
if c == '_':
flag = True
continue
if flag:
c = c.upper()
flag = False
ret += c
return ret
words = [line.strip() for line in open('keywords.txt', 'r') if len(... | jamesmarva/myria | jsonQueries/case_conversion/generate_convert_zsh.py | Python | bsd-3-clause | 761 |
#!/usr/bin/env python
from __future__ import print_function
from builtins import input
from builtins import str
import sys
import pmagpy.pmag as pmag
def main():
"""
NAME
stats.py
DEFINITION
calculates Gauss statistics for input data
SYNTAX
stats [command line options][< fil... | lfairchild/PmagPy | programs/stats.py | Python | bsd-3-clause | 1,632 |
"""
Worker that receives input from Piped RDD.
"""
import os
import sys
import time
import traceback
from base64 import standard_b64decode
# CloudPickler needs to be imported so that depicklers are registered using the
# copy_reg module.
from pyspark.accumulators import _accumulatorRegistry
from pyspark.broadcast impor... | prabeesh/Spark-Kestrel | python/pyspark/worker.py | Python | bsd-3-clause | 2,473 |
from __future__ import division, print_function, absolute_import
import warnings
import numpy as np
from numpy import asarray_chkfinite
from .misc import LinAlgError, _datacopied
from .lapack import get_lapack_funcs
from scipy._lib.six import callable
__all__ = ['qz']
_double_precision = ['i','l','d']
def _sele... | witcxc/scipy | scipy/linalg/_decomp_qz.py | Python | bsd-3-clause | 8,764 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Setup script for jupyter_contrib_nbextensions."""
# -----------------------------------------------------------------------------
# Imports
# -----------------------------------------------------------------------------
from __future__ import print_function
import os
... | ipython-contrib/IPython-notebook-extensions | setup.py | Python | bsd-3-clause | 4,617 |
from tower import ugettext_lazy as _
# Add-on and File statuses.
STATUS_NULL = 0
STATUS_PENDING = 2
STATUS_PUBLIC = 4
STATUS_DISABLED = 5
STATUS_DELETED = 11
STATUS_REJECTED = 12
STATUS_APPROVED = 13
STATUS_BLOCKED = 15
STATUS_UNLISTED = 16
# AMO-only statuses. Kept here only for memory and to not re-use the IDs.
_S... | tsl143/zamboni | mkt/constants/base.py | Python | bsd-3-clause | 10,226 |
# -*- coding: utf-8 -*-
"""
GPFA core functionality.
:copyright: Copyright 2014-2020 by the Elephant team, see AUTHORS.txt.
:license: Modified BSD, see LICENSE.txt for details.
"""
from __future__ import division, print_function, unicode_literals
import time
import warnings
import numpy as np
import scipy.linalg as... | INM-6/elephant | elephant/gpfa/gpfa_core.py | Python | bsd-3-clause | 20,866 |
from django.contrib import messages
from django.shortcuts import render, redirect
from django.template.loader import render_to_string
from tower import ugettext as _
from .forms import ReportForm
from ..base.utils import notify_admins
from ..base.decorators import throttle_view
@throttle_view(methods=['POST'], durat... | mozilla/popcorn_maker | popcorn_gallery/reports/views.py | Python | bsd-3-clause | 1,003 |
"""
datetimelike delegation
"""
from __future__ import annotations
from typing import TYPE_CHECKING
import warnings
import numpy as np
from pandas.core.dtypes.common import (
is_categorical_dtype,
is_datetime64_dtype,
is_datetime64tz_dtype,
is_integer_dtype,
is_list_like,
is_period_dtype,
... | dsm054/pandas | pandas/core/indexes/accessors.py | Python | bsd-3-clause | 14,627 |
"""
fs.remote
=========
Utilities for interfacing with remote filesystems
This module provides reusable utility functions that can be used to construct
FS subclasses interfacing with a remote filesystem. These include:
* RemoteFileBuffer: a file-like object that locally buffers the contents of
... | wylieswanson/agilepyfs | fs/remote.py | Python | bsd-3-clause | 26,904 |
# encoding: utf-8
from .base import APITestCase
from vilya.models.user import User
class FollowTest(APITestCase):
def setUp(self):
super(FollowTest, self).setUp()
user_name1 = 'zhangchi'
email = '%s@douban.com' % user_name1
self.zhangchi = User(user_name1, email)
user_name2... | xtao/code | tests/webtests/api/test_follow.py | Python | bsd-3-clause | 2,864 |
# 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.
import logging
import os
import unittest
from telemetry.core import os_version
from telemetry.core import util
from telemetry import decorators
from telemet... | lihui7115/ChromiumGStreamerBackend | tools/telemetry/telemetry/internal/platform/power_monitor/powermetrics_power_monitor_unittest.py | Python | bsd-3-clause | 3,002 |
from django.conf.urls.defaults import *
urlpatterns = patterns('lingcod.manipulators.views',
(r'^test/$', 'testView' ),
(r'^list/([A-Za-z0-9_,]+)/([A-Za-z0-9_,]+)/$', 'mpaManipulatorList' ),
url(r'^([A-Za-z0-9_,]+)/$', 'multi_generic_manipulator_view', name='manipulate'),
url(r'^$', 'multi_generic_mani... | Alwnikrotikz/marinemap | lingcod/manipulators/urls.py | Python | bsd-3-clause | 487 |
import gc
import os
import random
import eventlet
from eventlet import hubs, greenpool, event, pools
from eventlet.support import greenlets as greenlet, six
import tests
def passthru(a):
eventlet.sleep(0.01)
return a
def passthru2(a, b):
eventlet.sleep(0.01)
return a, b
def raiser(exc):
raise... | collinstocks/eventlet | tests/greenpool_test.py | Python | mit | 15,085 |
from controllers.board_controller import BoardController
from models.move import Move
from models.board import Board
controller = BoardController()
controller.init_game() | daniellima/othello | main.py | Python | mit | 204 |
"""
Test for unwanted reference cycles
"""
import pyqtgraph as pg
import numpy as np
import gc, weakref
import six
import pytest
app = pg.mkQApp()
skipreason = ('unclear why test is failing on python 3. skipping until someone '
'has time to fix it. Or pyside is being used. This test is '
'... | pbmanis/acq4 | acq4/pyqtgraph/tests/test_ref_cycles.py | Python | mit | 2,523 |
class Solution:
# @param {integer[]} nums
# @param {integer} target
# @return {integer[]}
def searchRange(self, nums, target):
res = []
l, r = 0, len(nums) - 1
while l <= r:
m = (l + r) /2
if nums[m] < target:
l = m + 1
else:
... | Chasego/codirit | leetcode/034-Search-for-a-Range/SearchForaRange_001.py | Python | mit | 654 |
"""Assess transcript abundance in RNA-seq experiments using Cufflinks.
http://cufflinks.cbcb.umd.edu/manual.html
"""
import os
import tempfile
from bcbio.utils import get_in, file_exists, safe_makedir
from bcbio.distributed.transaction import file_transaction
from bcbio.pipeline import config_utils
from bcbio.provena... | hjanime/bcbio-nextgen | bcbio/rnaseq/cufflinks.py | Python | mit | 10,155 |
from __future__ import absolute_import, division, print_function, unicode_literals
from gratipay.elsewhere import PlatformOAuth2
from gratipay.elsewhere._extractors import any_key, key
from gratipay.elsewhere._paginators import query_param_paginator
class Google(PlatformOAuth2):
# Platform attributes
name =... | eXcomm/gratipay.com | gratipay/elsewhere/google.py | Python | cc0-1.0 | 1,648 |
'''OpenGL extension SUNX.constant_data
This module customises the behaviour of the
OpenGL.raw.GL.SUNX.constant_data to provide a more
Python-friendly API
Overview (from the spec)
This extension allows the pixel data specified by the
application to be used internally without making a second copy.
This extension... | D4wN/brickv | src/build_data/windows/OpenGL/GL/SUNX/constant_data.py | Python | gpl-2.0 | 835 |
#
# Copyright (c) 2016 Google, Inc
# Written by Simon Glass <sjg@chromium.org>
#
# SPDX-License-Identifier: GPL-2.0+
#
# Test for the Entry class
import collections
import unittest
import entry
class TestEntry(unittest.TestCase):
def testEntryContents(self):
"""Test the Entry bass class"""
b... | chris4795/u-boot-novena | tools/binman/entry_test.py | Python | gpl-2.0 | 873 |
#!/usr/bin/env python
#-*- coding: utf-8 -*-
###########################################################################
## ##
## Copyrights Etienne Chové <chove@crans.org> 2009 ##
## Copyrights Frédéric Rodrigo 2011-2015 ... | tkas/osmose-backend | analysers/analyser_osmosis_building_overlaps.py | Python | gpl-3.0 | 8,802 |
# Copyright 2016 Mycroft AI, Inc.
#
# This file is part of Mycroft Core.
#
# Mycroft Core is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later versio... | jasonehines/mycroft-core | mycroft/tts/google_tts.py | Python | gpl-3.0 | 1,667 |
#!/usr/bin/env python
'''log command handling'''
import time, os
from MAVProxy.modules.lib import mp_module
class LogModule(mp_module.MPModule):
def __init__(self, mpstate):
super(LogModule, self).__init__(mpstate, "log", "log transfer")
self.add_command('log', self.cmd_log, "log file handling", ... | 3drobotics/MAVProxy | MAVProxy/modules/mavproxy_log.py | Python | gpl-3.0 | 7,465 |
#!/usr/bin/python2.4
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://w... | marcellodesales/svnedge-console | ext/windows/pkg-toolkit/pkg/vendor-packages/pkg/client/progress.py | Python | agpl-3.0 | 30,842 |
# 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 sys
from ctest_log_parser import BuildError, BuildWarning, CTestLogParser
f... | LLNL/spack | lib/spack/spack/util/log_parse.py | Python | lgpl-2.1 | 3,781 |
# 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
# distributed under the... | vitan/openrave | sandbox/debugkinbody.py | Python | lgpl-3.0 | 4,041 |
#!/usr/bin/env python
# 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
# "Li... | cwelton/incubator-hawq | tools/bin/gpload.py | Python | apache-2.0 | 95,521 |
#!/usr/bin/python
from azuremodules import *
import sys
import shutil
import time
import re
import os
import linecache
import imp
import os.path
import zipfile
current_distro = "unknown"
distro_version = "unknown"
sudo_password = ""
startup_file = ""
rpm_links = {}
tar_link = {}
current_distro = ... | Azure/azure-linux-automation | remote-scripts/SETUP-INSTALL-PACKAGES.py | Python | apache-2.0 | 22,500 |
#!/usr/bin/python
#
# Copyright 2014 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | coxmediagroup/googleads-python-lib | examples/dfa/v1_20/get_advertisers.py | Python | apache-2.0 | 2,314 |
# 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... | infobloxopen/neutron | neutron/openstack/common/middleware/request_id.py | Python | apache-2.0 | 1,027 |
"""A mail sender that sends mail via a configured sendmail."""
# =============================================================================
# CONTENTS
# -----------------------------------------------------------------------------
# phlmail_sender
#
# Public Classes:
# MailSender
# .send
#
# -------------------... | kjedruczyk/phabricator-tools | py/phl/phlmail_sender.py | Python | apache-2.0 | 2,042 |
"""
@package mi.instrument.wetlabs.fluorometer.flord_d.test.test_driver
@file marine-integrations/mi/instrument/wetlabs/fluorometer/flort_d/driver.py
@author Tapana Gupta
@brief Test cases for flord_d driver
USAGE:
Make tests verbose and provide stdout
* From the IDK
$ bin/test_driver
$ bin/test_driv... | vipullakhani/mi-instrument | mi/instrument/wetlabs/fluorometer/flord_d/test/test_driver.py | Python | bsd-2-clause | 19,945 |
# flake8: noqa
"""
Public testing utility functions.
"""
from pandas.util.testing import (
assert_frame_equal, assert_index_equal, assert_series_equal)
| GuessWhoSamFoo/pandas | pandas/testing.py | Python | bsd-3-clause | 158 |
"""
Bridging module between Oscar and the gateway module (which is Oscar agnostic)
"""
from oscar.apps.payment import exceptions
from paypal.payflow import codes, gateway, models
def authorize(order_number, amt, bankcard, billing_address=None):
"""
Make an *authorisation* request
This holds the money on... | lpakula/django-oscar-paypal | paypal/payflow/facade.py | Python | bsd-3-clause | 6,767 |
import unittest2 as unittest
from ..models import TestStorage
from ..strategy import TestStrategy
from ...backends.utils import load_backends, get_backend
from ...backends.github import GithubOAuth2
from ...exceptions import MissingBackend
class BaseBackendUtilsTest(unittest.TestCase):
def setUp(self):
s... | tobias47n9e/social-core | social_core/tests/backends/test_utils.py | Python | bsd-3-clause | 1,767 |
from django.db.models import Q
from .models import UserProfile
class TestUserBackend:
"""Authentication backend to easily log in a user while testing."""
def authenticate(self, request=None, username=None, email=None, password=None):
# This needs to explicitly throw when there is a password since dj... | mozilla/addons-server | src/olympia/users/backends.py | Python | bsd-3-clause | 1,144 |