text stringlengths 12 6.59M |
|---|
"""
A very simply autopilot designed to simplify testing of planes by providing an
existing framework for getting a plane in the air.
"""
from .io import Protocol
from . import packets
class TakeOffMixin:
_take_off_state = None
_take_off_heading = None
def take_off(self):
self.take_off_started()... |
import numpy as np
from numpy.testing import assert_array_equal
from nose.tools import (assert_equal, assert_raises, raises, assert_true,
assert_false)
try:
from nose.tools import assert_is
except ImportError:
from landlab.testing.tools import assert_is
from landlab import RasterModel... |
"""Lens training + nearest neighbors classification pipeline."""
import os
import sys
sys.path.insert(1, 'google_research/')
import flax
from flax import nn
from flax.training import checkpoints
import jax
from jax import random
import jax.numpy as jnp
from jax.config import config
config.enable_omnistaging()
impo... |
from __future__ import division
from __future__ import print_function
import plotly.graph_objs as go
import cea.plots.demand
from cea.plots.variable_naming import LOGO, COLOR, NAMING
class EnergySupplyIntensityPlot(cea.plots.demand.DemandPlotBase):
name = "Energy Supply Intensity"
def __init__(self, project... |
import os
import pika
import time
from flask import Flask
from flask import request
from flask_sqlalchemy import SQLAlchemy
db_path = 'sqlite:///' + os.path.join(os.path.dirname(__file__), 'flask_db.db')
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = db_path
app.config['SQLALCHEMY_TRACK_MO... |
"""
pghoard - list and restore basebackups
Copyright (c) 2016 Ohmu Ltd
See LICENSE for details
"""
from . import common, config, logutil, version
from .patchedtarfile import tarfile
from .postgres_command import PGHOARD_HOST, PGHOARD_PORT
from concurrent import futures
# ignore pylint/distutils issue, https://github.c... |
"""
Solar vertical insolation algorithm based on ArcGIS Solar Analyst
"""
from __future__ import division
from cea.interfaces.arcgis.modules import arcgisscripting
import datetime
import os
from cea.interfaces.arcgis.modules import arcpy
import ephem
import numpy as np
import pandas as pd
from simpledbf import Dbf5
... |
#
# Virtuozzo containers hauler module
#
import logging
import os
import shlex
import subprocess
import util
import pycriu.rpc_pb2
import criu_api
import criu_cr
import fs_haul_ploop
vz_global_conf = "/etc/vz/vz.conf"
vz_conf_dir = "/etc/vz/conf/"
vzctl_bin = "vzctl"
cgget_bin = "cgget"
cgexec_bin = "cgexec"
vz_... |
#!/usr/bin/env python
# coding=utf-8
import re
import time
import urllib
import urllib2
import datetime
from modules.scheduler import RunOnce
from modules.scheduler import Scheduler
from modules.scheduler import every_x_mins
from modules.scheduler import every_x_secs
djangoUrl = 'http://phenny.venefyxatu.be/'
schedu... |
# coding=utf-8
from __future__ import print_function
from flask import Flask, url_for, request, Response, current_app, Blueprint, safe_join, send_from_directory, make_response, send_file
from werkzeug.exceptions import NotFound, BadRequest, HTTPException, default_exceptions
from werkzeug.routing import BaseConverter
... |
import os
import logging
LOGGER = logging.getLogger(__name__)
def includeme(config):
# settings = config.registry.settings
LOGGER.debug('Adding storage ...')
config.include('pyramid_storage')
config.add_route('download_storage', 'download/storage/{filename:.*}')
config.add_route('upload', 'uploa... |
##########################################################################
#
# Copyright 2011 Jose Fonseca
# All Rights Reserved.
#
# 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 res... |
from __future__ import division
import numpy as np
import six
def eval_detection_voc(
bboxes, labels, scores, gt_bboxes, gt_labels, n_class,
gt_difficults=None,
minoverlap=0.5, use_07_metric=False):
"""Calculate detection metrics based on evaluation code of PASCAL VOC.
This function ... |
"""
CallbackResolver service module
"""
import codecs
import os
import re
from collections import OrderedDict
from django.http import HttpResponse
from django.http.request import HttpRequest
from django.views.generic import TemplateView
from django.views.decorators.csrf import csrf_exempt
from rinzler.core.route_mapp... |
""" Execution engine """
import gzip
import os
import time
import botocore
import csv
import json
import pickle
import logging
import six
from base64 import b64encode
from botocore.exceptions import ClientError
from decimal import Decimal
from dynamo3 import (TYPES, DynamoDBConnection, DynamoKey, LocalIndex,
... |
from django.conf.urls.defaults import *
from models import Gallery, Photo
# galleries
gallery_args = {'date_field': 'pub_date', 'allow_empty': True, 'queryset': Gallery.objects.filter(is_public=True)}
urlpatterns = patterns('django.views.generic.date_based',
url(r'^gallery/(?P<year>\d{4})/(?P<month>[a-z]{3... |
import types
import sys
import shutil
import codecs
import tempfile
class JSTolkenizer(object):
LINETERMINATOR = (u'\u000A',u'\u000D',u'\u2028',u'\u2029')
STRING_WHITESPACE = 'WHITESPACE'
STRING_LINETERMINATOR = 'LINETERMINATOR'
STRING_IDENTIFIER = 'IDENTIFIER'
STRING_PUNCTUATOR = 'PUNCTUATOR'
... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2005 Edgewall Software
# Copyright (C) 2005 Christopher Lenz <cmlenz@gmx.de>
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://trac.edgew... |
import re
REFERENCE_TEXT = "all work and no play makes jack a dull boy"
#==== Tokens: ========================================================
class Token:
def __eq__(self, other):
return (isinstance(other, self.__class__)
and self.__dict__ == other.__dict__)
def __ne__(self, other): retur... |
#!/usr/bin/env python
# PYTHON_ARGCOMPLETE_OK
import argparse
import os
import logging
import mpmath
from sympy import (nsolve, symbols, Mul, Add, chebyshevt, exp, simplify,
chebyshevt_root, Tuple, diff, plot, N, solve, together, Poly)
from sympy.utilities.decorator import conserve_mpmath_dps
logger = logging.g... |
"""
DVC config objects.
"""
import os
import configobj
from schema import Schema, Optional, And, Use, Regex
from dvc.exceptions import DvcException
class ConfigError(DvcException):
""" DVC config exception """
def __init__(self, msg, ex=None):
super(ConfigError, self).__init__('Config file error: {}'... |
import errno
import logging
import os
import platform
import shutil
import sys
from dvc.compat import fspath
from dvc.exceptions import DvcException
logger = logging.getLogger(__name__)
if (
platform.system() == "Windows"
and sys.version_info < (3, 8)
and sys.getwindowsversion() >= (6, 2)
):
try:
... |
import sys, time
try:
import json
except ImportError:
try:
import simplejson as json
except ImportError:
sys.exit("Could not find json or simplejson libraries.")
if sys.version_info[0] == 2:
from httplib import HTTPConnection, HTTPSConnection
from urllib import pathname2url
... |
#!/ms/dist/python/PROJ/core/2.5.0/bin/python
# ex: set expandtab softtabstop=4 shiftwidth=4: -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# $Header$
# $Change$
# $DateTime$
# $Author$
# Copyright (C) 2008 Morgan Stanley
#
# This module is part of Aquilon
"""Contains the logic for `aq show domain --domain`."""
f... |
"""A container for a PICO-8 game, and routines to load and save game files."""
__all__ = [
'DEFAULT_VERSION',
'Game',
'InvalidP8HeaderError',
'InvalidP8SectionError'
]
import os
import re
import tempfile
from .. import util
from ..lua.lua import Lua
from ..lua.lua import PICO8_LUA_CHAR_LIMIT
from ..lu... |
from django.conf.urls.defaults import patterns, include
from devilry.apps.jsapp.views import create_app_urls
urlpatterns = patterns('devilry_subjectadmin',
('rest/',include('devilry_subjectadmin.rest.urls')),
*create_app_urls(appname='devilry_subjectadmin',
... |
# -*- coding:utf8 -*-
######################## BEGIN LICENSE BLOCK ########################
# This library 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 2.1 of the License, or (at you... |
# coding=utf-8
"""
Port of the ganglia gearman collector
Collects stats from gearman job server
#### Dependencies
* gearman
"""
import diamond.collector
import os
import subprocess
import time
try:
import gearman
except ImportError:
gearman = None
class GearmanCollector(diamond.collector.Collector):
... |
"""Pika specific exceptions"""
class AMQPError(Exception):
def __repr__(self):
return 'An unspecified AMQP error has occurred'
class AMQPConnectionError(AMQPError):
def __repr__(self):
if len(self.args) == 1:
if self.args[0] == 1:
return ('No connection could be o... |
#! /usr/bin/env python3
import yaml
from voluptuous import Schema, Optional, Any, All, Range, Length, Coerce
from .pinetree import Promoter, Terminator, Polymerase, Genome, Mask, Reaction, Simulation, SpeciesReaction, Bind, SpeciesTracker, seed
class Parser:
"""
A class to parse and validate simulation input... |
"""Copyright 2013 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 agreed to in ... |
# -*- coding: utf-8 -*-
from sys import float_info
import math
from math import ldexp
from pint.roundmode import roundmode
'''
# Calculate addition, subtraction, multiplication, division and root with rounding mode.
# using exsample
from pint import roundfloat as rf
from pint import roundmode as rdm
# Calculate 0.25... |
import sys, inspect
from django.http import (HttpResponse, Http404, HttpResponseNotAllowed,
HttpResponseForbidden, HttpResponseServerError)
from django.views.debug import ExceptionReporter
from django.views.decorators.vary import vary_on_headers
from django.conf import settings
from django.core.mail import send_ma... |
from __future__ import (
unicode_literals,
absolute_import,
print_function,
division,
)
from io import BytesIO
import io
import traceback
import os
from uuid import UUID, uuid4
import sys
import datetime
import weakref
from .utils import (
read_u8,
read_u16le,
read_u32le,
write_u8,
... |
#!/usr/bin/python
#
# aamporter.py
# Tim Sutton
#
# Utility to download AAM 2.0 and higher (read: CS5 and up) updates from Adobe's updater feed.
# Optionally import them into a Munki repo, assuming munkiimport is already configured.
#
# See README.md for more information.
import logging
import optparse
import os
impor... |
from flask import Flask, flash, render_template, request, redirect, session, url_for
from planigale import Question, Species, Planigale, PlanigaleGame, PlanigaleConsole
import os
app = Flask(__name__)
app.secret_key = os.urandom(24)
def get_new_session():
global curr_session
curr_session += 1
def get_sess... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from time import time
import os.path
import numpy as np
from numpy.linalg import inv
from scipy.ndimage import median_filter, gaussian_filter, map_coordinates
from .bas... |
# Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# 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 appli... |
import uuid
import json
import os
import webbrowser
import six
from plotly.io._utils import validate_coerce_fig_to_dict
from plotly.offline.offline import _get_jconfig, get_plotlyjs
from plotly import utils
# Build script to set global PlotlyConfig object. This must execute before
# plotly.js is loaded.
_window_plo... |
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that ... |
#!/usr/bin/python
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed... |
import sublime
from .headings import all_headings
from .view import MdeTextCommand, MdeViewEventListener
ST4 = int(sublime.version()) > 4000
def folded_region(view, region):
for i in view.folded_regions():
if i.contains(region):
return i
return None
def first_unfolded_selection(view):
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (c) 2013 Shaun Zinck <shaun.zinck at gmail.com>
# Copyright (c) 2015 Lawrence Leonard Gilbert <larry@L2G.to>
#
# Written by Shaun Zinck
# Based on pacman module written by Afterburn <http://github.com/afterburn>
# that was based on apt module written by Matthew Wi... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2017, Ansible Project
# 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',
... |
#!/usr/bin/python
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distribut... |
# IDA plugin for identifying ROP gadgets in Linux MIPS binaries.
#
# Return Oriented Programming in Linux MIPS is more like Jump Oriented Programming; the idea is to
# control enough of the stack/registers in order to control various jumps. Since all instructions
# in MIPS must be 4-byte aligned, you cannot "create" ne... |
# (c) 2013, seth vidal <skvidal@fedoraproject.org> red hat, inc
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your optio... |
import unittest
class Plugin:
def __init__(self, channel, password, target="NiceBot"):
self.channel = channel
self.password = password
self.target = target
def on_join(self, bot, msg):
if self.channel == msg["channel"] and msg["is_me"]:
bot.send(self.target, self.p... |
'''
A KBase client that dynamically configures itself on request to call
local KBase SDK methods.
This client is currently in the proof-of-concept stage.
This client is not concurrency-safe. Do not rely on environment variables
for initializing tokens or callback URLs if running in a threaded or concurrent
programming ... |
import datetime
import ircbot.plugin
import tweepy
from ircbot import cfg
class TwitterPlugin(ircbot.plugin.Plugin):
SPAM_THROTTLE = 10
def __init__(self, bot, channel):
super().__init__(bot, channel)
self.cfg = cfg.get('twitter_api')
if not self.cfg:
raise RuntimeError('twitter_api missing from config')
... |
import plugintypes
import sys
sys.path.append('./plugins')
from py3owm import OpenWeatherMap
class WeatherPlugin(plugintypes.TelegramPlugin):
"""
Weather
"""
patterns = [
"^!weather (.*)"
]
usage = [
"!weather <zip code>|<city>"
]
def activate(self):
if not ... |
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not ... |
import logging
import numpy as np
from numpy.linalg import norm
from qrsim.tcpclient import UAVControls
from scipy.optimize import fmin_l_bfgs_b
from nputil import GrowingArray, meshgrid_nd
logger = logging.getLogger(__name__)
class VelocityTowardsWaypointController(object):
def __init__(self, maxv, max_climb,... |
from __future__ import print_function
import argparse
import sys
import pm
from multiprocessing.pool import ThreadPool as Pool
from pm.console import blue_print, green_print, red_print, cyan_print
from pm.projects import list_projects
def build_parser():
parser = argparse.ArgumentParser(description='')
pa... |
import numpy as np
import web
import random
import time
import util.str_util as str_util
from data import gen_docs
ITERATIONS = 5
# takes in a list of lists of commands which should be executed in order
def policy_gradient(command_documents, start_url = "http://localhost:8000"):
theta = np.zeros(len(web.Action.FE... |
from datetime import datetime
import iso8601
from flask import Blueprint, jsonify, request, current_app
from app.config import QueueNames
from app.dao.dao_utils import dao_save_object
from app.dao.templates_dao import dao_get_template_by_id_and_service_id
from app.dao.users_dao import get_user_by_id
from app.dao.broa... |
import pandas as pd
import numpy as np
class Developer:
def __init__(self, feasibility):
"""
Pass the dataframe that is returned by feasibility here
"""
self.feasibility = feasibility
@staticmethod
def max_form(f, colname):
"""
Assumes dataframe with hiera... |
import sys, os.path, threading, inspect, re, weakref, textwrap
from pony.utils import read_text_file, is_ident, decorator, decorator_with_params, get_mtime
try: from pony import _templating
except ImportError: pass
try: real_stdout
except NameError: real_stdout = sys.stdout
class Html(unicode):
def _... |
from portality.core import app
from portality.lib import plugin
import os, shutil, boto3
from urllib.parse import quote_plus
class StoreException(Exception):
pass
class StoreFactory(object):
@classmethod
def get(cls, scope):
"""
Returns an implementation of the base Store class
"... |
import unittest
import time
import glob
import sys
import threading
import tempfile
import signal
import logging
from os.path import abspath, dirname, join, exists, curdir
from os import chdir
from robot import run, rebot
from robot.model import SuiteVisitor
from robot.running import namespace
from robot.utils import ... |
import unittest
from StringIO import StringIO
import time
from robot import utils
from robot.utils.asserts import *
from robot.output.filelogger import FileLogger
from robot.utils.robottime import TimestampCache
class _FakeTimeCache(TimestampCache):
def __init__(self):
self.fake = time.mktime((2006, 6,... |
from django.shortcuts import render
from django.contrib.auth.decorators import login_required
from django.http import HttpResponseRedirect
from django.core.urlresolvers import reverse
from django.db.models import Q
from postermap.models import Poster
from ticketing.models import Production
from core.models import User
... |
# Copyright 2011,2012 James McCauley
#
# 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 ... |
# coding: utf-8
import logging
from contextlib import contextmanager
from datetime import datetime
from sqlalchemy import (
create_engine, Column, Integer, String,
Float, Date, DateTime, SmallInteger, Boolean,
ForeignKeyConstraint
)
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm... |
# coding=utf-8
# Copyright 2022 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... |
#!/usr/bin/env python3
import os
import sys
import fsquery
import path_utils
import prjrenamer
def pad_with_zeroes_left(num_in_str, amount):
if len(num_in_str) > amount:
return num_in_str
while amount - len(num_in_str) != 0:
num_in_str = "0" + num_in_str
return num_in_str
def is_std_cpp_... |
"""Pressure Layout classes"""
__all__ = ['Layout']
CONST_PHI = (1+5**0.5)/2.0 # Golden ratio
class LayoutChild(object):
"""A container for an arbitrary element.
Attribute values are measured in pixels.
Attributes
----------
element : mixed
Contained element that this represent
x :... |
# -*- coding: utf-8 -*-
# Copyright © 2014 Chris “Kwpolska” Warrick and others.
# 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 limitation
# the rig... |
import collections
import copy
from contextlib import contextmanager
import json
import os
import uuid
import requests
from requests_toolbelt.multipart.encoder import MultipartEncoder, MultipartEncoderMonitor
import semantic_version
def not_implented_in_v2(func):
def wrapper(*args, **kwargs):
raise NotImp... |
import sys
import scipy as sp
import numpy as np
import matplotlib as mpl
import pandas as pd
import sklearn as skl
from erlport.erlterms import Atom
# simple return sys version
def version():
return sys.version
# descriptive stats over a dataframe
# this is used with a dynamical assignment since
# data frame wil... |
#!/usr/bin/env python
# standard library imports
import os
import sys
import logging
import re
import hashlib
import time
import traceback
import os.path
import datetime
import shutil
#import sqlite3
#try:
# import cPickle as cPickle
#except:
# import pickle as cPickle
from string import digits
from stri... |
#!/usr/bin/env python
"""
# Copyright 2017 Matt Settles
# Created June 8, 2017
"""
from optparse import OptionParser
import sys
import os
import time
import glob
import errno
from subprocess import Popen, PIPE, STDOUT
import string
from collections import Counter
import numpy
def median(lst):
return numpy.median(... |
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 28 12:54:12 2014
@author: Kyle Ellefsen
"""
from __future__ import (absolute_import, division,print_function, unicode_literals)
from future.builtins import (bytes, dict, int, list, object, range, str, ascii, chr, hex, input, next, oct, open, pow, round, super, filter, ma... |
"""
clipocr1.py
Demonstrates a technique that often improves ocr quality on screen captures.
Reads an image from the system clipboard,
and prints text recognized in the image, by using tesseract OCR.
The technique is based on judicious rescaling of image dimensions.
SIDE EFFECT:
Creates imag... |
#!/usr/bin/env python3
import activate
activate.activate()
import sys
from sys import stdout
from time import sleep
import serial
DEBUG = False
def bb(*args):
return bytes(args)
def program(name):
s = serial.Serial('/dev/ttyACM0', baudrate=9600)
def r(*args, **kwargs):
xx = s.read(*args,... |
import os
import re
import logging
import datetime
from datetime import date
from dateutil.relativedelta import relativedelta
from itertools import product,chain
import pandas as pd
import numpy as np
from drain import util, data
from drain.util import merge_dicts, hash_obj
# AggregateSeries consist of a series and... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2015, 2016, 2017 Guenter Bartsch
#
# This program 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
# (at ... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# This module is also sponsored by E.T.A.I. (www.etai.fr)
# 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_versio... |
import tensorflow as tf
import tensorflow.contrib.rnn as rnn
import tensorflow.contrib.layers as layers
from vae import vae
from transformer import transformer
from gumbel import gumbel_softmax_binary
class AIRModel:
def __init__(self, input_images, target_num_digits,
max_steps=3, max_digits=2,... |
"""Strptime-related classes and functions.
CLASSES:
LocaleTime -- Discovers and/or stores locale-specific time information
TimeRE -- Creates regexes for pattern matching string of text containing
time information as is returned by time.strftime()
FUNCTIONS:
firstjulian -- Calculates the Ju... |
import ast
from epydoc import docparser
from pyty_errors import VariableTypeUnspecifiedError
from pyty_types import PytyMod, PytyStmt, PytyInt, PytyBool
"""
Location for main typechecking function. Will probably import lots of
functions from parser.py.
"""
int_type = PytyInt()
bool_type = PytyBool()
def parse_type_... |
"""
Reads in the annotations and images for the PASCAL data format.
Example usage:
>>> p = PascalDataset(".")
>>> for anotation in p.annotations():
... im = p.image(annotation.image)
... do_something(im, annotation)
"""
from vision import Box
import os
import Image
import logging
from xml.etree import Elemen... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import argparse
import math
import numpy
import pickle
from PIL import Image
"""
./eigenimage.py ./img/train-png/*-[123]*.png
"""
def get_k_limit(sigma):
klimit = 1
last_eigenvalue = 0
eigenvalues = numpy.nditer(sigma, flags=['f_index'])
while not eigenval... |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# 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 ... |
from flask import request
from flask_mail import Message
from project import app
from project.tasks.mail import celery_send_mail
def get_message(title, body, recipients, attachment_name=None,
attachment_type=None, attachment=None):
msg = Message(title, recipients=recipients)
msg.body = body
... |
"""
Individual pages
"""
from dominate import document
from dominate.tags import *
from pyteaser import SummarizeUrl
from flask import (
Blueprint,
g,
render_template)
analytics = Blueprint('analytics', __name__)
urls = [
'http://www.wired.com/',
'http://www.nytimes.com/',
'http:... |
from collections import namedtuple
from .util import StateDict
from .exceptions import NoSuchPlug
Conn = namedtuple('Conn', 'cable,plug')
def connect(recieving, recieving_j, dest, dest_j):
if recieving_j not in recieving.connections:
raise NoSuchPlug(recieving_j, recieving.name, recieving.ttype)
re... |
"""Workers
Worker components used to perform "work" in independent threads or
processes. Worker(s) are typically used by a Pool (circuits.core.pools)
to create a pool of workers. Worker(s) are not registered with a Manager
or another Component - instead they are managed by the Pool. If a Worker
is used independently i... |
# Module: wsgi
# Date: 6th November 2008
# Author: James Mills, prologic at shortcircuit dot net dot au
"""WSGI Components
This module implements WSGI Components.
"""
import warnings
from urllib import unquote
from traceback import format_exc
from circuits import handler, Component
from circuits.lib.io imp... |
# Copyright 2015, Province of British Columbia
# License: https://github.com/bcgov/ckanext-bcgov/blob/master/license
version = '1.6.5'
|
# Use states for animation
# States come from entity / Animation set
# Entities have a list of animations?
# Prehab sets of animations
class Animation(object):
def __init__(self):
pass
def draw(self, surface, tick):
pass
|
# -*- coding: utf-8 -*-
# Copyright: Damien Elmes <anki@ichi2.net>
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import urllib
import os
import sys
import gzip
import random
from cStringIO import StringIO
import httplib2
from anki.db import DB
from anki.utils import ids2str, intTime, ... |
"""base.py: HasProperties class and Instance, Union, and List props"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import json
import pickle
from warnings import warn
from six import integer_types
from six import ... |
from django.db import models
#from ybase.avatars import enumerable_variant_upload
enumerable_variant_upload = ''
# Create your models here.
# Enumerable
class EnumerableProperty(models.Model):
fullname = models.CharField(max_length=255)
description = models.TextField(blank=True, null=True)
class Meta:
... |
from sys import exit
import pros.common.ui as ui
import pros.conductor as c
from .common import *
@pros_root
def upload_cli():
pass
@upload_cli.command(aliases=['u'])
@click.option('--target', type=click.Choice(['v5', 'cortex']), default=None, required=False,
help='Specify the target microcontro... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""General-purpose tools shared across linting checks."""
import os
import shelve
import inspect
import functools
import re
import hashlib
def memoize(f):
"""Cache results of computations on disk."""
path_of_this_file = os.path.dirname(os.path.realpath(__file__))... |
from django.conf.urls import patterns, include, url
#from django.contrib import admin
#admin.autodiscover()
urlpatterns = patterns('',
# Example:
(r'^$','activitytree.views.welcome'),
(r'^welcome/$','activitytree.views.welcome'),
(r'^dashboard/(?P<uri>\w(\/*)+)$','activitytree.views.dashboar... |
from django.conf.urls import *
from django.contrib.auth.decorators import permission_required
from django.core.paginator import Paginator
from django.shortcuts import get_object_or_404, render
from .models import Protocol, Institution
from .forms import ProtocolForm, TopicFormSet, AttendanceForm
from members.models im... |
from client import exceptions as ex
from client.sources.common import core
from client.utils import auth, format
from client.protocols.grading import grade
import client
import collections
import glob
import importlib
import json
import logging
import os
import textwrap
log = logging.getLogger(__name__)
CONFIG_EXTENS... |
import signal
import asyncio
from pprint import pprint
from collections import defaultdict, Counter
from .proxy import Proxy
from .judge import Judge, judgesList
from .checker import ProxyChecker
from .negotiators import BaseNegotiator
from .utils import log, set_my_ip, IPPortPatternLine
from .providers import ProxyP... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.