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 __future__ import absolute_import
from changes.api.base import APIView
from changes.models import Task
class TaskIndexAPIView(APIView):
def get(self):
queryset = Task.query.order_by(Task.date_created.desc())
return self.paginate(queryset)
| bowlofstew/changes | changes/api/task_index.py | Python | apache-2.0 | 268 |
class B(object):
def __init__<warning descr="Signature is not compatible to __new__">(self)</warning>: # error
pass
def __new__<warning descr="Signature is not compatible to __init__">(cls, x, y)</warning>: # error
pass
class A1(B):
pass
class A2(A1):
def __new__<warning descr="Signature is not c... | asedunov/intellij-community | python/testData/inspections/PyInitNewSignatureInspection/test.py | Python | apache-2.0 | 780 |
#
# 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 ... | stackforge/solum | solum/objects/sqlalchemy/migration/alembic_migrations/versions/43df309dbf3f_extend_base_image_id_to_100_chars.py | Python | apache-2.0 | 1,292 |
#!/usr/bin/env python
#coding=utf-8
# Copyright (C) 2011, Alibaba Cloud Computing
#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 ... | lufornpy/aliyun-cli | aliyuncli/ossadp/ossHandler.py | Python | apache-2.0 | 88,246 |
from __future__ import annotations
from dataclasses import dataclass
import logging
import json
import numbers
from typing import (Any, Dict, List, Union, Tuple,
Sequence, TYPE_CHECKING)
from opentrons import config
from opentrons.config import feature_flags as ff
from opentrons_shared_data.pipette... | Opentrons/labware | api/src/opentrons/config/pipette_config.py | Python | apache-2.0 | 16,434 |
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the... | JioCloud/horizon | openstack_dashboard/dashboards/admin/users/panel.py | Python | apache-2.0 | 1,001 |
# pylint: disable=invalid-unary-operand-type
from collections import OrderedDict
import json
import logging
from copy import deepcopy
from datetime import datetime, timedelta
from six import string_types
import requests
import sqlalchemy as sa
from sqlalchemy import (
Column, Integer, String, ForeignKey, Text, Boo... | nekia/incubator-superset-dev | superset/connectors/druid/models.py | Python | apache-2.0 | 40,706 |
#!/usr/bin/env python
import xml.etree.ElementTree as ET
class brocade_maps_ext(object):
"""Auto generated class.
"""
def __init__(self, **kwargs):
self._callback = kwargs.pop('callback')
def maps_get_all_policy_input_rbridge_id(self, **kwargs):
"""Auto Generated Code
... | BRCDcomm/pynos | pynos/versions/ver_6/ver_6_0_1/yang/brocade_maps_ext.py | Python | apache-2.0 | 12,855 |
# coding=utf-8
'''
cron trigger
@author: Huiyugeng
'''
import datetime
import trigger
class CronTrigger(trigger.Trigger):
def __init__(self, cron):
trigger.Trigger.__init__(self, 0, 1);
self.cron = cron
def _is_match(self):
parser = CronParser(self.cron)
... | interhui/py_task | task/trigger/cron_trigger.py | Python | artistic-2.0 | 3,634 |
from urllib.parse import quote_plus
import praw
QUESTIONS = ['what is', 'who is', 'what are']
REPLY_TEMPLATE = '[Let me google that for you](http://lmgtfy.com/?q={})'
def main():
reddit = praw.Reddit(user_agent='LMGTFY (by /u/USERNAME)',
client_id='CLIENT_ID', client_secret="CLIENT_SECR... | RGood/praw | docs/examples/lmgtfy_bot.py | Python | bsd-2-clause | 1,206 |
from django.contrib.auth.models import User
from django.core import mail
from django.test.client import RequestFactory
from mock import ANY, patch
from nose.tools import eq_, ok_
from test_utils import TestCase
from remo.dashboard.forms import EmailRepsForm
from remo.profiles.tests import FunctionalAreaFactory, UserF... | chirilo/remo | remo/dashboard/tests/test_forms.py | Python | bsd-3-clause | 2,108 |
# -*- coding: utf-8 -*-
import os
from django.conf import settings
from django.core.exceptions import PermissionDenied
from django.core.files.storage import FileSystemStorage
from django.forms import Form
from django.template.response import SimpleTemplateResponse
from django.urls import NoReverseMatch
from formtool... | benzkji/django-cms | cms/wizards/views.py | Python | bsd-3-clause | 5,882 |
import pytest
from functools import partial
from bluesky.preprocessors import suspend_wrapper
from bluesky.suspenders import (SuspendBoolHigh,
SuspendBoolLow,
SuspendFloor,
SuspendCeil,
Suspen... | ericdill/bluesky | bluesky/tests/test_suspenders.py | Python | bsd-3-clause | 7,631 |
# cython: language_level=2
#
# ElementTree
# $Id: ElementPath.py 3375 2008-02-13 08:05:08Z fredrik $
#
# limited xpath support for element trees
#
# history:
# 2003-05-23 fl created
# 2003-05-28 fl added support for // etc
# 2003-08-27 fl fixed parsing of periods in element names
# 2007-09-10 fl new selection ... | lxml/lxml | src/lxml/_elementpath.py | Python | bsd-3-clause | 10,742 |
"""MethodCaller provider traversal tests."""
from dependency_injector import providers
def test_traverse():
provider1 = providers.Provider()
provided = provider1.provided
method = provided.method
provider = method.call()
all_providers = list(provider.traverse())
assert len(all_providers) ==... | ets-labs/python-dependency-injector | tests/unit/providers/traversal/test_method_caller_py3.py | Python | bsd-3-clause | 1,790 |
# -*- 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:
"""Tests for the engine module
"""
import numpy as np
import scipy.sparse as ssp
import re
import mock
from nipype.pipeline.plugins.tools import report_crash
def test_report_crash... | mick-d/nipype | nipype/pipeline/plugins/tests/test_tools.py | Python | bsd-3-clause | 1,756 |
# -*- coding: utf-8 -*-
#
# Diazo documentation build configuration file, created by
# sphinx-quickstart on Tue Nov 2 18:58:07 2010.
#
# 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 c... | ebrehault/diazo | docs/conf.py | Python | bsd-3-clause | 6,987 |
import time
import config
from ophyd import scaler
from ophyd.utils import enum
ScalerMode = enum(ONE_SHOT=0, AUTO_COUNT=1)
loggers = ('ophyd.signal',
'ophyd.scaler',
)
config.setup_loggers(loggers)
logger = config.logger
sca = scaler.EpicsScaler(config.scalers[0])
sca.preset_time.put(5.2, ... | dchabot/ophyd | examples/scaler.py | Python | bsd-3-clause | 1,039 |
import re
from os.path import join
from setuptools import find_packages
def get():
pkgnames = find_packages()
if len(pkgnames) == 0:
return "unknown"
pkgname = pkgnames[0]
content = open(join(pkgname, "__init__.py")).read()
c = re.compile(r"__version__ *= *('[^']+'|\"[^\"]+\")")
m = c... | limix/glimix-core | version.py | Python | mit | 411 |
"""
Provide functionality to interact with Cast devices on the network.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/media_player.cast/
"""
# pylint: disable=import-error
import logging
import voluptuous as vol
from homeassistant.components.media_pla... | hexxter/home-assistant | homeassistant/components/media_player/cast.py | Python | mit | 8,925 |
from . import resource
class AuthorizationsBase(resource.GitHubResource):
path = 'authorizations'
class Authorization(AuthorizationsBase):
pass
class Authorizations(AuthorizationsBase):
pass
| ducksboard/libsaas | libsaas/services/github/authorizations.py | Python | mit | 210 |
from allauth.socialaccount.tests import OAuth2TestsMixin
from allauth.tests import MockedResponse, TestCase
from .provider import MicrosoftGraphProvider
class MicrosoftGraphTests(OAuth2TestsMixin, TestCase):
provider_id = MicrosoftGraphProvider.id
def get_mocked_response(self):
response_data = """
... | AltSchool/django-allauth | allauth/socialaccount/providers/microsoft/tests.py | Python | mit | 988 |
# 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.
"""
Function/method decorators that provide timeout and retry logic.
"""
import functools
import itertools
import sys
from devil.android import device_erro... | Teamxrtc/webrtc-streaming-node | third_party/webrtc/src/chromium/src/build/android/devil/android/decorators.py | Python | mit | 5,401 |
from django.core.urlresolvers import reverse
from django.db import models
from django.db.models import Q
from core.models import TimeStampedModel
from accounts.models import Account
class Board(models.Model):
def __str__(self):
return 'Board Name: ' + self.name
def get_absolute_url(self):
re... | hyesun03/k-board | kboard/board/models.py | Python | mit | 3,211 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'FeaturedResource'
db.create_table('resources_featuredresource', (
('id', self.gf... | amitskwalia/codesters | resources/migrations/0004_auto__add_featuredresource__add_unique_featuredresource_topic_resource.py | Python | mit | 8,260 |
import os
from home.models import ReplicaSet, WhatTorrent, WhatFulltext
def run_checks():
errors = []
warnings = []
# Check WhatFulltext integrity
def check_whatfulltext():
w_torrents = dict((w.id, w) for w in WhatTorrent.objects.defer('torrent_file').all())
w_fulltext = dict((w.id, ... | MADindustries/WhatManager2 | WhatManager2/checks.py | Python | mit | 2,864 |
"""
Some helper functions for workspace stuff
"""
import logging
import re
import biokbase
import biokbase.workspace
from biokbase.workspace import client as WorkspaceClient
g_log = logging.getLogger(__name__)
# regex for parsing out workspace_id and object_id from
# a "ws.{workspace}.{object}" string
ws_regex = re.c... | rsutormin/narrative | src/biokbase/narrative/ws_util.py | Python | mit | 11,249 |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2009 Benny Malengier
#
#
# 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... | dermoth/gramps | gramps/plugins/drawreport/drawplugins.gpr.py | Python | gpl-2.0 | 7,435 |
import dns
import os
import socket
import struct
from recursortests import RecursorTest
class testKeepOpenTCP(RecursorTest):
_confdir = 'KeepOpenTCP'
_config_template = """dnssec=validate
packetcache-ttl=10
packetcache-servfail-ttl=10
auth-zones=authzone.example=configs/%s/authzone.zone""" % _confdir
@c... | PowerDNS/pdns | regression-tests.recursor-dnssec/test_KeepOpenTCP.py | Python | gpl-2.0 | 2,856 |
# -*- coding: utf-8 -*-
import re
from collections import OrderedDict
from odoo import api, fields, models, _
from PIL import Image
from cStringIO import StringIO
import babel
from odoo.tools import html_escape as escape, posix_to_ldml, safe_eval, float_utils
from .qweb import unicodifier
import logging
_logger = logg... | chienlieu2017/it_management | odoo/odoo/addons/base/ir/ir_qweb/fields.py | Python | gpl-3.0 | 16,571 |
# coding=utf-8
"""
InaSAFE Disaster risk assessment tool developed by AusAid and World Bank
- **GUI Test Cases.**
Contact : ole.moller.nielsen@gmail.com
.. 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 Fre... | wonder-sk/inasafe | safe/impact_statistics/test/test_postprocessor_manager.py | Python | gpl-3.0 | 5,518 |
# (c) 2013-2014, Michael DeHaan <michael.dehaan@gmail.com>
# (c) 2015 Toshio Kuratomi <tkuratomi@ansible.com>
#
# 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... | cmvelo/ansible | lib/ansible/executor/module_common.py | Python | gpl-3.0 | 33,348 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2017 F5 Networks Inc.
# 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
import os
import json
import sys
from nose.plugins.skip import SkipTest
i... | alexlo03/ansible | test/units/modules/network/f5/test_bigip_vcmp_guest.py | Python | gpl-3.0 | 5,742 |
#!/usr/bin/env python
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
__license__ = 'GPL v3'
__copyright__ = '2010, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
import json, traceback
from PyQt4.Qt import QDialogButtonBox
from calibre.gui2 import error_dialog, warning_dialog
from c... | insomnia-lab/calibre | src/calibre/gui2/preferences/template_functions.py | Python | gpl-3.0 | 10,331 |
# --------------------------------------------------------------------------- #
# CUBECOLOURDIALOG Widget wxPython IMPLEMENTATION
#
# Python Code By:
#
# Andrea Gavana, @ 16 Aug 2007
# Latest Revision: 14 Apr 2010, 12.00 GMT
#
#
# TODO List
#
# 1. Find A Way To Reduce Flickering On The 2 ColourPanels;
#
# 2. See Why wx... | ezequielpereira/Time-Line | libs64/wx/lib/agw/cubecolourdialog.py | Python | gpl-3.0 | 139,714 |
# Copyright(C) 2014 by Abe developers.
# test_btc200.py: test Abe loading through Bitcoin Block 200.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, o... | n00bsys0p/altcoin-abe | test/test_btc200.py | Python | agpl-3.0 | 98,158 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (c) 2006 ACYSOS S.L. (http://acysos.com) All Rights Reserved.
# Pedro Tarrafeta <pedro@acysos.com>
# Copyright (c) 2008 Pablo Roc... | jmesteve/openerpseda | openerp/addons/l10n_es_payment_order/wizard/csb_19.py | Python | agpl-3.0 | 13,523 |
import radon.complexity
import radon.visitors
from coalib.bears.LocalBear import LocalBear
from coalib.results.Result import Result
from coalib.results.RESULT_SEVERITY import RESULT_SEVERITY
from coalib.results.SourceRange import SourceRange
from coalib.settings.Setting import typed_list
class RadonBear(LocalBear):
... | sims1253/coala-bears | bears/python/RadonBear.py | Python | agpl-3.0 | 1,902 |
"""
Instructor Views
"""
## NOTE: This is the code for the legacy instructor dashboard
## We are no longer supporting this file or accepting changes into it.
from contextlib import contextmanager
import csv
import json
import logging
import os
import re
import requests
from collections import defaultdict, OrderedDict... | xiandiancloud/edxplaltfom-xusong | lms/djangoapps/instructor/views/legacy.py | Python | agpl-3.0 | 82,769 |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Gengeo(AutotoolsPackage):
"""GenGeo is a library of tools for creating complex particle
... | LLNL/spack | var/spack/repos/builtin/packages/gengeo/package.py | Python | lgpl-2.1 | 1,514 |
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
determine_ext,
float_or_none,
int_or_none,
)
class JWPlatformBaseIE(InfoExtractor):
@staticmethod
def _find_jwplayer_data(webpage):
# TODO: Merge this with JWPlayer-r... | dntt1/youtube-dl | youtube_dl/extractor/jwplatform.py | Python | unlicense | 5,161 |
# Copyright (c) 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 ... | thiagodasilva/swift | swift/common/middleware/bulk.py | Python | apache-2.0 | 30,792 |
#
# 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... | wileeam/airflow | airflow/providers/google/cloud/operators/speech_to_text.py | Python | apache-2.0 | 4,187 |
"""Copyright 2008 Orbitz WorldWide
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, softw... | krux/graphite-web | webapp/graphite/events/urls.py | Python | apache-2.0 | 832 |
# Copyright 2013 Huawei Technologies Co.,LTD.
# 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
#
# Unl... | izadorozhna/tempest | tempest/api/identity/admin/v2/test_tenant_negative.py | Python | apache-2.0 | 6,865 |
# Copyright (c) 2013-2014 OpenStack Foundation
# 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
#
# Un... | Juniper/contrail-dev-neutron | neutron/plugins/ml2/drivers/mechanism_odl.py | Python | apache-2.0 | 15,181 |
#
# Copyright (c) 2015 nexB Inc. and others. All rights reserved.
# http://nexb.com and https://github.com/nexB/scancode-toolkit/
# The ScanCode software is licensed under the Apache License version 2.0.
# Data generated with ScanCode require an acknowledgment.
# ScanCode is a trademark of nexB Inc.
#
# You may not use... | vinodpanicker/scancode-toolkit | src/extractcode/libarchive2.py | Python | apache-2.0 | 28,804 |
################################################################################
# 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... | jinglining/flink | flink-python/pyflink/table/tests/test_dependency.py | Python | apache-2.0 | 11,436 |
"""Constants for the Vilfo Router integration."""
from __future__ import annotations
from dataclasses import dataclass
from homeassistant.components.sensor import SensorEntityDescription
from homeassistant.const import DEVICE_CLASS_TIMESTAMP, PERCENTAGE
DOMAIN = "vilfo"
ATTR_API_DATA_FIELD_LOAD = "load"
ATTR_API_DA... | jawilson/home-assistant | homeassistant/components/vilfo/const.py | Python | apache-2.0 | 1,270 |
"""The Brother component."""
from __future__ import annotations
from datetime import timedelta
import logging
from brother import Brother, DictToObj, SnmpError, UnsupportedModel
import pysnmp.hlapi.asyncio as SnmpEngine
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_HOST, C... | jawilson/home-assistant | homeassistant/components/brother/__init__.py | Python | apache-2.0 | 2,597 |
from pulsar.tools.authorization import get_authorizer
from .test_utils import get_test_toolbox, TestCase
def test_allow_any_authorization():
authorizer = get_authorizer(None)
authorization = authorizer.get_authorization('tool1')
authorization.authorize_setup()
authorization.authorize_tool_file('cow', ... | galaxyproject/pulsar | test/authorization_test.py | Python | apache-2.0 | 1,340 |
#*****************************************************************************
# Copyright 2004-2008 Steve Menard
#
# 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... | ktan2020/jpype | jpype/_jcollection.py | Python | apache-2.0 | 8,284 |
import django
if django.VERSION >= (3, 2):
# The declaration is only needed for older Django versions
pass
else:
default_app_config = (
"wagtail.contrib.simple_translation.apps.SimpleTranslationAppConfig"
)
| zerolab/wagtail | wagtail/contrib/simple_translation/__init__.py | Python | bsd-3-clause | 233 |
"""
sentry.interfaces.template
~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
__all__ = ('Template',)
from sentry.interfaces.base import Interface, InterfaceValidationError
... | JackDanger/sentry | src/sentry/interfaces/template.py | Python | bsd-3-clause | 3,261 |
##########################################################################
#
# Copyright 2010 Dr D Studios Pty Limited (ACN 127 184 954) (Dr. D Studios),
# its affiliates and/or its licensors.
#
# Copyright (c) 2010-2013, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary ... | DoubleNegativeVisualEffects/cortex | test/IECoreHoudini/FromHoudiniPointsConverter.py | Python | bsd-3-clause | 39,834 |
# Copyright (c) 2016, Xilinx, 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 ... | schelleg/PYNQ | pynq/lib/pmod/pmod_led8.py | Python | bsd-3-clause | 5,931 |
"""
Demonstrates how the bz2 module may be used to create a compressed object
which represents a bitarray.
"""
import bz2
from bitarray import bitarray
def compress(ba):
"""
Given a bitarray, return an object which represents all information
within the bitarray in a compresed form.
The function `deco... | brianhelba/pylibtiff | libtiff/bitarray-a1646c0/examples/compress.py | Python | bsd-3-clause | 953 |
''' Functions for arranging bokeh Layout objects.
'''
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
from __future__ import absolute_import
from .core.enums import Location, SizingMode
from .model... | percyfal/bokeh | bokeh/layouts.py | Python | bsd-3-clause | 19,180 |
import importlib
import inspect
import os
import re
import sys
import tempfile
from io import StringIO
from pathlib import Path
from django.conf.urls import url
from django.core import mail
from django.core.files.uploadedfile import SimpleUploadedFile
from django.db import DatabaseError, connection
from django.shortcu... | etos/django | tests/view_tests/tests/test_debug.py | Python | bsd-3-clause | 47,063 |
import os, tempfile, zipfile, tarfile, logging
from django.core.servers.basehttp import FileWrapper
from django.http import HttpResponse
def get_zipfile(file_list):
"""
Create a ZIP file on disk and transmit it in chunks of 8KB,
without loading the whole file into memory.
"""
... | commtrack/commtrack-core | apps/transformers/zip.py | Python | bsd-3-clause | 3,024 |
# -*- coding: utf-8 -*-
"""
sphinx.builders.gettext
~~~~~~~~~~~~~~~~~~~~~~~
The MessageCatalogBuilder class.
:copyright: Copyright 2007-2015 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from __future__ import unicode_literals
from os import path, walk
from codecs ... | WhySoGeeky/DroidPot | venv/lib/python2.7/site-packages/sphinx/builders/gettext.py | Python | mit | 7,833 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging as loggers
import numpy as np
import theano.tensor as T
from theano.tensor.nnet import conv
from theano.tensor.signal import downsample
from deepy.utils import build_activation, UniformInitializer
from deepy.layers.layer import NeuralLayer
logging = log... | ZhangAustin/deepy | deepy/layers/conv.py | Python | mit | 2,682 |
"""
Test rpc_util functions
"""
__author__ = 'Dan Gunter <dkgunter@lbl.gov>'
__date__ = '8/28/15'
# Imports
# stdlib
import re
# third-party
from nose.tools import raises
# local
from doekbase.data_api import rpc_util
from thrift.Thrift import TType
class Metadata:
"""SAMPLE object for testing validation, etc.
... | scanon/data_api2 | lib/doekbase/data_api/tests/test_rpc_util.py | Python | mit | 3,869 |
# coding=utf-8
from __future__ import print_function
"""
Place in ~/.octoprint/plugins & restart server to test:
* python_checker and python_updater mechanism
* demotion of pip and python setup.py clean output that
gets written to stderr but isn't as severe as that would
look
Plugin will always demand to... | JackGavin13/octoprint-test-not-finished | tests/manual_tests/always_update.py | Python | agpl-3.0 | 2,285 |
#***************************************************************************
#* *
#* Copyright (c) 2016 Yorik van Havre <yorik@uncreated.net> *
#* *
#* This ... | usakhelo/FreeCAD | src/Mod/Arch/import3DS.py | Python | lgpl-2.1 | 4,196 |
# -*- encoding: utf-8 -*-
# Pilas engine - A video game framework.
#
# Copyright 2010 - Hugo Ruscitti
# License: LGPLv3 (see http://www.gnu.org/licenses/lgpl.html)
#
# Website - http://www.pilas-engine.com.ar
from pilasengine.actores.actor import Actor
class Bala(Actor):
""" Representa una bala que va en línea ... | apehua/pilas | pilasengine/actores/bala.py | Python | lgpl-3.0 | 1,431 |
# Copyright 2013 NEC Corporation.
# 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... | queria/my-tempest | tempest/services/compute/xml/aggregates_client.py | Python | apache-2.0 | 5,059 |
# Copyright 2008-2015 Nokia Networks
# Copyright 2016- Robot Framework 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
... | alexandrul-ci/robotframework | src/robot/model/totalstatistics.py | Python | apache-2.0 | 2,319 |
# 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 ... | t-tran/libcloud | libcloud/test/storage/test_base.py | Python | apache-2.0 | 4,866 |
"""
mbed CMSIS-DAP debugger
Copyright (c) 2006-2013 ARM Limited
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 ... | ARMmbed/yotta_osx_installer | workspace/lib/python2.7/site-packages/pyOCD/target/target_nrf51.py | Python | apache-2.0 | 1,678 |
"""Tests for distutils.command.check."""
import os
import textwrap
import unittest
from test.support import run_unittest
from distutils.command.check import check, HAS_DOCUTILS
from distutils.tests import support
from distutils.errors import DistutilsSetupError
try:
import pygments
except ImportError:
pygment... | batermj/algorithm-challenger | code-analysis/programming_anguage/python/source_codes/Python3.8.0/Python-3.8.0/Lib/distutils/tests/test_check.py | Python | apache-2.0 | 5,711 |
"""Set of utility functions for working with OS commands.
Functions in this module return the command string. These commands are composed but not executed.
"""
import os
from subprocess import call
HADOOP_CONF_DIR = '/etc/hadoop/conf'
def encrypt(key_file):
"""
Encrypt the data from stdin and write output t... | apache/incubator-cotton | mysos/executor/shell_utils.py | Python | apache-2.0 | 3,152 |
"""login is not nullable
Revision ID: 105c1c44ff70
Revises: 2003c675a267
Create Date: 2013-12-09 10:52:50.646000
"""
# revision identifiers, used by Alembic.
revision = '105c1c44ff70'
down_revision = '2003c675a267'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
... | gateway4labs/labmanager | alembic/versions/105c1c44ff70_login_is_not_nullabl.py | Python | bsd-2-clause | 832 |
"""
========================
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... | illume/numpy3k | numpy/doc/broadcasting.py | Python | bsd-3-clause | 5,413 |
#!/usr/bin/env python
"""
Custom test runner
If args or options, we run the testsuite as quickly as possible.
If args but no options, we default to using the spec plugin and aborting on
first error/failure.
If options, we ignore defaults and pass options onto Nose.
Examples:
Run all tests (as fast as possible)
$ .... | kapt/django-oscar | runtests.py | Python | bsd-3-clause | 3,114 |
from setuptools import setup
import pybvc
setup(
name='pybvc',
version=pybvc.__version__,
description='A python library for programming your network via the Brocade Vyatta Controller (BVC)',
long_description=open('README.rst').read(),
author='Elbrys Networks',
author_email='jeb@elbrys.com',
... | tnadeau/pybvc | setup.py | Python | bsd-3-clause | 1,243 |
"""
Implementation of various trading strategies.
"""
from cointrol.core.models import (
Order, TradingSession,
RelativeStrategyProfile, FixedStrategyProfile
)
class TradeAction:
BUY, SELL = Order.BUY, Order.SELL
def __init__(self, action, price):
self.action = action
self.price = p... | iamkingmaker/cointrol | cointrol/trader/strategies.py | Python | mit | 2,030 |
from __future__ import absolute_import
import sys
import types
from contextlib import contextmanager
from kombu.utils.encoding import str_to_bytes
from celery import signature
from celery import states
from celery import group
from celery.backends.cache import CacheBackend, DummyClient
from celery.exceptions import... | sunze/py_flask | venv/lib/python3.4/site-packages/celery/tests/backends/test_cache.py | Python | mit | 9,216 |
#!/usr/bin/env python
#
# This is run by Travis-CI before an upgrade to load some data into the
# database. After the upgrade is complete, the data is verified by
# upgrade-after.py to make sure that the upgrade of the database went smoothly.
#
import logging
import unittest
import sys
sys.path.insert(0, '..')
sys.pat... | ettrig/NIPAP | tests/upgrade-before.py | Python | mit | 3,381 |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
from __future__ import division, print_function, unicode_literals, \
absolute_import
import os
import unittest
from pymatgen.io.lammps.sets import LammpsInputSet
__author__ = 'Kiran Mathew'
__email__ = '... | johnson1228/pymatgen | pymatgen/io/lammps/tests/test_sets.py | Python | mit | 2,130 |
# coding: utf-8
from __future__ import absolute_import
import flask
import auth
import model
import util
from main import app
yahoo_config = dict(
access_token_url='https://api.login.yahoo.com/oauth/v2/get_token',
authorize_url='https://api.login.yahoo.com/oauth/v2/request_auth',
base_url='https://query.yaho... | gmist/ctm-5studio | main/auth/yahoo.py | Python | mit | 2,148 |
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
from __future__ import unicode_literals
import formatter
import io
import sys
import time
import portage
from portage import os
from portage import _encodings
from portage import _unicode_encode
from portage.ou... | nullishzero/Portage | pym/_emerge/JobStatusDisplay.py | Python | gpl-2.0 | 7,763 |
# This file is part of Buildbot. Buildbot 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, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... | Lekensteyn/buildbot | master/buildbot/steps/mtrlogobserver.py | Python | gpl-2.0 | 18,336 |
# -*- coding: utf-8 -*-
# Copyright(C) 2013 Julien Veyssier
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your op... | frankrousseau/weboob | modules/allocine/module.py | Python | agpl-3.0 | 8,218 |
"""Support for Z-Wave sensors."""
from homeassistant.components.sensor import DEVICE_CLASS_BATTERY, DOMAIN, SensorEntity
from homeassistant.const import DEVICE_CLASS_TEMPERATURE, TEMP_CELSIUS, TEMP_FAHRENHEIT
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
... | jawilson/home-assistant | homeassistant/components/zwave/sensor.py | Python | apache-2.0 | 3,679 |
#
# Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
#
from pysandesh_example.gen_py.vn.ttypes import VirtualNetwork, VNInfo, VirtualNetworkResp, \
VirtualNetworkAll, VNStats, VirtualNetworkAllResp
def VirtualNetwork_handle_request(self, sandesh):
vn_stats = VNStats(in_pkts=10, out_pkts=20,... | vpramo/contrail-sandesh | library/python/pysandesh/example/pysandesh_example/sandesh_req_impl.py | Python | apache-2.0 | 1,469 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# vim: set et sw=4 ts=4 sts=4 ff=unix fenc=utf8:
# Author: Binux<i@binux.me>
# http://binux.me
# Created on 2014-07-17 21:06:43
import time
import mysql.connector
from pyspider.database.base.projectdb import ProjectDB as BaseProjectDB
from pyspider.database.base... | shanezhiu/pyspider | pyspider/database/mysql/projectdb.py | Python | apache-2.0 | 2,401 |
# 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... | nburn42/tensorflow | tensorflow/python/ops/linalg/linear_operator_test_util.py | Python | apache-2.0 | 28,767 |
"""Define constants for the SimpliSafe component."""
from datetime import timedelta
DOMAIN = "simplisafe"
DATA_CLIENT = "client"
DEFAULT_SCAN_INTERVAL = timedelta(seconds=30)
TOPIC_UPDATE = "update"
| fbradyirl/home-assistant | homeassistant/components/simplisafe/const.py | Python | apache-2.0 | 203 |
# $Id: stp.py 23 2006-11-08 15:45:33Z dugsong $
# -*- coding: utf-8 -*-
"""Spanning Tree Protocol."""
import dpkt
class STP(dpkt.Packet):
__hdr__ = (
('proto_id', 'H', 0),
('v', 'B', 0),
('type', 'B', 0),
('flags', 'B', 0),
('root_id', '8s', ''),
('root_path', 'I',... | lkash/test | dpkt/stp.py | Python | bsd-3-clause | 1,695 |
#-----------------------------------------------------------------------------
# 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... | bl4ckdu5t/registron | tests/basic/test_email.py | Python | mit | 681 |
# Natural Language Toolkit: Decision Tree Classifiers
#
# Copyright (C) 2001-2017 NLTK Project
# Author: Edward Loper <edloper@gmail.com>
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
"""
A classifier model that decides which label to assign to a token on
the basis of a tree structure, where bra... | sdoran35/hate-to-hugs | venv/lib/python3.6/site-packages/nltk/classify/decisiontree.py | Python | mit | 12,314 |
#!/usr/bin/env python
import glob
import os
import sys
sys.path.insert(0, os.pardir)
from testing_harness import TestHarness
from openmc.statepoint import StatePoint
class SourcepointTestHarness(TestHarness):
def _test_output_created(self):
"""Make sure statepoint.* files have been created."""
st... | kellyrowland/openmc | tests/test_sourcepoint_interval/test_sourcepoint_interval.py | Python | mit | 1,176 |
import logging
from django.core.management.base import BaseCommand
from readthedocs.projects import tasks
from readthedocs.api.client import api
log = logging.getLogger(__name__)
class Command(BaseCommand):
"""
Build documentation using the API and not hitting a database.
Usage::
./manage.py ... | SteveViss/readthedocs.org | readthedocs/core/management/commands/update_api.py | Python | mit | 851 |
import unittest
from chainer import cuda
from chainer import initializers
from chainer import testing
from chainer.testing import attr
import numpy
@testing.parameterize(*testing.product({
'target': [
initializers.Uniform,
initializers.LeCunUniform,
initializers.HeUniform,
initial... | kiyukuta/chainer | tests/chainer_tests/initializer_tests/test_uniform.py | Python | mit | 1,548 |
from test import support
from test.support import bigaddrspacetest, MAX_Py_ssize_t
import unittest
import operator
import sys
class StrTest(unittest.TestCase):
@bigaddrspacetest
def test_concat(self):
s1 = 'x' * MAX_Py_ssize_t
self.assertRaises(OverflowError, operator.add, s1, '?')
@big... | MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-3.1/Lib/test/test_bigaddrspace.py | Python | mit | 1,284 |
from searchv2.tests.test_builders import *
from searchv2.tests.test_models import *
from searchv2.tests.test_utils import *
from searchv2.tests.test_views import * | pydanny/djangopackages | searchv2/tests/__init__.py | Python | mit | 163 |
# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
from __future__ import print_function
import fixpath
import colorama
from colorama import Fore, Back, Style
from random import randint, choice
from string import printable
# Fore, Back and Style are convenience classes for the constant ANSI str... | Teamxrtc/webrtc-streaming-node | third_party/webrtc/src/chromium/src/third_party/colorama/src/demos/demo06.py | Python | mit | 1,711 |
import json
import unittest
import mock
from django.http import HttpResponseBadRequest
from base import (assert_auth_CREATE, assert_auth_READ, assert_auth_UPDATE, assert_auth_DELETE,
assert_auth_EXECUTE)
from pulp.server.exceptions import InvalidValue, MissingResource, MissingValue, OperationPostpon... | ulif/pulp | server/test/unit/server/webservices/views/test_consumer_groups.py | Python | gpl-2.0 | 24,673 |
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# 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) an... | jnerin/ansible | lib/ansible/inventory/manager.py | Python | gpl-3.0 | 23,570 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.