src stringlengths 721 1.04M |
|---|
from collections import Counter
from collections import deque
def soma_quadrados(n):
test=0
aux=n
res = {0:[0], 1:[1]}
if n>=0 and n<=1:
return res[n]
else:
quad=[]
test=2
while test<=aux:
n=test
for q in range(1,n+1):
... |
#!/usr/bin/env python3
import logging
import binascii
import uuid
import pykms_RpcBase
from pykms_Dcerpc import MSRPCHeader, MSRPCBindAck
from pykms_Structure import Structure
from pykms_Format import justify, byterize, enco, deco, pretty_printer
#---------------------------------------------------------------------... |
#
# The MIT License (MIT)
# Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including without ... |
import os
import time
import subprocess
import sys
import uuid
import json
import re
from ripple.observers.base_observer import BaseObserver
from ripple import logger, RippleConfig
class IPCObserver(BaseObserver):
"""
Set up the polling IPC monitor. It will use the
"ipcs" command to query for shared memo... |
# -*- coding: utf-8 -*-
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2015 Thumbor Community
import tornadis
import tornado
from thumbor.storages import BaseStorage
class Storage(BaseStorage):
pool = None
def __init__(self, context):
'''Initiali... |
"""The logical connection object that links two devices together"""
from Devices.Bridge import *
from Devices.Firewall import *
from Devices.Hub import *
from Devices.Mobile import *
from Devices.Router import *
from Devices.Subnet import *
from Devices.Switch import *
from Devices.UML import *
from Devices.... |
"""
<name>GenExpress</name>
<description>Expression data from GenExpress.</description>
<icon>icons/GenCloud.svg</icon>
<priority>36</priority>
"""
from __future__ import absolute_import
import Orange
import genesis
import sys, os
from collections import defaultdict
import math
from datetime import date
import numpy... |
# -*- coding: utf-8 -*-
from openerp import SUPERUSER_ID, api
from openerp.osv import fields, osv
from openerp.tools.translate import _
import openerp.addons.decimal_precision as dp
import datetime,time
import logging
import os
import shutil
import re
import urllib2
from openerp import tools
from lxml import etree
_lo... |
"""
Application: HealthNet
File: /patient/forms.py
Authors:
- Nathan Stevens
- Philip Bedward
- Daniel Herzig
- George Herde
- Samuel Launt
Description:
- This file contains all view controller information
"""
from base.models import ExtendedStay
from dja... |
# -*- coding: utf-8 -*-
#
# Test links:
# https://www.oboom.com/B7CYZIEB/10Mio.dat
import re
from module.plugins.internal.utils import json
from module.plugins.internal.Hoster import Hoster
from module.plugins.captcha.ReCaptcha import ReCaptcha
class OboomCom(Hoster):
__name__ = "OboomCom"
__type__ = ... |
import os
import pickle
import unittest
import darksky
import requests
class TestPickle(unittest.TestCase):
""" Forecast pickling """
@classmethod
def setUpClass(cls):
def mock_request_get(*args, **kwargs):
response = type('Response', (object,), {})
response.headers = {}
... |
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2009 Douglas S. Blank <doug.blank@gmail.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 L... |
# Django settings for cualbondi project.
import os
CUALBONDI_ENV = os.environ.get('CUALBONDI_ENV', 'development')
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ALLOWED_HOSTS = ['*',]
LOGIN_REDIRECT_URL = '/'
ABSOLUTE_URL_OVERRIDES = {
'auth.user': lambda u: "/usuarios/%s/" % u.username,
}
ADMINS = (
# ('Your Name'... |
# -*- coding: UTF-8 -*-
#######################################################################
# ----------------------------------------------------------------------------
# "THE BEER-WARE LICENSE" (Revision 42):
# @Daddy_Blamo wrote this file. As long as you retain this notice you
# can do whatever you want wi... |
# $Id: ip6.py 87 2013-03-05 19:41:04Z andrewflnr@gmail.com $
# -*- coding: utf-8 -*-
"""Internet Protocol, version 6."""
from __future__ import print_function
from __future__ import absolute_import
from . import dpkt
from . import ip
from .decorators import deprecated
from .compat import compat_ord
class IP6(dpkt.Pa... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-03-22 14:13
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [('eighth', '0038_merge')]
operations = [
migrations.AddField(
model_name='eight... |
# This file is part of MyPaint.
# Copyright (C) 2009 by Martin Renold <martinxyz@gmx.ch>
#
# 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) ... |
# coding: utf-8
from __future__ import unicode_literals
from django.contrib.auth.models import User, Group
from stored_filters import create_filter
from granular_access.models import ACL
from granular_access.tests.base import BaseTest
from granular_access.acl import match_acl
class MatchACLTest(BaseTest):
def se... |
from hazelcast.exception import HazelcastSerializationError
from hazelcast.serialization.api import IdentifiedDataSerializable
from tests.base import SingleMemberTestCase
from tests.util import random_string
FACTORY_ID = 1
class Task(IdentifiedDataSerializable):
CLASS_ID = 1
def write_data(self, object_data... |
from __future__ import absolute_import
from __future__ import unicode_literals
import logging
import os
import re
import sys
from collections import namedtuple
from operator import attrgetter
import six
from docker.errors import APIError
from docker.utils import create_host_config
from docker.utils import LogConfig
f... |
import cgi
import os.path
from paste.urlparser import StaticURLParser
from pylons import tmpl_context as c, request
from pylons.controllers.util import abort, forward
from pylons.middleware import error_document_template, media_path
from webhelpers.html.builder import literal
from kai.lib.base import BaseController, ... |
#!/usr/bin/env python
import pytest
import os
import shutil
import json
import numpy as np
import cv2
import sys
import pandas as pd
from plotnine import ggplot
from plantcv import plantcv as pcv
import plantcv.learn
import plantcv.parallel
import plantcv.utils
# Import matplotlib and use a null Template to block plot... |
import sqlite3
import time
import os
import sys
from utils import query_db
from subprocess import call
execfile('config.py')
conn = sqlite3.connect(DATABASE)
conn.row_factory = sqlite3.Row
def runScript( command):
print os.getcwd()
sys.stdout.flush()
sys.stdout.flush()
print command.split()
comma... |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import matplotlib.pyplot as plt
from matplotlib.dates import drange, date2num
from pandas.lib import Timestamp
from datetime import timedelta
import numpy as np
from .geom import geom
import pandas as pd
class ... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
# from experiments.src.exp import AggregateExperiment, MDPAgentConfiguration, SingleExperiment
from src.sequential_taskgen import SequentialTaskgen
from src.experiment import AggregateExperiment, MDPAgentConfiguration, SingleExperiment, LazyAgentConfigurat... |
#############################################################################
##
## Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
## Contact: http://www.qt-project.org/legal
##
## This file is part of Qt Creator.
##
## Commercial License Usage
## Licensees holding valid commercial Qt licenses may use this f... |
import pandas as pd
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import os
import pdb
import sys
plt.style.use("ggplot")
os.chdir("..")
ipath = "./Data/Final_Data/"
ifile = "Final_Data"
opath = "./Data/Final_Data/Neighborhoods/"
imgpath = "./Plots/Neighborhood_TS/"
ext = ".csv"
input_var =... |
from google.appengine.ext import db
class TaxiDriver(db.Model):
EXCEPTION_NO_PARENT = "`parent` property must be an `Account` object."
name = db.StringProperty(default=None)
email = db.EmailProperty(default=None)
sex = db.StringProperty(default=None)
address = db.StringProperty(default=None)
parish = db.... |
#!/usr/local/bin/python
import csignal_tests
import unittest
import sys
from test_csignal import TestsCSignal
f... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# File: svhn.py
# Author: Yuxin Wu <ppwwyyxx@gmail.com>
import os
import random
import numpy as np
from six.moves import range
from ...utils import logger, get_rng, get_dataset_path
from ..base import RNGDataFlow
try:
import scipy.io
__all__ = ['SVHNDigit']
excep... |
from __future__ import absolute_import
import numpy as np
import collections
try:
from itertools import imap
except ImportError:
imap = map
try:
from functools import reduce
except ImportError:
pass
class SampleSet(collections.MutableSet):
def __init__(self):
self._dict = {}
self._... |
from gi.repository import GObject
class PlayerIsDead(Exception):
""" Used instead of returning a move,
when an engine crashes, or a nonlocal player disconnects """
pass
class TurnInterrupt(Exception):
""" Used instead of returning a move, when a players turn is interrupted.
Currently thi... |
import markdown
from django.db import models
from django.utils.text import slugify
from conf import settings
class Permalinkable(models.Model):
slug = models.SlugField()
class Meta:
abstract = True
def get_url_kwargs(self, **kwargs):
kwargs.update(getattr(self, 'url_kwargs', {}))
... |
from __future__ import print_function
from nplab.utils.gui import QtWidgets, uic, QtCore, get_qt_app
from nplab.ui.ui_tools import UiTools
import nplab.datafile as df
from nplab.utils.log import create_logger, ColoredFormatter
import os
import sys
import inspect
import numpy as np
import pyqtgraph
import pyqtgraph.do... |
from puf import cli
from tests import StreamCaptureTest
import re
from tempfile import NamedTemporaryFile
class TestMain(StreamCaptureTest):
def test_main(self):
cli.main(['range(3)'])
self.assertWasStreamed('0\n1\n2\n')
def test_main_initial(self):
self.assertRaises(NameError, cli.ma... |
from alert.exceptions import AlertIDAlreadyInUse, AlertBackendIDAlreadyInUse,\
InvalidApplicableUsers
import django
from django.conf import settings
from django.utils import timezone
from django.template.loader import render_to_string, get_template
from django.contrib.sites.models import Site
from django.template i... |
'''
Created on Apr 8, 2014
@author: cmills
'''
from unittest import TestLoader, TextTestRunner
from test_tasr import TestTASR
from test_app_topic import TestTASRTopicApp
from test_app_core import TestTASRCoreApp
from test_app_subject import TestTASRSubjectApp
from test_client_legacy_methods import TestTASRLegacyClien... |
# Copyright 2019,2020,2021 Sony 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 agreed... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""A setuptools based setup module.
See:
https://packaging.python.org/en/latest/distributing.html
https://github.com/pypa/sampleproject
"""
# Always prefer setuptools over distutils
from setuptools import setup, find_packages
# To use a consistent encoding
from codecs im... |
# -*- coding: utf-8 -*-
"""
Don't edit this file manually.
Update it from QGIS console:
from processing.tools.translation import updateTranslations
updateTranslations()
"""
from PyQt4.QtCore import QCoreApplication
def translationShadow():
"""QGISAlgorithmProvider"""
QCoreApplication.translate("SumLines", ... |
"""
Unit tests for reverse URL lookups.
"""
from __future__ import absolute_import, unicode_literals
import unittest
from django.conf import settings
from django.contrib.auth.models import User
from django.core.exceptions import ImproperlyConfigured, ViewDoesNotExist
from django.core.urlresolvers import (reverse, res... |
# -*- coding: utf-8 -*-
"""Models related to mailboxes management."""
from __future__ import unicode_literals
import os
import pwd
from reversion import revisions as reversion
from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.db.models import Q
from django.db.model... |
# +-------------------------------------------------------------------------
# | Copyright (C) 2016 Yunify, Inc.
# +-------------------------------------------------------------------------
# | Licensed under the Apache License, Version 2.0 (the "License");
# | you may not use this work except in compliance with the Li... |
import pandas as pd
import numpy as np
from fitensemble import bayesian_weighting, belt
import experiment_loader
import ALA3
prior = "BW"
ff = "amber96"
stride = 1000
regularization_strength = 10.0
thin = 400
factor = 50
steps = 1000000
predictions_framewise, measurements, uncertainties = experiment_loader.load(ff, ... |
import functools
import logging
import traceback
import webbrowser
import pygments.styles
import pygments.token
import porcupine
from porcupine import _dialogs, dirs, filetypes, menubar, settings, tabs, utils
log = logging.getLogger(__name__)
# global state makes some things a lot easier
_main_window = None
_tab_ma... |
import tempfile
from driver_pete_python_sandbox.download import S3
from driver_pete_python_sandbox.filter_gps_processor import filter_gps_data,\
FilterChain, DuplicateTimeFilter,\
VelocityOutliersFilter, apply_filter
from driver_pete_python_sandbox.trajectory_reader import read_compressed_trajectory
from drive... |
"""
Atmosphere api email
"""
from rest_framework.response import Response
from rest_framework import status
from django.template.loader import render_to_string
from django.template import Context
from threepio import logger
from django_cyverse_auth.protocol.ldap import lookupEmail
from core.models import AtmosphereU... |
# Copyright 2021 The SeqIO Authors.
#
# 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 wr... |
"""Some examples of how to use modules."""
# from everpy_extras import EverPyExtras
from everpy_pro import EverPyPro
import everpy_utilities
PATH_TO_ENSCRIPT = r"C:\Program Files (x86)\Evernote\Evernote\ENScript.exe"
def createnote(epy):
"""Example of how to make a note from python."""
content = open("READM... |
# coding: utf-8
"""Provides implementation of Simulation model and Simulation"""
from __future__ import absolute_import
from google.appengine.ext import ndb
from google.appengine.ext.ndb.model import GeoPt
import model
import time
from pcse.db import NASAPowerWeatherDataProvider
from pcse.fileinput import CABOFileRea... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__name__ == "database"
import pymongo
import logging
import re
from datetime import datetime
from copy import copy
import os, sys
class Database(object):
'''Database creation'''
def __init__(self, database_name, local=False, debug=False):
try:
... |
# -*- coding: utf-8 -*-
#
# (c) 2016, Yanis Guenane <yanis+ansible@guenane.org>
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later vers... |
#!/usr/local/bin/python2.7
# -*- coding: utf-8 -*-
__author__ = 'https://github.com/password123456/'
import random
import numpy as np
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
import requests
import urllib
import urllib2
import json
import datetime
import time
import dateutil.relativedelta as REL
class b... |
import numpy as np
from astrodata.adutils import logutils
from gempy.adlibrary.manipulate_ad import remove_single_length_dimension
from gempy.gemini import gemini_tools as gt
from primitives_GEMINI import GEMINIPrimitives
class F2Primitives(GEMINIPrimitives):
"""
This is the class containing all of the primiti... |
#!/usr/bin/env python3
#
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Big number routines.
This file is copied from python-bitcoinlib.
"""
import struct
# generic big endian MPI format
def bn_bytes(v, have_ext=False):
... |
# This module contains abstractions for the input stream. You don't have to
# looks further, there are no pretty code.
#
# We define two classes here.
#
# Mark(source, line, column)
# It's just a record and its only use is producing nice error messages.
# Parser does not use it for any other purposes.
#
# Reader(so... |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------
# Copyright (c) 2009 Jendrik Seipp
#
# RedNotebook 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 vers... |
import six
from decimal import Decimal as D
from oscar.core.loading import get_model
from django.test import TestCase
from oscar.test import factories, decorators
from oscar.apps.partner import abstract_models
Partner = get_model('partner', 'Partner')
PartnerAddress = get_model('partner', 'PartnerAddress')
Country =... |
# //=======================================================================
# // Copyright JobPort, IIIT Delhi 2015.
# // Distributed under the MIT License.
# // (See accompanying file LICENSE or copy at
# // http://opensource.org/licenses/MIT)
# //======================================================================... |
import numpy as np
import tables
import wx
import os
import itertools
# ClassMultiple testing correction using mathematical morphology
##Tables definition
##
##tables:
##/Shape # Keep the shape of the Data, to reshape after calculation # simple array
##/Data/All #using createEArray('/','AllData',tables.Float6... |
import sys
import logging
import data_handler
def update_data(context):
print 'Update data'
data_handler.update()
return 0, ""
def search(context):
if not data_handler.has_data():
context["logger"].debug("Data is missing")
update_data(context)
search_word = context['arguments'][1... |
# Copyright 2020 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... |
#!/usr/bin/python2.7
# -*- coding: utf-8 -*-
# vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab
# 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
... |
#!/usr/bin/python
import dbus
import os
bus = dbus.SystemBus()
policy_kit = bus.get_object('org.freedesktop.PolicyKit', '/')
#print policy_kit_mechanism.Introspect()
if(policy_kit == None):
print("Error: Could not get the PolicyKit interface.\n")
action_id = "org.gnome.clockapplet.mechanism.settimezone"
result... |
# Copyright (C) 2016 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
from selenium.common import exceptions
from lib import base
from lib.constants import url
from lib.constants import locator
from lib import environment
from lib import decorator
from lib.page import widget_... |
# Copyright 2012 Brett Ponsler
# This file is part of pysiriproxy.
#
# pysiriproxy 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.
#
# ... |
#!/usr/bin/python3
# @begin:license
#
# Copyright (c) 2015-2019, Benjamin Niemann <pink@odahoda.de>
#
# 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... |
# 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... |
# This Python script can be used to build and install a Python "protokit" module that
# provides a wrapper to select portions of the "Protlib" code base.
# This currently includes just the "protopipe" interprocess communication class.
# Example scripts are provided in the "examples" subdirectory.
import platform
from ... |
def count_syllables(word):
# thanks to https://github.com/akkana
verbose = False #print debugging?
vowels = ['a', 'e', 'i', 'o', 'u']
on_vowel = False
in_diphthong = False
minsyl = 0
maxsyl = 0
lastchar = None
word = word.lower()
for c in word:
is_vowel = c in vowels
... |
# DSL - easy Display Setup for Laptops
# Copyright (C) 2012-2015 Ralf Jung <post@ralfj.de>
#
# 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... |
"""k5lib public functions.
k5lib is a collection of functions and utilities to communicate with Fujits K5 cloud REST API.
"""
from .authenticate import get_global_token
from .authenticate import get_region_token
from .authenticate import get_project_token
from .authenticate import get_domain_id
from .authenticate imp... |
# -*- coding: utf-8 -*-
# This file is part of periscope3.
# Copyright (c) 2013 Roman Hudec <black3r@klikni.cz>
#
# This file contains parts of code from periscope.
# Copyright (c) 2008-2011 Patrick Dessalle <patrick@dessalle.be>
#
# periscope is free software; you can redistribute it and/or modify
# ... |
"""
Created on 29 Jan 2012
@author: Mike Thomas
"""
from PyQt4.QtGui import QDialog
from ui_midiLearnPaired import Ui_MidiLearnPairedDialog
from midiMessages import MidiControlThread
from controlSet import PairedMidi
class MidiLearnPairedDialog(QDialog, Ui_MidiLearnPairedDialog):
"""
classdocs
"""
... |
import copy
import re
import six
from six.moves import urllib
from .common import (
Requester,
_lower,
_upper,
_singularize,
_pluralize,
_json_dumper,
)
__author__ = "Gary M. Josack <gary@dropbox.com>"
from .version import __version__, version_info # noqa
TRIGGER_LOG_ENTRY_RE = re.compile(
... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Category',
fields=[
('id', models.AutoField(ver... |
"""
Shogun demo
Fernando J. Iglesias Garcia
This example shows the use of dimensionality reduction methods, mainly
Stochastic Proximity Embedding (SPE), although Isomap is also used for
comparison. The data selected to be embedded is an helix. Two different methods
of SPE (global and local) are applied showing that... |
# Copyright (c) 2014 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-2.0
#
# Unless require... |
import numpy as np
def forward(z):
"""forward pass for sparsemax
this will process a 2d-array $z$, where axis 1 (each row) is assumed to be
the the z-vector.
"""
# sort z
z_sorted = np.sort(z, axis=1)[:, ::-1]
# calculate k(z)
z_cumsum = np.cumsum(z_sorted, axis=1)
k = np.arange... |
"""Evaluation of the Model.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from datetime import datetime
import math
import time
import tensorflow.python.platform
from tensorflow.python.platform import gfile
import numpy as np
import tensorflow as tf... |
# -*- encoding: utf-8 -*-
################################################################################
# #
# Copyright (C) 2013-Today Carlos Eduardo Vercelino - CLVsol #
# ... |
# Copyright 2017 the authors.
# This file is part of Hy, which is free software licensed under the Expat
# license. See the LICENSE.
from __future__ import unicode_literals
from hy import HyString
from hy.models import HyObject
from hy.compiler import hy_compile
from hy.importer import import_buffer_to_hst
from hy.er... |
# -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import (absolute_import, division, print_function)
import os
class ClassOne(object):
pass
class ClassTwo(object):
pass
def track_param(n):
return 42
track_param.params = [ClassOne, ClassTwo]
def ... |
from os import urandom
from time import sleep
from neopixel import NeoPixel
from machine import Pin
from math import floor
dataPin = Pin(13)
ledCount = 27
np = NeoPixel(dataPin, ledCount)
def blank():
for pos in range(ledCount):
np[pos]=(0,0,0)
np.write();
def visitAll():
for pos in range(ledCount):
blank()
... |
from __future__ import with_statement
import eg
eg.RegisterPlugin(
name = "Barco CRT Projector",
description = "Controls Barco CRT projectors via RS232.",
kind = "external",
author = "Bitmonster",
version = "1.0.0",
canMultiLoad = True,
createMacrosOnAdd = True,
icon = (
... |
from discord.ext import commands
from .utils.dataIO import dataIO
from .utils import checks
from .utils.chat_formatting import pagify, box
import os
import re
class CustomCommands:
"""Custom commands
Creates commands used to display text"""
def __init__(self, bot):
self.bot = bot
self.fi... |
from datetime import datetime
import sqlalchemy as sa
import config
from models.episode_watch import EpisodeWatch # pylint: disable=unused-import
class Episode(config.Base):
__tablename__ = 'episode'
id = sa.Column(sa.Integer, sa.Sequence('episode_id_seq'), primary_key=True)
title = sa.Column(sa.Text)
... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'inputWindow.ui'
#
# Created by: PyQt4 UI code generator 4.11.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s... |
"""A GDS layer is a tuple of two integers.
You can:
- Define your layers in a dataclass
- Load it from Klayout XML file (.lyp)
LayerSet adapted from phidl.device_layout
load_lyp, name_to_description, name_to_short_name adapted from phidl.utilities
preview_layerset adapted from phidl.geometry
"""
import pathlib
from ... |
#
# PluginManagerGtk.py -- Simple class to manage plugins.
#
# Eric Jeschke (eric@naoj.org)
#
# Copyright (c) Eric R. Jeschke. All rights reserved.
# This is open-source software licensed under a BSD license.
# Please see the file LICENSE.txt for details.
#
import sys
import threading
import traceback
import gtk
fro... |
# -*- coding: utf-8 -*-
from kivy.animation import Animation
from kivy.clock import Clock
from kivy.core.window import Window
from kivy.lang import Builder
from kivy.metrics import dp
from kivy.properties import OptionProperty, NumericProperty, StringProperty, \
BooleanProperty, ListProperty
from kivy.uix.boxlayout... |
# -*- coding: utf-8 -*-
import gettext
from gi.repository import GObject, Peas, Totem # pylint: disable-msg=E0611
import iplayer2
import threading
gettext.textdomain ("totem")
D_ = gettext.dgettext
_ = gettext.gettext
class IplayerPlugin (GObject.Object, Peas.Activatable):
__gtype_name__ = 'IplayerPlugin'
... |
import sys
class Parse:
command = "\n"
line = 0
eof = False
def __init__(self, file_name):
try:
self.f = open(file_name, "r")
except IOError:
print("Could not open {}", f)
exit(1)
def hasMoreCommands(self):
... |
# -*- coding: utf-8 -*-
'''
Tensorflow Implementation of the Scaled ELU function and Dropout
'''
import numbers
import numpy as np
import tensorflow as tf
from tensorflow.contrib import layers
from tensorflow.python.framework import ops
from tensorflow.python.framework import tensor_shape
from tensorflow.python.frame... |
# vi: ts=4 expandtab
#
# Copyright (C) 2012 Canonical Ltd.
# Copyright (C) 2012 Yahoo! Inc.
#
# Author: Scott Moser <scott.moser@canonical.com>
# Author: Joshua Harlow <harlowja@yahoo-inc.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Gene... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-07-03 12:17
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.Crea... |
##############################################################################
##
## This file is part of Sardana
##
## http://www.sardana-controls.org/
##
## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
##
## Sardana is free software: you can redistribute it and/or modify
## it under the terms of the GN... |
import dataclasses
import json
import sys
import tkinter
from tkinter import ttk
from tkinter.font import Font
from typing import List, Optional
import dacite
import pytest
from porcupine import settings
# Could replace some of this with non-global setting objects, but I don't feel
# like rewriting the tests just b... |
from .base import BaseOptions, BaseType
from .field import Field
from .utils import yank_fields_from_attrs
# For static type checking with Mypy
MYPY = False
if MYPY:
from typing import Dict # NOQA
class InterfaceOptions(BaseOptions):
fields = None # type: Dict[str, Field]
class Interface(BaseType):
"... |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2009, Robert Corsaro
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright
# ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.