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 |
|---|---|---|---|---|---|
'''
Created on 01.12.2015
@author: markusfasel
'''
import os, getpass, json
gConfig = None
gMode = ""
gTrainRoot = ""
class ConfigHandler(object):
@staticmethod
def LoadConfiguration(mode):
global gConfig
if not gConfig and mode != gMode:
gConfig = Config(os.path.join(gTrain... | raymondEhlers/pdsftrain | train/steer/config.py | Python | gpl-3.0 | 3,210 |
"""
Given a binary tree, return the inorder traversal of its nodes' values.
For example:
Given binary tree {1,#,2,3},
return [1,3,2].
"""
class TreeNode(object):
def __init__(self, x):
self.val = x
self.left = None
self.right = None
#Recursion code
class Solution(object):
def inord... | lingcheng99/LeetCode | BinaryTreeInorderTraversal.py | Python | mit | 1,181 |
from django.db import models
from django.utils.translation import ugettext_lazy as _
import netaddr
import constants
class Rule(models.Model):
""" A disclaimer rule.
If all requirements are set, carry out the actions.
"""
name = models.CharField(
_("name"),
max_length=255,
... | dploeger/disclaimr | disclaimrwebadmin/models.py | Python | mit | 12,539 |
# -*- coding: utf-8 -*-
#########################################################################
#
# Copyright (C) 2016 OSGeo
#
# 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 ... | PixelDragon/pixeldragon2 | pixeldragon2/layers/admin.py | Python | gpl-3.0 | 2,889 |
#!/usr/bin/env python
#
# -*- coding: utf-8 -*-
#
import pygame
def factory(widget_def):
widget_class = widget_def.get('type', None)
if not widget_class:
return DummyWidget()
if widget_class == 'Box':
pos = tuple(widget_def.get('position', [0, 0]))
size = tuple(widget_def.get('siz... | int-0/scriptadventure | widgets.py | Python | gpl-3.0 | 6,091 |
#!/usr/bin/env python
"""
A simple example of a few buttons and click handlers.
"""
from prompt_toolkit.application import Application
from prompt_toolkit.application.current import get_app
from prompt_toolkit.key_binding import KeyBindings
from prompt_toolkit.key_binding.bindings.focus import focus_next, focus_previou... | jonathanslenders/python-prompt-toolkit | examples/full-screen/buttons.py | Python | bsd-3-clause | 2,389 |
# Copyright 2022. ThingsBoard
#
# 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 ... | thingsboard/thingsboard-gateway | thingsboard_gateway/storage/file/event_storage_reader_pointer.py | Python | apache-2.0 | 1,115 |
# Copyright (c) 2015 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
#
# Unle... | cloudbase/neutron | neutron/conf/agent/l3/config.py | Python | apache-2.0 | 5,731 |
from __future__ import print_function
import os
os.environ['OMP_NUM_THREADS'] = '1'
import json
import argparse
from async_train import train_a3c
def main():
# Training settings
parser = argparse.ArgumentParser(description='A3C:Train')
parser.add_argument('--name', type=str, required=True, help='Experime... | wuhuikai/pytorch-a3c | train.py | Python | mit | 3,767 |
"""Tests for HomematicIP Cloud light."""
from homematicip.base.enums import RGBColorState
from homeassistant.components.homematicip_cloud import DOMAIN as HMIPC_DOMAIN
from homeassistant.components.homematicip_cloud.light import (
ATTR_CURRENT_POWER_W,
ATTR_TODAY_ENERGY_KWH,
)
from homeassistant.components.lig... | nkgilley/home-assistant | tests/components/homematicip_cloud/test_light.py | Python | apache-2.0 | 8,930 |
# 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 t... | wolverineav/neutron | neutron/tests/api/admin/test_l3_agent_scheduler.py | Python | apache-2.0 | 4,381 |
"""
Module containing functions to differentiate functions using tensorflow.
"""
try:
import tensorflow as tf
from tensorflow.python.ops.gradients import _hessian_vector_product
except ImportError:
tf = None
from ._backend import Backend, assert_backend_available
class TensorflowBackend(Backend):
def... | j-towns/pymanopt | pymanopt/tools/autodiff/_tensorflow.py | Python | bsd-3-clause | 2,913 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from .trigger import Trigger
from .triggertype import TriggerType
from data.data import balance
from validators.validators import valid_address, valid_amount
class SentTrigger(Trigger):
def __init__(self, trigger_id):
super(SentTrigger, self).__init__(trigger... | ValyrianTech/BitcoinSpellbook-v0.3 | trigger/senttrigger.py | Python | gpl-3.0 | 1,405 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('auth', '0001_initial'),
('orentapp', '0009_auto_20150402_1928'),
]
operations = [
m... | link272/0rent | orentapp/migrations/0010_auto_20150413_1331.py | Python | agpl-3.0 | 1,222 |
from __future__ import absolute_import, division, print_function, with_statement
from tornado.concurrent import Future
from tornado import gen
from tornado.escape import json_decode, utf8, to_unicode, recursive_unicode, native_str, to_basestring
from tornado.httputil import format_timestamp
from tornado.iostream import... | Callwoola/tornado | tornado/test/web_test.py | Python | apache-2.0 | 104,453 |
# Copyright 2012 NEC Corporation
#
# 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... | newrocknj/horizon | openstack_dashboard/dashboards/admin/networks/tests.py | Python | apache-2.0 | 68,798 |
import itertools
import logging
from django import forms
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from mypage.pages.models import Page, Widget
from mypage.rsswidgets.models import RSSWidget
from mypage.rsswidgets.forms import RSSCreationConfigForm
log = logging.getLogg... | ella/mypage | mypage/pages/forms.py | Python | bsd-3-clause | 6,005 |
#!/usr/bin/env python
# coding: utf-8
# Copyright 2011-2021, Nigel Small
#
# 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 require... | technige/py2neo | py2neo/client/console.py | Python | apache-2.0 | 15,083 |
import FWCore.ParameterSet.Config as cms
XMLIdealGeometryESSource = cms.ESSource("XMLIdealGeometryESSource",
geomXMLFiles = cms.vstring('Geometry/CMSCommonData/data/materials.xml',
'Geometry/CMSCommonData/data/rotations.xml',
'Geometry/CMSCommonData/data/normal/cmsextent.xml',
'Geometry/... | trianam/tkLayoutTests | TestRouting/test9/conf/xml/cmsIdealGeometryXML_cfi.py | Python | gpl-2.0 | 14,720 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015-2019 Bitergia
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This ... | valeriocos/perceval | perceval/errors.py | Python | gpl-3.0 | 2,186 |
from .pymdb import *
| kaushiksk/pymdb | pymdb/__init__.py | Python | mit | 21 |
# -*- coding: utf-8 -*-
#
# GIMS documentation build configuration file, created by
# sphinx-quickstart on Fri Jun 13 18:48:41 2014.
#
# 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
# autogenerated file.
#
# All ... | Ecodev/gims | docs/conf.py | Python | mit | 8,194 |
"""
SoftLayer.tests.CLI.modules.vs_tests
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:license: MIT, see LICENSE for more details.
"""
import json
import mock
from SoftLayer.CLI import exceptions
from SoftLayer import testing
class VirtTests(testing.TestCase):
def test_list_vs(self):
result = self... | Neetuj/softlayer-python | tests/CLI/modules/vs_tests.py | Python | mit | 17,932 |
# Copyright (C) 2014 Johnny Vestergaard <jkv@unixcluster.dk>
#
# 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... | CZ-NIC/conpot | conpot/protocols/kamstrup/usage_simulator.py | Python | gpl-2.0 | 4,908 |
"""
********************************************************************
Test file for implementation check of CR3BP library.
********************************************************************
Last update: 21/01/2022
Description
-----------
Contains a few sample orbit propagations to test the CR3BP l... | poliastro/poliastro | contrib/CR3BP/test_run_CR3BP.py | Python | mit | 6,277 |
from firedrake import *
from firedrake_adjoint import *
# Create mesh and define function space
n = 5
mesh = UnitSquareMesh(2 ** n, 2 ** n)
V = FunctionSpace(mesh, "CG", 1)
def model(s):
# Define variational problem
lmbda = 1
u = TrialFunction(V)
v = TestFunction(V)
a = dot(v, u) * dx
L = s * v... | ellipsis14/dolfin-adjoint | tests_firedrake/identity_assemble/identity_assemble.py | Python | lgpl-3.0 | 1,202 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.29 on 2021-06-24 09:23
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('submission', '0052_auto_20210525_1743'),
('submission', '0053_auto_20210222_1849'),
]
... | BirkbeckCTP/janeway | src/submission/migrations/0054_merge_20210624_0923.py | Python | agpl-3.0 | 345 |
# 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 may ... | Azure/azure-sdk-for-python | sdk/network/azure-mgmt-network/azure/mgmt/network/v2021_05_01/aio/operations/_express_route_circuits_operations.py | Python | mit | 53,747 |
# -*- coding: utf-8 -*-
#
# langfiles
# **************
#
import json
import os
from twisted.internet.defer import inlineCallbacks
from globaleaks import models
from globaleaks.handlers.base import BaseHandler
from globaleaks.orm import transact
from globaleaks.rest.apicache import GLApiCache
from globaleaks.settings... | vodkina/GlobaLeaks | backend/globaleaks/handlers/l10n.py | Python | agpl-3.0 | 1,472 |
from pylearn2.blocks import Block
import numpy as np
from pylearn2.utils.rng import make_np_rng
from pylearn2.space import Conv2DSpace
from scipy.ndimage.interpolation import rotate, shift, zoom
class DataAugmentation(Block):
def __init__(self, space, seed=20150111, spline_order=1, cval=0.):
self.rng = ma... | JesseLivezey/plankton | pylearn2/data_augmentation.py | Python | bsd-3-clause | 1,555 |
from .Counter import Counter | CRIStAL-PADR/python-paper-template | mymodule/__init__.py | Python | mit | 28 |
from django.core.cache import cache
from sorl.thumbnail.kvstores.base import KVStoreBase
from sorl.thumbnail.conf import settings
from sorl.thumbnail.models import KVStore as KVStoreModel
class EMPTY_VALUE(object):
pass
class KVStore(KVStoreBase):
def clear(self):
"""
We can clear the databa... | atomos/sorl-thumbnail | sorl/thumbnail/kvstores/cached_db_kvstore.py | Python | bsd-3-clause | 1,927 |
from __future__ import absolute_import
import unittest
import ddt
from django.test.utils import override_settings
from mock import Mock
from opaque_keys.edx.locator import CourseLocator
from xblock.field_data import DictFieldData
from xblock.fields import ScopeIds
from xmodule.html_module import CourseInfoBlock, Htm... | ESOedX/edx-platform | common/lib/xmodule/xmodule/tests/test_html_module.py | Python | agpl-3.0 | 11,723 |
import os
import logging
parentdir = os.path.dirname(os.path.abspath(__file__))
os.sys.path.insert(0,parentdir)
logging.basicConfig(format='ListenEngland:%(levelname)s:%(message)s',level=logging.DEBUG)
from llama.pika_client import *
publisher = PikaPublisher("demonstration")
from listening_llama.listener import Lis... | simonwgill/octo-llama | run_twitter_england.py | Python | gpl-2.0 | 406 |
import openpnm as op
from numpy.testing import assert_allclose
class SubclassedTransportTest:
def setup_class(self):
self.net = op.network.Cubic(shape=[9, 9, 9])
self.geo = op.geometry.GenericGeometry(network=self.net,
pores=self.net.Ps,
... | PMEAL/OpenPNM | tests/unit/algorithms/SubclassedTransportTest.py | Python | mit | 3,707 |
import symbol_table
class IntegerBox(object):
def __init__(self, value = False):
if value:
self.value = value
else:
self.value = 0
def copy(self):
return IntegerBox(self.value)
def set_to(self, integer):
self.value = integer.value
class ArrayBox(object):
def __init__(self, size, in... | burz/simcom | src/environment.py | Python | mit | 1,817 |
# -*- coding: utf-8 -*-
from reports.accidents.models import *
| k-vinogradov/noclite | reports/models.py | Python | bsd-3-clause | 66 |
from pathlib import Path
class NotificationService(object):
def __init__(self, repository):
self.repository = repository
self._indent = 0
def _rel(self, path: Path) -> str:
"""
Calculates the relative path inside a repository
:param path: absolute path
:return:... | Brutus5000/BiReUS | bireus/client/notification_service.py | Python | mit | 4,591 |
# Copyright (C) 2011, CloudCaptive
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed i... | satoshi-nakamoto/UserInfuser | serverside/signin.py | Python | agpl-3.0 | 1,987 |
from collections import defaultdict
from copy import deepcopy
from utils import memo
class Solution(object):
def countArrangement(self, N):
"""
:type N: int
:rtype: int
"""
@memo
def rec(pos, left): # actually left can be just a number
if not left:
... | wufangjie/leetcode | 526. Beautiful Arrangement.py | Python | gpl-3.0 | 1,670 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='University',
fields=[
('id', models.AutoField(v... | ResearchSoftwareInstitute/MyHPOM | hs_dictionary/migrations/0001_initial.py | Python | bsd-3-clause | 611 |
from django.http import JsonResponse
from django.shortcuts import redirect
from django.contrib.auth.decorators import login_required
from django.views.decorators.csrf import csrf_exempt
from invoices.models import OutgoingInvoice
from .providers.mollie import MollieApi
from .providers.bunq import BunqApi
from .models... | jlmdegoede/Invoicegen | payment/views.py | Python | gpl-3.0 | 1,589 |
# Copyright (C) 2007 Canonical Ltd
#
# 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 ... | Distrotech/bzr | bzrlib/email_message.py | Python | gpl-2.0 | 8,294 |
# 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 ... | lmazuel/azure-sdk-for-python | azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/operations/virtual_machine_scale_set_rolling_upgrades_operations.py | Python | mit | 13,768 |
"""
Read Pycco static resources into module variables
"""
import os
realpath = os.path.realpath(__file__)
with open(os.path.join(os.path.dirname(realpath), "pycco.html"), 'rb') as f:
html = f.read()
with open(os.path.join(os.path.dirname(realpath), "pycco.css"), 'rb') as f:
css = f.read()
with open(os.path.... | ckald/pyccoon | pyccoon/resources/__init__.py | Python | mit | 549 |
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
from .base import ObjectId, RequireField, RequireFieldError
class Purify:
'''
变量中会频繁出现 structure 和 struct
structure, 用于表示 collection 的结构定义, 是一个整体
struct, 用于表示 structure 以及其在遍历过程中的递归子元素
'''
def __init__(self, structure):
if not str... | lecly/pymongo-driver | pymongo_driver/purify.py | Python | mit | 6,295 |
try:
set
except NameError:
from sets import Set as set # Python 2.3 fallback
from django.db import connection
from django.contrib.auth.models import User
class ModelBackend(object):
"""
Authenticates against django.contrib.auth.models.User.
"""
# TODO: Model, login attribute name and password... | Shrews/PyGerrit | webapp/django/contrib/auth/backends.py | Python | apache-2.0 | 3,160 |
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file ex... | vmanoria/bluemix-hue-filebrowser | hue-3.8.1-bluemix/desktop/libs/hadoop/src/hadoop/__init__.py | Python | gpl-2.0 | 868 |
#############################################################################
##
## Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
## Contact: http://www.qt-project.org/legal
##
## This file is part of Qt Creator.
##
## Commercial License Usage
## Licensees holding valid commercial Qt licenses may use this f... | maui-packages/qt-creator | tests/system/suite_general/tst_default_settings/test.py | Python | lgpl-2.1 | 15,660 |
#!/usr/bin/env python3
#
# Copyright 2016 Red Hat, Inc.
#
# Authors:
# Fam Zheng <famz@redhat.com>
#
# This work is licensed under the MIT License. Please see the LICENSE file or
# http://opensource.org/licenses/MIT.
import abc
import subprocess
from api.models import Message, Result
from .patchewtest import Pa... | patchew-project/patchew | tests/test_testing.py | Python | mit | 14,544 |
#!/usr/bin/env python
import mymodule
print('hello from [{0}]'.format(__file__))
mymodule.print_module_info()
| veltzer/demos-python | src/examples/long/modules_basic/use_module.py | Python | gpl-3.0 | 113 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
##
## Author: Adriano Monteiro Marques <adriano@umitproject.org>
##
## Copyright (C) 2011 S2S Network Consultoria e Tecnologia da Informacao LTDA
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU Affero General Publi... | umitproject/site-status | main/views.py | Python | agpl-3.0 | 16,953 |
# -*- coding: utf-8 -*-
# simple spam detection using scikit-learn
import cPickle as pickle
from wootpaste.config import config
from sklearn.feature_extraction.text import CountVectorizer, TfidfTransformer
from sklearn.naive_bayes import BernoulliNB, MultinomialNB
from sklearn.linear_model import SGDClassifier
from ... | geekosphere/wootpaste | wootpaste/utils/spam_ml.py | Python | agpl-3.0 | 2,460 |
import os
import numpy as np
from pkg_resources import resource_filename
from numpy.testing import assert_array_equal, assert_allclose
import pytest
def find_testfile(fname):
return resource_filename('binding_md', os.path.join('tests', fname))
| dwhswenson/binding_md | binding_md/tests/utils.py | Python | mit | 250 |
# -*- coding: utf-8 -*-
"""
h2/frame_buffer
~~~~~~~~~~~~~~~
A data structure that provides a way to iterate over a byte buffer in terms of
frames.
"""
from hyperframe.exceptions import UnknownFrameError, InvalidFrameError
from hyperframe.frame import (
Frame, HeadersFrame, ContinuationFrame, PushPromiseFrame
)
fr... | bhavishyagopesh/hyper-h2 | h2/frame_buffer.py | Python | mit | 7,155 |
"""
Large-scale experiments that evaluate rnn-fxpts on many randomly sampled networks
File names provided to methods in this module should follow these naming conventions:
<test data id>: base name for a set of test networks
traverse_<test data id>_N_<N>_s_<s>: results for traverse on the s^{th} network of size N
... | garrettkatz/rnn-fxpts | fxpt_experiments.py | Python | mit | 63,834 |
# This file is part of the xxdiff package. See xxdiff for license and details.
"""xx-cvs-diff [<options>] [<file> <file> ...]
This simple script invokes 'cvs diff' with the given file arguments, then splits
the output patch for individual files, applies the reverse patches to temporary
files and for each file it the... | hackhowtofaq/xxdiff | lib/python/xxdiff/scripts/cvsdiff.py | Python | gpl-2.0 | 4,431 |
#//////////////////////////////////////////////
#//// UNAB - Facultad Ingenieria ////
#//// 30-04-2016 Santiago, Chile ////
#//// Autor: Isui Rojas M. ////
#//// Ing. en Computacion e Informatica ////
#//////////////////////////////////////////////
# Esta es una funcion recursiva... | xbash/LabUNAB | 06_funciones/factorial_recursivo.py | Python | gpl-3.0 | 1,702 |
import logging, time
from autotest_lib.client.common_lib import error
from autotest_lib.client.virt import virt_utils
@error.context_aware
def run_shutdown(test, params, env):
"""
KVM shutdown test:
1) Log into a guest
2) Send a shutdown command to the guest, or issue a system_powerdown
monitor... | libvirt/autotest | client/virt/tests/shutdown.py | Python | gpl-2.0 | 1,618 |
# -*- coding: utf-8 -*-
"""
Student dashboard page.
"""
from bok_choy.page_object import PageObject
from bok_choy.promise import EmptyPromise
from . import BASE_URL
class DashboardPage(PageObject):
"""
Student dashboard, where the student can view
courses she/he has registered for.
"""
def __init... | zadgroup/edx-platform | common/test/acceptance/pages/lms/dashboard.py | Python | agpl-3.0 | 6,473 |
from flask import url_for
from tracker.advisory import advisory_get_label
from tracker.model.cve import issue_types
from tracker.model.enum import Publication
from tracker.model.enum import Remote
from tracker.model.enum import Severity
from tracker.model.enum import Status
from .conftest import DEFAULT_ADVISORY_ID
f... | anthraxx/arch-security-tracker | test/test_todo.py | Python | mit | 11,364 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import re
from .common import InfoExtractor
class MoviezineIE(InfoExtractor):
_VALID_URL = r'https?://www\.moviezine\.se/video/(?P<id>[^?#]+)'
_TEST = {
'url': 'http://www.moviezine.se/video/205866',
'info_dict': {
... | kthordarson/youtube-dl-ruv | youtube_dl/extractor/moviezine.py | Python | unlicense | 1,401 |
#!/usr/bin/env python
#
# Copyright 2011, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list... | endlessm/chromium-browser | third_party/pywebsocket3/src/test/test_dispatch.py | Python | bsd-3-clause | 13,269 |
# -*- 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 model 'TOpen'
db.create_table('later_topen', (
('id', self.gf('django.db.models.fields.... | mozillazg/open-it-later | openitlater/later/migrations/0001_initial.py | Python | mit | 5,290 |
#-*- coding: utf_8 -*-
# XXX/AAA.wav | AAA_1.wav "text1"
# AAA_1.wav [0.0,1.2] | AAA_2.wav "text2"
# AAA_2.wav [1.5,2.0] | BBB_1.wav "text3"
# . | BBB_2.wav "text4"
# XXX/BBB.wav |
# BBB_1.wav [0.0,0.8] |
# BBB_2.wav [1.1,1.9] |
# .
import os
import sys... | wangjie1991/script | python/shijigaotongTextGrid.py | Python | apache-2.0 | 2,695 |
#!/usr/bin/python
#
# Copyright (C) 2013 Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of... | apyrgio/ganeti | test/py/cmdlib/instance_storage_unittest.py | Python | bsd-2-clause | 11,516 |
import itertools
import math
import sys
import warnings
import numpy as np
from numba.core.compiler import compile_isolated, Flags
from numba.core import utils, types
from numba.core.config import IS_WIN32, IS_32BITS
from numba.tests.support import TestCase, CompilationCache, tag
import unittest
from numba.np import ... | cpcloud/numba | numba/tests/test_mathlib.py | Python | bsd-2-clause | 21,179 |
import json
import os
import shutil
from click.testing import CliRunner, Result
from freezegun import freeze_time
from moto import mock_s3
import great_expectations
from great_expectations import DataContext
from great_expectations.cli import cli
from great_expectations.data_context.util import file_relative_path
fro... | great-expectations/great_expectations | tests/cli/upgrade_helpers/test_upgrade_helper.py | Python | apache-2.0 | 25,748 |
import logging as log
import requests
from bs4 import BeautifulSoup
from bs4.diagnose import diagnose
from pprint import pprint
from lxml import etree
import os
import pickle
import re
from argparse import ArgumentParser
import time
class PgaTourney():
tourney = '20150505_tpc_sawgrass'
url_past = 'http://www.... | Tjorriemorrie/trading | 20_pga/pga_tourney.py | Python | mit | 8,329 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Generate code fragments for amazon.yml
names = (
("us-east-1", "US East", "N. Virginia"),
("us-east-2", "US East", "Ohio"),
("us-west-1", "US West", "N. California"),
("us-west-2", "US West", "Oregon"),
("ca-ce... | jlund/streisand | util/print-aws-regions.py | Python | gpl-3.0 | 1,559 |
__author__ = 'Fabrizio'
#kivy.require(1.8.0")
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.screenmanager import Screen, ScreenManager, FadeTransition
from kivy.uix.widget import Widget
from kivy.graphics import Ellipse, Rectangle, Line
from kivy.uix import label
"""
http://robertour.com/2013/0... | ForAP/Advanc3d-Pr0graming | A5-Tree/Spike-Code/main.py | Python | gpl-2.0 | 2,421 |
# mail
mail = auth.settings.mailer
mail.settings.server = "logging" or "smtp.gmail.com:587"
mail.settings.sender = "admin@site.com"
mail.settings.login = "user:password"
# signals
def notifica(form):
user = form.vars
mail.send(
to=mail.settings.sender,
subject="Usuário %(first_name)s pendente... | cassiobotaro/curso.web2py | blog/models/30_mail.py | Python | gpl-3.0 | 498 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015-2018 CERN.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Configuration options for Invenio-Search.
The documentation for the configuration... | inveniosoftware/invenio-search | invenio_search/config.py | Python | mit | 3,755 |
import time
import cStringIO
import libpry
import libqtile.manager, libqtile.hook
import utils
class uHook(libpry.AutoTree):
def tearDown(self):
libqtile.hook.clear()
def setUpAll(self):
class Dummy: pass
dummy = Dummy()
io = cStringIO.StringIO()
dummy.log = lib... | andrelaszlo/qtile | test/test_hook.py | Python | mit | 1,407 |
#!/usr/bin/env python
# This file is part of Medieer.
#
# Medieer 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.
#
#... | toddself/Medieer | src/core/first_run.py | Python | gpl-3.0 | 3,395 |
from uzentropi import PLATFORM, PYTHON, MINUTES, Agent, on_timer, on_event
if PLATFORM is PYTHON:
try:
import requests
except ImportError as e:
raise ImportError('pip install requests')
import time
api_url = 'https://icanhazip.com'
else:
try:
import urequests as requests
... | zentropi/python-uzentropi | examples/06-external-ip/external_ip.py | Python | apache-2.0 | 1,217 |
#!/usr/bin/env python3
#
# Copyright (C) 2018-2019 The ESPResSo project
#
# This file is part of ESPResSo.
#
# ESPResSo 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... | espressomd/espresso | maintainer/gh_post_style_patch.py | Python | gpl-3.0 | 2,704 |
# 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... | dmlc/mxnet | tools/flakiness_checker.py | Python | apache-2.0 | 4,124 |
#!/usr/bin/env python
import plivohelper
import sys
try:
room = sys.argv[1]
fileformat = sys.argv[2]
filepath = sys.argv[3]
except IndexError:
print "Need ConferenceName, FileFormat, FilePath args"
sys.exit(1)
try:
filename = sys.argv[4]
except IndexError:
filename = ''
# URL of the Plivo... | plivo/plivohelper-python | examples/example-conferencerecordstart.py | Python | mit | 797 |
"""empty message
Revision ID: 17b38c3d5e7
Revises: 331c513e8d4
Create Date: 2015-09-07 19:56:25.897494
"""
# revision identifiers, used by Alembic.
revision = '17b38c3d5e7'
down_revision = '331c513e8d4'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - plea... | codeforamerica/comport | migrations/versions/17b38c3d5e7_.py | Python | bsd-3-clause | 883 |
# Copyright 2014 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | pandeyop/tempest | tempest/services/volume/v2/json/admin/volume_services_client.py | Python | apache-2.0 | 896 |
import pytest
from app.mongo.clear_query import ClearQuery
pytestmark = pytest.mark.asyncio
@pytest.mark.usefixtures('unstub')
class TestClearQuery:
async def test__builder_method(self):
data = {'jenkins_url': 'url', 'jobName': 'job', 'eventType': 'type'}
result = ClearQuery.from_clear_request_d... | futuresimple/triggear | tests/mongo/test_clear_query.py | Python | mit | 686 |
"""
Copyright (c) 2016 Genome Research Ltd.
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distr... | jeremymcrae/mupit | mupit/mutation_rates.py | Python | mit | 8,652 |
import shutil
import tempfile
import unittest
import queuelib
from scrapy.squeues import (
PickleFifoDiskQueue,
PickleLifoDiskQueue,
MarshalFifoDiskQueue,
MarshalLifoDiskQueue,
FifoMemoryQueue,
LifoMemoryQueue,
)
from scrapy.http import Request
from scrapy.spiders import Spider
from scrapy.uti... | pawelmhm/scrapy | tests/test_squeues_request.py | Python | bsd-3-clause | 7,452 |
# Copyright 2012 OpenStack Foundation
# All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | raildo/nova | nova/tests/unit/network/test_neutronv2.py | Python | apache-2.0 | 179,388 |
class traktException(Exception):
pass
class traktAuthException(traktException):
pass
class traktServerBusy(traktException):
pass
| h3llrais3r/SickRage | sickchill/oldbeard/trakt_api/exceptions.py | Python | gpl-3.0 | 145 |
import serial
from .abstract import SerialX10Controller, X10Controller
from ..utils import encodeX10HouseCode, encodeX10UnitCode, encodeX10Address
from x10.protocol import functions
class CM11(SerialX10Controller):
# -----------------------------------------------------------
# House and unit code tabl... | glibersat/python-x10 | x10/controllers/cm11.py | Python | gpl-3.0 | 2,319 |
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
import sys
if not (sys.version_info.major == 3 and sys.version_info.minor > 5):
print("Python version %s.%s not supported version 3.6 or above required - exiting" % (sys.version_info.major,sys.version_info.minor))
sys.exit(1)
# To be executed in the SchemaPages/... | vholland/schemaorg | SchemaPages/example-code/simpleTermList/simpleExpandedTermList.py | Python | apache-2.0 | 3,486 |
# -*- coding:utf8 -*-
import os
import re
import json
import csv
import requests
import threading
global thread_num
global error_count
from multiprocessing.dummy import Pool
def map_func_async(func, args_list, worker_num=8):
job = lambda args: func(args)
p = Pool(worker_num)
p.map(job, args_list)
def r... | tiankangkan/paper_plane | test.py | Python | gpl-3.0 | 1,532 |
###############################################################################
#
# The MIT License (MIT)
#
# Copyright (c) Tavendo GmbH
#
# 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 with... | meejah/AutobahnPython | autobahn/twisted/test/test_protocol.py | Python | mit | 4,619 |
# Copyright 2008-2015 Canonical
# Copyright 2015-2018 Chicharreros (https://launchpad.net/~chicharreros)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# Licens... | magicicada-bot/magicicada-server | magicicada/filesync/tests/test_gateway.py | Python | agpl-3.0 | 192,932 |
# -*- 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):
# Changing field 'Machine.memory'
db.alter_column(u'server_machine', 'memory', self.gf('django.db.models.fi... | salsoftware/sal | server/migrations/0005_auto__chg_field_machine_memory__chg_field_machine_hd_space__chg_field_.py | Python | gpl-3.0 | 11,563 |
"""
PageObjects related to the AcidBlock
"""
from bok_choy.page_object import PageObject
from bok_choy.promise import BrokenPromise, EmptyPromise
from edxapp_acceptance.pages.xblock.utils import wait_for_xblock_initialization
class AcidView(PageObject):
"""
A :class:`.PageObject` representing the rendered ... | edx/edx-e2e-tests | edxapp_acceptance/pages/xblock/acid.py | Python | agpl-3.0 | 3,301 |
from django.test import TestCase
from django.contrib import auth
from accounts.models import Token
User = auth.get_user_model()
class UserModelTest(TestCase):
def test_user_is_valid_with_email_only(self):
user = User(email='a@b.com')
user.full_clean() # should not raise
def test_is_authent... | fantasycheung/django_learning | accounts/tests/test_models.py | Python | mit | 903 |
# -*- coding: utf-8 -*-
from tests import msg
from uamobile import *
from uamobile.softbank import SoftBankUserAgent
from uamobile.factory.softbank import SoftBankUserAgentFactory
def test_detect_fast():
assert detect_fast('SoftBank/1.0/816SH/SHJ001 Browser/NetFront/3.4 Profile/MIDP-2.0 Configuration/CLDC-1.1') ==... | TheProjecter/wsgiuseragentmobile | tests/test_softbank.py | Python | mit | 14,960 |
# ***** BEGIN GPL LICENSE BLOCK *****
#
#
# 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 distribute... | Microvellum/Fluid-Designer | win64-vc/2.78/Python/bin/2.78/scripts/addons_contrib/text_intellisense.py | Python | gpl-3.0 | 9,294 |
# Static media bundle definitions.
PIPELINE_CSS = {
'csrf-failure': {
'source_filenames': (
'css/sandstone/sandstone-resp.less',
'css/csrf-failure.less',
),
'output_filename': 'css/csrf-failure-bundle.css',
},
'about': {
'source_filenames': (
... | jpetto/bedrock | bedrock/settings/static_media.py | Python | mpl-2.0 | 55,292 |
# -*- coding: utf-8 -*-
'''Flask SSE module
'''
from flask import Blueprint, request, current_app, json, stream_with_context
from redis import StrictRedis
from messager import ServerSideMessage
#from event import RayEvents
from app import app, logger
from app import sse_event
#with app.app_context():
# sse_event =... | rtx3/Microburst | ray/sse.py | Python | mit | 3,687 |
"""
=============
testapp.utils
=============
Utilities and helpers for Comments app.
"""
import hashlib
import uuid
from flask import current_app, redirect, url_for
build_key = lambda key, *args, **kwargs: (
key.format(current_app.config['KEY_PREFIX'], *args, **kwargs)
)
to_index = lambda: redirect(url_for('... | playpauseandstop/Flask-And-Redis | testapp/utils.py | Python | bsd-3-clause | 443 |
import os
import platform
import redis
from modules.configobj import ConfigObj
r = redis.Redis()
GITDOX_PREFIX = "__gitdox"
SEP = "|"
REPORT = "report"
TIMESTAMP = "timestamp"
if platform.system() == "Windows":
prefix = "transc\\"
else:
prefix = ""
rootpath = os.path.dirname(os.path.dirname(os.path.re... | cligu/gitdox | modules/redis_cache.py | Python | apache-2.0 | 3,532 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.