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 |
|---|---|---|---|---|---|
########################################################################
# File name: muc_logger.py
# This file is part of: aioxmpp
#
# LICENSE
#
# This program 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 Found... | horazont/aioxmpp | examples/muc_moderate_message.py | Python | lgpl-3.0 | 4,312 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2012-today OpenERP SA (<http://www.openerp.com>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms o... | diogocs1/comps | web/addons/auth_signup/res_users.py | Python | apache-2.0 | 14,710 |
#python
# Calculate the amount of water in terms of olympic swimming pools (50x25x2)
# that has gone into the atmosphere at the surface since 1973
EarthArea = 510100000000000 # earth area in m2 thanks to google
AirDensity = 1.225 # at sea level and 15 degrees kg/m3
Deltaq = 0.08 # HadISDH.blend.1.0.0.2019f g/kg/10yr... | Kate-Willett/HadISDH_Build | SwimmingPools_of_q.py | Python | cc0-1.0 | 1,630 |
# tox/urls.py
"""
tox URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home... | thomec/tox | tox/urls.py | Python | gpl-2.0 | 2,226 |
import theano.tensor as T
from mnist.hidden_layer import HiddenLayer
from mnist.logistic_regression import LogisticRegression
class MLP:
def __init__(self, rng, input_, n_in, n_hidden, n_out):
self.hidden_layer = HiddenLayer(
rng=rng, input_=input_, n_in=n_in, n_out=n_hidden, activation=T.tan... | vribeiro1/ia896_2s2016 | mnist/mlp.py | Python | gpl-3.0 | 870 |
#!/usr/bin/env python3
# written by sqall
# twitter: https://twitter.com/sqall01
# blog: https://h4des.org
# github: https://github.com/sqall01
#
# Licensed under the GNU Affero General Public License, version 3.
from .client import ServerCommunication, ConnectionWatchdog, Receiver
from .smtp import SMTPAlert
from .m... | sqall01/alertR | managerClientConsole/lib/__init__.py | Python | agpl-3.0 | 441 |
"""
JP-specific Form helpers
"""
from django.core import validators
from django.newforms import ValidationError
from django.utils.translation import ugettext_lazy as _
from django.newforms.fields import RegexField, Select
class JPPostalCodeField(RegexField):
"""
A form field that validates its input is a Japa... | paulsmith/geodjango | django/contrib/localflavor/jp/forms.py | Python | bsd-3-clause | 1,252 |
# Copyright 2014 Cloudbase Solutions Srl
#
# 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 l... | cernops/cloudbase-init | cloudbaseinit/tests/utils/test_dhcp.py | Python | apache-2.0 | 6,514 |
import unittest
import tempfile
# load testsuites from module.
from tests import console, config, pkgmgr, basepool, gitpool, script, env, runner
def suite():
suite = unittest.TestSuite()
suite.addTest(config.suite())
suite.addTest(pkgmgr.suite())
suite.addTest(basepool.suite())
suite.addTest(gitpo... | hychen/lazyscripts | tests/__init__.py | Python | gpl-2.0 | 550 |
from numpy import *
from numpy.random import *
from pylab import *
from pylab import rcParams
import time
import os
import sys
files = []
c = 299792458
R = 10.
f = array(arange(100e6,10e9+100e6,100e6))
#f = array([1, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1200, 1400, ... | manuamador/Misc | PostDoc_python/CAvsOATS/dipolesources.py | Python | agpl-3.0 | 3,661 |
#!/usr/bin/env python3
# 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... | google/fruit | tests/meta/test_basics.py | Python | apache-2.0 | 3,009 |
import rospy
import threading
import types
from lg_common.helpers import load_director_message, find_window_with_activity
from lg_msg_defs.msg import ApplicationState
class BackgroundStopper:
def __init__(self, disable_activities, device_writer):
self.disable_activities = disable_activities
self.d... | EndPointCorp/lg_ros_nodes | lg_nav_to_device/src/lg_nav_to_device/background_stopper.py | Python | apache-2.0 | 2,636 |
from __future__ import unicode_literals
import os
from django.template import Context, Engine, TemplateSyntaxError
from django.template.base import Node
from django.template.library import InvalidTemplateLibrary
from django.test import SimpleTestCase, ignore_warnings
from django.test.utils import extend_sys_path
from... | moreati/django | tests/template_tests/test_custom.py | Python | bsd-3-clause | 20,102 |
# -*- coding: UTF-8 -*-
import signal, datetime, logging, os, sys, time, json, base64 #zlib, bz2,
from optparse import make_option
from django.core.management.base import BaseCommand
from django.contrib.contenttypes.models import ContentType
from niftyurls.fetch_feed import FetchFeed
from niftyurls.models import Feed, ... | florentin/django-niftyurls | niftyurls/management/commands/niftyurls_feeds.py | Python | bsd-3-clause | 3,990 |
class SessionHelper:
def __init__(self, app):
self.app = app
def login(self, username, password):
# login
wd = self.app.wd
self.app.open_home_page_group ()
wd.find_element_by_name("user").click()
wd.find_element_by_name("user").clear()
wd.find_element_b... | ElenaBadWolf/for_homework1 | fixture/session.py | Python | apache-2.0 | 1,287 |
#!/usr/bin/env python
"""
Pegasus utility for generating breakdown chart
"""
##
# Copyright 2010-2011 University Of Southern California
#
# 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
... | elainenaomi/sciwonc-dataflow-examples | sbbd2016/experiments/1-postgres/3_workflow_full_10files_primary_nosh_nors_annot_with_proj_3s/pegasus.bDkvI/pegasus-4.6.0/lib/python2.7/dist-packages/Pegasus/plots_stats/plots/pegasus_breakdown.py | Python | gpl-3.0 | 14,216 |
'''
Copyright 2017 Dell Inc. or its subsidiaries. All Rights Reserved.
Author(s):
George Paulos
This script tests minimum payload base case of the RackHD API 2.0 OS bootstrap workflows using NFS mount or local repo method.
This routine runs OS bootstrap jobs simultaneously on multiple nodes.
For 12 tests to run, 12 n... | uppalk1/RackHD | test/tests/bootstrap/test_api20_os_bootstrap_parallel_local.py | Python | apache-2.0 | 14,582 |
"""
Functions to visualize an Experiment.
"""
__authors__ = "James Bergstra"
__license__ = "3-clause BSD License"
__contact__ = "github.com/hyperopt/hyperopt"
import math
import sys
# -- don't import this here because it locks in the backend
# and we want the unittests to be able to set the backend
##impor... | w1kke/hyperopt | hyperopt/plotting.py | Python | bsd-3-clause | 19,883 |
test = {
'name': '',
'points': 1,
'suites': [
{
'cases': [
{
'code': r"""
>>> print_kth_top_movie_year(4)
Year number 4 for total gross movie sales was: 2009
""",
'hidden': False,
'locked': False
},
],
'scored': Tru... | jamesfolberth/NGC_STEM_camp_AWS | notebooks/data8_notebooks/lab04/tests/q2_5.py | Python | bsd-3-clause | 400 |
# -*- coding: utf-8 -*-
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
# Copyright (c) 2012 dput authors
#
# 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... | Debian/dput-ng | dput/commands/rm.py | Python | gpl-2.0 | 3,336 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import datetime
import json
import os
import shutil
import tempfile
import unittest
from collections import Sequence, Ma... | twobraids/crontabber | crontabber/tests/base.py | Python | mpl-2.0 | 7,558 |
from django.contrib.auth.models import User
from rest_framework import serializers
# Serializers define the API representation.
class UserSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = User
fields = ('url', 'username', 'email', 'is_staff')
| seadsystem/ShR2 | Web Stack/home/serializers.py | Python | mit | 286 |
#!/usr/bin/env python
import re
import sys
import urllib
import urllib2
from bs4 import BeautifulSoup
def valid_andrew_id(andrewid):
# regex written by Jacob Zimmerman
return (type(andrewid) is str or type(andrewid) is unicode) \
and re.match(r'^[a-zA-Z][a-zA-Z0-9]{1,7}$', andrewid) is not None
... | ScottyLabs/cmupy | directory.py | Python | mit | 3,794 |
from __future__ import division,print_function,unicode_literals,with_statement
from django.conf import settings as django_settings
from .session import SessionManager
def common_settings(request):
return {
'domain_name':django_settings.DOMAIN_NAME,
'www_root':django_settings.WWW_ROOT,
'is_dev':django_s... | hikelee/launcher | launcher/utils/common/context_processors.py | Python | mit | 433 |
# -*- coding: utf-8 -*-
from selenium.webdriver.firefox.webdriver import WebDriver
import unittest
from contact import Contact
def is_alert_present(wd):
try:
wd.switch_to_alert().text
return True
except:
return False
class test_add_contact(unittest.TestCase):
def setUp(self):
... | eugence/python_training | test_add_contact.py | Python | apache-2.0 | 4,112 |
# partitioning.py
# Disk partitioning functions.
#
# Copyright (C) 2009, 2010, 2011, 2012, 2013 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... | karmix/blivet | blivet/partitioning.py | Python | gpl-2.0 | 81,110 |
# general models go here
# TODO: add alembic/flask-migrate
import os
from datetime import datetime
import json
import hashlib
from flask_login import UserMixin
from . import db
class TextJsonPickleType(db.PickleType):
impl = db.Text
def __init__(self):
super(TextJsonPickleType, self).__... | mbodea/pocket-bulletin | pocketbulletin/models.py | Python | mit | 7,192 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import test_website_form_editor | ddico/odoo | addons/website_form/tests/__init__.py | Python | agpl-3.0 | 138 |
#!/usr/bin/env python3
import json
import os
from wsgiref.handlers import CGIHandler
from philologic.runtime.DB import DB
from philologic.runtime import generate_text_object
import sys
sys.path.append("..")
import custom_functions
try:
from custom_functions import WebConfig
except ImportError:
from philolo... | clovis/PhiloLogic4 | www/scripts/get_notes.py | Python | gpl-3.0 | 1,038 |
"""Add organization column to newsflash
Revision ID: 7c472e4582de
Revises: 2c54437f4ee4
Create Date: 2020-08-21 02:08:31.654024
"""
# revision identifiers, used by Alembic.
revision = '7c472e4582de'
down_revision = '2c54437f4ee4'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
... | hasadna/anyway | alembic/versions/7c472e4582de_add_organization_column_to_newsflash.py | Python | mit | 491 |
import sys
import pytest
from _pytest.pytester import Pytester
if sys.version_info < (3, 8):
pytest.skip("threadexception plugin needs Python>=3.8", allow_module_level=True)
@pytest.mark.filterwarnings("default::pytest.PytestUnhandledThreadExceptionWarning")
def test_unhandled_thread_exception(pytester: Pytest... | pytest-dev/pytest | testing/test_threadexception.py | Python | mit | 4,085 |
from greengraph.command import parser, process, build_greengraph
from mock import mock_open, patch
# Test command line input arguments
def test_command_args():
args = parser.parse_args(['--from','London','--to','Paris','--steps','15','--out','file_name'])
assert args.startLoc == 'London'
assert args.endLo... | davidtwomey/greengraphs_cw | greengraph/test/test_command.py | Python | mit | 1,945 |
"""
Demonstration script for quadratic interpolation.
Modified for the problem described in Homework 2 problem #1.
"""
import numpy as np
import matplotlib.pyplot as plt
from numpy.linalg import solve
# Set up linear system to interpolate through data points:
# Data points:
xi = np.array([-1., 1., 2])
yi = np.array(... | philipwangdk/HPC | uwhpsc/2013/solutions/homework2/hw2a.py | Python | mit | 1,057 |
# -*- coding: utf-8 -*-
# © 2014 Elico Corp (https://www.elico-corp.com)
# Licence AGPL-3.0 or later(http://www.gnu.org/licenses/agpl.html)
from openerp.osv import orm, fields
class stock_picking(orm.Model):
_inherit = 'stock.picking'
_columns = {
'carrier_website': fields.related(
'carr... | Elico-Corp/openerp-7.0 | delivery_carrier_website/delivery_carrier_website.py | Python | agpl-3.0 | 1,122 |
# Authors: Martin Luessi <mluessi@nmr.mgh.harvard.edu>
# Denis A. Engemann <denis.engemann@gmail.com>
#
# License: BSD-3-Clause
from functools import partial
from inspect import getmembers
import numpy as np
from .utils import check_indices
from ..utils import _check_option, CONNECTIVITY_DEPRECATION_MSG
fro... | pravsripad/mne-python | mne/connectivity/spectral.py | Python | bsd-3-clause | 42,525 |
#!/usr/bin/env python -W ignore::DeprecationWarning
import stars
import warnings
def dependencies_for_myprogram():
from scipy.sparse.csgraph import _validation
warnings.filterwarnings("ignore")
stars.main()
| GeoDaCenter/CAST | stars.py | Python | gpl-3.0 | 218 |
# coding=utf-8
"""
The OneWireCollector collects data from 1-Wire Filesystem
You can configure which sensors are read in two way:
- add section [scan] with attributes and aliases,
(collector will scan owfs to find attributes)
or
- add sections with format id:$SENSOR_ID
See also: http://owfs.org/
Author: Tomas... | tsheasha/fullerite | src/diamond/collectors/onewire/onewire.py | Python | apache-2.0 | 2,416 |
# -*- coding: utf-8 -*-
from model.project import Project
import re
class ProjectHelper:
def __init__(self, app):
self.app = app
def open_manage_proj_page(self):
wd = self.app.wd
if not wd.current_url.endswith("/manage_proj_page.php"):
wd.get("http://localhost/mantisbt-1.... | Alex360-D/python_training_mantis | fixture/project.py | Python | apache-2.0 | 3,640 |
"""
Retrieve a dictionary of Weasyl staff.
"""
import ast
from weasyl import macro
def load():
"""
Load staff from a Python config file.
Parameters: None. Path is obtained from `macro.MACRO_SYS_STAFF_CONFIG_PATH`
Returns:
staff_dict: A dictionary with the staff member user IDs.
"""
... | Weasyl/weasyl | weasyl/staff_config.py | Python | apache-2.0 | 1,078 |
from __future__ import absolute_import
from .base import AppConf # noqa
# following PEP 386
__version__ = "0.5"
| canvasnetworks/canvas | website/compressor/appconf/__init__.py | Python | bsd-3-clause | 114 |
{
'name': 'Base import',
'description': """
New extensible file import for Odoo
======================================
Re-implement Odoo's file import system:
* Server side, the previous system forces most of the logic into the
client which duplicates the effort (between clients), makes the
import system ... | Aravinthu/odoo | addons/base_import/__manifest__.py | Python | agpl-3.0 | 1,164 |
"""Acceptance tests for yala executable."""
import re
from concurrent.futures import ThreadPoolExecutor
from io import StringIO
from unittest import TestCase
from unittest.mock import patch
from yala.main import main
class TestAcceptance(TestCase):
"""Acceptance test."""
@classmethod
@patch("yala.main.s... | cemsbr/yala | tests/acceptance.py | Python | mit | 5,375 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2003 - 2014 Detlev Offenbach <detlev@die-offenbachs.de>
#
"""
Eric6 Documentation Generator.
This is the main Python script of the documentation generator. It is
this script that gets called via the source documentation interface.
This script can be used... | davy39/eric | eric6_doc.py | Python | gpl-3.0 | 15,567 |
import unittest
from scrapy.settings import Settings
from scrapy.utils.test import get_crawler
from scrapy.spider import BaseSpider
class SettingsTest(unittest.TestCase):
def test_get(self):
settings = Settings({
'TEST_ENABLED1': '1',
'TEST_ENABLED2': True,
'TEST_ENABL... | aburan28/scrapy | scrapy/tests/test_settings.py | Python | bsd-3-clause | 3,091 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-02-11 19:28
from __future__ import unicode_literals
import datetime
from django.db import migrations, models
from django.utils.timezone import utc
class Migration(migrations.Migration):
dependencies = [
('curling', '0007_auto_20170209_0158'),
... | zbassett/curling-robot | RaspberryPi/DjangoSite/mysite/curling/migrations/0008_auto_20170211_1928.py | Python | apache-2.0 | 1,595 |
class Solution:
def titleToNumber(self, s: str) -> int:
num = 0
for c in s:
num = num * 26 + ord(c) - ord('A') + 1
return num
| jiadaizhao/LeetCode | 0101-0200/0171-Excel Sheet Column Number/0171-Excel Sheet Column Number.py | Python | mit | 166 |
# This file is part of The Family's treasure tale.
# The Family's treasure tale 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.
# The... | stevenremot/family_treasure_tale | family_treasure/text.py | Python | gpl-3.0 | 2,636 |
while(True):
n = input()
if(n == 42):
break
else:
print n | aqfaridi/Code-Online-Judge | web/env/Main1145/Main1145.py | Python | mit | 90 |
import asyncio
import collections
from .helpers import ensure_future
class EventResultOrError:
"""
This class wrappers the Event asyncio lock allowing either awake the
locked Tasks without any error or raising an exception.
thanks to @vorpalsmith for the simple design.
"""
def __init__(self,... | Eyepea/aiohttp | aiohttp/locks.py | Python | apache-2.0 | 1,029 |
#!/usr/bin/env python
# Copyright (c) 2012 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.
"""Moves C++ files to a new location, updating any include paths that
point to them, and re-ordering headers as needed. If multipl... | hujiajie/pa-chromium | tools/git/move_source_file.py | Python | bsd-3-clause | 5,950 |
# Copyright 2016 Casey Jaymes
# This file is part of PySCAP.
#
# PySCAP 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.
#
# PySCAP is ... | cjaymes/pyscap | src/scap/model/oval_5/defs/windows/DnsCacheObjectElement.py | Python | gpl-3.0 | 1,040 |
from pymongo import MongoClient
# connection to MongoDB on the IFO server
uri = "mongodb://hackathon_reader:To0305@www.oci-ifo.org:27017/scrapy?authMechanism=MONGODB-CR"
client = MongoClient(uri)
db = client.scrapy
collection = db.websites
#uncomment to save output to file
#f = open('data.txt', 'w')
#Query to M... | web-archive-group/hackathon | OCI-IFO/python/media_list.py | Python | mit | 541 |
# 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.
import datetime
import requests
from bkr.server.model import session, ... | jtoppins/beaker | IntegrationTests/src/bkr/inttest/server/selenium/test_system_commands.py | Python | gpl-2.0 | 9,518 |
import errno
import json
import os
import random
import string
import socket
from concurrent.futures import ThreadPoolExecutor
from collections import deque, namedtuple
from datetime import datetime, timedelta
from tornado import gen
from tornado import ioloop
from tornado.log import app_log
from tornado.httpclient im... | betatim/tmpnb | spawnpool.py | Python | bsd-3-clause | 16,742 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2017-04-10 00:18
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('app', '0009_auto_20170409_1656'),
('app', '0012_auto_20170409_2239'),
]
operations ... | TeamAADGT/CMPUT404-project-socialdistribution | social/app/migrations/0013_merge_20170410_0018.py | Python | apache-2.0 | 330 |
# Copyright 2015 Cloudera 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, so... | korotkyn/ibis | ibis/impala/tests/common.py | Python | apache-2.0 | 5,509 |
"""Czech-specific form helpers."""
from __future__ import unicode_literals
import re
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField, Select
from django.utils.translation import ugettext_lazy as _
from localflavor.compat impo... | thor/django-localflavor | localflavor/cz/forms.py | Python | bsd-3-clause | 4,676 |
# Generated by Django 2.2.10 on 2020-09-25 14:11
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('accelerator', '0024_program_show_all_masschallenge_events'),
]
operations = [
migrations.AddField(
model_name='navtreeitem',
... | masschallenge/django-accelerator | accelerator/migrations/0025_add_user_type_to_nav_tree_item.py | Python | mit | 573 |
from __future__ import unicode_literals
from .nuevo import NuevoBaseIE
class RulePornIE(NuevoBaseIE):
_VALID_URL = r'https?://(?:www\.)?ruleporn\.com/(?:[^/?#&]+/)*(?P<id>[^/?#&]+)'
_TEST = {
'url': 'http://ruleporn.com/brunette-nympho-chick-takes-her-boyfriend-in-every-angle/',
'md5': '86861ebc624a1097c7c10ea... | valmynd/MediaFetcher | src/plugins/youtube_dl/youtube_dl/extractor/ruleporn.py | Python | gpl-3.0 | 1,280 |
"""Support for OpenUV sensors."""
import logging
from homeassistant.components.openuv import (
DATA_OPENUV_CLIENT, DATA_UV, DOMAIN, SENSORS, TOPIC_UPDATE,
TYPE_CURRENT_OZONE_LEVEL, TYPE_CURRENT_UV_INDEX, TYPE_CURRENT_UV_LEVEL,
TYPE_MAX_UV_INDEX, TYPE_SAFE_EXPOSURE_TIME_1, TYPE_SAFE_EXPOSURE_TIME_2,
TYP... | HydrelioxGitHub/home-assistant | homeassistant/components/openuv/sensor.py | Python | apache-2.0 | 4,910 |
import simplejson as json
import pytest
from tests.services.service_microservice import TestService
@pytest.fixture
def app():
service = TestService()
service.skip_configuration = True
service._initial_setup()
return service.make_tornado_app()
@pytest.mark.gen_test
def test_simple_call_no_paramete... | vladcalin/gemstone | tests/functional/test_microservice.py | Python | mit | 13,576 |
"""
sentry.management.commands.upgrade
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import, print_function
from django.core.management import call_command
from django.core.mana... | Kryz/sentry | src/sentry/management/commands/upgrade.py | Python | bsd-3-clause | 998 |
# -*- coding: utf-8 -*-
from django.conf import settings
if settings.REST_FRAMEWORK['DEFAULT_VERSIONING_CLASS'] == 'rest_framework.versioning.URLPathVersioning':
default_version = settings.REST_FRAMEWORK['DEFAULT_VERSION']
def set_default_version(params):
for param in params:
if param['n... | visasq/django-rest-swagger | rest_framework_swagger/patch.py | Python | bsd-2-clause | 485 |
#!/usr/bin/env python
# Copyright 2017-present Samsung Electronics Co., Ltd. and other contributors
#
# 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/LIC... | heejin-kim/TizenRT | external/iotjs/tools/testrunner.py | Python | apache-2.0 | 8,020 |
def extractLearning2TlWordpressCom(item):
'''
Parser for 'learning2tl.wordpress.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
if "WATTT" in item['tags']:
return buildReleaseMessageWithType(item, "WAT... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractLearning2TlWordpressCom.py | Python | bsd-3-clause | 379 |
# -*- coding: utf-8 -*-
import re
import time
from module.plugins.internal.Account import Account
class HellshareCz(Account):
__name__ = "HellshareCz"
__type__ = "account"
__version__ = "0.25"
__status__ = "testing"
__description__ = """Hellshare.cz account plugin"""
__license__ ... | kaarl/pyload | module/plugins/accounts/HellshareCz.py | Python | gpl-3.0 | 2,843 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__authors__ = 'Bruno Adelé <bruno@adele.im>'
__copyright__ = 'Copyright (C) 2013 Bruno Adelé'
__description__ = """Unittest"""
__license__ = 'GPLv3'
import os
import unittest
from githubsummary import githubsummary
EXAMPLE_RST = 'example.rst'
class TestPackages(unitt... | badele/github-summary | tests.py | Python | gpl-3.0 | 3,819 |
from random import randint
from pythoncom import VT_R8, VT_ARRAY, VT_DISPATCH, VT_BSTR, VT_BYREF, com_error
from .tool import double_from_string, int_from_string
def text_input(app, request_type = "str", prompt = "", options = None, default = None):
"""
Функция текстового ввода в активном документе
:par... | lobyntsev-d/pyacadcom | pyacadcom/userinput.py | Python | bsd-2-clause | 12,281 |
#
# 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 in the hope th... | Inspq/ansible | lib/ansible/playbook/role_include.py | Python | gpl-3.0 | 4,883 |
import GPUstats
# Get all device ids and their processing and memory utiliazion
#(deviceIds, gpuUtil, memUtil) = GPUstats.getGPUs()
# Get the first available GPU
firstGPU = GPUstats.getFirstAvailable()
print 'First available GPU id:'
print firstGPU
# Get the first available GPU, where processing is less than 1%
firs... | anderskm/tucgffcnnfss | Python/gpuUtilTest.py | Python | gpl-3.0 | 1,397 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Daniel Reis, 2013
#
# 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, eith... | raycarnes/project | project_issue_baseuser/__openerp__.py | Python | agpl-3.0 | 1,661 |
"""Support for RESTful binary sensors."""
import httpx
import voluptuous as vol
from homeassistant.components.binary_sensor import (
DEVICE_CLASSES_SCHEMA,
PLATFORM_SCHEMA,
BinarySensorEntity,
)
from homeassistant.const import (
CONF_AUTHENTICATION,
CONF_DEVICE_CLASS,
CONF_FORCE_UPDATE,
CON... | balloob/home-assistant | homeassistant/components/rest/binary_sensor.py | Python | apache-2.0 | 5,901 |
#!/usr/bin/env python
import json
import sys
import errno
import argparse
import xml.etree.ElementTree as ElementTree
from collections import namedtuple
reload(sys)
# Enable Utf-8 support. Needed if script will be run under Windows
sys.setdefaultencoding('utf-8')
class colors:
"""Class defining colorful output.... | APCVSRepo/sdl_core | tools/infrastructure/api_compare.py | Python | bsd-3-clause | 17,505 |
from ._config import PluginConfiguration
from ._parser import EndpointParser
from treq.client import HTTPClient
from twisted.internet import reactor, defer
from twisted.internet.interfaces import IHalfCloseableProtocol
from twisted.python import log
from twisted.python.failure import Failure
from twisted.web import ser... | cilium-team/powerstrip | powerstrip/powerstrip.py | Python | apache-2.0 | 14,164 |
import yaml
import re
from model import User
from model import Event
from google.appengine.ext import db
def post(handler, response):
people_yaml = handler.request.get('people')
import logging
people = yaml.load(people_yaml)
for person in people:
user = User.get_or_insert(key_name=person.get('email') or ... | globalspin/haemapod | haemapod/handlers/people/upload.py | Python | mit | 1,067 |
import collections
from supriya import CalculationRate
from supriya.ugens.UGen import UGen
class FBSineC(UGen):
"""
A cubic-interpolating feedback sine with chaotic phase indexing.
::
>>> fbsine_c = supriya.ugens.FBSineC.ar(
... a=1.1,
... c=0.5,
... fb=0.1,
... | Pulgama/supriya | supriya/ugens/FBSineC.py | Python | mit | 886 |
#############################################################################
##
## Copyright (C) 2015 The Qt Company Ltd.
## Contact: http://www.qt.io/licensing
##
## This file is part of Qt Creator.
##
## Commercial License Usage
## Licensees holding valid commercial Qt licenses may use this file in
## accordance wit... | martyone/sailfish-qtcreator | tests/system/suite_HELP/tst_HELP05/test.py | Python | lgpl-2.1 | 2,905 |
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright 2013 Matthieu Huin <mhu@enovance.com>
#
# This file is part of duplicity.
#
# Duplicity is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; ei... | andreagrandi/duplicity-sx | duplicity/backends/swiftbackend.py | Python | gpl-2.0 | 4,180 |
# Copyright (C) 2016 Matt Griswold <grizz@20c.com>
#
# This file is part of bgpfu
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless req... | bgpfu/bgpfu | src/bgpfu/prefixlist/simple.py | Python | apache-2.0 | 3,810 |
import inspect
from discord.ext import commands
from .utils import checks
# to expose to the eval command
class Admin:
"""Admin-only commands that make the bot dynamic."""
def __init__(self, bot):
self.bot = bot
@commands.command(hidden=True)
@checks.is_owner()
async def load(self, *... | jorismathijssen/ProjectLipa | James/cogs/admin.py | Python | gpl-3.0 | 2,377 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2018-01-02 02:12
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('polls', '0107_auto_20180101_2108'),
('polls', '0108_auto_20180101_1820'),
]
operati... | PrefPy/opra | compsocsite/polls/migrations/0109_merge_20180101_2112.py | Python | mit | 334 |
from dataclasses import dataclass, field, replace
from typing import (
Dict,
TYPE_CHECKING,
Iterable,
List,
NamedTuple,
Optional,
Sequence,
Tuple,
Union,
)
from . import box, errors
from ._loop import loop_first_last, loop_last
from ._pick import pick_bool
from ._ratio import ratio_... | willmcgugan/rich | rich/table.py | Python | mit | 35,052 |
class Smell(object):
def __init__(self):
self.id = None
self.name = ""
self.description = ""
self.aka = []
self.aka_obj_list = []
self.reference = ""
self.category = ""
self.category_obj = None
self.ref_obj = None
self.tool_list = [] #i... | tushartushar/smells | smellCatalog/Smell.py | Python | mit | 624 |
from chill import *
source('mm.c')
procedure('mm')
#format: rose
loop(0)
known('ambn > 0')
known('an > 0')
known('bm > 0')
print_code()
print_dep()
| ztuowen/chill-dev | Manual/tests/depend/test_known.py | Python | gpl-3.0 | 150 |
#!/usr/bin/python
# Copyright (C) International Business Machines Corp., 2005
# Author: Dan Smith <danms@us.ibm.com>
from XmTestLib import *
import re
if ENABLE_HVM_SUPPORT:
SKIP("Restore currently not supported for HVM domains")
config = {"disk": ["phy:/dev/ram0,hda1,w", "phy:/dev/ram1,hdb2,w"],
"vi... | avsm/xen-unstable | tools/xm-test/tests/restore/04_restore_withdevices_pos.py | Python | gpl-2.0 | 3,619 |
# __
# / /_ ____ ___ ____ ___ ____
# / __ \/ __ `/ _ \/ __ `__ \/ __ \
# / /_/ / /_/ / __/ / / / / / /_/ /
# /_.___/\__,_/\___/_/ /_/ /_/\____/
# baemo
__title__ = "baemo"
__author__ = "Christopher Antonellis"
__license__ = "MIT"
__copyright__ = "Copyright 2017 Christopher Antonellis"
__version__ = "0.0... | chrisantonellis/pymongo_basemodel | baemo/__init__.py | Python | mit | 325 |
#!/usr/bin/env python
"""Test cattery.py file."""
import unittest
from . import cattery
class TestCattery(unittest.TestCase):
"""Test Cattery class."""
def setUp(self):
self.cattery = cattery.Cattery()
# add_cats
def test__add_cats__succeeds(self):
"""It should successfully add ca... | Hwesta/git-tutorial | code/test_cattery.py | Python | mit | 1,287 |
#! /usr/bin/env python
import os
import errno
import pickle
import StringIO
from pylab import *
from scipy.ndimage.filters import gaussian_filter
plt.rcParams['image.interpolation'] = 'nearest'
plt.rcParams['image.cmap'] = 'gray'
from misc import mkdir_p, combine_dicts
from image_misc import saveimagesc, saveimagesc... | yosinski/deep-visualization-toolbox | optimize/gradient_optimizer.py | Python | mit | 16,438 |
######
#
# HX-2014-08:
# for Python code translated from ATS
#
######
######
# beg of [reference_cats.py]
######
############################################
def ats2pypre_ref(x): return [x]
def ats2pypre_ref_make_elt(x): return [x]
############################################
#
def ats2pypre_ref_get_elt(ref): retu... | githwxi/ATS-Postiats-frozen | contrib/libatscc-0.3.2/libatscc2py3/CATS/reference_cats.py | Python | mit | 550 |
from airflow import DAG
from airflow.operators import BashOperator, PythonOperator
from datetime import datetime, timedelta
import os
import logging
from subprocess import call
import tracker.model
from tracker.model.analysis_run import *
from tracker.util.workflow_common import *
from tracker.util.workflow_common im... | EMBL-EBI-TSI/butler | examples/workflows/delly-workflow/delly-workflow.py | Python | gpl-3.0 | 2,861 |
from allauth.socialaccount.tests import OAuth2TestsMixin
from allauth.tests import MockedResponse, TestCase
from .provider import WindowsLiveProvider
class WindowsLiveTests(OAuth2TestsMixin, TestCase):
provider_id = WindowsLiveProvider.id
def get_mocked_response(self):
return MockedResponse(200, """... | pztrick/django-allauth | allauth/socialaccount/providers/windowslive/tests.py | Python | mit | 841 |
# -*- coding: utf-8 -*-
# from __future__ import unicode_literals
from alibrary.models import Artist
from django.conf.urls import url
from django.db.models import Q
from easy_thumbnails.files import get_thumbnailer
from tastypie.authentication import (
MultiAuthentication,
SessionAuthentication,
ApiKeyAuth... | hzlf/openbroadcast.org | website/apps/alibrary/api/artistapi.py | Python | gpl-3.0 | 2,603 |
import logging
from pyvisdk.exceptions import InvalidArgumentError
########################################
# Automatically generated, do not edit.
########################################
log = logging.getLogger(__name__)
def VirtualHdAudioCardOption(vim, *args, **kwargs):
'''The VirtualHdAudioCardOption data ... | xuru/pyvisdk | pyvisdk/do/virtual_hd_audio_card_option.py | Python | mit | 1,244 |
from src.settings import Colors
def league_color(league: str) -> Colors:
if league in [
]:
return Colors.GREEN
if league in [
'1 CFL (Montenegro)',
'A Lyga (Lithuania)',
'Bikar (Iceland)',
'Coupe de la Ligue (France)',
'EURO Qualifiers (Europe)',
'F... | vapkarian/soccer-analyzer | src/colors/v20/default.py | Python | mit | 1,079 |
# Copyright 2009-2014 MongoDB, 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 writin... | otherness-space/myProject003 | my_project_003/lib/python2.7/site-packages/pymongo/master_slave_connection.py | Python | mit | 14,422 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# main.py
#
# Copyright 2014 Yang <yang@Leo-FamilyGuy>
#
# 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,... | BTY2684/gitPy-snippets | testProj/main.py | Python | gpl-2.0 | 1,348 |
# -*- coding: gbk -*-
path1 = u'K:\\选择删除\\' #所需修改文件夹所在路径
import os
import zhconv
for parent, dirnames, filenames in os.walk(path1):
for filename in filenames:
try:
os.rename(os.path.join(parent, filename), os.path.join(parent, zhconv.convert(filename, 'zh-cn')))
#print(zhconv.convert... | a67878813/script | rename2.py | Python | apache-2.0 | 703 |
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# bu... | PandaWei/avocado | avocado/core/job.py | Python | gpl-2.0 | 24,846 |
# -*- coding: utf-8 -*-
'''
Github User State Module
.. versionadded:: 2016.3.0.
This state is used to ensure presence of users in the Organization.
.. code-block:: yaml
ensure user test is present in github:
github.present:
- name: 'Example TestUser1'
- email: example@domain.com... | stephane-martin/salt-debian-packaging | salt-2016.3.3/salt/states/github.py | Python | apache-2.0 | 4,092 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: zengchunyun
"""
import os
import sys
base_dir = os.path.dirname(os.path.abspath(os.path.dirname(__file__)))
sys.path.append(base_dir)
if __name__ == "__main__":
try:
from modules.rabbitmq_core import main
main()
except KeyboardInterru... | zengchunyun/s12 | day10/homework/rabbitmq_management/bin/controller.py | Python | gpl-2.0 | 337 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.