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 |
|---|---|---|---|---|---|
import scores_db
import mock
import redis_client
import control
from twisted.internet import defer
import yaml
# Unit tests
## ScoresDB access
def test_set_scores():
fake_connection = mock.Mock()
fake_connection.set = mock.Mock()
with mock.patch('redis_client.connection', fake_connection):
scores... | prophile/compd | src/test_scores_db.py | Python | mit | 25,628 |
# Copyright 2014-2017 Insight Software Consortium.
# Copyright 2004-2009 Roman Yakovenko.
# Distributed under the Boost Software License, Version 1.0.
# See http://www.boost.org/LICENSE_1_0.txt
"""
defines few algorithms, that deals with different properties of functions
"""
from . import calldef_types
from . import ... | BRAINSia/ITK | Modules/ThirdParty/pygccxml/src/pygccxml/declarations/function_traits.py | Python | apache-2.0 | 4,047 |
# coding: utf-8
import flask
import auth
import model
import util
from main import app
instagram_config = dict(
access_token_method='POST',
access_token_url='https://api.instagram.com/oauth/access_token',
authorize_url='https://instagram.com/oauth/authorize/',
base_url='https://api.instagram.com/v1... | d4rr3ll/gae-init-docker | main/auth/instagram.py | Python | mit | 1,489 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2010 British Broadcasting Corporation and Kamaelia Contributors(1)
#
# (1) Kamaelia Contributors are listed in the AUTHORS file and at
# http://www.kamaelia.org/AUTHORS - please extend this file,
# not this notice.
#
# Licensed under the Apache License, Ver... | sparkslabs/kamaelia | Sketches/MPS/pprocess/dk_bug_report_maybe.py | Python | apache-2.0 | 2,090 |
# Generated by Django 2.1.2 on 2018-11-04 05:45
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('collab', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='instance',
... | nirizr/rematch | server/collab/migrations/0002_auto_20181104_0545.py | Python | gpl-3.0 | 713 |
# encoding: UTF-8
'''
行情记录模块相关的GUI控制组件
'''
import json
from uiBasicWidget import QtGui, QtCore
from eventEngine import *
########################################################################
class TableCell(QtGui.QTableWidgetItem):
"""居中的单元格"""
#---------------------------------------------------------... | freeitaly/Trading-System | vn.trader/dataRecorderAlone/uiDrWidget.py | Python | mit | 7,251 |
from ctypes import Structure, POINTER, c_void_p, cast, create_string_buffer, \
c_char_p, byref, memmove
from ctypes import windll, WinDLL, WINFUNCTYPE
try:
from ctypes import wintypes
except ValueError:
# see http://bugs.python.org/issue16396
raise ImportError("wintypes")
from keyring.util.escape impo... | b-jesch/service.fritzbox.callmonitor | resources/lib/PhoneBooks/pyicloud/vendorlibs/keyrings/alt/_win_crypto.py | Python | gpl-2.0 | 3,477 |
""""Search Insert Position
Given a sorted array and a target value, return the index if the target is found. If not,
return the index where it whould be if it were inserted in order.
You may assume no duplicates in the array.
Example 1:
Input: [1, 3, 5, 6], 5
Output: 2
Example 2:
Input: [1, 3, 5, 6], ... | aiden0z/snippets | leetcode/035_search_insert_position.py | Python | mit | 1,452 |
from __future__ import print_function
from builtins import (ascii, bytes, chr, dict, filter, hex, input,
map, next, oct, pow, range, round,
str, super, zip)
import unittest
import argparse
import copy
import numpy as np
import numpy.testing as nptest
import fess.builder.buil... | pkerpedjiev/ernwin | test/fess/builder/builder_test.py | Python | agpl-3.0 | 3,152 |
import os
import psutil
import logging
from time import sleep
from reynard.monitors import Monitor
from katcp import Sensor
from subprocess import Popen,PIPE
log = logging.getLogger("reynard.monitor.memory")
class MemoryMonitor(Monitor):
def __init__(self,polling_interval=1):
super(MemoryMonitor,self).__i... | ewanbarr/reynard | reynard/monitors/memory_monitor.py | Python | mit | 2,263 |
"""This module provides the a softmax cross entropy loss for training FCN.
In order to train VGG first build the model and then feed apply vgg_fcn.up
to the loss. The loss function can be used in combination with any optimizer
(e.g. Adam) to finetune the whole model.
"""
from __future__ import absolute_import
from __... | MarvinTeichmann/tensorflow-fcn | loss.py | Python | mit | 1,779 |
# encoding: utf-8
"""Magic functions for InteractiveShell.
"""
from __future__ import print_function
#-----------------------------------------------------------------------------
# Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
# Copyright (C) 2001 Fernando Perez <fperez@colorado.edu>
# Copyright (C) 2008... | wolfram74/numerical_methods_iserles_notes | venv/lib/python2.7/site-packages/IPython/core/magic.py | Python | mit | 26,487 |
"""
WSGI config for broadclass 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.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
from dj_static import Cling
os.e... | Lucas-Pinheiro/BroadClass | broadclass/wsgi.py | Python | mit | 432 |
from __future__ import print_function
from keras.datasets import cifar10
from keras.layers import Input, Dense, Reshape, Flatten, Dropout, multiply, GaussianNoise
from keras.layers import BatchNormalization, Activation, Embedding, ZeroPadding2D
from keras.layers import MaxPooling2D
from keras.layers.advanced_act... | sofiane87/lasagne-GAN | ccgan/ccgan.py | Python | mit | 10,035 |
# -*- coding:utf-8 -*-
import unittest, sys, os
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from saklient.errors.exceptionfactory import ExceptionFactory
from saklient.errors.httpexception import HttpException
from saklient.errors.httpnotfoundexception import HttpNotFoundException
from... | hnakamur/saklient.python | tests/test_exception.py | Python | mit | 986 |
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
# Copyright 2013 Canonical Corp.
# 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
#
# htt... | shail2810/nova | nova/tests/unit/virt/vmwareapi/test_vm_util.py | Python | apache-2.0 | 67,481 |
# Copyright (c) 2011 Red Hat, 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 ... | weiting-chen/manila | manila/openstack/__init__.py | Python | apache-2.0 | 609 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
from dotty_dict import Dotty, dotty
class TestDottyPrivateMembers(unittest.TestCase):
def test_split_separator(self):
dot = dotty()
result = dot._split('chain.of.keys')
self.assertListEqual(result, ['chain', 'of', 'keys'])
... | pawelzny/dotty_dict | tests/test_dotty_api.py | Python | mit | 7,302 |
import sys
import os
import numpy as np
from pprint import pprint
from datetime import datetime
from datetime import timedelta
import mysql.connector
import math
import matplotlib.pyplot as plt
import matplotlib.colors
from matplotlib import dates
import calendar
from scipy.optimize import curve_fit
start = datetime(... | annahs/atmos_research | AL_size_distrs.py | Python | mit | 14,993 |
# coding=utf-8
import unittest
"""587. Erect the Fence
https://leetcode.com/problems/erect-the-fence/description/
There are some trees, where each tree is represented by (x,y) coordinate in a
two-dimensional garden. Your job is to fence the entire garden using the
**minimum length** of rope as it is expensive. The ga... | openqt/algorithms | leetcode/python/lc587-erect-the-fence.py | Python | gpl-3.0 | 1,702 |
import wx
hadImportError = False
try:
import numpy
import wx.lib.plot
except ImportError:
hadImportError = True
#############################################################################
# Where's the code???
#
# The wx.lib.plot package comes with its own excellent demo built in, for
# testing purpos... | dnxbjyj/python-basic | gui/wxpython/wxPython-demo-4.0.1/demo/PyPlot.py | Python | mit | 2,465 |
from . import sqlite
class TestPostgreSql(sqlite.TestSqlite):
config_params = {
'DATASTORE': 'postgresql://lux:luxtest@127.0.0.1:5432/luxtests'}
| tazo90/lux | tests/auth/postgresql.py | Python | bsd-3-clause | 159 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
EditScriptDialog.py
---------------------
Date : December 2012
Copyright : (C) 2012 by Alexander Bruy
Email : alexander dot bruy at gmail dot com
*******... | yordan-desta/QgisIns | python/plugins/processing/gui/ScriptEditorDialog.py | Python | gpl-2.0 | 7,417 |
"""
Django settings for wph project.
Generated by 'django-admin startproject' using Django 1.10.7.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
import os
imp... | prattl/wepickheroes | api/wph/settings/settings.py | Python | mit | 4,590 |
# This file is part of Trackma.
#
# 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 in the... | z411/trackma | trackma/tracker/tracker.py | Python | gpl-3.0 | 10,873 |
# Copyright 2017 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.
"""This program wraps an arbitrary command since gn currently can only execute
scripts."""
import os
import subprocess
import sys
from shutil import copy2
... | nwjs/chromium.src | tools/v8_context_snapshot/run.py | Python | bsd-3-clause | 552 |
"""
GitLab API:
https://docs.gitlab.com/ee/api/personal_access_tokens.html
https://docs.gitlab.com/ee/api/users.html#create-a-personal-access-token
"""
import pytest
import responses
user_id = 1
token_id = 1
token_name = "Test Token"
token_url = "http://localhost/api/v4/personal_access_tokens"
single_token_url = f"{... | python-gitlab/python-gitlab | tests/unit/objects/test_personal_access_tokens.py | Python | lgpl-3.0 | 2,791 |
'''
A tool to annotate and print variants in tabular format
Author: Khalid Mahmood
Contact: khalid.mahmood@unimelb.edu.au
Copyright: 2015
'''
#!/usr/bin/python
from utils import findlist
from annotations import getTabixVal,getTabixValCondel,getTabixBool
from annotations import getfathmm,adjust_scores
import sys
imp... | khalidm/VarPub | src/readvcf2.py | Python | gpl-2.0 | 15,746 |
#!/usr/bin/env python
#
# 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
# "... | dcristoloveanu/qpid-proton | examples/python/helloworld_direct.py | Python | apache-2.0 | 1,576 |
#
# Copyright (c) 2013 Big Switch Networks, Inc.
#
# Licensed under the Eclipse Public License, Version 1.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.eclipse.org/legal/epl-v10.html
#
# Unless required by applicable l... | opennetworkinglab/spring-open-cli | cli/desc/version200/switch.py | Python | epl-1.0 | 42,607 |
from resources.lib.nfl2018 import NFL2018
class Team(NFL2018):
short = "buccaneers"
hostname = "www.buccaneers.com"
def __init__(self, parameters):
self.parameters = parameters
NFL2018.__init__(self)
| Tenzer/plugin.video.nfl-teams | resources/lib/teams/buccaneers.py | Python | mit | 231 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import controller
import mainWindow
def main():
mainController = controller.CController()
#窗口显示
mainWindow.main(mainController)
pass
if __name__ == '__main__':
main() | sharmaking/NoticeSystem | main.py | Python | mit | 223 |
# 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 applicable law or agreed to in... | huntxu/neutron | neutron/tests/unit/api/test_api_common.py | Python | apache-2.0 | 1,311 |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PerlDbdSqlite(PerlPackage):
"""DBD::SQLite - Self-contained RDBMS in a DBI Driver"""
... | LLNL/spack | var/spack/repos/builtin/packages/perl-dbd-sqlite/package.py | Python | lgpl-2.1 | 905 |
from .items import *
from grandalf.routing import *
class GraphScene(QGraphicsScene):
def __init__(self, sug=None):
super(GraphScene, self).__init__()
p = QPen()
p.setColor(QColor("red"))
self.addLine(-5, 0, 5, 0, p)
self.addLine(0, -5, 0, 5, p)
self.sug = sug
... | LRGH/amoco | amoco/ui/graphics/qt_/graphwin.py | Python | gpl-2.0 | 2,530 |
from unittest import TestCase
from instructions.pop import Pop
from context import Context
from registers import AX, SP
__author__ = "Sébastien Guimmara"
class TestPop(TestCase):
def test_execute(self):
p = Pop.parse(['ax'])
ctx = Context(None)
ctx.registers.set(SP, 0xFFFE)
self.a... | Groutcho/exii | tests/instructions/test_pop.py | Python | gpl-2.0 | 762 |
from unittest import TestCase
from chatterbot.conversation.utils import get_response_statements
from chatterbot.conversation import Statement, Response
class ConversationUtilsTests(TestCase):
def test_get_statements_with_known_responses(self):
statement_list = [
Statement("What... is your que... | DarkmatterVale/ChatterBot | tests/conversation_tests/test_utils.py | Python | bsd-3-clause | 736 |
"""
test.py
Copyright 2015 Jeroen Arnoldus <jeroen@repleo.nl>
THIS SOFTWARE IS SUPPLIED WITHOUT WARRANTY OF ANY KIND, AND MAY BE
COPIED, MODIFIED OR DISTRIBUTED IN ANY WAY, AS LONG AS THIS NOTICE
AND ACKNOWLEDGEMENT OF AUTHORSHIP REMAIN.
"""
from django.test import TestCase
from randomcab.backends import ... | bjarnoldus/randomcab | src/randomcab/backends/test.py | Python | mit | 5,508 |
# -*- coding: utf-8 -*-
from django.core.exceptions import ValidationError
from photos.settings import BADWORDS
__author__ = 'hadock'
from django import forms
from photos.models import Photo
class PhotoForm(forms.ModelForm):
class Meta:
model = Photo
exclude = ['owner']
| krainet/Frikr | photos/forms.py | Python | mit | 294 |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | Xeralux/tensorflow | tensorflow/contrib/quantize/python/quantize_graph_test.py | Python | apache-2.0 | 8,586 |
# Copyright 2013 NTT 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... | vedujoshi/tempest | tempest/api/object_storage/test_account_bulk.py | Python | apache-2.0 | 6,413 |
##############################################################################
#
# OSIS stands for Open Student Information System. It's an application
# designed to manage the core business of higher education institutions,
# such as universities, faculties, institutes and professional schools.
# The core ... | uclouvain/osis | assessments/views/program_manager/score_sheet_xls_export.py | Python | agpl-3.0 | 1,948 |
import sys
import os
import numpy as np
from emclaw.utils.materials import Material1D
from emclaw.utils.sources import Source1D
from emclaw.utils import basics
material = Material1D(shape='homogeneous')
material.setup()
source = Source1D(material,shape='off',wavelength=2.0)
source.offset = 25.0
source.setup()
x_lowe... | MaxwellGEMS/emclaw | examples/maxwell_vc_1d/maxwell_1d.py | Python | lgpl-3.0 | 4,042 |
# BOLTS - Open Library of Technical Specifications
# Copyright (C) 2013 Johannes Reinhardt <jreinhardt@ist-dein-freund.de>
# Copyright (C) 2021 Bernd Hahnebach <bernd@bimstatik.org>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License a... | berndhahnebach/BOLTS | backends/freecad/gui/freecad_bolts.py | Python | gpl-3.0 | 18,156 |
"""Cli command to initialize a new database"""
import logging
import click
from sqlalchemy.exc import IntegrityError
from sqlalchemy.orm.exc import FlushError
from genotype.init.utils import read_snps
LOG = logging.getLogger(__name__)
@click.command("init")
@click.option("-r", "--reset", is_flag=True, help="reset... | Clinical-Genomics/taboo | genotype/cli/init_cmd.py | Python | mit | 942 |
#!/usr/bin/env python3
import argparse
import os
from lib.certificate_authority import make_server_certificate
def main():
if not os.path.isfile("LICENSE"):
print("This program expects to be run from the root OpenHouse checkout directory.")
return 1
parser = argparse.ArgumentParser(descriptio... | terrence2/OpenHouse | scripts/make_server_certificate.py | Python | gpl-3.0 | 646 |
'''
Plyer
=====
'''
__all__ = ('accelerometer', 'audio', 'battery', 'camera', 'compass', 'email',
'filechooser', 'gps', 'gyroscope', 'irblaster', 'orientation',
'notification', 'sms', 'tts', 'uniqueid', 'vibrator')
__version__ = '1.2.5dev'
from plyer import facades
from plyer.utils import Pro... | kostyll/plyer | plyer/__init__.py | Python | mit | 1,899 |
# Copyright 2016 Google LLC
# Modifications: Copyright 2020 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 ... | googleinterns/server-side-identity | gsi/transport/__init__.py | Python | apache-2.0 | 3,286 |
import json
from ... import cnscom
from .. import exception
from ._completions import complete_ident
###
name = 'start'
cmdhelp = 'Start program(s)'
###
def init_parser(parser):
parser.add_argument('-n','--no-server-start', action='store_true', help='Avoid eventual automatic start of Ramona server')
parser.add_arg... | ateska/ramona | ramona/console/cmd/start.py | Python | bsd-2-clause | 1,479 |
"""Contains the AdminModule which defines administrative methods."""
import asyncio
import logging
import sys
import os
from .module import Module
logging.basicConfig(level=logging.INFO)
class AdminModule(Module):
"""AdminModule which defines administrative methods."""
def __init__(self, client, modules, com... | 4rChon/DiscordBot | bot/modules/admin.py | Python | gpl-3.0 | 4,184 |
async # Comment
| asedunov/intellij-community | python/testData/completion/async.after.py | Python | apache-2.0 | 16 |
__author__ = 'mmmmmtasty'
import soco
from soco import SoCo
import time
import json
import os
import traceback
from email.mime.text import MIMEText
from smtplib import SMTP
# Convert times in 00:00:00 format to an integer number of seconds
def time_to_int( time_string ):
accum = 0
mult = 1
for p in rever... | mmmmmtasty/PiZeroDoorbell | get_sonos_state.py | Python | gpl-3.0 | 5,699 |
# Abstract base class setting out template for manifold classes
import abc
import numpy as np
class Manifold(object):
__metaclass__ = abc.ABCMeta
@abc.abstractproperty
def name(self):
# Name of the manifold.
raise NotImplementedError
@abc.abstractproperty
def short_name(self):
... | Nehoroshiy/urnn | manifolds/manifold.py | Python | mit | 3,041 |
# -*- coding: utf-8 -*-
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | tseaver/google-cloud-python | talent/tests/unit/gapic/v4beta1/test_application_service_client_v4beta1.py | Python | apache-2.0 | 11,302 |
from __future__ import unicode_literals
from django.db import models
from django.utils import timezone
# Create your models here.
class user(models.Model):
name = models.CharField(max_length=50,blank=False)
mail_id = models.EmailField(max_length=50,blank=True)
time_stamp = models.TimeField(default=timezo... | Technorip/Myntra | Django Backend/myntra/mynt/models.py | Python | gpl-2.0 | 1,001 |
# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
# Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect 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 Licen... | jameschch/Lean | Algorithm.Python/ETFConstituentUniverseMappedCompositeRegressionAlgorithm.py | Python | apache-2.0 | 4,222 |
# -*- coding: utf-8 -*-
"""The encoded stream path specification resolver helper implementation."""
# This is necessary to prevent a circular import.
import dfvfs.file_io.encoded_stream_io
import dfvfs.vfs.encoded_stream_file_system
from dfvfs.lib import definitions
from dfvfs.resolver import resolver
from dfvfs.reso... | manashmndl/dfvfs | dfvfs/resolver/encoded_stream_resolver_helper.py | Python | apache-2.0 | 1,357 |
from lib.simpleutils import latinnum
from lib.unicodeops import unistr
def numeric(el): ####Oi upoloipoi typoi
el = unistr(el)
if el.startswith("0") and not el.startswith("0."):
return el
try:
return int(el)
except ValueError:
try:
return float(el)
except ... | madgik/exareme | Exareme-Docker/src/exareme/exareme-tools/madis/src/lib/gtable.py | Python | mit | 4,546 |
# -*- coding: utf-8 -*-
#
# 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
#... | subodhchhabra/airflow | airflow/www_rbac/app.py | Python | apache-2.0 | 7,193 |
from django.core.management.base import BaseCommand
from ...shortcuts import stripe
class Command(BaseCommand):
help = "Clear all test customers from your stripe account."
def handle(self, *args, **options):
verbosity = int(options.get('verbosity', 1))
count, offset = 100, 0
if verbo... | amccloud/django-stripe | django_stripe/management/commands/stripe_clear_test_customers.py | Python | bsd-3-clause | 1,106 |
# stdlib
import logging
import os
import shutil
import unittest
# project
from tests.checks.common import Fixtures, get_check
log = logging.getLogger()
CONFIG = """
init_config:
instances:
- mysql_host: localhost
mysql_user: root
rrd_path: /tmp/cacti_test/rrds
rrd_whitelist: %s
""" %... | jyogi/purvar-agent | tests/checks/mock/test_cacti.py | Python | bsd-3-clause | 3,589 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | takeshineshiro/keystone | keystone/contrib/simple_cert/controllers.py | Python | apache-2.0 | 1,499 |
#!/usr/bin/python3
from re import *
import os
with open('creche.toc', 'r') as f:
toc = f.read()
f.closed
p = compile('.*\{Preface\}.*')
toc = p.sub('* **Preface**', toc)
p = compile('.*contentsfinish\s\n')
toc = p.sub('', toc)
p = compile('\\\\contentsline\s\{chapter\}\{\\\\numberline\s\{\d*\}')
toc = p.su... | domenicozambella/creche | toc.py | Python | gpl-3.0 | 1,126 |
"""Fixtures factories."""
import factory
from modoboa.admin import factories as admin_factories
from . import models
class UserCalendarFactory(factory.DjangoModelFactory):
class Meta:
model = models.UserCalendar
name = factory.Sequence(lambda n: 'User calendar %s' % n)
mailbox = factory.SubFa... | modoboa/modoboa-radicale | modoboa_radicale/factories.py | Python | mit | 827 |
import os
import sys
SETTINGS_DIR = os.path.dirname(__file__)
PROJECT_DIR = os.path.dirname(SETTINGS_DIR)
BUILDOUT_DIR = os.path.dirname(PROJECT_DIR)
VAR_DIR = os.path.join(BUILDOUT_DIR, "var")
##########################################################################
#
# Broker settings
#
#########################... | michaelwisely/aubergine | aubergine/settings/celeryconfig.py | Python | bsd-3-clause | 2,240 |
# Copyright (c) 2011 ARM Limited
# All rights reserved
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implementation of the functionality o... | lastweek/gem5 | tests/configs/realview-o3-checker.py | Python | bsd-3-clause | 3,819 |
# -*- coding: UTF-8 -*-
import wx
from outwiker.gui.testeddialog import TestedDialog
class TextEntryDialog(TestedDialog):
"""
The dialog to enter text value with optional prefix
"""
def __init__(self, parent,
title=u'', message=u'', prefix=u'',
value=u'',
... | unreal666/outwiker | plugins/hackpage/hackpage/gui/textentrydialog.py | Python | gpl-3.0 | 2,935 |
# Copyright 2013 Josh Durgin
# Copyright 2013 Red Hat, 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-... | imsplitbit/nova | nova/tests/api/openstack/compute/contrib/test_volumes.py | Python | apache-2.0 | 32,150 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2012, Michael DeHaan <michael.dehaan@gmail.com>
#
# 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... | amandolo/ansible-modules-core | system/setup.py | Python | gpl-3.0 | 5,256 |
"""Fixtures for pywemo."""
import asyncio
from unittest.mock import create_autospec, patch
import pytest
import pywemo
from homeassistant.components.wemo import CONF_DISCOVERY, CONF_STATIC
from homeassistant.components.wemo.const import DOMAIN
from homeassistant.setup import async_setup_component
MOCK_HOST = "127.0.... | partofthething/home-assistant | tests/components/wemo/conftest.py | Python | apache-2.0 | 2,417 |
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def zigzagLevelOrder(self, root):
"""
:type root: TreeNode
:rtype: List[List[int]]
"""
... | tedye/leetcode | Python/leetcode.103.binary-tree-zigzag-level-order-traversal.py | Python | mit | 859 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import tornado.httpserver
import tornado.ioloop
import tornado.options
import tornado.web
import tornado.websocket
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BOARD)
GPIO.setup(11, GPIO.OUT)
GPIO.output(11, False)
class ArduinoHandler(tornado.websocket.WebSocketHandler): ... | pedrosanchezm/Proyecto_Sistema_de_seguridad | Websocket/TornadoWebsocketsPI.py | Python | gpl-3.0 | 1,310 |
#!/usr/bin/env python3
# Copyright (c) 2014-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from test_framework.test_framework import ElectrumTestFramework
from test_framework.util import *
# Crea... | sinraf96/electrum | qa/rpc-tests/fundrawtransaction.py | Python | mit | 25,230 |
#!/usr/bin/env python
########################################################################
# File : dirac-install-web-portal
# Author : Ricardo Graciani
########################################################################
"""
Do the initial installation of a DIRAC Web portal
"""
from DIRAC.Core.Base.Script ... | DIRACGrid/DIRAC | src/DIRAC/Core/scripts/dirac_install_web_portal.py | Python | gpl-3.0 | 618 |
import sys, os, re
def reformat(f):
of = 'reformatted/'+f
with open(f, 'r') as input, open(of, 'w') as output:
line = input.readline() # Comment 1
output.write(line)
line = input.readline() # Comment 2
output.write(line)
line = input.readline() # Comment 3
output... | paul-voyles/femsim-hrmc | potentials/reformat_potential.py | Python | mit | 1,506 |
#!/usr/bin/env python
from setuptools import find_packages, setup
import os
# You need install_requires if you don't have a ROS environment
install_requires = [] if os.environ.get('CATKIN_BINARY_DIR') else [
# build
'setuptools',
# runtime
'enum34;python_version<"3.4"',
'pydot'
]
tests_require = ... | stonier/py_trees_suite | setup.py | Python | bsd-3-clause | 3,418 |
# GNU Enterprise Common Library - MS-ADO database driver using adodbapi
#
# Copyright 2000-2007 Free Software Foundation
#
# This file is part of GNU Enterprise.
#
# GNU Enterprise 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 S... | HarmonyEnterpriseSolutions/harmony-platform | src/gnue/common/datasources/drivers/sql/mssql/pyodbcdrv.py | Python | gpl-2.0 | 3,945 |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2015-2021 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
# This file is part of qutebrowser.
#
# qutebrowser 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 Sof... | fiete201/qutebrowser | tests/unit/config/test_configexc.py | Python | gpl-3.0 | 4,232 |
import numpy as np
import random
from hartmann.asr import MOG
from hartmann.asr import HMM
class HMMSet:
def __init__(self, hmm = [], model = [], transition = []):
self.hmm = hmm
self.model = model
self.transition = transition
self.ci_index = {}
self.cd_index = {}
def b... | hartmannw/research | hartmann/asr/hmmset.py | Python | unlicense | 8,074 |
"""
Module defining a few BlackBoxes for textured plane tracking
"""
from ecto import BlackBoxCellInfo, BlackBoxForward
from ecto_opencv.calib import PoseDrawer, TransformCompose
from ecto_opencv.features2d import FASTFeature, ORB, Matcher, MatchRefinementHSvd, DrawMatches, KeypointsToMat, \
LSHMatcher
from ecto_op... | WalkingMachine/sara_commun | wm_ork/capture/python/object_recognition_capture/orb_capture.py | Python | apache-2.0 | 5,546 |
#!/usr/bin/env python
"""Mixin that tests hash blob references."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
import os
import random
from grr_response_server.rdfvalues import objects as rdf_objects
class DatabaseTestBlobReferencesMixin(object):
... | dunkhong/grr | grr/server/grr_response_server/databases/db_blob_references_test.py | Python | apache-2.0 | 3,314 |
from PyQt4 import QtCore, QtGui
import sys
import copy
class NewsTicker(QtGui.QWidget):
def __init__(self, *args, **kwargs):
QtGui.QWidget.__init__(self, *args, **kwargs)
self.news = []
self.myText = ""
self.offset = 0
self.myTimerId... | IDragonfire/modular-client | src/galacticWar/newsTicker/newsTicker.py | Python | gpl-3.0 | 2,218 |
__author__ = 'cutylewiwi'
# -*- coding:utf-8 -*-
import urllib
import urllib2
import re
class Prof:
def __init__(self, name, photoUrl, pUrl, title, area, office, phone, email):
self.name = name
self.photoUrl = photoUrl
self.pUrl = pUrl
self.title = title
self.a... | doge-search/webdoge | wuyudong/CUNY/CUNY.py | Python | unlicense | 3,075 |
#
# 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 us... | lukecwik/incubator-beam | sdks/python/apache_beam/typehints/schemas_test.py | Python | apache-2.0 | 10,272 |
# This program verifies the discrete crowdsensing game model is n-truthful.
import random
import math
from copy import deepcopy
# Let there be 100 users.
n = 100
# Let the upper bound of the users' unit costs be 10.
k_max = 10.0
# the maximum payment to each user is 100.
Pm = 100
# Total reward of the platform is 1000... | anonymous10101/collusion_resist_codes | programs/tr_dis.py | Python | gpl-2.0 | 8,347 |
# 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 agree... | Juniper/nova | nova/objects/__init__.py | Python | apache-2.0 | 3,288 |
import _picklesize
from picklesize import _fastpicklesize
try:
import numpy.core.multiarray
def fast_estimate_ndarray(est, obj, obj_type, obj_id):
est._seen.add(obj_id)
return obj.nbytes
def estimate_ndarray(est, obj, obj_type, obj_id):
# During pickle, the actual dat... | smurn/picklesize | picklesize/_numpysupport.py | Python | mit | 2,081 |
from . import base
reload(base)
from . import xref
reload(xref)
from . import line
reload(line)
from . import function
reload(function)
from . import switch
reload(switch)
from . import instruction
reload(instruction)
from . import segment
reload(segment)
from .base import *
from .line import Line, lines
... | HackerTool/Sark | sark/code/__init__.py | Python | mit | 438 |
"""Feature definitions for OAuth2 integration."""
from __future__ import unicode_literals
from django.utils.translation import ugettext_lazy as _
from djblets.features.feature import Feature, FeatureLevel
class OAuth2ServiceFeature(Feature):
"""A feature for OAuth2 integration."""
feature_id = 'oauth.servi... | chipx86/reviewboard | reviewboard/oauth/features.py | Python | mit | 571 |
import csv
import numpy as np
class Histogram():
def __init__(self, table_filename='', fields=[], ordered_fields=[],
histogram=None, valists=[], valdicts=[]):
""" Can be given seed data (table_filename) or complete histogram. """
self.table_filename = table_filename
self.fields = fields
self.order... | dnut/associations | associations/histogram.py | Python | gpl-3.0 | 7,504 |
###
### Cisco Meraki Firewall AP Rules API - robert@nigma.org
###
#!/usr/bin/env python
# Table layout
from tabulate import tabulate
# Progress bar
from tqdm import tqdm
import json
import requests
import sys
import os
import csv
import argparse
# Main Function
def main():
if meraki_debug == "1":
print("D... | robertcsapo/cisco-meraki-fw-ap-rules-api | cisco_meraki_fw_ap_rules_api.py | Python | mit | 13,017 |
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | cshallue/models | research/object_detection/models/ssd_mobilenet_v2_keras_feature_extractor.py | Python | apache-2.0 | 6,777 |
"""The tests for Philips Hue device triggers."""
import pytest
from homeassistant.components import hue
import homeassistant.components.automation as automation
from homeassistant.components.hue import device_trigger
from homeassistant.setup import async_setup_component
from .conftest import setup_bridge_for_sensors ... | tboyce021/home-assistant | tests/components/hue/test_device_trigger.py | Python | apache-2.0 | 5,717 |
# -*- coding: utf-8 -*-
import sys
def print_progress (iteration, total, prefix = '', suffix = '', decimals = 1, barLength = 100):
"""
Call in a loop to create terminal progress bar
@params:
iteration - Required : current iteration (Int)
total - Required : total iterations (Int)
... | DawudH/scrapy_real-estate | plot/print_progressbar.py | Python | mit | 1,262 |
"""
Django settings for eveggie project.
For more information on this file, see
https://docs.djangoproject.com/en/dev/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/dev/ref/settings/
"""
import environ
ROOT_DIR = environ.Path(__file__) - 3 # (eveggie/config/se... | flp9001/eveggie | config/settings/base.py | Python | mit | 10,190 |
#!/usr/bin/env python
def acc(n = 0):
rst = 0
for i in range(n+1):
rst += i
return rst
for i in range(10):
print("acc(" + str(i) + ") returns " + str(acc(i)))
print("acc() returns " + str(acc()))
| yehnan/rpi_book_yehnan | ch_python/def_acc.py | Python | mit | 224 |
# -*- coding: utf-8 -*-
# Copyright 2022 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... | googleapis/python-dataflow-client | google/cloud/dataflow_v1beta3/types/environment.py | Python | apache-2.0 | 27,163 |
from django.db import models
from django.utils.translation import ugettext as _
class Propaganda(models.Model):
"""Each different email to be sent"""
plaintext_msg = models.TextField(_("plain text message"))
html_msg = models.TextField(_("html message"))
subject = models.CharField(_("subject"), max_le... | nabucosound/django-propaganda | propaganda/models.py | Python | bsd-3-clause | 1,882 |
import datetime
from dateutil.relativedelta import *
## give final date and time after parsing by changing current date-time
def change_datetime ( c="0", y=0, mt=0, w=0, d=0, h=0, m=0, s=0):
#mt = mt + 12*y
#d = d + 30*mt
now = datetime.datetime.now()
change = relativedelta( years =+ y, months =+ mt, weeks... | Chirayu-sopho/Hindi-DateTime-Parser | functions.py | Python | mit | 4,957 |
#!/usr/bin/env python
import os
print("this is python, FOO is", os.environ["FOO"]) | tjgillies/unix-web | bin/example/test.py | Python | mit | 83 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.