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 |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
"""SQL-Alchemy wrapper for Maraschino database"""
from sqlalchemy import create_engine
from sqlalchemy.orm import scoped_session, sessionmaker
from sqlalchemy.ext.declarative import declarative_base
from maraschino import DATABASE
engine = create_engine('sqlite:///%s' % (DATABASE), convert_uni... | N3MIS15/maraschino-webcam | maraschino/database.py | Python | mit | 687 |
# -*- coding: utf-8 -*-
#
# Copyright 2009: Johannes Raggam, BlueDynamics Alliance
# http://bluedynamics.com
# GNU Lesser General Public License Version 2 or later
__author__ = """Johannes Raggam <johannes@raggam.co.at>"""
__docformat__ = 'plaintext'
from activities.runtime.interfaces import IExecutio... | bluedynamics/activities.test.hospital | src/activities/test/hospital/executions.py | Python | lgpl-3.0 | 1,924 |
"""distutils.dep_util
Utility functions for simple, timestamp-based dependency of files
and groups of files; also, function based entirely on such
timestamp dependency analysis."""
# This module should be kept compatible with Python 2.1.
__revision__ = "$Id: dep_util.py,v 1.7 2004/11/10 22:23:14 loewis Exp $"
impor... | trivoldus28/pulsarch-verilog | tools/local/bas-release/bas,3.9-SunOS-i386/lib/python/lib/python2.4/distutils/dep_util.py | Python | gpl-2.0 | 3,573 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright Kitware 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 ... | adsorensen/girder | tests/cases/rest_util_test.py | Python | apache-2.0 | 6,155 |
# Copyright (c) 2014, German Neuroinformatics Node (G-Node)
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted under the terms of the BSD License. See
# LICENSE file in the root of the Project.
from __future__ import (absolute_import, division,... | stoewer/nixpy | nixio/entity_with_sources.py | Python | bsd-3-clause | 990 |
# -*- coding: utf-8 -*-
"""Fetch hard drive temperature data from a hddtemp daemon
that runs on localhost and default port (7634)
contributed by `somospocos <https://github.com/somospocos>`_ - many thanks!
"""
import socket
import core.module
import core.widget
HOST = "localhost"
PORT = 7634
CHUNK_SIZE = 1024
REC... | tobi-wan-kenobi/bumblebee-status | bumblebee_status/modules/contrib/hddtemp.py | Python | mit | 2,667 |
from distutils.core import setup
from distutils.command.install_data import install_data
from distutils.command.install import INSTALL_SCHEMES
import os
import sys
class osx_install_data(install_data):
# On MacOS, the platform-specific lib dir is /System/Library/Framework/Python/.../
# which is wrong. Python 2... | t11e/django | setup.py | Python | bsd-3-clause | 4,079 |
import imageio
import os
try:
imageio.plugins.ffmpeg.download()
except:
print("Some cause an error, please execute is as root.")
finally:
os.remove("ffmpeg-ins.py")
| DcSoK/ImgurPlus | lib/ffmpeg-ins.py | Python | gpl-3.0 | 177 |
import os
import infra.basetest
GLXINFO_TIMEOUT = 120
class TestGlxinfo(infra.basetest.BRTest):
config = \
"""
BR2_x86_core2=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_CUSTOM=y
BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y
BR2_TOOLCHAIN_EXTERNAL_URL="http://toolchains.... | glevand/buildroot--buildroot | support/testing/tests/package/test_glxinfo.py | Python | gpl-2.0 | 2,589 |
from django.urls import path
urlpatterns = [
path('stock/soap11', 'stock.web.views.dispatch11'),
path('stock/soap12', 'stock.web.views.dispatch12'),
path('ws/ops', 'stock.web.views.ops_dispatch'),
]
| soapteam/soapfish | examples/stock/urls.py | Python | bsd-3-clause | 212 |
from db import Db
from gen import Generator
from parse import Parser
from sql import Sql
from rnd import Rnd
import sys
import sqlite3
import codecs
SENTENCE_SEPARATOR = '.'
WORD_SEPARATOR = ' '
if __name__ == '__main__':
args = sys.argv
usage = 'Usage: %s (parse <name> <depth> <path to txt file>|gen ... | codebox/markov-text | markov.py | Python | mit | 1,018 |
"""
This code is for illustration purpose only.
Use multi_agent.py for better performance and speed.
"""
import os
import numpy as np
import tensorflow as tf
import env
import a3c
import load_trace
from common_settings import CommonSettings
S_INFO = CommonSettings.S_INFO # bit_rate, buffer_size, next_chunk_size, ban... | BlackPoint-CX/ABR | ABR/sim/agent.py | Python | mit | 8,958 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Functions to format lexc from omorfi data."""
# Author: Omorfi contributors <omorfi-devel@groups.google.com> 2015
# 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 ... | jiemakel/omorfi | src/python/omorfi/lexc_formatter.py | Python | gpl-3.0 | 3,736 |
#!/usr/bin/env python3
# -*- python -*-
"""
%prog SUBMODULE...
Hack to pipe submodules of Numpy through 2to3 and build them in-place
one-by-one.
Example usage:
python3 tools/py3tool.py testing distutils core
This will copy files to _py3k/numpy, add a dummy __init__.py and
version.py on the top level, and copy a... | jasonmccampbell/scipy-refactor | tools/py3tool.py | Python | bsd-3-clause | 11,878 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2011, 2012, 2013, 2014, 2015 CERN.
#
# Invenio 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 (a... | Lilykos/invenio | invenio/ext/sqlalchemy/__init__.py | Python | gpl-2.0 | 7,906 |
class Solution:
def profitableSchemes(self, G: int, P: int, group: List[int], profit: List[int]) -> int:
dp = [[0]*(1 + G) for _ in range(1 + P)]
dp[0][0] = 1
MOD = 10**9 + 7
for g0, p0 in zip(group, profit):
for g in range(G, g0 - 1, -1):
for p in range(P... | jiadaizhao/LeetCode | 0801-0900/0879-Profitable Schemes/0879-Profitable Schemes.py | Python | mit | 442 |
from tornado import ioloop, httpclient as hc, gen, log, escape
import time
from . import _compat as _
from .graphite import GraphiteRecord
from .utils import convert_to_format, parse_interval, parse_rule, HISTORICAL, HISTORICAL_TOD, interval_to_graphite
import math
import psycopg2
from collections import deque, defaul... | ViaSat/graphite-beacon | graphite_beacon/alerts.py | Python | mit | 12,919 |
#!/bin/python
# gofed-ng - Golang system
# Copyright (C) 2016 Fridolin Pokorny, fpokorny@redhat.com
#
# 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 y... | gofed/gofed-ng | testsuite/helpers/utils.py | Python | gpl-3.0 | 1,073 |
#!/usr/bin/env python
# Copyright (C) 2015 Tadej Stajner <tadej@tdj.si>
# License: 3-clause BSD
from setuptools import setup
setup(name='autokit',
version='0.1',
description='autokit - machine learning for busy people',
author='Tadej Stajner',
author_email='tadej@tdj.si',
url='https://gi... | aruneral01/autokit | setup.py | Python | mit | 1,216 |
"""Get details for a virtual server."""
# :license: MIT, see LICENSE for more details.
import click
import SoftLayer
from SoftLayer.CLI import environment
from SoftLayer.CLI import formatting
from SoftLayer.CLI import helpers
from SoftLayer import utils
@click.command()
@click.argument('identifier')
@click.option('... | underscorephil/softlayer-python | SoftLayer/CLI/virt/detail.py | Python | mit | 4,441 |
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import product_template
from . import product_variant
| OCA/product-variant | product_variant_inactive/models/__init__.py | Python | agpl-3.0 | 131 |
# Copyright 2014-2019 The ODL contributors
#
# This file is part of ODL.
#
# 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 https://mozilla.org/MPL/2.0/.
"""Testing utilities."""
from __future__ im... | kohr-h/odl | odl/util/testutils.py | Python | mpl-2.0 | 21,151 |
# -*- coding: utf-8 -*-
# Copyright (C) 2014 Daniele Simonetti
#
# 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.
#
# Thi... | OpenNingia/l5r-character-manager | l5rcm/models/advancements/__init__.py | Python | gpl-3.0 | 749 |
# -*- coding: utf-8 -*-
#
# data documentation build configuration file, created by
# sphinx-quickstart on Fri Apr 24 11:56:24 2015.
#
# 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 co... | mbr/data | docs/conf.py | Python | mit | 7,972 |
# -*- coding: utf8 -*-
import mechanize
import datetime
from bs4 import BeautifulSoup
import urllib2
import cookielib
import re
import sqlite3
from dateutil.parser import parse
conn=sqlite3.connect('/home/top10.db')
conn.text_factory = lambda x: unicode(x, 'utf-8', 'ignore')
item = [[u'']*3 for x in xrange(50)]
index=... | okwow123/freebaram | crawler/mech.py | Python | mit | 3,121 |
# Addons: "HitLog"
# ktulho <https://kr.cm/f/p/17624/>
import BigWorld
import ResMgr
import nations
from Avatar import PlayerAvatar
from DestructibleEntity import DestructibleEntity
from Vehicle import Vehicle
from VehicleEffects import DamageFromShotDecoder
from constants import ATTACK_REASON
from constants import IT... | KnechtRootrechtCH/Mimir | content/Mods/XVM/XVM_Base/res_mods_content/configs/xvm/py_macro/xvm/hitLog.py | Python | mit | 39,872 |
import os, re, shutil
internalIp = os.environ['OPENSHIFT_DIY_IP']
runtimeDir = os.environ['OPENSHIFT_HOMEDIR'] + "/app-root/runtime"
repoDir = os.environ['OPENSHIFT_HOMEDIR'] + "/app-root/runtime/repo"
f = open(repoDir + '/misc/templates/httpd.conf.tpl', 'r')
conf = f.read().replace('{{OPENSHIFT_INTERNAL_IP}}', inter... | dottobr83/openshift-php | misc/parse_templates.py | Python | mit | 818 |
# -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import
import llvm
from numba import *
from numba import nodes
from numba.typesystem import is_obj, promote_to_native
from numba.codegen.codeutils import llvm_alloca, if_badval
from numba.codegen import debug
class ObjectCoercer(object... | shiquanwang/numba | numba/codegen/coerce.py | Python | bsd-2-clause | 8,887 |
# Generated by Django 2.2.19 on 2021-03-05 11:09
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('tickets', '0003_auto_20180313_0138'),
]
operations = [
migrations.AlterFi... | Inboxen/Inboxen | inboxen/tickets/migrations/0004_auto_20210305_1109.py | Python | agpl-3.0 | 754 |
#!/usr/bin/env python2
# MIT License
#
# Copyright (c) 2016 Zhiang Chen
'''
Receive the depth image from "depth_image", and crop the image by a 34x34 window.
Then publish the cropped image to "cropped_depth_image" with 10hz.
'''
from __future__ import print_function
import rospy
import roslib
import cv2
from sensor_... | ZhiangChen/deep_learning | auto_recognition/src/depth2input.py | Python | mit | 1,315 |
# -*- coding: utf-8 -*-
"""
Copyright (C) 2010 Dariusz Suchojad <dsuch at gefira.pl>
Licensed under LGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
# stdlib
import logging, time
from hashlib import sha1
from string import Templ... | dsuch/sec-wall | code/src/secwall/wsse.py | Python | gpl-3.0 | 8,308 |
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
def norm_col_init(weights, std=1.0):
x = torch.randn(weights.size())
x *= std / torch.sqrt((x**2).sum(1, keepdim=True))
return x
def weights_init(m):
classname = m.__class__.__name__
if classname.find('Conv') !=... | Nasdin/ReinforcementLearning-AtariGame | A3CModel.py | Python | bsd-3-clause | 2,624 |
import os
from optparse import make_option
from django.core.management.base import BaseCommand
from django.conf import settings
import sys
class Command(BaseCommand):
help = "Clear supervisor confs for the given environment"
args = ""
option_list = BaseCommand.option_list + (
make_option('--conf... | puttarajubr/commcare-hq | corehq/apps/hqadmin/management/commands/clear_supervisor_confs.py | Python | bsd-3-clause | 995 |
from __future__ import absolute_import
from django import forms
from django.contrib import messages
from django.http import HttpResponseRedirect
from django.shortcuts import get_object_or_404
from django.utils.translation import ugettext_lazy as _
from sentry.models import ApiKey, AuditLogEntryEvent
from sentry.web.f... | jean/sentry | src/sentry/web/frontend/organization_api_key_settings.py | Python | bsd-3-clause | 1,865 |
import OOMP
newPart = OOMP.oompItem(9118)
newPart.addTag("oompType", "LEDS")
newPart.addTag("oompSize", "05")
newPart.addTag("oompColor", "I9")
newPart.addTag("oompDesc", "STAN")
newPart.addTag("oompIndex", "01")
OOMP.parts.append(newPart)
| oomlout/oomlout-OOMP | old/OOMPpart_LEDS_05_I9_STAN_01.py | Python | cc0-1.0 | 242 |
from common import * #@UnusedWildImport
from gridRole import GridRole
properties = ArrayList()
class Rocket(GridRole) :
def onHalfInvaded(self, invader) :
self.deathEvent( "launch" )
invader.deathEvent( "launch" )
ExplosionBuilder(self.actor) \
.dependent().forever().f... | nickthecoder/itchy | resources/Cavern-Quest/scripts/rocket.py | Python | gpl-3.0 | 755 |
"""The Session is a wrapper around a Shotgun instance, proxying requests to
the server and applying additional logic on top of it. The Session instance is
designed to be used for a single task and then discarded, since it makes the
assumption that entity relationships do not change.
While not fully documented below, t... | westernx/sgsession | sgsession/session.py | Python | bsd-3-clause | 33,714 |
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from __future__ import absolute_import
import re
import six
from six.moves import map # pylint: disable=redefined-builtin
from telemetry.timeline import chr... | catapult-project/catapult | telemetry/telemetry/timeline/chrome_trace_config.py | Python | bsd-3-clause | 6,778 |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2014-2020 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 S... | The-Compiler/qutebrowser | qutebrowser/__init__.py | Python | gpl-3.0 | 1,276 |
import numpy
#from MyLimiar import Limiar
#from MatrizA import MatrizA
class Limiarizador(object):
def __init__(self):
pass
def execute(self, matriz, limiar):
#verificar tipos
m = matriz.getM()
n = matriz.getTam()
l = numpy.zeros((n,n))
lim = limiar.next() ... | Evnsan/sage_proj | modulo/Limiarizador.py | Python | gpl-2.0 | 519 |
import glob
def comports():
"""scan for available ports. return a list of device names."""
devices = glob.glob('/dev/tty.*')
return [(d, d, d) for d in devices]
| IECS/MansOS | tools/lib/motelist_src/get_ports_mac.py | Python | mit | 180 |
import numpy as np
import os
def replace_value(line,pos,val):
old_val = line.split()[pos]
index_start = line.find(old_val)
index_end = index_start + len(old_val)
len_diff = len(old_val) - len(val)
return line[:index_start] + val + ' '*len_diff + line[index_end:]
def generate_input_file(settin... | DavidAce/DMRG | batch_scripts/generate_inputs/src/generate_inputs.py | Python | mit | 677 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
# STDLIB
import inspect
import random
# THIRD PARTY
import pytest
import numpy as np
# LOCAL
import astropy.units as u
from astropy import cosmology
from astropy.cosmology import Cosmology, Planck18, realizations
from astropy.cosmology.core import _COS... | saimn/astropy | astropy/cosmology/io/tests/test_model.py | Python | bsd-3-clause | 6,402 |
#!/usr/bin/python3 -O
# vim: fileencoding=utf-8
import os
import setuptools
import setuptools.command.install
# don't import: import * is unreliable and there is no need, since this is
# compile time and we have source files
def get_console_scripts():
for filename in os.listdir('./qubes/tools'):
basenam... | QubesOS/qubes-core-admin | setup.py | Python | lgpl-2.1 | 3,863 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, unicode_literals
from logging import getLogger
import Queue
import time
import os
import hashlib
from ..watchdog import events
from ..watchdog.observers import Observer
from ..watchdog.utils.bricks import OrderedSetQueue
f... | tomkat83/PlexKodiConnect | resources/lib/playlists/common.py | Python | gpl-2.0 | 7,211 |
#
# Copyright (c) 2008--2015 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You should have received a c... | xkollar/spacewalk | backend/server/rhnServer/search_notify.py | Python | gpl-2.0 | 1,394 |
#
# 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... | spektom/incubator-airflow | airflow/migrations/versions/8504051e801b_xcom_dag_task_indices.py | Python | apache-2.0 | 1,297 |
# -*- coding: utf-8 -*-
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from __future__ import absolute_import
import flask_talisman
import flask_talisman.talisman
#... | garbas/mozilla-releng-services | lib/backend_common/backend_common/security.py | Python | mpl-2.0 | 1,361 |
from collections import Counter
def checkio(text):
text = text.lower()
n_text = ""
return_word = []
if not text.isalpha():
for digit in text:
if digit.isalpha():
n_text = n_text + digit
c = [c * 1 for c in n_text]
d_count = Counter(c)
text = s... | Dani4kor/Checkio | most-wanted-letter.py | Python | mit | 1,248 |
# -*- coding: utf-8 -*-
# Maestro Music Manager - https://github.com/maestromusic/maestro
# Copyright (C) 2009-2015 Martin Altmayer, Michael Helmling
#
# 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 Foun... | maestromusic/maestro | maestro/core/nodes.py | Python | gpl-3.0 | 21,992 |
from .test_cache import *
from .test_rest import *
from .test_templatetags import *
from .test_admin import *
from .test_settings import *
| joar/djedi-cms | djedi/tests/__init__.py | Python | bsd-3-clause | 139 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import admin
from models import Project, TestSet, TestCase, TestStep, TestSetRun, TestCaseRun
admin.site.register(Project)
admin.site.register(TestSet)
admin.site.register(TestCase)
admin.site.register(TestStep)
admin.site.register(Te... | Shibashisdas/testmanager-backend | api/admin.py | Python | mit | 363 |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.thread_list, name='thread-list'),
url(r'^add/$', views.thread_create, name='thread-create'),
url(r'^(?P<thread_pk>\d+)/$', views.thread_detail, name='thread-detail'),
url(r'^(?P<path_tags>[\w/]+)/$', views.thread_lis... | funkybob/django-dequorum | dequorum/urls.py | Python | mit | 346 |
"""
Copyright (c) 2012-2013 RockStor, Inc. <http://rockstor.com>
This file is part of RockStor.
RockStor 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 la... | kamal-gade/rockstor-core | src/rockstor/smart_manager/views/task_log.py | Python | gpl-3.0 | 1,865 |
from __future__ import absolute_import, unicode_literals
import functools
import logging
import os
import socket
import tornado.escape
import tornado.ioloop
import tornado.web
import tornado.websocket
import mopidy
from mopidy import core, models
from mopidy.internal import encoding, jsonrpc
logger = logging.getLo... | dbrgn/mopidy | mopidy/http/handlers.py | Python | apache-2.0 | 7,230 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.10 on 2016-10-26 20:07
from __future__ import unicode_literals
import os
import six
from django.conf import settings
from django.db import migrations
STACKS_DIRECTORY = os.path.join(settings.FILE_STORAGE_DIRECTORY, 'stacks')
def slug_to_id(apps, schema_migration):... | clarkperkins/stackdio | stackdio/api/stacks/migrations/0008_0_8_0_migrations.py | Python | apache-2.0 | 1,417 |
#!/usr/bin/env python
#
# Script to simulate colonial expansion of the galaxy
import sys
import getopt
import time
import pygame
from collections import defaultdict
from coloniser import Coloniser
from liner import Liner
from galaxy import Galaxy
from config import galaxywidth, galaxyheight, screensize, maxships
impo... | dwagon/Exodus | exodus.py | Python | gpl-3.0 | 7,490 |
from typing import Dict, Optional
from great_expectations.core.expectation_configuration import ExpectationConfiguration
from great_expectations.execution_engine import ExecutionEngine
from great_expectations.expectations.expectation import (
InvalidExpectationConfigurationError,
TableExpectation,
)
from great... | great-expectations/great_expectations | great_expectations/expectations/core/expect_table_column_count_to_equal.py | Python | apache-2.0 | 6,651 |
import argparse
from util import operations
from os import path
import h5py, re
def get_arguments():
parser = argparse.ArgumentParser(description='Prepare data for training')
parser.add_argument('data', type=str, help='Path to a HDF5 file containing \'smiles\', \'classes\' and \'partition\'')
parser.add_a... | patrick-winter-knime/deep-learning-on-molecules | lsfp/prepare_multiple_data.py | Python | gpl-3.0 | 1,134 |
"""Higher level child and data watching API's.
:Maintainer: Ben Bangert <ben@groovie.org>
:Status: Production
.. note::
:ref:`DataWatch` and :ref:`ChildrenWatch` may only handle a single
function, attempts to associate a single instance with multiple functions
will result in an exception being thrown.
"... | bsanders/kazoo | kazoo/recipe/watchers.py | Python | apache-2.0 | 14,705 |
from robotpy_ext.common_drivers.navx._impl import AHRSProtocol
def test_decoding():
data = [0]*4
AHRSProtocol.encodeBinaryUint16(42, data, 0)
assert AHRSProtocol.decodeBinaryUint16(data, 0) == 42
AHRSProtocol.encodeBinaryUint16(40000, data, 0)
assert AHRSProtocol.decodeBinaryUint16(... | Twinters007/robotpy-wpilib-utilities | tests/test_navx.py | Python | bsd-3-clause | 719 |
# 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/v2016_09_01/operations/_virtual_network_peerings_operations.py | Python | mit | 22,805 |
#!/usr/bin/env python
'''
Run this script to update all the copyright headers of files
that were changed this year.
For example:
// Copyright (c) 2009-2012 The Presidentielcoin Core developers
it will change it to
// Copyright (c) 2009-2015 The Presidentielcoin Core developers
'''
import os
import time
import re
y... | presidentielcoin/presidentielcoin | contrib/devtools/fix-copyright-headers.py | Python | mit | 1,400 |
# -*- coding: iso-8859-1 -*-
#
# Bicycle Repair Man - the Python Refactoring Browser
# Copyright (C) 2001-2006 Phil Dawes <phil@phildawes.net>
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
# A some of this code is ... | lebauce/artub | bike/parsing/pathutils.py | Python | gpl-2.0 | 5,507 |
#
# Copyright 2002-2008 Zuza Software Foundation
#
# This file is part of translate.
#
# translate 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 lat... | nijel/translate | translate/storage/oo.py | Python | gpl-2.0 | 15,689 |
from rest_framework.permissions import BasePermission
from kolibri.core.auth.permissions.general import _user_is_admin_for_own_facility
class NetworkLocationPermissions(BasePermission):
"""
A user can access NetworkLocation objects if:
1. User can manage content (to get import/export peers)
2. User i... | indirectlylit/kolibri | kolibri/core/discovery/permissions.py | Python | mit | 811 |
# Copyright (c) 2013 OpenStack Foundation.
#
# 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... | subramani95/neutron | neutron/api/rpc/agentnotifiers/dhcp_rpc_agent_api.py | Python | apache-2.0 | 7,721 |
# EXAMPLE 1: Polymorphism in Python with a function:
# ==============================================================================
# We create two classes: Bear and Dog, both can make a distinct sound.
# We then make two instances and call their action using the same method.
class Bear(object):
def sound(self... | rolandovillca/python_introduction_basic | oo/polymorphism.py | Python | mit | 2,016 |
from requests_lib import enable_requests
| dieseldev/diesel | diesel/util/patches/__init__.py | Python | bsd-3-clause | 41 |
# This file is part of Invenio.
# Copyright (C) 2008, 2009, 2010, 2011, 2012 CERN.
#
# Invenio 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 v... | Lilykos/invenio | invenio/legacy/webjournal/web/admin/webjournaladmin.py | Python | gpl-2.0 | 16,753 |
import unittest
import transaction
from pyramid import testing
from .models import DBSession
class TestMyViewSuccessCondition(unittest.TestCase):
def setUp(self):
self.config = testing.setUp()
from sqlalchemy import create_engine
engine = create_engine('sqlite://')
from .models i... | kiritantan/ShishoSan | shishosan/tests.py | Python | mit | 1,500 |
import time
time=time.strftime('%Y-%m-%d %H:%M:%S')
print(type(time))
| xiaoyongaa/ALL | python基础2周/1.py | Python | apache-2.0 | 70 |
# -*- coding: utf-8 -*-
#
from .common import *
class StopTest(TestCase):
def test_block(self):
root = Node.add_root()
node1 = root.add_child(content_object=StopInterpretation())
node2 = variable_assign_value(parent=root)
root = Node.objects.get(id=root.id)
context = Cont... | vlfedotov/django-business-logic | tests/test_stop.py | Python | mit | 965 |
# coding: utf-8
from os.path import join
from re import match
from os.path import dirname, exists, join
from datetime import datetime
import functools
from collections import namedtuple
import re
class ChangeLogException(Exception):
pass
class OnlyLocalException(Exception):
pass
def real_repo_only(method):... | sniegu/django-surround | surround/common/git_info.py | Python | mit | 6,513 |
import statsmodels.api as sm
from matplotlib import pyplot as plt
data = sm.datasets.longley.load()
data.exog = sm.add_constant(data.exog)
mod_fit = sm.OLS(data.endog, data.exog).fit()
res = mod_fit.resid # residuals
fig = sm.qqplot(res)
plt.show()
#qqplot of the residuals against quantiles of t-distribution with 4 de... | UpSea/midProjects | BasicOperations/08_Statsmodels/01_Statsmodels_01_OLS03.py | Python | mit | 706 |
import hashlib
from django.conf import settings
from django.utils import importlib
from django.utils.datastructures import SortedDict
from django.utils.encoding import smart_str
from django.core.exceptions import ImproperlyConfigured
from django.utils.crypto import (
pbkdf2, constant_time_compare, get_random_strin... | ychen820/microblog | y/google-cloud-sdk/platform/google_appengine/lib/django-1.4/django/contrib/auth/hashers.py | Python | bsd-3-clause | 14,277 |
# -*- coding: utf-8 -*-
# Third Party Stuff
from django.db.models import signals
def signals_switch():
pre_save = signals.pre_save.receivers
post_save = signals.post_save.receivers
def disconnect():
signals.pre_save.receivers = []
signals.post_save.receivers = []
def reconnect():
... | DESHRAJ/wye | tests/utils.py | Python | mit | 504 |
#!/usr/bin/python
# Watermark each page in a PDF document
import sys #, os
import getopt
import math
from Quartz.CoreGraphics import *
from Quartz.ImageIO import *
def drawWatermark(ctx, image, xOffset, yOffset, angle, scale, opacity):
if image:
imageWidth = CGImageGetWidth(image)
imageHeight = CG... | jamescooper/automater | src/tool.py | Python | apache-2.0 | 5,070 |
from config.api2_0_config import *
from on_http_api2_0 import ApiApi as WorkflowApi
from on_http_api2_0 import rest
from modules.logger import Log
from datetime import datetime
from proboscis.asserts import *
from proboscis import SkipTest
from proboscis import test
from json import dumps, loads
import json
LOG = Log... | DavidjohnBlodgett/RackHD | test/tests/api/v2_0/workflowTasks_tests.py | Python | apache-2.0 | 3,496 |
import unittest
from testlib import testutil, PygrTestProgram
from pygr import sequence
class Sequence_Test(unittest.TestCase):
'basic sequence class tests'
def setUp(self):
self.seq = sequence.Sequence('atttgactatgctccag', 'foo')
def test_length(self):
"Sequence lenght"
assert l... | cjlee112/pygr | tests/sequence_test.py | Python | bsd-3-clause | 5,048 |
from django.db import models
from geodata.models import Country, City, Region
class IndicatorTopic(models.Model):
id = models.AutoField(primary_key=True)
name = models.CharField(max_length=255)
source_note = models.TextField(null=True)
class LendingType(models.Model):
id = models.CharField(max_length=... | schlos/OIPA-V2.1 | OIPA/indicator/models.py | Python | agpl-3.0 | 1,876 |
"""Config flow for Kodi integration."""
import logging
from pykodi import CannotConnectError, InvalidAuthError, Kodi, get_kodi_connection
import voluptuous as vol
from homeassistant import config_entries, core, exceptions
from homeassistant.const import (
CONF_HOST,
CONF_NAME,
CONF_PASSWORD,
CONF_PORT... | tboyce021/home-assistant | homeassistant/components/kodi/config_flow.py | Python | apache-2.0 | 10,723 |
"""Grep dialog for Find in Files functionality.
Inherits from SearchDialogBase for GUI and uses searchengine
to prepare search pattern.
"""
import fnmatch
import os
import sys
from tkinter import StringVar, BooleanVar
from tkinter.ttk import Checkbutton
from idlelib.searchbase import SearchDialogBase
from idle... | Microsoft/PTVS | Python/Product/Miniconda/Miniconda3-x64/Lib/idlelib/grep.py | Python | apache-2.0 | 6,741 |
# -*- coding: utf-8 -*-
# © 2015-2016 Antiun Ingeniería S.L. - Pedro M. Baeza
# © 2015 AvanzOSC - Ainara Galdona
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from openerp import models, fields, api, exceptions, _
PRORRATE_TAX_LINE_MAPPING = {
29: 28,
33: 32,
35: 34,
37: 36,
39:... | RamonGuiuGou/l10n-spain | l10n_es_aeat_vat_prorrate/models/mod303.py | Python | agpl-3.0 | 8,146 |
# 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.
# --------------------------------------------------------------------... | Azure/azure-sdk-for-python | sdk/storage/azure-storage-blob/tests/test_cpk_n_async.py | Python | mit | 51,849 |
"""
Platform for the Daikin AC.
For more details about this component, please refer to the documentation
https://home-assistant.io/components/daikin/
"""
import logging
from datetime import timedelta
from socket import timeout
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeass... | persandstrom/home-assistant | homeassistant/components/daikin.py | Python | apache-2.0 | 3,885 |
from __future__ import absolute_import, print_function, division
import operator
from petl.compat import OrderedDict
from petl.util import RowContainer, hybridrows, expr, rowgroupby
from petl.transform.sorts import sort
def fieldmap(table, mappings=None, failonerror=False, errorvalue=None):
"""
Transform ... | rs/petl | src/petl/transform/maps.py | Python | mit | 16,043 |
#!/bin/false
# This file is part of Espruino, a JavaScript interpreter for Microcontrollers
#
# Copyright (C) 2013 Gordon Williams <gw@pur3.co.uk>
#
# 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 h... | AlexanderBrevig/Espruino | boards/DPTBOARD.py | Python | mpl-2.0 | 1,205 |
import os
import shutil
from django.contrib.sites.models import Site
from django.conf import settings
from .models import SiteResources, SitePeople
def resources_for_site():
return SiteResources.objects.get(site=Site.objects.get_current()).resources.all()
def users_for_site():
return SitePeople.objects.get(... | davekennewell/geonode | geonode/contrib/geosites/utils.py | Python | gpl-3.0 | 2,308 |
from __future__ import print_function
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class ScopedEnumType(TestBase):
mydir = TestBase.compute_mydir(__file__)
@skipIf(dwarf_version=['<', '4'])
def test(self):
self.bu... | llvm-mirror/lldb | packages/Python/lldbsuite/test/commands/expression/scoped_enums/TestScopedEnumType.py | Python | apache-2.0 | 1,570 |
from twisted.trial import unittest
from twisted.python.failure import Failure
from deluge.httpdownloader import download_file
from deluge.log import setupLogger
from email.utils import formatdate
class DownloadFileTestCase(unittest.TestCase):
def setUp(self):
setupLogger("warning", "log_file")
def t... | laanwj/deluge | tests/test_httpdownloader.py | Python | gpl-3.0 | 4,280 |
#
# This file is part of opsd.
#
# opsd 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.
#
# opsd is distributed in the hope that it wil... | warwick-one-metre/opsd | warwick/observatory/operations/dome/astrohaven/__init__.py | Python | gpl-3.0 | 4,416 |
"""
the functions
get_record_csv
get_court_id
are intended to be the closest interface points with the front end.
each has comments on its function prior to its definition and a series of demonstrative example calls afterwards
get_records_csv will require some changes to work with a db - it has been written to... | xHeliotrope/injustice_dropper | pull_from_dataset.py | Python | mit | 8,630 |
#!/usr/bin/env python
# Encoding: UTF-8
"""Part of qdex: a Pokédex using PySide and veekun's pokedex library.
Tools handling custom YAML tags
"""
# Not to be confused with the PyYaml library
from __future__ import absolute_import
import yaml
from forrin.translator import TranslatableString
translatableStringTag = ... | encukou/qdex | qdex/yaml.py | Python | mit | 3,188 |
"""Support for LCN devices."""
import asyncio
import logging
import pypck
from homeassistant import config_entries
from homeassistant.const import (
CONF_IP_ADDRESS,
CONF_NAME,
CONF_PASSWORD,
CONF_PORT,
CONF_RESOURCE,
CONF_USERNAME,
)
from homeassistant.helpers import entity_registry as er
fro... | w1ll1am23/home-assistant | homeassistant/components/lcn/__init__.py | Python | apache-2.0 | 6,029 |
#!/usr/bin/python
#
# Copyright (C) 2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | franckverrot/live-note | waveapi/element.py | Python | gpl-3.0 | 8,441 |
# -*- coding: utf-8 -*-
###############################################################################
#
# ListSigningCertificates
# Returns information about the signing certificates associated with the specified user. If there are none, the action returns an empty list.
#
# Python versions 2.6, 2.7, 3.x
#
# Copyrig... | jordanemedlock/psychtruths | temboo/core/Library/Amazon/IAM/ListSigningCertificates.py | Python | apache-2.0 | 4,648 |
# -*- coding: utf8 -*-
'''
Copyright 2009 Denis Derman <denis.spir@gmail.com> (former developer)
Copyright 2011-2012 Peter Potrowl <peter017@gmail.com> (current developer)
This file is part of Pijnu.
Pijnu is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public Lic... | peter17/pijnu | samples/SebastienFunction.py | Python | gpl-3.0 | 5,130 |
"""Diffusion across rows"""
from __future__ import print_function
from math import sqrt
from ase import Atoms, Atom
from ase.io import write
from ase.visualize import view
from ase.constraints import FixAtoms
from ase.optimize import QuasiNewton
from ase.optimize import MDMin
from ase.neb import NEB
from ase.calculat... | misdoro/python-ase | doc/tutorials/selfdiffusion/neb2.py | Python | gpl-2.0 | 1,640 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-08-11 12:47
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='GeneDet... | 444thLiao/VarappX | varapp/migrations/0001_initial.py | Python | gpl-3.0 | 10,400 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.