src
stringlengths
721
1.04M
from __future__ import absolute_import, unicode_literals import hashlib import os.path from collections import OrderedDict from contextlib import contextmanager import django from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.core.files import File from django.core.ur...
from __future__ import absolute_import, print_function, division import unittest from pony.orm.core import * from pony.orm.tests import setup_database, teardown_database, db_params logged_events = [] db = Database() class Person(db.Entity): id = PrimaryKey(int) name = Required(unicode) age = Required(...
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class RaxmlNg(CMakePackage): """RAxML-NG is a phylogenetic tree inference tool which uses ma...
#!/usr/bin/env python #author: wowdd1 #mail: developergf@gmail.com #data: 2014.12.09 import requests import json from bs4 import BeautifulSoup; import os,sys import time import re from all_subject import subject_dict, need_update_subject_list reload(sys) sys.setdefaultencoding("utf-8") sys.path.append("....
""" Django settings for doi_site project. Generated by 'django-admin startproject' using Django 1.8. For more information on this file, see https://docs.djangoproject.com/en/1.8/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.8/ref/settings/ """ # Build paths...
# All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in...
from datetime import datetime from src.textgenerator import TextGenerator from src.utils import extract_project_gutenberg_novel, remove_titles # The source files to use # NOTE: Ulysses makes the generated text just a little too weird. files = [ './data/life_and_amours.txt', './data/memoirs_of_fanny_hill.txt',...
#! /usr/bin/env python import os import sys from time import sleep from glob import glob from os.path import expandvars from optparse import OptionParser import tempfile import subprocess import time import urllib2 import json version = "0.9.12" release_date = "May 7, 2011" class CmdException(Exception): pass c...
# -*- coding: utf-8 -*- import re,urllib,urlparse import traceback from resources.lib.modules import log_utils, source_utils from resources.lib.modules import client, rd_check from resources.lib.modules import debrid, control from resources.lib.sources import cfscrape class source: def __init__(self): se...
#!/usr/bin/env python # Copyright (C) 2009-2010: # Gabes Jean, naparuba@gmail.com # Gerhard Lausser, Gerhard.Lausser@consol.de # # This file is part of Shinken. # # Shinken 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 F...
############################################################################## # Copyright (c) 2015 Orange # guyrodrigue.koffi@orange.com / koffirodrigue@gmail.com # All rights reserved. This program and the accompanying materials # are made available under the terms of the Apache License, Version 2.0 # which accompani...
"""Utility module to handle the shared ssh connection.""" import base64 import logging import os import re import time import paramiko import six from fnmatch import fnmatch from contextlib import contextmanager from robottelo.cli import hammer from robottelo.config import settings logger = logging.getLogger(__name_...
import warnings warnings.filterwarnings("ignore", "strop functions are obsolete;", DeprecationWarning, r'test.test_strop|unittest') import strop import unittest from test import test_support class StropFunctionTestCase(unittest.TestCase): def test_atoi(s...
#!/usr/bin/env python # ********************************************************************** # # Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved. # # This copy of Ice is licensed to you under the terms described in the # ICE_LICENSE file included in this distribution. # # *************************************...
from __future__ import division from __future__ import print_function def input(in_msg): import inspect in_msg.input_file = inspect.getfile(inspect.currentframe()) print("*** read input from ", in_msg.input_file) in_msg.sat = "cosmo" in_msg.instrument = "cosmo" in_msg.sat_nr="1" in_msg....
######## # Copyright (c) 2014 GigaSpaces Technologies Ltd. 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...
# Copyright (c) 2018 PaddlePaddle 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 app...
# -*- coding: utf-8 -*- # /*************************************************************************** # Irmt # A QGIS plugin # OpenQuake Integrated Risk Modelling Toolkit # ------------------- # begin : 2013-10-24 # copyright ...
#!/usr/bin/python3 # vim: ts=4 et sw=4 sts=4 : import argparse from pkcommon import * class DuplicateEntryRemover: def __init__(self): self.m_parser = argparse.ArgumentParser( description = "Removes superfluous duplicate entries from polkit profiles or warns about conflicting ones." ...
# 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, ...
'''Convert CSV files into JSON files needed for the visualizer page.''' import argparse import json import os import functools from util.readers.addarash1 import AddarashReader from util.readers.bulbapedia import BulbapediaReader from util.readers.chfoo import ChfooReader from util.readers.editornotes import EditorNote...
""" basic syntax of the parameter file is: # simple parameter file [driver] nsteps = 100 ; comment max_time = 0.25 [riemann] tol = 1.e-10 max_iter = 10 [io] basename = myfile_ The recommended way to use this is for the code to have a master list of parameters and their defaults (e.g. _defaults), and then ...
from __future__ import absolute_import, division, print_function import utool import plottool_ibeis.draw_func2 as df2 import numpy as np from plottool_ibeis import plot_helpers as ph #(print, print_, printDBG, rrr, profile) = utool.inject(__name__, '[viz_keypoints]', DEBUG=False) utool.noinject(__name__, '[viz_keypoint...
''' Created on 2 Jun 2015 @author: sl0 ''' class UI: def __init__(self, ctrl): self._ctrl = ctrl def _print_menu(self): print(" 1. Show all songs\n \ 2. Add song\n \ 3. Delete song\n \ 4. Rate song!\n \ 5. Exit") def _show_all(self...
import shlex from robob.pipe import PipeBase class Pipe(PipeBase): """ Implementation of the application pipe item """ def configure(self, config): """ Configure cmdline """ # Prepare self.binary = config['binary'] self.args = [] self.stdin = None # Parse arguments if 'args' in config: if ...
import asyncio import taskloaf from .refcounting import Ref from .object_ref import put, is_ref, ObjectRef import logging logger = logging.getLogger(__name__) def await_handler(args): req_addr = args[0] pr = args[1] async def await_wrapper(): result_ref = await pr._get_future() taskloa...
#!/usr/bin/python # -*- coding: utf-8 -*- import redis import bgpranking import argparse if __name__ == '__main__': parser = argparse.ArgumentParser(description='Prepare the information to dump.') parser.add_argument('-f', '--full', action="store_true", default=False, help='Do a full dump (asn, b...
# flake8: noqa DEBUG=True, USE_TZ=True DATABASES={ "default": { "ENGINE": "django.db.backends.sqlite3", } } ROOT_URLCONF="tests.urls" INSTALLED_APPS=[ "django.contrib.auth", "django.contrib.contenttypes", "django.contrib.sites", 'django.contrib.sessions', "rest_framework", "teleg...
from os import path from hashlib import sha1 from httplib import HTTPResponse from urllib2 import urlopen from StringIO import StringIO from urlparse import urlparse from werkzeug import secure_filename MANIFEST_FILE = 'manifest.yaml' def fullpath(filename): # a happy tour through stdlib filename = path.ex...
# -*- coding: utf-8 -*- # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the #...
from __future__ import absolute_import, division, print_function import numpy as np from itertools import product from .core import normalize_chunks, Array, names def doc_wraps(func): """ Copy docstring from one function to another """ def _(func2): func2.__doc__ = func.__doc__.replace('>>>', '>>').re...
from optparse import OptionParser import sys, os import imp import rosbag, rospy import pickle import pyqtgraph as pg from pyqtgraph.Qt import QtCore, QtGui import pyqtgraph.ptime as ptime import time import numpy as np import read_hdf5_file_to_pandas import data_slicing #import find_flies_in_image_directory import...
import unittest, os from django.test import TestCase from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from django.test import LiveServerTestCase TITLE_PREFIX = 'GrowthStr...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # SchoolSoftAPI documentation build configuration file, created by # sphinx-quickstart on Wed Oct 4 01:43:46 2017. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in thi...
# -*- coding: utf-8 -*- import sys import urllib, urllib2, ssl, re import requests import httplib import urlparse import re UA = 'Mozilla/6.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.5) Gecko/2008092417 Firefox/3.0.3' def cleanHTML(raw_html): cleanr = re.compile('<.*?>') cleantext = re.sub(cleanr, '', raw_html...
# -*- coding: UTF-8 -*- import re,urllib,urlparse from resources.lib.modules import cleantitle from resources.lib.modules import client from resources.lib.modules import debrid class source: def __init__(self): self.priority = 1 self.language = ['en'] self.domains = ['best-moviez.ws'] ...
#!/usr/bin/env python import sys import os import os.path import shutil import xml.dom.minidom from xml.dom.minidom import getDOMImplementation from xml.dom.minidom import parseString from subprocess import call def get_vars(): errorMsg = "" travisSecurityVars = os.environ["TRAVIS_SECURE_ENV_VARS"] if tr...
from collections import defaultdict from pathlib import Path from helpers.plots import grouped_box_plot, p_value_annotations, box_plot from helpers.cache import cache_decorator, Cache from analyses.enrichment import ptm_on_random from models import InheritedMutation, MC3Mutation, lru_cache from ..store import cases ...
# -*- coding: utf-8 -*- from ..base.simple_decrypter import SimpleDecrypter class FilerNetFolder(SimpleDecrypter): __name__ = "FilerNetFolder" __type__ = "decrypter" __version__ = "0.48" __status__ = "testing" __pyload_version__ = "0.5" __pattern__ = r"https?://filer\.net/folder/\w{16}" ...
import urwid from yesno import ConfirmButton class ElectricityPodlet(object): def __init__(self, name, nr): self.name=name self.nr=nr self.PWRstate='off' self.ETHstate='unknown' self.buildGui() def buildGui(self): txt=urwid.Text(('nodehead', self.name), align='center') #headline=urwid.Filler(txt,"midd...
""" R code printer The RCodePrinter converts single sympy expressions into single R expressions, using the functions defined in math.h where possible. """ from __future__ import print_function, division from sympy.core import S from sympy.core.compatibility import string_types, range from sympy.codegen.ast import...
from webkit import WebHistoryItem, WebBackForwardList, WebView import gobject import unittest class TestWebBackForwardList (unittest.TestCase): """Test WebBackForwardList functions""" def setUp(self): gobject.threads_init() self.view = WebView() self.bf_list = self.view.get_back_forw...
# -*- coding: utf-8 -*- from author.decorators import with_author from colorful.fields import RGBColorField from constance.admin import config import django from django import forms from django.contrib.gis.db import models from django.contrib.gis.geos import GeometryCollection from django.core.cache import cache fr...
from plotfitness_emitter import main as main_em from plotfitness_receiver import main as main_recv from plotfitness_direction import main as main_dir from time import sleep production = True if production: print "Warning running in production mode. This will take a long time" sleep(1) num_steps = [1,1] ...
#!/usr/bin/env python """Utility to bulk load resources into the system, e.g. for initial preload""" __author__ = 'Michael Meisinger' import yaml import re import os from pyon.core import MSG_HEADER_ACTOR, MSG_HEADER_ROLES, MSG_HEADER_VALID from pyon.core.bootstrap import get_service_registry from pyon.core.governa...
# Copyright 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. """Presubmit script for changes affecting tools/perf/. See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for more details about th...
from __init__ import LOG_DIRECTORY from utility import assert_dir from os.path import join from datetime import datetime from shutil import copyfile REQUEST_DIR = join(LOG_DIRECTORY,'requests') RESPONSE_DIR = join(LOG_DIRECTORY,'responses') assert_dir(REQUEST_DIR) assert_dir(RESPONSE_DIR) def log_request(reque...
"""Predicates indicating if a level or cell should be unlocked.""" from django.db.models.query_utils import Q from apps.widgets.smartgrid_play_tester import play_tester from apps.widgets.smartgrid_design.models import DesignerAction, DesignerGrid from apps.managers.smartgrid_mgr import smartgrid_mgr def approved_act...
import unittest from tests.core import TestCore from pyrep.objects.vision_sensor import VisionSensor from pyrep.const import RenderMode, PerspectiveMode class TestVisionSensors(TestCore): def setUp(self): super().setUp() [self.pyrep.step() for _ in range(10)] self.cam = VisionSensor('cam0...
""" Sahana Eden Automated Test - INV023 Create Facilty @copyright: 2011-2016 (c) Sahana Software Foundation @license: MIT 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 witho...
# coding=utf-8 r""" This code was generated by \ / _ _ _| _ _ | (_)\/(_)(_|\/| |(/_ v1.0.0 / / """ from twilio.base import deserialize from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import...
#!/usr/bin/env python """Script to auto-generate our API docs. """ # stdlib imports import os, sys # local imports from apigen import ApiDocWriter # version comparison from distutils.version import LooseVersion as V #***************************************************************************** def abort(error): ...
import subprocess import sys import os import setup_util def start(args, logfile, errfile): setup_util.replace_text("go/src/hello/hello.go", "tcp\(.*:3306\)", "tcp(" + args.database_host + ":3306)") if os.name == 'nt': #subprocess.call("rmdir /s /q pkg\\windows_amd64", shell=True, cwd="go") #subprocess.cal...
import os import subprocess H_NAME = 'oauth-kerberos-server' H_FOLDER = os.path.join('/cgroup', H_NAME) CGROUP_NAME = 'thegroup' CGROUP_FOLDER = os.path.join(H_FOLDER, CGROUP_NAME) MOUNT_CMD_PATH = '/bin/mount' UMOUNT_CMD_PATH = '/bin/umount' MOUNTPOINT_CMD_PATH = '/bin/mountpoint' def prevent_swapping(): """preve...
#################################################### # # noxnet_systemtest_single.py # #--------------------------------------------------- # # Tests Upload, Download, Assemble and Search # functions with one daemon and client. # #################################################### from noxnet_systemtest import * ...
from copy import deepcopy import json import logging import mock import os import pytest import requests import time from f5.bigip import ManagementRoot from f5.utils.testutils.registrytools import register_device from f5_openstack_agent.lbaasv2.drivers.bigip.icontrol_driver import \ iControlDriver from f5_opensta...
import gzip import json import os import requests import tarfile import urllib2 resources_endpoint = "http://localhost:5002/resources" resource_stacks_endpoint = "http://localhost:5002/resource_stacks" environments_endpoint = "http://localhost:5002/environments" apps_endpoint = "http://localhost:5002/apps" containers_...
import sys import subprocess import re import os import warnings from tempfile import mkdtemp from shutil import rmtree from distutils.spawn import find_executable from tempfile import gettempdir from six import string_types import oddt from oddt.utils import (is_openbabel_molecule, is_molecul...
''' Created on 2016/3/24 :author: hubo ''' from vlcp.config.config import defaultconfig import vlcp.service.kvdb.storage as storage import vlcp.service.kvdb.redisnotifier as redisnotifier from vlcp.server.module import depend, Module, call_api, api import vlcp.utils.dataobject as dataobj from vlcp.event.runnable impor...
#!/usr/bin/env python """ The logical grammar (base lexicon) used throughout the paper. The code in grammar.py messes with the namespace that it establishes, in order to implement lexical uncertainty in an intuitive way. """ __author__ = "Christopher Potts" __version__ = "2.0" __license__ = "GNU general public licens...
import os from services.PlnService import PlnService import pkppln import bagit import zipfile import shutil class ValidateBag(PlnService): """Validate a bag in a deposit""" def state_before(self): return 'payloadVerified' def state_after(self): return 'bagValidated' def execute(se...
from mpl_toolkits.mplot3d import Axes3D from matplotlib import cm import matplotlib.pyplot as plt import numpy as np ### def print_u (f, label1, u, ny, nx, label2): f.write(label1) for j in range(ny): f.write("[") for i in range(nx): f.write(str(u[j,i])) if i < nx-1: ...
from fjord.base.tests import reverse, TestCase from fjord.redirector import get_redirectors from fjord.redirector.base import build_redirect_url from fjord.redirector.providers.dummy import DummyRedirector from fjord.redirector.tests import RedirectorTestMixin class DummyRedirectorLoadingTestCase(RedirectorTestMixin,...
#!/usr/bin/python2.7 # -*- coding: utf-8 -*- # # 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 agree...
# Copyright 2012 IBM Corp. # Copyright 2013 Red Hat, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
from libs import db import api.web from api.urls import handle_api_url from api import fieldtypes from api.exceptions import APIException from libs import config @handle_api_url("update_user_avatar_by_discord_id") class UpdateUserAvatarByDiscordId(api.web.APIHandler): auth_required = False sid_required = False...
# -*- coding: utf-8 -*- #---------------------------------------------------------------------------- # A modRana Qt 5 QtQuick 2.0 GUI module # * it inherits everything in the base GUI module # * overrides default functions and handling #---------------------------------------------------------------------------- # Cop...
# -*- mode: python; coding: utf-8 -*- # Copyright (c) 2018 Radio Astronomy Software Group # Licensed under the 2-clause BSD License """Tests for FHD_cal object.""" import pytest import os import numpy as np from pyuvdata import UVCal import pyuvdata.tests as uvtest from pyuvdata.data import DATA_PATH # set up FHD f...
############################################################################### # # Copyright 2012 Pants Developers (see AUTHORS.txt) # # 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 # # h...
import os from CPAC.pipeline import nipype_pipeline_engine as pe import nipype.interfaces.utility as util from CPAC.utils.test_mocks import configuration_strategy_mock from CPAC.image_utils import spatial_smooth import CPAC.utils.test_init as test_utils def test_smooth(): test_name = 'test_smooth_nodes' c...
""" Delaunay Sampler Module. Provides the Delaunay Sampler Class which contains the strategies for active sampling a spatial field """ from dora.active_sampling.base_sampler import Sampler, grid_sample import numpy as np from scipy.spatial import Delaunay as ScipyDelaunay class Delaunay(Sampler): """ Delau...
"""tutorial URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.10/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-b...
# Copyright (C) 2015 Education Advisory Board # Copyright (C) 2011-2012 Yaco Sistemas # # 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...
""" Models for the tags application """ # pylint: disable=model-missing-unicode # Django from django.db import models # Standard Library import re # Third Party from taggit.models import GenericTaggedItemBase, Tag as TaggitTag from taggit.utils import _parse_tags def parse_tags(tagstring): """Normalize tags a...
# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. from __future__ import absolute_import, print_function, unicode_literals from StringIO import StringIO import os import...
#/usr/bin/python # import os for the os.walk() function # os.walk returns a list of tuples: 3-tuple (dirpath, dirnames, filenames) import os import sys def ParseArgs(): Error1 = """ # USAGE # # filesystemWalk.py [directory] # filesystemWalk.py /Users/mcohoon/Devel/PythonPractice """ if len(sys.arg...
# 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 ...
#!/usr/bin/env python """ btree.py This file contains an implementation of a B-Tree as outlined in https://en.wikipedia.org/wiki/B-tree. """ def find_index_in_sorted_list(key, L): """ Helper function. Return index closest (above) key in sorted list. """ if not L: return 0 if len(L) == 1: ...
# -*- coding: utf-8 -*- # # Picard, the next-generation MusicBrainz tagger # # Copyright (C) 2017 Sambhav Kothari # Copyright (C) 2018 Laurent Monin # Copyright (C) 2018-2019 Philipp Wolfer # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # ...
#!/usr/bin/env python # coding: utf-8 """MXNet: a concise, fast and flexible framework for deep learning.""" from __future__ import absolute_import from .context import Context, current_context, cpu, gpu from .base import MXNetError from . import base from . import contrib from . import ndarray from . import name # us...
import json import sys from twisted.internet.task import react from twisted.python import usage class Options(usage.Options): optParameters = [ ["marathon", "m", "http://localhost:8080", "The address for the Marathon HTTP API endpoint."], ["config", "c", None, "The path to a con...
import time import smbus class I2C(object): @staticmethod def getPiVersion(): "Gets the version number of the Pi board" try: with open('/proc/cpuinfo', 'r') as infile: for line in infile: # Match a line of the form "Revision : 0002" while ignoring extra # info in front of...
''' This script creates an odt document with a summary of the evaluation data In needs a OrderedDict with the courses, languages and groups for each one of them It also needs the plots of each course, lang, group. Both subjects and promotion And it needs too a csv file with a summary of each group data (cleaning, care,...
from scipy.linalg import expm, norm import numpy as np def rot_mat(axis, theta): return expm(np.cross(np.eye(3), axis/norm(axis)*theta)) def rotate_vector(v, axis, theta): M = rot_mat(axis, theta) return np.tensordot(M,v,axes=([0],[1])).T #np.dot(M, v) def rotate_around_z(v, theta): return rotate_ve...
# coding: utf8 from __future__ import unicode_literals # Setting explicit height and max-width: none on the SVG is required for # Jupyter to render it properly in a cell TPL_DEP_SVG = """ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:lang="{lang}" id="{id}" class="displacy" w...
#!/usr/bin/env python # -*- coding: utf-8 -*- from runner.koan import * class AboutClasses(Koan): class Dog(object): "Dogs need regular walkies. Never, ever let them drive." def test_instances_of_classes_can_be_created_adding_parentheses(self): fido = self.Dog() self.assertEqual('Dog...
# -*- encoding: utf-8 -*- import requests from django.contrib.auth import get_user_model from django.contrib.sites.models import Site from django.template.defaultfilters import slugify from django.utils.six import StringIO, BytesIO, PY3 from taggit.utils import parse_tags if PY3: import csv else: import unic...
# -*- coding: utf-8 -*- from south.utils import datetime_utils as datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding model 'Brand' db.create_table(u'_backend_api_brand', ( ...
import pickle from unittest import TestCase from unittest.mock import Mock from tempfile import TemporaryFile from pynetics.stop import StepsNum, FitnessBound class StepsNumTestCase(TestCase): """ Test for the stop condition based on number of iterations. """ def test_class_is_pickeable(self): """ ...
''' @date Mar 22, 2010 @author Matthew A. Todd This file is part of Test Parser by Matthew A. Todd Test Parser is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option)...
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
#!/usr/bin/env python # ********************************************************************** # # Copyright (c) 2003-2014 ZeroC, Inc. All rights reserved. # # This copy of Ice is licensed to you under the terms described in the # ICE_LICENSE file included in this distribution. # # *************************************...
# Copyright 2011 Jeff Garzik # # RawProxy has the following improvements over python-jsonrpc's ServiceProxy # class: # # - HTTP connections persist for the life of the RawProxy object (if server # supports HTTP/1.1) # - sends protocol 'version', per JSON-RPC 1.1 # - sends proper, incrementing 'id' # - sends Basic HTT...
# -*- coding: utf-8 -*- import scrapy from scrapy.http import Request, FormRequest from scrapy.spiders import CrawlSpider from alexscrapper.items import * from datetime import datetime from scrapy.conf import settings import urllib import csv import json import re from datetime import datetime, timedelta from dateutil...
# -*- coding: utf-8 -*- # Copyright (c) 2010-2014 openpyxl # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modif...
from util import * import random class StrategyStateException(Exception): def __init__(self, message): super(StrategyStateException, self).__init__() self.message = message class Strategy(object): """Class to encapsulate logic of analyzing the state of a board and returning a valid coordin...
# 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 the...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Standalone benchmark runner """ import cProfile import pstats import profile import numpy as np print("Running Rust + Cython benchmarks") # calibrate pr = profile.Profile() calibration = np.mean([pr.calibrate(100000) for x in range(5)]) # add the bias profile.Profile...
import cupy from cupy.linalg import _util import cupyx.scipy.sparse try: from cupy_backends.cuda.libs import cugraph _cugraph_available = True except ImportError: _cugraph_available = False def connected_components(csgraph, directed=True, connection='weak', return_labels=True): ...
#!/usr/bin/python # coding: utf-8 # Copyright (C) 2010 Lucas Alvares Gomes <lucasagomes@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 2 of the License, or # (at you...