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 |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from openerp.osv import fields, osv
from datetime import datetime
from openerp.tools.translate import _
import openerp.addons.decimal_precision as dp
from openerp.exceptions import UserError
class mrp_repair(osv.osv):
... | angelapper/odoo | addons/mrp_repair/mrp_repair.py | Python | agpl-3.0 | 35,968 |
# Factories are self documenting
# pylint: disable=missing-docstring
import json
from functools import partial
import factory
from django.test.client import RequestFactory
from factory.django import DjangoModelFactory
from opaque_keys.edx.keys import CourseKey
from opaque_keys.edx.locator import CourseLocator
from co... | philanthropy-u/edx-platform | lms/djangoapps/courseware/tests/factories.py | Python | agpl-3.0 | 5,195 |
# 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 PyPyyaml(PythonPackage):
"""PyYAML is a YAML parser and emitter for Python."""
homepa... | LLNL/spack | var/spack/repos/builtin/packages/py-pyyaml/package.py | Python | lgpl-2.1 | 2,663 |
"""
The B{0install whatchanged} command-line interface.
"""
# Copyright (C) 2012, Thomas Leonard
# See the README file for details, or visit http://0install.net.
from __future__ import print_function
import os
from zeroinstall import _, SafeException
from zeroinstall.cmd import UsageError
syntax = "APP-NAME"
def ... | timdiels/0install | zeroinstall/cmd/whatchanged.py | Python | lgpl-2.1 | 2,814 |
# -*- coding: utf-8 -*-
"""
odict
~~~~~
This module is an example implementation of an ordered dict for the
collections module. It's not written for performance (it actually
performs pretty bad) but to show how the API works.
Questions and Answers
=====================
Why would any... | tlangerak/Multi-Agent-Systems | spade/odict.py | Python | lgpl-2.1 | 10,695 |
#! /usr/bin/env python
"""Super-fast, efficiently stored Trie for Python."""
import os
import sys
from setuptools import setup, Extension
from setuptools.command.test import test as TestCommand
LIBDATRIE_DIR = 'libdatrie/datrie'
LIBDATRIE_FILE_NAMES = [
'alpha-map.c', 'darray.c', 'fileutils.c', 'tail.c', 'trie.c... | hickford/datrie | setup.py | Python | lgpl-2.1 | 2,391 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'pilas/data/tutoriales.ui'
#
# Created: Fri Feb 21 18:52:31 2014
# by: PyQt4 UI code generator 4.10.3
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8... | apehua/pilas | pilas/tutoriales_base.py | Python | lgpl-3.0 | 2,672 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# 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
# no... | gyang/horizon | horizon/dashboards/nova/images_and_snapshots/snapshots/forms.py | Python | apache-2.0 | 2,323 |
# Copyright 2012, Nachi Ueno, NTT MCL, Inc.
# Copyright 2013, Big Switch Networks, 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... | sandvine/horizon | openstack_dashboard/dashboards/project/routers/views.py | Python | apache-2.0 | 9,121 |
"""
Sensors of a KNX Device.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/knx/
"""
from enum import Enum
import logging
import voluptuous as vol
from homeassistant.const import (
CONF_NAME, CONF_MAXIMUM, CONF_MINIMUM,
CONF_TYPE, TEMP_CELSIUS
... | MungoRae/home-assistant | homeassistant/components/sensor/knx.py | Python | apache-2.0 | 5,476 |
"""
CrowdKernel algorithm of the Online Learning Library for Next.Discovery
author: Lalit Jain, kevin.g.jamieson@gmail.com
last updated: 4/22/2015
"""
import numpy
import numpy.random
from apps.PoolBasedTripletMDS.algs.CrowdKernel import utilsCrowdKernel
import time
class CrowdKernel:
def initExp(self,butler,n,d,f... | sumeetsk/NEXT-1 | apps/PoolBasedTripletMDS/algs/CrowdKernel/CrowdKernel.py | Python | apache-2.0 | 5,533 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 Nicira, 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/lic... | qwefi/nova | nova/tests/api/openstack/compute/contrib/test_neutron_security_groups.py | Python | apache-2.0 | 34,999 |
# Copyright 2012 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
#
# Unless requ... | fengbeihong/tempest_automate_ironic | tempest/api/volume/test_volumes_get.py | Python | apache-2.0 | 6,313 |
#! /usr/bin/env python
import sys
import os
import subprocess
includeos_src = os.environ.get('INCLUDEOS_SRC',
os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__file__))).split('/test')[0])
sys.path.insert(0,includeos_src)
from vmrunner import vmrunner
# Get an auto-created V... | ingve/IncludeOS | test/fs/integration/ide_write/test.py | Python | apache-2.0 | 663 |
# 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... | dmlc/tvm | python/tvm/topi/hexagon/conv2d.py | Python | apache-2.0 | 973 |
# Copyright (c) 2017 Orange. # All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | stackforge/networking-bagpipe-l2 | networking_bagpipe/objects/bgpvpn.py | Python | apache-2.0 | 15,705 |
#!/usr/bin/env python
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "L... | yajiedesign/mxnet | python/mxnet/__init__.py | Python | apache-2.0 | 3,631 |
# Copyright 2014 Rackspace, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | devananda/ironic | ironic/common/network.py | Python | apache-2.0 | 1,491 |
from django.conf.urls import patterns, include, url
from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
### #FIXME admin.autodiscover()
import views as htcondor_views
#from ..api.htcondorapi import views as htcondorapi_views
urlpatterns = patterns('',
### H... | kiae-grid/panda-bigmon-core | core/htcondor/urls.py | Python | apache-2.0 | 526 |
#
# 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... | DinoCow/airflow | airflow/providers/amazon/aws/operators/cloud_formation.py | Python | apache-2.0 | 3,375 |
import web
import sys, os
from twisted.python import log
from twisted.internet import defer, reactor
def main(config_file):
log.startLogging(sys.stdout)
application = web.Application... | fiorix/cyclone | appskel/foreman/modname/main.py | Python | apache-2.0 | 820 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2010 British Broadcasting Corporation and Kamaelia Contributors(1)
#
# (1) Kamaelia Contributors are listed in the AUTHORS file and at
# http://www.kamaelia.org/AUTHORS - please extend this file,
# not this notice.
#
# Licensed under the Apache License,... | sparkslabs/kamaelia_ | Sketches/JL/IRC/plainPython/client.py | Python | apache-2.0 | 2,730 |
#!/usr/bin/env python3
# author: @netmanchris
# This section imports required libraries
import json
import requests
HEADERS = {'Accept': 'application/json', 'Content-Type':
'application/json', 'Accept-encoding': 'application/json'}
#auth = None
"""
This section contains functions which operate at the system... | HPNetworking/HP-Intelligent-Management-Center | build/lib/pyhpeimc/plat/device.py | Python | apache-2.0 | 23,430 |
#
# 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... | Acehaidrey/incubator-airflow | tests/providers/microsoft/azure/hooks/test_azure_cosmos.py | Python | apache-2.0 | 10,134 |
#!/usr/bin/python
#
# Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
#
import sys
import argparse
import ConfigParser
from vnc_api.vnc_api import *
class EncapsulationProvision(object):
def __init__(self, args_str=None):
self._args = None
if not args_str:
args_str = '... | aranjan7/contrail-controller-aranjan | src/config/utils/provision_encap.py | Python | apache-2.0 | 5,187 |
# 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... | odejesush/tensorflow | tensorflow/python/ops/gradients_test.py | Python | apache-2.0 | 23,474 |
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2020 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See https://swift.org/LICENSE.txt for license information
# See https://swift.org/CONTRIBUTORS.txt for the list o... | aschwaighofer/swift | utils/build_swift/tests/build_swift/test_cache_utils.py | Python | apache-2.0 | 3,309 |
"""Test Z-Wave node entity."""
import unittest
from unittest.mock import patch, MagicMock
import tests.mock.zwave as mock_zwave
import pytest
from homeassistant.components.zwave import node_entity, const
from homeassistant.const import ATTR_ENTITY_ID
async def test_maybe_schedule_update(hass, mock_openzwave):
"""... | joopert/home-assistant | tests/components/zwave/test_node_entity.py | Python | apache-2.0 | 18,310 |
"""This is the **second** application used as example in
:doc:`/dev/lets/index`.
"""
| lino-framework/book | lino_book/projects/lets2/__init__.py | Python | bsd-2-clause | 86 |
# -*- test-case-name: vumi.transports.cellulant.tests.test_cellulant_sms -*-
import json
from urllib import urlencode
from twisted.internet.defer import inlineCallbacks
from vumi.utils import http_request_full
from vumi import log
from vumi.config import ConfigDict, ConfigText
from vumi.transports.httprpc import Htt... | TouK/vumi | vumi/transports/cellulant/cellulant_sms.py | Python | bsd-3-clause | 3,968 |
""" Defines the DataLabelTool class.
"""
# Major library imports
from numpy import array, asarray, argmin, sqrt
# Enthought library imports
from traits.api import Any, Bool, Enum
from enable.tools.drag_tool import DragTool
class DataLabelTool(DragTool):
""" A tool for dragging a data label.
Attach this tool... | ContinuumIO/chaco | chaco/tools/data_label_tool.py | Python | bsd-3-clause | 3,421 |
"""
oauthlib.openid.connect.core.endpoints.userinfo
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This module is an implementation of userinfo endpoint.
"""
import json
import logging
from oauthlib.common import Request
from oauthlib.oauth2.rfc6749 import errors
from oauthlib.oauth2.rfc6749.endpoints.base imp... | idan/oauthlib | oauthlib/openid/connect/core/endpoints/userinfo.py | Python | bsd-3-clause | 3,847 |
#!/usr/bin/env python
from distutils.core import setup
setup(name='Ajax Select',
version='1.0',
description='Django-jQuery jQuery-powered auto-complete fields for ForeignKey and ManyToMany fields',
author='Crucial Felix',
author_email='crucialfelix@gmail.com',
url='http://code.google.com... | Ksynko/django-crm | sample_project/external_apps/ajax_select/setup.py | Python | bsd-3-clause | 387 |
"""
Tools for different procedure estimations
"""
__author__ = "Luc Anselin luc.anselin@asu.edu, \
Pedro V. Amaral pedro.amaral@asu.edu, \
David C. Folch david.folch@asu.edu, \
Daniel Arribas-Bel darribas@asu.edu"
import numpy as np
from scipy import sparse as SP
import scipy.optimi... | chhao91/pysal | pysal/spreg/utils.py | Python | bsd-3-clause | 24,433 |
from __future__ import absolute_import, print_function
import logging
logger = logging.getLogger(__file__)
from six import add_metaclass, iteritems
from .properties import Any, HasProps, List, MetaHasProps, Instance, String
from .query import find
from .exceptions import DataIntegrityException
from .util.serializati... | srinathv/bokeh | bokeh/plot_object.py | Python | bsd-3-clause | 11,126 |
# Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Denis Engemann <denis.engemann@gmail.com>
# Martin Luessi <mluessi@nmr.mgh.harvard.edu>
# Eric Larson <larson.eric.d@gmail.com>
# Cathy Nangini <cnangini@gmail.com>
# Mainak Jas <mainak@neuro.hut.fi>
#... | jniediek/mne-python | mne/viz/tests/test_misc.py | Python | bsd-3-clause | 5,345 |
from .component import Component
import basic
import c
| pemryan/f2py | srcgen/api.py | Python | bsd-3-clause | 56 |
from __future__ import unicode_literals
import codecs
import datetime
from decimal import Decimal
import locale
try:
from urllib.parse import quote
except ImportError: # Python 2
from urllib import quote
import warnings
from django.utils.functional import Promise
from django.utils import six
class Django... | blaze33/django | django/utils/encoding.py | Python | bsd-3-clause | 9,166 |
#
# file: multiprocessing.py
# author: Mark Erb
#
class Job:
""" abstract job class """
def __init__(self, type, name):
""" constructor """
self.__name = name
self.__type = type
def getName(self):
""" return the name connected with the job """
return self.__name
def getType(se... | fmaschler/networkit | networkit/profiling/job.py | Python | mit | 485 |
import functools
import logging
import os
import random
import sys
import time
from gym import error
logger = logging.getLogger(__name__)
def utf8(value):
if isinstance(value, unicode) and sys.version_info < (3, 0):
return value.encode('utf-8')
else:
return value
def file_size(f):
return... | xpharry/Udacity-DLFoudation | tutorials/reinforcement/gym/gym/scoreboard/client/util.py | Python | mit | 1,383 |
# Copyright (c) 2013 Alan McIntyre
import httplib
import json
import decimal
import re
decimal.getcontext().rounding = decimal.ROUND_DOWN
exps = [decimal.Decimal("1e-%d" % i) for i in range(16)]
btce_domain = "btc-e.com"
all_currencies = ("btc", "usd", "rur", "ltc", "nmc", "eur", "nvc",
"trc", "pp... | blorenz/btce-api | btceapi/common.py | Python | mit | 5,264 |
# -*- encoding: utf-8 -*-
#
# Copyright (c) 2013 Paul Tagliamonte <paultag@debian.org>
# Copyright (c) 2013 Bob Tolbert <bob@tolbert.org>
#
# 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 wit... | paultag/hy | hy/errors.py | Python | mit | 4,271 |
import requests
from allauth.socialaccount.providers.base import ProviderException
from allauth.socialaccount.providers.oauth2.views import (
OAuth2Adapter,
OAuth2CallbackView,
OAuth2LoginView,
)
from .provider import DataportenProvider
class DataportenAdapter(OAuth2Adapter):
provider_id = Dataporte... | bittner/django-allauth | allauth/socialaccount/providers/dataporten/views.py | Python | mit | 2,476 |
# -*- coding: UTF-8 -*-
import gettext
import locale
import os
from Tools.Directories import SCOPE_LANGUAGE, resolveFilename
class Language:
def __init__(self):
gettext.install('enigma2', resolveFilename(SCOPE_LANGUAGE, ""), unicode=0, codeset="utf-8")
gettext.bindtextdomain("enigma2", resolveFilename(SCOPE_LANG... | ACJTeam/enigma2 | lib/python/Components/Language.py | Python | gpl-2.0 | 5,188 |
from gettext import gettext as _
SECTION_ROOT = 'puppet'
DESC_ROOT = _('manage Puppet bindings')
def ensure_puppet_root(cli):
"""
Verifies that the root of puppet-related commands exists in the CLI,
creating it using constants from this module if it does not.
:param cli: CLI instance being configure... | ammaritiz/pulp_puppet | pulp_puppet_extensions_consumer/pulp_puppet/extensions/consumer/structure.py | Python | gpl-2.0 | 635 |
# repo.py
# DNF Repository objects.
#
# Copyright (C) 2013-2015 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program i... | shaded-enmity/dnf | dnf/repo.py | Python | gpl-2.0 | 27,545 |
""" Python Character Mapping Codec generated from 'CP866.TXT'.
Written by Marc-Andre Lemburg (mal@lemburg.com).
(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
"""#"
import codecs
### Codec APIs
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(in... | atmark-techno/atmark-dist | user/python/Lib/encodings/cp866.py | Python | gpl-2.0 | 7,002 |
# Copyright 2010-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
from __future__ import unicode_literals
import io
import tempfile
import portage
from portage import os, shutil, _encodings
from portage.const import USER_CONFIG_PATH
from portage.dep import Atom
from portage.p... | ptisserand/portage | pym/portage/tests/ebuild/test_config.py | Python | gpl-2.0 | 10,679 |
# 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 t... | ctrlaltdel/neutrinator | vendor/openstack/tests/functional/cloud/test_identity.py | Python | gpl-3.0 | 10,600 |
"""
This integration tests will perform basic operations on a storage element, depending on which protocols are available.
It creates a local hierarchy, and then tries to upload, download, remove, get metadata etc
Potential problems:
* it might seem a good idea to simply add tests for the old srm in it. It is not :-)
... | fstagni/DIRAC | tests/Integration/Resources/Storage/Test_Resources_GFAL2StorageBase.py | Python | gpl-3.0 | 14,328 |
from Estructura import espaceado
from Instrucciones.Arbol_Sintactico_Abstracto import Arbol_Sintactico_Abstracto
class Condicional:
def __init__(self,expresion,if_lista_controladores,else_lista_controladores=None):
self.expresion = expresion
self.if_lista_controladores = if_lista_controladores
self.else_lista_c... | danmt/NEO | Codigo_Fuente/etapa3/entrega/Instrucciones/Condicional.py | Python | gpl-3.0 | 910 |
# Caolan McNamara caolanm@redhat.com
# a simple email mailmerge component
# manual installation for hackers, not necessary for users
# cp mailmerge.py /usr/lib/libreoffice/program
# cd /usr/lib/libreoffice/program
# ./unopkg add --shared mailmerge.py
# edit ~/.openoffice.org2/user/registry/data/org/openoffice/Office/W... | beppec56/core | scripting/source/pyprov/mailmerge.py | Python | gpl-3.0 | 17,916 |
import json
import re
from .common import InfoExtractor
class TEDIE(InfoExtractor):
_VALID_URL=r'''http://www\.ted\.com/
(
((?P<type_playlist>playlists)/(?P<playlist_id>\d+)) # We have a playlist
|
((?P<type_talk>talks)) #... | xiaokangwang/KKWebVideoDL-X | youtube_dl/extractor/ted.py | Python | gpl-3.0 | 4,024 |
#!/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... | zengenti/ansible | lib/ansible/modules/cloud/amazon/aws_kms.py | Python | gpl-3.0 | 11,285 |
######################## BEGIN LICENSE BLOCK ########################
# The Original Code is Mozilla Communicator client code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Ri... | adam111316/SickGear | lib/chardet/langgreekmodel.py | Python | gpl-3.0 | 12,867 |
"""
Script to process pytest warnings output by pytest-json-report plugin and output it as a html
"""
from __future__ import absolute_import
from __future__ import print_function
import json
import os
import io
import re
import argparse
from collections import Counter
import pandas as pd
from write_to_html import (
... | edx-solutions/edx-platform | openedx/core/process_warnings.py | Python | agpl-3.0 | 9,556 |
#!/usr/bin/python
import Sofa
import Flexible.IO
import sys,os
datadir=os.path.dirname(os.path.realpath(__file__))+"/data/"
nbFrames = 10
nbGaussPoints = 1
file_Dof= datadir + "dofs.py"
file_SF= datadir + "SF.py"
file_GP= datadir + "GP.py"
# scene creation method
def createScene(rootNode):
rootNode.createObject('... | FabienPean/sofa | applications/plugins/Flexible/examples/IO/saveSimu.py | Python | lgpl-2.1 | 4,119 |
# Copyright 2016 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | dhermes/gcloud-python | logging/tests/unit/test_sink.py | Python | apache-2.0 | 12,160 |
# Copyright (c) 2010-2012 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 agree... | psachin/swift | swift/common/manager.py | Python | apache-2.0 | 26,766 |
#
# 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... | spektom/incubator-airflow | airflow/providers/google/marketing_platform/operators/search_ads.py | Python | apache-2.0 | 7,440 |
"""
mbed SDK
Copyright (c) 2011-2016 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 law or agreed to in writin... | svastm/mbed | tools/export/codered.py | Python | apache-2.0 | 1,779 |
from django.contrib import admin
from biz.network.models import Network, Subnet, Router
class NetworkAdmin(admin.ModelAdmin):
list_display = ("id", "name", "is_default")
class SubnetAdmin(admin.ModelAdmin):
list_display = ("id", "name", "address", "ip_version")
class RouterAdmin(admin.ModelAdmin):
l... | zhanghui9700/eonboard | eoncloud_web/biz/network/admin.py | Python | apache-2.0 | 487 |
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2008,2009,2010,2013 Contributor
#
# 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 Li... | stdweird/aquilon | upgrade/1.4.5/aquilon/aqdb/model/machine_specs.py | Python | apache-2.0 | 4,639 |
# The Adafruit16CServoDriver API is supported through Jython
servo1 = Runtime.createAndStart("servo1", "Servo")
pwm = Runtime.createAndStart("pwm", "Adafruit16CServoDriver")
pwm.connect("COM12")
# attach servo1 to pin 0 on the servo driver
pwm.attach(servo1, 0)
servo1.broadcastState()
servo1.moveTo(0)
sleep(1... | sujitbehera27/MyRoboticsProjects-Arduino | src/resource/Python/examples/Adafruit16CServoDriver.py | Python | apache-2.0 | 529 |
# Copyright 2018-present Facebook, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | brettwooldridge/buck | scripts/artificialproject/file_path_generator.py | Python | apache-2.0 | 7,481 |
from unittest import TestCase
from tweepy.utils import *
class TweepyUtilsTests(TestCase):
def testparse_datetime(self):
result = parse_datetime("Wed Aug 27 13:08:45 +0000 2008")
self.assertEqual(datetime(2008, 8, 27, 13, 8, 45), result)
def testlist_to_csv(self):
self.assertEqual("1... | ralstonJ/Angelhack-Rumble | tweepy-master/tests/test_utils.py | Python | apache-2.0 | 470 |
from __future__ import absolute_import
from typing import Any
# This file needs to be different from cache.py because cache.py
# cannot import anything from zerver.models or we'd have an import
# loop
from django.conf import settings
from zerver.models import Message, UserProfile, Stream, get_stream_cache_key, \
R... | peiwei/zulip | zerver/lib/cache_helpers.py | Python | apache-2.0 | 4,504 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2012, Nachi Ueno, NTT MCL, 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://ww... | Brocade-OpenSource/OpenStack-DNRM-Neutron | neutron/db/securitygroups_rpc_base.py | Python | apache-2.0 | 12,867 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# king_phisher/client/widget/managers.py
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# n... | securestate/king-phisher | king_phisher/client/widget/managers.py | Python | bsd-3-clause | 17,478 |
# 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 con... | schelleg/PYNQ | pynq/lib/logictools/tests/test_boolean_generator.py | Python | bsd-3-clause | 14,127 |
from __future__ import absolute_import
from django.core.urlresolvers import reverse
from django.template.response import TemplateResponse
from django.test import TestCase
from django.test.utils import override_settings
from .models import Action
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1... | lzw120/django | tests/regressiontests/admin_custom_urls/tests.py | Python | bsd-3-clause | 3,056 |
from django.core.urlresolvers import reverse
from django.http import HttpResponse, HttpResponseRedirect, Http404
def no_permissions_redirect(request):
np_page = reverse('no_permissions')
return HttpResponseRedirect(np_page) if request.method == 'GET' else HttpResponse("Missing qualifications")
def check_and_... | puttarajubr/commcare-hq | corehq/apps/orgs/decorators.py | Python | bsd-3-clause | 1,343 |
from django.contrib.gis.db.models.functions import (
Area, Distance, Length, Perimeter, Transform,
)
from django.contrib.gis.geos import GEOSGeometry, LineString, Point
from django.contrib.gis.measure import D # alias for Distance
from django.db import connection
from django.db.models import F, Q
from django.test ... | Beauhurst/django | tests/gis_tests/distapp/tests.py | Python | bsd-3-clause | 24,141 |
"""Generic wrapper for read-eval-print-loops, a.k.a. interactive shells
"""
import os.path
import signal
import sys
import re
import pexpect
PY3 = (sys.version_info[0] >= 3)
if PY3:
def u(s): return s
basestring = str
else:
def u(s): return s.decode('utf-8')
PEXPECT_PROMPT = u('[PEXPECT_PROMPT>')
PEXPEC... | Wakeupbuddy/pexpect | pexpect/replwrap.py | Python | isc | 4,604 |
from kivy.uix.widget import Widget
class MyWidget(Widget):
def __init__(self, **kwargs):
super(MyWidget, self).__init__(**kwargs)
def callback(*l):
self.x = self.y
self.fbind('y', callback)
callback()
| matham/kivy | kivy/tests/pyinstaller/simple_widget/project/widget.py | Python | mit | 253 |
# -*- coding: utf-8 -*-
__title__ = 'subliminal'
__version__ = '2.1.0'
__short_version__ = '.'.join(__version__.split('.')[:2])
__author__ = 'Antoine Bertin'
__license__ = 'MIT'
__copyright__ = 'Copyright 2016, Antoine Bertin'
import logging
from .core import (AsyncProviderPool, ProviderPool, check_video, download_be... | Diaoul/subliminal | subliminal/__init__.py | Python | mit | 818 |
#!/usr/bin/env python
# This script is used for verify HOMEPAGE.
# The result is influenced by network environment, since the timeout of connect url is 5 seconds as default.
import sys
import os
import subprocess
import urllib2
def search_bitbakepath():
bitbakepath = ""
# Search path to bitbake lib dir in o... | wwright2/dcim3-angstrom1 | sources/openembedded-core/scripts/contrib/verify-homepage.py | Python | mit | 2,175 |
import re
import logging
import csv
import os
from StringIO import StringIO
from projects.exceptions import ProjectImportError
from vcs_support.backends.github import GithubContributionBackend
from vcs_support.base import BaseVCS, VCSVersion
log = logging.getLogger(__name__)
class Backend(BaseVCS):
supports_tag... | dirn/readthedocs.org | readthedocs/vcs_support/backends/git.py | Python | mit | 6,947 |
def cartesian_product(sequences):
# This isn't actually a proper cartesian product because we
# concatenate lists, rather than forming sequences of atomic elements.
if not sequences:
yield []
else:
temp = list(cartesian_product(sequences[1:]))
for item in sequences[0]:
for sequence in temp:
... | thierry1985/project-1022 | translate/tools.py | Python | mit | 1,267 |
# flake8: noqa
from __future__ import absolute_import
# This will make sure the celery app is always imported when
# Django starts so that tasks can use this celery app.
# Without this Django wouldn't know which celery app to use.
# See http://celery.readthedocs.org/en/latest/django/first-steps-with-django.html
from .... | aksh1/wagtail-cookiecutter-foundation | {{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/__init__.py | Python | mit | 352 |
# This file is part of beets.
# Copyright 2015, Adrian Sampson.
#
# 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, ... | Dishwishy/beets | beets/ui/__init__.py | Python | mit | 40,331 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2013, 2014 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) any... | quantifiedcode-bot/invenio-deposit | invenio_deposit/autocomplete_utils.py | Python | gpl-2.0 | 3,068 |
#!/usr/bin/env python2
#
# Copyright (C) 2013-2017(H)
# Max Planck Institute for Polymer Research
#
# This file is part of ESPResSo++.
#
# ESPResSo++ 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,... | govarguz/espressopp | testsuite/pickle_potential/pickle_potential.py | Python | gpl-3.0 | 1,526 |
#!/usr/bin/env python3
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
# This file is part of qutebrowser.
#
# qutebrowser is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as pub... | toofar/qutebrowser | tests/unit/scripts/test_check_coverage.py | Python | gpl-3.0 | 6,650 |
"""Manage HTTP servers with CherryPy."""
import warnings
import cherrypy
from cherrypy.lib import attributes
from cherrypy._cpcompat import basestring
# We import * because we want to export check_port
# et al as attributes of this module.
from cherrypy.process.servers import *
class Server(ServerAdapter):
"""... | 2mny/mylar | lib/cherrypy/_cpserver.py | Python | gpl-3.0 | 7,535 |
# (c) 2016, Charles Paul <cpaul@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 version 3 of the License, or
# (at your option) any later versio... | hkariti/ansible | lib/ansible/utils/module_docs_fragments/vca.py | Python | gpl-3.0 | 2,634 |
# -*- coding: utf-8 -*-
#
# Copyright (C) Pootle contributors.
#
# This file is a part of the Pootle project. It is distributed under the GPL3
# or later license. See the LICENSE file for a copy of the license and the
# AUTHORS file for copyright and authorship information.
from datetime import timedelta
import pytes... | unho/pootle | tests/pootle_profile/profile.py | Python | gpl-3.0 | 2,638 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright: (c) 2018, Bojan Vitnik <bvitnik@mainstream.rs>
# 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_versi... | pdellaert/ansible | lib/ansible/modules/cloud/xenserver/xenserver_guest.py | Python | gpl-3.0 | 97,865 |
"""
this example shows how to freeze degrees of freedom using the Lennard Jones potential as
an example
"""
import numpy as np
from pele.potentials import LJ, FrozenPotentialWrapper
from pele.optimize import mylbfgs
def main():
natoms = 4
pot = LJ()
reference_coords = np.random.uniform(-1, 1, [3 * natoms... | khs26/pele | examples/frozen_degrees_of_freedom/frozen_lj.py | Python | gpl-3.0 | 1,133 |
# -*- coding: utf-8 -*-
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
import frappe
import unittest
class TestSoilTexture(unittest.TestCase):
def test_texture_selection(self):
soil_tex = frappe.get_all('Soil Texture', fields=['name'],... | indictranstech/erpnext | erpnext/agriculture/doctype/soil_texture/test_soil_texture.py | Python | agpl-3.0 | 518 |
# 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 RCircstats(RPackage):
"""Circular Statistics, from "Topics in Circular Statistics" (2001)
... | LLNL/spack | var/spack/repos/builtin/packages/r-circstats/package.py | Python | lgpl-2.1 | 898 |
# 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... | sandeepdsouza93/TensorFlow-15712 | tensorflow/python/ops/state_ops.py | Python | apache-2.0 | 6,803 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the ... | cloudant/couchdb-mango | test/06-text-default-field-test.py | Python | apache-2.0 | 2,174 |
# -*- coding: utf-8 -*-
import datetime
import json
import subprocess
from contextlib import nested
import mock
from jira.exceptions import JIRAError
from elastalert.alerts import BasicMatchString
from elastalert.alerts import CommandAlerter
from elastalert.alerts import EmailAlerter
from elastalert.alerts import Jir... | megancarney/elastalert | tests/alerts_test.py | Python | apache-2.0 | 19,021 |
# Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: anze@reciprocitylabs.com
# Maintained By: anze@reciprocitylabs.com
"""pop sample evidence document joins
Revision ID: 307bd54ac651
Revises: 2814f1... | prasannav7/ggrc-core | src/ggrc/migrations/versions/20131009115538_307bd54ac651_pop_sample_evidence.py | Python | apache-2.0 | 2,175 |
#
# Copyright 2015 Ram Sriharsha
#
# 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, ... | YanjieGao/magellan | python/__init__.py | Python | apache-2.0 | 626 |
# -*- coding: utf-8 -*-
###############################################################################
#
# ListPlaylistsByID
# Returns a collection of playlists that match the provided IDs.
#
# Python versions 2.6, 2.7, 3.x
#
# Copyright 2014, Temboo Inc.
#
# Licensed under the Apache License, Version 2.0 (the "Licen... | jordanemedlock/psychtruths | temboo/core/Library/YouTube/Playlists/ListPlaylistsByID.py | Python | apache-2.0 | 6,403 |
#!/usr/bin/env python
'''
ansible module for zabbix triggers
'''
# vim: expandtab:tabstop=4:shiftwidth=4
#
# Zabbix trigger ansible module
#
#
# Copyright 2015 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.
# ... | menren/openshift-ansible | roles/lib_zabbix/library/zbx_trigger.py | Python | apache-2.0 | 8,027 |
# Copyright 2011 Justin Santa Barbara
# 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 requ... | yosshy/nova | nova/tests/functional/test_login.py | Python | apache-2.0 | 1,197 |
def f(x):
"""
Returns:
object:
"""
return 42 | amith01994/intellij-community | python/testData/intentions/afterReturnTypeInNewGoogleDocString.py | Python | apache-2.0 | 68 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.