code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
# lock.py
# DNF Locking Subsystem.
#
# Copyright (C) 2013-2016 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is ... | j-mracek/dnf | dnf/lock.py | Python | gpl-2.0 | 5,332 |
DEFAULT_CONFIG = {
# Protector server address
'host': 'localhost',
'port': 8888,
# Connection to the time series database API
'backend_host': 'localhost',
'backend_port': 8086,
'rules': [
'prevent_delete',
'prevent_drop',
'series_endswith_dot',
'short_series_n... | trivago/Protector | protector/config/default_config.py | Python | bsd-3-clause | 1,108 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('here', '0018_post_postid'),
]
operations = [
migrations.RemoveField(
model_name='post',
name='postid... | chenjunqian/here | HereServer-deprecated/here/migrations/0019_remove_post_postid.py | Python | gpl-2.0 | 340 |
from __future__ import division
import numpy as np
# Non-monotonic Sobol G Function (8 parameters)
# First-order indices:
# x1: 0.7165
# x2: 0.1791
# x3: 0.0237
# x4: 0.0072
# x5-x8: 0.0001
def evaluate(values, a=None):
if type(values) != np.ndarray:
raise TypeError("The argument `values` m... | willu47/SALib | src/SALib/test_functions/Sobol_G.py | Python | mit | 1,685 |
###################################################################################
## MODULE : spell.lib.adapter.constants.__init__
## DATE : Mar 18, 2011
## PROJECT : SPELL
## DESCRIPTION: Module initialization
## --------------------------------------------------------------------------------
##
## Co... | Spacecraft-Code/SPELL | src/spell/spell/lib/adapter/constants/__init__.py | Python | lgpl-3.0 | 1,267 |
# -*- coding: utf-8 -*-
# Author: Jan Paricka
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'h9w5qat*mdxuwjrn+z3=$s3c_f1_Jan_Paricka_mcz+@#u%^z24jdkdc5b!=$'
ADMINS = (
('Jan Paricka', 'jparicka@gmail.com'),
('Ond... | followyourheart/cloudly | cloudly/settings.py | Python | mit | 3,381 |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
TopoDelProp
A QGIS plugin
TopoDelProp
-------------------
begin : 2011-12-19
copyright : (C) 2011 by... | gasparmoranavarro/TopoDelProp | ctr/ctrIntrodDatos_NFinca.py | Python | gpl-2.0 | 10,273 |
#!/usr/bin/env python
"""
dirac-my-great-script
This script prints out how great is it, shows raw queries and sets the
number of pings.
Usage:
dirac-my-great-script [option|cfgfile] <Arguments>
Arguments:
<service1> [<service2> ...]
"""
from DIRAC import S_OK, S_ERROR, gLogger... | DIRACGrid/DIRACDocs | source/DeveloperGuide/AddingNewComponents/DevelopingCommands/dirac-my-great-script.py | Python | gpl-3.0 | 2,711 |
""" generate_uniform_precip.py
This component generates rainfall
events based on statistical distributions.
No particular units must be used, but it was
written with the storm units in hours (hr)
and depth units in millimeters (mm)
Written by Jordan Adams, 2013.
"""
import os
import numpy as np... | decvalts/landlab | landlab/components/uniform_precip/generate_uniform_precip.py | Python | mit | 16,070 |
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright (C) 2015, 2016 Canonical Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# This program is distributed in... | jocave/snapcraft | snapcraft/tests/test_commands_prime.py | Python | gpl-3.0 | 5,460 |
# Copyright 2016 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.
from __future__ import print_function
import os
import sys
from gpu_tests import common_browser_args as cba
from gpu_tests import gpu_integration_test
from... | scheib/chromium | content/test/gpu/gpu_tests/trace_integration_test.py | Python | bsd-3-clause | 20,948 |
"""The Unix filesystem
https://en.wikipedia.org/wiki/Unix_filesystem#Conventional_directory_layout
The filesystem appears as one rooted tree of directories
Instead of addressing separate volumes such as disk partitions,
removable media,
and network shares as separate trees (
as done in DOS and Window... | jalanb/dotsite | pysyte/unix/root.py | Python | mit | 918 |
import time
import pyven.constants
from pyven.steps.step import Step
from pyven.checkers.checker import Checker
from pyven.logging.logger import Logger
from pyven.reporting.content.step import StepListing
class Postprocess(Step):
def __init__(self, verbose, nb_threads=1):
super(Postprocess, self).__init_... | mgaborit/pyven | source/pyven/steps/postprocess.py | Python | mit | 1,841 |
from exchanges import helpers
from exchanges import hitbtc
from exchanges import kraken
from exchanges import opportunity_kraken
import opportunity
from time import sleep
from datetime import datetime
import csv
# PREPARE OUTPUT FILE
# tell computer where to put CSV and to name it
filename = datetime.now().strftime(... | Humantrashcan/prices | request.py | Python | mit | 4,411 |
# Copyright (c) 2010 Mitch Garnaat http://garnaat.org/
# Copyright (c) 2011 Harry Marr http://hmarr.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
# wit... | mikel-egana-aranguren/SADI-Galaxy-Docker | galaxy-dist/eggs/boto-2.27.0-py2.7.egg/boto/ses/connection.py | Python | gpl-3.0 | 21,708 |
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 25 10:21:20 2016
@author: suraj
"""
import pickle
import numpy as np
X = pickle.load(open('x_att.p'))
y = pickle.load(open('y_att.p'))
batchX = []
batchy = []
def convertPointsToBatch(day_of_week,data1,data2):
for i in range(5):
batchX.extend(data1... | suraj-jayakumar/lstm-rnn-ad | src/testdata/random_data_15min_ts/point_to_batch_data_conversion.py | Python | apache-2.0 | 762 |
# -*- coding: utf-8 -*-
# Pluma External Tools plugin
# Copyright (C) 2005-2006 Steve Frécinaux <steve@istique.net>
# Copyright (C) 2012-2021 MATE Developers
#
# 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
# ... | mate-desktop/pluma | plugins/externaltools/tools/functions.py | Python | gpl-2.0 | 10,724 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import requests
from lxml import html
from datetime import datetime, timedelta
# get news in last X days
DAY = 3
# url of the news page
BASE_URL = "http://see.xidian.edu.cn/"
# get the page content
r = requests.get(BASE_URL)
# override the encoding
r.encoding = 'GBK'
... | runningwolf666/xidian-scripts | get_xidian_news.py | Python | mit | 931 |
'''
New Integration Test for Simple VM stop/start scheduler with repeatCount.
@author: quarkonics
'''
import os
import time
import zstackwoodpecker.operations.vm_operations as vm_ops
import zstackwoodpecker.operations.scheduler_operations as schd_ops
import zstackwoodpecker.test_util as test_util
import ... | zstackio/zstack-woodpecker | integrationtest/vm/virtualrouter/scheduler/test_create_start_stop_vm_simple_repeatcount_scheduler.py | Python | apache-2.0 | 4,057 |
#
# Copyright (c) 2008--2012 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You should have received a c... | xkollar/spacewalk | client/tools/osad/src/dispatcher_client.py | Python | gpl-2.0 | 7,736 |
"""empty message
Revision ID: 74af9cceeeaf
Revises: 6e7b88dc4544
Create Date: 2017-07-30 20:47:07.982489
"""
# revision identifiers, used by Alembic.
revision = '74af9cceeeaf'
down_revision = '6e7b88dc4544'
from alembic import op
import sqlalchemy as sa
def upgrade():
# ### commands auto generated by Alembic ... | Tethik/faktura | migrations/versions/74af9cceeeaf_.py | Python | mit | 634 |
"""Twitter authentication related utilities."""
import logging
import tweepy
log = logging.getLogger(__name__)
def get_authorized_api(access_token_key, access_token_secret, consumer_key, consumer_secret):
"""Return an API object initialized with the given token and secret.
:Parameters:
- `access_t... | ysenko/python-from-zero-to-hero | twitter_explorer/twitter_backend/auth.py | Python | mit | 1,799 |
#!/usr/bin/python3
from setuptools import setup, find_packages
setup(
name = "LaVa",
version = "0.2",
packages = find_packages(),
scripts = ['analyser.py', 'visualizer.py'],
install_requires = [
'nltk>=3.0.0'
],
package_data = {
'': ['*.txt']
},
author = "Scott R. Pledger",
author_email = "pledger@color... | scottpledger/lava | setup.py | Python | gpl-2.0 | 459 |
_author_ = 'Srikrishna'
import ConfigParser
import sys
import logging
logger = logging.getLogger(__name__)
sections = 'Connection','Configuration','Testing'
class MyConfiguration(object):
def __init__(self, *file_names):
parser = ConfigParser.ConfigParser()
parser.optionxform = str # make opti... | srikrishna3118/Lora_GW | PythonFiles/Config.py | Python | gpl-3.0 | 632 |
# Bob build tool
# Copyright (C) 2016 Jan Klötzke
#
# SPDX-License-Identifier: GPL-3.0-or-later
from unittest import TestCase
import yaml
from bob.errors import ParseError
from bob.input import ScmOverride
from bob.stringparser import Env
class TestScmOverride(TestCase):
def setUp(self):
self.scm = {
... | stefanreuther/bob | test/test_input_scmoverride.py | Python | gpl-3.0 | 6,234 |
# -*- coding: utf-8 -*-
"""
批量移动文件
https://developer.qiniu.com/kodo/api/1250/batch
"""
from qiniu import build_batch_move, Auth, BucketManager
access_key = ''
secret_key = ''
q = Auth(access_key, secret_key)
bucket = BucketManager(q)
src_bucket_name = ''
target_bucket_name = ''
# force为true时强制同名覆盖, 字典的键为原文件,... | jemygraw/python-sdk | examples/batch_move.py | Python | mit | 557 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
for part in orm.PaymentPart.objects.all():
print('----------------\nfound part %s - $%s' % (part.id, part.pri... | bankonme/www.freedomsponsors.org | djangoproject/core/migrations/0021_set_paymentpart_solution.py | Python | agpl-3.0 | 16,118 |
#!/usr/bin/env python
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
from __future__ import with_statement
__license__ = 'GPL v3'
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
import sys, os, shutil, plistlib, subprocess, glob, zipfile, tempfile, \
py_compi... | yeyanchao/calibre | setup/installer/osx/app/main.py | Python | gpl-3.0 | 23,748 |
# This script animates an averaged variable in time, Notably in the Telow case for the void fraction
#
# A FOLDER ./voidfraction/averaged must exist!
# Author : Bruno Blais
# Last modified : 24-02-2014
#Python imports
#----------------
import os
import sys
import numpy
import math
import matplotlib.pyplot as plt
imp... | blaisb/cfdemUtilities | couette/movieAllTetlow.py | Python | lgpl-3.0 | 1,840 |
# -*- coding: utf-8 -*-
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2012-2013 Elanz (<http://www.openelanz.fr>).
#
# 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 Foun... | noemis-fr/old-custom | e3z_mail_ipbox/sale.py | Python | agpl-3.0 | 2,613 |
###############################################################################
#
# Tests for XlsxWriter.
#
# SPDX-License-Identifier: BSD-2-Clause
# Copyright (c), 2013-2022, John McNamara, jmcnamara@cpan.org
#
import unittest
from io import StringIO
from ..helperfunctions import _xml_to_list
from ...table import Tab... | jmcnamara/XlsxWriter | xlsxwriter/test/table/test_table06.py | Python | bsd-2-clause | 2,225 |
#!/usr/bin/python
'''
annotate a fasta sequence for KMAD with structural information
requirements:
- SwissProt database:
- fasta and text files split in separate entries)
- formatted for blast
- DSSP
- blastp
input:
- a regular fasta file
or
- a fasta.7c file (converted with IDP converter fr ... | cmbi/kmad | scripts/annotate_strct_alignment.py | Python | gpl-3.0 | 20,890 |
import platform
from base64 import b64encode
import re
from ingenico.connect.sdk.data_object import DataObject
from ingenico.connect.sdk.defaultimpl.default_marshaller import \
DefaultMarshaller
from ingenico.connect.sdk.domain.metadata.shopping_cart_extension import ShoppingCartExtension
from request_header impor... | Ingenico-ePayments/connect-sdk-python2 | ingenico/connect/sdk/meta_data_provider.py | Python | mit | 5,912 |
#!/usr/bin/env python
# A module for sleeping and testing return codes, so tests run on windows too.
import time
import signal
import sys
DROP_SIGTERM = 250
def handle_sigterm(*args):
# Should support the various OS's to return the correct value
global sigtermReturnCode
if sigtermReturnCode == DROP_SI... | kata198/python-subprocess2 | tests/subprocess2Tests/sleeper.py | Python | lgpl-3.0 | 959 |
# Copyright (c) 2014-2016, NVIDIA CORPORATION. All rights reserved.
from __future__ import absolute_import
import os
# Find the best implementation available
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
import caffe_pb2
import flask
import lmdb
import PIL.Image
from... | brainstorm-ai/DIGITS | digits/dataset/images/classification/views.py | Python | bsd-3-clause | 15,470 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
def reset_extensions_translations_locales(apps, schema_editor):
"""Reset the locale field for all translations on existing Extensions. This
is done to fix bug 1215094: some translations were created with the wron... | washort/zamboni | mkt/extensions/migrations/0016_reset_extensions_translations_locale.py | Python | bsd-3-clause | 1,062 |
# Copyright 2013 IBM Corp.
#
# 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... | phenoxim/cinder | cinder/api/contrib/volume_mig_status_attribute.py | Python | apache-2.0 | 2,136 |
#
# Copyright (c) 2008--2014 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You should have received a c... | hustodemon/spacewalk | backend/server/action_extra_data/packages.py | Python | gpl-2.0 | 16,087 |
# -*- coding: utf-8 -*-
import random
import pygame
import classes.board
import classes.drw.fraction_hq
import classes.game_driver as gd
import classes.level_controller as lc
import classes.extras as ex
class Board(gd.BoardGame):
def __init__(self, mainloop, speaker, config, screen_w, screen_h):
self.lev... | imiolek-ireneusz/eduActiv8 | game_boards/game093.py | Python | gpl-3.0 | 11,038 |
# Author: echel0n <echel0n@sickrage.ca>
# URL: https://sickrage.ca
#
# This file is part of SickRage.
#
# SickRage 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... | gborri/SickRage | sickrage/core/databases/cache/index.py | Python | gpl-3.0 | 4,038 |
# 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... | zhouyao1994/incubator-superset | superset/examples/long_lat.py | Python | apache-2.0 | 3,916 |
"""
SoftLayer.tests.CLI.core_tests
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:license: MIT, see LICENSE for more details.
"""
import logging
import SoftLayer
from SoftLayer.CLI import core
from SoftLayer.CLI import environment
from SoftLayer import testing
from SoftLayer import utils
import click
import mock
clas... | nanjj/softlayer-python | tests/CLI/core_tests.py | Python | mit | 4,014 |
#!/usr/bin/python
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed... | Tiger66639/ansible-modules-core | cloud/amazon/s3.py | Python | gpl-3.0 | 25,945 |
"""
n! means n * (n 1) * ... * 3 * 2 * 1
For example, 10! = 10 * 9 * ... * 3 * 2 * 1 = 3628800,
and the sum of the digits in the number 10! is 3 + 6 + 2 + 8 + 8 + 0 + 0 = 27.
Find the sum of the digits in the number 100!
"""
from math import factorial
print sum(map(int,list(str(factorial(100))))) | hickeroar/project-euler | 020/solution020.py | Python | mit | 302 |
#!/usr/bin/env python
'''
Handles access to the WebDAV's server creditentials.
'''
from collections import namedtuple
import secretstorage
APPLICATION_NAME = "davify"
FileStorage = namedtuple('FileStorage',
'username password protocol server port path')
def get_secret_storage():
bus =... | AlbertWeichselbraun/davify | src/davify/keyring.py | Python | gpl-3.0 | 1,784 |
# -*- coding: utf-8 -*-
"""
requests.api
~~~~~~~~~~~~
This module implements the Requests API.
:copyright: (c) 2012 by Kenneth Reitz.
:license: Apache2, see LICENSE for more details.
"""
from . import sessions
def request(method, url, **kwargs):
"""Constructs and sends a :class:`Request <Request>`.
:para... | lllucius/climacast | requests/api.py | Python | agpl-3.0 | 6,229 |
from tcpgecko import TCPGecko
from binascii import hexlify, unhexlify
import sys
try: import __builtin__
except: import builtins as __builtin__
def hex(value, fill):
return "0x" + __builtin__.hex(value).lstrip("0x").rstrip("L").zfill(fill).upper()
tcp = TCPGecko("192.168.0.10")
title_id = 0x0005000010144F00 #Smas... | XBigTK13X/wiiu-memshark | vendor/tcpgecko/syshax.py | Python | mit | 732 |
# coding: utf-8
"""
MINDBODY Public API
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: v6
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
impo... | mindbody/API-Examples | SDKs/Python/test/test_get_clients_response.py | Python | bsd-2-clause | 972 |
#!/usr/bin/env python
import os
import sys
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(BASE_DIR)
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "test_project.settings")
from django.core.management import execute_from_command_line
ex... | clearspark/django-monthfield | test_project/manage.py | Python | bsd-3-clause | 354 |
#!/usr/bin/env python
#
# Copyright 2016 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 requir... | Aloomaio/googleads-python-lib | examples/ad_manager/v201808/package_service/get_in_progress_packages.py | Python | apache-2.0 | 1,890 |
## Copyright (c) 2012-2015 Aldebaran Robotics. All rights reserved.
## Use of this source code is governed by a BSD-style license that can be
## found in the COPYING file.
import os
import qisys.script
from qibuild.test.conftest import TestBuildWorkTree
import pytest
def test_pml_outside_worktree(tmpdir, monkeypat... | dmerejkowsky/qibuild | python/qilinguist/test/test_qilinguist_release.py | Python | bsd-3-clause | 2,577 |
from __future__ import (absolute_import, division, print_function)
import unittest
from mantid.simpleapi import logger
import numpy as np
import json
import AbinsModules
def old_python():
"""" Check if Python has proper version."""
is_python_old = AbinsModules.AbinsTestHelpers.old_python()
if is_python_ol... | wdzhou/mantid | scripts/test/AbinsLoadCRYSTALTest.py | Python | gpl-3.0 | 8,735 |
from rlkit.torch.core import PyTorchModule
class LinearTransform(PyTorchModule):
def __init__(self, m, b):
super().__init__()
self.m = m
self.b = b
def __call__(self, t):
return self.m * t + self.b
| vitchyr/rlkit | rlkit/torch/networks/linear_transform.py | Python | mit | 241 |
# -*- coding: utf-8 -*-
"""Program to process a single station using information from files.
If you use the optimized birrp.exe and you get an error saying: didn't find all
the .bf files, something a miss. Try running using the old version. Something
in the optimization compiler changes something in the variable us... | MTgeophysics/mtpy | legacy/runbirrpsinglestation.py | Python | gpl-3.0 | 6,757 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
openslides.agenda.views
~~~~~~~~~~~~~~~~~~~~~~~
Views for the agenda app.
:copyright: 2011 by the OpenSlides team, see AUTHORS.
:license: GNU GPL, see LICENSE for more details.
"""
from datetime import datetime
from django.shortcuts import render_... | svschannak/openslides-templates-pmv | openslides/agenda/views.py | Python | gpl-2.0 | 13,460 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Entry.author'
db.add_column(u'feeds_entry', 'author',
self.gf('django.... | vincentbernat/feedhq | feedhq/feeds/migrations/0008_auto__add_field_entry_author.py | Python | bsd-3-clause | 9,489 |
import traceback
events = {}
def registerEvent(name,func,priority=5):
"""Registers an event handler"""
global events
# Max priority of 5
if priority > 5:
priority = 5
if priority < 0:
priority = 0
# No such event, add it
if name not in events:
events[name] = {}
... | andrewphorn/Ainsly | core/events.py | Python | mit | 2,421 |
"""
Tests for Suite model.
"""
from django.core.exceptions import ValidationError
from tests import case
class SuiteTest(case.DBTestCase):
def test_unicode(self):
"""Unicode representation is name of Suite."""
self.assertEqual(unicode(self.F.SuiteFactory(name="Foo")), u"Foo")
def test_clo... | peterbe/moztrap | tests/model/library/models/test_suite.py | Python | bsd-2-clause | 2,013 |
"""XViewMiddleware has been moved to django.contrib.admindocs.middleware."""
import warnings
warnings.warn(__doc__, DeprecationWarning, stacklevel=2)
from django.contrib.admindocs.middleware import XViewMiddleware
| denisenkom/django | django/middleware/doc.py | Python | bsd-3-clause | 216 |
import unittest
import pinq
class queryable_difference_tests(unittest.TestCase):
def setUp(self):
self.queryable1 = pinq.as_queryable(range(1, 11))
self.queryable2 = pinq.as_queryable(range(2, 10, 2))
def test_difference_list(self):
self.assertEqual(list(self.queryable1.difference(
... | dlshriver/pinq | tests/test_queryable_difference.py | Python | mit | 1,827 |
import sys
import time
import unittest
from neupy.helpers import progressbar
from base import BaseTestCase
from utils import catch_stdout
class ProgressbarTestCase(BaseTestCase):
@unittest.skip("Broken test")
def test_simple_progressbar(self):
with catch_stdout() as out:
iterator = progr... | stczhc/neupy | tests/helpers/test_progressbar.py | Python | mit | 780 |
import xml.etree.ElementTree as ET
import checkmod
DEBUG = 0
if DEBUG:
XMLPath = '../../Package.xml'
EmbedFile = '../../DreamInstaller/Embed.inc'
CodeFile = '../../DreamInstaller/Files.inc'
else:
XMLPath = '../Package.xml'
EmbedFile = 'Embed.inc'
CodeFile = 'Files.inc'
def I... | DreamHacks/dreamdota | DreamWarcraft/Build Tools/PackFiles.py | Python | mit | 860 |
import colorsys
from itertools import cycle
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
plt.style.use('ggplot')
import numpy as np
def get_separate_colors(count):
num_div = np.linspace(0.0,1.0,num=count,endpoint=False)
return [[a,b,c] for (a,b,c) in [colorsys.hsv_to_rgb(d,1.0,1.0) \... | nOkuda/classtm | classtm/plot.py | Python | gpl-3.0 | 2,160 |
'''
Tests properties.
Copyright (c) 2009, 2013 Peter Parente
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR D... | parente/pyttsx | tests/unit/test_prop.py | Python | isc | 4,557 |
import re,xbmcaddon,time,requests
from ..scraper import Scraper
from ..common import random_agent,send_log,error_log
requests.packages.urllib3.disable_warnings()
s = requests.session()
dev_log = xbmcaddon.Addon('script.module.universalscrapers').getSetting("dev_log")
from universalscrapers.modules import cfscrape
clas... | repotvsupertuga/tvsupertuga.repository | script.module.streamtvsupertuga/lib/resources/lib/sources/it/watchstream.py | Python | gpl-2.0 | 2,011 |
import struct
import textwrap
import typing
from .abstractentry import AbstractEntry
from .sound import Sound
if typing.TYPE_CHECKING:
from ..rom import Rom
class InstrumentList(AbstractEntry):
"""The list of instruments used by the game to play music.
Instrument information was found through some guess... | adambiser/snes-wolf3d-extractor | extractor/entrytype/instrument_list.py | Python | mit | 5,727 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
#
# Copyright 2013 Rémi Palancher
#
# This file is part of Cloubed.
#
# Cloubed 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 Lice... | rezib/cloubed | cloubed/HTTPServer.py | Python | lgpl-3.0 | 2,423 |
import os
from .authenticated_client import AuthenticatedClient
from .errors import ControllerConnectionError
LOCAL_DEFAULT_USERNAME = "paradrop"
LOCAL_DEFAULT_PASSWORD = ""
PARADROP_API_TOKEN = os.environ.get("PARADROP_API_TOKEN", None)
PARADROP_CHUTE_NAME = os.environ.get("PARADROP_CHUTE_NAME", None)
PDSERVER_UR... | ParadropLabs/Paradrop | tools/pdtools/pdtools/controller_client.py | Python | apache-2.0 | 9,487 |
#!/usr/bin/env python3
import xml.etree.ElementTree as ET
import sys
# Read command line arguments and check there is only one
arguments = sys.argv
if len(arguments) != 2:
print("Usage: amfprint [FILE]")
sys.exit(2)
amf = arguments[1]
# Read AMF file
try:
tree = ET.parse(amf)
root = tree.getroot()
e... | UniversalScientificTechnologies/MLAB-3Dprinter | hw/cad/amfsort.py | Python | gpl-3.0 | 2,472 |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2015, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | tomsilver/nupic.research | union_pooling/union_pooling/experiments/union_pooler_experiment.py | Python | gpl-3.0 | 9,172 |
"""
Test lldb data formatter subsystem.
"""
from __future__ import print_function
import datetime
import os
import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class PrintObjectArrayTestCase(TestBase):
mydir = TestBase.compu... | youtube/cobalt | third_party/llvm-project/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/poarray/TestPrintObjectArray.py | Python | bsd-3-clause | 3,381 |
import asyncio
# python 3.6 doesn't have "get_running_loop"
get_running_loop = getattr(asyncio, "get_running_loop", asyncio.get_event_loop)
| madedotcom/photon-pump | photonpump/compat.py | Python | mit | 141 |
# Copyright 2012 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Test dist-upgrader custom uploads.
See also lp.soyuz.tests.test_distroseriesqueue_dist_upgrader for high-level
tests of dist-upgrader upload and queue manipulation.
"""
import... | abramhindle/UnnaturalCodeFork | python/testdata/launchpad/lib/lp/archivepublisher/tests/test_dist_upgrader.py | Python | agpl-3.0 | 4,270 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import re
import sys
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
def get_version(*file_paths):
"""Retrieves the version from txmoney/__init__.py"""
filename = os.path.join(os.path.dirname(__file__), *fi... | txerpa/dj-txmoney | setup.py | Python | mit | 2,449 |
# Copyright 2008 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 or agreed to in writing, ... | rietveld-codereview/rietveld | codereview/views.py | Python | apache-2.0 | 173,739 |
from django import forms
class CartForm(forms.Form):
email = forms.CharField(max_length=100, widget=forms.TextInput(
attrs={'class':"autosave required", 'placeholder':""}))
name = forms.CharField(max_length=100, widget=forms.TextInput(
attrs={'class':"autosave requi... | tomcounsell/Cobra | apps/public/views/forms.py | Python | gpl-2.0 | 2,154 |
import ConfigParser
import logging
from miro import api
from miro import app
from miro.test.framework import MiroTestCase
from miro.test import mock
# define stubs to allow us to use this module as an extension module
def unload():
pass
ext_context = None
def load(context):
global ext_context
ext_contex... | debugger06/MiroX | lib/test/extensiontest.py | Python | gpl-2.0 | 6,603 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
# Copyright (C) 2008-2008 凯源吕鑫 lvxin@gmail.com <basic chart data>
# 维智众源 oldrev@gmail.com <states data>
# Copyright (C) 2012-2012 南京盈通 ccdos@intoerp.com <small business chart>
# Copyright (C) 2... | t3dev/odoo | addons/l10n_cn/__manifest__.py | Python | gpl-3.0 | 1,061 |
import pymel.core as pm
import os
import metautil.json_util as json_u
class Follicle():
'''Creates a hair Follicle in Maya and attaches it to a mesh.'''
def __init__(self, follicle):
if follicle and not follicle.listRelatives(shapes=True) and type(follicle) == pm.nt.Follicle:
self.follicle = follicle
self.... | deathglitch/metarigging | python/model/follicle.py | Python | mit | 4,928 |
"""
This little helper takes Lebedev point and weight data from [1] and produces JSON files.
[1]
https://people.sc.fsu.edu/~jburkardt/datasets/sphere_lebedev_rule/sphere_lebedev_rule.html
"""
import os
import re
import numpy as np
def read(filename):
data = np.loadtxt(filename)
azimuthal_polar = data[:, :2]... | nschloe/quadpy | tools/lebedev/import_lebedev.py | Python | mit | 4,694 |
# -*- coding: utf-8 -*-
"""
define some help functions
"""
import io
import csv
import datetime
import config
import os
def format_stocks(stocks_result):
input_stream = io.StringIO(stocks_result)
csv_f = csv.reader(input_stream)
header_str = '{:<6} {:\u3000<5} {:\u3000<5} {:<7} {:<10} {:<10}'
format_st... | guryun/guryunSDK | utils.py | Python | mit | 1,095 |
# -*- 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/.
from django.db import models
from django.utils import timezone
from utils.models import CNPJFiel... | ansp-2015/arquea | identificacao/models.py | Python | mpl-2.0 | 17,924 |
# 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 ... | rjschwei/azure-sdk-for-python | azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/models/shared_access_authorization_rule_properties.py | Python | mit | 954 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django.conf.urls import url
from . import views
urlpatterns = [
# URL pattern for the UserListView
url(
regex=r'^$',
view=views.NotifyView.as_view(),
name='notify'
),
url(
regex=r'^me... | TexasLAN/texaslan.org | texaslan/notify/urls.py | Python | mit | 395 |
from unittest import TestCase
class TestAtributosDisponibles(TestCase):
@classmethod
def setUpClass(cls):
class Vacio:
pass
cls.fichero = Vacio()
cls.fichero.name = "/home/usuario/README.md"
def test_cambio_extension_fichero_nuevo(self):
from mzbackup.utils.p... | VTacius/MZBackup | tests/utils/pato/test_atributos_disponibles.py | Python | lgpl-3.0 | 771 |
import _io
import collections
import unittest
from mock import patch, Mock, call, MagicMock, sentinel
import low_level
def mock_open(mock=None, read_data='', lines=None):
"""
A helper function to create a mock to replace the use of `open`. It works
for `open` called directly or used as a context manager.
... | dgrant/brickowl2rebrickable | tests/test_low_level.py | Python | gpl-2.0 | 4,886 |
#!c:\users\домашний\dropbox\pycharmprojects\github\django_test\dj_env\scripts\python.exe
from django.core import management
if __name__ == "__main__":
management.execute_from_command_line()
| Daneev/Django_test | dj_env/Scripts/django-admin.py | Python | apache-2.0 | 203 |
# ==========================================================================
#
# 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/... | thewtex/ITK | Modules/Core/SpatialObjects/wrapping/test/SpatialObjectTest.py | Python | apache-2.0 | 1,668 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Shape-Out - meta data functionalities"""
from __future__ import division, unicode_literals
import hashlib
import pathlib
import warnings
import h5py
import imageio
import nptdms
from dclab.rtdc_dataset import config as rt_config
from dclab.rtdc_dataset import fmt_tdms
fr... | ZellMechanik-Dresden/ShapeOut | shapeout/meta_tool.py | Python | gpl-2.0 | 11,078 |
# Copyright 2015 Cloudbase Solutions Srl
# 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 r... | bigswitch/nova | nova/virt/hyperv/serialconsoleops.py | Python | apache-2.0 | 3,970 |
# Copyright 2014, Rackspace, US, 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 w... | AlexOugh/horizon | openstack_dashboard/test/api_tests/rest_util_tests.py | Python | apache-2.0 | 6,677 |
# -*- coding: utf-8 -*-
# Copyright 2014 Leonidas Poulopoulos
# Copyright 2014 Costas Drogos
# Copyright 2014 Stavros Kroustouris
#
# 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:/... | grnet/mupy | muparse/management/commands/parse_munin.py | Python | gpl-3.0 | 9,781 |
import pytest
from swimlane import exceptions
@pytest.fixture(autouse=True, scope='module')
def my_fixture(helpers):
# setup stuff
defaultApp = 'selection fields'
pytest.swimlane_instance = helpers.swimlane_instance
pytest.py_ver = helpers.py_ver
pytest.app, pytest.appid = helpers.findCreateApp(de... | Swimlane/sw-python-client | functional_tests/driver_tests/test_selection_fields.py | Python | mit | 12,296 |
# Copyright (C) 2008-2010, 2013-2014 Rocky Bernstein <rocky@gnu.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 License, or
# (at your option) any later versio... | kamawanu/pydbgr | __pkginfo__.py | Python | gpl-3.0 | 3,628 |
from sandbox.dalz.data import ArticleCommentCountFileData, ArticlePublicationDateFileData, ArticleAuthorFileData, \
ArticleWordCountFileData, CommentAuthorCommentCountFilesDatas, AuthorArticleCountFilesData, \
AuthorArticlesCommentsCountAverageFilesData, AuthorArticlesWordsCountAverageFilesData, \
ArticlePu... | buxx/TextDataExtractor | sandbox/dalz/implode.py | Python | gpl-2.0 | 1,003 |
# -*- coding: utf-8 -*-
#------------------------------------------------------------
# pelisalacarta - XBMC Plugin
# Conector para longurl (acortador de url)
# http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/
#------------------------------------------------------------
import urlparse,urllib2,urllib,re
import ... | prds21/repository-barrialTV | servers/longurl.py | Python | gpl-2.0 | 1,796 |
"""Base email backend class."""
class BaseEmailBackend(object):
"""
Base class for email backend implementations.
Subclasses must at least overwrite send_messages().
open() and close() can be called indirectly by using a backend object as a
context manager:
with backend as conn... | diego-d5000/MisValesMd | env/lib/python2.7/site-packages/django/core/mail/backends/base.py | Python | mit | 1,627 |
import utcdatetime
from nose.tools import assert_equal
import datetime
TEST_CASES = [
(
utcdatetime.utcdatetime(2015, 5, 11, 16, 43, 10, 45),
datetime.date(2015, 5, 11)
),
]
def test_date_method():
for utc_dt, expected_date in TEST_CASES:
yield _assert_date_equals, utc_dt, expe... | paulfurley/python-utcdatetime | utcdatetime/tests/test_date.py | Python | mit | 442 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# rcpy documentation build configuration file, created by
# sphinx-quickstart on Sat May 20 09:36:24 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autog... | mcdeoliveira/rcpy | doc/conf.py | Python | mit | 4,832 |
# 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 Li... | FNST-OpenStack/horizon | openstack_dashboard/test/integration_tests/config.py | Python | apache-2.0 | 3,298 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.