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 |
|---|---|---|---|---|---|
from functools import wraps
from typing import Any, Callable, Dict, Mapping, Set, Tuple, Union, cast
from django.http import HttpRequest, HttpResponse
from django.urls import path
from django.urls.resolvers import URLPattern
from django.utils.cache import add_never_cache_headers
from django.views.decorators.csrf impor... | punchagan/zulip | zerver/lib/rest.py | Python | apache-2.0 | 7,852 |
# Copyright (C) 2015 Yahoo! Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | NeCTAR-RC/horizon | openstack_dashboard/dashboards/identity/identity_providers/protocols/views.py | Python | apache-2.0 | 1,718 |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# Copyright (c) 2010 Citrix Systems, Inc.
# Copyright (c) 2011 Piston Cloud Computing, Inc
# Copyright (c) 2012 University Of Minho
# (c) Copyright 2013 Hewlett-Pa... | apporc/nova | nova/virt/libvirt/host.py | Python | apache-2.0 | 37,673 |
from rima.controllers import BaseController
from models.user import UserModel
class UserController(BaseController):
"""
User Controller Class.
"""
model = UserModel | farirat/rima | examples/api/controllers/user.py | Python | apache-2.0 | 187 |
"""Support for Freedompro binary_sensor."""
from homeassistant.components.binary_sensor import (
DEVICE_CLASS_MOTION,
DEVICE_CLASS_OCCUPANCY,
DEVICE_CLASS_OPENING,
DEVICE_CLASS_SMOKE,
BinarySensorEntity,
)
from homeassistant.core import callback
from homeassistant.helpers.entity import DeviceInfo
fr... | jawilson/home-assistant | homeassistant/components/freedompro/binary_sensor.py | Python | apache-2.0 | 2,578 |
name = "hello_world"
version = "1.0.0"
authors = [
"ajohns"
]
description = \
"""
Python-based hello world example package.
"""
tools = [
"hello"
]
requires = [
"python"
]
uuid = "examples.hello_world_py"
build_command = 'python {root}/build.py {install}'
def commands():
env.PYTHONPA... | nerdvegas/rez | example_packages/hello_world/package.py | Python | apache-2.0 | 381 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2012 Quang-Cuong Pham <cuong.pham@normalesup.org>
#
# 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... | Tastalian/avp-rrt-rss-2013 | vippy/MintimeTrajectory.py | Python | apache-2.0 | 11,341 |
# Copyright 2016 The Kubernetes Authors.
#
# 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 ... | shashidharatd/test-infra | gubernator/view_pr.py | Python | apache-2.0 | 8,659 |
#!/usr/bin/python3
#
# Copyright (c) 2020 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os
import sys
import time
import subprocess
import mmap
# Log reader for the trace output buffer on a ADSP device.
#
# When run with no arguments, it will detect the device, dump the
# contents of the trace buffer... | nashif/zephyr | boards/xtensa/intel_adsp_cavs15/tools/adsplog.py | Python | apache-2.0 | 8,018 |
# -*- coding: utf-8 -*-
from copy import deepcopy
import pytest
import yaml
from awx.main.utils.safe_yaml import safe_dump
@pytest.mark.parametrize('value', [None, 1, 1.5, []])
def test_native_types(value):
# Native non-string types should dump the same way that `yaml.safe_dump` does
assert safe_dump(value) ... | GoogleCloudPlatform/sap-deployment-automation | third_party/github.com/ansible/awx/awx/main/tests/unit/utils/test_safe_yaml.py | Python | apache-2.0 | 2,424 |
"""
Proposal Target Operator selects foreground and background roi and assigns label, bbox_transform to them.
"""
from __future__ import print_function
import mxnet as mx
import numpy as np
from distutils.util import strtobool
from rcnn.io.rcnn import sample_rois
DEBUG = False
class ProposalTargetOperator(mx.opera... | likelyzhao/mxnet | example/rcnn/rcnn/symbol/proposal_target.py | Python | apache-2.0 | 3,893 |
# 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... | krummas/cassandra | pylib/cqlshlib/test/run_cqlsh.py | Python | apache-2.0 | 12,156 |
#!/usr/bin/env python
#
# Copyright 2013 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 requir... | iLotus/googleads-adsensehost-examples | django-quickstart/blog/association.py | Python | apache-2.0 | 1,452 |
#!/usr/bin/env python
'''
Interpolates high level financials using basic accounting identities when
those tags are not made explicit in a given xbrl filing
** Note **
This runs prospectively each day after new xbrl filings are downloaded,
parsed and ingested
'''
import argparse
import json
import... | gophronesis/ernest | enrich/modules/xbrl_rss_interpolation.py | Python | apache-2.0 | 4,847 |
"""
This modules provides various functions for operating on files.
Functions:
copy_files: Copy file(s) to a specified location.
"""
import subprocess
def copy_files(files: list, destination: str):
"""
Copy files to a given destination.
Args:
files: A list of files to copy.
destinat... | bigfatpanda-training/pandas-practical-python-primer | training/level-2-command-line-interfaces/bfp-reference/exercise_09/file_ops.py | Python | artistic-2.0 | 612 |
from django.conf.urls import patterns, include, url
import example.views
urlpatterns = patterns('',
url(r'^$', example.views.formset_view),
)
| pretix/django-formset-js | example/example/urls.py | Python | bsd-2-clause | 147 |
from __future__ import unicode_literals
__VERSION__ = '0.1.1'
| dvdmgl/django-pg-fts | pg_fts/__init__.py | Python | bsd-2-clause | 63 |
from datetime import datetime
from NetCatKS.Logger import Logger
from NetCatKS.Components import BaseRootAPI
class Time(BaseRootAPI):
def __init__(self, factory):
super(Time, self).__init__(factory)
self.factory = factory
self.logger = Logger()
def process_factory(self):
... | dimddev/NetCatKS | examples/projects/rootapis/web_time_server/components/adapters/time/__init__.py | Python | bsd-2-clause | 587 |
import os
import asyncio
import tests
class TestGithubApi(tests.GithubMix, tests.AgileTest):
def test_url(self):
repo = self.repo
self.assertTrue(repo.api_url)
self.assertEqual(repo.api_url,
'%s/repos/%s' % (self.github.api_url, tests.REPO))
self.assertEq... | quantmind/pulsar-agile | tests/test_githubapi.py | Python | bsd-3-clause | 2,024 |
# coding: utf-8
"""
tinycss.decoding
----------------
Decoding stylesheets from bytes to Unicode.
http://www.w3.org/TR/CSS21/syndata.html#charset
:copyright: (c) 2012 by Simon Sapin.
:license: BSD, see LICENSE for more details.
"""
from __future__ import unicode_literals
import operator
impo... | SimonSapin/tinycss | tinycss/decoding.py | Python | bsd-3-clause | 9,175 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Court',
fields=[
('id', models.AutoField(verbos... | khansrk/khanadvocates | advocates/migrations/0001_initial.py | Python | bsd-3-clause | 1,766 |
from .taxii.exceptions import UnauthorizedStatus
class UnauthorizedException(UnauthorizedStatus):
pass
class InvalidAuthHeader(Exception):
pass
| Intelworks/OpenTAXII | opentaxii/exceptions.py | Python | bsd-3-clause | 157 |
#
# Author: Travis Oliphant 2002-2011 with contributions from
# SciPy Developers 2004-2011
#
from scipy._lib._util import getfullargspec_no_self as _getfullargspec
import sys
import keyword
import re
import types
import warnings
from itertools import zip_longest
from scipy._lib import doccer
from ._distr_p... | aeklant/scipy | scipy/stats/_distn_infrastructure.py | Python | bsd-3-clause | 127,400 |
# ----------------------------------------------------------------------------
# Copyright (c) 2016-2017, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... | jairideout/docs | source/sphinx_extensions/plugin_directory/__init__.py | Python | bsd-3-clause | 400 |
import imghdr
from wsgiref.util import FileWrapper
from django.core.exceptions import ImproperlyConfigured, PermissionDenied
from django.http import (
HttpResponse,
HttpResponsePermanentRedirect,
StreamingHttpResponse,
)
from django.shortcuts import get_object_or_404
from django.urls import reverse
from dj... | wagtail/wagtail | wagtail/images/views/serve.py | Python | bsd-3-clause | 2,857 |
#!/usr/bin/env python
"""
Converting a file tree into partitioned, space-controlled TAR files.
This module attempts to address the following problems:
* Storing individual small files can be very time consuming because of
per-file overhead.
* It is desirable to maintain UNIX metadata on a file, and that's not
al... | modulexcite/wal-e | wal_e/tar_partition.py | Python | bsd-3-clause | 19,584 |
#
# Eric Jeschke (eric@naoj.org)
#
# Copyright (c) Eric R. Jeschke. All rights reserved.
# This is open-source software licensed under a BSD license.
# Please see the file LICENSE.txt for details.
#
import threading
class TimeoutError(Exception):
pass
class Datasrc(object):
def __init__(self, length=0):
... | sosey/ginga | ginga/misc/Datasrc.py | Python | bsd-3-clause | 3,565 |
from app import db
from app import app
from config import WHOOSH_ENABLED
import requests, json, re
import sys
if sys.version_info >= (3, 0):
enable_search = False
else:
enable_search = WHOOSH_ENABLED
if enable_search:
import flask.ext.whooshalchemy as whooshalchemy
followers = db.Table('followers'... | Akelio-zhang/sxk-microblog | app/models.py | Python | bsd-3-clause | 3,738 |
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Windows constants for IOCP
"""
# this stuff should really be gotten from Windows headers via pyrex, but it
# probably is not going to change
ERROR_PORT_UNREACHABLE = 1234
ERROR_NETWORK_UNREACHABLE = 1231
ERROR_CONNECTION_REFU... | hlzz/dotfiles | graphics/VTK-7.0.0/ThirdParty/Twisted/twisted/internet/iocpreactor/const.py | Python | bsd-3-clause | 550 |
#!/usr/bin/env python
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (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.mozil... | AdrianGaudebert/configman | demo/demo3.py | Python | bsd-3-clause | 4,683 |
from __future__ import absolute_import, division, print_function
from functools import partial, wraps
from itertools import product, repeat
from math import factorial, log, ceil
import operator
import numpy as np
from toolz import compose, partition_all, merge, get, accumulate, pluck
from . import chunk
from .core i... | cowlicks/dask | dask/array/reductions.py | Python | bsd-3-clause | 22,730 |
"""
Anscombe's quartet
==================
_thumb: .4, .4
"""
import seaborn as sns
sns.set_theme(style="ticks")
# Load the example dataset for Anscombe's quartet
df = sns.load_dataset("anscombe")
# Show the results of a linear regression within each dataset
sns.lmplot(x="x", y="y", col="dataset", hue="dataset", data... | mwaskom/seaborn | examples/anscombes_quartet.py | Python | bsd-3-clause | 430 |
# -*- test-case-name: twisted.words.test -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
MSNP8 Protocol (client only) - semi-experimental
This module provides support for clients using the MSN Protocol (MSNP8).
There are basically 3 servers involved in any MSN session:
I{Dis... | hlzz/dotfiles | graphics/VTK-7.0.0/ThirdParty/Twisted/twisted/words/protocols/msn.py | Python | bsd-3-clause | 91,486 |
"""Tests for tools for solving inequalities and systems of inequalities. """
from sympy import (And, Eq, FiniteSet, Ge, Gt, Interval, Le, Lt, Ne, oo,
Or, S, sin, sqrt, Symbol, Union, Integral, Sum,
Function, Poly, PurePoly, pi, root)
from sympy.solvers.inequalities import (reduce_... | mcdaniel67/sympy | sympy/solvers/tests/test_inequalities.py | Python | bsd-3-clause | 13,455 |
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import httplib
import json
import logging
import pprint
import re
import socket
import sys
import urllib2
from telemetry import decorators
from telemetry.co... | patrickm/chromium.src | tools/telemetry/telemetry/core/backends/chrome/chrome_browser_backend.py | Python | bsd-3-clause | 12,542 |
from couchdbkit import ResourceNotFound
from corehq.apps.fixtures.exceptions import FixtureUploadError, ExcelMalformatException, \
DuplicateFixtureTagException, FixtureAPIException
from django.core.validators import ValidationError
from django.utils.translation import ugettext as _, ugettext_noop
from corehq.apps.f... | puttarajubr/commcare-hq | corehq/apps/fixtures/upload.py | Python | bsd-3-clause | 19,677 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-06-02 16:10
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('lowfat', '0020_auto_20160602_1607'),
]
operations = [
migrations.AddField(
... | softwaresaved/fat | lowfat/migrations/0021_blog_status.py | Python | bsd-3-clause | 627 |
from modeltranslation.translator import translator, TranslationOptions
from tos.models import TermsOfService
# Translations for django-tos
class TermsOfServiceTranslationOptions(TranslationOptions):
fields = ('content', )
translator.register(TermsOfService, TermsOfServiceTranslationOptions)
| cypreess/django-tos | tos_i18n/translation.py | Python | bsd-3-clause | 299 |
"""
Functions in the ``as*array`` family that promote array-likes into arrays.
`require` fits this category despite its name not matching this pattern.
"""
from .overrides import (
array_function_dispatch,
set_array_function_like_doc,
set_module,
)
from .multiarray import array
__all__ = [
"asarray",... | grlee77/numpy | numpy/core/_asarray.py | Python | bsd-3-clause | 12,184 |
from __future__ import absolute_import
from collections import defaultdict
from datetime import datetime, timedelta
from time import time
from django.db import transaction
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from celery import states
from celery.events.state import ... | mozilla/firefox-flicks | vendor-local/lib/python/djcelery/snapshot.py | Python | bsd-3-clause | 5,591 |
"""
Defines errors thrown by this package.
"""
class WeldError(RuntimeError):
"""
An error raised by Weld.
All Weld compilation and runtime errors are converted to a `WeldError`.
"""
pass
| sppalkia/weld | weld-python/weld/error.py | Python | bsd-3-clause | 210 |
#!/usr/bin/env python
import vtk
from vtk.test import Testing
from vtk.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()
# create pipeline
#
reader = vtk.vtkDataSetReader()
reader.SetFileName(VTK_DATA_ROOT + "/Data/RectGrid2.vtk")
reader.Update()
warper = vtk.vtkWarpVector()
warper.SetInpu... | hlzz/dotfiles | graphics/VTK-7.0.0/Filters/General/Testing/Python/WarpVectorImage.py | Python | bsd-3-clause | 1,372 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
import argparse
from cocoprep.archive_load_data import get_file_name_list, parse_archive_file_name, get_key_value, parse_range
from cocoprep.archive_exceptions import PreprocessingException, PreprocessingWarning... | PyQuake/earthquakemodels | code/cocobbob/coco/code-preprocessing/archive-update/extract_extremes.py | Python | bsd-3-clause | 4,277 |
import io
import tempfile
from pathlib import Path
import pytest
from bioc import BioCFileType
from bioc.biocjson.encoder import toJSON
import bioc
from bioc.biocjson import BioCJsonIterWriter
from tests.utils import assert_everything
file = Path(__file__).parent / 'everything.json'
def test_dump():
with open... | yfpeng/pengyifan-pybioc | tests/bioc/test_json_encoder.py | Python | bsd-3-clause | 1,888 |
from sympy import S, Integral, sin, cos, pi, sqrt, symbols
from sympy.physics.mechanics import (Dyadic, Particle, Point, ReferenceFrame,
RigidBody, Vector)
from sympy.physics.mechanics import (angular_momentum, dynamicsymbols,
inertia, inertia_of... | wdv4758h/ZipPy | edu.uci.python.benchmark/src/benchmarks/sympy/sympy/physics/mechanics/tests/test_functions.py | Python | bsd-3-clause | 5,068 |
#The MIT License (MIT)
#Copyright (c) 2015-2016 mh4x0f P0cL4bs Team
#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, mo... | samyoyo/3vilTwinAttacker | Modules/ModuleProbeRequest.py | Python | mit | 4,383 |
# Script Name : main.py
# Author : Shy Ruparel
# Created : September 8 2015
# Pulls in data from "data.csv" which is 2 columns wide
# Uses a base image as the background
# Uses the data - school name, and venue address -
# and prints onto the base image
# and saves every image as a .PNG
fro... | niespodd/flyer_generator | main.py | Python | mit | 2,191 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import os, time
from cutout import cutout
datastr = '''
<html>
<head>
<title>html网页标题</title>
</head>
<body>
<ul id="img">
<li> <p>pic1</p> <img src="/img/pic1.jpg" /> </li>
<li> <p>pic... | yangjiePro/cutout | example.py | Python | mit | 4,408 |
#
# Copyright (c) 2001 - 2014 The SCons Foundation
#
# 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... | dezelin/scons | scons-local/SCons/Tool/MSCommon/netframework.py | Python | mit | 2,754 |
import marshal
import os
import subprocess
import urlparse
import dxr.plugins
"""Omniglot - Speaking all commonly-used version control systems.
At present, this plugin is still under development, so not all features are
fully implemented.
Omniglot first scans the project directory looking for the hallmarks of a VCS
... | nrc/dxr | dxr/plugins/omniglot/htmlifier.py | Python | mit | 10,987 |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | yugangw-msft/azure-cli | src/azure-cli/azure/cli/command_modules/resource/parameters.py | Python | mit | 474 |
try:
import unittest2 as unittest
except:
import unittest
import ctypes
from ctypes import create_string_buffer
import settings
import socket
import sys
@unittest.skipUnless(sys.platform.startswith("win"), "requires Windows")
class SspiTest(unittest.TestCase):
def test_enum_security_packages(self):
... | tpow/pytds | tests/sspi_test.py | Python | mit | 3,151 |
from mitmproxy.addons import anticache
from mitmproxy.addons import anticomp
from mitmproxy.addons import block
from mitmproxy.addons import browser
from mitmproxy.addons import check_ca
from mitmproxy.addons import clientplayback
from mitmproxy.addons import core
from mitmproxy.addons import cut
from mitmproxy.addons ... | zlorb/mitmproxy | mitmproxy/addons/__init__.py | Python | mit | 1,495 |
# -*- coding: utf-8 -*-
# Copyright © 2012-2014 Roberto Alsina and others.
# 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 t... | pluser/nikola_plugins | v7/less/less.py | Python | mit | 4,899 |
from test.parser.pattern.nodes.base import PatternTestBaseClass
from programy.parser.exceptions import ParserException
from programy.parser.pattern.nodes.topic import PatternTopicNode
from programy.parser.pattern.nodes.root import PatternRootNode
class PatternTopicNodeTests(PatternTestBaseClass):
def test_init(s... | dkamotsky/program-y | src/test/parser/pattern/nodes/test_topic.py | Python | mit | 1,693 |
# Natural Language Toolkit: SemCor Corpus Reader
#
# Copyright (C) 2001-2015 NLTK Project
# Author: Nathan Schneider <nschneid@cs.cmu.edu>
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
"""
Corpus reader for the SemCor Corpus.
"""
from __future__ import absolute_import, unicode_literals... | MyRookie/SentimentAnalyse | venv/lib/python2.7/site-packages/nltk/corpus/reader/semcor.py | Python | mit | 11,106 |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsVectorFileWriter.
.. note:: 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.
"... | pblottiere/QGIS | tests/src/python/test_qgsvectorfilewriter.py | Python | gpl-2.0 | 61,172 |
#!/usr/bin/python2
# Client code for Update Agent
# Copyright (c) 1999--2018 Red Hat, Inc. Distributed under GPLv2.
#
# Author: Adrian Likins <alikins@redhat.com
#
import os
__rhnexport__ = [
'reboot']
from up2date_client import up2dateLog
from up2date_client import config
cfg = config.initUp2dateConfig()
log... | mcalmer/spacewalk | client/rhel/rhn-client-tools/src/actions/reboot.py | Python | gpl-2.0 | 1,358 |
# anaconda: The Red Hat Linux Installation program
#
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
# Red Hat, Inc. All rights reserved.
#
# 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 Softw... | kparal/anaconda | pyanaconda/anaconda.py | Python | gpl-2.0 | 9,570 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import string, xbmc, xbmcgui, xbmcplugin, xbmcaddon, os, sys, urllib, urllib2, cookielib, time, codecs, datetime, re
import socket
import sqlite3 as db
from BeautifulSoup import BeautifulSoup, BeautifulStoneSoup
import calendar
socket.setdefaulttimeout(35000)
PLUGIN_NAME =... | sshnaidm/ru | script.module.YaTv/lib/YaTv.py | Python | gpl-2.0 | 65,597 |
# -*- coding: utf-8 -*-
## This file is part of Invenio.
## Copyright (C) 2012, 2013 CERN.
##
## Invenio 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... | lnielsen/invenio | invenio/ext/babel/selectors.py | Python | gpl-2.0 | 2,593 |
from __future__ import print_function
import psi4
from psi4.driver import qcdb
#! A test of the basis specification. Various basis sets are specified outright and in blocks, both
#! orbital and auxiliary. Constructs libmints BasisSet objects through the constructor that calls
#! qcdb.BasisSet infrastructure. Checks th... | kratman/psi4public | tests/python/mints9/input.py | Python | gpl-2.0 | 8,970 |
# -*- mode: python; coding: utf-8; -*-
#
# This file is part of Invenio.
# Copyright (C) 2010, 2011, 2012 CERN.
#
# Invenio 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... | CERNDocumentServer/invenio | modules/bibsort/lib/bibsort_daemon.py | Python | gpl-2.0 | 15,964 |
#!/usr/bin/env python
"""
Framework to start a simulated vehicle and connect it to MAVProxy.
Peter Barker, April 2016
based on sim_vehicle.sh by Andrew Tridgell, October 2011
"""
import atexit
import getpass
import optparse
import os
import os.path
import signal
import subprocess
import sys
import tempfile
import ti... | hsteinhaus/ardupilot | Tools/autotest/sim_vehicle.py | Python | gpl-3.0 | 31,053 |
#!/usr/bin/env py.test
"""Unit tests for parameter library"""
# Copyright (C) 2011 Anders Logg
#
# This file is part of DOLFIN.
#
# DOLFIN is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either versio... | MiroK/dolfin | test/unit/python/parameter/test_parameters.py | Python | gpl-3.0 | 4,019 |
from p2pool.bitcoin import networks
PARENT = networks.nets['joulecoin']
SHARE_PERIOD = 20 # seconds
CHAIN_LENGTH = 12*60*60//10 # shares
REAL_CHAIN_LENGTH = 12*60*60//10 # shares
TARGET_LOOKBEHIND = 20 # shares
SPREAD = 10 # blocks
IDENTIFIER = 'ac556af4e900ca61'.decode('hex')
PREFIX = '16ac009e4fa655ac'.decode('hex')... | Rav3nPL/p2pool-rav | p2pool/networks/joulecoin.py | Python | gpl-3.0 | 568 |
# ##### 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 distrib... | elfnor/sverchok | nodes/generators_extended/generative_art.py | Python | gpl-3.0 | 15,917 |
# Copyright (C) 2010-2015 GRNET S.A.
#
# 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 3 of the License, or
# (at your option) any later version.
#
# This program is distributed i... | dimara/synnefo | snf-astakos-app/astakos/api/projects.py | Python | gpl-3.0 | 21,618 |
# -*- coding: utf-8 -*-
"""
test_task
TestTask
:copyright: (c) 2013-2015 by Openlabs Technologies & Consulting (P) Limited
:license: BSD, see LICENSE for more details.
"""
import unittest
import json
import smtplib
from minimock import Mock
from trytond.tests.test_tryton import POOL, DB_NAME, USER, C... | sharoonthomas/nereid-project | tests/test_task.py | Python | gpl-3.0 | 38,238 |
#-*- coding:utf-8 -*-
"""
This file is part of OpenSesame.
OpenSesame 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.
OpenSesame is distri... | eort/OpenSesame | libopensesame/sketchpad_elements/_noise.py | Python | gpl-3.0 | 1,670 |
# encoding: utf-8
#
#
# 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/.
#
# Contact: Kyle Lahnakoski (kyle@lahnakoski.com)
#
from __future__ import absolute_import, divis... | klahnakoski/TestLog-ETL | vendor/mo_collections/persistent_queue.py | Python | mpl-2.0 | 7,580 |
from __future__ import unicode_literals
from frappe import _
def get_data():
return {
'fieldname': 'therapy_session',
'transactions': [
{
'label': _('Assessments'),
'items': ['Patient Assessment']
}
]
}
| gsnbng/erpnext | erpnext/healthcare/doctype/therapy_session/therapy_session_dashboard.py | Python | agpl-3.0 | 226 |
#!/usr/bin/python
import logging
logging.basicConfig(level = logging.DEBUG)
from gi.repository import Vips
Vips.cache_set_trace(True)
try:
a = Vips.Image.new_from_file("/home/john/pics/babe.poop")
except Vips.Error, e:
print e
a = Vips.Image.new_from_file("/home/john/pics/babe.jpg")
b = Vips.Image.new_from_... | leiyangyou/libvips | python/example/try2.py | Python | lgpl-2.1 | 591 |
#!/usr/bin/env python
'''
extract mavlink mission from log
'''
import sys, time, os
# allow import from the parent directory, where mavlink.py is
sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), '..'))
from optparse import OptionParser
parser = OptionParser("mavmission.py [options]")
par... | x75/mavlink | pymavlink/examples/mavmission.py | Python | lgpl-3.0 | 1,070 |
"""The tests for the Xiaomi router device tracker platform."""
import logging
from unittest.mock import MagicMock, call, patch
import requests
from homeassistant.components.device_tracker import DOMAIN
import homeassistant.components.xiaomi.device_tracker as xiaomi
from homeassistant.components.xiaomi.device_tracker ... | partofthething/home-assistant | tests/components/xiaomi/test_device_tracker.py | Python | apache-2.0 | 8,787 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Tests for the Windows event data attribute containers."""
import unittest
import uuid
from plaso.containers import windows_events
from tests import test_lib as shared_test_lib
class WindowsDistributedLinkTrackingEventDataTest(shared_test_lib.BaseTestCase):
"""Tes... | kiddinn/plaso | tests/containers/windows_events.py | Python | apache-2.0 | 1,527 |
#!/usr/bin/env python
# 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 (the
# "License"); you ma... | jayceyxc/hue | apps/search/src/search/conf.py | Python | apache-2.0 | 1,443 |
import asyncio
import sys
from abc import ABC, abstractmethod
from collections.abc import Iterable, Sized
PY_35 = sys.version_info >= (3, 5)
class AbstractRouter(ABC):
def __init__(self):
self._frozen = False
def post_init(self, app):
"""Post init stage.
Not an abstract method for ... | juliatem/aiohttp | aiohttp/abc.py | Python | apache-2.0 | 3,396 |
#!/usr/bin/python
from eve import Eve
from eve.auth import BasicAuth
from flask_bootstrap import Bootstrap
from eve_docs import eve_docs
class ResourceManagerBasicAuth(BasicAuth):
def check_auth(self, username, password, allowed_roles, resource, method):
if method == 'GET':
# Allow read-only a... | tbeckham/DeploymentManager | resource_manager/server.py | Python | apache-2.0 | 658 |
#
# 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 ... | apache/aurora | src/main/python/apache/thermos/monitoring/resource.py | Python | apache-2.0 | 13,377 |
"""Offer state listening automation rules."""
from __future__ import annotations
from datetime import timedelta
import logging
from typing import Any
import voluptuous as vol
from homeassistant import exceptions
from homeassistant.const import CONF_ATTRIBUTE, CONF_FOR, CONF_PLATFORM, MATCH_ALL
from homeassistant.cor... | w1ll1am23/home-assistant | homeassistant/components/homeassistant/triggers/state.py | Python | apache-2.0 | 6,291 |
#
# 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/aaa/aaatacacsparams.py | Python | apache-2.0 | 8,097 |
"""Webhooks for external integrations."""
from __future__ import absolute_import
from django.http import HttpRequest, HttpResponse
from django.utils.translation import ugettext as _
from zerver.models import get_client, UserProfile
from zerver.lib.actions import check_send_message
from zerver.lib.response import json... | sonali0901/zulip | zerver/webhooks/freshdesk/view.py | Python | apache-2.0 | 5,880 |
#
# 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 | tests/utils/test_python_virtualenv.py | Python | apache-2.0 | 2,580 |
import sys
sys.path.insert(1, "../../../")
import h2o
import numpy as np
def minmax_basic(ip,port):
print "Uploading iris data..."
iris_h2o = h2o.import_file(h2o.locate("smalldata/iris/iris_wheader.csv"))
iris_np = np.genfromtxt(h2o.locate("smalldata/iris/iris_wheader.csv"), delimiter=",", skip_... | weaver-viii/h2o-3 | h2o-py/tests/testdir_munging/unop/pyunit_minmax_basic.py | Python | apache-2.0 | 1,862 |
"""Support for Tasmota fans."""
from hatasmota import const as tasmota_const
from homeassistant.components import fan
from homeassistant.components.fan import FanEntity
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from .const import DATA_REMOVE_DISCOVE... | tboyce1/home-assistant | homeassistant/components/tasmota/fan.py | Python | apache-2.0 | 2,750 |
"""Integration with the Rachio Iro sprinkler system controller."""
import asyncio
import logging
import secrets
from typing import Optional
from aiohttp import web
from rachiopy import Rachio
import voluptuous as vol
from homeassistant.components.http import HomeAssistantView
from homeassistant.const import CONF_API_... | leppa/home-assistant | homeassistant/components/rachio/__init__.py | Python | apache-2.0 | 10,051 |
from __future__ import unicode_literals
from ctypes import windll, pointer
from ctypes.wintypes import DWORD
from six.moves import range
from prompt_toolkit.key_binding.input_processor import KeyPress
from prompt_toolkit.keys import Keys
from prompt_toolkit.mouse_events import MouseEventType
from prompt_toolkit.win32_... | KaranToor/MA450 | google-cloud-sdk/lib/third_party/prompt_toolkit/terminal/win32_input.py | Python | apache-2.0 | 12,797 |
#!Measurement
'''
baseline:
after: true
before: false
counts: 20
detector: H1
mass: 34.2
settling_time: 15.0
default_fits: nominal_linear
equilibration:
eqtime: 1.0
inlet: R
inlet_delay: 3
outlet: O
use_extraction_eqtime: true
multicollect:
counts: 90
detector: H1
isotope: Ar40
peakcenter:
... | UManPychron/pychron | docs/user_guide/operation/scripts/examples/argus/measurement/jan_unknown90_20_no_center.py | Python | apache-2.0 | 2,277 |
"""Support for loading picture from Neato."""
from datetime import timedelta
import logging
from pybotvac.exceptions import NeatoRobotException
from homeassistant.components.camera import Camera
from .const import (
NEATO_DOMAIN,
NEATO_LOGIN,
NEATO_MAP_DATA,
NEATO_ROBOTS,
SCAN_INTERVAL_MINUTES,
)... | leppa/home-assistant | homeassistant/components/neato/camera.py | Python | apache-2.0 | 3,990 |
# 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 ... | cloudera/hue | desktop/core/ext-py/phoenixdb-1.1.0/phoenixdb/tests/test_types.py | Python | apache-2.0 | 22,726 |
import numpy as np
import pytest
from pandas import (
DataFrame,
MultiIndex,
)
import pandas._testing as tm
from pandas.core.groupby.base import (
reduction_kernels,
transformation_kernels,
)
@pytest.fixture(params=[True, False])
def as_index(request):
return request.param
@pytest.fixture
def m... | dsm054/pandas | pandas/tests/groupby/conftest.py | Python | bsd-3-clause | 3,673 |
# Python imports
import locale
import math
import uuid
# django imports
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.fields import GenericRelation
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ObjectDoesNotExist
from d... | baffolobill/django-lfs | lfs/catalog/models.py | Python | bsd-3-clause | 97,109 |
# -*- coding: utf-8 -*-
import json
import logging
from vilya.libs.search import code_client
class IndexEngine(object):
c = code_client
if not c.head():
c.put('')
@classmethod
def update_mapping(cls, index_type, data):
result = cls.c.post(
'%s/_mapping' % index_type, da... | xtao/code | vilya/models/elastic/indexer.py | Python | bsd-3-clause | 2,860 |
import csv
import sys
import django
from django.conf import settings
from django.contrib.auth.models import User
from django.core.exceptions import ImproperlyConfigured
from django.utils import six
from oscar.core.loading import get_model
# A setting that can be used in foreign key declarations
AUTH_USER_MODEL = get... | vicky2135/lucious | src/oscar/core/compat.py | Python | bsd-3-clause | 6,146 |
# -*- coding: utf-8 -*-
"""
=========================================================
Principal components analysis (PCA)
=========================================================
These figures aid in illustrating how a point cloud
can be very flat in one direction--which is where PCA
comes in to choose a direction th... | sergeyf/scikit-learn | examples/decomposition/plot_pca_3d.py | Python | bsd-3-clause | 2,259 |
{'board_id': 812,
'public_url': 'https://p.datadoghq.com/sb/20756e0cd4'}
| jhotta/documentation | code_snippets/results/result.api-screenboard-share.py | Python | bsd-3-clause | 74 |
from subprocess import call, check_output
from locale import getpreferredencoding
class TestDjango:
""" Test if Django and its libraries are properly installed inside venv """
def django_version(self):
""" Returns current version of Django """
output = check_output(['python', '-c', 'import djan... | byteknacker/fcc-python-vagrant | python/python_test/test_modules/django_test.py | Python | bsd-3-clause | 555 |
"""
Tests for uu module.
Nick Mathewson
"""
import unittest
from test.support import os_helper
import os
import stat
import sys
import uu
import io
plaintext = b"The symbols on top of your keyboard are !@#$%^&*()_+|~\n"
encodedtext = b"""\
M5&AE('-Y;6)O;',@;VX@=&]P(&]F('EO=7(@:V5Y8F]A<F0@87)E("% (R0E
*7B8J*"E?*WQ^"... | brython-dev/brython | www/src/Lib/test/test_uu.py | Python | bsd-3-clause | 8,294 |
from scrapy.contrib.exporter import CsvItemExporter
from scrapy.conf import settings
class SlybotCSVItemExporter(CsvItemExporter):
def __init__(self, *args, **kwargs):
kwargs['fields_to_export'] = settings.getlist('CSV_EXPORT_FIELDS') or None
super(SlybotCSVItemExporter, self).__init__(*args, **kwa... | lodow/portia-proxy | slybot/slybot/exporter.py | Python | bsd-3-clause | 325 |