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 |
|---|---|---|---|---|---|
#!/usr/bin/env python
from contextlib import contextmanager
import fnmatch
import os
import tarfile
import tempfile
import click
import numpy as np
import rasterio
from rasterio import crs
from rasterio.warp import calculate_default_transform, reproject, RESAMPLING
@contextmanager
def temp_expand(filename):
if o... | ceholden/landsat_tiles | tests/data/mini_espa.py | Python | bsd-3-clause | 5,223 |
###
# Copyright (c) 2003-2005, Jeremiah Fincher
# Copyright (c) 2008-2009, James McCoy
# 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 ... | Ban3/Limnoria | plugins/String/plugin.py | Python | bsd-3-clause | 9,489 |
# ----------------------------------------------------------------------------
# Copyright (c) 2013--, scikit-bio development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
# --------------------------------------------... | gregcaporaso/scikit-bio | skbio/stats/ordination/tests/test_principal_coordinate_analysis.py | Python | bsd-3-clause | 13,369 |
"""`Configuration` provider type specification example."""
import os
from dependency_injector import containers, providers
class ApiClient:
def __init__(self, api_key: str, timeout: int):
self.api_key = api_key
self.timeout = timeout
class Container(containers.DeclarativeContainer):
confi... | rmk135/dependency_injector | examples/providers/configuration/configuration_type.py | Python | bsd-3-clause | 898 |
"""
===========================================================================
Motor imagery decoding from EEG data using the Common Spatial Pattern (CSP)
===========================================================================
Decoding of motor imagery applied to EEG data decomposed using CSP.
Here the classifier... | nicproulx/mne-python | examples/decoding/plot_decoding_csp_eeg.py | Python | bsd-3-clause | 5,570 |
import json
import os
from datetime import date, datetime
from django.conf import settings
from django.core.exceptions import BadRequest
import responses
from olympia.amo.tests import TestCase
from olympia.devhub.cron import update_blog_posts
from olympia.devhub.models import BlogPost
class TestUpdateBlogPosts(Tes... | mozilla/addons-server | src/olympia/devhub/tests/test_cron.py | Python | bsd-3-clause | 3,507 |
# Author: Virgile Fritsch <virgile.fritsch@inria.fr>
#
# License: BSD 3 clause
import numpy as np
from . import MinCovDet
from ..utils.validation import check_is_fitted
from ..utils.validation import _deprecate_positional_args
from ..metrics import accuracy_score
from ..base import OutlierMixin
class EllipticEnvelop... | anntzer/scikit-learn | sklearn/covariance/_elliptic_envelope.py | Python | bsd-3-clause | 8,316 |
#!/usr/bin/env python
#
# Curriculum Module Deploy Script
# - Run once per PCE by the admin
# - onramp_run_params.cfg file is -not- available
#
import os
import sys
import time
from subprocess import call
print 'This is an output log test.'
sys.stderr.write('Output to stderr')
#
# Change to the 'src' directory
#
os.... | OnRampOrg/onramp | pce/src/testing/testmodule/bin/onramp_deploy_bad.py | Python | bsd-3-clause | 790 |
#!/usr/bin/env python
import os, sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "symposion_project.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| pyconca/2013-web | manage.py | Python | bsd-3-clause | 262 |
# -*- coding: utf-8 -*-
"""Script to compact all Brython scripts in a single one."""
import datetime
import os
import re
import sys
import tarfile
import zipfile
import javascript_minifier
if(sys.version_info[0]!=3):
raise ValueError("This script only works with Python 3")
# path of parent directory
pdir = o... | Mozhuowen/brython | scripts/make_dist.py | Python | bsd-3-clause | 8,039 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# thumbor imaging service
# https://github.com/thumbor/thumbor/wiki
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 globo.com thumbor@googlegroups.com
from os.path import splitext
from thumbor.ext.filters import _nine_p... | fanhero/thumbor | thumbor/filters/frame.py | Python | mit | 3,694 |
# Node Grid Arranger Class
NODE_PADDING = 80
FRAME_NAMES = ['Textures','Output','Blend']
FRAME_WIDTHS = [400, 180, 180]
TOTAL_WIDTH = 0.0
for width in FRAME_WIDTHS:
TOTAL_WIDTH += width + NODE_PADDING
FRAME_COLORS = [(0.6,0.48,0.44),(0.53,0.6,0.47),(0.56,0.46,0.90)]
class Nodegrid:
def __init__(self, nodetree,... | AxioDL/PathShagged | hecl/blender/hecl/Nodegrid.py | Python | mit | 2,045 |
"""The tests the History component."""
# pylint: disable=protected-access,too-many-public-methods
from datetime import timedelta
import unittest
from unittest.mock import patch, sentinel
import homeassistant.core as ha
import homeassistant.util.dt as dt_util
from homeassistant.components import history, recorder
from... | deisi/home-assistant | tests/components/test_history.py | Python | mit | 7,481 |
import struct
# see https://en.wikipedia.org/wiki/Half-precision_floating-point_format
def float16i(val):
val &= 0xffff
sign = (val & 0x8000) << 16
frac = val & 0x3ff
expn = (val >> 10) & 0x1f
if expn == 0:
if frac:
# denormalized number
shift = 11 - frac.bit_length... | envytools/envytools | rnn/fp.py | Python | mit | 822 |
from sqlobject import *
from sqlobject.tests.dbtest import *
from sqlobject.inheritance import InheritableSQLObject
class InheritedPersonIndexGet(InheritableSQLObject):
first_name = StringCol(notNone=True)
last_name = StringCol(notNone=True)
age = IntCol()
pk = DatabaseIndex(first_... | lightcode/SeriesWatcher | serieswatcher/sqlobject/inheritance/tests/test_indexes.py | Python | mit | 1,659 |
"""
This module contains functions to handle markers. Used by both the
marker functionality of `~matplotlib.axes.Axes.plot` and
`~matplotlib.axes.Axes.scatter`.
All possible markers are defined here:
============================== ===============================================
marker descrip... | Solid-Mechanics/matplotlib-4-abaqus | matplotlib/markers.py | Python | mit | 25,917 |
"""Multi-consumer multi-producer dispatching mechanism
Originally based on pydispatch (BSD) http://pypi.python.org/pypi/PyDispatcher/2.0.1
See license.txt for original license.
Heavily modified for Django's purposes. 有重大修改
"""
from django.dispatch.dispatcher import Signal, receiver | Anlim/decode-Django | Django-1.5.1/django/dispatch/__init__.py | Python | gpl-2.0 | 295 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2011 Glencoe Software, Inc. All Rights Reserved.
# Use is subject to license terms supplied in LICENSE.txt
#
"""
Integration test focused on the omero.api.IUpdate interface.
"""
import unittest
import integration.library as lib
import omero
class Test... | rleigh-dundee/openmicroscopy | components/tools/OmeroPy/test/integration/iupdate.py | Python | gpl-2.0 | 838 |
default_app_config = 'games.word2def.apps.Word2DefConfig'
| taniaka/lingwars-games | games/word2def/__init__.py | Python | gpl-2.0 | 60 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
components/tools/OmeroPy/src/omero/util/figureUitl.py
-----------------------------------------------------------------------------
Copyright (C) 2006-2009 University of Dundee. All rights reserved.
This program is free software; you can redistribute it and/or m... | ximenesuk/openmicroscopy | components/tools/OmeroPy/src/omero/util/figureUtil.py | Python | gpl-2.0 | 10,958 |
#############################################################################
#
# Voronoi diagram calculator/ Delaunay triangulator
# Translated to Python by Bill Simons
# September, 2005
#
# Additional changes by Carson Farmer added November 2010
#
# Calculate Delaunay triangulation or the Voronoi polygons for a set o... | mola/qgis | python/plugins/fTools/tools/voronoi.py | Python | gpl-2.0 | 28,072 |
# This file is part of the sos project: https://github.com/sosreport/sos
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# version 2 of the GNU General Public License.
#
# See the LICENSE file in the source distribution ... | slashdd/sos | sos/report/plugins/usbguard.py | Python | gpl-2.0 | 813 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) Pootle contributors.
#
# This file is a part of the Pootle project. It is distributed under the GPL3
# or later license. See the LICENSE file for a copy of the license and the
# AUTHORS file for copyright and authorship information.
import locale
from dj... | electrolinux/pootle | pootle/apps/pootle_project/views.py | Python | gpl-3.0 | 5,958 |
import cPickle as pickle
import os
from kupfer import config
from kupfer import conspickle
from kupfer import pretty
mnemonics_filename = "mnemonics.pickle"
CORRELATION_KEY = 'kupfer.bonus.correlation'
## this is a harmless default
_default_actions = {
'<builtin.AppLeaf gnome-terminal>': '<builtin.LaunchAgain>',
'... | labero/kupfer | kupfer/core/learn.py | Python | gpl-3.0 | 5,364 |
# Copyright (C) 2010 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | harshilasu/GraphicMelon | y/google-cloud-sdk/platform/gcutil/lib/google_api_python_client/oauth2client/appengine.py | Python | gpl-3.0 | 29,976 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from datetime import datetime
from dateutil.relativedelta import relativedelta
from openerp import api, fields, models, _
from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT
from openerp.tools.translate import _
fro... | minhphung171093/GreenERP | openerp/addons/purchase/purchase.py | Python | gpl-3.0 | 41,819 |
# -*- 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 field 'Feedback.editor'
db.add_column('publicweb_feedback', 'editor',
self.gf... | martinburchell/econsensus | django/econsensus/publicweb/migrations/0031_auto__add_field_feedback_editor.py | Python | gpl-3.0 | 10,418 |
from django.apps import AppConfig
class QuotesConfig(AppConfig):
name = 'quotes'
| KSG-IT/ksg-nett | quotes/apps.py | Python | gpl-3.0 | 87 |
import io
import json
import os
import html5lib
import pytest
from selenium import webdriver
from wptserver import WPTServer
ENC = 'utf8'
HERE = os.path.dirname(os.path.abspath(__file__))
WPT_ROOT = os.path.normpath(os.path.join(HERE, '..', '..'))
HARNESS = os.path.join(HERE, 'harness.html')
def pytest_addoption(pa... | upsuper/servo | tests/wpt/web-platform-tests/resources/test/conftest.py | Python | mpl-2.0 | 4,612 |
# 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 django import forms
from django.utils.translation import ugettext as _
from oneanddone.base.widgets import MyURLFi... | bobsilverberg/oneanddone | oneanddone/users/forms.py | Python | mpl-2.0 | 2,126 |
"""HTTP endpoints for the Teams API."""
import logging
from django.shortcuts import get_object_or_404, render_to_response
from django.http import Http404
from django.conf import settings
from django.core.paginator import Paginator
from django.views.generic.base import View
from rest_framework.generics import GenericA... | zofuthan/edx-platform | lms/djangoapps/teams/views.py | Python | agpl-3.0 | 50,126 |
# -*- coding: utf-8 -*-
# Copyright 2014 Associazione Odoo Italia (<http://www.odoo-italia.org>)
# Copyright 2016 Andrea Gallina (Apulia Software)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import test_fiscalcode
| linkitspa/l10n-italy | l10n_it_fiscalcode/tests/__init__.py | Python | agpl-3.0 | 247 |
# -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
import copy
from functools import partial
from numbers import Number
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from django.utils.formats... | maurizi/otm-core | opentreemap/treemap/units.py | Python | agpl-3.0 | 9,932 |
#!/usr/bin/python
# -*- coding: utf8 -*-
import mock
import random
from django.test import TestCase
from django.core.urlresolvers import reverse
import swiftclient
import swiftbrowser
class MockTest(TestCase):
""" Unit tests for swiftbrowser
All calls using python-swiftclient.clients are replaced using mo... | hbhdytf/django-swiftbrowser | tests/test_swiftbrowser.py | Python | apache-2.0 | 13,751 |
# Copyright 2016 NEC Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | openstack/python-neutronclient | neutronclient/tests/functional/core/test_common.py | Python | apache-2.0 | 1,394 |
# 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 u... | GabrielBrascher/cloudstack | test/integration/smoke/test_multipleips_per_nic.py | Python | apache-2.0 | 5,419 |
# 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 use ... | rectang/lucy-clownfish | runtime/python/test/test_err.py | Python | apache-2.0 | 1,117 |
from typing import Any, Dict
from django.conf import settings
from zerver.lib.upload import upload_backend
from zerver.models import Realm
def get_realm_logo_source(realm: Realm, night: bool) -> str:
if realm.plan_type == Realm.LIMITED:
return Realm.LOGO_DEFAULT
if night:
return realm.night_... | rht/zulip | zerver/lib/realm_logo.py | Python | apache-2.0 | 1,104 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('api', '0065_auto_20150903_1853'),
]
operations = [
migrations.AlterField(
model_name='userpreferences',
... | dburr/SchoolIdolAPI | api/migrations/0066_auto_20150904_1837.py | Python | apache-2.0 | 593 |
# coding: utf-8
from __future__ import absolute_import
from datetime import date, datetime # noqa: F401
from typing import List, Dict # noqa: F401
from tapi_server.models.base_model_ import Model
from tapi_server.models.tapi_common_global_class import TapiCommonGlobalClass # noqa: F401,E501
from tapi_server.model... | karthik-sethuraman/ONFOpenTransport | RI/flask_server/tapi_server/models/tapi_path_computation_path_computation_service.py | Python | apache-2.0 | 12,039 |
# Copyright 2017 Google 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 to in writing, s... | tseaver/google-cloud-python | logging/google/cloud/logging/resource.py | Python | apache-2.0 | 1,749 |
"""
Example of downloading and processing SDSS spectra
--------------------------------------------------
This is the code used to create the files fetched by the routine
:func:`fetch_sdss_corrected_spectra`. Be aware that this routine
downloads a large amount of data (~700MB for 4000 spectra) and takes
a long time t... | nhuntwalker/astroML | examples/datasets/compute_sdss_pca.py | Python | bsd-2-clause | 4,610 |
class Link():
def __init__(self):
self.id = None
self.source = None
self.target = None
self.quality = None
self.type = None
class LinkConnector():
def __init__(self):
self.id = None
self.interface = None
def __repr__(self):
return "LinkConnector(%d, %s)" % (self.id, self.interfac... | ff-kbu/ffmap-backend | link.py | Python | bsd-3-clause | 323 |
import sys
sys.path.append('../..')
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import scoped_session, sessionmaker
import tornado.httpserver
import tornado.ioloop
import tornado.options
import tornado.web
from social.apps.tornado_app.models impor... | duoduo369/python-social-auth | examples/tornado_example/app.py | Python | bsd-3-clause | 1,886 |
# -*- coding: utf-8 -*-
#
# pcaspy documentation build configuration file, created by
# sphinx-quickstart on Sat Jan 12 21:59:30 2013.
#
# 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.
#
# All ... | dchabot/python-pcaspy | docs/source/conf.py | Python | bsd-3-clause | 8,478 |
import os
import sys
# In Python versions prior to 3.4, __file__ returns a relative path. This path
# is fixed at load time, so if the program later cd's (as we do in tests, at
# least) __file__ is no longer valid. As a workaround, compute the absolute
# path at load time.
MODULE_ROOT = os.path.abspath(os.path.dirnam... | enzochiau/peru | peru/compat.py | Python | mit | 964 |
import os
import pytest
import tarfile
from thefuck.rules.dirty_untar import match, get_new_command, side_effect
from tests.utils import Command
@pytest.fixture
def tar_error(tmpdir):
def fixture(filename):
path = os.path.join(str(tmpdir), filename)
def reset(path):
with tarfile.TarFi... | sekaiamber/thefuck | tests/rules/test_dirty_untar.py | Python | mit | 1,795 |
"""
This is the Implementation of the exciting I/O Functions
The functions are called with read write usunf the format "exi"
The module depends on lxml http://codespeak.net/lxml/
"""
from math import pi, cos, sin, sqrt, acos
import numpy as np
from ase.atoms import Atoms
from ase.parallel import paropen
from ase.un... | JConwayAWT/PGSS14CC | lib/python/multimetallics/ase/io/exciting.py | Python | gpl-2.0 | 4,598 |
# Copyright (C) 2013 Samsung Electronics. All rights reserved.
#
# Based on code from Chromium, copyright as follows:
#
# Copyright (c) 2013 The Chromium Authors. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditi... | loveyoupeng/rt | modules/web/src/main/native/Tools/Scripts/webkitpy/port/leakdetector_valgrind.py | Python | gpl-2.0 | 11,970 |
from boxbranding import getMachineBrand, getMachineName
from twisted.web import client
from twisted.internet import reactor, defer, ssl
class HTTPProgressDownloader(client.HTTPDownloader):
def __init__(self, url, outfile, headers=None):
client.HTTPDownloader.__init__(self, url, outfile, headers=headers, agent="En... | wetek-enigma/enigma2 | lib/python/Tools/Downloader.py | Python | gpl-2.0 | 2,228 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2017, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | nrwahl2/ansible | lib/ansible/modules/identity/ipa/ipa_group.py | Python | gpl-3.0 | 9,300 |
#!/usr/bin/python
# This file is part of Ansible
#
# Ansible 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 version.
#
# Ansible is distributed... | bjolivot/ansible | lib/ansible/modules/cloud/amazon/cloudformation.py | Python | gpl-3.0 | 19,635 |
#!/usr/bin/env python2
# vim:fileencoding=utf-8
from __future__ import (unicode_literals, division, absolute_import,
print_function)
__license__ = 'GPL v3'
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
import os
from collections import defaultdict
from urlparse import urlparse
... | jeanlinux/calibre | src/calibre/ebooks/oeb/polish/check/links.py | Python | gpl-3.0 | 16,909 |
"""Provides competition settings in the request context to be used within a template."""
from django.utils import importlib
import re
from apps.managers.challenge_mgr import challenge_mgr
from apps.managers.player_mgr.models import Profile
from apps.managers.score_mgr import score_mgr
from apps.managers.team_mgr.models... | justintweaver/mtchi-cert-game | makahiki/apps/managers/challenge_mgr/context_processors.py | Python | gpl-3.0 | 4,203 |
# Copyright (C) 2014-2020 ycmd contributors
#
# This file is part of ycmd.
#
# ycmd 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 version.
#
#... | puremourning/ycmd-1 | ycmd/hmac_plugin.py | Python | gpl-3.0 | 3,092 |
##
## This file is part of the libsigrokdecode project.
##
## Copyright (C) 2019-2020 Benjamin Vernoux <bvernoux@gmail.com>
##
## 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... | DreamSourceLab/DSView | libsigrokdecode4DSL/decoders/st25r39xx_spi/pd.py | Python | gpl-3.0 | 14,342 |
from bs4 import BeautifulSoup
from couchpotato.core.logger import CPLog
from couchpotato.core.providers.automation.base import Automation
log = CPLog(__name__)
class Goodfilms(Automation):
url = 'https://goodfil.ms/%s/queue?page=%d&without_layout=1'
interval = 1800
def getIMDBids(self):
if no... | entomb/CouchPotatoServer | couchpotato/core/providers/automation/goodfilms/main.py | Python | gpl-3.0 | 1,368 |
from django.conf.urls import patterns, url
from . import views
urlpatterns = patterns('',
url(r'^persona/signin$', views.persona_login, name="persona_login"),
url(r'^persona/complete$', views.persona_complete, name="persona_complete"),
url(r'^persona/csrf$', views.persona_csrf, name="persona_csrf_token"),... | mastizada/kuma | kuma/users/providers/persona/urls.py | Python | mpl-2.0 | 323 |
"""
instabot example
Workflow:
Follow user's following by username.
"""
import sys
import os
import time
import random
from tqdm import tqdm
import argparse
sys.path.append(os.path.join(sys.path[0], '../'))
from instabot import Bot
parser = argparse.ArgumentParser(add_help=True)
parser.add_argument(... | vkgrd/instabot | examples/follow_user_following.py | Python | apache-2.0 | 700 |
from nose.tools import *
from tests.base import ApiTestCase
from tests.factories import InstitutionFactory, AuthUserFactory, RegistrationFactory
from framework.auth import Auth
from api.base.settings.defaults import API_BASE
class TestInstitutionRegistrationList(ApiTestCase):
def setUp(self):
super(TestI... | brandonPurvis/osf.io | api_tests/institutions/views/test_institution_registrations_list.py | Python | apache-2.0 | 2,377 |
# -*- 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
... | KL-WLCR/incubator-airflow | airflow/contrib/operators/dataproc_operator.py | Python | apache-2.0 | 38,650 |
#!/usr/bin/python
#
# Licensed to the Software Freedom Conservancy (SFC) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The SFC licenses this file
# to you under the Apache License, Version 2.0 (the
# "Li... | denis-vilyuzhanin/selenium-fastview | py/selenium/webdriver/common/alert.py | Python | apache-2.0 | 2,514 |
# Copyright 2016 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... | benoitsteiner/tensorflow-opencl | tensorflow/contrib/cudnn_rnn/python/kernel_tests/cudnn_rnn_test.py | Python | apache-2.0 | 38,648 |
#!/usr/bin/env python
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this... | usc-isi/essex-baremetal-support | nova/testing/runner.py | Python | apache-2.0 | 13,227 |
__author__ = 'frank'
import threading
import functools
import traceback
import log
logger = log.get_logger(__name__)
tlocal = threading.local()
tlocal.rollback_structs = []
def rollbackable(func):
@functools.wraps(func)
def wrap(*args, **kwargs):
if not hasattr(tlocal, 'rollback_structs'):
... | zstackorg/zstack-utility | zstacklib/zstacklib/utils/rollback.py | Python | apache-2.0 | 1,209 |
"""Tests for tensorflow.ops.nn_ops.Pad."""
import tensorflow.python.platform
import numpy as np
import tensorflow as tf
from tensorflow.python.kernel_tests import gradient_checker as gc
class PadOpTest(tf.test.TestCase):
def _npPad(self, inp, paddings):
return np.pad(inp, paddings, mode="constant")
def t... | rickyHong/Tensorflow_modi | tensorflow/python/kernel_tests/pad_op_test.py | Python | apache-2.0 | 4,594 |
# Copyright 2009-2015 Eucalyptus Systems, Inc.
#
# Redistribution and use of this software 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 ... | jhajek/euca2ools | euca2ools/commands/iam/addusertogroup.py | Python | bsd-2-clause | 1,742 |
# -*- coding: utf-8 -*-
# Copyright (c) 2010, Almar Klein
#
# Visvis is distributed under the terms of the (new) BSD License.
# The full license can be found in 'license.txt'.
""" SCRIPT
Pack all font data in a single ssdf file.
Use the free command line tool BMFontGenerator to generate a .png
file with the characte... | Alwnikrotikz/visvis.dev | fonts/pack.py | Python | bsd-3-clause | 4,996 |
# flake8: noqa
"""
========================================
Release Highlights for scikit-learn 0.24
========================================
.. currentmodule:: sklearn
We are pleased to announce the release of scikit-learn 0.24! Many bug fixes
and improvements were added, as well as some new key features. We detail
... | manhhomienbienthuy/scikit-learn | examples/release_highlights/plot_release_highlights_0_24_0.py | Python | bsd-3-clause | 11,288 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
from knesset.utils import slugify_name
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Bill.slug'
db.add_column('laws_bill', 'slug', sel... | alonisser/Open-Knesset | laws/migrations/0018_auto__add_field_bill_slug__add_field_bill_popular_name_slug.py | Python | bsd-3-clause | 27,638 |
#!/usr/bin/python
import sys
import numpy as np
import irtk
full_file = sys.argv[1]
cropped_file = sys.argv[2]
full_img = irtk.imread( full_file, dtype='float32' )
cropped_img = irtk.imread( cropped_file, dtype='float32' )
(z,y,x), score = irtk.match_template( full_img, cropped_img, pad_input=False )
print score
... | BioMedIA/irtk-legacy | wrapping/cython/scripts/find_template.py | Python | bsd-3-clause | 554 |
"""Schema v5
Revision ID: 83e4121b299
Revises: 7c315088952
Create Date: 2015-08-21
"""
# revision identifiers, used by Alembic.
revision = '83e4121b299'
down_revision = '7c315088952'
import os
import sys
sys.path.insert(1, os.path.abspath(os.path.join(os.path.dirname(__file__), *['..'] * 5)))
from alembic import o... | securestate/king-phisher | data/server/king_phisher/alembic/versions/83e4121b299_schema_v5.py | Python | bsd-3-clause | 951 |
# -*- coding: utf-8 -*-
"""
jinja2.testsuite.filters
~~~~~~~~~~~~~~~~~~~~~~~~
Tests for the jinja filters.
:copyright: (c) 2010 by the Jinja Team.
:license: BSD, see LICENSE for more details.
"""
import unittest
from jinja2.testsuite import JinjaTestCase
from jinja2 import Markup, Environment
en... | Apreche/Presentoh | utils/jinja2/testsuite/filters.py | Python | mit | 10,544 |
import os
from oeqa.oetest import oeRuntimeTest, skipModule
from oeqa.utils.decorators import skipUnlessPassed, testcase
def setUpModule():
if not (oeRuntimeTest.hasPackage("dropbear") or oeRuntimeTest.hasPackage("openssh-sshd")):
skipModule("No ssh package in image")
class ScpTest(oeRuntimeTest):
@t... | wwright2/dcim3-angstrom1 | sources/openembedded-core/meta/lib/oeqa/runtime/scp.py | Python | mit | 990 |
"""Test utils for autocompletes."""
| luzfcb/django-autocomplete-light | src/dal/test/__init__.py | Python | mit | 36 |
"""Generated client library for clouddebugger version v2."""
# NOTE: This file is autogenerated and should not be edited by hand.
from apitools.base.py import base_api
from googlecloudsdk.third_party.apis.clouddebugger.v2 import clouddebugger_v2_messages as messages
class ClouddebuggerV2(base_api.BaseApiClient):
""... | Sorsly/subtle | google-cloud-sdk/lib/googlecloudsdk/third_party/apis/clouddebugger/v2/clouddebugger_v2_client.py | Python | mit | 13,844 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016 Red Hat, Inc.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUME... | kustodian/ansible | lib/ansible/modules/cloud/ovirt/ovirt_disk.py | Python | gpl-3.0 | 33,148 |
#!/bin/env python
# coding=utf-8
"""Extract and tag References from a PDF.
Created on Mar 1, 2010
@author: John Harrison
Usage: references.py OPTIONS FILEPATH
OPTIONS:
-h, --help Print help and exit
-t, --test Carry out unit tests on RegEx reference tagging
--noxml Do not tag individual references, an... | leoman6/pdfssa4met | references.py | Python | gpl-3.0 | 8,842 |
###################################################################################################
# Author: Jodi Jones <venom@gen-x.co.nz>
# URL: https://github.com/VeNoMouS/Sick-Beard
#
# This file is part of Sick Beard.
#
# Sick Beard is free software: you can redistribute it and/or modify
# it under the terms of t... | rui-castro/Sick-Beard | sickbeard/providers/torrentshack.py | Python | gpl-3.0 | 11,460 |
import unittest
import os
import sys
from django.conf import settings
from south.hacks import hacks
# Add the tests directory so fakeapp is on sys.path
test_root = os.path.dirname(__file__)
sys.path.append(test_root)
# Note: the individual test files are imported below this.
class Monkeypatcher(unittest.TestCase):
... | garnermccloud/OLD_DJANGO | south/tests/__init__.py | Python | apache-2.0 | 1,493 |
__all__ = ['process_from_web']
import io
import pandas
import logging
import requests
from .processor import TrrustProcessor
trrust_human_url = 'https://www.grnpedia.org/trrust/data/trrust_rawdata' \
'.human.tsv'
logger = logging.getLogger(__name__)
def process_from_web():
"""Return a Trr... | johnbachman/indra | indra/sources/trrust/api.py | Python | bsd-2-clause | 784 |
"""
Base class for all Direct Gui items. Handles composite widgets and
command line argument parsing.
Code Overview:
1 Each widget defines a set of options (optiondefs) as a list of tuples
of the form ('name', defaultValue, handler).
'name' is the name of the option (used during construction of configure)
... | chandler14362/panda3d | direct/src/gui/DirectGuiBase.py | Python | bsd-3-clause | 46,144 |
#!/usr/bin/env python
#
# Copyright (c) 2014, 2016 ARM Limited
# All rights reserved
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware impleme... | yohanko88/gem5-DC | util/style/verifiers.py | Python | bsd-3-clause | 15,502 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import datetime
class Migration(migrations.Migration):
dependencies = [
('proposals', '0011_auto_20150530_0224'),
]
operations = [
migrations.AddField(
model_name='propos... | farhaanbukhsh/junction | junction/proposals/migrations/0012_auto_20150709_0842.py | Python | mit | 747 |
#!/usr/bin/python2.4
"""Diff Match and Patch
Copyright 2006 Google Inc.
http://code.google.com/p/google-diff-match-patch/
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... | lemonad/methodiki | methodiki/third_party/google_diff_match_patch/diff_match_patch.py | Python | mit | 66,410 |
"""
This file is part of the web2py Web Framework
Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu>
License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
Utility functions for the Admin application
===========================================
"""
import os
import sys
import traceback
import zipfile
import ur... | pouyana/teireader | webui/gluon/admin.py | Python | mit | 13,438 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# This file is part of IRIS: Infrastructure and Release Information System
#
# Copyright (C) 2013-2015 Intel Corporation
#
# IRIS is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# version 2.0 as published by t... | liverbirdkte/iris-panel | bin/import_scm.py | Python | gpl-2.0 | 1,529 |
#############################################################################
##
## Copyright (C) 2017 Riverbank Computing Limited.
## Copyright (C) 2006 Thorsten Marek.
## All right reserved.
##
## This file is part of PyQt.
##
## You may use this file under the terms of the GPL v2 or the revised BSD
## license as fol... | baoboa/pyqt5 | pyuic/uic/exceptions.py | Python | gpl-3.0 | 2,279 |
import os
import ycm_core
flags = [
'-Wall',
'-std=gnu99',
'-x',
'c',
'-isystem',
'/usr/include',
'-isystem',
'/usr/local/include',
'-Isrc',
'-I3rd/c-ares',
'-I3rd/libuv/include',
'-I3rd/libsodium/src/libsodium/include',
]
compilation_database_folder = ''
if os.path.exists( compilation_database_folder ):
database... | sutun2008/xsocks | .ycm_extra_conf.py | Python | gpl-3.0 | 2,932 |
# 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/.
import os
import cgi
import json
import pkg_resources
import base64
import marionette.runner.mixins
from collections imp... | mozilla-b2g/fxos-certsuite | mcts/utils/report/summary.py | Python | mpl-2.0 | 7,028 |
# -*- coding: utf-8 -*-
# Copyright 2015-2017 Onestein (<http://www.onestein.eu>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import fields, models
class AccountMoveLine(models.Model):
_inherit = 'account.move.line'
cost_center_id = fields.Many2one(
'account.cos... | Domatix/account-financial-tools | account_cost_center/models/account_move_line.py | Python | agpl-3.0 | 386 |
"""Config flow for Minut Point."""
import asyncio
from collections import OrderedDict
import logging
import async_timeout
from pypoint import PointSession
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.components.http import HomeAssistantView
from homeassistant.const import CONF_... | tchellomello/home-assistant | homeassistant/components/point/config_flow.py | Python | apache-2.0 | 6,020 |
#!/usr/bin/env python
PRIMARY_OS = 'Ubuntu-14.04'
PRIMARY = '''#!/bin/sh
#
FQDN="{fqdn}"
# /etc/hostname - /etc/hosts
sed -i "1 c\\127.0.0.1 $FQDN localhost" /etc/hosts
echo $FQDN > /etc/hostname
service hostname restart
sleep 5
{dinfo}
'''
def pre_process():
"""Anything added to this function is executed befor... | superseb/train | train/labs/base/scripts/ubuntu.py | Python | apache-2.0 | 472 |
# Copyright 2013 10gen Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | danbao/mongo-web-shell | mongows/validators/ValidationTest.py | Python | apache-2.0 | 2,871 |
"""lispify_ast - returns a tuple representation of the AST
Uses 2.5's _ast, not other AST implementations in CPython, since these
are not used by the compilation phase. And that's what we're
interested in.
Since this is a tuple, we can directly compare, and this is going to
be handy when comparing Jython's implementa... | tunneln/CarnotKE | jyhton/ast/jastlib.py | Python | apache-2.0 | 1,895 |
from __future__ import print_function
import os
import re
import sys
import subprocess
import tempfile
from subprocutils import check_output, which, CalledProcessError
class EmptyTempFile(object):
def __init__(self, prefix=None, dir=None, closed=True):
self.file, self.name = tempfile.mkstemp(prefix=pref... | daedric/buck | programs/buck_version.py | Python | apache-2.0 | 3,359 |
#!/usr/bin/python
# Script to compare testsuite failures against a list of known-to-fail
# tests.
# Contributed by Diego Novillo <dnovillo@google.com>
#
# Copyright (C) 2011 Free Software Foundation, Inc.
#
# This file is part of GCC.
#
# GCC is free software; you can redistribute it and/or modify
# it under the term... | the-linix-project/linix-kernel-source | gccsrc/gcc-4.7.2/contrib/testsuite-management/validate_failures.py | Python | bsd-2-clause | 10,915 |
from sympy import symbols
from sympy.physics.mechanics import *
q1, q2 = dynamicsymbols('q1 q2')
q1d, q2d = dynamicsymbols('q1 q2', 1)
u1, u2 = dynamicsymbols('u1 u2')
u1d, u2d = dynamicsymbols('u1 u2', 1)
l, m, g = symbols('l m g')
N = ReferenceFrame('N')
A = N.orientnew('A', 'Axis', [q1, N.z])
B = N.orientnew('B', ... | Shekharrajak/pydy | examples/double_pendulum/double_pendulum.py | Python | bsd-3-clause | 961 |
# class generated by DeVIDE::createDeVIDEModuleFromVTKObject
from module_kits.vtk_kit.mixins import SimpleVTKClassModuleBase
import vtk
class vtkPDBReader(SimpleVTKClassModuleBase):
def __init__(self, module_manager):
SimpleVTKClassModuleBase.__init__(
self, module_manager,
vtk.vtkP... | nagyistoce/devide | modules/vtk_basic/vtkPDBReader.py | Python | bsd-3-clause | 464 |
# -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
from __future__ import unicode_literals
from builtins import str, bytes
import os
import numpy as np
import pytest
from nipype.testing.fixtures import create_files_in_directory
im... | mick-d/nipype | nipype/interfaces/spm/tests/test_base.py | Python | bsd-3-clause | 5,419 |