src stringlengths 721 1.04M |
|---|
import tingbot
from tingbot import *
import urllib2
import json
import time
import datetime
from collections import deque
temperature_str = "n/a"
description_str = ""
icon_str = "icons/na.png"
screen_index = 0
max_screens = 3 # can increase to 4 if log screen is enabled
forecast_list = []
update_time_str = ""
default... |
from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
from flask.json import JSONEncoder
from datetime import date, datetime
import os
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql+pymysql://%s:%s@localhost/csa?charset=utf8' % (
os.environ['CSA_DB_USERNAME'], os.environ['CSA_DB... |
#!/usr/bin/env python
"""
Merge a git hub pull request by its number
Copyright (c) 2015 Tuan-Tu Tran
The MIT License (MIT)
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, in... |
"""Unsupervised EM training for chordclass HMM tagging model.
"""
"""
============================== License ========================================
Copyright (C) 2008, 2010-12 University of Edinburgh, Mark Granroth-Wilding
This file is part of The Jazz Parser.
The Jazz Parser is free software: you can redistr... |
import pkg_resources
pkg_resources.require("ncclient==0.4.3")
from ncclient import manager
import ncclient
#due to ofconfig design problem, it need fill port feature
#but we won't use it currently.
#of-agent nexthop 2 destination user-input-dst-mac ethernet 1/2 vid 2
config_nexthop_ucast_xml="""
<confi... |
from __future__ import division
import json
import sys
import math
import random
#hard coded number of similar stores to spit out since HW said 5, could always add to command line
nSimilarStores = 5
maxBonus = 0.0005
class vectors:
def __init__(self, featureVectorName, multiplier, shopVectors):
self.mult... |
# -*- coding: utf-8 -*-
#
# Amara documentation build configuration file, created by
# sphinx-quickstart on Mon Jul 25 14:58:38 2011.
#
# 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 c... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description from the README file
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = f.r... |
import numpy as np
import numpy.ma as ma
from numpy.ma.testutils import *
import StringIO
import gzip
import os
from tempfile import mkstemp, NamedTemporaryFile
import sys, time
from datetime import datetime
MAJVER, MINVER = sys.version_info[:2]
def strptime(s, fmt=None):
"""This function is available in the d... |
class _DoublyLinkedListBase:
""" A base class providing a doubly linked list representation """
#--------------------------------------------------------------------------------------
#--------------------------------------------------------------------------------------
class _Node:
""" Lightweight, non pu... |
import sys
from ase import *
from ase.parallel import paropen
from ase.data.s22 import data, s22
from ase.calculators.vdwcorrection import vdWTkatchenko09prl
from gpaw import *
from gpaw.cluster import Cluster
from gpaw.analyse.hirshfeld import HirshfeldDensity, HirshfeldPartitioning
from gpaw.analyse.vdwradii import v... |
from zope.interface import Interface, Attribute
class IOAuth2Provider(Interface):
server = Attribute("""oauthlib.oauth2.Server instance""")
class IOAuth2DataProvider(Interface):
def get_client(client_id, *args, **kw):
"""Client getter function.
Accepts one parameter `client_id`, and retur... |
"""
numpy.ma : a package to handle missing or invalid values.
This package was initially written for numarray by Paul F. Dubois
at Lawrence Livermore National Laboratory.
In 2006, the package was completely rewritten by Pierre Gerard-Marchant
(University of Georgia) to make the MaskedArray class a subclass of ndarray,... |
import pygame
import random
pygame.display.set_caption("Multi Bingo")
screen = pygame.display.set_mode((0,0))
screen.fill([0,0,0])
pygame.mouse.set_visible(False)
meter = pygame.image.load('graphics/assets/black_register_cover.png').convert()
odds = pygame.image.load('hawaii_2/assets/odds.png').convert_alpha()
eb = ... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-09-28 14:00
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("events", "0011_notifications_enabled_fields")]
operations = [
migrations.AddField(
... |
from Commands import Commands, Targets, Defaults, Payloads
dd = Defaults.DELIMETER
dt = Defaults.TARGET_DELIMETER
dn = Defaults.NONE
""" COMMANDS TO BE SENT BY ANY """
def createLogin(targetType, roomid = dn ):
playerId = dn
payload = dn
target = dt.join([targetType, roomid, playerId])
msg = dd.join([... |
# Copyright 2014-2019 Tecnativa - Pedro M. Baeza
from odoo import _, api, fields, exceptions, models
def trunc(f, n):
slen = len('%.*f' % (n, f))
return float(str(f)[:slen])
class L10nEsAeatMod130Report(models.Model):
_description = "AEAT 130 report"
_inherit = "l10n.es.aeat.report"
_name = "l1... |
'''Copyright(C): Leaf Johnson 2011
This file is part of makeclub.
makeclub 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 versi... |
from twisted.internet import reactor
import atexit, os
from Hatenatools import TMB
#The database handling flipnote files and info
#this one stores them in plaintext, only works with one server worker
class Database:
def __init__(self):
#read database stuff into memory:
if os.path.exists("database/new_flipnotes.da... |
# -*- coding: utf-8 -*-
import pandas as pd
from rates.models import InterestRateModel
from credit.prepayment import PrepaymentModel
from common.db_manager import DB
from sqlalchemy import select
from sqlalchemy import and_
from sqlalchemy import asc
def vintage_sett_manual(name, forecast, nper, sdate, repricing, rat... |
# -*- coding: utf-8 -*-
from io import BytesIO
from gzip import compress as gzip_compress
from pyramid.decorator import reify
from ines.middlewares import Middleware
class Gzip(Middleware):
name = 'gzip'
def __init__(self, config, application, **settings):
super(Gzip, self).__init__(config, applic... |
import conexion_nmcli
import wpa_decrypt
def wpa_console():
print("\n\x1b[1;37m"+"WPA_Decrypt_Console >>", end="")
comando_WPA_Decrypt = input()
buscar_comandos_WPA_Decrypt(comando_WPA_Decrypt)
def buscar_comandos_WPA_Decrypt(comando):
#Sentencia para escanear redes inalambricas
if comando == "use WPA_De... |
import logging
import httplib2
import json
import os
import hashlib
# This module performs authentication based on the tokens
# issued by Globus Online's Nexus service, see this URL for
# details:
# http://globusonline.github.com/nexus-docs/api.html
#
# Import the Globus Online client libraries, originally
# sourced f... |
from multiprocessing import Process, Queue, Value, RawValue, Lock
import time
class INT():
def __init__(self, n):
self.i = n
self.v = RawValue('i', n)
def increment(self):
self.v.value += 1
self.i += 1
def getV(self):
return self.v.value
def getI(self):
... |
import os
import re
import codecs
from optparse import OptionParser
import ConfigParser
from StringIO import StringIO
def main():
parser = OptionParser("Usage: %prog [options] cfgpath cfgsect "
"catalog-path")
(options, args) = parser.parse_args()
if len(args) < 3:
parser... |
# Copyright (c) 2014-2016 Cedric Bellegarde <cedric.bellegarde@adishatz.org>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later vers... |
"""
Flask Admin App
"""
import os
from flask import Flask, flash, render_template, request
from flask_admin import Admin
from flask_basicauth import BasicAuth
from azure.storage.blob import BlockBlobService, ContentSettings
from storage.models import Database
from storage.secrets import blob_key, blob_accountname, b... |
import datetime
import os
import pytz
import tempfile
from unittest.mock import call, patch
from django.test import override_settings, TestCase
from ditto.core.utils.downloader import DownloadException, filedownloader
from ditto.flickr.factories import AccountFactory, PhotoFactory, UserFactory
from ditto.flickr.fetch... |
# -*- coding: utf-8 -*-
#
# This file is part of EUDAT B2Share.
# Copyright (C) 2016 University of Tuebingen, CERN.
# Copyright (C) 2015 University of Tuebingen.
#
# B2Share 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... |
# vim: ts=4 sw=4 et
# Standard
import json
import os
# Celery
from celery import task
# OpenStack
import keystoneclient.v2_0.client as ksclient
from neutronclient.neutron import client
# Cosmo
from cosmo.events import send_event
# TODO: rename to create()
@task
def provision(__cloudify_id, router, enable_snat=Tru... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import pygame
from pygame.locals import *
import codecs
import os
import random
import struct
import sys
SCR_RECT = Rect(0, 0, 640, 480)
GS = 32
DOWN,LEFT,RIGHT,UP = 0,1,2,3
STOP, MOVE = 0, 1 # 移動タイプ
PROB_MOVE = 0.005 # 移動確率
TRANS_COLOR = (190,179,145) # マップチップの透明色
sou... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2004 - 2014 Detlev Offenbach <detlev@die-offenbachs.de>
#
"""
Eric6 Re.
This is the main Python script that performs the necessary initialization
of the PyRegExp wizard module and starts the Qt event loop. This is a
standalone version of the integrated P... |
__author__ = 'Ivan Dortulov'
class Client(object):
def __init__(self, id):
self.history = ["connect"]
self.name = id
import xml.etree.ElementTree as ET
tree = ET.parse('/home/ivan/Documents/Python/SubTasking/log.xml')
root = tree.getroot()
clients = []
def find_client(id):
for client in cl... |
#!/usr/bin/env python
import ConfigParser
import errno
from gimpfu import register, PF_INT16, pdb, main
from gimpenums import INTERPOLATION_CUBIC
import gimp
import os
def mkdir_p(path):
try:
os.makedirs(path)
except OSError as exc:
if exc.errno == errno.EEXIST and os.path.isdir(path):
... |
"""
ulmo.wof.core
~~~~~~~~~~~~~
This module provides direct access to `CUAHSI WaterOneFlow`_ web services.
.. _CUAHSI WaterOneFlow: http://his.cuahsi.org/wofws.html
"""
from future import standard_library
standard_library.install_aliases()
from builtins import str
import io
import suds.client
import... |
import os
import subprocess
import sys
import time
from contextlib import contextmanager
from typing import Iterator, Optional
# Verify the Zulip venv is available.
from tools.lib import sanity_check
sanity_check.check_venv(__file__)
import django
import requests
MAX_SERVER_WAIT = 180
TOOLS_DIR = os.path.dirname(o... |
"""
kombu.transport.zmq
===================
ZeroMQ transport.
"""
from __future__ import absolute_import
import errno
import os
import socket
try:
import zmq
from zmq import ZMQError
except ImportError:
zmq = ZMQError = None # noqa
from kombu.five import Empty
from kombu.log import get_logger
from kom... |
# -*- coding: utf-8; Mode: Python; indent-tabs-mode: nil; tab-width: 4 -*-
# Copyright (C) 2006 Canonical Ltd.
# Written by Colin Watson <cjwatson@ubuntu.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 Soft... |
# -*- coding: utf-8 -*-
# vim: set fileencodings=utf-8
__docformat__ = "reStructuredText"
import os
import sys
import unittest
from requests.exceptions import ConnectionError
from docker import Client
from docker.utils import kwargs_from_env
from itests import SimpleRunTest, JavaPropertiesTest, \
EnvironmentVa... |
#!/usr/bin/python
#
# Copyright (c) 2016 Sertac Ozercan, <seozerca@microsoft.com>
#
# 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',
... |
from __future__ import unicode_literals
from datetime import datetime, timedelta
from urllib import quote
from django.conf import settings
from django.contrib.auth.models import User
from django.db import transaction
from django.utils import timezone
import requests
import waffle
from celery.task import periodic_tas... |
from swandns.modules.blacklist import BlackListResolverModule
import ipcalc
def WhiteListResolverModule(BlackListResolverModule):
'''
The WhiteListResolverModule is a module which will hold 2 white lists of ips (one for ipv4 & one for ipv6).
The module implements white list from a lists of networks provid... |
import matplotlib.pyplot as plt
import models.model as model
import earthquake.catalog as catalog
from collections import OrderedDict
def histogramMagnitude(catalog_, region):
"""
Creates the histogram of magnitudes by a given region.
Saves the histogram to the follwing path ./code/Zona2/histograms/'+regio... |
#Made by Andre Augusto Leite de Almeida
import os
import random
import collections
from PIL import Image, ImageDraw
from numpy import array
from skimage import img_as_float
from skimage.measure import compare_ssim
#Fast, but supports only one image on template
class Basic_Meme:
def __init__(self,folder):
... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
#scikit-bio/skbio/diversity/alpha/_ace.py
#Greg Caporasogregcaporaso on Aug 7, 2014 API: moved base.py to _base.py
#!/usr/bin/env python
# ----------------------------------------------------------------------------
# Copyright (... |
# -*- coding: utf-8 -*-
import sys
import sqlite3
import json
import getopt
import os
from core.util.base_util import BaseUtil
reload(sys)
sys.setdefaultencoding('utf8')
class Updcookie(BaseUtil):
@staticmethod
def get_settings():
return dict(
descr = "Update the value of a cookie of saved requests",
op... |
# -*- coding: utf-8 -*-
"""
Collect all the tables and column types relevant for django_tables2 here.
"""
import unicodedata
import django_tables2
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.utils.html import escape, format_html
from django.utils.safestring im... |
# -*- coding: utf-8 -*-
import mock
import socket
import ssl
import unittest
from SevpnMgmtPy.cedar import Session, Watermark
class TestSession(unittest.TestCase):
def test_start_rpc_session(self):
ba = bytearray('\xab\xcd\xef')
hello_pack = mock.MagicMock()
hello_pack.get_va... |
#
# Copyright 2014 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 ... |
# This file is part of MSMTools.
#
# Copyright (c) 2015, 2014 Computational Molecular Biology Group
#
# MSMTools 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 the License, or
# (a... |
import codecs
import re
from os import path
from setuptools import setup, find_packages
def read(*parts):
filename = path.join(path.dirname(__file__), *parts)
with codecs.open(filename, encoding='utf-8') as fp:
return fp.read()
def find_version(*file_paths):
version_file = read(*file_paths)
... |
"""
Counter class for py2.6 back compat.
<http://code.activestate.com/recipes/576611/>
"""
from operator import itemgetter
from heapq import nlargest
from itertools import repeat, ifilter
class Counter(dict):
'''Dict subclass for counting hashable objects. Sometimes called a bag
or multiset. Elements are st... |
#!/usr/bin/env python
# Copyright (c) 2013 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.
import os
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
... |
"""SConsAddons.Options.CppUnit
Defines options for the CppUnit project
"""
#
# __COPYRIGHT__
#
# This file is part of scons-addons.
#
# Scons-addons 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... |
import sys
from test import list_tests
import pickle
import unittest
class ListTest(list_tests.CommonTest):
type2test = list
def test_basic(self):
self.assertEqual(list([]), [])
l0_3 = [0, 1, 2, 3]
l0_3_bis = list(l0_3)
self.assertEqual(l0_3, l0_3_bis)
self.assertTrue(l... |
#!/usr/bin/python2
import os, sys
import getopt, datetime
import platform
#automatyczne przeliczenie wartosci od Bajtow w gore
def GetHumanReadable(size,precision=2):
suffixes=['B','KB','MB','GB','TB']
suffixIndex = 0
while size > 1024 and suffixIndex < 3:
suffixIndex += 1 #increment the index of ... |
# -*- coding: utf-8 -*- #
# Copyright 2011 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 o... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# LICENSE
#
# Copyright (c) 2010-2017, GEM Foundation, G. Weatherill, M. Pagani,
# D. Monelli.
#
# The Hazard Modeller's Toolkit is free software: you can redistribute
# it and/or modify it under the terms of the GNU Affero Gene... |
#!/usr/bin/env python
"""
NamesOfGod
Version para Python 2
"""
__author__ = "Jose Miguel Garrido"
__copyright__ = "(C) 2016 Jose Miguel Garrido"
"""
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, e... |
"""
Test geo utils.
"""
from qgis.core import QgsCoordinateTransform
from ThreeDiToolbox.tests.utilities import ensure_qgis_app_is_initialized
from ThreeDiToolbox.utils.geo_utils import get_coord_transformation_instance
import pytest
@pytest.fixture
def rdnew_to_wgs84():
ensure_qgis_app_is_initialized()
src... |
# -*- coding: utf-8 -*-
#
# Django Autoslug documentation build configuration file, created by
# sphinx-quickstart on Tue Jul 21 22:35:51 2009.
#
# 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.... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
##
# bsf_decomp.py: Decomposes binary symplectic matrices into circuits.
##
# © 2012 Christopher E. Granade (cgranade@gmail.com) and
# Ben Criger (bcriger@gmail.com).
# This file is a part of the QuaEC project.
# Licensed under the AGPL version 3.
##
# This program is free ... |
#!/usr/bin/env python3
# Copyright (c) 2015-2017 The Bitcoin Unlimited developers
# Copyright (c) 2014-2015 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
import test_framework.loginit
# Test emergent c... |
# -*- encoding: utf-8 -*-
##############################################################################
#
# Croc Bauges - Print Product module for Odoo
# Copyright (C) 2015-Today GRAP (http://www.grap.coop)
# @author Sylvain LE GAL (https://twitter.com/legalsylvain)
#
# This program is free software: you c... |
# 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 ... |
"""
Contains a Flask-based webserver in charge of presenting a website and
collected data to users connected via a webbrowser.
"""
__version__ = (0, 0, 1)
from .app import app
from .config import DevelopmentConfig, ProductionConfig
from flask_debugtoolbar import DebugToolbarExtension
def run_dev():
"""
Ru... |
from django.core.urlresolvers import reverse # reverse_lazy
from django.utils.translation import ugettext as _ # , ungettext
from django.utils.text import capfirst # , get_text_list
from django.contrib import messages
from django.views import generic
from django.http import HttpResponseRedirect, JsonResponse # , Ht... |
# 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... |
# -*- coding: utf-8 *-*
# Copyright (c) 2013 Tisserant Pierre
#
# This file is part of Dragon dice simulator.
#
# Dragon dice simulator 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 ve... |
# 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 ... |
from resources.lib.handler.requestHandler import cRequestHandler
#from t0mm0.common.net import Net
from resources.lib.parser import cParser
from resources.lib.config import cConfig
from resources.hosters.hoster import iHoster
import urllib, urllib2,re
import xbmcgui
try: import json
except: import simplejson as jso... |
from unittest import TestCase
from mfp.mfp_app import MFPApp
from mfp.patch import Patch
from mfp.scope import NaiveScope
def setup():
MFPApp().setup()
def mkproc(case, init_type, init_args=None):
return MFPApp().create(init_type, init_args, case.patch, None, init_type)
class DSPObjectTests (TestCase):
... |
from django.conf import settings
import math
from django.core.exceptions import PermissionDenied
from django.shortcuts import render, redirect
class Pager:
def __init__(self, page, count):
if page is None or int(page) < 1:
page = 1
else:
page= int(page)
self.curr... |
"""
Copyright (C) 2004-2015 Pivotal Software, Inc. All rights reserved.
This program and the accompanying materials are made available under
the terms of the 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
... |
from reload import fixup
fixup(0)
from physmath.units import parse_unit as pu
from physmath.physnum import parse_physical_number as ppn
from physmath.convert import convert, convert_factor
from physmath.annotator import annotator
from physmath import layout
import browsemath.client
reload(browsemath.client)
from bro... |
# coding: utf-8
import abc
class AbstractConfig(object): # pragma: no cover
__metaclass__ = abc.ABCMeta
def __init__(self, sandbox=False):
self.sandbox = sandbox
@classmethod
def get(self, key, default=None):
return getattr(self, key, default)
@abc.abstractproperty
def BASE... |
"""
svdcut.py --- Correlations and SVD Cuts
This code illustrates the use of SVD cuts when calculating
correlations using random samples. See the Case Study in the
documentation for more information.
"""
from __future__ import print_function
import numpy as np
import gvar as gv
try:
# may not be installed, in wh... |
import json
settings_json = json.dumps([
{'type': 'title',
'title': 'Base title'},
{'type': 'numeric',
'title': 'Startup volume',
'desc': 'Default volume at boot',
'section': 'Base',
'key': 'startupvolume'},
{'type': 'path',
'title': 'Media path',
'desc': 'Path to the mus... |
# -*- coding: utf-8 -*-
#!/usr/bin/python
import argparse, datetime, glob, os
from mate import parsing, createNonExistingFolders
from retokenisation import retokeniser
from conll import makeEmpty
memory="40G"
def parseFile(infile, lemodel, tagmodel, parsemodel, folderpref="mate/parses/"):
timestamp=datetime.datetime... |
# -*- coding: utf-8 -*-
# Script for creating different kind of indexes in a small space as possible.
# This is intended for testing purposes.
from tables import *
class Descr(IsDescription):
var1 = StringCol(itemsize=4, shape=(), dflt='', pos=0)
var2 = BoolCol(shape=(), dflt=False, pos=1)
var3 = Int32Co... |
# Copyright 2012 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... |
# Copyright 2010 OpenStack LLC.
# 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 b... |
import multiprocessing
import os
from typing import Union
import torchvision
from torch.utils.data import DataLoader, ConcatDataset, Subset
from torchvision import transforms
from root import from_root
from src.misc.utils import read_lines
DATA_DIRPATH = from_root("data/svhn")
SPLIT_DIRPATH = from_root("splits/svhn"... |
# Copyright 2013 Devsim LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... |
"""
The :mod:`sklearn.feature_extraction.image` submodule gathers utilities to
extract features from images.
"""
# Authors: Emmanuelle Gouillart <emmanuelle.gouillart@normalesup.org>
# Gael Varoquaux <gael.varoquaux@normalesup.org>
# Olivier Grisel
# Vlad Niculae
# License: BSD 3 clause
fro... |
import string
from datetime import datetime
import Tkinter as tk
import ttk
import tkFont
import webbrowser
import socket
import src.lib.fileHandler as fileHandler
import src.lib.twitchHandler as twitchHandler
from src.lib.irc import irc as irc_
from src.lib.variables import global_variables
from src.lib.gui_bots... |
# ===============================================================================
# Copyright 2011 Jake Ross
#
# 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... |
# -*- coding: utf-8 -*-
import pytest
from insert_sort import insert_sort
def test_sorted():
my_list = list(range(100))
insert_sort(my_list)
assert my_list == list(range(100))
def test_reverse():
my_list = list(range(100))[::-1]
insert_sort(my_list)
assert my_list == list(range(100))
def t... |
# coding: utf-8
import hashlib
import time
from mongodb_migrations.base import BaseMigration
class Migration(BaseMigration):
def upgrade(self):
"""
Add default bookmark to every user
:return:
"""
user_ids = [str(i['user']) for i in self.db.bookmark.find()]
users =... |
"""
Example showing how to communicate with an EQ-99 Manager from Energetiq.
"""
import time
from msl.equipment import (
EquipmentRecord,
ConnectionRecord,
Backend,
)
record = EquipmentRecord(
manufacturer='Energetiq',
model='EQ-99',
connection=ConnectionRecord(
address='COM6', # upda... |
#
# Copyright (c) 2008-2015 Citrix Systems, 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 l... |
#!/usr/bin/python
#
# Generates synthetic recipe domains.
# RUNS ON PYTHON 3.x, not 2.7
# GENERAL DIRECTIONS
# 1. Plate items down
# * Cup, bowl, cakemix
# 2. Pour cakemix into bowl
# 3. Mix bowl
# 4. Place oil bottle
# 5. pour oil bottle into mixing bowl
# 6. MIX
# 7. Place 1-2 more bowls, pour and mix
#
# So we ma... |
import sys
import json
import math
THRESHOLD = 10
data = []
with open(sys.argv[1], "r") as f:
used = count = 0
for line in f:
if line[0] == "#":
continue
items = line.split()
if items[1] == "TPV":
obj = json.loads(" ".join(items[2:-1]))
obj['used'] =... |
#!/usr/bin/env python
# From https://code.google.com/p/minidns
import sys
import socket
import fcntl
import struct
# DNSQuery class from http://code.activestate.com/recipes/491264-mini-fake-dns-server/
class DNSQuery:
def __init__(self, data):
self.data=data
self.domain=''
tipo = (ord(data[2]) >> 3) & ... |
# vim:fileencoding=utf-8:ts=2:sw=2:expandtab
from . import CSSList as CSSList_Class
from . import JSList as JSList_Class
def BaseLayout(*,
JSList = None, # AppStruct.UI.JSList instance
CSSList = None, # AppStruct.UI.CSSList instance
Title = None, # Page ... |
from django.shortcuts import render, get_object_or_404
from django.utils.decorators import method_decorator
from django.contrib.auth.decorators import login_required, user_passes_test
from django.views.generic import View
from ..models import (
Student,
Gewicht,
Platz,
Zeitraum,
)
class StudentDetail... |
import ctypes, sys
from ctypes import windll, wintypes
from uuid import UUID
class GUID(ctypes.Structure): # [1]
_fields_ = [
("Data1", wintypes.DWORD),
("Data2", wintypes.WORD),
("Data3", wintypes.WORD),
("Data4", wintypes.BYTE * 8)
]
def __init__(self, uuid_):
... |
#! /usr/bin/env python
# ==========================================================================
# Computes the PHA spectra for source/background and ARF/RMF files using the
# reflected region method
#
# Copyright (C) 2017-2021 Luigi Tibaldo
#
# This program is free software: you can redistribute it and/or modify
# ... |
# -*- coding: utf-8 -*-
# Copyright (c) 2016 Ericsson AB
#
# 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 ... |
# Copyright 2020 Makani Technologies LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.