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
"""This is for cleaning up binary files improperly added to CVS. This script
scans the given path to find binary files; checks with CVS to see if the sticky
options are set to -kb; finally if sticky options are not -kb then uses 'cvs
admin' to set the -kb option.
This script ignores CVS director... | youtube/cobalt | third_party/llvm-project/lldb/third_party/Python/module/pexpect-2.4/examples/fix_cvs_files.py | Python | bsd-3-clause | 3,049 |
from __future__ import print_function, division
import numpy
from galpy import potential
def test_errors():
#Test that when we set up an interpRZPotential w/ another interpRZPotential, we get an error
rzpot= potential.interpRZPotential(RZPot=potential.MWPotential,
rgrid=(... | jobovy/galpy | tests/test_interp_potential.py | Python | bsd-3-clause | 61,872 |
"""
:synopsis: Wapiti does not provide ranking for the vulnerabilities it has found. This file tries to define a ranking
for every vulnerability Wapiti might find.
.. moduleauthor:: Tao Sauvage
"""
from ptp.libptp.constants import HIGH, MEDIUM, LOW, INFO
#: :data: :class:`dict` of the categories with their r... | owtf/ptp | ptp/tools/wapiti/signatures.py | Python | bsd-3-clause | 958 |
import sys
import argparse
import unittest
from bulbs.config import Config
from bulbs.tests.client_tests import ClientTestCase
from bulbs.tests.client_index_tests import ClientIndexTestCase
from bulbs.titan.client import TitanClient, TITAN_URI, DEBUG
import time
# Default database. You can override this with the com... | mudbungie/NetExplorer | env/lib/python3.4/site-packages/bulbs/titan/tests/client_tests.py | Python | mit | 1,492 |
from __future__ import unicode_literals, division, absolute_import
from collections import Mapping
import logging
import subprocess
from flexget import plugin
from flexget.event import event
from flexget.utils.template import render_from_entry, render_from_task, RenderError
from flexget.utils.tools import io_encoding... | voriux/Flexget | flexget/plugins/output/exec.py | Python | mit | 7,367 |
#MOOSHELL_SEO_TITLE_TAIL = " | to test your Mootools code"
#MOOSHELL_SEO_TITLE_HEAD = ""
#MOOSHELL_TITLE_SEPARATOR = " | "
#MOOSHELL_PROJECT_NAME = "MooShell"
#MOOSHELL_PROJECT_STATUS = "(alpha)"
#MOOTOOLS_CORE = "lib/mootools-1.2.4-core-yc.js"
#MOOTOOLS_DEV_CORE = "lib/mootools-1.2.4-core-nc.js"
#MOOTOOLS_MORE = "l... | timwienk/mooshell | machine_settings-default.py | Python | mit | 761 |
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings")
# This application object is used by any WSGI server configured to use this
# file. This includes Django's development server, if the WSGI_APPLICATION
# setting points here.
application = get... | datahuborg/datahub | src/browser/wsgi.py | Python | mit | 474 |
#!/usr/bin/env python3
import itertools
import networkx as nx
from pgmpy.base import UndirectedGraph
class DirectedGraph(nx.DiGraph):
"""
Base class for all Directed Graphical Models.
Each node in the graph can represent either a random variable, `Factor`,
or a cluster of random variables. Edges i... | sandeepkrjha/pgmpy | pgmpy/base/DirectedGraph.py | Python | mit | 9,379 |
# pylint: disable=missing-docstring,too-few-public-methods,invalid-name
# pylint: disable=attribute-defined-outside-init, useless-object-inheritance
class Aaaa(object):
"""class with attributes defined in wrong order"""
def __init__(self):
var1 = self._var2 # [access-member-before-definition]
... | ruchee/vimrc | vimfiles/bundle/vim-python/submodules/pylint/tests/functional/a/access/access_member_before_definition.py | Python | mit | 1,059 |
# --------------------------------------------
# Using speech input instead of touch-tone
# See http://www.tropo.com for more info
# --------------------------------------------
answer()
result = ask("Hi. For sales, say sales. For support, say support",
{'choices':"sales, support", 'repeat':3})
if (result.name == 'c... | rogervaas/tropo-samples | python/tutorial/05-usespeechvstone.py | Python | mit | 514 |
# https://www.hackerrank.com/challenges/beautiful-days-at-the-movies
i, j, k = map(int, raw_input().split())
days = 0
# A day between i and j is beautiful if the absolute difference
# of the number and its reverse is evenly divisible by k.
for number in range(i, j + 1):
reverse = int(str(number)[::-1])
days += ... | Zubieta/CPP | HackerRank/Algorithms/02_Implementation/11_Beatiful_Days_At_The_Movies.py | Python | mit | 364 |
# View more python learning tutorial on my Youtube and Youku channel!!!
# Youtube video tutorial: https://www.youtube.com/channel/UCdyjiB5H8Pu7aDTNVXTTpcg
# Youku video tutorial: http://i.youku.com/pythontutorial
import tkinter as tk
window = tk.Tk()
window.title('Welcome to Mofan Python')
window.geometry('450x300')... | wangwei7175878/tutorials | tkinterTUT/tk13_login_example/tk13_login_example.py | Python | mit | 1,256 |
import logging
import os
from plugins import BaseMetaAssembler
from yapsy.IPlugin import IPlugin
import asmtypes
class GamNgsAssembler(BaseMetaAssembler, IPlugin):
new_version = True
def run(self):
contigsets = self.data.contigsets
if len(contigsets) < 2:
raise Exception('Fewer tha... | sebhtml/assembly | lib/assembly/plugins/gam_ngs.py | Python | mit | 3,217 |
"""
Collects metrics on queues and queue consumers from PgQ, a PostgreSQL-based
queueing mechanism (part of the Skytools utilities released by Skype.)
#### Dependencies
* psycopg2
#### Example Configuration
```
enabled = True
[instances]
[[database1]]
dsn = postgresql://user:secret@localhost
[[database2]]
dsn =... | MichaelDoyle/Diamond | src/collectors/pgq/pgq.py | Python | mit | 3,517 |
def unittest(data_path, temp_path):
import image
img = image.Image("unittest/data/shapes.ppm", copy_to_fb=True)
lines = img.find_lines(threshold = 5000, theta_margin = 25, rho_margin = 25)
return len(lines) == 4 and\
lines[0][0:] == (22, 0, 22, 119, 119, 8670, 0, 22) and\
lines[1][0:] == (0, 39... | kwagyeman/openmv | scripts/unittest/script/11-find_lines.py | Python | mit | 473 |
import io
import contextlib
import os
import sys
import glob
import multiprocessing
import configparser
import itertools
import pytest
def run_tests(src, test, fail):
stderr = io.StringIO()
stdout = io.StringIO()
with contextlib.redirect_stderr(stderr):
with contextlib.redirect_stdout(stdout):
... | mosajjal/mitmproxy | test/individual_coverage.py | Python | mit | 2,610 |
#!/usr/bin/env python
#-------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#----------------------------------------------------------------... | SUSE/azure-sdk-for-python | azure-mgmt-devtestlabs/setup.py | Python | mit | 2,816 |
"""
urlresolver XBMC Addon
Copyright (C) 2011 anilkuj
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.
... | SMALLplayer/smallplayer-image-creator | storage/.xbmc/addons/script.module.urlresolver/lib/urlresolver/plugins/hostingbulk.py | Python | gpl-2.0 | 3,492 |
# Copyright 2015 Christoph Reiter
#
# 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.
"""Utils for executing things in a ... | quodlibet/quodlibet | quodlibet/util/thread.py | Python | gpl-2.0 | 4,064 |
from netconfig.drivers import Prompt, System, Config, Layer3, Layer2, Device, ComponentList
from re import compile, match, search, sub, DOTALL
#######################################################################
# Cisco Nexus
#######################################################################
class PromptCis... | SLAC-OCIO/net-config | lib/netconfig/drivers/cisco_wlc.py | Python | gpl-2.0 | 2,399 |
## This file is part of Invenio.
## Copyright (C) 2009, 2010, 2011 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 later versio... | AlbertoPeon/invenio | modules/oairepository/lib/oai_repository_updater.py | Python | gpl-2.0 | 21,590 |
#!/usr/bin/env python2
# This file is part of MyPaint.
# Copyright (C) 2007-2013 by Martin Renold <martinxyz@gmx.ch>
# Copyright (C) 2013-2015 by the MyPaint Develoment Team.
#
# 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
#... | achadwick/mypaint | mypaint.py | Python | gpl-2.0 | 17,340 |
# vim: expandtab ts=4 sw=4 sts=4 fileencoding=utf-8:
#
# Copyright (C) 2007-2010 GNS3 Development Team (http://www.gns3.net/team).
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation;
#
#... | dlintott/gns3 | src/GNS3/Globals/Symbols.py | Python | gpl-2.0 | 7,556 |
# -*- coding: utf-8 -*-
"""
Python Markdown
A Python implementation of John Gruber's Markdown.
Documentation: https://python-markdown.github.io/
GitHub: https://github.com/Python-Markdown/markdown/
PyPI: https://pypi.org/project/Markdown/
Started by Manfred Stienstra (http://www.dwerg.net/).
Maintained for a few yea... | unreal666/outwiker | plugins/markdown/markdown/markdown_plugin_libs/markdown/__main__.py | Python | gpl-3.0 | 5,847 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.11 on 2017-08-14 16:15
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('sessao', '0011_auto_20170814_1409'),
]
operations = [
migrations.AlterModelOptions(... | interlegis/sapl | sapl/sessao/migrations/0012_auto_20170814_1615.py | Python | gpl-3.0 | 696 |
class P2(Pynguin):
def onclick(self, x, y):
# only change x-coord
yo = self.y
self.goto(x, yo)
| alcemirfernandes/pynguin | doc/examples_src/onclick_pynd/00004.py | Python | gpl-3.0 | 123 |
"""
Defines functions that can be used to inspect the properties of a
function call. For example
lhs_info() can be used to get retrieve the names and number of
arguments that are being assigned to a function
return
"""
from __future__ import (absolute_import, divis... | dymkowsk/mantid | Framework/PythonInterface/mantid/kernel/funcinspect.py | Python | gpl-3.0 | 12,495 |
"""Tokenization help for Python programs.
generate_tokens(readline) is a generator that breaks a stream of
text into Python tokens. It accepts a readline-like method which is called
repeatedly to get the next line of input (or "" for EOF). It generates
5-tuples with these members:
the token type (see token.py)
... | lidavidm/mathics-heroku | venv/lib/python2.7/site-packages/sympy/parsing/sympy_tokenize.py | Python | gpl-3.0 | 16,454 |
__author__ = 'Kristy'
# run run_bpy first to set path
import bpy
import scripts.ema_shared.properties as pps
import scripts.ema_blender.blender_shared_objects as bsh
def bpy_make_straight_bones_all_with_ik(n, armature_name):
# create the armature, set name from global value
hook_empties = []
#
print('--... | m2ci-msp/ematoblender | ematoblender/scripts/ema_blender/ema_bpy/external_tongue_armature.py | Python | gpl-3.0 | 3,036 |
def show_all():
mode('pynguin')
notrack()
home()
import time
xmin, ymin, xmax, ymax = viewcoords()
funcs = sorted(list(globals().keys()))
for fname in funcs:
if fname.startswith('eq'):
f = globals().get(fname)
clear()
home()
grid()... | alcemirfernandes/pynguin | doc/examples_src/descartes_pynd/00000.py | Python | gpl-3.0 | 471 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | duyetdev/openerp-6.1.1 | openerp/addons/account/wizard/account_report_print_journal.py | Python | agpl-3.0 | 3,426 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2015 Agile Business Group sagl (<http://www.agilebg.com>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public Licen... | nicolas-petit/website | website_cookie_notice/__openerp__.py | Python | agpl-3.0 | 1,436 |
# Amara, universalsubtitles.org
#
# Copyright (C) 2013 Participatory Culture Foundation
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your opti... | ReachingOut/unisubs | apps/api/tests/test_actions.py | Python | agpl-3.0 | 3,166 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models, _
from odoo.tools import html2plaintext, html_escape
class MailChannel(models.Model):
_inherit = 'mail.channel'
def _define_command_lead(self):
return {'help': _('Create a new ... | ygol/odoo | addons/crm_livechat/models/mail_channel.py | Python | agpl-3.0 | 1,745 |
# Copyright (C) 2014-2016 Andrey Antukh <niwi@niwi.nz>
# Copyright (C) 2014-2016 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014-2016 David Barragán <bameda@dbarragan.com>
# Copyright (C) 2014-2016 Alejandro Alonso <alejandro.alonso@kaleidos.net>
# This program is free software: you can redistribute it and/or mo... | Rademade/taiga-back | taiga/projects/issues/apps.py | Python | agpl-3.0 | 3,717 |
# -*- coding: utf-8 -*-
# Copyright(C) 2010-2012 Romain Bignon
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at you... | blckshrk/Weboob | weboob/tools/application/qt/backendcfg.py | Python | agpl-3.0 | 20,483 |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | wscullin/spack | var/spack/repos/builtin/packages/libdrm/package.py | Python | lgpl-2.1 | 2,264 |
"""
Define RPC functions needed to generate
"""
# [ <ret-type>, [<arg_types>] ]
func_table = [
[ "string", ["string", "int"] ],
[ "object", ["string"] ],
[ "objlist", ["string", "int"] ],
]
| skmezanul/libsearpc | tests/rpc_table.py | Python | lgpl-3.0 | 203 |
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..compat import compat_HTTPError
from ..utils import (
float_or_none,
ExtractorError,
)
class RedBullTVIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?redbull(?:\.tv|\.com(?:/[^/]+)?(?:/tv)?)(?:... | rg3/youtube-dl | youtube_dl/extractor/redbulltv.py | Python | unlicense | 9,332 |
"""A TestCase class that doesn't call super setUp or super tearDown."""
import unittest
# pylint: disable=too-few-public-methods, missing-docstring
class BadTestCase(unittest.TestCase):
def setUp(self):
self.i_am_bad = True
def tearDown(self):
self.i_am_bad = True
class AllowedToBeHalfBadTe... | Sveder/edx-lint | test/input/func_no_super_setup_call.py | Python | apache-2.0 | 542 |
# Copyright (c) 2014 Mirantis Inc.
# Copyright (c) 2015 ISPRAS
#
# 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... | tellesnobrega/sahara | sahara/plugins/spark/edp_engine.py | Python | apache-2.0 | 2,350 |
"""Blebox sensors tests."""
import logging
from unittest.mock import AsyncMock, PropertyMock
import blebox_uniapi
import pytest
from homeassistant.components.sensor import SensorDeviceClass
from homeassistant.const import (
ATTR_DEVICE_CLASS,
ATTR_UNIT_OF_MEASUREMENT,
STATE_UNKNOWN,
TEMP_CELSIUS,
)
fr... | home-assistant/home-assistant | tests/components/blebox/test_sensor.py | Python | apache-2.0 | 2,790 |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | abhitopia/tensorflow | tensorflow/contrib/linalg/python/ops/linear_operator.py | Python | apache-2.0 | 24,017 |
"""Tests for 1-Wire config flow."""
from pyownet import protocol
from homeassistant.components.onewire.const import (
CONF_MOUNT_DIR,
CONF_TYPE_OWSERVER,
CONF_TYPE_SYSBUS,
DEFAULT_OWSERVER_PORT,
DEFAULT_SYSBUS_MOUNT_DIR,
DOMAIN,
)
from homeassistant.config_entries import SOURCE_IMPORT, SOURCE_U... | sdague/home-assistant | tests/components/onewire/test_config_flow.py | Python | apache-2.0 | 11,189 |
#!/usr/bin/env python
#
# Copyright (c) 2015 Pavel Lazar pavel.lazar (at) gmail.com
#
# The Software is provided WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED.
#####################################################################
import tornado.web
import tornado.httpclient
import tornado.ioloop
import tornado.options
from... | pavel-lazar/obsi | openbox/runner/rest_server.py | Python | apache-2.0 | 3,366 |
# 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... | Vaidyanath/tempest | tempest/thirdparty/boto/test.py | Python | apache-2.0 | 27,914 |
import logging
import re
from email.message import EmailMessage
from typing import Dict, List, Optional, Tuple
from django.conf import settings
from django.utils.timezone import now as timezone_now
from django.utils.timezone import timedelta
from zerver.lib.actions import (
internal_send_huddle_message,
inter... | timabbott/zulip | zerver/lib/email_mirror.py | Python | apache-2.0 | 17,657 |
# 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... | rabipanda/tensorflow | tensorflow/python/client/session_test.py | Python | apache-2.0 | 76,835 |
import sys
sys.path.insert(1,"../../../")
import h2o
from tests import pyunit_utils
def cbind():
# Connect to a pre-existing cluster
hdf = h2o.import_file(path=pyunit_utils.locate('smalldata/jira/pub-180.csv'))
otherhdf = h2o.import_file(path=pyunit_utils.locate('smalldata/jira/v-11.csv'))
rows, cols = ... | YzPaul3/h2o-3 | h2o-py/tests/testdir_munging/slice/pyunit_cbind.py | Python | apache-2.0 | 3,791 |
# -*- coding:utf-8 -*-
__author__ = 'q00222219@huawei'
from heat.openstack.common import log as logging
LOG=logging.getLogger(__name__)
class CloudManagerException(Exception):
"""Base CloudManager Exception
To correctly use this class, inherit from it and define
a 'msg_fmt' property. That msg_fmt will ... | hgqislub/hybird-orchard | code/cloudmanager/exception.py | Python | apache-2.0 | 2,903 |
import logging
import os
import shlex
from cattle import Config
from cattle.process_manager import background
log = logging.getLogger('cadvisor')
class Cadvisor(object):
def on_startup(self):
cmd = ['cadvisor',
'-logtostderr=true',
'-listen_ip', Config.cadvisor_ip(),
... | rancher/python-agent | cattle/plugins/cadvisor/cadvisor.py | Python | apache-2.0 | 1,142 |
# Copyright 2015 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.org/licenses/LICENSE-2.0
#
# Unless requir... | Tehsmash/networking-cisco | networking_cisco/plugins/cisco/cfg_agent/device_drivers/iosxe/run_asr1kv.py | Python | apache-2.0 | 1,971 |
# Copyright 2015 - Rackspace
#
# 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, ... | stackforge/solum | solum/objects/sqlalchemy/migration/alembic_migrations/versions/1393c21ea82c_add_image_id_to_assembly_table.py | Python | apache-2.0 | 1,010 |
#! /usr/bin/env python
import os,sys,math,urllib2,urllib
import optparse
###########################################################################
class OptionParser (optparse.OptionParser):
def check_required (self, opt):
option = self.get_option(opt)
# Assumes the option's 'default' is set to N... | vightel/FloodMapsWorkshop | python/download_landsat8.py | Python | apache-2.0 | 4,636 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2009 Benoit Chesneau <benoitc@e-engura.org>
#
# This software is licensed as described in the file LICENSE, which
# you should have received as part of this distribution.
import os
import tempfile
import shutil
import sys
import unittest2 as unittest
from tes... | flimzy/couchapp | tests/test_cli.py | Python | apache-2.0 | 10,059 |
from __future__ import print_function, division, absolute_import
import numpy
from numba.cuda.testing import unittest
from numba import cuda
class TestCudaArray(unittest.TestCase):
def test_gpu_array_zero_length(self):
x = numpy.arange(0)
dx = cuda.to_device(x)
hx = dx.copy_to_host()
... | ssarangi/numba | numba/cuda/tests/cudapy/test_array.py | Python | bsd-2-clause | 1,829 |
#!/usr/bin/env python
import angr
import os
import nose
p32 = None
p64 = None
def setup_module():
global p32, p64
test_location = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..', 'binaries', 'tests')
bin64 = os.path.join(test_location, 'x86_64', 'all')
bin32 = os.path.join(test_l... | angr/angr | tests/broken_sleak.py | Python | bsd-2-clause | 886 |
import datetime
import json
from unittest import TestCase
from pytz import utc
from redash.query_runner.mongodb import parse_query_json, parse_results, _get_column_by_name
from redash.utils import parse_human_time
class TestParseQueryJson(TestCase):
def test_ignores_non_isodate_fields(self):
query = {
... | 44px/redash | tests/query_runner/test_mongodb.py | Python | bsd-2-clause | 5,010 |
import json
from flask import request
from flask_login import login_required
from redash import models, redis_connection
from redash.handlers import routes
from redash.handlers.base import json_response
from redash.permissions import require_super_admin
from redash.tasks.queries import QueryTaskTracker
@routes.route... | hudl/redash | redash/handlers/admin.py | Python | bsd-2-clause | 1,996 |
import psycopg2 as psy
import sqlalchemy
import datetime as dt
from sqlalchemy import (
Table,
Column,
Index,
Integer,
String,
Text,
Boolean,
ForeignKey,
UniqueConstraint,
)
from sqlalchemy import text
from sqlalchemy.dialects.postgresql import JSON,JSONB
from sqlalchemy.ext.dec... | OpenTreeOfLife/otindex | dev_scripts/dev_models.py | Python | bsd-2-clause | 2,583 |
"""Singleton provider async mode tests."""
import asyncio
import random
from dependency_injector import providers
from pytest import mark, raises
from .common import RESOURCE1, RESOURCE2, BaseContainer, Client, Service
@mark.asyncio
async def test_injections():
class ContainerWithSingletons(BaseContainer):
... | ets-labs/python-dependency-injector | tests/unit/providers/async/test_singleton_py36.py | Python | bsd-3-clause | 3,009 |
from unittest import TestCase
import math
from numpy import inf, isinf, nan, isnan
from ewaim import calculate
from ewaim import get_csv
from ewaim import mean_lat_long
class TestOneNumber(TestCase):
def test_floats(self):
for num in range(10):
self.assertEqual(calculate(str(num) + '**2.0'), po... | Thru-Echoes/ewaim-webapp | ewaim/tests/test_ewaim.py | Python | bsd-3-clause | 529 |
from datetime import date
from . import PostgreSQLTestCase
from .models import (
HStoreModel, IntegerArrayModel, NestedIntegerArrayModel,
NullableIntegerArrayModel, OtherTypesArrayModel, RangesModel,
)
try:
from psycopg2.extras import NumericRange, DateRange
except ImportError:
pass # psycopg2 isn't ... | theo-l/django | tests/postgres_tests/test_bulk_update.py | Python | bsd-3-clause | 1,418 |
from nose.tools import eq_
import amo.tests
from amo.urlresolvers import reverse
from users.models import UserProfile
from mkt.api.models import Access
from mkt.site.fixtures import fixture
class TestAPI(amo.tests.TestCase):
fixtures = fixture('user_999')
def setUp(self):
self.profile = UserProfile... | wagnerand/zamboni | mkt/developers/tests/test_views_api.py | Python | bsd-3-clause | 2,111 |
#!/usr/bin/env python
#
# Copyright (c) 2016, The OpenThread Authors.
# 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
# ... | georgecpr/openthread | tests/scripts/thread-cert/Cert_5_2_05_AddressQuery.py | Python | bsd-3-clause | 6,303 |
# Copyright (C) 2013 Google 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:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the ... | youtube/cobalt | third_party/blink/Tools/Scripts/webkitpy/layout_tests/breakpad/dump_reader_win.py | Python | bsd-3-clause | 5,855 |
from __future__ import print_function, division
try:
from ctypes import c_float
except ImportError:
pass
import pyglet.gl as pgl
from math import sqrt as _sqrt, acos as _acos
def cross(a, b):
return (a[1] * b[2] - a[2] * b[1],
a[2] * b[0] - a[0] * b[2],
a[0] * b[1] - a[1] * b[0])... | kaushik94/sympy | sympy/plotting/pygletplot/plot_rotation.py | Python | bsd-3-clause | 1,496 |
from __future__ import absolute_import
from django.db.models import F
from sentry import roles
from sentry.cache import default_cache
from sentry.models import ApiToken
from sentry.api.serializers import serialize
from sentry.web.frontend.base import BaseView
from sentry.web.helpers import render_to_response
from sen... | mvaled/sentry | src/sentry/web/frontend/setup_wizard.py | Python | bsd-3-clause | 2,882 |
"""
=============================================================
Online Latent Dirichlet Allocation with variational inference
=============================================================
This implementation is modified from Matthew D. Hoffman's onlineldavb code
Link: https://github.com/blei-lab/onlineldavb
"""
# ... | shyamalschandra/scikit-learn | sklearn/decomposition/_lda.py | Python | bsd-3-clause | 31,632 |
import logging
import os
import shutil
from django.conf import settings
import waffle
from celery import task
import mkt
from lib.video import library
from mkt.files.helpers import copyfileobj
from mkt.site.decorators import set_modified_on
from mkt.users.models import UserProfile
from mkt.webapps.models import Prev... | jamesthechamp/zamboni | lib/video/tasks.py | Python | bsd-3-clause | 3,978 |
# -*- coding: utf-8 -*-
# Unit tests for cache framework
# Uses whatever cache backend is set in the test settings file.
from __future__ import unicode_literals
import os
import re
import shutil
import tempfile
import threading
import time
import unittest
import warnings
from django.conf import settings
from django.... | rogerhu/django | tests/cache/tests.py | Python | bsd-3-clause | 79,385 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | BurtBiel/autorest | AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/Lro/autorestlongrunningoperationtestservice/models/sku.py | Python | mit | 837 |
#!/usr/bin/env python
import cmd
import json
import optparse
import pydoc
import sys
import os
import logging
from pydiscourse.client import DiscourseClient, DiscourseError
class DiscourseCmd(cmd.Cmd):
prompt = 'discourse>'
output = sys.stdout
def __init__(self, client):
cmd.Cmd.__init__(self)
... | loleg/pydiscourse | pydiscourse/main.py | Python | mit | 2,249 |
"""
Support for parsing phylogenetic tree's in newick format.
TODO: Tree/Edge should be a generic data structure, not newick specific.
"""
from bx_extras.pyparsing import *
__all__ = [ "Tree", "Edge", "NewickParser", "newick_parser" ]
def indent( s ):
return "\n".join( " " + line for line in s.split( "\n" ) ... | parlar/calls2xls | external/CrossMap/usr/lib64/python2.7/site-packages/bx/phylo/newick.py | Python | mit | 3,710 |
# -*- coding: utf-8 -*-
##
## This file is part of CDS Invenio.
## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 CERN.
##
## CDS 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 versio... | ppiotr/Bibedit-some-refactoring | modules/bibformat/lib/elements/bfe_date.py | Python | gpl-2.0 | 1,725 |
#!/usr/bin/env python
#
# Karaka Skype-XMPP Gateway: Registration service
# <http://www.vipadia.com/products/karaka.html>
#
# Copyright (C) 2008-2009 Vipadia Limited
# Richard Mortier <mort@vipadia.com>
# Neil Stratford <neils@vipadia.com>
#
## This program is free software; you can redistribute it and/or
## modify it... | agbell/karaka | register.py | Python | gpl-2.0 | 13,654 |
from module import *
class Startup(Module):
def __init__(self, target, backdoor, core):
self.core = core
self.target = target
self.name = "startup"
self.backdoor = backdoor
self.options = {
"bash": Option("bash", True, "Add to bashrc", False),
... | krintoxi/NoobSec-Toolkit | NoobSecToolkit /scripts/sshbackdoors/modules/startup.py | Python | gpl-2.0 | 1,187 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
OtbAlgorithm.py
---------------
Date : June 2017
Copyright : (C) 2017 by CS Systemes d'Information (CS SI)
: (C) 2018 by Centre National d'Etudes et... | m-kuhn/QGIS | python/plugins/processing/algs/otb/OtbAlgorithm.py | Python | gpl-2.0 | 13,439 |
#!/usr/bin/en python3
__all__ = ["get_info", "strip_site", "InfoExtractor"]
import re, sys
from ..utils import (strip_site, std, MGet, urlparse, ExtractorError)
from ..utils import common as _common
from .common import InfoExtractor
from .anivids import Anivids_IE
from .aniupload import Aniupload_IE
from .auengine i... | FrogLogics/mget | build/lib.linux-x86_64-3.5/Mget/extractor/__init__.py | Python | gpl-2.0 | 3,088 |
#!/bin/python
import os, subprocess
import logging
from autotest.client import test
from autotest.client.shared import error
class libconfig(test.test):
"""
Autotest module for testing basic functionality
of libconfig
@author Athira Rajeev <atrajeev@in.ibm.com> ##
"""
... | rajashreer7/autotest-client-tests | linux-tools/libconfig/libconfig.py | Python | gpl-2.0 | 1,250 |
# This file is part of the musicbrainzngs library
# Copyright (C) Alastair Porter, Adrian Sampson, and others
# This file is distributed under a BSD-2-Clause type license.
# See the COPYING file for more information.
import re
import threading
import time
import logging
import socket
import hashlib
import locale
impor... | mrquim/mrquimrepo | script.module.musicbrainz/lib/musicbrainzngs/musicbrainz.py | Python | gpl-2.0 | 48,787 |
# -*- coding: utf-8 -*-
# Copyright 2012 Ofir Brukner <ofirbrukner@gmail.com>
#
# This file is part of subliminal.
#
# subliminal 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 ... | serensoner/CouchPotatoServer | libs/subliminal/services/subscenter.py | Python | gpl-3.0 | 6,202 |
#
# Copyright 2010 Free Software Foundation, Inc.
#
# This file was generated by gr_modtool, a tool from the GNU Radio framework
# This file is a part of gr-howto
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
#
"""
A base class is created.
Classes based upon this are used to make more user-friendly interfaces
to the... | mrjacobagilbert/gnuradio | gr-utils/modtool/templates/gr-newmod/docs/doxygen/doxyxml/base.py | Python | gpl-3.0 | 6,205 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | a0c/odoo | addons/account_analytic_plans/account_analytic_plans.py | Python | agpl-3.0 | 23,412 |
import unittest
from django.conf import settings
# Note: the individual test files are imported below this.
class Monkeypatcher(unittest.TestCase):
"""
Base test class for tests that play with the INSTALLED_APPS setting at runtime.
"""
def create_fake_app(self, name):
class Fake:
... | nekohayo/snowy | lib/south/tests/__init__.py | Python | agpl-3.0 | 1,996 |
import sys
import os
import signal
import subprocess
import time
import twill
import urllib2
import os.path
import re
TEST_PATH = os.path.dirname(os.path.abspath(__file__))
def waitforport(port, start):
while True:
if time.time() - start > 900:
raise Exception('Servers did not start in 90 seco... | adieu/authentic2 | tests/integration/saml2/__init__.py | Python | agpl-3.0 | 1,392 |
#!/usr/bin/env python
from __future__ import with_statement
import time
import functools
import threading
import Queue
import logging
import gobject
import algorithms
import misc
_moduleLogger = logging.getLogger(__name__)
def make_idler(func):
"""
Decorator that makes a generator-function into a function tha... | epage/MaemoPythonSkeleton | src/util/go_utils.py | Python | lgpl-2.1 | 6,065 |
# Copyright (c) 2007-2009 Pedro Matiello <pmatiello@gmail.com>
#
# 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,... | sebastienhupin/qxrad | qooxdoo/tool/pylib/graph/__init__.py | Python | lgpl-3.0 | 2,259 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import re
from fabric.api import *
from fabric.tasks import Task
@task
def doctests():
"""Run the doctests found in GuessIt classes"""
local('PYTHONPATH=.:$PYTHONPATH python guessit/test/test_doctests.py')
class TestTask(Task):
name = 'testtask'
... | jfortier/guessit | fabfile.py | Python | lgpl-3.0 | 4,234 |
#
# Author:: Matthew Kent (<mkent@magoazul.com>)
# Copyright:: Copyright (c) 2009 Matthew Kent
# License:: Apache License, Version 2.0
#
# 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
#
# ... | jreichhold/chef-repo | vendor/ruby/2.0.0/gems/chef-0.8.10/lib/chef/provider/package/yum-dump.py | Python | apache-2.0 | 3,830 |
from __future__ import print_function
import unittest, sys, time, threading, struct, logging, os
import vpp_papi
from ipaddress import *
scriptdir = os.path.dirname(os.path.realpath(__file__))
papi_event = threading.Event()
print(vpp_papi.vpe.VL_API_SW_INTERFACE_SET_FLAGS)
def papi_event_handler(result):
if result.... | licko/vpp-1701-licko | vpp-api/python/tests/test_papi.py | Python | apache-2.0 | 3,363 |
#!/usr/bin/env python
#
# Copyright 2007 Google 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 o... | yencarnacion/jaikuengine | .google_appengine/google/appengine/tools/devappserver2/go_application.py | Python | apache-2.0 | 8,325 |
'''
For stress Testing: keep creating/destroying vm in 24hr
@author: Youyk
'''
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.test_state as test_state
import os
import time
import zstackwoodpecker.operations.resource_operations as res_ops... | zstackorg/zstack-woodpecker | integrationtest/vm/stress/test_24hr_create_destroy.py | Python | apache-2.0 | 1,193 |
import statsd
class Average(statsd.Client):
'''Class to implement a statsd "average" message.
This value will be averaged against other messages before being
sent.
See https://github.com/chuyskywalker/statsd/blob/master/README.md for
more info.
'''
def send(self, subname, value):
... | Ppanos40/liquid-galaxy.lg-root-fs | home/lg/bin/statsd/average.py | Python | apache-2.0 | 693 |
r"""
If I repeat a paragraph using the following formula::
do text for pp in properties_list()
and if `properties_list()` is a generator function,
then appy.pod works only correctly
if the generator function actually yields values.
The following test works:
>>> run_test(1,[
... Property("Computer","good"),
...... | lino-framework/lino | tests/appy/20111129/test.py | Python | bsd-2-clause | 2,758 |
import fnmatch
def get_files(storage, ignore_patterns=[], location=''):
"""
Recursively walk the storage directories gathering a complete list of files
that should be copied, returning this list.
"""
def is_ignored(path):
"""
Return True or False depending on whether the ``path... | faun/django_test | django/contrib/staticfiles/utils.py | Python | bsd-3-clause | 993 |
from django.conf.urls import include, url
from django.views.generic import TemplateView
urlpatterns = [
url(r'^$',
TemplateView.as_view(template_name='index.html'),
name='index'),
url(r'^accounts/',
include('registration.backends.simple.urls')),
url(r'^accounts/profile/',
... | yorkedork/django-registration | test_app/urls_simple.py | Python | bsd-3-clause | 486 |
"""Helper functions
Consists of functions to typically be used within templates, but also
available to Controllers. This module is available to both as 'h'.
"""
| obeattie/pylons | tests/test_webapps/filestotest/helpers_sample.py | Python | bsd-3-clause | 162 |
# Generated by Django 2.0.3 on 2018-08-22 12:20
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("checkout", "0009_cart_translated_discount_name")]
operations = [
migrations.AlterField(
model_name="cart",
... | maferelo/saleor | saleor/checkout/migrations/0010_auto_20180822_0720.py | Python | bsd-3-clause | 624 |
""" Test functions for stats module
"""
from __future__ import division, print_function, absolute_import
import warnings
import re
import sys
from numpy.testing import (TestCase, run_module_suite, assert_equal,
assert_array_equal, assert_almost_equal, assert_array_almost_equal,
assert_allclose, assert_, asse... | witcxc/scipy | scipy/stats/tests/test_distributions.py | Python | bsd-3-clause | 82,097 |