code stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 226 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k |
|---|---|---|---|---|---|
from django.conf import settings as django_settings
from django.core.mail import EmailMultiAlternatives, EmailMessage
from django.template import loader
from rest_framework import response, status
try:
from django.contrib.sites.shortcuts import get_current_site
except ImportError:
from django.contrib.sites.mod... | mjuopperi/djoser | djoser/utils.py | Python | mit | 4,015 |
# -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
try:
import ctypes
except MemoryError:
# selinux execmem denial
# https://bugzilla.redhat.com/show_bug.cgi?id=488396
ctypes = None
except ImportError:
# Python on Solaris ... | OneBitSoftware/jwtSample | src/Spa/env1/Lib/site-packages/gunicorn/util.py | Python | mit | 12,319 |
# Copyright (C) 2008-2015 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... | yland/mailman3 | src/mailman/interfaces/pipeline.py | Python | gpl-2.0 | 1,138 |
import gtk
import cairo
import gobject
class CellRendererEmblems(gtk.CellRenderer):
"""Cell renderer that accepts list of icon names."""
__gproperties__ = {
'emblems': (
gobject.TYPE_PYOBJECT,
'Emblem list',
'List of icon names to display',
gobject.PARAM_READWRITE
),
'is-link': ... | Goodmind/sunflower-fm | application/widgets/emblems_renderer.py | Python | gpl-3.0 | 2,375 |
#!/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... | dochang/ansible-modules-core | cloud/amazon/ec2_asg.py | Python | gpl-3.0 | 34,382 |
#!/usr/bin/python
# Copyright: 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',
'status': ['stableinterf... | qrkourier/ansible | lib/ansible/modules/cloud/amazon/ec2_vpc_subnet.py | Python | gpl-3.0 | 9,267 |
# -*- coding: utf-8 -*-
# This file is part of beets.
# Copyright 2016, François-Xavier Thomas.
#
# 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 limi... | bbsan2k/nzbToMedia | libs/beetsplug/badfiles.py | Python | gpl-3.0 | 4,564 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# 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.
#... | bcoca/ansible-modules-extras | database/misc/redis.py | Python | gpl-3.0 | 10,653 |
import ipaddress
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.asymmetric import padding, rsa
from .connection import NetworkAddress
def encode_address(addr: NetworkAddress) -> bytes:
return ipaddress.ip_address(add... | asajeffrey/servo | tests/wpt/web-platform-tests/tools/third_party/aioquic/src/aioquic/quic/retry.py | Python | mpl-2.0 | 1,449 |
# Copyright 2012-2013, Damian Johnson
# See LICENSE for licensing information
"""
Connection and networking based utility functions. This will likely be expanded
later to have all of `arm's functions
<https://gitweb.torproject.org/arm.git/blob/HEAD:/src/util/connections.py>`_,
but for now just moving the parts we need... | arlolra/stem | stem/util/connection.py | Python | lgpl-3.0 | 8,605 |
# coding: utf-8
from __future__ import unicode_literals
import itertools
from .amp import AMPIE
from ..compat import (
compat_HTTPError,
compat_urlparse,
)
from ..utils import (
ExtractorError,
clean_html,
int_or_none,
sanitized_Request,
urlencode_postdata
)
class DramaFeverBaseIE(AMPIE)... | pim89/youtube-dl | youtube_dl/extractor/dramafever.py | Python | unlicense | 7,450 |
""" Simple wrapper for a Spark Context to provide loading functionality """
import os
from thunder.utils.common import checkParams, handleFormat, raiseErrorIfPathExists
from thunder.utils.datasets import DataSets
from thunder.utils.params import Params
class ThunderContext():
"""
Wrapper for a SparkContext ... | pearsonlab/thunder | thunder/utils/context.py | Python | apache-2.0 | 36,355 |
# Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: dan@reciprocitylabs.com
# Maintained By: dan@reciprocitylabs.com
from ggrc.models.all_models import register_model
from .risk_assessment import Ri... | prasannav7/ggrc-core | src/ggrc_risk_assessments/models/__init__.py | Python | apache-2.0 | 365 |
#!/usr/bin/env python
#
# VM Backup extension
#
# Copyright 2015 Microsoft 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
#
# U... | Azure/azure-linux-extensions | VMEncryption/main/oscrypto/rhel_72_lvm/encryptstates/UnmountOldrootState.py | Python | apache-2.0 | 7,716 |
#
# 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... | apache/incubator-airflow | airflow/operators/postgres_operator.py | Python | apache-2.0 | 1,149 |
"""Views for the node settings page."""
# -*- coding: utf-8 -*-
from dateutil.parser import parse as dateparse
import httplib as http
import logging
from flask import request, make_response
from framework.exceptions import HTTPError
from website.addons.base import generic_views
from website.addons.github.api import ... | RomanZWang/osf.io | website/addons/github/views.py | Python | apache-2.0 | 10,973 |
# encoding: UTF-8
from vnhuobi import TradeApi, DataApi | mumuwoyou/vnpy-master | vnpy/api/huobi/__init__.py | Python | mit | 56 |
#!/usr/bin/env python
# File: mk_regions.py
# Created on: Sun May 27 21:56:23 2012
# Last Change: Tue May 29 16:13:20 2012
# Purpose of script: <+INSERT+>
# Author: Steven Boada
import sys
import os
import numpy as np
#def mk_regions(coords):
def mk_regions():
for coords in os.listdir('.'):
if coords.en... | boada/vpCluster | data/boada/scripts/mk_regions.py | Python | mit | 1,077 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2017, Bruno Calogero <brunocalogero@hotmail.com>
# 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_... | thaim/ansible | lib/ansible/modules/network/aci/aci_static_binding_to_epg.py | Python | mit | 14,726 |
# Copyright (c) 2003-2006 CORE Security Technologies
#
# This software is provided under under a slightly modified version
# of the Apache Software License. See the accompanying LICENSE file
# for more information.
#
# $Id: transport.py,v 1.5 2006/05/23 21:19:26 gera Exp $
#
# Description:
# Transport implementations... | pwnieexpress/pwn_plug_sources | src/voiper/sulley/impacket/dcerpc/transport.py | Python | gpl-3.0 | 11,565 |
"""
This module imitates a real module, providing standard syntax
like from `plumbum.colors` and from `plumbum.colors.bg` to work alongside
all the standard syntax for colors.
"""
from __future__ import print_function
import sys
import os
import atexit
from plumbum.colorlib import ansicolors, main
_reset = ansicolors... | Hellrungj/CSC-412-Networking | rpc-project/venv/lib/python2.7/site-packages/plumbum/colors.py | Python | gpl-3.0 | 646 |
"""
Python unit testing framework, based on Erich Gamma's JUnit and Kent Beck's
Smalltalk testing framework.
This module contains the core framework classes that form the basis of
specific test cases and suites (TestCase, TestSuite etc.), and also a
text-based utility class for running the tests and reporting the resu... | Microvellum/Fluid-Designer | win64-vc/2.78/python/lib/unittest/__init__.py | Python | gpl-3.0 | 3,117 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | ujjvala-addsol/addsol_hr | openerp/addons/account/account_bank_statement.py | Python | agpl-3.0 | 50,409 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | aricchen/openHR | openerp/addons/base/res/res_currency.py | Python | agpl-3.0 | 12,118 |
# Copyright 2013 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | scrapinghub/keystone | keystone/auth/plugins/external.py | Python | apache-2.0 | 6,469 |
# Copyright 2015 Red Hat 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 ... | HybridF5/tempest_debug | tempest/api/identity/admin/v3/test_domains_negative.py | Python | apache-2.0 | 3,018 |
from __future__ import print_function
from builtins import range
import sys
sys.path.insert(1,"../../")
import h2o
from tests import pyunit_utils
import random
import os
def javapredict_dynamic_data():
# Generate random dataset
dataset_params = {}
dataset_params['rows'] = random.sample(list(range(5000,150... | YzPaul3/h2o-3 | h2o-py/tests/testdir_javapredict/pyunit_javapredict_dynamic_data_paramsKmeans.py | Python | apache-2.0 | 2,376 |
"""
# 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... | OBIGOGIT/etch | binding-python/runtime/src/main/python/etch/compiler/__init__.py | Python | apache-2.0 | 1,061 |
# 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 unittest
from telemetry.internal.results import page_test_results
from telemetry.page import page as page_module
from telemetry.web_perf.metrics impo... | SaschaMester/delicium | tools/telemetry/telemetry/web_perf/metrics/smoothness_unittest.py | Python | bsd-3-clause | 13,607 |
# -*- coding: utf-8 -*-
# TODO:
# * Move/rename namespace polluting attributes
# * Documentation
# * Make backends optional: Meta.backends = (path, modelinstance/model, view)
import hashlib
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.utils.datastructures i... | shirishagaddi/django-seo | rollyourown/seo/base.py | Python | bsd-3-clause | 14,784 |
#Copyright ReportLab Europe Ltd. 2000-2004
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/tools/pythonpoint/__init__.py
| makinacorpus/reportlab-ecomobile | tools/pythonpoint/__init__.py | Python | bsd-3-clause | 199 |
#!/usr/bin/python
# coding=utf-8
##########################################################################
from test import CollectorTestCase
from test import get_collector_config
from test import unittest
from mock import Mock
from mock import patch
from diamond.collector import Collector
from elasticsearch import... | Ssawa/Diamond | src/collectors/elasticsearch/test/testelasticsearch.py | Python | mit | 11,625 |
# -*- coding: iso-8859-1 -*-
# Copyright (C) 2004-2012 Bastian Kleineidam
#
# 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 versi... | terryyin/linkchecker | tests/checker/test_telnet.py | Python | gpl-2.0 | 1,953 |
APPLICATION_NAME = 'pypack'
APPLICATION_VERSION = '0.0.0'
APPLICATION_REVISION = '0'
| linuxmint/mint4win | src/pypack/libpypack/version.py | Python | gpl-2.0 | 86 |
#!/usr/bin/env python
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:fdm=marker:ai
from __future__ import (unicode_literals, division, absolute_import,
print_function)
__license__ = 'GPL v3'
__copyright__ = '2012, Kovid Goyal <kovid at kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
... | yeyanchao/calibre | src/calibre/devices/mtp/defaults.py | Python | gpl-3.0 | 1,628 |
#!/usr/bin/python
#***************************************************************************
#* *
#* Copyright (c) 2009 Yorik van Havre <yorik@uncreated.net> *
#* ... | timthelion/FreeCAD | src/Tools/updatefromcrowdin.py | Python | lgpl-2.1 | 11,250 |
"""Tests for the Abode sensor device."""
from homeassistant.components.abode import ATTR_DEVICE_ID
from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN
from homeassistant.const import (
ATTR_DEVICE_CLASS,
ATTR_FRIENDLY_NAME,
ATTR_UNIT_OF_MEASUREMENT,
DEVICE_CLASS_HUMIDITY,
PERCENTAGE,... | aronsky/home-assistant | tests/components/abode/test_sensor.py | Python | apache-2.0 | 1,877 |
#!/usr/bin/python2.7
# Copyright 2012 Google Inc. All Rights Reserved.
"""Support for simple JSON templates.
A JSON template is a dictionary of JSON data in which string values
may be simple templates in string.Template format (i.e.,
$dollarSignEscaping). By default, the template is expanded against
its own data, op... | dougbeal/google-apis-client-generator | src/googleapis/codegen/utilities/json_expander.py | Python | apache-2.0 | 1,809 |
# -*- coding: utf-8 -*-
import mock
import pytest
from future.moves.urllib.parse import urlparse, urljoin
from addons.base.tests import views
from addons.base.tests.utils import MockFolder
from addons.mendeley.models import Mendeley
from addons.mendeley.tests.utils import MendeleyTestCase, mock_responses
from tests.b... | Johnetordoff/osf.io | addons/mendeley/tests/test_views.py | Python | apache-2.0 | 1,232 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2009-2011 Red Hat, 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
#
# Unle... | djw8605/htcondor | src/condor_contrib/mgmt/qmf/test/jobcontrol.py | Python | apache-2.0 | 1,434 |
# -*- coding: utf-8 -*-
from __future__ import print_function
# pylint: disable-msg=W0612,E1101
from copy import deepcopy
from datetime import datetime, timedelta, time, date
import sys
import operator
import re
import csv
import nose
import functools
import itertools
from itertools import product, permutations
from d... | kelseyoo14/Wander | venv_2_7/lib/python2.7/site-packages/pandas/tests/test_frame.py | Python | artistic-2.0 | 638,116 |
#-----------------------------------------------------------------------------
# Copyright (c) 2013, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License with exception
# for distributing bootloader.
#
# The full license is in the file COPYING.txt, distributed with this softwa... | timeyyy/PyUpdater | pyupdater/vendor/PyInstaller/hooks/hookutils.py | Python | bsd-2-clause | 22,893 |
import pytest
pytest.importorskip('numpy')
import numpy as np
from numpy.testing import assert_array_almost_equal, assert_array_equal
import dask
import dask.array as da
from dask.array.ghost import (Array, fractional_slice, getitem, trim_internal,
ghost_internal, nearest, constant, boun... | esc/dask | dask/array/tests/test_ghost.py | Python | bsd-3-clause | 9,623 |
#!/usr/bin/env python
"""
Copyright (c) 2006-2015 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
from lib.core.enums import DBMS
from lib.core.settings import MSSQL_SYSTEM_DBS
from lib.core.unescaper import unescaper
from plugins.dbms.mssqlserver.enumeration import Enumer... | V11/volcano | server/sqlmap/plugins/dbms/mssqlserver/__init__.py | Python | mit | 1,081 |
#!/usr/bin/env python3
import numpy as np, pylab, tkinter
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit
from decimal import *
import sys, string, os
argv = sys.argv
if len(argv) != 3:
print("Syntax: ./plot_precession.py res_lammps.dat res_llg.dat")
sys.exit()
lammps_file = sys.argv[1]
llg... | jeremiahyan/lammps | examples/SPIN/test_problems/validation_damped_exchange/plot_precession.py | Python | gpl-2.0 | 1,111 |
# Copyright 2012 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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, or (at your option)
# any later version.
#
... | trdean/grEME | gr-video-sdl/python/video_sdl/__init__.py | Python | gpl-3.0 | 1,138 |
def WebIDLTest(parser, harness):
threw = False
try:
parser.parse("""
interface Foo {
[CEReactions(DOMString a)] void foo(boolean arg2);
};
""")
results = parser.finish()
except:
threw = True
harness.ok(threw, "Should have thrown for... | upsuper/servo | components/script/dom/bindings/codegen/parser/tests/test_cereactions.py | Python | mpl-2.0 | 3,527 |
import pixie.vm.rt as rt
from pixie.vm.primitives import nil
rt.init()
def test_hashmap_create():
acc = rt.hashmap(rt.wrap(1), rt.wrap(2))
val = rt._val_at(acc, rt.wrap(1), nil)
assert val.int_val() == 2
| kidaa/pixie | pixie/vm/test/test_hashmaps.py | Python | lgpl-3.0 | 221 |
"""Config flow for local_ip."""
from __future__ import annotations
from typing import Any
from homeassistant.config_entries import ConfigFlow
from homeassistant.data_entry_flow import FlowResult
from .const import DOMAIN
class SimpleConfigFlow(ConfigFlow, domain=DOMAIN):
"""Handle a config flow for local_ip.""... | jawilson/home-assistant | homeassistant/components/local_ip/config_flow.py | Python | apache-2.0 | 757 |
"""Tests for the Subaru component config flow."""
# pylint: disable=redefined-outer-name
from copy import deepcopy
from unittest import mock
from unittest.mock import patch
import pytest
from subarulink.exceptions import InvalidCredentials, InvalidPIN, SubaruException
from homeassistant import config_entries
from hom... | Danielhiversen/home-assistant | tests/components/subaru/test_config_flow.py | Python | apache-2.0 | 8,146 |
from io import BytesIO
import sys
from mitmproxy.net import wsgi
from mitmproxy.net.http import Headers
def tflow():
headers = Headers(test=b"value")
req = wsgi.Request("http", "GET", "/", "HTTP/1.1", headers, "")
return wsgi.Flow(("127.0.0.1", 8888), req)
class ExampleApp:
def __init__(self):
... | mosajjal/mitmproxy | test/mitmproxy/net/test_wsgi.py | Python | mit | 3,186 |
# -*- coding: utf-8 -*-
"""
Pygments
~~~~~~~~
Pygments is a syntax highlighting package written in Python.
It is a generic syntax highlighter for general use in all kinds of software
such as forum systems, wikis or other applications that need to prettify
source code. Highlights are:
* a ... | JulienMcJay/eclock | windows/Python27/Lib/site-packages/pygments/__init__.py | Python | gpl-2.0 | 2,974 |
# -*- coding: utf-8 -*-
"""
The module :mod:`openerp.tests.common` provides unittest test cases and a few
helpers and classes to write tests.
"""
import errno
import glob
import importlib
import json
import logging
import os
import select
import subprocess
import threading
import time
import itertools
import unittest
... | vileopratama/vitech | src/openerp/tests/common.py | Python | mit | 15,778 |
# -*- coding: utf-8 -*-
from functools import wraps
from celery import chain
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.db.models.query import QuerySet
from django_object_actions import DjangoObjectActions
# Register your models here.
from appliances.models import (
... | anurag03/integration_tests | sprout/appliances/admin.py | Python | gpl-2.0 | 7,546 |
""" Test script for the unicodedata module.
Written by Marc-Andre Lemburg (mal@lemburg.com).
(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
"""#"
import unittest, test.test_support
import sha
encoding = 'utf-8'
### Run tests
class UnicodeMethodsTest(unittest.TestCase):
# update this, if the d... | xbmc/atv2 | xbmc/lib/libPython/Python/Lib/test/test_unicodedata.py | Python | gpl-2.0 | 8,080 |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | eadgarchen/tensorflow | tensorflow/compiler/tests/xla_test.py | Python | apache-2.0 | 9,399 |
from itertools import filterfalse
from typing import (
Callable,
Iterable,
Iterator,
Optional,
Set,
TypeVar,
Union,
)
# Type and type variable definitions
_T = TypeVar('_T')
_U = TypeVar('_U')
def unique_everseen(
iterable: Iterable[_T], key: Optional[Callable[[_T], _U]] = None
) -> ... | pybuilder/pybuilder | src/main/python/pybuilder/_vendor/pkg_resources/_vendor/importlib_resources/_itertools.py | Python | apache-2.0 | 884 |
import logging
from django.views import generic
from django.contrib.auth.models import User
from django.contrib import messages
from django.core.mail import send_mail
from django import http
from django.core.urlresolvers import reverse
from django.template.loader import get_template
from django.template import Context... | elliotthill/django-oscar | sites/sandbox/apps/gateway/views.py | Python | bsd-3-clause | 1,784 |
from __future__ import division
import unittest
import itertools
import numpy
from chainer import iterators
from chainer import serializer
from chainer import testing
class DummySerializer(serializer.Serializer):
def __init__(self, target):
super(DummySerializer, self).__init__()
self.target = ... | rezoo/chainer | tests/chainer_tests/iterators_tests/test_iterator_compatibility.py | Python | mit | 2,915 |
"""
========================
Broadcasting over arrays
========================
The term broadcasting describes how numpy treats arrays with different
shapes during arithmetic operations. Subject to certain constraints,
the smaller array is "broadcast" across the larger array so that they
have compatible shapes. Broadc... | AdaptiveApplications/carnegie | tarc_bus_locator_client/numpy-1.8.1/numpy/doc/broadcasting.py | Python | mit | 5,576 |
# Eve W-Space
# Copyright (C) 2013 Andrew Austin and other contributors
#
# 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... | djrscally/eve-wspace | evewspace/POS/models.py | Python | gpl-3.0 | 7,280 |
def f(c, x):
if c > 2:
from lib1 import f #pass
elif c > 1:
from lib2 import f #pass
else:
<warning descr="Unused import statement 'from lib2 import g #fail'">from lib2 import g #fail</warning>
return f(x) | siosio/intellij-community | python/testData/inspections/PyUnresolvedReferencesInspection/ConditionalImports/a.py | Python | apache-2.0 | 245 |
"""This module is part of Swampy, a suite of programs available from
allendowney.com/swampy.
Copyright 2011 Allen B. Downey
Distributed under the GNU General Public License at gnu.org/licenses/gpl.html.
"""
import math
from World import World
class CellWorld(World):
"""Contains cells and animals that move betwe... | simontakite/sysadmin | pythonscripts/thinkpython/CellWorld.py | Python | gpl-2.0 | 6,080 |
# -*- coding: utf-8 -*-
from module.database import style
from module.plugins.internal.Addon import Addon
class DeleteFinished(Addon):
__name__ = "DeleteFinished"
__type__ = "hook"
__version__ = "1.14"
__status__ = "testing"
__config__ = [("interval" , "int" , "Check interval in hours" ... | LePastis/pyload | module/plugins/hooks/DeleteFinished.py | Python | gpl-3.0 | 2,839 |
import logging
from airflow.hooks import MySqlHook
from airflow.models import BaseOperator
from airflow.utils import apply_defaults
class MySqlOperator(BaseOperator):
"""
Executes sql code in a specific MySQL database
:param mysql_conn_id: reference to a specific mysql database
:type mysql_conn_id: ... | wwwslinger/airflow | airflow/operators/mysql_operator.py | Python | apache-2.0 | 1,063 |
# Django settings for example project.
import os
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
('Tester', 'test@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
'N... | GbalsaC/bitnamiP | venv/src/django-oauth2-provider/tests/settings.py | Python | agpl-3.0 | 1,878 |
## based on https://github.com/dmlc/mxnet/issues/1302
## Parses the model fit log file and generates a train/val vs epoch plot
import matplotlib.pyplot as plt
import numpy as np
import re
import argparse
parser = argparse.ArgumentParser(description='Parses log file and generates train/val curves')
parser.add_argument(... | likelyzhao/mxnet | example/kaggle-ndsb1/training_curves.py | Python | apache-2.0 | 1,093 |
# Copyright (C) 2010 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the f... | mogoweb/webkit_for_android5.1 | webkit/Source/WebKit2/Scripts/webkit2/messages_unittest.py | Python | apache-2.0 | 24,676 |
#
# This file is part of pyasn1-modules software.
#
# Created by Russ Housley.
#
# Copyright (c) 2019, Vigil Security, LLC
# License: http://snmplabs.com/pyasn1/license.html
#
# Alternative Challenge Password Attributes for EST
#
# ASN.1 source from:
# https://www.rfc-editor.org/rfc/rfc7894.txt
#
from pyasn1.type impo... | martbhell/wasthereannhlgamelastnight | src/lib/pyasn1_modules/rfc7894.py | Python | mit | 2,769 |
# Copyright 2015 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... | nburn42/tensorflow | tensorflow/python/framework/random_seed.py | Python | apache-2.0 | 5,903 |
"""
Define common steps for instructor dashboard acceptance tests.
"""
# pylint: disable=missing-docstring
# pylint: disable=redefined-outer-name
from __future__ import absolute_import
from lettuce import step, world
from mock import patch
from nose.tools import assert_in
from courseware.tests.factories import Inst... | pepeportela/edx-platform | lms/djangoapps/instructor/features/common.py | Python | agpl-3.0 | 4,560 |
from distutils.version import LooseVersion
import functools
import re
import sys
def _check_version(actver, version, cmp_op):
"""
Check version string of an active module against a required version.
If dev/prerelease tags result in TypeError for string-number comparison,
it is assumed that the depend... | RPGOne/Skynet | version_requirements.py | Python | bsd-3-clause | 4,443 |
# coding: utf-8
from .. import fixtures, config
from ..assertions import eq_
from ..config import requirements
from sqlalchemy import Integer, Unicode, UnicodeText, select
from sqlalchemy import Date, DateTime, Time, MetaData, String, \
Text, Numeric, Float, literal, Boolean, cast, null, JSON, and_
from ..schema i... | pcu4dros/pandora-core | workspace/lib/python3.5/site-packages/sqlalchemy/testing/suite/test_types.py | Python | mit | 24,316 |
#!/usr/bin/env python3
# Copyright (c) 2020-2021 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test block-relay-only anchors functionality"""
import os
from test_framework.p2p import P2PInterface
... | ajtowns/bitcoin | test/functional/feature_anchors.py | Python | mit | 2,924 |
# Copyright 2011 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | ChinaMassClouds/copenstack-server | openstack/src/nova-2014.2/nova/api/openstack/compute/contrib/extended_status.py | Python | gpl-2.0 | 3,926 |
# cerbero - a multi-platform build system for Open Source software
# Copyright (C) 2012 Andoni Morales Alastruey <ylatuya@gmail.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; eit... | OptoFidelity/cerbero | cerbero/commands/bootstrap.py | Python | lgpl-2.1 | 1,583 |
# -*- encoding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
class People(models.Model):
name = models.CharField(max_length=255)
parent = models.ForeignKey('self', models.CASCADE)
class Message(models.Model):
from_field = models.ForeignKey(People, models.CASCADE, db_co... | darkryder/django | tests/inspectdb/models.py | Python | bsd-3-clause | 3,075 |
from __future__ import unicode_literals
from django.db import models
from django.test import TestCase
from django.core.exceptions import ImproperlyConfigured
from rest_framework import serializers, viewsets, permissions
from rest_framework.compat import include, patterns, url
from rest_framework.decorators import link,... | GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/rest_framework/tests/test_routers.py | Python | agpl-3.0 | 7,115 |
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | nburn42/tensorflow | tensorflow/python/grappler/graph_placer.py | Python | apache-2.0 | 4,478 |
from __future__ import unicode_literals
import re
from .amp import AMPIE
from .common import InfoExtractor
class FoxNewsIE(AMPIE):
IE_NAME = 'foxnews'
IE_DESC = 'Fox News and Fox Business Video'
_VALID_URL = r'https?://(?P<host>video\.(?:insider\.)?fox(?:news|business)\.com)/v/(?:video-embed\.html\?vide... | vinegret/youtube-dl | youtube_dl/extractor/foxnews.py | Python | unlicense | 5,156 |
# 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.
"""A Telemetry page_action that loops media playback.
Action attributes are:
- loop_count: The number of times to loop media.
- selector: If no selector is ... | androidarmv6/android_external_chromium_org | tools/telemetry/telemetry/page/actions/loop.py | Python | bsd-3-clause | 1,886 |
"""Plugins for "exit" task phase."""
| ratoaq2/Flexget | flexget/plugins/exit/__init__.py | Python | mit | 37 |
"""
Support for monitoring the Transmission BitTorrent client API.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.transmission/
"""
import logging
from datetime import timedelta
import voluptuous as vol
from homeassistant.components.sensor impor... | srcLurker/home-assistant | homeassistant/components/sensor/transmission.py | Python | mit | 4,962 |
#!/usr/bin/env python
parameter_list=[[]]
def labels_io_modular():
from modshogun import RegressionLabels, CSVFile
lab=RegressionLabels()
f=CSVFile("../data/label_train_regression.dat","r")
f.set_delimiter(" ")
lab.load(f)
#print lab.get_labels()
return lab
if __name__=='__main__':
print('Labels IO')
labels_... | curiousguy13/shogun | examples/undocumented/python_modular/labels_io_modular.py | Python | gpl-3.0 | 351 |
import os
AUTH_MIDDLEWARE = [
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
]
AUTH_TEMPLATES = [{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(os.path.dirname(__file__), 'templates')],
'APP_... | wkschwartz/django | tests/auth_tests/settings.py | Python | bsd-3-clause | 587 |
from __future__ import absolute_import, division, unicode_literals
from html5lib import constants, parseFragment, serialize
from html5lib.filters import sanitizer
def runSanitizerTest(_, expected, input):
parsed = parseFragment(expected)
expected = serialize(parsed,
omit_optional_tag... | UK992/servo | tests/wpt/web-platform-tests/tools/third_party/html5lib/html5lib/tests/test_sanitizer.py | Python | mpl-2.0 | 5,540 |
# -*- coding: utf-8 -*-
def generate_translations(item):
"""Generate French and Spanish translations for the given `item`."""
fr_prefix = u'(français) '
es_prefix = u'(español) '
oldname = unicode(item.name)
item.name = {'en': oldname,
'fr': fr_prefix + oldname,
'... | tsl143/addons-server | src/olympia/landfill/translations.py | Python | bsd-3-clause | 364 |
self.description = "Remove a package required by other packages"
lp1 = pmpkg("pkg1")
self.addpkg2db("local", lp1)
lp2 = pmpkg("pkg2")
lp2.depends = ["pkg1"]
self.addpkg2db("local", lp2)
lp3 = pmpkg("pkg3")
lp3.depends = ["pkg1"]
self.addpkg2db("local", lp3)
lp4 = pmpkg("pkg4")
lp4.depends = ["pkg1"]
self.addpkg2db(... | AWhetter/pacman | test/pacman/tests/remove047.py | Python | gpl-2.0 | 521 |
#!/usr/bin/python
#
# @author: Gaurav Rastogi (grastogi@avinetworks.com)
# Eric Anderson (eanderson@avinetworks.com)
# module_check: supported
# Avi Version: 17.1.1
#
# Copyright: (c) 2017 Gaurav Rastogi, <grastogi@avinetworks.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses... | alxgu/ansible | lib/ansible/modules/network/avi/avi_useraccountprofile.py | Python | gpl-3.0 | 4,875 |
"""
USA-specific Form helpers
"""
from django.forms import ValidationError
from django.forms.fields import Field, RegexField, Select, EMPTY_VALUES
from django.utils.encoding import smart_unicode
from django.utils.translation import ugettext_lazy as _
import re
phone_digits_re = re.compile(r'^(?:1-?)?(\d{3})[-\.]?(\d{... | Shrews/PyGerrit | webapp/django/contrib/localflavor/us/forms.py | Python | apache-2.0 | 4,166 |
"""Exceptions used by basic support utilities."""
__author__ = "Ian Goodfellow"
import sys
from pylearn2.utils.common_strings import environment_variable_essay
from theano.compat import six
class EnvironmentVariableError(Exception):
"""
An exception raised when a required environment variable is not defined
... | CIFASIS/pylearn2 | pylearn2/utils/exc.py | Python | bsd-3-clause | 3,029 |
# Copyright (c) 2011 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.
"""Code to validate and convert settings of the Microsoft build tools.
This file contains code to validate and convert settings of the Microsoft
build t... | carlosbeatortega/sociedades | web/node/node_modules/npm/node_modules/node-gyp/legacy/tools/gyp/pylib/gyp/MSVSSettings.py | Python | mit | 42,889 |
from django import forms
from .models import SignUp
class ContactForm(forms.Form):
full_name = forms.CharField(required=False)
email = forms.EmailField()
message = forms.CharField()
class SignUpForm(forms.ModelForm):
class Meta:
model = SignUp
fields = ['full_name', 'email']
### exclude = ['full_name']
... | codingforentrepreneurs/ecommerce-2 | src/newsletter/forms.py | Python | mit | 812 |
"""The tests for marytts tts platforms."""
| fbradyirl/home-assistant | tests/components/marytts/__init__.py | Python | apache-2.0 | 43 |
from distutils.core import setup
from distutils.command.install_data import install_data
from distutils.command.install import INSTALL_SCHEMES
import os
import sys
class osx_install_data(install_data):
# On MacOS, the platform-specific lib dir is /System/Library/Framework/Python/.../
# which is wrong. Python 2... | ychen820/microblog | y/google-cloud-sdk/platform/google_appengine/lib/django-1.2/setup.py | Python | bsd-3-clause | 4,087 |
#!/usr/bin/python
#
# Created on Aug 25, 2016
# @author: Gaurav Rastogi (grastogi@avinetworks.com)
# Eric Anderson (eanderson@avinetworks.com)
# module_check: supported
# Avi Version: 17.1.1
#
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the te... | RackSec/ansible | lib/ansible/modules/network/avi/avi_sslkeyandcertificate.py | Python | gpl-3.0 | 5,751 |
#
# Copyright (C) 2011 The Android Open Source Project
#
# 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 la... | qingpingguo/git-repo | subcmds/list.py | Python | apache-2.0 | 2,535 |
# -*- coding: utf-8 -*-
# $Id: fi.py 7119 2011-09-02 13:00:23Z milde $
# Author: Asko Soukka <asko.soukka@iki.fi>
# Copyright: This module has been placed in the public domain.
# New language mappings are welcome. Before doing a new translation, please
# read <http://docutils.sf.net/docs/howto/i18n.html>. Two files ... | idea4bsd/idea4bsd | python/helpers/py3only/docutils/parsers/rst/languages/fi.py | Python | apache-2.0 | 3,541 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | jss-emr/openerp-7-src | openerp/addons/account/wizard/account_unreconcile.py | Python | agpl-3.0 | 2,140 |
from django.db import models
class ThingItem(object):
def __init__(self, value, display):
self.value = value
self.display = display
def __iter__(self):
return (x for x in [self.value, self.display])
def __len__(self):
return 2
class Things(object):
def __iter__(se... | atruberg/django-custom | tests/model_validation/models.py | Python | bsd-3-clause | 614 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.