content stringlengths 4 20k |
|---|
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('job', '0020_auto_20161110_1517'),
]
operations = [
migrations.AlterField(
model_name='taskupdate',
n... |
"""HOOMD simulation format."""
import itertools
import operator
import warnings
from collections import namedtuple
import numpy as np
import parmed as pmd
import mbuild as mb
from mbuild.utils.conversion import RB_to_OPLS
from mbuild.utils.io import import_
from mbuild.utils.sorting import natural_sort
from .hoomd_s... |
#!/usr/bin/env python3
"""
Top 100 most starred GitHub projects grouped by topic description.
Visualized as a interactive 3D pie chart in HTML 5 hosted on GitHub Pages
using Google Charts JavaScript library.
"""
from datetime import datetime, timedelta
import time
from lxml import html
import requests
from pandas_d... |
__author__ = 'marvinsmith'
# Python Libraries
import curses, logging
# --------------------------------- #
# - Base Window Type - #
# --------------------------------- #
class Base_Window_Type(object):
# Window Title
window_title = ''
# Window render screen
screen = None
# Cur... |
from __future__ import print_function
import random
from raffle import Raffle
from cheats import Cheat
try: # Python 2 compatibility
input = raw_input
except NameError:
pass
class MultipleChoice(object):
def __init__(self):
self.actions = {}
self.reset_action_bags()
def reset_acti... |
"""Test functions for the sparse.linalg.interface module
"""
from __future__ import division, print_function, absolute_import
from functools import partial
from itertools import product
import operator
import pytest
from pytest import raises as assert_raises
from numpy.testing import assert_, assert_equal
import num... |
from typing import Dict, List, Tuple
from mypy_extensions import TypedDict
from django.db.models.query import QuerySet
from zerver.models import (
Recipient,
Stream,
Subscription,
UserProfile,
)
def get_active_subscriptions_for_stream_id(stream_id: int) -> QuerySet:
# TODO: Change return type to Q... |
# -*- coding: utf-8 -*-
import unittest
import asyncio
import datetime
import aschedule
class TestEveryFunction(unittest.TestCase):
_multiprocess_shared_ = True
def setUp(self):
self.loop = asyncio.get_event_loop()
self.schedule = None
self.count = 0
self.count_max = 5
... |
# -*- coding: utf-8 -*-
"""
Defines the unit tests for the
:mod:`colour.models.rgb.transfer_functions.sony_slog` module.
"""
import numpy as np
import unittest
from colour.models.rgb.transfer_functions import (
log_encoding_SLog, log_decoding_SLog, log_encoding_SLog2,
log_decoding_SLog2, log_encoding_SLog3, l... |
import os
import shutil
import avocado
from avocado import Test
from avocado.utils import process, memory, distro, pmem, disk, partition
from avocado.utils.software_manager import SoftwareManager
class MemoHog(Test):
"""
Hogs up memory to sepcified size
:avocado: tags=memory
"""
@avocado.fail_on... |
import os
from configman import Namespace
import poster
import requests
from socorro.external.crashstorage_base import CrashStorageBase
poster.streaminghttp.register_openers()
def parse_urls(url_string):
"""Return urls to POST to
:arg string url_string: the "urls" config value
:returns: list of url ... |
import distutils
import os as O
import sys as S
import shutil
import numpy as N
import ctypes.util
import sys
#If prefix is set, we want to allow installation in a directory that is not on PYTHONPATH
#and this is only possible with distutils, not setuptools
if str(sys.argv[1:]).find("--prefix") == -1:
from setupto... |
DEFAULT_OPENOFFICE_PORT = 8100
import uno
from os.path import abspath, splitext
from com.sun.star.beans import PropertyValue
from com.sun.star.connection import NoConnectException
FAMILY_PRESENTATION = "Presentation"
FAMILY_SPREADSHEET = "Spreadsheet"
FAMILY_TEXT = "Text"
FAMILY_BY_EXTENSION = {
"odt": FAMILY_TEX... |
# -*- coding: utf-8 -*-
import logging
if __name__ == '__main__':
logging.basicConfig()
_log = logging.getLogger(__name__)
# Undeclared XML namespace
import pyxb.binding.generate
import pyxb.binding.datatypes as xs
import pyxb.utils.domutils
from xml.dom import Node
import os.path
xsd='''<?xml version="1.0" encod... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import tic_tac_toe.game as game
def test_create_initial_state():
assert game.create_initial_state() == [1, 2, 3, 4, 5, 6, 7, 8, 9]
assert game.create_initial_state() is not game.create_initial_state()
def test_is_valid_move():
assert game.is_valid_move(['X'... |
import sys, gc
__author__ = 'Tom Ming'
class ListNode:
def __init__(self, data=None, pred=None, succ=None):
self.data = data
self.pred = pred
self.succ = succ
def insert_as_pred(self, e):
"""插入前驱节点,存入被引用对象e,返回新节点位置"""
x = ListNode(e, self.pred, self)
self.pred... |
#!/usr/bin/python
import atexit
import exceptions
import pexpect
import sys
import time
sys.path.append("/usr/share/fence")
from fencing import all_opt
from fencing import atexit_handler
from fencing import check_input
from fencing import fence_action
from fencing import fence_login
from fencing import process_input
... |
import logging
import typing
from typing import Any, Dict, List, TypeVar
from PyQt5 import QtCore
from noisicaa import core
from noisicaa import music
from .qtyping import QGeneric
logger = logging.getLogger(__name__)
if typing.TYPE_CHECKING:
QObjectMixin = QtCore.QObject
else:
QObjectMixin = object
OBJEC... |
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
int_or_none,
parse_duration,
)
class RtlNlIE(InfoExtractor):
IE_NAME = 'rtl.nl'
IE_DESC = 'rtl.nl and rtlxl.nl'
_VALID_URL = r'''(?x)
https?://(?:(?:www|static)\.)?
(?:
... |
import hashlib
import os
from parso._compatibility import FileNotFoundError, is_pypy
from parso.pgen2.pgen import generate_grammar
from parso.utils import split_lines, python_bytes_to_unicode, parse_version_string
from parso.python.diff import DiffParser
from parso.python.tokenize import tokenize_lines, tokenize
from ... |
import os
import subprocess
import sys
import shutil
import argparse
def build(root):
os.chdir(os.path.join(root,"source"))
subprocess.check_call("make clean",shell=True)
subprocess.check_call("make", shell=True)
def finalize(root, install_path):
bin_dir = os.path.join(install_path,"bin")
inc_dir = os.path.join(... |
from __future__ import print_function
import pickle
import os.path
from googleapiclient.discovery import build
from google_auth_oauthlib.flow import InstalledAppFlow
from google.auth.transport.requests import Request
# If modifying these scopes, delete the file token.pickle.
SCOPES = ['https://www.googleapis.com/auth/... |
import numpy as np
from numpy.testing import assert_equal, assert_raises
from scipy import sparse
from sklearn.utils.testing import assert_less
from sklearn.linear_model import LinearRegression, RANSACRegressor
# Generate coordinates of line
X = np.arange(-200, 200)
y = 0.2 * X + 20
data = np.column_stack([X, y])
#... |
from fabric.api import *
from fabric.api import env, put, run, sudo, task, cd, settings, prefix, shell_env
from fabric.contrib.files import exists
import time
from aws.ec2_operations import *
from aws.s3_operations import *
@task
def keys(access_key, secret_key):
"""
fab aws_ops.keys:access_key='*****',secret... |
import os
import os.path
import sys
sys.path.insert(0, os.path.abspath('lib'))
from ansible.release import __version__, __author__
try:
from setuptools import setup, find_packages
except ImportError:
print("Ansible now needs setuptools in order to build. Install it using"
" your package manager (us... |
import unittest
import core
import flask
import tasks
from unittest import mock
import auth
@mock.patch.object(tasks.import_data, 'run', autospec=True)
class DataImportTestCase(unittest.TestCase):
API_URL = '/api/v0'
@classmethod
def setUpClass(cls):
core.celery.conf['CELERY_ALWAYS_EAGER'] = True... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from abc import ABCMeta
import json
from os.path import exists, join
import re
from bundlewrap.exceptions import BundleError
from bundlewrap.operations import run_local
from bundlewrap.items import BUILTIN_ITEM_ATTRIBUTES, Item
from bundlewrap.items.file... |
import os
import re
import sys
import urllib
import urllib2
from django.template.loader import render_to_string
from django.conf import settings
from file_system import File
from subprocess import check_call, CalledProcessError
class TemplateProcessor:
@staticmethod
def process(resource):
try:
... |
import pytest
from cylc.flow.platforms import platform_from_name, platform_from_job_info
from cylc.flow.exceptions import PlatformLookupError
PLATFORMS = {
'desktop[0-9]{2}|laptop[0-9]{2}': {
'batch system': 'background'
},
'sugar': {
'hosts': 'localhost',
'batch system': 'slurm',
... |
"""
Utility functions for link prediction
Most code is adapted from authors' implementation of RGCN link prediction:
https://github.com/MichSchli/RelationPrediction
"""
import numpy as np
import torch
import dgl
#######################################################################
#
# Utility function for building... |
import requests
import xml.etree.ElementTree as ET
import ast
import sched, time
import exceptions
######REGISTER DEVICE######
def register(objId):
url = "http://localhost:8080/Entre/resources/api/thermostat/register"
data = { 'objectId': objId }
r = requests.post(url, data=data)
response = r.json()
... |
"""
Utility methods for url download, file extraction,
data padding and parsing, testing, etc.
Also, all third-party submodules are located under this module.
"""
from __future__ import print_function
from six import iteritems
def print_text_box(text):
"""Prints a simple text box.
Parameters
---------... |
"""RNN Cells and additional RNN operations. See @{$python/contrib.rnn} guide.
@@RNNCell
@@BasicRNNCell
@@BasicLSTMCell
@@GRUCell
@@LSTMCell
@@LayerNormBasicLSTMCell
@@LSTMStateTuple
@@MultiRNNCell
@@LSTMBlockWrapper
@@DropoutWrapper
@@EmbeddingWrapper
@@InputProjectionWrapper
@@OutputProjectionWrapper
@@DeviceWrapper
... |
class SQLRole(object):
"""Define a "role" within a SQL statement structure.
Classes within SQL Core participate within SQLRole hierarchies in order
to more accurately indicate where they may be used within SQL statements
of all types.
.. versionadded:: 1.4
"""
class UsesInspection(object):
... |
import re
from pprint import pprint
from queue import Queue
import yaml
from netmiko import (
ConnectHandler,
NetMikoAuthenticationException,
NetMikoTimeoutException,
)
def parse_cdp(output):
regex = (
r"IP address: (?P<ip>\S+)\n"
r".*?"
r"Interface: (?P<local_port>\S+), +"
... |
#!/usr/bin/env python
import os
import sys
from setuptools import setup
if "install" in sys.argv: # If we are running python setup.py install
sys.stdout.write("""
We are installing IRIS. Please wait...
""")
# Do all apt-get stuff here
# End apt-get stuff
readme = open('README.rst', 'r') # Put... |
from gbpservice.nfp.core import controller
from gbpservice.nfp.core import poll
import os
from oslo_log import log as logging
import time
LOG = logging.getLogger(__name__)
class Handler_Class(poll.PollEventDesc):
def __init__(self, sc):
self._sc = sc
self.counter = 0
self.timer = 0
d... |
'''
Clone Python implementation of Kivy Launcher from kivy/kivy-launcher repo,
install deps specified in the OPTIONS['apk']['requirements'] and put it
to a dist named OPTIONS['apk']['dist-name'].
Tested with P4A Dockerfile at 5fc5241e01fbbc2b23b3749f53ab48f22239f4fc,
kivy-launcher at ad5c5c6e886a310bf6dd187e992df97286... |
from ._constants import BLANK_LINE, BLANK_LINES
connectionprofile_used = "Preparing to connect using connection profile:" + BLANK_LINE + "%r"
err_extender_pre_connect = "Extender exception raised on_pre_connect."
err_extender_session_start = "Extender exception raised on_session_start."
err_extender_session_stop = "E... |
"""Run static analysis over the specified stb-tester python scripts.
"stbt lint" runs "pylint" with the following additional checkers:
* E7001: The image path given to "stbt.match" (and similar functions)
does not exist on disk.
* E7002: The return value from is_screen_black, match, match_text, ocr,
press_and_wai... |
import logging
from web3 import Web3
from web3._utils.events import get_event_data
from django_ethereum_events.models import MonitoredEvent
logger = logging.getLogger(__name__)
class Decoder:
"""Event log decoder.
Attributes:
watched_addresses (list): List of contract addresses, in hexstring form,... |
"""GPS position model."""
from auvsi_suas.models import distance
from django.db import models
class GpsPosition(models.Model):
"""GPS position consisting of a latitude and longitude degree value."""
# Latitude in degrees
latitude = models.FloatField()
# Longitude in degrees
longitude = models.Flo... |
import functools
import inspect
import logging
import time
from concurrent.futures import CancelledError
from types import TracebackType
from typing import Any, AsyncContextManager, Collection, Optional, Tuple, Type
import idb.common.plugin as plugin
from grpclib.const import Status
from grpclib.exceptions import GRPC... |
"""This code example gets all roles. This sample can be used to determine which
role id is needed when getting and creating users."""
__author__ = '<EMAIL> (Jeff Sham)'
# Locate the client library. If module was installed via "setup.py" script, then
# the following two lines are not needed.
import os
import sys
sys.p... |
from django.http import StreamingHttpResponse
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from agir.events.models import Event
from ..actions import events_to_csv_lines
def export_events(modeladmin, request, queryset):
response = StreamingHttpResponse(
events... |
import collections
import json
import logging
import pickle
import sys
import time
import mpld3
import numpy
from matplotlib import pyplot as pyplot
from sklearn import metrics
from sklearn.cluster import KMeans, MiniBatchKMeans
from sklearn.decomposition import TruncatedSVD
from sklearn.feature_extraction.text import... |
#!/usr/bin/env python
print "\nProcessing..."
import os
import glob
try:
import numpy as np # Numeric calculation
import pandas as pd # General purpose data analysis library
import squeak # For mouse data
except:
raise Exception("\
Whoops, you're missing some of the dependencies you need to run this... |
import numpy as np
import fluidfoam
from pylab import matplotlib, mpl, figure, subplot, savefig, show
import matplotlib.gridspec as gridspec
from analytic_coulomb2D import analytic_coulomb2D
#
# Change fontsize
#
matplotlib.rcParams.update({'font.size': 20})
mpl.rcParams['lines.linewidth'] = 3
mpl.rcParams['lines.mark... |
import logging
from django import forms
from chatterbox.utils.facebook import activity_from_dict
from . import (Collector, maybe)
log = logging.getLogger(__name__)
class FacebookUserForm(forms.Form):
user_id = forms.CharField(label='User ID', max_length=100)
class FacebookWall(Collector):
form = FacebookU... |
import six
from django.urls import reverse
from django.utils.functional import lazy
from django.utils.translation import ungettext
from oioioi.base.utils import make_navbar_badge
from oioioi.contests.utils import can_enter_contest, is_contest_basicadmin
from oioioi.questions.utils import unanswered_questions
from oioi... |
import re
from definition_items import DefinitionItem
from line_functions import is_empty, get_indent, fix_backspace, NEW_LINE
underline_regex = re.compile(r'\s*\S+\s*\Z')
#------------------------------------------------------------------------------
# Classes
#----------------------------------------------------... |
"""
Runs PowerView on a remote system, piping the output to
a specific result file.
Default behavior is Invoke-NetView, cmdlet and arguments can be specified.
See PowerView's README.md for all options:
https://github.com/Veil-Framework/Veil-PowerView/blob/master/README.md
Note: this needs to be run under a dom... |
__author__ = 'Xplore'
# Cyberaom brute force Script
import urllib
import time
import datetime
import urllib2
import sys
import xml.dom.minidom as XML
trst = {}
userid=[]
start=int(raw_input("Enter the starting Roll:"))
end=int(raw_input("Enter the last Roll:"))
for s in range(start,end+1):
userid.append(s)
filen... |
import logging
from collections import OrderedDict
from ginga.table import AstroTable
from ginga.misc import Callback, Settings
from ginga.misc import Bunch
class TableViewBase(Callback.Callbacks):
"""An abstract base class for displaying tables represented by
astropy table objects.
Parameters
-----... |
from flask import Flask
from time import sleep
from threading import Timer
from datetime import time, datetime
import RPi.GPIO as GPIO
relay = 2
GPIO.setmode(GPIO.BCM)
GPIO.setup(relay, GPIO.OUT)
state = {"lights": True}
GPIO.output(relay, state["lights"])
alarmTime = time(10)
app = Flask(__name__)
@app.route('/')
d... |
"""
Newseye
convert
<TextRegion id="r_11_separator" custom="readingOrder {index:17;} structure {type:separator;}">
<Coords points="126,574 1282,574 1282,592 126,592"/>
</TextRegion>
into
<Separator id="r_11_separator" >
<Coords points="126,574 1282,574 1282,592 12... |
def install(*args, **kwargs):
ZWSP = u"" # ZERO WIDTH SPACE, basically an invisible space separator
import __builtin__
__builtin__.__dict__['_'] = lambda x: x + ZWSP
__builtin__.__dict__['ngettext'] = lambda one, more, n: one + ZWSP if n == 1 else more + ZWSP |
import re
import os
import configparser
import sys
from pprint import pprint
from grabber.containers import SearchInfo, PostInfo
class BooruParser_(object):
def __init__(self, booru):
if booru == 'sankaku':
import grabber.parsers.sankaku as booru_module
# from kiririn_main.parse... |
## \file
## \ingroup tutorial_dataframe
## \notebook
## Read data from RDataFrame into Numpy arrays.
##
## \macro_code
## \macro_output
##
## \date December 2018
## \author Stefan Wunsch (KIT, CERN)
import ROOT
from sys import exit
# Let's create a simple dataframe with ten rows and two columns
df = ROOT.RDataFrame(1... |
#logical_part.py
import re
from pymomo.pcb import reference
def convert(arg, **kwargs):
if arg is None:
return None
if isinstance(arg, Part):
return arg
elif isinstance(arg, dict):
return Part(**arg)
raise ValueError("Creating a logical_part from any type other than a Part object is not supported")
def ... |
#!/usr/bin/env python
import numpy as np
import edrlib
def worked_example_1():
print("Worked example 1")
print("")
#obtain raw data from ASCII file
rawdata = np.array([line.split( ) for line in open("example1_radardata_ascii.txt")])
rawdata = rawdata[20:368]
rawdata = np.array([[float(item) f... |
"""This script is used to synthesize generated parts of this library."""
import synthtool as s
import synthtool.gcp as gcp
import logging
AUTOSYNTH_MULTIPLE_COMMITS = True
logging.basicConfig(level=logging.DEBUG)
gapic = gcp.GAPICBazel()
common = gcp.CommonTemplates()
v1_library = gapic.php_library(
service='k... |
"""The gcloud app modules group."""
from googlecloudsdk.calliope import base
class Modules(base.Group):
"""View and manage your App Engine modules.
This set of commands can be used to view and manage your existing App Engine
modules. To create new deployments of modules, use {parent_command} deploy.
"""
... |
import mock
from collections import defaultdict
from searx.engines import fdroid
from searx.testing import SearxTestCase
class TestFdroidEngine(SearxTestCase):
def test_request(self):
query = 'test_query'
dic = defaultdict(dict)
dic['pageno'] = 1
params = fdroid.request(query, dic... |
"""Commit message editor support."""
from __future__ import absolute_import
import codecs
import os
from subprocess import call
import sys
from bzrlib import (
cmdline,
config,
osutils,
trace,
transport,
ui,
)
from bzrlib.errors import BzrError, BadCommitMessageEncoding
from bzrlib.hooks ... |
from base64 import b64encode
import mock
import json
from ec2stack.helpers import read_file, generate_signature
from . import Ec2StackAppTestCase
class SnapshotTestCase(Ec2StackAppTestCase):
def test_create_snapshot(self):
data = self.get_example_data()
data['Action'] = 'CreateSnapshot'
... |
import numpy as np
import nengo
import nengo.old_api as nef
from nengo.tests.helpers import SimulatorTestCase, unittest
class TestNode(SimulatorTestCase):
def test_simple(self):
params = dict(simulator=self.Simulator, seed=123, dt=0.001)
# Old API
net = nef.Network('test_simple', **para... |
import json
from collections import namedtuple
from django.core.paginator import EmptyPage, Paginator
from django.http import Http404, HttpResponse
from django.utils.cache import patch_cache_control, patch_vary_headers
from django.views.generic import View
from mimeparse import MimeTypeParseException, best_match
Attr... |
'''
Short URL Generator
===================
Python implementation for generating Tiny URL- and bit.ly-like URLs.
A bit-shuffling approach is used to avoid generating consecutive, predictable
URLs. However, the algorithm is deterministic and will guarantee that no
collisions will occur.
The URL alphabet ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: delo
# @Date: 2014-02-18 00:12:46
# @Email: <EMAIL>
# @Last modified by: delo
# @Last modified time: 2014-02-19 23:44:23
import weibo
from mputils import sub_dict, rs
class WeiboApi(object):
def __init__(self, appkey, appsecret, callback, token, expir... |
"""Solving matrix games with LP solver."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from absl import app
from open_spiel.python.algorithms import lp_solver
import pyspiel
def main(_):
# lp_solver.solve_zero_sum_matrix_game(pyspiel.load_matrix_gam... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
if sys.argv[-1] == 'publish':
os.system('python setup.py sdist upload')
sys.exit()
readme = open('README.rst').read()
history = open('HISTORY.rst... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'home1.0.ui'
#
# Created by: PyQt5 UI code generator 5.8.2
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Dialog(object):
def setupUi(self, Dialog):
Dialog.setObjectN... |
import logging
from django.conf import settings
from django.http import HttpResponse
from django.http.request import validate_host
from django.utils.http import is_safe_url
from httplib import HTTPConnection
from urlparse import urlsplit
from geonode.geoserver.helpers import ogc_server_settings
logger = logging.getLog... |
"""stack.py - a simple stack
stack functionality on input ^stack\s+(push\s.*|pop|xray)" """
from moobot_module import MooBotModule
handler_list = ["stack"]
class stack(MooBotModule):
def __init__(self):
""" stack functionality on input ^stack\s+(push\s.*|pop|xray\s\d+)" """
self.regex="^stack\s+(push\s.*|po... |
# -*- coding: utf-8 -*-
import datetime
import json
from operator import itemgetter
import unittest
from bson.objectid import ObjectId
from auto_api.mongodb import admin
from .. import BaseTest, MoviesTest
class TestGetResource(MoviesTest):
def test_get_not_created(self):
response = self.app.get('/%s/a... |
import logging
from fuel_agent_ci.objects import Object
LOG = logging.getLogger(__name__)
class Vm(Object):
__typename__ = 'vm'
def __init__(self, env, name, boot=None):
self.env = env
self.name = name
self.interfaces = []
self.disks = []
self.boot = boot or 'hd'
... |
#!/usr/bin/python
import math
import ephem
import sys, getopt
# Astronomical dawn or dusk is when the Sun is >18deg below horizon
# For the Moon 5deg should(?) be OK
# Also, MOON_MAX_ALT could be a function of moon.phase so that
# we get a more extended nightfall duration when a cresent moon rises/sets
MOON_MAX_ALT ... |
"""Script to test database capabilities and the DB-API interface.
It tests for functionality and data integrity for some of the basic data types. Adapted from a script
taken from the MySQL python driver.
"""
import random
import time
from math import fabs
import pytz
from snowflake.connector.dbapi import DateFromTi... |
import os
import sys
import unittest
import tempfile
import json
from app import app
from ast import literal_eval
class AppTestCase(unittest.TestCase):
def setUp(self):
app.testing = True
self.app = app.test_client()
def tearDown(self):
pass
def test_home_endpoint(self):
"""
Teste que le endpoint "/... |
#coding:utf8
import os
import logging
from conf.config import SITE_ROOT
class LogManager(object):
def __init__(self, logFile="", logLevel=0, logTree=""):
logFile = SITE_ROOT+"/log/" + logFile
try:
self.logger = self._configLogger(
logFile=logFile, logLevel=logLevel, lo... |
import time
from datetime import datetime
from django.conf import settings
from django.contrib.auth.models import User
from django.db import models, connection
from django.template.defaultfilters import striptags
from django.utils.text import truncate_words
from django.utils.translation import ugettext_lazy as _
from ... |
# -*- coding: utf-8 -*-
"""
Created on Fri Apr 21 16:39:41 2017
/**
* Initializes and re-scales a Phoenix LTE spherical reference model of
* Teff=4250K, log(g)=2.0, [Fe/H]=0.0, xi=1.0 km/s, l=1.0H_p, M=1M_Sun, R=6.4761e+10cm
*
* @author Ian
*/
@author: ishort
"""
import math
import ToolBox
im... |
import threading
import socketserver
class Handler(object):
def __init__(self):
self.__client_address = None
self.__request = None
def handle(self, server=None):
pass
@property
def request(self):
return self.__request
@request.setter
def request(self, reques... |
import os
import sys
import argparse
import numpy as np
import theano.tensor as T
homepath = os.path.join('..', '..')
if not homepath in sys.path:
sys.path.insert(0, homepath)
from dlearn.models.layer import FullConnLayer, ConvPoolLayer
from dlearn.models.nnet import NeuralNet
from dlearn.utils import actfuncs, ... |
"""
Main abstraction layer for retrieving and storing information about disk
images used by the compute layer.
"""
from nova.image import glance
class API(object):
"""Responsible for exposing a relatively stable internal API for other
modules in Nova to retrieve information about disk images. This API
a... |
import json
from django.conf import settings
from rest_framework import views
from rest_framework.response import Response
from rest_framework import status
from email_devino.client import DevinoClient
from email_devino.client import DevinoException
from core import models
from core import consts
from core import se... |
__author__ = 'Tom Schaul, Sun Yi, Tobias Glasmachers'
from pybrain.tools.rankingfunctions import HansenRanking
from pybrain.optimization.distributionbased.distributionbased import DistributionBasedOptimizer
from pybrain.auxiliary.importancemixing import importanceMixing
from scipy.linalg import expm2
from scipy impor... |
"""library_add_progress_dialog.py - Progress bar for the library."""
import gtk
import pango
from mcomix import labels
_dialog = None
# The "All books" collection is not a real collection stored in the library,
# but is represented by this ID in the library's TreeModels.
_COLLECTION_ALL = -1
class _AddLibraryProgre... |
"""MNE software for MEG and EEG data analysis."""
# PEP0440 compatible formatted version, see:
# https://www.python.org/dev/peps/pep-0440/
#
# Generic release markers:
# X.Y
# X.Y.Z # For bugfix releases
#
# Admissible pre-release markers:
# X.YaN # Alpha release
# X.YbN # Beta release
# X.YrcN # Rele... |
#encoding: utf-8
import urllib,urllib2
from urlparse import urlparse
import datetime
import re
import logging
import os
from BeautifulSoup import BeautifulSoup
from HTMLParser import HTMLParseError
from django.core.files.base import ContentFile
from django.contrib.contenttypes.models import ContentType
from links.mo... |
from .rest import RestClient
class ClientGrants(object):
"""Auth0 client grants endpoints
Args:
domain (str): Your Auth0 domain, e.g: 'username.auth0.com'
token (str): Management API v2 Token
telemetry (bool, optional): Enable or disable Telemetry
(defaults to True)
... |
import proto # type: ignore
from google.ads.googleads.v6.resources.types import billing_setup
__protobuf__ = proto.module(
package="google.ads.googleads.v6.services",
marshal="google.ads.googleads.v6",
manifest={
"GetBillingSetupRequest",
"MutateBillingSetupRequest",
"BillingSet... |
import bge
from bge import logic as g
from mathutils import *
from math import *
# Get the owner (should be the camera)
cont = bge.logic.getCurrentController()
own = cont.owner
# Get the general scene
scene = g.getCurrentScene()
# And get the missions manager from the owner.
# The mission manager has several utilit... |
#!/usr/bin/python
import boto3
import os
import random
import string
import itertools
host = "localhost"
port = 8000
## AWS access key
access_key = "0555b35654ad1656d804"
## AWS secret key
secret_key = "h7GhxuBLTrlhVUyxSPUKUV8r/2EI4ngqJxD7iBdBYLhwluN30JaT3Q=="
prefix = "YOURNAMEHERE-1234-"
endpoint_url = "http://%... |
import asyncio
import sys
_PY36 = sys.version_info[0:2] >= (3, 6)
if _PY36:
from .asyncmap36 import asyncmap # pylint: disable=unused-import
else:
class asyncmap: # pylint: disable=invalid-name
"""
Async generator object that is a port of the asyncmap36 generator.
This is needed f... |
import IMP.pmi
import IMP.pmi.analysis
import IMP.test
import IMP.rmf
import sys
class Tests(IMP.test.TestCase):
@IMP.test.expectedFailure
def test_graphxl(self):
import IMP.pmi.plotting.topology
dd={"med6":["med6"],
"med8":["med8"],
"med11":["med11"],
"med17... |
from i3pystatus import IntervalModule
import requests
import json
from i3pystatus.core import ConfigError
from i3pystatus.core.util import user_open, internet, require
class Github(IntervalModule):
"""
Check Github for pending notifications.
Requires `requests`
Formatters:
* `{unread}` — ... |
from nssrc.com.citrix.netscaler.nitro.resource.base.base_resource import base_resource
from nssrc.com.citrix.netscaler.nitro.resource.base.base_resource import base_response
from nssrc.com.citrix.netscaler.nitro.service.options import options
from nssrc.com.citrix.netscaler.nitro.exception.nitro_exception import nitro_... |
"""
Polyaxon SDKs and REST API specification.
Polyaxon SDKs and REST API specification. # noqa: E501
The version of the OpenAPI document: 1.10.0
Contact: <EMAIL>
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
from polyaxon_sdk.configuration i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.