src stringlengths 721 1.04M |
|---|
from django.conf import settings
from django.utils import translation
from django.utils.functional import cached_property
from django.utils.translation.trans_real import translation as trans_real_translation
from rest_framework import serializers
from rest_framework.schemas import AutoSchema
from rest_framework.views i... |
#!/usr/bin/python
#SYSTEM IMPORTS
import math
import time
import cv2
import Queue
import os
import inspect
import sys
import numpy as np
from copy import copy
#Add script directory to path
script_dir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) # script directory
sys.path.append(script_... |
#!/usr/bin/env python3
#
# Copyright (c) 2015-2017 Nest Labs, 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/lic... |
#!/bin/python
import datetime, logging, platform, pygame, os
from gameglobals import *
# Logging setup
if platform.system() == 'Windows':
# Logging on Windows
logdir = os.path.join(os.getenv('APPDATA'), 'typefight')
else:
# Assume Linux
logdir = os.path.join(os.path.expanduser('~'), '.typefight')
try:... |
import marshal
import subprocess as sub
import os
from inspect import getsource, getargspec
import re
import types
from functools import wraps
from contextlib import contextmanager
import sys
import qsubsettings
from glob import glob
def _globalimports(func):
for name, val in func.__globals__.iteritems():
... |
from .compat import _range
_s2_options = {
'a': ((['a', 't', 'i', 'o', 'n', 'a', 'l'], ['a', 't', 'e']),
(['t', 'i', 'o', 'n', 'a', 'l'], ['t', 'i', 'o', 'n'])),
'c': ((['e', 'n', 'c', 'i'], ['e', 'n', 'c', 'e']),
(['a', 'n', 'c', 'i'], ['a', 'n', 'c', 'e']),),
'e': ((['i', 'z', 'e', 'r... |
from warpnet_client import *
from warpnet_common_params import *
from warpnet_experiment_structs import *
from twisted.internet import reactor
from datetime import *
import time
minTime = 10
pktLen = 1412
pktPeriod = 2000
mod_hdr = 2
mod_payload = 2
txGains = [30, 45, 60];
class ScriptMaster:
def startup(self):
... |
# encoding: utf-8
from GlyphsApp.plugins import *
from math import cos, sin
from glyphmonkey import *
from itertools import izip
from GlyphsApp import LINE
class Comb(FilterWithDialog):
# Definitions of IBOutlets
# The NSView object from the User Interface. Keep this here!
dialog = objc.IBOutlet()
# Text field... |
import socket
def send_data(sock,data):
sock.sendall(data)
def receive_data(sock,size = 4096):
data = bytes()
while size:
recv = sock.recv(size)
if not recv:
raise ConnectionError()
data += recv
size -= len(recv)
return data
def nDigit(s,size):
s = str(s)
if(len(s)<size):
s = '0'*(size-len(s))+s
... |
"""
owtf.shell.interactive
~~~~~~~~~~~~~~~~~~~~~~
The shell module allows running arbitrary shell commands and is critical
to the framework in order to run third party tools. The interactive shell module allows non-blocking
interaction with subprocesses running tools or remote connections (i.e. shells)
"""
import logg... |
import datetime
from flask import render_template, session, url_for, redirect, request, flash, current_app
from . import main
from .forms import NameForm
from .. import db
from ..models import User
from ..email import send_mail
app = current_app
@main.route('/', methods=['GET', 'POST'])
def index():
user_agent ... |
# -*- coding: utf-8 -*-
import constants
__author__ = constants.__author__
__copyright__ = constants.__copyright__
__license__ = constants.__license__
def format(block):
""" Apply formatting to a block. """
wideopeningchars = constants.WIDE_OPENING_CHARS
text = block.gettext()
newtext = []
... |
import base64
import functools
import json
import logging
from django.conf import settings
from django.http import Http404
from django.contrib import messages
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.shortcuts import render, redirect
from django.utils.http import is_safe_url
from karaage.common... |
from functools import wraps
from LambdaQuery.query import *
def asExpr(value):
if isinstance(value, Columns):
if len(value) > 1:
raise TypeError(f"Can't convert Columns with more than one Expr to Expr: {value}")
return value.asExpr()
elif isinstance(value, ConstExpr.allowedTypes):
... |
import tp
import mm
def thing_init(t):
return
def rock_init(name, short_name, tiles=[]):
x = tp.Tp(name)
x.set_is_shadow_caster_soft(True)
x.set_is_shadow_caster(True)
x.set_short_name(short_name)
x.set_is_movement_blocking(True)
x.set_is_rock(True)
x.set_z_depth(mm.Z_DEPTH_ROCK)
... |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
# Copyright (C) 2010-2012 OpenERP s.a. (<http://openerp.com>).
#
# This program is free software: you ca... |
from django.shortcuts import render, redirect
from .models import Post, Comment
from .forms import PostForm, CommentForm
from django.template.context_processors import csrf
from django.utils import timezone
def discuss_index(request):
"""
Display all the discussion threads present in the server. The are put se... |
import os
from shutil import copyfile, copytree
if __name__ == '__main__':
BASE_PATH = '/home/{}/'.format(os.getlogin())
CORE_PATH = "{}.buildscripts/".format(BASE_PATH)
SUB_PATH = "{}/config/".format(CORE_PATH)
install_path = 'config/'
base_files = ('head.html', 'foot.html', 'buildscript.py',
'... |
# Gemini
# https://docs.gemini.com/rest-api/
# By Rick Ramstetter <rick@anteaterllc.com>
from exchange import Exchange, CURRENCY
class Gemini(Exchange):
name = "Gemini"
code = "gemini"
ticker = "https://api.gemini.com/v1/pubticker/"
discovery = "https://api.gemini.com/v1/symbols"
default_label ... |
#
# 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
# ... |
#!/usr/bin/env python
# Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.
import sys
import os.path
import time
import argparse
import logging
import re
import shutil
import math
import random
from collections import Counter
import threading
import Queue
try:
import digits
except ImportError:
... |
#!/usr/bin/env python
import re
import sys
from collections import defaultdict
old="/lscr2/andersenlab/kml436/git_repos2/Transposons2/results_feb/final_results/data_for_figures/T_kin_C_matrix_full.txt"
new="/lscr2/andersenlab/kml436/git_repos2/Transposons2/results/final_results/data_for_figures/T_kin_C_matrix_full.tx... |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2015 Comunitea Servicios Tecnológicos All Rights Reserved
# $Omar Castiñeira Saaevdra <omar@comunitea.com>$
#
# This program is free software: you can redistribute it and/or modify
# it u... |
# Copyright (c) 2015 Cisco 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 law or agreed to i... |
import logging
import unittest
"""CountSemiprimes (https://codility.com/demo/take-sample-test/count_semiprimes/)
Analysis:
- http://codesays.com/2014/solution-to-count-semiprimes-by-codility/#comment-11233
"""
__author__ = 'au9ustine'
logging.basicConfig(format='%(message)s', level=logging.DEBUG)
def sieve(n)... |
from django.shortcuts import render
from django.http import HttpResponse, Http404
from django.db.utils import DatabaseError
from django.core.exceptions import ValidationError
from mozdns.utils import get_zones
from core.search.compiler.django_compile import compile_to_django
from core.search.compiler.django_compile i... |
"""Helper functions and classes for bup."""
from collections import namedtuple
from ctypes import sizeof, c_void_p
from os import environ
from contextlib import contextmanager
import sys, os, pwd, subprocess, errno, socket, select, mmap, stat, re, struct
import hashlib, heapq, math, operator, time, grp, tempfile
from... |
import os
from astropy import units as u
from astropy import wcs
from astropy.coordinates import EarthLocation
from astropy.coordinates import FK5
from astropy.coordinates import SkyCoord
from astropy.io import fits
from astropy.time import Time
from collections import namedtuple
from . import PanBase
from .utils imp... |
#Copyright ReportLab Europe Ltd. 2000-2012
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/platypus/tableofcontents.py
__version__=''' $Id$ '''
__doc__="""Experimental class to generate Tables of Contents easily
This module defines a single... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#...the usual suspects.
import os, inspect
#...for the unit testing.
import unittest
#...for the logging.
import logging as lg
# The wrapper class to test.
from nod import NOD
class TestNOD(unittest.TestCase):
def setUp(self):
pass
def tearDown(self)... |
import requests
import json
from api import send_message
ENDPOINT = "https://public-api.tracker.gg/apex/v1/standard/profile/5/"
PLAYERS = {
14160874: "bertoncio",
16631085: "beartz",
85867003: "R3TCH4",
52451934: "xisteaga",
10549434: "Axasdas123",
123123862: "MeroFabio",
569341... |
# Copyright (c) 2015 Cinchapi Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('restaurant', '0029_cart'),
]
ope... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# --- BEGIN_HEADER ---
#
# benchmark_ro - benchmark read-only access
# Copyright (C) 2003-2011 The MiG Project lead by Brian Vinter
#
# This file is part of MiG.
#
# MiG is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public ... |
#!/usr/bin/python
# pi-timolo - Raspberry Pi Long Duration Timelapse, Motion Detection, with Low Light Capability
# written by Claude Pageau Dec-2014 (original issue)
# getStreamImage function based on utpalc code based on brainflakes lightweight motion detection code on Raspberry PI forum - Thanks
# Complete pi-timol... |
from __future__ import absolute_import
# import apis into api package
from .alliance_api import AllianceApi
from .assets_api import AssetsApi
from .bookmarks_api import BookmarksApi
from .calendar_api import CalendarApi
from .character_api import CharacterApi
from .clones_api import ClonesApi
from .contacts_api import... |
# -*- coding: utf-8 -*-
# Copyright 2020 Green Valley Belgium NV
#
# 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 appl... |
#===============================================================================
# brobot
# Copyright (C) 2010 Michael Keselman
#
# 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... |
from .models import GallerySection, Image, GALLERY_SETTINGS, Thumber
from django.contrib import admin
from django import forms
from django.shortcuts import render
from django.http import HttpResponseRedirect
from django.urls import reverse
try:
from tinymce import widgets as tinymce_widgets
except ImportError:
... |
"""
Print a package.yaml file in package.py format.
"""
from __future__ import print_function
def setup_parser(parser, completions=False):
parser.add_argument(
"PATH", type=str, nargs='?',
help="path to yaml to convert, or directory to search for package.yaml;"
" cwd if not provided")
de... |
# -*- coding: utf-8 -*-
#
# Copyright 2019 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... |
# Copyright 2010 http://www.collabq.com
# Copyright 2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... |
import math
import pygrace
import pygame,os,time,sys
WIDTH=400
HEIGHT=100
size = [WIDTH,HEIGHT]
flags=pygame.SRCALPHA|pygame.HWSURFACE|pygame.HWACCEL
os.environ['SDL_VIDEO_WINDOW_POS'] = '700,100'
screen = pygame.display.set_mode(size,flags)
pygame.display.set_caption("Transmission and reflection")
def xmgrace():
g... |
from ecl.util import BoolVector
from res.enkf.enums import HookRuntime
from res.enkf import ErtRunContext
from ert_gui.simulation.models import BaseRunModel, ErtRunError, EnsembleExperiment
class SingleTestRun(EnsembleExperiment):
def __init__(self, queue_config):
super(EnsembleExperiment, self).__ini... |
'''
Copyright (c) 2016 Genome Research Ltd.
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 rights to
use, copy, modify, merge, publish, distr... |
#!/usr/bin/env python2.7
# Copyright 2016, ARM Limited
# 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 notice,
# this li... |
# -*- coding: utf-8 -*-
"""
Created on Thu Jul 14 21:18:54 2016
@author: charlesgulian
"""
import os
#os.chdir('/Users/annepstein/Work/Deconv')
curr_dir = os.getcwd()
import numpy as np
from astropy.io import fits
import matplotlib.pyplot as plt
import matplotlib
#from photutils import aperture_photometry
#from phot... |
"""hug/exceptions.py
Defines the custom exceptions that are part of, and support
Copyright (C) 2016 Timothy Edmund Crosley
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, i... |
import cvxpy as cp
from cvxpy.reductions.solvers.conic_solvers.scs_conif import \
dims_to_solver_dict
import diffcp
import numpy as np
try:
import tensorflow as tf
except ImportError:
raise ImportError("Unable to import tensorflow. Please install "
"TensorFlow >= 2.0 (https://tensorfl... |
# encoding = utf-8
import random
class PetShop:
"""A pet shop"""
def __init__(self, animal_factory=None):
self.pet_factory = animal_factory
def show_pet(self):
pet = self.pet_factory.get_pet()
print("This is a lovely", pet)
print("It says", pet.speak())
print("It ... |
#! /usr/bin/env python
###############################################################################
import nose
import sys
import io
import random
import os
import glob
import subprocess
import numpy.testing
from mann import agent
here = os.path.abspath(os.path.dirname(__file__))
################################... |
# Copyright 2010 OpenStack Foundation
# Copyright 2011 Piston Cloud Computing, 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.apach... |
#!/usr/bin/env python
'''
Example showing how to read grouped aparc labels from yaml file and plot
grouped connectivity circle with these labels.
Author: Praveen Sripad <pravsripad@gmail.com>
'''
import numpy as np
from jumeg import get_jumeg_path
from jumeg.connectivity import plot_grouped_connectivity_circle
impor... |
# This problem can be really computational expensive if we simply traverse all
# the possible orderings (50! = 3.0414093e+64)
# Instead, we observe that if two adjacent minions(m[i], m[i+1]) in the ordering
# with property(t[i], t[i+1], t is the time the minion takes to complete the
# task) and (p[i], p[i+1], p is prob... |
#!/usr/bin/python
# import our modules
import cwiid
import time
import RPi.GPIO as GPIO
import piconzero as pz
import sensorlibs as sl
from picamera import PiCamera
# setup our camera
cam = PiCamera()
# setup our constants
button_delay = 0.1
PIN_LED = sl.GPIOtoBoard(4)
GPIO.setup(PIN_LED, GPIO.OUT)
GPIO.output(PIN_L... |
#TO RUN: joey2 project_operation_tests.py
import sys
import os
import unittest
import shutil
sys.path.append('../')
import lib.config as config
import lib.mm_util as util
import test_helper as helper
from lib.mm_connection import MavensMatePluginConnection
from lib.mm_client import MavensMateClient
class TestProject... |
"""
images.py
This module, writtn by Kenneth Lambert, supports simple image processing.
The Image class represents either an image loaded from a GIF file or a
blank image.
To instantiate an image from a file, enter
image = Image(aGifFileName)
To instantiate a blank image, enter
image = Ima... |
# Description: create harvested organizations from orgfile.txt
# Author: Shanshan Jiang, last modified 14.12.2016
import json
import urllib
import urllib2
import pprint
print "create organizations"
org_dict = {
'name': 'testagain',
'title': 'test again',
'image_url': ''
}
def create_org(dataset_dict)... |
from navmazing import NavigateToAttribute
from widgetastic.widget import View
from widgetastic_patternfly import Dropdown
from cfme.base.ui import BaseLoggedInPage
from cfme.utils.appliance import Navigatable
from cfme.utils.appliance.implementations.ui import navigator, CFMENavigateStep
from widgetastic_manageiq impo... |
# -*- coding: utf-8 -*-
import os
import sys
import qgis
import qgis.gui
import qgis.utils
from qgis.PyQt import uic, QtCore
try:
from qgis.PyQt.QtGui import (QWidget,QDialog,QMainWindow)
except ImportError:
from qgis.PyQt.QtWidgets import (QWidget,QDialog,QMainWindow)
from PostTelemac.meshlayer.post_telema... |
# Software License Agreement (BSD License)
#
# Copyright (c) 2013, Willow Garage, Inc.
# 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 2011 OpenStack Foundation
# Copyright 2013 IBM Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... |
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 14 14:16:45 2014
%reset -f
%clear
%pylab
%load_ext autoreload
%autoreload 2
@author: isaac
"""
from __future__ import division
import numpy as np
import matplotlib.pyplot as plt
from scipy.interpolate import UnivariateSpline
from scipy.io import loadmat
# setup better... |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'ShortURL'
db.create_table('urlshortener_shorturl', (
(u'id', self.gf('django.db.... |
import mock
import os.path
import unittest
import tempfile
import shutil
import sys
# Python 2.7 does have io.StringIO but StringIO. is more liberal regarding str
# versus unicode inputs to write()
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
from ripe.atlas.tools.commands.bas... |
# -*- coding: utf-8 -*-
# <Lettuce - Behaviour Driven Development for python>
# Copyright (C) <2010-2012> Gabriel Falcão <gabriel@nacaolivre.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 Foundatio... |
import pytest
from pyphi.labels import NodeLabels
@pytest.fixture
def nl():
return NodeLabels(("A", "B", "C"), (0, 1, 2))
def test_defaults():
nd = NodeLabels(None, (0, 1, 2))
assert nd.labels == ("n0", "n1", "n2")
def test_labels2indices(nl):
assert nl.labels2indices(("A", "B")) == (0, 1)
as... |
# Copyright (c) 2016 EMC Corporation.
# 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... |
import os
import datetime
import postgresql
import collections
import utils
import exceptions
from conf import conf
from conf import sf
def __git_describe__():
return utils.callsubprocess('git_describe',
conf.git_describe_cmd, False, True)[0]
def __git_commit__():
return utils.callsubprocess('git_rev_parse',
... |
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
import http.client
import sys
import urllib.parse
if len(sys.argv) < 2:
print ('python nacos-config.py nacosAddr')
exit()
headers = {
'content-type': "application/x-www-form-urlencoded"
}
hasError = False
for line in open('../config.txt'):
pair = line.... |
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
try:
from pypandoc import convert
read_md = lambda f: convert(f, 'rst')
except ImportError:
print("warning: pypandoc module not found, could not convert Markdown to RST")
read_md = lambda f: open(f, 'r').read... |
from bitUtils import *
from bitarray import bitarray
import FA18A_functions
# Semantic Sugar
def opNeedsAddress(op):
return isinstance(op, (jumpOp, nextOp, ifOp, minusIfOp))
def loadNewWordAfterOp(op):
return isinstance(op, (returnOp, executeOp, jumpOp, callOp, nextOp, ifOp, minusIfOp))
# Add the 5 bit of a... |
# -*- coding: utf-8 -*-
#
# manila documentation build configuration file, created by
# sphinx-quickstart on Sat May 1 15:17:47 2010.
#
# 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.
#
# Al... |
import sys, pickle, copy
import numpy as np
import matplotlib.pyplot as pl
import astropy.io.fits as pyfits
import magellanic.regionsed as rsed
import magellanic.mcutils as utils
from magellanic.lfutils import *
try:
import fsps
from sedpy import observate
except ImportError:
#you wont be able to predict... |
from __future__ import absolute_import, unicode_literals
from mopidy import listener, models
class Backend(object):
"""Backend API
If the backend has problems during initialization it should raise
:exc:`mopidy.exceptions.BackendError` with a descriptive error message.
This will make Mopidy print th... |
from collections import defaultdict
class Hash(object):
def __init__(self):
self._data = defaultdict(int)
def hset(self, key, value):
"""
Set ``key`` to ``value`` within hash ``name``
Returns 1 if HSET created a new field, otherwise 0
"""
if key in self._data:... |
import canopen
import sys
import os
import traceback
import time
try:
# Start with creating a network representing one CAN bus
network = canopen.Network()
# Connect to the CAN bus
network.connect(bustype='kvaser', channel=0, bitrate=1000000)
network.check()
# Add some nodes with correspond... |
#!/usr/bin/env python
# Script which test the different filtering thresholds per barcode
# Returns per barcode the detected species which match the criteria
import sys
import os
### Get the OTU abundance from the file (This is per barcode)
def GetOTUabundance(statFile, pOTU):
# Local variables
f = open(statFile)
... |
# Copyright 2007-2009 Owen Taylor
#
# This file is part of Reinteract and distributed under the terms
# of the BSD license. See the file COPYING in the Reinteract
# distribution for full details.
#
########################################################################
import gobject
import gtk
import re
from shell_b... |
# coding: utf-8
# Copyright 2014-2015 Álvaro Justen <https://github.com/turicas/rows/>
#
# 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 yo... |
# -*- coding: utf-8 -*-
import datetime
import re
import pytz
from dateutil import parser
from django.utils import timezone
from nose.tools import * # flake8: noqa
from rest_framework import serializers as ser
from unittest import TestCase
from tests.base import ApiTestCase
from api.base.filters import ListFilte... |
import logging
from base import ActionRunner, ActionManager
from collections import namedtuple
from gevent.pool import Group
from gevent import sleep
from robotActionController.Data.storage import StorageFactory
from robotActionController.Data.Model import Action
class GroupRunner(ActionRunner):
supportedClass = ... |
"""Provides device automations for Kodi."""
from typing import List
import voluptuous as vol
from homeassistant.components.automation import AutomationActionType
from homeassistant.components.device_automation import TRIGGER_BASE_SCHEMA
from homeassistant.const import (
ATTR_ENTITY_ID,
CONF_DEVICE_ID,
CON... |
import os
import re
from pathlib import Path
import pytest
from django.urls import reverse
from rdmo.core.constants import VALUE_TYPE_FILE
from ..models import Project, Value
users = (
('owner', 'owner'),
('manager', 'manager'),
('author', 'author'),
('guest', 'guest'),
('user', 'user'),
('s... |
# Copyright 2019 Microsoft 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 to in wri... |
# Copyright 2016 The Meson development team
# 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 ... |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Profile'
db.create_table(u'cfiweb_profile', (
... |
"""Take a list of files and known star coordinates, and
perform photometry on them all, either with apertures (phot)
or by PSF fitting (daophot, which required additional
parameters and is apropriate to poor S/N or crowded fields).
Makes extensive use of iraf tasks; set all photometry parameters
before running:
datapar... |
# utils.py
#
# Utility functions for use with the CGR-101 USB oscilloscope
import logging # The python logging module
import serial # Provides serial class Serial
import time # For making pauses
from datetime import datetime # For finding calibration time differences
import binascii # For hex string conversion... |
"""This file contains all the configurations for unit testing."""
# Configurations for testing GPIO related functions.
GPIO_CONFIG = {
"VALID_PIN": '0',
"VALID_DIGITAL_WRITE_VALUE": "HIGH",
"INVALID_PIN": "16",
"INVALID_DIGITAL_WRITE_VALUE": "MEDIUM",
"SUCCESS_RESPONSE": '1',
"FAILED_RESPONSE":... |
#
# Copyright (c) SAS Institute Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... |
from django.urls import reverse
from django.shortcuts import redirect, get_object_or_404,render
from django.contrib.auth import authenticate, login, logout, REDIRECT_FIELD_NAME
from django.contrib.auth import get_user_model
from django.contrib.auth.forms import PasswordChangeForm
from django.contrib.auth.views import l... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import blanc_basic_assets.fields
class Migration(migrations.Migration):
dependencies = [
('assets', '__first__'),
]
operations = [
migrations.CreateModel(
name='Recurring... |
# Copyright 2014 Open vStorage NV
#
# 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 writ... |
from common import *
import datetime
import json
import sys
import time
try:
from katello.client.api.system import SystemAPI
except ImportError, e:
print "Please install Katello CLI package."
sys.exit(-1)
class System(SystemAPI):
def __init__(self):
super(System, self).__init__()
def c... |
# -*- coding: utf-8 -*-
# Copyright 2020 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... |
"""A Python3 implementation of the Ant Colony Optimization Meta-Heuristic.
**Pants** provides you with the ability to quickly determine how to
visit a collection of interconnected nodes such that the work done is
minimized. Nodes can be any arbitrary collection of data while the edges
represent the amount of "work" re... |
# import pytest
'''
https://www.testdome.com/questions/python/two-sum/14289?questionIds=14288,14289&generatorId=92&type=fromtest&testDifficulty=Easy
Write a function that, given a list and a target sum, returns zero-based indices of any two distinct elements whose sum is equal to the target sum. If there are no such e... |
#!/usr/bin/env python
from __future__ import with_statement
from basetest import BaseTest
import sys, tempfile, os
from StringIO import StringIO
import unittest, signal
from logging import getLogger, WARN, ERROR
from contextlib import contextmanager
sys.path.insert(0, '..')
os.environ["http_proxy"] = "localhost:8000"... |
'''
Boneh-Franklin Identity Based Encryption
| From: "D. Boneh, M. Franklin Identity-Based Encryption from the Weil Pairing", Section 4.2.
| Published in: Crypto 2003
| Available from: http://.../bfibe.pdf
| Notes: This is the IBE .
* type: encryption (identity-based)
* setting: bilinear groups (as... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.