src
stringlengths
721
1.04M
from django.contrib.sites.models import Site from django.template.defaultfilters import slugify from django.conf import settings from mypage.pages.models import Page from mypage.pages.layout import WidgetInLayout from mypage.widgets.models import Widget from unit_project.testwidgets.models import TestWidget import any...
import sys from unittest import mock from .. import * from bfg9000.path import Root from bfg9000.safe_str import jbos from bfg9000.shell import (CalledProcessError, convert_args, execute, Mode, split_paths, which) base_dirs = { Root.srcdir: '$(srcdir)', Root.builddir: None, } cla...
""" mbed CMSIS-DAP debugger Copyright (c) 2006-2015 ARM Limited 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 ...
# -*- coding: utf-8 -*- # *************************************************************************** # * * # * Copyright (c) 2016 sliptonic <shopinthewoods@gmail.com> * # * ...
# graph_bar.py # # Copyright 2009 Hugo Teso <hugo.teso@gmail.com> # Based on code from w3af by Andres Riancho (w3af.sourceforge.net) # # 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...
# -*- coding: utf-8 -*- from flask import Blueprint, render_template, request, redirect, url_for, flash, Response, abort from .models import Department, Extractor from comport.data.models import DemographicValue, DenominatorValue from flask.ext.login import login_required from comport.decorators import admin_or_depart...
#/bin/env python2 # encoding: utf8 __version__ = '0.0.3' import re import itertools from bigos.backend import generate_events watchlist = [] class EventHandler: def __init__(self, function, regex, dirs=False, types=['created', 'modified']): ''' :param function: function to run when the event is...
# -*- 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...
#!/usr/bin/env python from __future__ import with_statement import rospy from Queue import Queue, Empty from strands_executive_msgs.msg import Task, ExecutionStatus, DurationMatrix, DurationList, ExecutePolicyAction, ExecutePolicyFeedback, ExecutePolicyGoal, MdpStateVar, StringIntPair, StringTriple, MdpAction, MdpAct...
class HashTable: def __init__(self, size): self.size = size self.keys = [None]*size self.data = [None]*size def put(self, key, data): hashValue = self._hash(key) if (self.keys[hashValue] == None): # no collision, found empty slot, so insert self....
from pytest import raises from mido.messages import Message from mido.syx import read_syx_file, write_syx_file def test_read(tmpdir): path = tmpdir.join("test.syx").strpath msg = Message('sysex', data=(1, 2, 3)) with open(path, 'wb') as outfile: outfile.write(msg.bin()) assert read_syx_file(...
import pyglet from pyglet.gl import * import math from app import AppState, enter_state from outcome import OutcomeState from window import Window from entity import World import factories from euclid import Vector3 from resources import Resources from camera import Camera from controller import Controller from te...
from django.http import HttpResponse, HttpResponseRedirect, Http404 from django.shortcuts import render_to_response from django.contrib.auth.decorators import login_required from helpers import * import bforms import logging def topic_tag(request, topic_slug, tag_text): topic = get_topic(request, topic_slu...
import numpy as np import pandas as pd from numpy import nan from pvlib import modelchain, pvsystem from pvlib.modelchain import ModelChain from pvlib.pvsystem import PVSystem from pvlib.tracking import SingleAxisTracker from pvlib.location import Location from pandas.util.testing import assert_series_equal, assert_f...
#!/usr/bin/env python import xml.etree.ElementTree as ET import rospy class BeltParser(object): """Class used to parse the definition XML""" def __init__(self, file): super(BeltParser, self).__init__() rospy.logdebug("Parsing belt definition...") root = ET.parse(file).getroot() ...
#!/usr/bin/env python # Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import logging import os import re import subprocess import sys import unittest ROOT_DIR = os.path.dirname(os.path.abspath(__file_...
#!/usr/bin/python # -*- coding: utf-8 -*- """ Main entry of the monkey """ import os import time import sys import logging from configuration import B2gConfiguration from executor import B2gExecutor from crawler import B2gCrawler from visualizer import Visualizer from invariant import StringInvariant formatter = log...
# 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, ...
# https://launchpad.net/wxbanker # urllib3.py: Copyright 2007-2010 Mike Rooney <mrooney@ubuntu.com> # # This file is part of wxBanker. # # wxBanker 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 Foundat...
#!/usr/bin/env python # # setup.py for flashbake from setuptools import setup, find_packages setup(name='flashbake', version='0.27.1', author="Thomas Gideon", author_email="cmdln@thecommandline.net", maintainer="Thomas Gideon", maintainer_email="cmdln@thecommandline.net", ...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Object used to fit data and compute PDFs using brute-force methods. """ from __future__ import (print_function, division) import six from six.moves import range import sys import os import warnings import math import numpy as np import warnings from .pdf import * ...
import logging from django.test import TestCase from unravel.lib.text_analysis.readability import AutomatedReadabilityIndex from unravel.lib.text_analysis.readability.coleman_liau_index import ColemanLiauIndex from unravel.lib.text_analysis.readability import DaleChallReadabilityFormula from unravel.lib.text_analysis...
# -- # Copyright (c) 2012-2014 Net-ng. # All rights reserved. # # This software is licensed under the BSD License, as described in # the file LICENSE.txt, which you should have received as part of # this distribution. # -- from nagare import component, database, security import json from kansha.title import comp as ...
######################## ### ### IMPORTS ### ######################## ######################## ### BUILTIN ######################## from datetime import date import codecs import shutil import time import sys import re import os ######################## ### LOCAL ###################...
import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import axes3d from random import shuffle from dopamine.fapprox import * X_data, Y_data = np.meshgrid(np.arange(-1, 1, 0.3), np.arange(-1, 1, 0.3)) Z_data = np.sin(5*X_data) * np.cos(Y_data) + np.random.normal(0, 0.2, X_data.shape) plt.ion()...
import tp import mm def thing_init(t): return def road_snow_init(name, short_name, tiles=[]): x = tp.Tp(name) x.set_short_name(short_name) x.set_is_road_snow(True) x.set_is_world_item(True) x.set_z_depth(mm.Z_DEPTH_ROAD) if tiles is not None: for t in tiles: x.set_ti...
# 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 unde...
from collections import Counter from itertools import chain, combinations from django.conf import settings from django.core.urlresolvers import reverse from django.utils.http import urlquote from django.template.response import TemplateResponse from us_ignite.apps.models import Application, Domain from us_ignite.acti...
''' Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive. The update(i, val) function modifies nums by updating the element at index i to val. Example: Given nums = [1, 3, 5] sumRange(0, 2) -> 9 update(1, 2) sumRange(0, 2) -> 8 ''' class NumArray(object): def __ini...
''' Created on 2 Sep 2014 @author: chris ''' '''File format - data, length of data, containing unicode - target, length of data, contains int reference to target - target_names, type names relative to target - filenames, names of files storing data (probably target too) ...
from flask import Flask, request, render_template, g, url_for from werkzeug.local import LocalProxy from s3logparse.main import build_config from s3logparse.backends import mongo_storage from s3logparse.entry import FIELD_NAMES BACKEND_CONFIG = build_config() DEBUG = True app = Flask(__name__) app.config.from_object...
""" Class to hold miscellaneous but useful decorators for our framework """ from inspect import getfullargspec class Wrapit(): "Wrapit class to hold decorator functions" def _exceptionHandler(f): "Decorator to handle exceptions" def inner(*args,**kwargs): try: ret...
#!/usr/bin/env python3 # PYTHON_ARGCOMPLETE_OK """Entry point for cwltool.""" import argparse import functools import io import logging import os import signal import subprocess # nosec import sys import time import urllib import warnings from codecs import StreamWriter, getwriter from collections.abc import MutableM...
# -*- coding: utf-8 -*- from __future__ import division import numpy as np from batemaneq import ( bateman_full, bateman_full_arr, bateman_parent, bateman_parent_arr ) import pytest decay_analytic = { 0: lambda y0, k, t: ( y0[0] * np.exp(-k[0]*t)), 1: lambda y0, k, t: ( y0[1] * np.exp(-k[1]...
import os import png import pydicom import numpy as np from .models import GrayscaleImage from .contrast import auto_contrast def mri_to_png(mri_file, png_file, do_auto_contrast=False): """ Function to convert from a DICOM image to png @param mri_file: An opened file like object to read te dicom data ...
""" /*************************************************************************** * * * 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...
import os import sys import time import logging from inspect import getmembers, ismethod, isfunction from itertools import chain from fnmatch import fnmatchcase from six import iteritems from openmdao.core.problem import Problem import openmdao.util.log from analysis_server.varwrapper import _find_var_wrapper from ...
crs_country = { '130': ('DZ', 'Algeria'), '133': ('LY', 'Libya'), '136': ('MA', 'Morocco'), '139': ('TN', 'Tunisia'), '142': ('EG', 'Egypt'), '218': ('ZA', 'South Africa'), '225': ('AO', 'Angola'), '227': ('BW', 'Botswana'), '228': ('BI', 'Burundi'), '229': ('CM', 'Cameroon'), '230': ('CV', 'Cape Verde'), '...
#### Calibrate a solar model #### Author: Earl Bellinger ( bellinger@mps.mpg.de ) #### Stellar Ages & Galactic Evolution Group #### Max-Planck-Institut fur Sonnensystemforschung #### Department of Astronomy, Yale University import numpy as np import pandas as pd from scipy import optimize from os import ...
#!/usr/local/bin/python # -*- coding:utf8 -*- __author__ = 'liyc' import urllib2 import re from bs4 import BeautifulSoup def search_blog_keyword_page(keyword, page="0"): url = "http://zzk.cnblogs.com/s?t=b&dateMin=2013-01-01" if keyword: url = url + "&w=" + keyword if page: url = url + "&...
""" Basic test case for Gaphor tests. Everything is about services so the TestCase can define it's required services and start off. """ import logging import unittest from io import StringIO from typing import Type, TypeVar from gaphas.aspect import ConnectionSink from gaphas.aspect import Connector as ConnectorAspe...
#*************************************************************************** #* * #* Copyright (c) 2011 * #* Yorik van Havre <yorik@uncreated.net> * #* ...
import logging, logging.handlers import sys logging.handlers.HTTPHandler('','',method='GET') logger = logging.getLogger('simple_example') # http_handler = logging.handlers.HTTPHandler('127.0.0.1:9022', '/event', method='GET') http_handler = logging.handlers.HTTPHandler('127.0.0.1:9999', '/httpevent', method='GET') ...
import re import requests from ..library import NotAuthenticatedError class library: def __init__(self, url): """ Initialises the library. """ self.session = requests.Session() self.authenticated = False; return def login(self, userid, password): """ Authe...
""" ISPAQ Business Logic for Cross-Correlation Metrics. :copyright: Mazama Science :license: GNU Lesser General Public License, Version 3 (http://www.gnu.org/copyleft/lesser.html) """ # output is polarity_check metric from __future__ import (absolute_import, division, print_function) import math import n...
import pprint import functools from collections import defaultdict import inspect ### dictionary ### def invert(d, container=list, codomain=None): s = defaultdict(container) for k, v in d.items(): s[v].append(k) # fill in range if codomain is not None: for v in codomain: s...
#!/usr/bin/python # -*- coding: utf-8 -*- import urllib,urllib2,re,xbmcaddon,xbmcplugin,xbmcgui,xbmc,HTMLParser from stream import * htmlparser = HTMLParser.HTMLParser() pluginhandle = int(sys.argv[1]) itemcnt = 0 baseurl = 'http://www.szene-streams.com' settings = xbmcaddon.Addon(id='plugin.video.szene-streams') maxi...
from werkzeug.security import generate_password_hash, check_password_hash from flask_login import UserMixin from . import db, login_manager class Role(db.Model): __tablename__ = 'roles' id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(64), unique=True) users = db.relationship('U...
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may ...
import re from base import Struct, IndexedStruct, dict_to_struct, pause, output, copy,\ import_file, assert_, get_default from reader import Reader _required = ['filename_mesh', 'field_[0-9]+|fields', 'ebc_[0-9]+|ebcs', 'fe', 'equations', 'region_[0-9]+|regions', 'variable_[0-9]+|variab...
#!/usr/bin/env python # Web2Hunter -- Abhishek Mishra <ideamonk at gmail.com> # # a web 2.0 name generator extension to domainhunter.py # # usage - # $ python web2hunter.py import domainhunter as DH import random A = ["Anti", "Aero", "Babble", "Buzz", "Blog", "Blue", "Brain", "Bright", "Browse", "Bubbl...
import collections FIPSInfo = collections.namedtuple('FIPSInfo', ['name', 'fips_code', 'state_code']) def get_by_fips_code(fips_code): return INFOS_BY_FIPS_CODE.get(fips_code) def get_by_state_code(state_code): return INFOS_BY_STATE_CODE.get(state_code) def get_by_state_name(state_name): return INFOS_B...
#This file is part of Tryton. The COPYRIGHT file at the top level of #this repository contains the full copyright notices and license terms. from tryton import common import os import sys import imp import gettext _ = gettext.gettext PLUGINS_PATH = os.path.dirname(__file__) if not os.path.isdir(PLUGINS_PATH): # ...
import django from django import forms from django.core.exceptions import ObjectDoesNotExist from grouprise.features.content import forms as content from grouprise.features.content.models import Content from . import models SimpleOptionFormSet = forms.modelformset_factory( models.SimpleOption, fields=('title...
# -*- coding: utf-8 -*- # Generated by Django 1.11.1 on 2017-05-14 22:41 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='StockM...
__author__ = "Yinchong Yang" __copyright__ = "Siemens AG, 2018" __licencse__ = "MIT" __version__ = "0.1" """ MIT License Copyright (c) 2018 Siemens AG 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 Softwa...
""" Example usage for using DiscourseSSOHandler: - set SSO_SECRET to the same value as sso_secret from the Discourse settings - setup DISCOURSE_URL - set enable_sso in Discourse and set sso_url to http://localhost:8080/ """ import sys sys.path.insert(0, '..') import discourse_sso from google.appengine.api import user...
# ScatterBackup - A chaotic backup solution # Copyright (C) 2016 Ingo Ruhnke <grumbel@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, either version 3 of the License, or # (at your ...
""" Path operations common to more than one OS Do not use directly. The OS specific modules import the appropriate functions from this module themselves. """ import os import stat __all__ = ['commonprefix', 'exists', 'getatime', 'getctime', 'getmtime', 'getsize', 'isdir', 'isfile', 'samefile', 'sameopenfi...
from myadmin.backenddb import (insert_default_areas, insert_custom_areas, insert_default_categories) from offer.models import CategoryModel from locus.models import (CountryModel ,StateModel, CityModel, AreaModel) from mail.models import (PublicMessageModel) from myadmin.preload_data import (gCountries, gCategories) f...
from blackjack.cmake.ScriptBase import ScriptBase class SetList(ScriptBase): """ Represents a collection of source files to be passed to a Target """ def __init__(self, name: str, srcs: [] = None, parentscope: bool = False): super().__init__() self._Name = None self.Name = na...
# Copyright 2018 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
#!/usr/bin/env python # -*- coding: utf-8 -*- import unittest import mock import accurev.issue import accurev.stream import accurev.transaction import accurev.schema class TestAccuRevIssue(unittest.TestCase): def setUp(self): self.xml = """<?xml version="1.0" encoding="utf-8"?> <acResponse...
""" analysis.py: A wrapper for the Bark Partner API Copyright (C) 2016 Aaron Thomas This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your ...
import os from setuptools import setup with open(os.path.join(os.path.dirname(__file__), 'README.md')) as readme: README = readme.read() os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir))) setup( name='django-multiorg', version='0.2.2', packages=['multiorg',], include...
# Copyright 2016 PerfKitBenchmarker Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
from __future__ import print_function, unicode_literals from operator import attrgetter from django.db.models.loading import get_app, get_models from nicedjango._compat import exclude, unicode from nicedjango.graph.utils import sort_nodes from nicedjango.serializers.compact_python import Serializer from nicedjango.ut...
################################################################################ # # Copyright (C) 2012-2013 Eric Conte, Benjamin Fuks # The MadAnalysis development team, email: <ma5team@iphc.cnrs.fr> # # This file is part of MadAnalysis 5. # Official website: <https://launchpad.net/madanalysis5> # # MadAnalysis 5...
#!/usr/bin/python3 # # Copyright (C) 2015-2020 Sustainable Energy Now Inc., Angus King # # powerclasses.py - This file is part of SIREN. # # SIREN is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, ei...
try: import autotest.common as common except ImportError: import common from autotest_lib.database import db_utils, migrate TKO_MIGRATION_NAME = '031_rename_tko_tables' migrations_module = __import__('autotest_lib.tko.migrations', globals(), locals(), [TKO_MIGRATION_NAME]) tko_mi...
# -*- coding: utf-8 -*- import re from polib import unescape class ValidationError(Exception): pass class BaseValidator(object): """Base class for validators. Implements the decorator pattern. """ def __init__(self, source_language=None, target_language=None, rule=None): self.slang = ...
#!/usr/bin/env python # # Electrum - lightweight Bitcoin client # Copyright (C) 2015 Thomas Voegtlin # # 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 y...
# -*- coding: utf-8 -*- # # glymur documentation build configuration file, created by # sphinx-quickstart on Sun May 26 11:29:54 2013. # # 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...
#!/usr/bin/env python import glob,os def writefile(fd, newlines, stat): fd.seek(0) fd.write(''.join(newlines)) fd.truncate() fd.close() os.utime(f, (stat.st_atime, stat.st_mtime)) for f in glob.glob("*.log"): stat = os.stat(f) fd = open(f,'r+') newlines = [] lines = fd.readlines() #if n...
# -*- coding: utf-8 -*- # filename: lesson_122_list_methods.py # Life is short, use Python! # LIST METHODS # usage: LIST.METHOD(ARGUMENTs) # L.append(ELEMENT) ---> append ELEMENT as is at the end of list L # L.extend('LIST') ---> add elements of LIST at the end of L # L.insert(INDEX, 'ELEMENT') -...
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import print_function from __future__ import unicode_literals from py_privatekonomi.core.mappers.economy_mapper import EconomyMapper from py_privatekonomi.utilities import helper from py_privatekonomi.utilities.common ...
import datetime import re import random import time import redis from utils import log as logging from django.http import HttpResponse from django.conf import settings from django.db import connection from django.template import Template, Context from apps.profile.tasks import CleanupUser from apps.statistics.rstats im...
# ***************************************************************************** # Copyright (c) 2020, Intel Corporation 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 sou...
# ##### BEGIN GPL LICENSE BLOCK ##### # # 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, or (at your option) any later version. # # This program is distributed ...
# This file is part of lyx2lyx # -*- coding: utf-8 -*- # Copyright (C) 2011 The LyX team # # 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, or (at your option) ...
from kivy.lang import Builder from plyer import gps from kivy.app import App from kivy.properties import StringProperty from kivy.clock import mainthread from kivy.utils import platform kv = ''' BoxLayout: orientation: 'vertical' Label: text: app.gps_location Label: text: app.gps_status ...
from sklearn.feature_extraction.text import CountVectorizer from sklearn.feature_extraction.text import TfidfTransformer from sklearn.svm import LinearSVC from sklearn.naive_bayes import BernoulliNB from sklearn.pipeline import Pipeline from sklearn.linear_model import RidgeClassifier, LogisticRegression from tim...
import os path=os.path.dirname(__file__) def MakeWrapperFiles(field_dict,call_str,pointwise): write_to_file(field_dict,call_str,pointwise) def allocate_str(field_dict): s=""" subroutine allocate_storage(number_of_tracers,n) integer :: n !f2py integer, intent(hide), depend(number_of_tracers) :: n=shape(n...
# -*- encoding: utf-8 -*- ############################################################################## # # Copyright (C) 2014-2015 Compassion CH (http://www.compassion.ch) # Releasing children from poverty in Jesus' name # @author: Cyril Sester, Emanuel Cino # # The licence is in the file __openerp...
# -*- coding: utf-8 -*- """ Created on Wed May 24 15:00:15 2017 @author: Julien Couillard & Jean Thevenet """ from sklearn import cross_validation from sklearn import metrics import numpy class MLValidation: """This class calculates the preciseness of our tree against a set of data""" def __init__(self, ...
from operator import getitem import pandas as pd import pandas.util.testing as tm import numpy as np import dask from dask.async import get_sync from dask.utils import raises import dask.dataframe as dd from dask.dataframe.core import (get, concat, repartition_divisions, _loc, _coerce_loc_index) def eq(a, b...
# # The script creates the json files which can be directly imported into HarvardCards Django App. # It looks for the json file in the folder specified by the variable "path_files_folder" # Usage: # ./initial_data.py [json_file] # Note: For now, you can execute ./initial_data.py and the script will use the arthistory...
# Copyright 2014 Hewlett-Packard Development Company, L.P. # # 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...
""" Tests related to response objects. """ import unittest import requests from pyetherscan import client, response, error class FakeResponse(requests.Response): """Fake instance of a Response object""" def __init__(self, status_code, text): requests.Response.__init__(self) self.status_code...
# # Copyright 2019 The FATE Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
# -*- coding: utf-8 -*- import os import sys import urllib import urlparse import xbmcaddon import xbmcgui import xbmcplugin if sys.version_info < (2, 7): import simplejson as json else: import json from logging import log from util import build_url __addon__ = xbmcaddon.Addon() #__addonid__ = __addon__.get...
# -*- coding: utf-8 -*- class Slot(object): """ To use comb, you should create a python module file. we named *slot*. A legal slot must be named 'Slot' in your module file and it must be at least contain four method: * `initialize` initial resource, e.g: database handle * `__enter__` g...
# -*- coding: utf-8 -*- import re import traceback import xbmc import xbmcvfs import xbmcaddon # Import the common settings from settings import Settings from settings import log from settings import os_path_join ADDON = xbmcaddon.Addon(id='script.videoextras') PROFILE_DIR = xbmc.translatePath(ADDON.getAddonInfo('pro...
# ~*~ coding: utf-8 ~*~ __author__ = 'Kamo Petrosyan' from django import template from django.db.models import Q from virtenviro.content.models import Snippet, Page, AdditionalField, Menu from django.template import loader, Context from virtenviro.utils import * register = template.Library() @register.assignment_tag...
# -*- coding: utf-8 -*- #------------------------------------------------------------------------- # drawElements Quality Program utilities # -------------------------------------- # # Copyright 2015 The Android Open Source Project # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use t...
# -*- coding: utf-8 -*- # # stix-ramrod documentation build configuration file, created by # sphinx-quickstart on Tue Sep 30 14:08:10 2015. # # 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. ...
# -*- coding: utf8 -*- # This file is part of PyBossa. # # Copyright (C) 2013 SF Isle of Man Limited # # PyBossa is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at...
from ordered_set import OrderedSet from priodict import priorityDictionary class RecyclingSet(OrderedSet): __slots__ = ['items', 'indices', 'index', 'indexFor', '__contains__', '__getitem__', '__len__', 'count', 'maxsize', 'drop_listeners', 'priority'] def __init__(self, maxsi...
''' MLP network for MNIST digits classification with L2 reg Test accuracy: 95.2% ''' from __future__ import absolute_import from __future__ import division from __future__ import print_function # numpy package import numpy as np from keras.models import Sequential from keras.layers import Dense, Activation from keras...
# Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. # Configuration file for JupyterHub import os import sys c = get_config() # We rely on environment variables to configure JupyterHub so that we # avoid having to rebuild the JupyterHub container every time we change ...