src stringlengths 721 1.04M |
|---|
#!/usr/bin/env python
import cherrypy, logging
import sys, os
# Suppose this file in
installation_path = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir))
sys.path.insert(0, installation_path)
from core.routes.routes import Routes
from core.config import conf_server, conf_static, conf_logging
def... |
'''
This module defines various PP Attachment models and comes with a CLI to train and test them.
'''
import sys
import codecs
import argparse
import random
import json
import numpy
from overrides import overrides
from keras.layers import Input, Bidirectional
from keras.models import Model
from encoders import LSTME... |
# encoding: utf-8
# Copyright 2013 maker
# License
"""
Sales module objects.
"""
from django.db import models
from maker.core.models import Object, User, ModuleSetting
from maker.identities.models import Contact
from maker.finance.models import Transaction, Currency, Tax
from django.core.urlresolvers import revers... |
# --------------------------------------------------------------------------
# This module handles text-to-html rendering-engine callbacks.
# --------------------------------------------------------------------------
import sys
# This dictionary maps file extensions to registered rendering-engine
# callbacks. We inc... |
##########################################################################
# Author: Eduardo Crispim, emcrispim@gmail.com
# Date: September, 2015
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 or (a... |
#!/usr/bin/env python
#-*- coding: utf-8 -*-
#/*##########################################################################
# Copyright (C) 2016 K. Kummer, A. Tamborino, European Synchrotron Radiation
# Facility
#
# This file is part of the ID32 RIXSToolBox developed at the ESRF by the ID32
# staff and the ESR... |
from __future__ import print_function
import sys, os, operator
from datetime import datetime
from flask import Flask, render_template, request, flash, redirect, url_for
from flask_sqlalchemy import SQLAlchemy
from SignInApp.models import Member
from SignInApp import db, app
import requests
import time
import json
impo... |
from django.contrib.auth import authenticate, login, logout
from pingapp import models, ping
def user_login(request, username, password):
user = authenticate(username = username, password = password)
if user is not None:
login(request, user)
return True
return False
def user_logout(request):
logout(request... |
import sure # noqa
import moto.server as server
'''
Test the different server responses
'''
def test_s3_server_get():
backend = server.create_backend_app("s3")
test_client = backend.test_client()
res = test_client.get('/')
res.data.should.contain('ListAllMyBucketsResult')
def test_s3_server_buc... |
from collections import Iterator
import os
from os.path import exists, isdir
try:
import cPickle as pickle
except ImportError:
import pickle
import shutil
import tempfile
from functools import partial
import blosc
import bloscpack
import numpy as np
import pandas as pd
from pandas import msgpack
def e... |
# -*- coding: utf-8 -*-
from cms.admin.change_list import CMSChangeList
from cms.admin.dialog.views import get_copy_dialog
from cms.admin.forms import PageForm, PageAddForm
from cms.admin.permissionadmin import (PAGE_ADMIN_INLINES,
PagePermissionInlineAdmin, ViewRestrictionInlineAdmin)
from cms.admin.views import r... |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
#
# Copyright (c) 2015 ASMlover. 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 copyrig... |
# pylint: disable=C0111,R0902,R0904,R0912,R0913,R0915,E1101
# Smartsheet Python SDK.
#
# Copyright 2018 Smartsheet.com, 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.... |
import numpy as np
from scipy import stats
from six.moves import range
import numpy.testing as npt
from numpy.testing import assert_array_equal
import nose.tools
from nose.tools import assert_equal, raises
from .. import algorithms as algo
rs = np.random.RandomState(sum(map(ord, "test_algorithms")))
a_norm = rs.rand... |
import networkx as nx
from ryu.base import app_manager
from ryu.controller import ofp_event
from ryu.controller.handler import MAIN_DISPATCHER
from ryu.controller.handler import set_ev_cls
from ryu.ofproto import ofproto_v1_0
from ryu.lib.mac import haddr_to_bin
from ryu.lib.packet import packet
from ryu.lib.packet im... |
from django.shortcuts import render
import decimal
class TableElement:
"""
Represent an individual cell of an HTML table.
"""
def __init__(self, title=None, CSS_classes=None, content=None):
self.title = title
self.CSS_classes = CSS_classes
self.content = content
class TablePa... |
# -*- coding: ISO-8859-1 -*-
# Copyright 2010 Dirk Holtwick, holtwick.it
#
# 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
#
# Unl... |
# Copyright (C) PyZMQ Developers
# Distributed under the terms of the Modified BSD License.
from random import Random
import time
from unittest import TestCase
import zmq
from zmq.tests import BaseZMQTestCase, have_gevent, GreenTest
class TestPubSub(BaseZMQTestCase):
pass
# We are disabling this test wh... |
"""Data viewset."""
from elasticsearch_dsl.query import Q
from django.db import transaction
from django.db.models import Count
from rest_framework import exceptions, mixins, status, viewsets
from rest_framework.decorators import list_route
from rest_framework.response import Response
from resolwe.elastic.composer im... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# GetDevInfo test data for WxFixBoot Version 2.0.3
# This file is part of WxFixBoot.
# Copyright (C) 2013-2018 Hamish McIntyre-Bhatty
# WxFixBoot is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3 or,
# ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Utilities for selecting and finding specific attributes in datasets
"""
import math
import functools
import numpy as np
import bisect
import concurrent.futures
import scipy.interpolate
from UliEngineering.Utils.Concurrency import QueuedThreadExecutor
from .Utils import... |
#!/usr/bin/env python
from os import path
from codecs import open
from setuptools import setup, find_packages
here = path.abspath(path.dirname(__file__))
# Get the long description from the README file.
with open(path.join(here, 'README.md'), encoding='utf-8') as fh:
long_description = fh.read()
setup(
name... |
from __future__ import annotations
from urllib.parse import urlparse
from baseframe import _, __
from coaster.utils import getbool
import baseframe.forms as forms
from ..models import (
AuthClient,
AuthClientCredential,
AuthClientTeamPermissions,
AuthClientUserPermissions,
valid_name,
)
__all__ ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from helpers import FileBase, KittenGroomerBase, main
printers = ['.STL', '.obj']
cnc = ['.nc', '.tap', '.gcode', '.dxf', '.stl', '.obj', '.iges', '.igs',
'.vrml', '.vrl', '.thing', '.step', '.stp', '.x3d']
shopbot = ['.ai', '.svg', '.dxf', '.dwg', '.eps... |
from __future__ import unicode_literals
__author__ = 'lexxodus'
from datetime import datetime, timedelta
from dummies.bqq_balanced import event_handler
from dummies.bqq_balanced.bottle_quiz_quest import BottleQuizQuest
from random import choice, randint, random
class Simulation(object):
def __init__(self):
... |
import unittest
from conans.test.utils.tools import TestClient, TestServer
from conans.util.files import load, save
from conans.model.ref import PackageReference, ConanFileReference
import os
import platform
conanfile = """
from conans import ConanFile
from conans.util.files import save
import os
class HelloConan(Con... |
from comics.aggregator.crawler import CrawlerBase, CrawlerImage
from comics.core.comic_data import ComicDataBase
class ComicData(ComicDataBase):
name = 'Joe Loves Crappy Movies'
language = 'en'
url = 'http://www.digitalpimponline.com/strips.php?title=movie'
start_date = '2005-04-04'
rights = 'Jose... |
"""
This test suite exercises some system calls subject to interruption with EINTR,
to check that it is actually handled transparently.
It is intended to be run by the main test suite within a child process, to
ensure there is no background thread running (so that signals are delivered to
the correct thread).
Signals a... |
# -*- coding: utf-8 -*-
from __future__ import print_function
import os
import struct
import sys
import time
from . import formatSize, formatTime
from .. import LOCAL_ENCODING, compat
from .log import log
try:
import fcntl
import termios
import signal
_CAN_RESIZE_TERMINAL = True
except ImportError:
... |
# -*- coding: utf-8 -*-
from bottle.bottle import route, run, template,static_file,request, get, post, redirect, response
from Suwings import global_manager
from Suwings.const import *
from Suwings.security.path_filter import *
from Suwings.security.file_filter import FileFilter
from Suwings.permission import *
from ... |
from __future__ import unicode_literals
from django.contrib import admin
# Register your models here.
from .models import Type
from .models import Text
from .models import Rating
from .models import UserRating
from .models import Question
from .models import TextComment
from django.http import HttpResponse
from djan... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
"""Entry points related to reverse. """
import os
import sys
from haystack import argparse_utils
from haystack import cli
from haystack.reverse import api
# the description of the function
REVERSE_DESC = 'Reverse the data structure... |
import os
import sys
import requests
import json
import datetime as dt
from boto.s3.connection import S3Connection, Location
from boto.s3.key import Key
def unsafe_getenviron(k):
v = os.environ.get(k)
if(v):
return v
else:
raise Exception('environment variable %s not set' % k)
JC_DECAUX_API_KEY = unsafe_gete... |
import sys
import os.path
import timeit
import hashlib
import shutil
sys.path.insert( 0, os.path.normpath(os.path.join( os.path.dirname( __file__ ), '..') ))
from aql_tests import skip, AqlTestCase, runLocalTests
from aql.utils import CLIOption, CLIConfig, Tempfile
class TestCLIConfig( AqlTestCase ):
def test_... |
import asyncio
import logging
from . import const, compare
from .model import *
logger = logging.getLogger(__name__)
def _to_dc_items(wti_items, zendesk_items):
return [DynamicContentItem(key, wti_items.get(key), zendesk_item) for key, zendesk_item in zendesk_items.items()]
async def _get_all_translations(zen... |
import os
import tempfile
import pytest # pylint: disable=unused-import
from click.testing import CliRunner
import calliope
from calliope import cli, AttrDict
_THIS_DIR = os.path.dirname(__file__)
_MODEL_NATIONAL = os.path.join(
_THIS_DIR,
'..', 'example_models', 'national_scale', 'model.yaml'
)
class Tes... |
# Copyright (c) 2015 Stephen Warren
# Copyright (c) 2015-2016, NVIDIA CORPORATION. All rights reserved.
#
# SPDX-License-Identifier: GPL-2.0
# Common logic to interact with U-Boot via the console. This class provides
# the interface that tests use to execute U-Boot shell commands and wait for
# their results. Sub-clas... |
#!/usr/bin/python
import subprocess
import sys
import os
import filecmp
mycmd = "python"
myarg = "hello.py"
student_out = 'student_out'
student_err = 'student_err'
golden = 'golden.txt'
f_student_out = open(student_out, 'w')
f_student_err = open(student_err, 'w')
# Execute program
try:
retcode = subprocess.call... |
import numpy as np
###############################################################################
## Intersection utilities 2D
###############################################################################
def intersect2D(c_v1, c_v2, p_v1, p_v2):
A1 = c_v2[1] - c_v1[1]
B1 = c_v1[0] - c_v2[0]
C1 = c_v1[0... |
import unittest
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
import random
import sys
from ..core import *
class ElementSizeTests(unittest.TestCase):
def assert_roundtrip(self, value, length=None):
encoded = encode_element_size(value, length=length)
if length is not Non... |
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under ... |
from sqlalchemy import Column, String
from sqlalchemy.schema import ForeignKey
from user import User
import Group
from base.DatabaseBase import DBB
class UserGroup(DBB):
__tablename__ = "hs_user_usergroup"
user_id = Column(String(User.USER_ID_LENGTH),ForeignKey("hs_user_user.user_id"), primary_key=Tr... |
# Orca
#
# Copyright 2010 Joanmarie Diggs.
#
# 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 your option) any later version.
#
# This library i... |
import theano
import numpy as np
class SharedDataSet(object):
def __init__(self, input, response=None):
"""
SharedDataSet objects are containers for holding information about sets for training mlps.
Input and output paths should point to a *.npy file
input: string or ndarray
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
#############################################################################
##
## Copyright (C) 2016 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of PySide2.
##
## $QT_BEGIN_LICENSE:GPL-EXCEPT$
## Commercial Lice... |
'''CNN code for DSL 2016 task 2, with cross validation
'''
from __future__ import print_function
import numpy as np
np.random.seed(1337) # for reproducibility
from keras.preprocessing import sequence
from keras.models import Sequential, Model, load_model
from keras.layers import Dense, Dropout, Activation, Flatten, ... |
import numpy as np
from skimage.util import img_as_float
class FeatureDetector(object):
def __init__(self):
self.keypoints_ = np.array([])
def detect(self, image):
"""Detect keypoints in image.
Parameters
----------
image : 2D array
Input image.
... |
#!/usr/bin/python
# storage_tab.py - Copyright (C) 2012 CloudTimes, Inc.
# Written by Jarod.W <work.iec23801@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License... |
# DFF -- An Open Source Digital Forensics Framework
# Copyright (C) 2009-2010 ArxSys
# This program is free software, distributed under the terms of
# the GNU General Public License Version 2. See the LICENSE file
# at the top of the source tree.
#
# See http://www.digital-forensic.org for more information about this... |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from twitter.common.... |
import numpy as np
from sklearn.model_selection import cross_val_predict, cross_val_score, StratifiedKFold
from sklearn.base import BaseEstimator, ClassifierMixin
from sklearn.svm import SVC
from ..metrics import METRICS
class Blender:
def make_greedy_blend(self, X, y, models, scoring=None, cv=3,
... |
"""
Here we test data loss when updating objects.
In a perfect case, we should just be able to update
things by passing in only the updates, but unfortunately
we need to attach a lot more stuff in order to prevent
them from being deleted.
"""
# ----------------------------------------------------------------------
# ... |
# Copyright 2014 0xc0170
#
# 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, soft... |
"""
This module parse data files to lines.
"""
from __future__ import print_function
import csv
import codecs
try:
import xlrd
except ImportError:
xlrd = None
class DataReader(object):
"""
Game data file reader.
"""
types = None
def __init__(self, filename = None):
"""
... |
#!/usr/bin/env python
# coding: utf-8
import os
import re
import requests
from datetime import datetime
from bs4 import BeautifulSoup
from logya.core import Logya
from logya.path import slugify, target_file
from logya.writer import encode_content, write
logya = Logya()
logya.init_env()
url = 'https://en.wikipedia.o... |
# encoding: utf-8
u'''MCL Site Knowledge — Utilities.'''
from Products.CMFCore.interfaces import IFolderish
from Products.CMFCore.WorkflowCore import WorkflowException
from plone.app.dexterity.behaviors.exclfromnav import IExcludeFromNavigation
from zope.event import notify
from zope.lifecycleevent import modified
i... |
import unittest
import transaction
from pyramid import testing
from default.models.mymodel import DBSession
class TestMyViewSuccessCondition(unittest.TestCase):
def setUp(self):
self.config = testing.setUp()
from sqlalchemy import create_engine
engine = create_engine('sqlite://')
... |
import pytest
targets = [
{'name': 'one', 'uuid': '775795d3-4410-4114-836b-8eeecf1d0c2f'},
{'name': 'two', 'uuid': 'd6784f5e-48a1-4b40-9b11-c8aefb6e1377'},
]
item = {
'required': 'required value',
}
simple1 = {
'required': 'required value',
'simple1': 'supplied simple1',
}
simple2 = {
'requi... |
from libs import config
import api.web
from api import fieldtypes
from api.urls import handle_url
from api_requests.admin import producers
from rainwave.events import event
from api_requests.admin_web import index
from api_requests.admin_web.power_hours import get_ph_formatted_time
# this makes sure all the event modu... |
#!/usr/bin/env python
import json
import requests
import datetime
from serialize import saveValues, loadStations
from chcantabrico_get_stations import getFlow4Level
def parseLine(line):
d, v = line.split(';')
return datetime.datetime.strptime(d,"%d/%m/%Y %H:%M:%S"),float(v)
def main():
flow4level_updated... |
# Copyright 2011 OpenStack LLC.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... |
########################################################
# evallib.py: common functions for evaluator.py
# Author: Jamie Zhu <jimzhu@GitHub>
# Created: 2015/8/17
# Last updated: 2015/8/30
########################################################
import numpy as np
from numpy import linalg as LA
import os, sys, time
fr... |
'''
Created on 2014-12-29
@author: Administrator
'''
from lib import db_mysql
from lib import common
def conf_file_daily_num(resource=None):
'''
Get daliy file num
Just yesterday because today is not finished
'''
yesterday = common.lastday()
TARGET_TABLE='apprec_file_daily_num'
... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
#
# Main module of serverApplet.
# Copyright (C) 2015 Gergely Bódi
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, ... |
"""Module to handle streams of text from cli arguments"""
import os
import sys
import contextlib
from itertools import chain
from six import StringIO
from pysyte import iteration
from pysyte.cli import arguments
from pysyte.oss.platforms import get_clipboard_data
def parse_args():
"""Parse out command line argu... |
#!/usr/bin/env python3
"""Pre processing step for text.
Example:
pp = Preprocesses()
"""
from __future__ import absolute_import, with_statement
import re
from collections import namedtuple
from cachetools import LRUCache, cached # python2 support
from nltk.stem import SnowballStemmer
from six.moves.html_parser... |
# Copyright 2006-2009 the V8 project authors. 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 list of co... |
# -*- coding: utf-8 -*-
##
##
## This file is part of Indico.
## Copyright (C) 2002 - 2014 European Organization for Nuclear Research (CERN).
##
## Indico 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; eith... |
from fireplace.enums import GameTag
# Buff helper
def buff(atk=0, health=0):
ret = {}
if atk:
ret[GameTag.ATK] = atk
if health:
ret[GameTag.HEALTH] = health
return ret
###
# Game/Brawl set
#
TB_007e = {
GameTag.ATTACK_HEALTH_SWAP: True,
}
TB_Pilot1 = {
GameTag.DEATHRATTLE: True,
}
###
# Classic set
#
... |
import sqlite3
from models import DbMessage, DbUser, ReactionNames
class SqliteHelper(object):
"""
This class manages interfacing with the SQLite database. It stores DbUser and DbMessage
objects (see: models.py).
"""
def __init__(self, db_file):
self.connection = sqlite3.connect(db_... |
from arthur.util import MultiDeferred
from twisted.internet import defer
from twisted.trial import unittest
class MultiDeferredTests(unittest.SynchronousTestCase):
"""
Tests for L{defer.MultiDeferred}, except now in Arthur.
See tm.tl/6365.
"""
def setUp(self):
self.multiDeferred = MultiDe... |
#!/usr/bin/python
#-------------------------------------------------------------------------------------------------
#quick script to give basic information about usage of a class of datasets
#originally written to provide PromptReco RECO info to Dima
#-------------------------------------------------------------------... |
# -*- coding: utf-8 -*-
REGISTER_OBJECT_CLASSES = {
'top': {},
'organizationalUnit': {
'MUST': ['ou'],
'MAY': [
'userPassword', 'searchGuide', 'seeAlso', 'businessCategory',
'x121Address', 'registeredAddress', 'destinationIndicator',
'preferredDeliveryMethod',... |
#!/usr/bin/env python
# encoding: utf-8
"""
test_http_client.py
Created by dan mackinlay on 2011-05-06.
Copyright (c) 2011 __MyCompanyName__. All rights reserved.
"""
from gevent import monkey; monkey.patch_all()
import unittest
import sys
import os.path
import subprocess
import urllib2
from time import sleep, time
fr... |
import numpy as np
import cv2
import time
import matplotlib.pylab as plt
"""
Make sure that you hold the checkerboard horizontally (more checkers horizontally than vertically).
In order to get a good calibration you will need to move the checkerboard around in the camera frame such that:
the checkerboard is det... |
#!/usr/bin/python
__author__ = "Ricardo Fernandes"
__email__ = "ricardo.fernandes@synchrotron.org.au"
__copyright__ = "(C) 2013 Australian Synchrotron"
__version__ = "1.5"
__date__ = "2014/MAR/21"
__description__ = "Script to automate the release of a new version of the EPICS Qt Framework"
__status__ = "Production"
... |
#
# Transmission Line Simulator
#
# Author(s): Jiacong Xu
# Created: Jul-10-2017
#
from materialwidget import MaterialWidget
from materialbutton import MaterialButton
from kivy.properties import *
from kivy.lang.builder import Builder
from util.constants import *
from kivy.animation import Animation
from kivy.clock i... |
#!/usr/bin/env python
#
# Copyright 2015 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 requir... |
import numpy as np
from astropy.table import Table
from astropy.io import fits
import matplotlib.pyplot as plt
import matplotlib
import pickle
from matplotlib import cm
from numpy.random import randn
# table path
path = "/Users/caojunzhi/Downloads/upload_20170330/red_clump_dr13.fits"
star = fits.open(path)
table =... |
from iSoft.entity.model import db, FaQuery
import math
import json
from iSoft.model.AppReturnDTO import AppReturnDTO
from iSoft.core.Fun import Fun
import re
class QueryDal(FaQuery):
def __init__(self):
pass
def query_findall(self, pageIndex, pageSize, criterion, where):
relist, is_succ = Fun... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2012-2014 Ben Kurtovic <ben.kurtovic@gmail.com>
#
# 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 ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division,
print_function, unicode_literals)
from builtins import *
from collections import OrderedDict, defaultdict, ChainMap
from intervaltree import Interval, IntervalTree
import numpy as np
from txttk.re... |
#!/usr/bin/python2
# Copyright (C) 2007 Red Hat
# see file 'COPYING' for use and warranty information
#
# 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... |
import numpy as np
from lxmls.deep_learning.mlp import MLP
from lxmls.deep_learning.utils import index2onehot, logsumexp
class NumpyMLP(MLP):
"""
Basic MLP with forward-pass and gradient computation in Numpy
"""
def __init__(self, **config):
# This will initialize
# self.config
... |
"""
Load npy xy, plot and save
"""
import os, sys
import matplotlib
matplotlib.use('Agg') # Must be before importing matplotlib.pyplot or pylab!
import matplotlib.pyplot as plt
import matplotlib.cm as mpl_cm
from matplotlib import rc
from matplotlib.font_manager import FontProperties
from matplotlib import rcPa... |
notifications = [ ]
notificationAdded = [ ]
# notifications which are currently on screen (and might be closed by similiar notifications)
current_notifications = [ ]
def __AddNotification(fnc, screen, id, *args, **kwargs):
if ".MessageBox'>" in `screen`:
kwargs["simple"] = True
notifications.append((fnc, screen,... |
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Tests for L{twisted.internet.posixbase} and supporting code.
"""
from __future__ import division, absolute_import
from twisted.python.compat import set, _PY3
from twisted.trial.unittest import TestCase
from twisted.internet.defer import Defe... |
#
# Copyright (C) 2015 FreeIPA Contributors see COPYING for license
#
"""
DNS installer module
"""
from __future__ import absolute_import
from __future__ import print_function
import enum
# absolute import is necessary because IPA module dns clashes with python-dns
from dns import resolver
import six
import sys
... |
### extends 'class_empty.py'
### block ClassImports
# NOTICE: Do not edit anything here, it is generated code
from . import gxapi_cy
from geosoft.gxapi import GXContext, float_ref, int_ref, str_ref
from .GXMVIEW import GXMVIEW
### endblock ClassImports
### block Header
# NOTICE: The code generator will not replace t... |
#!/usr/bin/env python
# ******************************************************************************
# Copyright 2017-2020 Intel 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
... |
# -*- coding: utf-8 -*-
import python_q4m
__author__ = "Tatsuhiko Kubo (cubicdaiya@gmail.com)"
__version__ = "0.0.6"
__license__ = "GPL2"
__doc__ = """
This module is simple Q4M operation wrapper developed by pixiv Inc. for asynchronous upload system
Simple example of usage is followings
>>> from python_q4m.... |
# Copyright 2021 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 to in writing, ... |
__author__ = 'tinyms'
#coding=UTF8
from sqlalchemy import func
from tinyms.core.common import Utils
from tinyms.core.web import IAuthRequest
from tinyms.core.entity import Account
from tinyms.core.orm import SessionFactory
from tinyms.core.annotation import ObjectPool, route, setting, api
from tinyms.core.setting imp... |
from django.apps import apps as django_apps
from django.contrib import admin
from django_revision.modeladmin_mixin import ModelAdminRevisionMixin
from edc_model_admin import ModelAdminBasicMixin
from edc_base.sites.admin import ModelAdminSiteMixin
from edc_model_admin import (
ModelAdminNextUrlRedirectMixin, Mode... |
# -*- 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... |
# Copyright 2008-2015 Nokia Solutions and Networks
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack LLC.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2016-2017, Cabral, Juan; Sanchez, Bruno & Berois, Martín
# 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 sourc... |
"""Viewsets for the projects app."""
from rest_framework.viewsets import ModelViewSet, ReadOnlyModelViewSet
from rest_framework_json_api.views import PreloadIncludesMixin
from timed.permissions import IsAuthenticated, IsReadOnly, IsReviewer, IsSuperUser
from timed.projects import filters, models, serializers
class ... |
import logging
import simuvex
l = logging.getLogger(name="angr.analyses.vsa_ddg")
class DataGraphMeta(object):
def __init__(self):
self._p = None
def _irsb(self, in_state):
"""
We expect a VSA state here.
"""
return self._p.factory.sim_run(in_state)
def _vfg_nod... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.