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 |
|---|---|---|---|---|---|
#!/usr/bin/env python
#
# Copyright (c) 2013 Corey Goldberg
#
# 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.
#
# ... | cgoldberg/procstats | test_procstats.py | Python | gpl-3.0 | 3,147 |
default_app_config = 'exams.apps.ExamsConfig'
| Zahajamaan/Fudulbank | exams/__init__.py | Python | agpl-3.0 | 46 |
# Copyright 2018 Verizon Wireless
# 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... | openstack/glance | glance/tests/unit/async_/flows/test_api_image_import.py | Python | apache-2.0 | 51,706 |
# Copyright 2020 The Cirq Developers
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | quantumlib/Cirq | cirq-core/cirq/experiments/purity_estimation_test.py | Python | apache-2.0 | 923 |
from typing import Optional
from functools import wraps
from flask import request
from flask import current_app as app
def blueprint_auth(resource: Optional[str] = None):
"""
This decorator is used to add authentication to a Flask Blueprint
"""
def fdec(f):
@wraps(f)
def decorated(*ar... | petrjasek/superdesk-core | superdesk/auth/decorator.py | Python | agpl-3.0 | 569 |
"""
Wrapper class that takes a list of template loaders as an argument and attempts
to load templates from them in order, caching the result.
"""
import hashlib
from django.template import TemplateDoesNotExist
from django.template.backends.django import copy_exception
from django.utils.encoding import force_bytes
fr... | edmorley/django | django/template/loaders/cached.py | Python | bsd-3-clause | 3,669 |
# vim: set fileencoding=utf-8 :
from __future__ import absolute_import
from __future__ import print_function
import sys
import re
import boto
import boto.ec2
import boto.vpc
from .. import errors
from .. import formatting
from .. import provider
# -- API request/response stuff --
http_messages = { 400: "Problem wit... | unixnut/cloud-support | shepherd/aws/__init__.py | Python | gpl-2.0 | 11,401 |
# util.py
# -------
# Licensing Information: You are free to use or extend these projects for
# educational purposes provided that (1) you do not distribute or publish
# solutions, (2) you retain this notice, and (3) you provide clear
# attribution to UC Berkeley, including a link to http://ai.berkeley.edu.
#
# Attri... | omardroubi/Artificial-Intelligence | Projects/Project4/bayesNets/util.py | Python | apache-2.0 | 25,733 |
from flask_app.flask_app import db
from crypto.CryptoUtils import generate_api_key
from datetime import datetime, timedelta
class ApiUser(db.Model):
__tablename__ = "api_user"
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
key = db.Column(db.String(126))
email = db.Column(db.String(1... | MaximeGir/StarTrekCorpora | database/models/ApiUser.py | Python | mit | 801 |
# -*- coding: utf-8 -*-
import codecs
import os
from django.conf import settings
from django.utils.html import strip_tags
#from haystack import site
from haystack import indexes
from haystack.fields import CharField
from celery_haystack import indexes as celery_indexes
from projects import constants
from projects.m... | nyergler/pythonslides | readthedocs/projects/search_indexes.py | Python | mit | 3,498 |
#!/usr/bin/env python
#
# This script demonstrates both the high-level AND low-level
# OT API, in the Python language.
#
# Before running this script, make sure the _opentxs.so and
# the opentxs.py are both in a folder on the path: $PYTHONPATH
# Personally I put them in /usr/local/lib/python2.7/site-packages
# and the... | Open-Transactions/opentxs-cli | scripts/demo/python/python_ot_test.py | Python | agpl-3.0 | 6,333 |
from setuptools import setup
setup(
name='tangouca', # jeez
version='0.0.1',
author='Matthias Vogelgesang',
author_email='matthias.vogelgesang@kit.edu',
url='http://ufo.kit.edu',
license='(?)',
description='TANGO server for libuca',
long_description='TANGO server for libuca',
scr... | ufo-kit/libuca | tango/setup.py | Python | lgpl-2.1 | 381 |
# -*- coding: utf-8 -*-
import psycopg2
import sqlalchemy
from sqlalchemy import Column, Float, Integer, String, Boolean, DateTime, and_
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import ForeignKey
from sqlalchemy.orm import relationship
from sqlalchemy.orm import sessionmaker
from sqlalche... | verejnedigital/verejne.digital | obstaravania/data_model.py | Python | apache-2.0 | 4,625 |
"""aiohttp plugin that reads app configuration and stores a
GitHubClient object on app['client'].
If using caching, the caching plugin MUST be set up before
setting up this plugin.
"""
from .client import GitHubClient
from api.cache import APP_KEY as CACHE_APP_KEY
CONFIG_KEY = 'GITHUB'
APP_CLIENT_KEY = 'github_client... | sloria/sir | api/github/plugin.py | Python | mit | 574 |
import os
from pymco.test import ctxt
from . import base
class RabbitMQTestCase(base.IntegrationTestCase):
'''RabbitMQ integration test case.'''
CTXT = {
'connector': 'rabbitmq',
'plugin.rabbitmq.vhost': '/mcollective',
'plugin.rabbitmq.pool.size': '1',
'plugin.rabbitmq.pool.... | rafaduran/python-mcollective | tests/integration/test_with_rabbitmq.py | Python | bsd-3-clause | 1,771 |
from flask import Blueprint
main = Blueprint('main', __name__)
from . import views, errors
from ..models import Permission
@main.app_context_processor
def inject_permissions():
return dict(Permission=Permission) | Lirean/Elibrary | app/main/__init__.py | Python | gpl-3.0 | 219 |
#!/usr/bin/env python
###############################################################################
# Copyright 2017 The Apollo 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 ... | wanglei828/apollo | modules/tools/vehicle_calibration/plot_data.py | Python | apache-2.0 | 4,296 |
# -*- coding: utf-8 -*-
import logging
from icebergsdk.resources.application import Application, ApplicationCommissionSettings, ApplicationMerchantPolicies,\
ApplicationTransaction, ApplicationPaymentSettings, ApplicationUrls, ApplicationPermission
from icebergsdk.resources.order import Order, MerchantOrder, Orde... | Iceberg-Marketplace/Iceberg-API-PYTHON | icebergsdk/resources/__init__.py | Python | mit | 4,440 |
#!/usr/bin/env python3
# cerbero - a multi-platform build system for Open Source software
# Copyright (C) 2012 Andoni Morales Alastruey <ylatuya@gmail.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free S... | nirbheek/cerbero | cerbero/tools/libtool.py | Python | lgpl-2.1 | 5,912 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('release', '0007_add_release_variant_type_module'),
]
operations = [
migrations.AddField(
model_name='variant',
... | release-engineering/product-definition-center | pdc/apps/release/migrations/0008_auto_20160719_1221.py | Python | mit | 632 |
from mock import patch
import mock
from kiwi.filesystem.squashfs import FileSystemSquashFs
class TestFileSystemSquashfs:
@patch('os.path.exists')
def setup(self, mock_exists):
mock_exists.return_value = True
self.squashfs = FileSystemSquashFs(mock.Mock(), 'root_dir')
@patch('platform.ma... | SUSE/kiwi | test/unit/filesystem/squashfs_test.py | Python | gpl-3.0 | 2,670 |
'''
>>> from qpage import *
>>> import random
>>> random.seed(1)
>>> list_randomize([1,2,3,5,6])
[2, 1, 5, 3, 6]
>>> email_at("example@yahoo.com")
'example at yahoo.com'
>>> convert_bytes(200)
'200.0 bytes'
>>> convert_bytes(6000)
'5.9 KB'
>>> convert_bytes(80000)
'78.1 KB'
>>> random.seed(1)
>>> random_badge_color()
... | sepandhaghighi/qpage | source/test.py | Python | mit | 805 |
from itertools import product
from axelrod import Actions, Player, init_args, random_choice
from axelrod.strategy_transformers import FinalTransformer
from .lookerup import LookerUp, create_lookup_table_keys
C, D = Actions.C, Actions.D
@FinalTransformer((D, D)) # End with two defections if tournament length is kno... | marcharper/Axelrod | axelrod/strategies/gambler.py | Python | mit | 2,652 |
# coding=utf-8
"""Module used to generate context for aggregation result section."""
from safe.definitions.exposure import exposure_all, exposure_population
from safe.definitions.fields import (
affected_exposure_count_field,
aggregation_name_field,
total_affected_field,
exposure_type_field,
expos... | Gustry/inasafe | safe/report/extractors/aggregate_result.py | Python | gpl-3.0 | 9,641 |
"""Test getattr and associated."""
# --- import --------------------------------------------------------------------------------------
import WrightTools as wt
from WrightTools import datasets
# --- test ----------------------------------------------------------------------------------------
def test_axis_varia... | wright-group/WrightTools | tests/group/attributes.py | Python | mit | 1,261 |
# Copyright 2020 DeepMind Technologies Limited.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | deepmind/dm_robotics | py/vision/types.py | Python | apache-2.0 | 3,974 |
from datetime import datetime, timedelta
from django.test import TestCase
from couchforms.models import XFormInstance, XFormArchived
from couchforms.signals import xform_archived, xform_unarchived
from couchforms import fetch_and_wrap_form
class TestFormArchiving(TestCase):
def testArchive(self):
form = ... | puttarajubr/commcare-hq | corehq/ex-submodules/couchforms/tests/test_archive.py | Python | bsd-3-clause | 2,584 |
# coding: utf-8
ALLOWED_HOSTS = ['*']
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
}
}
INSTALLED_APPS = (
'tests.myapp',
'test_without_migrations',
)
SITE_ID=1,
SECRET_KEY='secret'
MIDDLEWARE_CLASSES = (
'django.middleware.common.Common... | henriquebastos/django-test-without-migrations | tests/settings.py | Python | mit | 384 |
from functools import partial
from ...utils import verbose
from ..utils import (has_dataset, _data_path, _data_path_doc,
_get_version, _version_doc)
has_erp_core_data = partial(has_dataset, name='erp_core')
@verbose
def data_path(path=None, force_update=False, update_path=True,
do... | kambysese/mne-python | mne/datasets/erp_core/erp_core.py | Python | bsd-3-clause | 797 |
# Generated by Django 2.2.1 on 2019-06-06 18:33
import datetime
from django.db import migrations, models
import django.db.models.deletion
from django.utils.timezone import utc
import django.utils.timezone
import gwells.db_comments.model_mixins
import wells.data_migrations
class Migration(migrations.Migration):
... | bcgov/gwells | app/backend/wells/migrations/0098_auto_20190606_1833.py | Python | apache-2.0 | 2,587 |
#!/usr/bin/python
#
# Copyright 2019 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 ag... | google/revisiting-self-supervised | train_and_eval.py | Python | apache-2.0 | 13,927 |
import threading
class Singleton(object):
_instance = None
def __new__(class_, *args, **kwargs):
if not isinstance(class_._instance, class_):
class_._instance = object.__new__(class_, *args, **kwargs)
return class_._instance
if __name__ == "__main__":
s1 = Singleton()
s2 = ... | kieslee/xlogging | xlogging/singleton.py | Python | apache-2.0 | 425 |
# -*- coding: utf-8 -*-
"""
sphinx.pycode
~~~~~~~~~~~~~
Utilities parsing and analyzing Python code.
:copyright: Copyright 2007-2013 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from os import path
from sphinx import package_dir
from sphinx.errors import PycodeErr... | waseem18/oh-mainline | vendor/packages/sphinx/sphinx/pycode/__init__.py | Python | agpl-3.0 | 13,014 |
#!/usr/bin/python
# Copyright (c) 2011 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.
"""Provides a convenient wrapper for spawning a test lighttpd instance.
Usage:
lighttpd_server PATH_TO_DOC_ROOT
"""
import codecs
i... | tierney/cryptagram-cc | src/build/android/lighttpd_server.py | Python | gpl-3.0 | 8,640 |
# -*- coding: utf-8 -*-
# @Time : 2017/6/29 10:17
# @Author : Hua
# @Site :
# @File : baseClient.py
# @Software: PyCharm
import shutil
from jinja2 import Environment, PackageLoader
import os, sqlite3
from config.Config import Config
class BaseClient(object):
ENV = Environment(loader=PackageLoader('temp... | GeekerHua/develop_documentation_spider | client/BaseClient.py | Python | mit | 7,057 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
from setuptools import setup, find_packages # Always prefer setuptools over distutils
from codecs import open # To use a consistent encoding
APP_NAME = 'legit'
APP_SCRIPT = './legit_r'
VERSION = '0.2.0'
# Grab requirements.
with open('reqs.txt')... | deshion/legit | setup.py | Python | bsd-3-clause | 1,882 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('product', '0009_auto_20150324_2149'),
]
operations = [
migrations.RemoveField(
model_name='product',
... | sorz/isi | store/product/migrations/0010_auto_20150324_2315.py | Python | mit | 733 |
# Copyright (c) 2009, Rotem Yaari <vmalloc@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:
# * Redistributions of source code must retain the above copyright
# notice, this li... | t-amerssonis/okami | src/Okami/third-parts/gitpy/__init__.py | Python | mit | 1,673 |
#!/usr/bin/python
""" Build light controller """
import os
current_dir = os.path.dirname(os.path.realpath(__file__))
import sys
sys.path.append(current_dir)
import signal
import getopt
import importlib
from lib import daemonize
from lib import logger
from lib import list_utils
from lib.constants import STATUS
from c... | DiUS/build-lights | light-controller/light_controller.py | Python | gpl-3.0 | 5,319 |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (c) The Spyder Development Team
#
# Licensed under the terms of the MIT License
# (See LICENSE.txt for details)
# -----------------------------------------------------------------------------
"""Tests."""... | spyder-ide/loghub | loghub/tests/__init__.py | Python | mit | 321 |
#!/usr/bin/env python3.7
# coding=utf-8
"""Jerod Gawne, 2018.06.11
https://github.com/jerodg/hackerrank
"""
import sys
import traceback
if __name__ == '__main__':
try:
[print(i ** 2) for i in range(int(input()))]
except Exception:
print(traceback.print_exception(*sys.exc_info()))
| jerodg/hackerrank-python | python/00.Introduction/4.Loops/solution1.py | Python | mit | 307 |
import os.path as op
import logging
import shutil
from subprocess import check_output
from tempfile import mkdtemp
import click
from ob_pipelines.s3 import (
s3, download_file_or_folder, remove_file_or_folder, SCRATCH_DIR, path_to_bucket_and_key
)
logger = logging.getLogger('ob-pipelines')
@click.command()
@cl... | outlierbio/ob-pipelines | ob_pipelines/apps/fastqc/fastqc.py | Python | apache-2.0 | 1,841 |
# Copyright (c) 2011 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | devendermishrajio/nova | nova/scheduler/filters/__init__.py | Python | apache-2.0 | 2,897 |
#!/usr/bin/env python
import image,numpy as np,auger,plot,dump
from scipy.ndimage.filters import gaussian_filter
np.random.seed(65983146)
f, ((ax1,ax2),(ax3,ax4)) = plot.subplots(nrows=2, ncols=2, sharex=False, sharey=False)
#spot 29 CT
filen = 'run.pMSA/output.2391740/ipnl-auger-tof-1.root'
auger.testfit(filen,1e9... | brenthuisman/phd_tools | graph.fopproc.py | Python | lgpl-3.0 | 863 |
#!/usr/bin/python
"""
Author: Jared R. Luellen
This repo is located at: https://github.com/jluellen/sms_ip
Sends current internal and external IP on boot
Add to cron by: sudo crontab -e
Append: @reboot python /home/pi/get_ip.py &
Save crontab
Reboot device and test
"""
from googlevoice import Voice
import re
import... | jluellen/sms_ip | get_ip.py | Python | gpl-2.0 | 2,802 |
import threading
import time
import queue
import paho.mqtt.client as mqtt
from python_homeautomation.devices.BaseDevice import BaseDevice
class MySensorHumidity(BaseDevice):
MODULE = 'MySensorHumidity'
UI_FIELDS = [{'name': 'humidity', 'text': 'Humidity', 'type': 'text', 'extra': None}]
def monitor(self... | sroehl/python_homeautomation | python_homeautomation/devices/MySensorHumidity.py | Python | mit | 1,830 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('event_mapper', '0020_auto_20150511_1626'),
]
operations = [
migrations.RemoveField(
model_name='movement',
... | timlinux/watchkeeper | django_project/event_mapper/migrations/0021_auto_20150511_2130.py | Python | bsd-2-clause | 791 |
#!/usr/bin/python3
from RaceGame import RaceGame
import pygame
def main():
pygame.init()
game = RaceGame()
game.run()
if __name__ == "__main__":
main()
| gezichtshaar/PyRaceGame | program.py | Python | gpl-2.0 | 171 |
# this file is here to make Install.py and utils.py importable.
# keep these lines to make it non-zero size and have winzip cooperate.
| collective/Products.Paypal2SalesforceLead | Products/Paypal2SalesforceLead/Extensions/__init__.py | Python | gpl-2.0 | 137 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2017-11-20 12:55
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('hkm', '0028_order_discount_lines'),
]
operations = [
migrations.AddField(
... | andersinno/kuvaselaamo | hkm/migrations/0029_checkout_status_flags.py | Python | mit | 921 |
from PIL import Image
import math, sys, json
import os.path
if __name__ == "__main__":
if not(len(sys.argv) == 3 and os.path.isfile(sys.argv[1])):
print "USAGE: python2 levelconverter.py inputfile outputfile"
sys.exit(-1)
im = Image.open(sys.argv[1])
rgb_im = im.convert('RGB')
(widt... | nickschot/ludumdare28 | levelconverter.py | Python | gpl-2.0 | 715 |
from typing import Any, Dict, Iterable, List, Tuple
import cirq
import stim
@cirq.value_equality
class DetAnnotation(cirq.Operation):
"""Annotates that a particular combination of measurements is deterministic.
Creates a DETECTOR operation when converting to a stim circuit.
"""
def __init__(
... | quantumlib/Stim | glue/cirq/stimcirq/_det_annotation.py | Python | apache-2.0 | 4,341 |
#! /usr/bin/python
import sys
import os
import json
import grpc
import time
import subprocess
from google.oauth2 import service_account
import google.oauth2.credentials
import google.auth.transport.requests
import google.auth.transport.grpc
from google.firestore.v1beta1 import firestore_pb2
from google.firestore.v1be... | GoogleCloudPlatform/grpc-gcp-python | firestore/examples/end2end/src/Commit.py | Python | apache-2.0 | 3,667 |
from __future__ import with_statement
from os import path, makedirs, environ
import shutil
from nose.plugins.skip import SkipTest
import _mssql
from .helpers import tmpdir
config_dump_path = path.join(tmpdir, 'freetds-config-dump.txt')
def setup_module():
if not path.isdir(tmpdir):
makedirs(tmpdir)
cla... | blackbass1988/pymssql-macos-lion | tests/test_config.py | Python | lgpl-2.1 | 3,403 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# no... | neudesk/neucloud | openstack_dashboard/dashboards/project/instances/workflows/create_instance.py | Python | apache-2.0 | 29,514 |
#!/usr/bin/python
import argparse
#import math
import numpy as np
import matplotlib.pyplot as plt
from pylab import *
from column import getColumn
#from operator import itemgetter, attrgetter
def createParser ():
parser = argparse.ArgumentParser()
parser.add_argument ('--abs', action='store_const', cons... | zhekan/MDrun | src/forceatom.py | Python | agpl-3.0 | 2,801 |
# -*- coding: utf-8 -*-
import urllib
import urllib2
import re
import os
import xbmcplugin
import xbmcgui
import xbmcaddon
import xbmcvfs
from BeautifulSoup import BeautifulStoneSoup, BeautifulSoup, BeautifulSOAP
viewmode=None
try:
from xml.sax.saxutils import escape
except: traceback.print_exc()
try:
import js... | cmvac/demagorgon.repository | plugin.video.rodasemotores/default.py | Python | gpl-2.0 | 51,862 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from solution import Solution
num = 14
sol = Solution()
res = sol.isUgly(num)
print(res)
| zhlinh/leetcode | 0263.Ugly Number/test.py | Python | apache-2.0 | 137 |
#!/usr/bin/env python
# Copyright (c) 2017,2018, F5 Networks, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | ryan-talley/f5-cccl | f5_cccl/resource/ltm/test/test_internal_data_group.py | Python | apache-2.0 | 3,068 |
"""
config/default.py
------------------
Default configuration settings for Flask app.
"""
import os
DEBUG = os.environ.get('FLASK_DEBUG', True)
SECRET_KEY = os.environ.get('FLASK_SECRET_KEY', 'default-secret-key')
USERNAME = os.environ.get('FLASK_USERNAME', 'admin')
SALT = os.environ.get('FLASK_SALT', '... | kennyng/kennyng.org | config/default.py | Python | mit | 994 |
from operator import itemgetter
from mediawords.db import connect_to_db
from mediawords.dbi.downloads.store import store_content
from mediawords.test.db.create import create_test_topic, create_test_medium, create_test_feed, create_test_story
from topics_base.stories import merge_foreign_rss_stories
def test_merge_f... | berkmancenter/mediacloud | apps/topics-base/tests/python/topics_base/stories/test_merge_foreign_rss_stories.py | Python | agpl-3.0 | 2,758 |
#!/usr/bin/env python
#############################################################################
# montyhall.py - Monty Hall Problem solver
# v0.5
# Copyright (C) 2013 Ian Havelock
#
# //http://en.wikipedia.org/wiki/Monty_Hall_problem
#
# This program is free software: you can redistribute it and/or ... | Morrolan/montyhall | montyhall.py | Python | gpl-3.0 | 6,973 |
import datetime
import re
import string
from flask import request
from server import app
from server.base import cached_route
from server.penndata import depts, reg
def is_dept(keyword):
return keyword.upper() in depts.keys()
def get_serializable_course(course):
return {
"_id": str(course.get("_id... | pennlabs/penn-mobile-server | server/registrar.py | Python | mit | 3,609 |
import pip
pip_version = tuple(int(v) if v.isdigit() else v
for v in pip.__version__.split('.'))
if pip_version > (10,):
from pip._internal.req import req_file
else:
from pip.req import req_file
def req_file_build_parser(line=None):
if pip_version > (10,):
return req_file.bu... | 5monkeys/blues | blues/compat.py | Python | mit | 471 |
from setuptools import setup, find_packages
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='market',
version='0.0.1',
description='Market microservice',
... | morganjbruce/microservices-in-action | chapter-11/market/setup.py | Python | mit | 1,856 |
# PiTimer - Python Hardware Programming Education Project For Raspberry Pi
# Copyright (C) 2015 Jason Birch
#
# 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
... | BirchJD/RPiTimer | PiTimer_Step-9/ScheduleItem.py | Python | gpl-3.0 | 5,820 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) Pootle contributors.
#
# This file is a part of the Pootle project. It is distributed under the GPL3
# or later license. See the LICENSE file for a copy of the license and the
# AUTHORS file for copyright and authorship information.
import os
import pyte... | Finntack/pootle | tests/pootle_fs/fs_response.py | Python | gpl-3.0 | 6,794 |
#!/usr/bin/python
import pygeoip
import json
from logsparser.lognormalizer import LogNormalizer as LN
import gzip
import glob
import socket
import urllib2
IP = 'IP.Of,Your.Server'
normalizer = LN('/usr/local/share/logsparser/normalizers')
gi = pygeoip.GeoIP('../GeoLiteCity.dat')
def complete(text, state):
return (gl... | radman404/Who-s-attacking-me-now-- | wamnclient.py | Python | gpl-2.0 | 2,126 |
#!/usr/bin/env python
# encoding: utf-8
from flask import jsonify
def make_error_resp(code, msg):
return jsonify(**{
'data': {},
'msg': msg,
'code': code,
'extras': {}
})
def normal_resp(data):
return jsonify(**{
'data': data,
'msg': 'success',
'co... | luke0922/MarkdownEditor | application/utils/response.py | Python | gpl-2.0 | 728 |
# Copyright 2014 NEC Corporation. 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 ... | HybridF5/tempest_debug | tempest/api/orchestration/stacks/test_templates_negative.py | Python | apache-2.0 | 1,954 |
from .csv_collect import *
from .noise_test import *
from .streamer_lsl import *
from .streamer_osc import *
from .streamer_tcp_server import *
from .udp_server import *
__version__ = "1.0.0"
| OpenBCI/OpenBCI_Python | openbci/plugins/__init__.py | Python | mit | 193 |
from direct.showbase.DirectObject import DirectObject
from otp.avatar.DistributedPlayer import DistributedPlayer
from direct.task.Task import Task
class TelemetryLimiter(DirectObject):
TaskName = 'TelemetryLimiterEnforce'
LeakDetectEventName = 'telemetryLimiter'
def __init__(self):
self._objs = {}... | ToonTownInfiniteRepo/ToontownInfinite | otp/distributed/TelemetryLimiter.py | Python | mit | 3,341 |
{% if created %}from rest_framework import viewsets, routers, serializers
from rest_framework.decorators import detail_route
from rest_framework.response import Response
from models import {{model_name}}
{% if with_filter %}import django_filters{% endif %}
{% endif %}
class {{model_name}}Serializer(serializers.ModelS... | TangentMicroServices/DRF-Project-Scaffolder | templates/api.py | Python | mit | 1,972 |
"""Modifies a password for a volume's access"""
# :license: MIT, see LICENSE for more details.
import click
import SoftLayer
from SoftLayer.CLI import environment
@click.command()
@click.argument('access_id')
@click.option('--password', '-p', multiple=False,
help='Password you want to set, this command... | softlayer/softlayer-python | SoftLayer/CLI/block/access/password.py | Python | mit | 849 |
#!/bin/python
# -*- coding: utf-8 -*-
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core import debug
from fenrirscreenreader.utils import char_utils
class command():
def __init__(self):
pass
def initialize(self, environment):
self.env = enviro... | chrys87/fenrir | src/fenrirscreenreader/commands/commands/review_curr_char_phonetic.py | Python | lgpl-3.0 | 1,237 |
from collections import Iterable
from django.conf import settings
from django.contrib.auth.decorators import REDIRECT_FIELD_NAME
from django.contrib.auth.decorators import login_required
from django.core.exceptions import ImproperlyConfigured
from django.core.exceptions import PermissionDenied
from guardian.utils... | hfeeki/django-guardian | guardian/mixins.py | Python | bsd-2-clause | 6,473 |
# TODO separate into different package modules
| dibaunaumh/fcs-skateboard | fcs_aux/mies/__init__.py | Python | agpl-3.0 | 47 |
import os
import unittest
import re
from mock import MagicMock
from PyAnalysisTools.base.ProcessConfig import ProcessConfig, parse_and_build_process_config, find_process_config, \
Process
from PyAnalysisTools.base.YAMLHandle import YAMLLoader as yl
cwd = os.path.dirname(__file__)
class TestProcess(unittest.Test... | morgenst/PyAnalysisTools | tests/unit/TestProcessConfig.py | Python | mit | 15,015 |
"""
This page is in the table of contents.
Fillet rounds the corners slightly in a variety of ways. This is to reduce corner blobbing and sudden extruder acceleration.
The fillet manual page is at:
http://fabmetheus.crsndoo.com/wiki/index.php/Skeinforge_Fillet
==Operation==
The default 'Activate Fillet' checkbox is ... | tinkerinestudio/Tinkerine-Suite | TinkerineSuite/Cura/cura_sf/skeinforge_application/skeinforge_plugins/craft_plugins/fillet.py | Python | agpl-3.0 | 18,646 |
from __future__ import unicode_literals
from builtins import object
from rest_framework import viewsets, serializers, mixins, permissions
from isisdata.models import Citation, Authority, ACRelation, PartDetails
from zotero.models import *
class InstanceResolutionEventSerializer(serializers.ModelSerializer):
clas... | upconsulting/IsisCB | isiscb/zotero/serializers.py | Python | mit | 3,223 |
#!/usr/bin/python
from distutils.core import setup
setup(name = 'py_mpgedit',
version='0.3beta',
author='Bryan Weingarten',
author_email='bryan.weingarten@mpgedit.org',
url='http://www.mpgedit.org/',
description='Python bindings to the mpgedit SDK.',
py_modules = ["pympgedit"])
| gusrc/mpgedit | contrib/python/py_mpgedit/setup_pympgedit.py | Python | lgpl-2.1 | 316 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2015, VMware, Inc.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.0',
'st... | bearstech/ansible | lib/ansible/modules/cloud/vmware/vmware_maintenancemode.py | Python | gpl-3.0 | 5,690 |
#!/usr/bin/env python
# $Id: CheetahWrapper.py,v 1.26 2007/10/02 01:22:04 tavis_rudd Exp $
"""Cheetah command-line interface.
2002-09-03 MSO: Total rewrite.
2002-09-04 MSO: Bugfix, compile command was using wrong output ext.
2002-11-08 MSO: Another rewrite.
Meta-Data
==================================================... | carvalhomb/tsmells | lib/Cheetah/src/CheetahWrapper.py | Python | gpl-2.0 | 21,599 |
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Font(_BaseTraceHierarchyType):
# class properties
# --------------------
_parent_path_str = "scatterternary.hoverlabel"
_path_str = "scatterternary.hoverlabel.font"
_valid_props = {"color... | plotly/python-api | packages/python/plotly/plotly/graph_objs/scatterternary/hoverlabel/_font.py | Python | mit | 11,245 |
import os.path
def get_path(type):
path = []
tmp = type
while tmp.parent is not None:
path.insert(0, tmp)
tmp = tmp.parent
if type.type_name == 'Namespace':
path = [part.identifier.lower_case for part in path] + ['__init__.py']
else:
path = [part.identifier.low... | umlfri/umlfri2 | addons/python_starter/libraryTemplate/lib/paths.py | Python | gpl-3.0 | 1,650 |
import pandas as pd
import sys
from suds.client import Client as sudsclient
import ssl
from .plots import *
david_categories = [
'GOTERM_BP_FAT', 'GOTERM_CC_FAT', 'GOTERM_MF_FAT', 'KEGG_PATHWAY',
'BIOCARTA', 'PFAM', 'PROSITE' ]
david_fields = [
'categoryName', 'termName', 'listHits', 'percent',
'ease', 'geneI... | mpg-age-bioinformatics/AGEpy | AGEpy/david.py | Python | mit | 9,205 |
# (C) British Crown Copyright 2011 - 2019, Met Office
#
# This file is part of cartopy.
#
# cartopy 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)... | ocefpaf/cartopy | lib/cartopy/mpl/patch.py | Python | lgpl-3.0 | 8,414 |
# Copyright (c) 2018 PaddlePaddle 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 app... | reyoung/Paddle | python/paddle/fluid/optimizer.py | Python | apache-2.0 | 53,808 |
# general class containing info about a transcribed region. Can come from UCSC Knowngenes (BED) or Ensembl GTF files currently
# Stephen N. Floor
# Fall 2014
class Transcript:
def __init__(self):
#properties defined in UCSC knowngenes
self.name = ''
self.chrom = ''
self.stran... | stephenfloor/extract-transcript-regions | Transcript.py | Python | gpl-2.0 | 25,460 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
import itertools
from frappe import _
from frappe.utils import cstr, flt
import json
from frappe import ValidationError
class ItemVariant... | bazz-erp/erpnext | erpnext/controllers/item_variant.py | Python | gpl-3.0 | 11,820 |
if 'imported' in locals():
import imp
import bpy
imp.reload(blendergltf)
else:
imported = True
import blendergltf
import json
import math
import bpy
def togl(matrix):
return [i for col in matrix.col for i in col]
class BTFConverter:
def __init__(self, gltf_settings=None):
if g... | Kupoman/BlenderRealtimeEngineAddon | brte/converters/btf.py | Python | mit | 2,024 |
"""
WSGI config for jsonform_example 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.9/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJA... | carlmjohnson/django-json-form | jsonform_example/wsgi.py | Python | mit | 409 |
from django import forms
from members.models import Member
class Registration(forms.Form):
given_name = forms.CharField()
class ChoiceLeader(forms.Form):
choice = forms.ModelChoiceField(queryset=Member.objects.none(), widget=forms.RadioSelect)
def __init__(self, *args, **kwargs):
user = kwargs... | venetay/Photo-Competition | members/forms.py | Python | mit | 868 |
"""Test fixtures for Tasmota component."""
from unittest.mock import patch
from hatasmota.discovery import get_status_sensor_entities
import pytest
from homeassistant import config_entries
from homeassistant.components.tasmota.const import (
CONF_DISCOVERY_PREFIX,
DEFAULT_PREFIX,
DOMAIN,
)
from tests.com... | turbokongen/home-assistant | tests/components/tasmota/conftest.py | Python | apache-2.0 | 2,047 |
"""
IO for NURBS and Bezier extraction data.
"""
from __future__ import absolute_import
import numpy as nm
import six
from six.moves import range
from sfepy.base.ioutils import HDF5ContextManager, enc, dec
def write_iga_data(filename, group, knots, degrees, control_points, weights,
cs, conn, bezier_... | lokik/sfepy | sfepy/discrete/iga/io.py | Python | bsd-3-clause | 4,107 |
from txpostgres import txpostgres
from twisted.internet import reactor
from twisted.python import log, util
# define the libpq connection string and the query to use
connstr = 'dbname=postgres'
query = 'select tablename from pg_tables order by tablename'
# connect to the database
conn = txpostgres.Connection()
d = c... | wulczer/txpostgres | doc/cursor_example.py | Python | mit | 941 |
from ddt import data, ddt
from rest_framework import status, test
from waldur_core.structure.tests import factories, fixtures
@ddt
class DivisionListTest(test.APITransactionTestCase):
def setUp(self):
self.fixture = fixtures.UserFixture()
self.division_1 = factories.DivisionFactory()
self... | opennode/nodeconductor-assembly-waldur | src/waldur_core/structure/tests/test_division.py | Python | mit | 5,033 |
"""Template tags for dealing with podcast channels."""
from django import template
from uryplayer.models import PodcastChannel
from django.template.defaultfilters import stringfilter
register = template.Library()
@register.filter
@stringfilter
def channel_singular(channel_name):
"""Replaces an internal channel... | CaptainHayashi/lass | website/templatetags/podcast_channel_tags.py | Python | gpl-2.0 | 436 |
import re
import sys
import imp
import time
import logging
import datetime
import multiprocessing
from django.conf import settings
from django.core.management import call_command
from . import app_settings
from .task import task
from .utils import set_process_title, get_backend, configure_logging
class CronScheduler... | lamby/django-lightweight-queue | django_lightweight_queue/cron_scheduler.py | Python | bsd-3-clause | 4,123 |
#!/usr/bin/env python
#
# test_ldp_oc_acl_topo1.py
# Part of NetDEF Topology Tests
#
# Copyright (c) 2020 by Volta Networks
#
# Permission to use, copy, modify, and/or distribute this software
# for any purpose with or without fee is hereby granted, provided
# that the above copyright notice and this permission notice... | freerangerouting/frr | tests/topotests/ldp_oc_acl_topo1/test_ldp_oc_acl_topo1.py | Python | gpl-2.0 | 7,507 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.