code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
from configure import Configuration, ConfigurationError
from ksgen import docstring, yaml_utils, utils
from ksgen.tree import OrderedTree
from ksgen.yaml_utils import LookupDirective
from docopt import docopt, DocoptExit
import logging
import os
import re
import yaml
VALUES_KEY = '!value'
DEFAULTS_TAG = 'defaults'
lo... | tkammer/infrared | tools/ksgen/ksgen/settings.py | Python | gpl-3.0 | 15,945 |
# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2016 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <https://weblate.org/>
#
# 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, eith... | jitka/weblate | weblate/trans/admin_views.py | Python | gpl-3.0 | 7,747 |
"""Implements VarnishInfo Class for gathering stats from Varnish Cache.
The statistics are obtained by running the command varnishstats.
"""
import re
import util
__author__ = "Ali Onur Uyar"
__copyright__ = "Copyright 2011, Ali Onur Uyar"
__credits__ = []
__license__ = "GPL"
__version__ = "0.9.24"
__maintainer__ =... | Elbandi/PyMunin | pysysinfo/varnish.py | Python | gpl-3.0 | 2,163 |
# This file is part of Indico.
# Copyright (C) 2002 - 2016 European Organization for Nuclear Research (CERN).
#
# Indico 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 (a... | belokop/indico_bare | indico/web/fields/__init__.py | Python | gpl-3.0 | 1,263 |
# -*- coding: utf-8 -*-
import re
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class EuroshareEu(SimpleHoster):
__name__ = "EuroshareEu"
__type__ = "hoster"
__version__ = "0.27"
__pattern__ = r'http://(?:www\.)?euroshare\.(eu|sk|cz|hu|pl)/file/.+'
__descr... | immenz/pyload | module/plugins/hoster/EuroshareEu.py | Python | gpl-3.0 | 2,309 |
import logging
from dao import DAO, TableDesc, FieldDesc
log = logging.getLogger(__name__)
card_td = TableDesc("Cards", "multiverseid",
[FieldDesc("multiverseid", "int"),
FieldDesc("set_code", "text"),
FieldDesc("number", "int"),
Fiel... | nuxgu/magic_db | sqldb/card_dao.py | Python | gpl-3.0 | 1,343 |
# -*- coding: utf-8 -*-
# This file is part of emesene.
#
# emesene 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.
#
#... | tiancj/emesene | emesene/e3/common/utils.py | Python | gpl-3.0 | 2,941 |
import bpy
# from math import pi, sin, cos
# from bpy_extras.view3d_utils import location_3d_to_region_2d
# from bgl import glEnable, glDisable, glBegin, glEnd, glVertex2f, glVertex3f, glColor4f, glLineWidth, GL_LINE_STRIP, GL_LINE_STIPPLE, GL_BLEND, GL_LINE_LOOP, GL_POLYGON
# from fashion_project.modules.utils impor... | TriumphLLC/FashionProject | modules/operators/wires/basic.py | Python | gpl-3.0 | 916 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('ideas', '0002_auto_20150314_1917'),
]
operations = [
migrations.AlterField(
mod... | benhoff/ava | src/ideas/migrations/0003_auto_20150314_2006.py | Python | gpl-3.0 | 502 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "Raspberry.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that th... | CodeHuntersLab/RaspberryPi | WEB/Raspberry/manage.py | Python | gpl-3.0 | 807 |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2014-2021 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 published by
# the Free S... | fiete201/qutebrowser | qutebrowser/utils/__init__.py | Python | gpl-3.0 | 830 |
../../../../../../../share/pyshared/orca/scripts/toolkits/CALLY/script.py | Alberto-Beralix/Beralix | i386-squashfs-root/usr/lib/python2.7/dist-packages/orca/scripts/toolkits/CALLY/script.py | Python | gpl-3.0 | 73 |
#! /usr/bin/env python2
############################################################################
#
# Copyright (C) 2016 The Qt Company Ltd.
# Contact: https://www.qt.io/licensing/
#
# This file is part of Qt Creator.
#
# Commercial License Usage
# Licensees holding valid commercial Qt licenses may use this file in... | pivonroll/Qt_Creator | scripts/dependencyinfo.py | Python | gpl-3.0 | 8,279 |
# -*- coding: utf-8 -*-
import json
from .common import CatmaidApiTestCase
class StacksApiTests(CatmaidApiTestCase):
def test_stack_info(self):
self.fake_authentication()
test_stack_id = 3
response = self.client.get('/%d/stack/%d/info' % (self.test_project_id, test_stack_id))
se... | tomka/CATMAID | django/applications/catmaid/tests/apis/test_stacks.py | Python | gpl-3.0 | 2,238 |
import deck
class Hand:
def __init__(self):
self.cards = []
def add(self, card):
self.cards.append(card)
def size(self):
return len(self.cards)
def score(self):
# sperate cards into aces and others
regular_cards = [c for c in self.cards if c.value != "A"]
... | chrfrantz/op-papers | oosd/week02/blackjack/hand.py | Python | gpl-3.0 | 952 |
__author__ = 'ronalddekker'
# imports
from xml.dom.pulldom import START_ELEMENT, parse
from xml.dom.minidom import NamedNodeMap
def segmentate_xml_file(xml_file):
# parse the file, XML event after XML event
# NOTE: the variable name 'doc' is not optimal (the variable is only a pointer to a stream of events)
... | DiXiT-eu/collatex-tutorial | unit8/sydney-material/integration/xml_segmentation.py | Python | gpl-3.0 | 1,298 |
#!/usr/bin/env python
# encoding: utf-8
# Christoph Koke, 2013
"""
Writes the c and cpp compile commands into build/compile_commands.json
see http://clang.llvm.org/docs/JSONCompilationDatabase.html
Usage:
def configure(conf):
conf.load('compiler_cxx')
...
conf.load('clang_compilation_databa... | o2gy84/libproperty | src/clang_compilation_database.py | Python | gpl-3.0 | 3,027 |
# coding=utf-8
from __future__ import unicode_literals
from frappe import _
def get_data():
return [
{
"module_name": "Item",
"_doctype": "Item",
"color": "#f39c12",
"icon": "octicon octicon-package",
"type": "link",
"link": "List/Item"
},
{
"module_name": "Customer",
"_doctype": "Custo... | adityaduggal/erpnext | erpnext/config/desktop.py | Python | gpl-3.0 | 11,448 |
# Authors: Rob Crittenden <rcritten@redhat.com>
#
# Copyright (C) 2008 Red Hat
# see file 'COPYING' for use and warranty information
#
# 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 ver... | msimacek/freeipa | ipaserver/install/ldapupdate.py | Python | gpl-3.0 | 33,389 |
"""
Copyright (c) 2012-2020 RockStor, Inc. <http://rockstor.com>
This file is part of RockStor.
RockStor 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 la... | phillxnet/rockstor-core | src/rockstor/scripts/qgroup_clean.py | Python | gpl-3.0 | 2,273 |
# encoding: utf-8
#
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Author: Kyle Lahnakoski (kyle@lahnakoski.com)
#
from __future__ import unicode_literals
from __... | mozilla/ChangeDetector | pyLibrary/queries/containers/__init__.py | Python | mpl-2.0 | 4,498 |
# -*- coding: utf-8 -*-
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import datetime
import json
import click
import click_spinner
import slugid
import cli_common.... | La0/mozilla-relengapi | lib/please_cli/please_cli/decision_task.py | Python | mpl-2.0 | 21,680 |
"""Performance example of running native ASTRA vs using ODL for reconstruction.
In this example, a 512x512 image is reconstructed using the Conjugate Gradient
Least Squares method on the GPU.
In general, ASTRA is faster than ODL since it does not need to perform any
copies and all arithmetic is performed on the GPU. ... | odlgroup/odl | examples/tomo/backends/astra_performance_cuda_parallel_2d_cg.py | Python | mpl-2.0 | 2,904 |
import random
import string
from collection.models import CollectionVersion, Collection
from concepts.models import Concept, ConceptVersion, LocalizedText
from oclapi.models import ACCESS_TYPE_EDIT, ACCESS_TYPE_VIEW
from orgs.models import Organization
from sources.models import Source, SourceVersion
from users.model... | snyaggarwal/oclapi | ocl/test_helper/base.py | Python | mpl-2.0 | 10,616 |
class a(object):
pass
class b(a):
pass
print a.__subclasses__()
class c(a):
pass
print a.__subclasses__() | meatcomputer/opencog | opencog/python/examples/test.py | Python | agpl-3.0 | 121 |
"""Help to make choice"""
# PYTHON STUFFS #######################################################
import random
import shlex
from nemubot import context
from nemubot.exception import IMException
from nemubot.hooks import hook
from nemubot.module.more import Response
# MODULE INTERFACE ############################... | nbr23/nemubot | modules/rnd.py | Python | agpl-3.0 | 1,491 |
"""
Test the roles utils
"""
from __future__ import unicode_literals
from django.contrib.auth.models import Group
from django.core.management import call_command
from django.utils.text import slugify
from guardian.shortcuts import get_perms
from mock import patch
from learningresources.api import create_repo
from le... | mitodl/lore | roles/tests/test_utils.py | Python | agpl-3.0 | 2,672 |
from test_lib.utils import get_data_by_path
class __DEFAULT__: # pylint: disable=invalid-name,too-few-public-methods
pass
class ClassBase:
"""
This class that is meant to be used as base for class that could be stored or loaded (in ES or any other backend)
"""
_es_data_mapping = {}
_data_ty... | scylladb/scylla-cluster-tests | sdcm/results_analyze/base.py | Python | agpl-3.0 | 8,871 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes
def make_test_records(verbose):
from webnotes.test_runner import make_test_objects
accounts = [
# [account_name, parent_account, group_or_ledg... | Yellowen/Owrang | accounts/doctype/account/test_account.py | Python | agpl-3.0 | 1,859 |
# This file is part of Shuup.
#
# Copyright (c) 2012-2021, Shuup Commerce Inc. All rights reserved.
#
# This source code is licensed under the OSL-3.0 license found in the
# LICENSE file in the root directory of this source tree.
# test that admin actually saves catalog
from __future__ import unicode_literals
import d... | shoopio/shoop | shuup_tests/campaigns/test_catalog_campaign_admin.py | Python | agpl-3.0 | 7,668 |
from django.contrib import admin
from account.models import (
Account,
AccountDeletion,
EmailAddress,
PasswordExpiry,
PasswordHistory,
SignupCode,
)
class SignupCodeAdmin(admin.ModelAdmin):
list_display = ["code", "max_uses", "use_count", "expiry", "created"]
search_fields = ["code",... | FreedomCoop/valuenetwork | account/admin.py | Python | agpl-3.0 | 1,314 |
# Copyright 2013-2020 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 RBigmemorySri(RPackage):
"""This package provides a shared resource interface
for t... | iulian787/spack | var/spack/repos/builtin/packages/r-bigmemory-sri/package.py | Python | lgpl-2.1 | 708 |
#!/usr/bin/env python
import logging
LOGGER = logging.getLogger('controller')
USER = 'user'
ROOT = 'root'
ADMIN = 'administrator'
| thomashuang/Lilac | lilac/controller/__init__.py | Python | lgpl-3.0 | 136 |
# Copyright Cartopy Contributors
#
# This file is part of Cartopy and is released under the LGPL license.
# See COPYING and COPYING.LESSER in the root of the repository for full
# licensing details.
from io import BytesIO
import matplotlib.pyplot as plt
import numpy as np
import cartopy.crs as ccrs
def test_empty_... | SciTools/cartopy | lib/cartopy/tests/mpl/test_plots.py | Python | lgpl-3.0 | 917 |
import sys
from services.spawn import MobileTemplate
from services.spawn import WeaponTemplate
from resources.datatables import WeaponType
from resources.datatables import Difficulty
from resources.datatables import Options
from java.util import Vector
def addTemplate(core):
mobileTemplate = MobileTemplate()
mobi... | agry/NGECore2 | scripts/mobiles/naboo/capper_spineflap.py | Python | lgpl-3.0 | 1,610 |
import os
import re
import subprocess
from setuptools import setup, find_packages, Command
try:
with open('projex/_version.py', 'r') as f:
content = f.read()
major = re.search('__major__ = (\d+)', content).group(1)
minor = re.search('__minor__ = (\d+)', content).group(1)
rev = re.s... | ProjexSoftware/projex | setup.py | Python | lgpl-3.0 | 2,436 |
import os, sys, shutil
import zipfile
from zipfile import ZipFile
from urllib import urlretrieve
from subprocess import Popen, PIPE
from distutils.cmd import Command
def zip_directory(dir, zip_file):
zip = ZipFile(zip_file, 'w', compression=zipfile.ZIP_DEFLATED)
root_len = len(os.path.abspath(dir))
... | nuigroup/pymt-widgets | pymt/tools/packaging/win32/build.py | Python | lgpl-3.0 | 6,313 |
# ExergyUtilities
# Copyright (c) 2010, B. Marcus Jones <>
# All rights reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your opt... | MarcusJones/py_ExergyUtilities | ExergyUtilities/util_excel.py | Python | lgpl-3.0 | 7,992 |
import sys
from services.spawn import MobileTemplate
from services.spawn import WeaponTemplate
from resources.datatables import WeaponType
from resources.datatables import Difficulty
from resources.datatables import Options
from java.util import Vector
def addTemplate(core):
mobileTemplate = MobileTemplate()
mobil... | agry/NGECore2 | scripts/mobiles/dathomir/purbole.py | Python | lgpl-3.0 | 1,377 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""
This file is part of cpe package.
This module of is an implementation of name matching
algorithm in accordance with version 2.2 of CPE (Common Platform
Enumeration) specification.
Copyright (C) 2013 Alejandro Galindo García, Roberto Abdelkader Martínez Pérez
This ... | nilp0inter/cpe | cpe/cpeset2_2.py | Python | lgpl-3.0 | 3,512 |
import requests
import json
import cookielib
url = 'https://online-demo.toppatch.com'
api_version = '/api/v1'
api_call = '/agents'
login_uri = '/login'
creds = {'username': 'admin', 'password': 'toppatch'}
session = requests.session()
headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
jar = cookie... | dtklein/vFense | tp/src/scripts/make_api_calls.py | Python | lgpl-3.0 | 650 |
#!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4
from __future__ import absolute_import
from rapidsms.message import Message
from rapidsms.connection import Connection
from . import backend
from email import message_from_string
from django.core.mail import *
class Backend(backend.Backend):
'''Uses the django ... | ewheeler/rapidsms-core | lib/rapidsms/backends/email.py | Python | lgpl-3.0 | 4,516 |
"""Classes that determine convergence of an algorithm run
based on population stagnation or max raw score reached"""
class Convergence(object):
"""
Base class for all convergence object to be based on.
It is necessary to supply the population instance, to be
able to obtain current and former populatio... | suttond/MODOI | ase/ga/convergence.py | Python | lgpl-3.0 | 3,442 |
from __future__ import unicode_literals
import re
from .common import InfoExtractor
class SpankBangIE(InfoExtractor):
_VALID_URL = r'https?://(?:(?:www|[a-z]{2})\.)?spankbang\.com/(?P<id>[\da-z]+)/video'
_TESTS = [{
'url': 'http://spankbang.com/3vvn/video/fantasy+solo',
'md5': '1cc433e1d6aa1... | linglung/ytdl | youtube_dl/extractor/spankbang.py | Python | unlicense | 2,167 |
import base64
import urllib
from io import StringIO
import orjson
from django.conf import settings
from zerver.lib.test_classes import ZulipTestCase
from zerver.lib.test_helpers import (
create_s3_buckets,
get_test_image_file,
override_settings,
use_s3_backend,
)
from zerver.lib.upload import upload_b... | brainwane/zulip | zerver/tests/test_thumbnail.py | Python | apache-2.0 | 17,260 |
# Copyright (C) 2014,2015 VA Linux Systems Japan K.K.
# Copyright (C) 2014,2015 YAMAMOTO Takashi <yamamoto at valinux co jp>
# 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 t... | jerryz1982/neutron | neutron/plugins/openvswitch/agent/openflow/ovs_ofctl/br_tun.py | Python | apache-2.0 | 10,433 |
"""
Copyright 2015 Malte Splietker
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
... | wette/netSLS | network_emulator/rpc_server.py | Python | apache-2.0 | 3,616 |
# Copyright 2014 Diamond Light Source Ltd.
#
# 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 t... | mjn19172/Savu | savu/test/test_utils.py | Python | apache-2.0 | 4,791 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
import os
import cPickle
import WebIDL
from Configuration import *
from Codegen import CGBindingRoot, replaceFileIfChang... | sergecodd/FireFox-OS | B2G/gecko/dom/bindings/BindingGen.py | Python | apache-2.0 | 2,361 |
"""
.. module: bless.ssh.certificate_authorities.rsa_certificate_authority
:copyright: (c) 2016 by Netflix Inc., see AUTHORS for more
:license: Apache, see LICENSE for more details.
"""
from bless.ssh.certificate_authorities.ssh_certificate_authority import \
SSHCertificateAuthority
from bless.ssh.protocol.... | ikben/bless | bless/ssh/certificate_authorities/rsa_certificate_authority.py | Python | apache-2.0 | 2,420 |
import re
import commands
stMap = []
tmpMap = {}
nLog = 30
for i in range(0,nLog):
if i == 0:
out = commands.getoutput('cat /data/sm/prod/httpd/logs/panda-Adder.log')
else:
out = commands.getoutput('zcat /data/sm/prod/httpd/logs/panda-Adder.log.%s.gz' % (nLog-i))
for line in out.spl... | RRCKI/panda-server | pandaserver/test/missing.py | Python | apache-2.0 | 1,267 |
# 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... | shakamunyi/tensorflow | tensorflow/python/kernel_tests/iterator_ops_cluster_test.py | Python | apache-2.0 | 4,391 |
#!/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
"License");... | alexryndin/ambari | ambari-server/src/main/resources/stacks/BigInsights/4.2/services/HBASE/package/scripts/hbase_decommission.py | Python | apache-2.0 | 2,306 |
# 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... | seanli9jan/tensorflow | tensorflow/compiler/tests/resampler_ops_test.py | Python | apache-2.0 | 6,753 |
# Copyright 2011 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... | openstack/nova | nova/api/openstack/compute/keypairs.py | Python | apache-2.0 | 9,891 |
# Copyright 2013 Huawei Technologies Co.,LTD.
#
# 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... | Juniper/tempest | tempest/api/compute/admin/test_hosts_negative.py | Python | apache-2.0 | 6,144 |
from __future__ import print_function, absolute_import, division
import sys
import argparse
from .. import __version__
from . import parser_dump
from . import parser_skeleton
from . import parser_worker
from . import parser_plot
from . import parser_currentbest
def main():
help = 'osprey is a tool for machine l... | rmcgibbo/osprey | osprey/cli/main.py | Python | apache-2.0 | 1,526 |
# Copyright 2020 The HuggingFace Team. 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 applicabl... | huggingface/transformers | examples/legacy/seq2seq/sentence_splitter.py | Python | apache-2.0 | 1,239 |
'''
Created on Oct 7, 2010
@author: jnaous
'''
import re
from django.core.management.base import NoArgsCommand
from expedient.clearinghouse.project.models import Project
from expedient.clearinghouse.geni.gopenflow.models import GCFOpenFlowAggregate
from expedient.clearinghouse.geni.models import GENISliceInfo
try:
... | dana-i2cat/felix | expedient/src/python/expedient/clearinghouse/commands/management/commands/load_openflow_data.py | Python | apache-2.0 | 7,889 |
#
# Copyright (c) 2015 Juniper Networks, Inc. All rights reserved.
#
from gevent import monkey
monkey.patch_all()
import os
import sys
import socket
import subprocess
import json
import time
import datetime
import platform
import gevent
import ConfigParser
from nodemgr.common.event_manager import EventManager
from p... | tcpcloud/contrail-controller | src/nodemgr/analytics_nodemgr/analytics_event_manager.py | Python | apache-2.0 | 2,984 |
from pickle import load
import os
import matplotlib.pyplot as plt
import numpy as np
class Data:
def __init__(self):
self.m_list1 = []
self.m_list2 = []
p = './data/'
m1 = []
m2 = []
for _,_,c in os.walk(p):
for x in c:
print('\n',x,'\n')
f = open(os.path.join(p,x), 'r')
d = load(f)
lm =... | kaslusimoes/SummerSchool2016 | data/Multiple Variation/Scale Free/heatmap.py | Python | apache-2.0 | 712 |
from xyz.location import build_location
def test_build_location_simple():
# test
Location = build_location()
location = Location("Canada", "Charlottetown")
assert location.country == "Canada"
assert location.city == "Charlottetown"
| codetojoy/gists | python/pipenv_jun_2020/tests/test_location.py | Python | apache-2.0 | 257 |
"""Config flow to configure StarLine component."""
from __future__ import annotations
from starline import StarlineAuth
import voluptuous as vol
from homeassistant import config_entries, core
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
from .const import (
_LOGGER,
CONF_APP_ID,
CONF_APP_... | w1ll1am23/home-assistant | homeassistant/components/starline/config_flow.py | Python | apache-2.0 | 8,011 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Cisco Systems, 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... | wallnerryan/quantum_migrate | quantum/plugins/cisco/nexus/cisco_nexus_plugin_v2.py | Python | apache-2.0 | 9,634 |
import traceback
from PyQt5 import QtCore
import androguard.session as session
from androguard.core import androconf
import logging
log = logging.getLogger("androguard.gui")
class FileLoadingThread(QtCore.QThread):
file_loaded = QtCore.pyqtSignal(bool)
def __init__(self, parent=None):
QtCore.QThre... | shuxin/androguard | androguard/gui/fileloading.py | Python | apache-2.0 | 1,625 |
from distutils.core import setup
setup(
name='python-indy-sdk-sample',
version='0.0.1',
url='https://github.com/hyperledger/indy-sdk',
license='MIT/Apache-2.0',
author='Artem Ivanov',
author_email='artem.ivanov@dsr-company.com',
description='This is the sample of usage python wrapper for Hy... | srottem/indy-sdk | samples/python/setup.py | Python | apache-2.0 | 398 |
###############################################################################
##
## Copyright (c) Crossbar.io Technologies GmbH
##
## 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... | crossbario/autobahn-testsuite | autobahntestsuite/autobahntestsuite/case/case9_3_3.py | Python | apache-2.0 | 1,267 |
# Android Device Testing Framework ("dtf")
# Copyright 2013-2016 Jake Valletta (@jake_valletta)
#
# 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
... | jakev/dtf | python-dtf/tests/integration-device/client/test_client_status.py | Python | apache-2.0 | 1,366 |
# written by python 2.*
import urllib2
import string
import os
import re
import sys
from datetime import datetime
from bs4 import BeautifulSoup
import logging
import ssl
import Config
from AllMovies_imdb import upload_data, add_empty_data, get_connections, get_business_of_movie, get_companycredits_of_movie, get_f... | softinus/IMDB_DataMiner | imdb.com/Parse_err.py | Python | apache-2.0 | 3,935 |
#!/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... | machristie/airavata | airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/samples/testAiravataClient.py | Python | apache-2.0 | 1,089 |
# -*- coding: utf-8 -*-
"""Analysis plugin that labels events according to rules in a tagging file."""
from plaso.analysis import interface
from plaso.analysis import manager
from plaso.engine import tagging_file
class TaggingAnalysisPlugin(interface.AnalysisPlugin):
"""Analysis plugin that labels events according... | joachimmetz/plaso | plaso/analysis/tagging.py | Python | apache-2.0 | 2,057 |
#!/usr/bin/env python
"""Mixin tests for storing Foreman rules in the relational db."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from grr_response_core.lib import rdfvalue
from grr_response_server import foreman_rules
from grr.test_lib import test_l... | dunkhong/grr | grr/server/grr_response_server/databases/db_foreman_rules_test.py | Python | apache-2.0 | 2,967 |
#!/usr/bin/env python
# Copyright 2017 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required... | opencord/xos | lib/xos-api/xosapi/chameleon_client/protos/schema_pb2_grpc.py | Python | apache-2.0 | 2,079 |
# Copyright 2017-present Open Networking 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 agr... | opencord/xos | lib/xos-api/xosapi/convenience/privilege.py | Python | apache-2.0 | 815 |
# 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... | NeCTAR-RC/cinder | cinder/tests/integrated/integrated_helpers.py | Python | apache-2.0 | 4,234 |
# 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
# d... | vedujoshi/os_tempest | tempest/common/waiters.py | Python | apache-2.0 | 5,919 |
# Copyright 2014, Doug Wiegley, A10 Networks.
#
# 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 appli... | mdurrant-b3/acos-client | acos_client/v21/slb/template/persistence.py | Python | apache-2.0 | 2,180 |
# Generated by Django 2.2.24 on 2021-10-26 15:29
from django.db import migrations, models
import uuid
class Migration(migrations.Migration):
dependencies = [
('sponsors', '0056_textasset'),
]
operations = [
migrations.AlterField(
model_name='genericasset',
name='... | manhhomienbienthuy/pythondotorg | sponsors/migrations/0057_auto_20211026_1529.py | Python | apache-2.0 | 416 |
#!/usr/bin/env python
# Copyright 2014-2018 The PySCF Developers. 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
#
# U... | gkc1000/pyscf | pyscf/tddft/__init__.py | Python | apache-2.0 | 660 |
# -*- coding: utf-8 -*-
# Copyright 2017 Novo Nordisk Foundation Center for Biosustainability,
# Technical University of Denmark.
#
# 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... | opencobra/memote | src/memote/suite/cli/reports.py | Python | apache-2.0 | 14,140 |
# Copyright 2019 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
"""Create AWS Lambdas from Python code.
See https://www.pantsbuild.org/docs/awslambda-python.
"""
from pants.backend.awslambda.python import rules as python_rules
from pants.backend.awsl... | benjyw/pants | src/python/pants/backend/awslambda/python/register.py | Python | apache-2.0 | 577 |
# ===============================================================================
# Copyright 2011 Jake Ross
#
# 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/licens... | USGSDenverPychron/pychron | pychron/mv/focus/autofocus_manager.py | Python | apache-2.0 | 16,498 |
# Copyright 2012 OpenStack Foundation
# Copyright 2013 Hewlett-Packard Development Company, L.P.
# Copyright 2017 AT&T Corp.
# 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 t... | Juniper/tempest | tempest/lib/services/compute/servers_client.py | Python | apache-2.0 | 36,704 |
"""Support for Vera cover - curtains, rollershutters etc."""
import logging
from homeassistant.components.cover import CoverDevice, ENTITY_ID_FORMAT, \
ATTR_POSITION
from homeassistant.components.vera import (
VERA_CONTROLLER, VERA_DEVICES, VeraDevice)
DEPENDENCIES = ['vera']
_LOGGER = logging.getLogger(__na... | nugget/home-assistant | homeassistant/components/vera/cover.py | Python | apache-2.0 | 2,003 |
"""Helpers for mobile_app."""
import json
import logging
from typing import Callable, Dict, Tuple
from aiohttp.web import Response, json_response
from nacl.encoding import Base64Encoder
from nacl.secret import SecretBox
from homeassistant.core import Context
from homeassistant.helpers.json import JSONEncoder
from hom... | joopert/home-assistant | homeassistant/components/mobile_app/helpers.py | Python | apache-2.0 | 5,246 |
#------------------------------------------------------------------------------
# bind_sdo.py (Section 4.4)
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# Copyright 2017, 2018, Oracle and/or its affiliate... | kawamon/hue | desktop/core/ext-py/cx_Oracle-6.4.1/samples/tutorial/solutions/bind_sdo.py | Python | apache-2.0 | 2,694 |
# Copyright 2013 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... | zhimin711/nova | nova/virt/imagecache.py | Python | apache-2.0 | 4,660 |
from django import forms
from django.conf import settings
from guardian.compat import url, patterns
from django.contrib import admin
from django.contrib import messages
from django.contrib.admin.widgets import FilteredSelectMultiple
from django.core.urlresolvers import reverse
from django.shortcuts import render_to_res... | restless/django-guardian | guardian/admin.py | Python | bsd-2-clause | 14,636 |
from horizon.test import helpers as test
class BandwidthTests(test.TestCase):
# Unit tests for bandwidth.
def test_me(self):
self.assertTrue(1 + 1 == 2)
| jorik041/shmoocon_2014_talk | caravan/caravan/dashboards/infrastructure/bandwidth/tests.py | Python | bsd-2-clause | 171 |
import numpy as np
import numpy.testing as npt
import AFQ.utils.parallel as para
def power_it(num, n=2):
# We define a function of the right form for parallelization
return num ** n
def test_parfor():
my_array = np.arange(100).reshape(10, 10)
i, j = np.random.randint(0, 9, 2)
my_list = list(my_... | arokem/pyAFQ | AFQ/utils/tests/test_parallel.py | Python | bsd-2-clause | 1,135 |
# Copyright (c) 2016 Hewlett Packard Enterprise Development LP
#
# Redistribution and use of this software in source and binary forms,
# with or without modification, are permitted provided that the following
# conditions are met:
#
# Redistributions of source code must retain the above copyright notice,
# this lis... | gholms/euca2ools | euca2ools/commands/iam/removeclientfromopenidconnectprovider.py | Python | bsd-2-clause | 1,921 |
CHA_Vol_PV = 'XF:11IDB-BI{XBPM:02}CtrlDAC:ALevel-SP'
HDM_Encoder_PV = 'XF:11IDA-OP{Mir:HDM-Ax:P}Pos-I'
E=np.arange(9.,11.,.05)
SI_STRIPE = -9
RH_STRIPE = 9
def take_Rdata( voltage, E):
caput(CHA_Vol_PV, voltage)
#yield from bp.abs_set(hdm.y, RH_STRIPE)
hdm.y.user_setpoint.value = RH_STRIPE
sl... | NSLS-II-CHX/ipython_ophyd | startup/97_HDM.py | Python | bsd-2-clause | 1,766 |
"""
Unit test for dynamic parameters.
Tests __get__, __set__ and that inspect_value() and
get_value_generator() work.
Originally implemented as doctests in Topographica in the file
testDynamicParameter.txt
"""
import copy
import unittest
import param
import numbergen
class TestDynamicParameters(unittest.TestCase):... | ceball/param | tests/API0/testdynamicparams.py | Python | bsd-3-clause | 9,003 |
#-*-coding:utf-8-*-
import hashlib
from urlparse import urlparse, urljoin
from flask import request
def md5(password):
return hashlib.md5(password).hexdigest()
def is_safe_url(target):
ref_url = urlparse(request.host_url)
test_url = urlparse(urljoin(request.host_url, target))
return test_url.scheme i... | ScriptFan/ScriptFan.com | website/scriptfan/utils/functions.py | Python | bsd-3-clause | 582 |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
""" Testing the glm module
"""
import numpy as np
from numpy.testing import (assert_almost_equal,
assert_array_almost_equal,
assert_raises)
from nose.t... | bthirion/nipy | nipy/algorithms/statistics/tests/test_mixed_effects.py | Python | bsd-3-clause | 5,555 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import datetime
import mock
import time
from django.contrib.auth.models import User
from sentry.models import Project
from sentry.exceptions import InvalidTimestamp, InvalidInterface, InvalidData
from sentry.coreapi import project_from_id, project_from_... | alex/sentry | tests/sentry/coreapi/tests.py | Python | bsd-3-clause | 10,465 |
#!/usr/bin/env python
# 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 simple trampoline to generate_profile.py in the src/ directory.
generate_profile.py generates a synthetic user profile.
"""
impo... | eunchong/build | scripts/slave/generate_profile_shim.py | Python | bsd-3-clause | 1,231 |
# -*- coding: utf-8 -*-
"""Change directory to provide relative paths for doctests
>>> import os
>>> filepath = os.path.dirname( os.path.realpath( __file__ ) )
>>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/data'))
>>> os.chdir(datadir)
"""
from __future__ import print_function, divisi... | carolFrohlich/nipype | nipype/interfaces/dipy/simulate.py | Python | bsd-3-clause | 12,156 |
# Standard imports
import logging
import time as systime
from datetime import datetime, time, timedelta
import json
# Our imports
import emission.analysis.result.carbon as carbon
import emission.net.api.stats as stats
from emission.core.wrapper.user import User
# BEGIN: Code to get and set client specific fields in t... | joshzarrabi/e-mission-server | emission/clients/data/data.py | Python | bsd-3-clause | 4,698 |
import typing as t
import warnings
from .request import Request
class _FakeSubclassCheck(type):
def __subclasscheck__(cls, subclass: t.Type) -> bool:
warnings.warn(
"'BaseRequest' is deprecated and will be removed in"
" Werkzeug 2.1. Use 'issubclass(cls, Request)' instead.",
... | mitsuhiko/werkzeug | src/werkzeug/wrappers/base_request.py | Python | bsd-3-clause | 1,174 |