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 -*-
'''
Use the "reclass" database as a Pillar source
.. |reclass| replace:: **reclass**
This ``ext_pillar`` plugin provides access to the |reclass| database, such
that Pillar data for a specific minion are fetched using |reclass|.
You can find more information about |reclass| at
http://reclass.p... | MadeiraCloud/salt | sources/salt/pillar/reclass_adapter.py | Python | apache-2.0 | 4,015 |
#!/usr/bin/python
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
### BEGIN LICENSE
# Copyright (C) 2013 <Kyle Francis> <guitarman_usa@yahoo.com>
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as publis... | guitarmanusa/metau | tests/test_example.py | Python | gpl-3.0 | 1,452 |
"""
Validate spreadsheet data is same as db data
"""
from __future__ import division
from __future__ import print_function
# import datetime
# import re
# import textwrap
# import numpy as np
# import pandas as pd
# import webbrowser
# import bs4
# import requests
# import email
# import smtplib
# from email.mime.... | proetman/checkit | dept_transport/validate_dept_transport.py | Python | gpl-2.0 | 7,554 |
import argparse
import os
import sys
from signal import signal, SIGPIPE, SIG_DFL
from Bio import SeqIO
import Bio.motifs as motifs
sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
import lib
class SeqSearchResults(object):
def __init__(self, seq_name, sequence, tf_names, tf_lengths):
self.... | SvichkarevAnatoly/Bioinformatics-DNA-Motifs-Search | src/utils/pattern_matching.py | Python | gpl-2.0 | 7,102 |
from __future__ import absolute_import, unicode_literals
from .base.SetupLcioDictionary import setupLcioDictionary
setupLcioDictionary()
import inspect, sys, ROOT, pyLCIO
namespaces = ["EVENT", "IMPL", "IO", "IOIMPL", "UTIL"]
for namespace in namespaces:
module = getattr( ROOT, namespace )
setattr(pyLCIO, nam... | petricm/LCIO | src/python/pyLCIO/__init__.py | Python | bsd-3-clause | 549 |
#!/usr/bin/python2.7
#coding:utf-8
import sys
import thread
import time
def timer(threadname):
saveout = sys.stdout
fsock = open(threadname,'w')
sys.stdout = fsock
for i in xrange(1,10):
print '-'
time.sleep(2)
sys.stdout = saveout
fsock.close()
def test(): #Use thread.start_n... | xujun10110/Hammer | temp/mutlistdouttest.py | Python | gpl-2.0 | 495 |
from django.core.management.base import BaseCommand, CommandError
from canvas.models import User, Count, Visibility, redis
class Command(BaseCommand):
args = ''
help = "Run our nightly cron tasks"
def handle(self, *args, **options):
self.annotate_accurate_flaggers()
def annotate_acc... | drawquest/drawquest-web | website/canvas/management/commands/cron_nightly.py | Python | bsd-3-clause | 1,277 |
# coding: utf-8
#
# Copyright 2014 The Oppia 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 requi... | AllanYangZhou/oppia | core/platform/email/gae_email_services.py | Python | apache-2.0 | 4,444 |
# coding: utf-8
"""
Swaggy Jenkins
Jenkins API clients generated from Swagger / Open API specification # noqa: E501
The version of the OpenAPI document: 1.1.2-pre.0
Contact: blah@cliffano.com
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
import sys # noqa: F401
impor... | cliffano/swaggy-jenkins | clients/python-experimental/generated/openapi_client/model/pipeline_impl.py | Python | mit | 3,057 |
# Copyright (c) 2017 Huawei, 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 a... | Hybrid-Cloud/conveyor-dashboard | conveyordashboard/common/constants.py | Python | apache-2.0 | 5,207 |
import logging
logger = logging.getLogger(__name__)
import os
import cPickle
import numpy as np
import theano
floatX = theano.config.floatX
from mozi.utils.utils import get_file, make_one_hot
from mozi.datasets.dataset import SingleBlock
class Cifar10(SingleBlock):
def __init__(self, flatten=False, **kwargs):
... | dksahuji/Mozi | mozi/datasets/cifar10.py | Python | mit | 1,575 |
import tkinter
import tkinter.ttk
from listparse.ui.common import mk_treeview, PageView
class IndexatorView(PageView):
listboxes = {}
buttons = {}
treeviews = {}
textlabels = {}
def __init__(self, root=None, main_frame=None):
super().__init__(root, main_frame)
def params(self):
... | sora7/listparse | src/listparse/ui/indexator/view.py | Python | gpl-2.0 | 3,612 |
#!/usr/bin/env python3
# Copyright (c) 2019-2020 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the generation of UTXO snapshots using `dumptxoutset`.
"""
from test_framework.test_framework impo... | Sjors/bitcoin | test/functional/rpc_dumptxoutset.py | Python | mit | 1,928 |
from django.db import models
from core.models import TimeStampedModel
from django.contrib.auth.models import User
from django.db.models.signals import post_save
from django.dispatch import receiver
class Organization(TimeStampedModel):
name = models.CharField(max_length=150)
description = models.CharField(max... | luisen14/treatment-tracking-project | treatment_tracker/researchers/models.py | Python | apache-2.0 | 1,267 |
import numpy as np
from scipy import fftpack
class Fft:
def __init__(self, x, *, sample_rate=None, padded=False):
if sample_rate is None:
raise ValueError('You must determine the sample rate')
fs = sample_rate
if padded:
padding_to = int(2**np.ceil(np.log2(len(x))... | viniciusd/DCO1008---Digital-Signal-Processing | projeto2/common.py | Python | mit | 596 |
from __future__ import unicode_literals
import json
from mock import patch
from tests import TestCase, with_settings
from nose.tools import eq_
class TestIndex(TestCase):
@with_settings(aws={'bucket': 'cattysnap'})
@patch('catsnap.web.controllers.find.Tag')
def test_find_a_tag(self, Tag):
Tag.get_... | ErinCall/catsnap | tests/web/test_find.py | Python | mit | 1,866 |
"""All methods needed to bootstrap a Home Assistant instance."""
import asyncio
import logging.handlers
from timeit import default_timer as timer
from types import ModuleType
from typing import Awaitable, Callable, Optional, Dict, List
from homeassistant import requirements, core, loader, config as conf_util
from hom... | MartinHjelmare/home-assistant | homeassistant/setup.py | Python | apache-2.0 | 10,473 |
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# d$
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of... | avanzosc/avanzosc6.1 | tree_grid/sale.py | Python | agpl-3.0 | 7,200 |
from flask import abort, Blueprint, flash, redirect, render_template, url_for
from flask.ext.login import current_user, login_required
from j4oauth.app import app, db
from j4oauth.forms import ClientForm
from j4oauth.models import Client, Token
account = Blueprint('account', __name__, template_folder='templates/accoun... | J4LP/J4OAuth | j4oauth/account.py | Python | mit | 6,105 |
from PyQt4 import QtGui
from PyQt4.QtCore import pyqtSlot, pyqtSignal, Qt
import sys
import numpy
from random import random
mplPlotWindow = None
qwtPlotWindow = None
pqgPlotWindow = None
PlotWindow = None
def use_qwt_backend():
global PlotWindow, qwtPlotWindow
if qwtPlotWindow is None:
qwtPlotWindow ... | ZhuangER/robot_path_planning | gui/qt_plotwindow.py | Python | mit | 2,076 |
#!/usr/bin/python
from distutils.core import setup
from os import getcwd, listdir, name
from os.path import join
from glob import glob
import re
from struct import pack, unpack
from tempfile import gettempdir
import time
import numpy # pull in dependencies
import platform
win64 = (platform.architecture()[0]=='64bit')... | Marginal/OverlayEditor | win32/setup.py | Python | gpl-2.0 | 13,143 |
#
# Copyright (c) 2010--2013 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... | moio/spacewalk | backend/server/importlib/debPackage.py | Python | gpl-2.0 | 5,827 |
import json
import os
import unittest
from app import app, db
from app.model.document import Document
from app.model.tag import Tag
from app import lib
#-----------------------------------------------------------------------------#
class BaseTestCase(unittest.TestCase):
def setUp(self):
app.config['TESTI... | andytom/searchr-server | app/tests/lib.py | Python | bsd-3-clause | 3,500 |
import re
import os
import sys
import time
import datetime
import traceback
from decimal import Decimal
import threading
import asyncio
from electrum.bitcoin import TYPE_ADDRESS
from electrum.storage import WalletStorage
from electrum.wallet import Wallet, InternalAddressCorruption
from electrum.paymentrequest import ... | fujicoin/electrum-fjc | electrum/gui/kivy/main_window.py | Python | mit | 44,226 |
import warnings
import numpy as np
from numpy.testing import (
run_module_suite, TestCase, assert_, assert_equal,
assert_array_equal, assert_almost_equal, assert_array_almost_equal,
assert_raises, assert_allclose, assert_array_max_ulp
)
from numpy.random import rand
from numpy.lib import... | dwf/numpy | numpy/lib/tests/test_function_base.py | Python | bsd-3-clause | 51,379 |
import demistomock as demisto
import pytest
import ShowCampaignLastIncidentOccurred
INCIDENT_IDS = [{"id": '1'}, {"id": '2'}, {"id": '3'}]
MULTIPLE_INCIDENT_CREATED = [
{
'Contents': '[{"created": "2021-07-27T15:09:35.269187268Z"}, {"created": "2021-07-28T15:06:33.100736309Z"}, \
{"... | VirusTotal/content | Packs/Campaign/Scripts/ShowCampaignLastIncidentOccurred/ShowCampaignLastIncidentOccurred_test.py | Python | mit | 1,691 |
# Copyright 2014 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 to in... | bswartz/cinder | cinder/volume/flows/manager/manage_existing.py | Python | apache-2.0 | 5,157 |
# coding: utf-8
from .db import db
class Noticia(db.Document):
titulo = db.StringField(required=True)
texto = db.StringField(required=True)
imagem = db.StringField()
| fabiomac/apps | wtf/wtf/models.py | Python | mit | 180 |
# -*- coding: utf-8 -*-
"""Functions for manipulating external links or querying third-party sites."""
#
# (C) Pywikibot team, 2013
#
# Distributed under the terms of the MIT license.
#
from __future__ import unicode_literals
__version__ = '$Id: 50ff23e73dd76adfd2f37025f676849df67243a0 $'
import sys
if sys.version_i... | hperala/kontuwikibot | pywikibot/weblib.py | Python | mit | 2,055 |
import copy
import datetime
from tornado.escape import xhtml_escape
class EscapedDict:
"""A wrapper for a dict that HTML-escapes values as you ask for them"""
def __init__(self, doc):
self.doc = doc
def __getitem__(self, key):
item = self.doc[key]
if isinstance(item, str):
... | asottile/pushmanager | pushmanager/core/util.py | Python | apache-2.0 | 5,859 |
from struct import unpack, calcsize, Struct
from StataTypes import MissingValue, Variable
class Reader(object):
""".dta file reader"""
_header = {}
_data_location = 0
_col_sizes = ()
_has_string_data = False
_missing_values = False
TYPE_MAP = range(251)+list('bhlfd')
MISSING_VALUES =... | karimbahgat/PythonGis | pythongis/vector/fileformats/thirdparty/PyDTA/StataTools.py | Python | mit | 15,846 |
#!/usr/bin/env python3
"""
Some automation for Astrolords.
"""
import sys
import time
import win32api
import win32con
from PIL import ImageGrab
from pywinauto import application, mouse
cords = (1050, 585)
x2_cords = (1050, 585)
x5_cords = (1050, 640)
def run():
path_to_astro = r'C:\Program Files (x86)\Astro Lords... | brokeyourbike/astrolords_dayleak | astro.py | Python | mit | 1,700 |
"""
This is an example settings/test.py file.
Use this settings file when running tests.
These settings overrides what's in settings/base.py
"""
from .base import *
DATABASES = {
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": ":memory:",
"USER": "",
"PASSWORD": "",
... | oskarm91/sis | sis/settings/test.py | Python | bsd-3-clause | 435 |
from views import app
from settings import FRONT_WEATHER_PORT
if __name__ == "__main__":
app.run(host='0.0.0.0', port=FRONT_WEATHER_PORT)
| microstack/front | weather/wsgi.py | Python | mit | 143 |
#Milton Orlando Sarria
#filtrado elemental de ruido sinusoidal
from scipy import signal
import matplotlib.pyplot as plt
import numpy as np
#disenar el filtro usando una ventana hamming
b = signal.firwin(9, 0.8, window='hamming', pass_zero=True)
#definir la frecuencia de muestreo y generar un vector de tiempo hasta 5... | miltonsarria/dsp-python | filters/FIR/filter_sine1.py | Python | mit | 1,128 |
# -*- coding: utf-8 -*-
'''
Tensorflow Implementation of the Scaled ELU function and Dropout
'''
from __future__ import absolute_import, division, print_function
import numbers
from tensorflow.contrib import layers
from tensorflow.python.framework import ops
from tensorflow.python.framework import tensor_shape
from te... | sethuiyer/mlhub | Deep MNIST/selu.py | Python | mit | 2,749 |
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | google/subpar | tests/package_a/a.py | Python | apache-2.0 | 2,881 |
# ##### 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 distrib... | pawkoz/dyplom | blender/release/scripts/modules/bpy_extras/io_utils.py | Python | gpl-2.0 | 20,833 |
from flask import g, render_template, request, session, redirect, url_for, send_file
from scrimmage import app, db
from scrimmage.decorators import sponsor_or_admin_required
from scrimmage.models import Team
from scrimmage.statistics import generate_team_stats
@app.route('/sponsor/')
@sponsor_or_admin_required
def s... | mitpokerbots/scrimmage | scrimmage/sponsor/index.py | Python | mit | 778 |
# Copyright 2014 Hewlett-Packard Development Company, L.P.
#
# Author: Endre Karlson <endre.karlson@hp.com>
#
# 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/lice... | amit0701/rally | rally/plugins/openstack/scenarios/designate/basic.py | Python | apache-2.0 | 11,351 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
'''
desimodel.inputs.fiberpos
=========================
Utilities for updating positioner to fiber mapping.
'''
import os
import shutil
import numpy as np
from astropy.table import Table, vstack
from . import docdb
from ..io impo... | desihub/desimodel | py/desimodel/inputs/fiberpos.py | Python | bsd-3-clause | 11,623 |
__author__ = 'Nataly'
from model.project import Project
import string
import random
def random_string(prefix, maxlen):
symbols = string.ascii_letters
return prefix + "".join([random.choice(symbols) for i in range(random.randrange(maxlen))])
def test_add_project(app):
project = Project(random_string("nam... | simonenkong/python_training_mantis | test/test_add_project.py | Python | gpl-2.0 | 726 |
# Import the library
try:
# This is the statement you normally use.
graph = ximport("graph")
except ImportError:
# But since these examples are "inside" the library
# we may need to try something different when
# the library is not located in /Application Support
graph = ximport("__init_... | zaqwes8811/coordinator-tasks | extern/GPL_libs/graph/graph_example1.py | Python | apache-2.0 | 1,154 |
import dateutil.parser
import yaml
import os
import shutil
import datetime
from setting import SettingHandler
class BlogpostHandler:
inst = None
def __init__(self):
BlogpostHandler.inst = self
self.pullList()
def pullList(self):
with open("../database/blog.yaml", encoding="utf-8... | mudream4869/imaginary-city | admin/blogpost.py | Python | apache-2.0 | 5,467 |
# -*- coding: utf-8 -*-
''' Utilities for using Delphes.
This module require for libDelphes.so to be in LD_LIBRARY_PATH
Examples:
A code to load the first 1000 of the photons in the specified root file::
from heptools.collider import delphes
@delphes.activate
def photon(i, photons):
... | hajifkd/heptools | heptools/collider/delphes.py | Python | gpl-3.0 | 2,948 |
# Authors:
# Jason Gerard DeRose <jderose@redhat.com>
#
# Copyright (C) 2008-2016 Red Hat
# see file 'COPYING' for use and warranty information
#
# 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 Foundatio... | ofayans/freeipa | ipaserver/rpcserver.py | Python | gpl-3.0 | 49,299 |
corner_tuples = (
(1, 37, 150),
(6, 145, 114),
(31, 73, 42),
(36, 109, 78),
(181, 72, 103),
(186, 108, 139),
(211, 180, 67),
(216, 144, 175),
)
edge_orbit_id = {
# orbit 0
2: 0,
5: 0,
7: 0,
25: 0,
12: 0,
30: 0,
32: 0,
35: 0, # Upper
38: 0,
41... | dwalton76/rubiks-color-resolver | rubikscolorresolver/cube_666.py | Python | mit | 73,654 |
# Copyright (C) 2019 Dmitry Marakasov <amdmi3@amdmi3.ru>
#
# This file is part of repology
#
# repology 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) an... | AMDmi3/repology | repology/parsers/parsers/os4depot.py | Python | gpl-3.0 | 2,191 |
# -*- coding: utf-8 -*-
r"""
.. _tut-imorting-eeg-data:
===============================
Importing data from EEG devices
===============================
MNE includes various functions and utilities for reading EEG data and electrode
locations.
.. _import-bv:
BrainVision (.vhdr, .vmrk, .eeg)
=========================... | bloyl/mne-python | tutorials/io/20_reading_eeg_data.py | Python | bsd-3-clause | 8,987 |
# ubuntuone.storageprotocol.samples.ping_client - a ping client
#
# Author: Lucio Torre <lucio.torre@canonical.com>
#
# Copyright 2009 Canonical Ltd.
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License version 3,
# as published by the Fr... | Alberto-Beralix/Beralix | i386-squashfs-root/usr/share/doc/python-ubuntuone-storageprotocol/examples/ping_client.py | Python | gpl-3.0 | 2,472 |
# -*- coding: UTF-8 -*-
# This file is part of Project-Stats
# Project-Stats 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
# any later version.
#
# Project-Stats is distri... | LuqueDaniel/ninja-project-stats | project_stats/project_stats.py | Python | gpl-3.0 | 6,879 |
# -*- coding: utf-8 -*-
from gluon import current
def config(settings):
"""
Template settings for Belize
- designed to be used in a Cascade with an application template
"""
#T = current.T
# Pre-Populate
settings.base.prepopulate.append("locations/BZ")
# Restrict to specific ... | flavour/eden | modules/templates/locations/BZ/config.py | Python | mit | 1,352 |
#
# 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... | openstack/ceilometer | ceilometer/nova_client.py | Python | apache-2.0 | 4,953 |
"""Routes bundles of ports (river routing).
"""
from typing import Callable, List, Optional
from gdsfactory.components.bend_euler import bend_euler
from gdsfactory.components.straight import straight
from gdsfactory.components.taper import taper as taper_function
from gdsfactory.cross_section import strip
from gdsfact... | gdsfactory/gdsfactory | gdsfactory/routing/get_bundle_path_length_match.py | Python | mit | 4,998 |
#!/usr/bin/python
import sys,os
from sqlobject import *
PROTOCOL_VERSION_1_0 = '1.0'
PROTOCOL_VERSION_1_1 = '1.1'
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "../.."))
from channel.channel_message import ChannelMessage as ChannelMessage
class AsteriskEvent(SQLObject):
added=DateTimeCol(default=s... | gryzz/uCall | utils/asterisk-connector/handlers/commands_1_1.py | Python | gpl-3.0 | 7,989 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import telemeta.models.fields
class Migration(migrations.Migration):
dependencies = [
('telemeta', '0002_auto_20170424_1110'),
]
operations = [
migra... | ANR-kamoulox/Telemeta | telemeta/migrations/0003_auto_20170718_1502.py | Python | agpl-3.0 | 8,878 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright: (c) 2017, F5 Networks Inc.
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | tersmitten/ansible | lib/ansible/modules/network/f5/bigip_gtm_pool.py | Python | gpl-3.0 | 42,441 |
#!/usr/bin/python
"""WARNING: Script is in beta and needs to be tested thoroughly.
The script generates a rudimentary appcache file based upon the content.opf file located in either:
an uncompressed epub directory or a compressed epub file and places it in the current directory
Usage: acm_gen.py --input='/path/to... | ravi-sai/epub.js | tools/appcache.py | Python | bsd-2-clause | 3,659 |
from datetime import timedelta
import pytest
from django.urls import reverse
from django.utils import timezone
from model_bakery import baker
from pythonpro.cohorts.models import LiveClass
from pythonpro.memberkit.models import Subscription
@pytest.fixture
def live_class(db, cohort, fake) -> LiveClass:
now = ti... | pythonprobr/pythonpro-website | pythonpro/cohorts/tests/test_live_class_detail.py | Python | agpl-3.0 | 1,924 |
#!/usr/bin/python2.5
#from __future__ import with_statement # Until Python 2.6
"""
Converts LaTeX math to png images.
Run latexmath2png.py --help for usage instructions.
"""
"""
Author:
Kamil Kisiel <kamil@kamilkisiel.net>
URL: http://www.kamilkisiel.net
Revision History:
2007/04/20 - Initial version
TOD... | liubenyuan/liubenyuan.github.io | latexmath2png.py | Python | mit | 4,617 |
"""
Implements the emitter decorator, class and desciptor.
"""
import weakref
from ._action import BaseDescriptor
def emitter(func):
""" Decorator to turn a method of a Component into an
:class:`Emitter <flexx.event.Emitter>`.
An emitter makes it easy to emit specific events, and is also a
placehol... | zoofIO/flexx | flexx/event/_emitter.py | Python | bsd-2-clause | 2,960 |
patches = [
{
"op": "replace",
"path": "/ResourceTypes/AWS::FMS::Policy/Properties/ResourceTags/ItemType",
"value": "Tag",
},
{
"op": "remove",
"path": "/PropertyTypes/AWS::FMS::Policy.ResourceTag",
},
{
"op": "replace",
"path": "/ResourceTypes... | cloudtools/troposphere | scripts/patches/fms.py | Python | bsd-2-clause | 496 |
#!/usr/bin/python2.4
#
# Copyright 2009 Empeeric LTD. 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
#
# Unl... | poeks/twitterbelle | lib/bitly.py | Python | apache-2.0 | 7,225 |
def create_skill_attributes_table(curs):
sql = '\n'.join([
"CREATE TABLE skill_attributes (",
" skill_attribute_id INTEGER PRIMARY KEY,",
" section_id INTEGER NOT NULL,",
" attribute TEXT,",
" armor_check_penalty INT,",
" trained_only INT",
")"])
curs.execute(sql)
def create_skill_attributes_index... | devonjones/PSRD-Parser | src/psrd/sql/skills.py | Python | gpl-3.0 | 1,898 |
import random
import textwrap
import cmd
import time
import combat
SCREEN_WIDTH = 80
NORTH = 'north'
SOUTH = 'south'
WEST = 'west'
EAST = 'east'
DESC = 'desc'
CHESTS = 'chests'
MOBS = 'mobs'
show_full_exits = True
chest_opened = False
mob_dead = False
gold_pouch = 0
def chest_gen():
return random.randint(0, 4)... | cjPrograms/miniQuest | cave.py | Python | gpl-2.0 | 6,132 |
import os
import requests
import time
import datetime
from sqlalchemy import or_, and_
from flask import jsonify, render_template, redirect,flash, request, url_for
from flask_login import login_required, logout_user, login_user, current_user
from werkzeug.utils import secure_filename
import bibtexparser
from bibtexpa... | frapac/bibtex-browser | apps/views/views.py | Python | mit | 15,666 |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for the postgres provider.
Note: to prepare the DB, you need to run the sql files specified in
tests/testdata/provider/testdata_pg.sh
Read tests/README.md about writing/launching tests with PostgreSQL.
Run with ctest -V -R PyQgsPostgresProvider
.. note:: This program is fr... | ghtmtt/QGIS | tests/src/python/test_provider_postgres.py | Python | gpl-2.0 | 138,650 |
"""
==========================
FastICA on 2D point clouds
==========================
This example illustrates visually in the feature space a comparison by
results using two different component analysis techniques.
:ref:`ICA` vs :ref:`PCA`.
Representing ICA in the feature space gives the view of 'geometric ICA':
ICA... | manhhomienbienthuy/scikit-learn | examples/decomposition/plot_ica_vs_pca.py | Python | bsd-3-clause | 3,446 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 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
#
#... | ntt-sic/nova | nova/tests/fake_notifier.py | Python | apache-2.0 | 1,657 |
import bot
bot.run_bot() | git-commit/iot-gatekeeper | gatekeeper/test_app.py | Python | mit | 25 |
def find_superbubble(G, G_rev, s):
queue = set([s])
labels = {}
while True:
v = queue.pop()
labels[v] = "visited"
v_children = list(G.neighbors(v))
if len(v_children) == 0:
return False, "tip"
for u in v_children:
if u == s:
... | snurk/meta-strains | final_algo/superbubbles.py | Python | mit | 891 |
# Copyright (c) 2013-2016 Jeffrey Pfau
#
# 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 ._pylib import ffi, lib
from . import tile
from cached_property import cach... | fr500/mgba | src/platform/python/mgba/core.py | Python | mpl-2.0 | 4,578 |
#!/usr/bin/env python
#=============================================================================================
# MODULE DOCSTRING
#=============================================================================================
"""
Datasets and parameter sets for testing physical property estimation.
Authors
----... | bmanubay/open-forcefield-tools | openforcefield/tests/testsystems.py | Python | mit | 1,301 |
from st2actions.runners.pythonrunner import Action
from libcloud.compute.providers import Provider as ComputeProvider
from libcloud.compute.providers import get_driver as get_compute_driver
from libcloud.storage.providers import Provider as StorageProvider
from libcloud.storage.providers import get_driver as get_stora... | armab/st2contrib | packs/azure/actions/lib/base.py | Python | apache-2.0 | 2,059 |
import argparse
import os
import numpy as np
from multiprocessing import Process, Queue
from Queue import Empty
import ioutils
from vecanalysis.representations.explicit import Explicit
from statutils.fastfreqdist import CachedFreqDist
SAMPLE_MAX = 1e9
def worker(proc_num, queue, out_dir, in_dir, count_dir, valid_wor... | williamleif/histwords | sgns/makecorpus.py | Python | apache-2.0 | 4,138 |
from mot.lib.cl_function import SimpleCLFunctionParameter
from .parameter_functions.numdiff_info import SimpleNumDiffInfo
from .parameter_functions.priors import UniformWithinBoundsPrior
from .parameter_functions.transformations import IdentityTransform
import numpy as np
__author__ = 'Robbert Harms'
__date__ = "2016-... | cbclab/MDT | mdt/model_building/parameters.py | Python | lgpl-3.0 | 11,543 |
# Copyright 2015 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... | laosiaudi/tensorflow | tensorflow/python/ops/gradients_test.py | Python | apache-2.0 | 20,925 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
class SkipNode(object):
__slots__ = ('key', 'payload', 'next', 'level')
def __init__(self, key, level=1, payload=None):
self.key = key
self.payload = payload
self.next = [None] * level
pass
def __str__(self):
return "S... | hongta/practice-python | data_structures/skip_list/skip_node.py | Python | mit | 344 |
# Copyright 2011 OpenStack Foundation.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless req... | zestrada/nova-cs498cc | nova/openstack/common/notifier/rpc_notifier.py | Python | apache-2.0 | 1,685 |
"""
Project Euler functions
"""
def sumcd(num):
"""
sum of consecutive digits function returns the sum of all numbers through num
ex: 5 would be 15 (1 + 2 + 3 + 4 + 5)
param: num: integer that we will return the sum of
return: sum of the consecutive digits
"""
return num * (num + 1) // 2
def sumpf(num):... | GHMusicalCoder/project_euler | Euler_funcs.py | Python | apache-2.0 | 912 |
from datetime import datetime, timedelta, date, time
import random
from django.test import TestCase as DjangoTestCase
from django.test.client import RequestFactory
from ..models import Event
def hours_ago(num):
return datetime.now() - timedelta(hours=num)
def hours_ahead(num):
return datetime.now() + timede... | armstrong/armstrong.apps.events | armstrong/apps/events/tests/_utils.py | Python | apache-2.0 | 1,387 |
from django.core import validators
from django.forms import CharField, ChoiceField, MultiValueField
from django.utils.translation import ugettext_lazy as _
from django.core.exceptions import ValidationError
from proposal.widgets import TimeDurationWidget, TimeDurationHiddenWidget
TIME_DURATION_CHOICES = (
('hour... | arscariosus/django-mango | mango/apps/proposal/fields.py | Python | isc | 1,254 |
import unittest
import shutil
import os
from mock import MagicMock
try:
import queue
except ImportError:
import Queue as queue # flake8: noqa
from pax.parallel import multiprocess_locally
from pax.plugins.io.Queues import PullFromQueue, PushToQueue, NO_MORE_EVENTS, REGISTER_PUSHER, PUSHER_DONE
from pax.data... | XENON1T/pax | tests/test_multiprocessing.py | Python | bsd-3-clause | 4,745 |
from math import log, log1p, exp
__author__ = 'Deepak Borania'
def pv_factor(irate, period=1):
return (1 + irate) ** (-period)
def convert_effective_rate(irate, src_prd_length, target_prd_length):
return ((1 + irate) ** (float(target_prd_length) / src_prd_length)) - 1
def irate_nominal_to_effective(ip, p... | antiface/pyActuary | pyactuary/rateconverters.py | Python | mit | 1,238 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | Johnzero/erp | openerp/addons/audittrail/__openerp__.py | Python | agpl-3.0 | 1,966 |
#!/usr/bin/env python
# OpenCenter(TM) is Copyright 2013 by Rackspace US, Inc.
##############################################################################
#
# OpenCenter is licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.... | rcbops/opencenter-agent | opencenteragent/plugins/output/plugin_service.py | Python | apache-2.0 | 2,640 |
# -*- coding: utf-8 -*-
# Copyright (C) 2020 Matthias Luescher
#
# Authors:
# Matthias Luescher
#
# This file is part of edi.
#
# edi is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of... | lueschem/edi | edi/commands/documentationcommands/render.py | Python | lgpl-3.0 | 4,683 |
# coding: utf-8
import functions
def datasets(*args):
if args[0] == "0":
raise functions.OperatorError("DATASET", "Dataset does not exist")
else:
return 1
datasets.registered = True
if not ('.' in __name__):
"""
This is needed to be able to test the function, put it at the end of ev... | madgik/exareme | Exareme-Docker/src/exareme/exareme-tools/madis/src/functions/row/datasets.py | Python | mit | 564 |
"""
======================================
Generalized hyperfine component fitter
======================================
.. moduleauthor:: Adam Ginsburg <adam.g.ginsburg@gmail.com>
"""
import numpy as np
import model
import fitter
from astropy import units as u
# should be imported in the future
ckms = 2.99792458e5
c... | dinossimpson/pyspeckit | pyspeckit/spectrum/models/hyperfine.py | Python | mit | 14,893 |
#!/usr/bin/env python
import sys
import cv2
import matplotlib.pyplot as plt
import numpy as np
import rospy as rp
import argparse
import tms_ss_ssd.srv
from sensor_msgs.msg import CompressedImage
def parse_args():
parser = argparse.ArgumentParser(description='Single-Shot Multibox Detector demo client')
parser.... | kazuto1011/rcnn-server | tms_ss_ssd/nodes/client/client_loaded_image.py | Python | mit | 2,314 |
from __future__ import absolute_import, unicode_literals
from django import template
register = template.Library()
@register.simple_tag(takes_context=True)
def if_url(context, url_name, yes, no):
"""
Example:
%li{ class:"{% if_url 'contacts.contact_read' 'active' '' %}" }
"""
current = cont... | peterayeni/dash | dash/utils/templatetags/utils.py | Python | bsd-3-clause | 405 |
#!/usr/bin/env python
ARCH_EXCLUDE = ['armel', 'alpha', 'hurd-i386', 'ia64', 'kfreebsd-amd64', 'kfreebsd-i386', 'mips', 'powerpc', 'ppc64el', 's390', 's390x', 'sparc']
CONTENT_EXCLUDE = ['binary-{arch}', 'installer-{arch}', 'Contents-{arch}.gz', 'Contents-udeb-{arch}.gz', 'Contents-{arch}.diff', 'arch-{arch}.files',... | cubarco/tunasync | scripts/gen_debian_exclude.py | Python | gpl-3.0 | 597 |
# Copyright 2012 Nebula, 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 agree... | django-leonardo/horizon | horizon/workflows/views.py | Python | apache-2.0 | 9,305 |
from .base import Base
class Roles(Base):
endpoint = "/roles"
def get_role_by_id(self, role_id):
return self.client.get(self.endpoint + "/" + role_id)
def get_role_by_name(self, role_name):
return self.client.get(self.endpoint + "/name/" + role_name)
def patch_role(self, role_id, op... | Vaelor/python-mattermost-driver | src/mattermostdriver/endpoints/roles.py | Python | mit | 545 |
# Copyright (c) 2016 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 ... | rallylee/gem5 | src/arch/generic/ISACommon.py | Python | bsd-3-clause | 2,443 |
#!/usr/bin/env python
#
# Protein Engineering Analysis Tool DataBase (PEATDB)
# Copyright (C) 2010 Damien Farrell & Jens Erik Nielsen
#
# 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 ver... | dmnfarrell/peat | PEATDB/DNAtool/PDBDumper.py | Python | mit | 5,131 |
from django.db import models
from django.conf import settings
from django.utils import timezone
from django.utils.timezone import utc
import urllib
import json
import datetime
class WeatherLocationManager(models.Manager):
def updateLocations(self):
apiKey = settings.MET_OFFICE_API_KEY
if apiKey != "":
try:
... | Tomcuzz/OctaHomeAutomation | OctaHomeCore/models/weather.py | Python | mit | 6,720 |
"""Test for `cspreports.urls`."""
from django.test import SimpleTestCase
from django.urls import include, re_path
import cspreports.urls
class TestCSPReportsURLs(SimpleTestCase):
"""Basic tests of CSP reports urls."""
def test_nice_report_empty(self):
self.assertTrue(len(include('cspreports.urls'))... | adamalton/django-csp-reports | cspreports/tests/test_urls.py | Python | mit | 326 |
# Copyright Iris contributors
#
# This file is part of Iris and is released under the LGPL license.
# See COPYING and COPYING.LESSER in the root of the repository for full
# licensing details.
"""
A package for handling multi-dimensional data and associated metadata.
.. note ::
The Iris documentation has further ... | SciTools/iris | lib/iris/__init__.py | Python | lgpl-3.0 | 14,621 |
#!/usr/bin/env python
########################################################################
# $HeadURL$
# File : dirac-start-component
# Author : Ricardo Graciani
########################################################################
"""
Start DIRAC component using runsvctrl utility
"""
__RCSID__ = "$Id$"
#
from... | Sbalbp/DIRAC | Core/scripts/dirac-start-component.py | Python | gpl-3.0 | 1,384 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.