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 |
|---|---|---|---|---|---|
#!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2016
# Leandro Toledo de Souza <devs@python-telegram-bot.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
... | franciscod/python-telegram-bot | tests/test_inlinequeryresultvideo.py | Python | gpl-2.0 | 3,826 |
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.lines import lineStyles
Light_cnames={'mistyrose':'#FFE4E1','navajowhite':'#FFDEAD','seashell':'#FFF5EE','papayawhip':'#FFEFD5','blanchedalmond':'#FFEBCD','white':'#FFFFFF','mintcream':'#F5FFFA','antiquewhite':'#FAEBD7','moccasin':'#FFE4B5','ivory':'#F... | newera912/WeatherTransportationProject | target/classes/edu/albany/cs/transWeatherPy/plotMesonetOrgData.py | Python | gpl-2.0 | 43,328 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# If this page isn't working, try executing `chmod +x app.py` in terminal.
# enable debugging
import cgitb, cgi; cgitb.enable()
from classes import Factory
fieldStorage = cgi.FieldStorage()
factory = Factory.Factory()
webApp = factory.makeWebApp(fieldStorage)
def outpu... | OuachitaHillsMinistries/OHCFS | htbin/app.py | Python | gpl-2.0 | 447 |
#
# Place a file called test.txt in the same directory as you place this program...
#
f = open('test.txt')
s = f.read()
print(s) | erikdejonge/python_for_kids | chapter09/opening_a_file.py | Python | gpl-2.0 | 130 |
# GNU Enterprise Common Library - Schema support for PostgreSQL
#
# Copyright 2000-2007 Free Software Foundation
#
# This file is part of GNU Enterprise.
#
# GNU Enterprise 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 ... | HarmonyEnterpriseSolutions/harmony-platform | src/gnue/common/datasources/drivers/sql/postgresql/Behavior.py | Python | gpl-2.0 | 13,533 |
from miasm.core.utils import size2mask
from miasm.expression.expression import ExprInt, ExprCond, ExprCompose, \
TOK_EQUAL
def simp_ext(_, expr):
if expr.op.startswith('zeroExt_'):
arg = expr.args[0]
if expr.size == arg.size:
return arg
return ExprCompose(arg, ExprInt(0, ex... | serpilliere/miasm | miasm/expression/simplifications_explicit.py | Python | gpl-2.0 | 4,228 |
#
# Copyright 2016 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in th... | oVirt/vdsm | lib/vdsm/storage/volumemetadata.py | Python | gpl-2.0 | 11,350 |
# Allows the creation of infix operators
# Thanks to Ferdinand Jamitzky
# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/384122
class Infix(object):
def __init__(self, function):
self.function = function
def __ror__(self, other):
return Infix(lambda x: self.function(other, x))
def __or__(s... | Kevin-Ray-Johnson/DM_Desk_Calc | Infix.py | Python | gpl-2.0 | 976 |
"""
Represents a group of conduits
Copyright: John Stowers, 2007
License: GPLv2
"""
import traceback
import os
import xml.dom.minidom
import gobject
import logging
log = logging.getLogger("SyncSet")
import conduit
import conduit.Conduit as Conduit
import conduit.Settings as Settings
import conduit.XMLSerialization as... | GNOME/conduit | conduit/SyncSet.py | Python | gpl-2.0 | 11,163 |
#
# Copyright 2014-2020 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed ... | oVirt/vdsm | tests/hostdev_test.py | Python | gpl-2.0 | 10,768 |
from random import choice
from feedparser import parse
from errbot import botcmd, BotPlugin
class DevOpsBorat(BotPlugin):
"""
Quotes from various dev humour related twitter accounts
"""
@botcmd
def borat(self, mess, args):
"""
Random quotes from the DEVOPS_BORAT twitter account
... | errbotio/err-devops-borat | devops_borat.py | Python | gpl-2.0 | 1,109 |
#
# Licensed under the GNU General Public License Version 3
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This p... | xkollar/spacewalk | spacecmd/src/lib/misc.py | Python | gpl-2.0 | 28,096 |
# -*- encoding: utf-8 -*-
from openerp.osv import fields, osv
from openerp.tools.translate import _
class sale_order_line(osv.Model):
"""
OpenERP Model : sale_order_line
"""
_inherit = 'sale.order.line'
_columns = {
'att_bro': fields.boolean('Attach Brochure', required=False, help="""If y... | 3dfxsoftware/cbss-addons | sale_multicompany_report/order.py | Python | gpl-2.0 | 1,880 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2013 Tristan Fischer (sphere@dersphere.de)
#
# 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 Lice... | noba3/KoTos | addons/plugin.video.myvideo_de/addon.py | Python | gpl-2.0 | 9,503 |
#!/usr/bin/env python3
#
#
#
# This file is part of librix-thinclient.
#
# librix-thinclient 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 ver... | andrevmatos/Librix-ThinClient | src/ui/users/add_user/addUser.py | Python | gpl-2.0 | 2,905 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007 Ralph Eisenbach
#
# This plugin is based on the plugin for ZoomPlayer
# by Lars-Peter Voss <bitmonster@eventghost.net>
#
# This file is a plugin for EventGhost.
# Copyright © 2005-2020 EventGhost Project <http://www.eventghost.net/>
#
# EventGhost is free software: you can... | EventGhost/EventGhost | plugins/TheaterTek/__init__.py | Python | gpl-2.0 | 31,794 |
import itertools
import sys
from flask import abort, g, render_template, request, redirect, Blueprint, flash, url_for, current_app
from flask.ext.login import login_required, current_user
from realms.lib.util import to_canonical, remove_ext, gravatar_url
from .models import PageNotFound
blueprint = Blueprint('wiki', _... | drptbl/realms-wiki-vagrant | realms/modules/wiki/views.py | Python | gpl-2.0 | 7,675 |
class StopSendingException(Exception):
"""
pre_send exception
"""
| ilstreltsov/django-db-mailer | dbmail/exceptions.py | Python | gpl-2.0 | 78 |
import nose
import sys
import os
import warnings
import tempfile
from contextlib import contextmanager
import datetime
import numpy as np
import pandas
import pandas as pd
from pandas import (Series, DataFrame, Panel, MultiIndex, Categorical, bdate_range,
date_range, Index, DatetimeIndex, isnull)
... | webmasterraj/FogOrNot | flask/lib/python2.7/site-packages/pandas/io/tests/test_pytables.py | Python | gpl-2.0 | 175,872 |
import time
import os
import ContentDb
from Debug import Debug
from Config import config
class ContentDbDict(dict):
def __init__(self, site, *args, **kwargs):
s = time.time()
self.site = site
self.cached_keys = []
self.log = self.site.log
self.db = ContentDb.getContentDb()... | OliverCole/ZeroNet | src/Content/ContentDbDict.py | Python | gpl-2.0 | 4,975 |
################################
# These variables are overwritten by Zenoss when the ZenPack is exported
# or saved. Do not modify them directly here.
# NB: PACKAGES is deprecated
NAME = 'ZenPacks.community.DistributedCollectors'
VERSION = '1.7'
AUTHOR = 'Egor Puzanov'
LICENSE = ''
NAMESPACE_PACKAGES = ['ZenPacks', '... | anksp21/Community-Zenpacks | ZenPacks.community.DistributedCollectors/setup.py | Python | gpl-2.0 | 2,617 |
# -*- encoding: utf-8 -*-
import os
from abjad import abjad_configuration
from abjad.demos import desordre
def test_demos_desordre_01():
lilypond_file = desordre.make_desordre_lilypond_file() | mscuthbert/abjad | abjad/demos/desordre/test/test_demos_desordre.py | Python | gpl-3.0 | 198 |
import numpy as np
import os
from galry import log_debug, log_info, log_warn, get_color
from fontmaps import load_font
from visual import Visual
__all__ = ['TextVisual']
VS = """
gl_Position.x += (offset - text_width / 2) * spacing.x / window_size.x;
gl_Position.y -= index * spacing.y / window_size.y;
gl... | DavidTingley/ephys-processing-pipeline | installation/klustaviewa-0.3.0/galry/visuals/text_visual.py | Python | gpl-3.0 | 7,555 |
"""
# Notes:
- This simulation seeks to emulate the CUBA benchmark simulations of (Brette
et al. 2007) using the Brian2 simulator for speed benchmark comparison to
DynaSim. However, this simulation does NOT include synapses, for better
comparison to Figure 5 of (Goodman and Brette, 2008).
- The time taken to si... | asoplata/dynasim-benchmark-brette-2007 | output/Brian2/brian2_benchmark_CUBA_nosyn_250/brian2_benchmark_CUBA_nosyn_250.py | Python | gpl-3.0 | 2,003 |
# OpenShot Video Editor is a program that creates, modifies, and edits video files.
# Copyright (C) 2009 Jonathan Thomas
#
# This file is part of OpenShot Video Editor (http://launchpad.net/openshot/).
#
# OpenShot Video Editor is free software: you can redistribute it and/or modify
# it under the terms of the GNU G... | XXLRay/libreshot | libreshot/blender/scripts/blinds.py | Python | gpl-3.0 | 5,718 |
"""
WSGI config for horario project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETT... | hbkfabio/horario | asignacion_horario/wsgi.py | Python | gpl-3.0 | 403 |
"""
Python script "setup.py"
by Matthew Garcia, PhD student
Dept. of Forest and Wildlife Ecology
University of Wisconsin - Madison
matt.e.garcia@gmail.com
Copyright (C) 2015-2016 by Matthew Garcia
Licensed Gnu GPL v3; see 'LICENSE_GnuGPLv3.txt' for complete terms
Send questions, bug reports, any related requests to ma... | megarcia/WxCD | setup.py | Python | gpl-3.0 | 18,007 |
# This file is a part of MediaDrop (http://www.mediadrop.net),
# Copyright 2009-2014 MediaDrop contributors
# For the exact contribution history, see the git revision log.
# The source code contained in this file is licensed under the GPLv3 or
# (at your option) any later version.
# See LICENSE.txt in the main project ... | kgao/MediaDrop | mediadrop/plugin/tests/events_test.py | Python | gpl-3.0 | 2,599 |
# ===================================================================
#
# Copyright (c) 2014, Legrandin <helderijs@gmail.com>
# 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. Redistributio... | hclivess/Stallion | nuitka/Cryptodome/Hash/MD2.py | Python | gpl-3.0 | 6,130 |
# -*- coding: utf-8 -*-
# Resource object code
#
# Created by: The Resource Compiler for PyQt5 (Qt v5.4.1)
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore
qt_resource_data = b"\
\x00\x00\x01\xf1\
\x00\
\x00\x09\x00\x78\x9c\xdd\x96\x51\x6f\x9b\x30\x10\xc7\xdf\xfb\x29\
\x3c\x1e\x9a\x4... | testmana2/test | Helpviewer/Bookmarks/DefaultBookmarks_rc.py | Python | gpl-3.0 | 2,920 |
../../../../../../../share/pyshared/orca/scripts/apps/nautilus/script.py | Alberto-Beralix/Beralix | i386-squashfs-root/usr/lib/python2.7/dist-packages/orca/scripts/apps/nautilus/script.py | Python | gpl-3.0 | 72 |
# @file plugin.py
#
# Connect Zen Coding to Pluma.
#
# Adapted to pluma by Joao Manoel (joaomanoel7@gmail.com)
#
# Original Author Franck Marcia (franck.marcia@gmail.com)
#
import pluma, gobject, gtk, os
from zen_editor import ZenEditor
zencoding_ui_str = """
<ui>
<menubar name="MenuBar">
<menu name="EditMenu"... | jmanoel7/pluma-plugins-0 | plugins/zencoding/plugin.py | Python | gpl-3.0 | 6,126 |
# -*- coding: utf-8 -*-
class Charset(object):
common_name = 'NotoKufiArabic-Regular'
native_name = ''
def glyphs(self):
glyphs = []
glyphs.append(0x0261) #uni0759.fina
glyphs.append(0x007F) #uni0625
glyphs.append(0x00D4) #uni0624
glyphs.append(0x0005) #uni0627... | davelab6/pyfontaine | fontaine/charsets/noto_glyphs/notokufiarabic_regular.py | Python | gpl-3.0 | 33,355 |
import web
import sam.common
import sam.models.links
class Details:
def __init__(self, db, subscription, ds, address, timestamp_range=None, port=None, page_size=50):
self.db = db
self.sub = subscription
self.table_nodes = "s{acct}_Nodes".format(acct=self.sub)
self.table_links = "s{... | riolet/SAM | sam/models/details.py | Python | gpl-3.0 | 16,289 |
#
# Copyright © 2012–2022 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, either version 3 of the Licens... | nijel/weblate | weblate/formats/tests/test_convert.py | Python | gpl-3.0 | 4,423 |
# dialogs - provide common dialogs
#
# Copyright (c) 2006 FSF Europe
#
# Authors:
# Sebastian Heinlein <glatzor@ubuntu.com>
# Michael Vogt <mvo@canonical.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License... | ruibarreira/linuxtrail | usr/lib/python3/dist-packages/softwareproperties/gtk/dialogs.py | Python | gpl-3.0 | 1,305 |
# coding: utf-8
from common import base
class Plugin(base.BASE):
__name__ = 'csdn'
__title__ = 'CSDN'
__url__ = 'http://www.csdn.net/'
def register(self, target):
self.information = {
'email': {
'url': 'http://passport.csdn.net/account/register',
... | tonybreak/Registered | plugins/csdn.py | Python | gpl-3.0 | 675 |
#
# Copyright (c) 2010-2011, 2015
# Nexa Center for Internet & Society, Politecnico di Torino (DAUIN),
# and Simone Basso <bassosimone@gmail.com>.
#
# This file is part of Neubot <http://www.neubot.org/>.
#
# Neubot is free software: you can redistribute it and/or modify
# it under the terms of the GNU General ... | bassosimone/neubot-server | neubot/runtime/http_client.py | Python | gpl-3.0 | 2,757 |
import unittest
import random
import sys
import os
ETEPATH = os.path.abspath(os.path.split(os.path.realpath(__file__))[0]+'/../')
sys.path.insert(0, ETEPATH)
from ete2 import Tree, TreeStyle, NodeStyle, PhyloTree, faces, random_color
from ete2.treeview.faces import *
from ete2.treeview.main import _NODE_TYPE_CHECKER,... | fw1121/ete | test/test_treeview.py | Python | gpl-3.0 | 5,124 |
#!/usr/bin/env python
# Progressive Cactus Package
# Copyright (C) 2009-2012 by Glenn Hickey (hickey@soe.ucsc.edu)
# and Benedict Paten (benedictpaten@gmail.com)
# 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... | BD2KGenomics/cactus | src/progressiveCactus.py | Python | gpl-3.0 | 16,648 |
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Softwa... | samn/spectral-workbench | webserver/public/lib/bespin-0.9a2/lib/dryice/path.py | Python | gpl-3.0 | 33,721 |
# -*- coding: utf-8 -*-
class Charset(object):
common_name = 'NotoSansHebrew-Regular'
native_name = ''
def glyphs(self):
chars = []
chars.append(0x0000) #null ????
chars.append(0x200C) #uni200C ZERO WIDTH NON-JOINER
chars.append(0x000D) #nonmarkingreturn ????
ch... | davelab6/pyfontaine | fontaine/charsets/noto_chars/notosanshebrew_regular.py | Python | gpl-3.0 | 9,355 |
# Authors:
# Jason Gerard DeRose <jderose@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, ei... | hatchetation/freeipa | ipalib/base.py | Python | gpl-3.0 | 15,669 |
# This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import absolute_import, division, print_function
from cryptography import utils
from cryptography.exceptions import (
... | CoderBotOrg/coderbotsrv | server/lib/cryptography/hazmat/primitives/hashes.py | Python | gpl-3.0 | 3,022 |
from .base import Browser, ExecutorBrowser, require_arg
from .base import get_timeout_multiplier # noqa: F401
from ..executors import executor_kwargs as base_executor_kwargs
from ..executors.executorwebdriver import (WebDriverTestharnessExecutor, # noqa: F401
WebDriverRefTe... | larsbergstrom/servo | tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/browsers/webkit.py | Python | mpl-2.0 | 3,966 |
#!/usr/bin/env python
#coding:utf-8
import cyclone.auth
import cyclone.escape
import cyclone.web
import datetime
import time
import os
from beaker.cache import cache_managers
from toughradius.manage.base import BaseHandler
from toughlib.permit import permit
from toughradius.manage import models
from toughradius.manage.... | sumonchai/tough | toughradius/manage/system/index.py | Python | agpl-3.0 | 1,739 |
# -*- coding: utf-8 -*-
# Copyright 2016 Acsone SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
'name': 'Account Invoice Check Total',
'summary': """
Check if the verification total is equal to the bill's total""",
'version': '10.0.1.0.0',
'license': 'AGPL-3',
'autho... | sysadminmatmoz/account-invoicing | account_invoice_check_total/__manifest__.py | Python | agpl-3.0 | 607 |
# -*- coding: UTF-8 -*-
import logging
unicode_string = u"Татьяна"
utf8_string = "'Татьяна' is an invalid string value"
logging.warning(unicode_string)
logging.warning(utf8_string)
try:
raise Exception(utf8_string)
except Exception,e:
print "--- (Log a traceback of the exception):"
logging.exception(e... | lsaffre/blog | docs/blog/2011/0527.py | Python | agpl-3.0 | 806 |
# -*- coding: utf-8 -*-
# Copyright (C) 2010 Samalyse SARL
# Copyright (C) 2010-2014 Parisson SARL
# This file is part of Telemeta.
# 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, eithe... | ANR-kamoulox/Telemeta | telemeta/models/corpus.py | Python | agpl-3.0 | 2,752 |
#!/usr/bin/env python3
# Sifer Aseph
"""Prints a "hello world" statement."""
def main():
"""Utterly standard."""
print("Hello cruel world.")
if __name__ == "__main__":
main()
| Surufel/Personal | 2.pysifer/Older/hello_world.py | Python | agpl-3.0 | 189 |
"""
Django Views for service status app
"""
from __future__ import absolute_import
import json
import time
from celery.exceptions import TimeoutError
from django.http import HttpResponse
from djcelery import celery
from openedx.core.djangoapps.service_status.tasks import delayed_ping
def index(_):
"""
An e... | ESOedX/edx-platform | openedx/core/djangoapps/service_status/views.py | Python | agpl-3.0 | 1,236 |
"""
Useful utilities for management commands.
"""
from django.core.management.base import CommandError
from opaque_keys import InvalidKeyError
from opaque_keys.edx.keys import CourseKey
def get_mutually_exclusive_required_option(options, *selections):
"""
Validates that exactly one of the 2 given options is... | eduNEXT/edunext-platform | openedx/core/lib/command_utils.py | Python | agpl-3.0 | 1,739 |
# -*- encoding: utf-8 -*-
################################################################################
# #
# Copyright (C) 2013-Today Carlos Eduardo Vercelino - CLVsol #
# ... | CLVsol/odoo_addons | clv_insured/seq/clv_insured_seq.py | Python | agpl-3.0 | 3,732 |
#!/usr/bin/env python3
import os, sys, glob, pickle, subprocess
sys.path.insert(0, os.path.dirname(__file__))
from clang import cindex
sys.path = sys.path[1:]
def configure_libclang():
llvm_libdirs = ['/usr/lib/llvm-3.2/lib', '/usr/lib64/llvm']
try:
libdir = subprocess.check_output(['llvm-config', '... | chergert/libgit2-glib | tools/coverage.py | Python | lgpl-2.1 | 6,733 |
# -*- coding: utf-8 -*-
# ***************************************************************************
# * Copyright (c) 2014 Yorik van Havre <yorik@uncreated.net> *
# * *
# * This program is free software; you can redistribute it a... | Fat-Zer/FreeCAD_sf_master | src/Mod/Path/PathScripts/PathDressupDogbone.py | Python | lgpl-2.1 | 49,208 |
import sys
def setup(core, object):
object.setAttachment('radial_filename', 'ring/unity')
object.setAttachment('objType', 'ring')
object.setStfFilename('static_item_n')
object.setStfName('item_ring_set_commando_utility_b_01_01')
object.setDetailFilename('static_item_d')
object.setDetailName('item_ring_set_comman... | agry/NGECore2 | scripts/object/tangible/wearables/ring/item_ring_set_commando_utility_b_01_01.py | Python | lgpl-3.0 | 1,084 |
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... | ProjectSWGCore/NGECore2 | scripts/mobiles/generic/static/tatooine/jano.py | Python | lgpl-3.0 | 1,147 |
#!/usr/bin/python
''' Auto-generated ui widget plugin '''
from projexui.qt.QtDesigner import QPyDesignerCustomWidgetPlugin
from projexui.qt.QtGui import QIcon
import projex.resources
from projexui.widgets.xviewwidget import XViewWidget as Base
setattr(Base, '__designer_mode__', True)
DEFAULT_XML = '''<ui... | bitesofcode/projexui | projexui/designer/build/xviewwidgetplugin.py | Python | lgpl-3.0 | 2,507 |
import enum
import inspect
import pydoc
import unittest
from collections import OrderedDict
from enum import Enum, IntEnum, EnumMeta, unique
from io import StringIO
from pickle import dumps, loads, PicklingError, HIGHEST_PROTOCOL
# for pickle tests
try:
class Stooges(Enum):
LARRY = 1
C... | Orav/kbengine | kbe/src/lib/python/Lib/test/test_enum.py | Python | lgpl-3.0 | 58,305 |
# Copyright 2012-2013 Greg Horn
#
# This file is part of rawesome.
#
# rawesome is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
... | ghorn/rawesome | rawe/newton/nmhe.py | Python | lgpl-3.0 | 10,700 |
#!/usr/bin/env python
# encoding: utf-8
#
# 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, Versi... | chrismattmann/NLTKRest | nltkrest/nltkrest/server.py | Python | apache-2.0 | 4,079 |
#!/usr/bin/env python
# Copyright 2016 Criteo
#
# 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... | Thib17/biggraphite | biggraphite/cli/command_list.py | Python | apache-2.0 | 2,668 |
from sys import maxsize
class Group:
def __init__(self, group_name=None, group_header=None, group_footer=None, id=None):
self.group_name = group_name
self.group_header = group_header
self.group_footer = group_footer
self.id = id
def __repr__(self):
return '%s:%s' % (se... | werbk/task-5.14 | tests_group/group_lib.py | Python | apache-2.0 | 3,504 |
#
# Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
#
import os
import gevent
import logging
import kazoo.client
import kazoo.exceptions
import kazoo.handlers.gevent
import kazoo.recipe.election
from kazoo.client import KazooState
from kazoo.retry import KazooRetry
from bitarray import bitarray
from cfg... | tcpcloud/contrail-controller | src/config/common/zkclient.py | Python | apache-2.0 | 14,983 |
#==========================================================================
#
# Copyright NumFOCUS
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/l... | malaterre/ITK | Modules/Segmentation/LevelSets/wrapping/test/GeodesicActiveContourImageFilterTest.py | Python | apache-2.0 | 6,301 |
# Copyright (c) 2018 by contributors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | PKU-Cloud-Lab/xLearn | python-package/xlearn/base.py | Python | apache-2.0 | 2,861 |
"""Cron job implementation of Zulip's incoming email gateway's helper
for forwarding emails into Zulip.
https://zulip.readthedocs.io/en/latest/production/email-gateway.html
The email gateway supports two major modes of operation: An email
server (using postfix) where the email address configured in
EMAIL_GATEWAY_PATT... | showell/zulip | zerver/management/commands/email_mirror.py | Python | apache-2.0 | 3,125 |
"""
Provides functionality to emulate keyboard presses on host machine.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/keyboard/
"""
import voluptuous as vol
from homeassistant.const import (
SERVICE_MEDIA_NEXT_TRACK, SERVICE_MEDIA_PLAY_PAUSE,
... | PetePriority/home-assistant | homeassistant/components/keyboard/__init__.py | Python | apache-2.0 | 2,078 |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# 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 ... | cloudbase/nova-virtualbox | nova/api/metadata/handler.py | Python | apache-2.0 | 8,152 |
""" Test for the remove.py module in the vcontrol/rest/providers directory """
from os import remove as delete_file
from web import threadeddict
from vcontrol.rest.providers import remove
PROVIDERS_FILE_PATH = "../vcontrol/rest/providers/providers.txt"
class ContextDummy():
env = threadeddict()
env['HTTP_HO... | CyberReboot/vcontrol | tests/test_rest_providers_remove.py | Python | apache-2.0 | 2,487 |
# 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... | TuSimple/mxnet | python/mxnet/metric.py | Python | apache-2.0 | 43,258 |
import re
import sys
class URI():
def __init__( self, root_path ):
super().__init__()
if root_path[-1] != '/' or root_path[0] != '/':
raise ValueError( 'root_path must start and end with "/"' )
self.root_path = root_path
self.uri_regex = re.compile( r'^({0}|/)(([a-zA-Z0-9\-_.!~*<>]+/)*)([a-zA... | cinp/python | cinp/common.py | Python | apache-2.0 | 4,279 |
# -*- coding: utf-8 -*-
#
# Copyright 2012-2015 Spotify AB
#
# 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... | riga/luigi | test/local_target_test.py | Python | apache-2.0 | 11,097 |
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | KaranToor/MA450 | google-cloud-sdk/lib/surface/functions/call.py | Python | apache-2.0 | 2,127 |
"""The ReCollect Waste integration."""
from __future__ import annotations
from datetime import date, timedelta
from aiorecollect.client import Client, PickupEvent
from aiorecollect.errors import RecollectError
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import Platform
from homeassi... | home-assistant/home-assistant | homeassistant/components/recollect_waste/__init__.py | Python | apache-2.0 | 2,425 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Copyright 2002-2018, Neo4j
#
# 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 req... | technige/cypy | test/test_encoding.py | Python | apache-2.0 | 8,939 |
# n peg hanoi tower problem, use bfs instead of dfs, and don't have a full
# analytical solution
import sys
import copy
def solutionWorks(currentSolution, stacksAfterSolution, initialStacks, finalStacks):
for x in range(len(currentSolution)):
i, j = currentSolution[x]
stacksAfterSolution[j].append... | baiyubin/python_practice | pegs.py | Python | apache-2.0 | 2,445 |
# 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... | matthewoliver/swift | test/unit/common/test_storage_policy.py | Python | apache-2.0 | 57,607 |
"""Support for Switchbot bot."""
from __future__ import annotations
import logging
from typing import Any
from switchbot import Switchbot # pylint: disable=import-error
import voluptuous as vol
from homeassistant.components.switch import (
DEVICE_CLASS_SWITCH,
PLATFORM_SCHEMA,
SwitchEntity,
)
from homea... | aronsky/home-assistant | homeassistant/components/switchbot/switch.py | Python | apache-2.0 | 5,033 |
"""Support for Zigbee switches."""
import voluptuous as vol
from homeassistant.components.switch import SwitchDevice
from homeassistant.components.zigbee import (
ZigBeeDigitalOut, ZigBeeDigitalOutConfig, PLATFORM_SCHEMA)
DEPENDENCIES = ['zigbee']
CONF_ON_STATE = 'on_state'
DEFAULT_ON_STATE = 'high'
DEPENDENCIE... | HydrelioxGitHub/home-assistant | homeassistant/components/zigbee/switch.py | Python | apache-2.0 | 765 |
# -*- coding: utf-8 -*-
# compute the times of action(rec|click|msg) for each user
from math import sqrt
def getActionScore(action):
if action == "rec":
return 0
elif action == "click" :
return 1
else:
return 2
def compute_interaction(data):
interaction = {}
for line in data:
... | bingtianbaihua/MachineLearning | 世纪佳缘会员推荐之投票加权/compute_user_popularity.py | Python | apache-2.0 | 2,399 |
# Copyright 2020 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... | googleapis/python-aiplatform | .sample_configs/param_handlers/delete_specialist_pool_sample.py | Python | apache-2.0 | 714 |
import subprocess
import pytest
from utils import *
@all_available_simulators()
def test_filter(tmp_path, simulator):
unit_test = tmp_path.joinpath('some_unit_test.sv')
unit_test.write_text('''
module some_unit_test;
import svunit_pkg::*;
`include "svunit_defines.svh"
string name = "some_ut";
svun... | svunit/svunit | test/test_run_script.py | Python | apache-2.0 | 9,783 |
# import asyncio
#
# async def compute(x, y):
# print("Compute %s + %s ..." % (x, y))
# await asyncio.sleep(1.0)
# return x + y
#
# async def print_sum(x, y):
# for i in range(10):
# result = await compute(x, y)
# print("%s + %s = %s" % (x, y, result))
#
# loop = asyncio.get_event_loop()... | fs714/concurrency-example | asynchronous/py36/asyncio/async_test.py | Python | apache-2.0 | 868 |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (nested_scopes, generators, division, absolute_import, with_statement,
print_function, unicode_literals)
from contextlib impor... | square/pants | tests/python/pants_test/fs/test_expand_path.py | Python | apache-2.0 | 1,446 |
# Copyright 2014 Hewlett-Packard Development Company, L.P.
#
# Author: Endre Karlson <endre.karlson@hp.com>
#
# 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/lice... | tonyli71/designate | designate/dnsutils.py | Python | apache-2.0 | 13,265 |
#!/usr/bin/env python
# Copyright 2010 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required ... | rbruyere/appengine-mapreduce | python/test/mapreduce gcs/mapreduce/input_readers.py | Python | apache-2.0 | 128,812 |
# Copyright 2015 Confluent 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 in writing, s... | geeag/kafka | tests/kafkatest/tests/client/message_format_change_test.py | Python | apache-2.0 | 4,644 |
import shelve
import os
import re
from resource_api.interfaces import Resource as BaseResource, Link as BaseLink, AbstractUriPolicy
from resource_api.schema import StringField, DateTimeField, IntegerField
from resource_api.service import Service
from resource_api.errors import ValidationError
RE_SHA1 = re.compile("^... | gurunars/resource-api | documentation/tutorial/service_v4.py | Python | apache-2.0 | 8,456 |
'''
Integration Test for scheduler reboot VM in HA mode.
@author: Quarkonics
'''
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_state as test_state
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.operations.resource_operations as res_ops
import zstackwoodp... | zstackio/zstack-woodpecker | integrationtest/vm/ha/test_one_node_shutdown_with_scheduler.py | Python | apache-2.0 | 2,920 |
# coding=utf-8
import os.path
import sys
import types
import getopt
from getopt import GetoptError
import text_file
import regex_utils
import string_utils as str_utils
def grep(target, pattern, number = False, model = 'e'):
'''
grep: print lines matching a pattern
@param target:string list or tex... | interhui/py-text | text/grep.py | Python | apache-2.0 | 4,283 |
# 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... | jamielennox/tempest | tempest/scenario/test_volume_boot_pattern.py | Python | apache-2.0 | 8,184 |
# 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... | jonparrott/google-cloud-python | logging/google/cloud/logging/entries.py | Python | apache-2.0 | 11,279 |
# Copyright 2014 NeuroData (http://neurodata.io)
#
# 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... | neurodata/ndstore | scripts/ingest/mitra/jp2kakadu.py | Python | apache-2.0 | 1,931 |
# 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... | rushiagr/keystone | keystone/contrib/federation/routers.py | Python | apache-2.0 | 9,192 |
# Copyright 2012-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 la... | varunarya10/python-openstackclient | openstackclient/shell.py | Python | apache-2.0 | 12,311 |
from model.project import Project
def test_add_project(app):
project=Project(name="students_project", description="about Project")
try:
ind = app.project.get_project_list().index(project)
app.project.delete_named_project(project)
except ValueError:
pass
old_projects = app.proje... | Manolaru/Python_Mantis | Working version/test/test_add_project.py | Python | apache-2.0 | 614 |
#!/usr/bin/env python3
import random
import unittest
import networkx
from mininet.topo import Topo
from clib.mininet_test_watcher import TopologyWatcher
from clib.mininet_test_base_topo import FaucetTopoTestBase
class FaucetFaultToleranceBaseTest(FaucetTopoTestBase):
"""
Generate a topology of the given pa... | trungdtbk/faucet | tests/generative/integration/mininet_tests.py | Python | apache-2.0 | 17,678 |
# Copyright The Cloud Custodian Authors.
# SPDX-License-Identifier: Apache-2.0
from common_openstack import OpenStackTest
class ServerTest(OpenStackTest):
def test_server_query(self):
factory = self.replay_flight_data()
p = self.load_policy({
'name': 'all-servers',
'resour... | thisisshi/cloud-custodian | tools/c7n_openstack/tests/test_server.py | Python | apache-2.0 | 2,461 |
# 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. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | mikalstill/nova | nova/objects/migration_context.py | Python | apache-2.0 | 3,456 |