src
stringlengths
721
1.04M
# 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 writing, software #...
"""Showmore extension for Markdown. To hide something with [more...], surround the corresponding text with triple parentheses, e.g. (((text_to_be_hidden))). In order to show the text, you have to include the following Javascript in your code, which depends on the availability of jquery. $('.showmore').each(funct...
# -*- coding: utf-8; -*- # # This file is part of Superdesk. # # Copyright 2013, 2014 Sourcefabric z.u. and contributors. # # For the full copyright and license information, please see the # AUTHORS and LICENSE files distributed with this source code, or # at https://www.sourcefabric.org/superdesk/license*. from super...
""" This file contains view functions for Flask-User forms. :copyright: (c) 2013 by Ling Thio :author: Ling Thio (ling.thio@gmail.com) :license: Simplified BSD License, see LICENSE.txt for more details.""" from datetime import datetime from flask import current_app, flash, redirect, request, url_for from ...
from __future__ import absolute_import, print_function, division import os import shutil import sys from tempfile import mkdtemp import time import unittest import copy from collections import OrderedDict import six.moves.cPickle as pickle from six.moves import xrange import numpy from nose.plugins.skip import SkipTe...
# Copyright (c) 2005, 2006 Allan Saddi <allan@saddi.com> # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this lis...
# encoding: utf-8 # module PyQt4.QtNetwork # from /usr/lib/python3/dist-packages/PyQt4/QtNetwork.cpython-34m-x86_64-linux-gnu.so # by generator 1.135 # no doc # imports import PyQt4.QtCore as __PyQt4_QtCore class QNetworkCookie(): # skipped bases: <class 'sip.simplewrapper'> """ QNetworkCookie(QByteArray nam...
#!/usr/bin/env python # -*- coding: utf-8 -*- # rppy - a geophysical library for Python # Copyright (c) 2014, Sean M. Contenti # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Re...
# -*- coding: utf-8 -*- # # This file is part of EventGhost. # Copyright © 2005-2019 EventGhost Project <http://www.eventghost.org/> # # EventGhost 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 versio...
# Copyright (c) Mathias Kaerlev 2012. # This file is part of Anaconda. # Anaconda 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) any later version. # ...
# -*- coding: utf-8 -*- ''' Local settings - Run in Debug mode - Use console backend for emails - Add Django Debug Toolbar - Add django-extensions as app ''' from .common import * # noqa # DEBUG # ------------------------------------------------------------------------------ DEBUG = env.bool('DJANGO_DEBUG', default...
from django.db import models from django.conf import settings import bills.models as bill_models class GovInfoScraper(models.Model): bill_name = models.CharField(max_length=100) bill_code = models.CharField(max_length=10) comment_startdate = models.DateField() comment_enddate = models.DateField() s...
from __future__ import print_function def consonant(c): v = ['a', 'e', 'i', 'o', 'u','A', 'E', 'I', 'O', 'U'] if c not in v: return True else: return False def pig_latin_1(word): if consonant(word[0]): word1 = word[1:] + word[0] + 'a' + 'y' return str(word1) ...
from HTMLParser import HTMLParser from urllib import urlopen import pandas as pd import urllib import matplotlib.pyplot as plt def get_data(url_meteors, x): ArrayHTML = [] ahtml2=[] ahtml3=[] class MyHTMLParser(HTMLParser): global ArrayHTML global ahtml2 global ahtml3 def ha...
#!/usr/bin/env python3 # MIT License # # Copyright (c) 2017 Caian Benedicto # # 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 #...
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- """Module ...
# Under GNU GPLv3 License, see LICENSE.txt import sys, time from random import randint from PyQt5.QtWidgets import QWidget, QApplication from PyQt5.QtGui import QPainter, QPen, QBrush, QColor from PyQt5.QtCore import pyqtSignal, QMutex, QTimer __author__ = 'jbecirovski' class TestPainter(QWidget): frame_rate = ...
# encoding: utf-8 # 2008-2009 © Václav Šmilauer <eudoxos@arcig.cz> """ Remote connections to woo: authenticated python command-line over telnet and anonymous socket for getting some read-only information about current simulation. These classes are used internally in gui/py/PythonUI_rc.py and are not intended for direc...
#!/usr/bin/python3 # -*- coding: utf-8 -*- ################################################################################ # Gmastix Copyright (C) 2016 Suizokukan # Contact: suizokukan _A.T._ orange dot fr # # This file is part of Gmastix. # Gmastix is free software: you can redistribute it and/or modify #...
from datetime import date, timedelta from django.test import TestCase from django.urls import reverse from rq.exceptions import NoSuchJobError from autoemails import admin from autoemails.actions import NewInstructorAction from autoemails.job import Job from autoemails.models import EmailTemplate, RQJob, Trigger from...
import math x=1010 encontrado=0 p1=0 n2=0 p2=0 n3=0 p3=0 n4=0 p4=0 n5=0 p5=0 n6=0 p6=0 n1="" while encontrado==0: p1=(-1+math.sqrt( 1+8*x) )/2 if p1.is_integer(): for x1 in range(10,100): n2=int(str(x)[2:]+str(x1)) p2=math.sqrt(n2) if p2.is_integer(): ...
''' Created on 17-07-2012 @author: orneo1212 ''' import os import time from farmlib import DictMapper from farmlib.farm import FarmField, FarmObject, FarmTile, Seed, objects from farmlib.player import Player try: xrange except NameError: xrange = range class GameManager(object): """Game Manager class ...
# Copyright (C) 2007 - 2009 The MITRE Corporation. See the toplevel # file LICENSE for license terms. # This is a file-based property cache which I was originally using in # the experiment engine, but now also in the workspaces. # # A property cache # # attrTriples is a sequence of triples <attr>, <readFunction>, <w...
#!/usr/env/python # # Note: root is required to send ICMP packets # # Dependencies: # netifaces (pip install netifaces) # ping (pip install ping) import sys from netifaces import interfaces, ifaddresses, AF_INET import ping def get_base_addresses(): base_addresses = [] for iface in interfaces(): ...
"""Copyright 2011 The University of Michigan 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 writi...
""" Internal tasks are tasks that are started from the teuthology infrastructure. Note that there is no corresponding task defined for this module. All of the calls are made from other modules, most notably teuthology/run.py """ from cStringIO import StringIO import contextlib import logging import os import time impo...
# -*-coding:Utf-8 -* # Copyright (c) 2010-2017 LE GOFF Vincent # 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 ...
from datetime import datetime import re import elementtree.ElementTree as et from django.core.management.base import BaseCommand from flicksapp.models import Movie, Country, Person, Genre, File imdb_regex = re.compile("http://.*imdb.com/title/tt0*(\d+)") imdb_regex2 = re.compile("http://.*imdb.com/Title\?0*(\d+)") ...
# Copyright 2016 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...
# -*- 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 o...
import torch import torch.nn as nn from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence from torch.autograd import Variable class SeqEncoder(nn.Module): def __init__(self, args): super(SeqEncoder, self).__init__() self.num_units = args.num_units self.num_encoder_layers...
# Copyright (c) 2019 UAVCAN Consortium # This software is distributed under the terms of the MIT License. # Author: Pavel Kirienko <pavel@uavcan.org> import typing import asyncio import ipaddress import pytest import pyuavcan.transport # Shouldn't import a transport from inside a coroutine because it triggers debug w...
from __future__ import (absolute_import, division, print_function, unicode_literals) exec(open("ground.py").read()) # mine import hamiltonian import diffeo import sde from utility import * # # # all data defined in utility (exp2,...) # def run(dict): import os.path if 'fnam...
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright (c) 2010-2011 OpenStack, 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 # # Unl...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import sys from unittest import TestLoader, TextTestRunner, TestSuite from hwt.simulator.simTestCase import SimTestCase from hwtLib.abstract.busEndpoint_test import BusEndpointTC from hwtLib.abstract.frame_utils.alignment_utils_test import FrameAlignmentUtilsTC from hwtL...
""" python speedup_kmeans.py --profile python speedup_kmeans.py git worktree add workdir_master master rob sedr "\<sklearn\>" sklearn_master True git mv sklearn sklearn_master python setup develop python -c "import sklearn_master; print(sklearn_master.__file__)" python -c "import sklearn; print(sklearn.__file__)" """ ...
import pytest import numpy as np import matplotlib.pyplot as plt from aneris.control.factory import InterfaceFactory from dtocean_core.core import (AutoFileInput, AutoFileOutput, AutoPlot, Core) from dtocean_core.data import ...
# -*- encoding: utf-8 -*- """Smoke tests for the ``API`` end-to-end scenario.""" import random from fauxfactory import gen_string from nailgun import client, entities from robottelo import helpers, manifests from robottelo.api.utils import ( enable_rhrepo_and_fetchid, promote, upload_manifest, ) from robot...
from __future__ import print_function from abopt.legacy.vmad import VM, microcode, programme, Zero, Tape from numpy.testing import assert_raises, assert_array_equal, assert_allclose import numpy class TestVM(VM): @microcode(ain=['x'], aout=['y']) def unitary(self, x, y, factor): y[...] = x * factor ...
# -*-coding:Utf-8 -* # Copyright (c) 2012 LE GOFF Vincent # 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 # l...
#Copyright ReportLab Europe Ltd. 2000-2016 #see license.txt for license details #history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/platypus/__init__.py __version__='3.3.0' __doc__='''Page Layout and Typography Using Scripts" - higher-level framework for flowing documents''' ...
#!/usr/bin/env python #TODO--------------TODO# #----------------------# #Strip nicks from quotes when saving #Create function to connect to a page and get source instead of repeating every time #Integrate with pastebin for dumping quotes #----------------------# #TODO--------------TODO# import socket, random, sys,...
import bs4 import collections import itertools import urllib import re import requests import pandas as pd import sys import psycopg2 from sqlalchemy import create_engine from time import time def make_soup(url): "Make a beautiful soup from an url." try: page = requests.get(url) soup = bs4.Beau...
#!/usr/bin/env python # -*- coding: utf-8 -*- #------------------------------------------------------------- # GMSH mesh convertion for SPECFEM3D # # by Thomas CURTELIN # Centrale Marseille, France, July 2012 # # Based on Paul Cristini's equivalent script for 2D meshes # # For now it can only handle v...
#!/usr/bin/env python "shrink photos so that it doesn't take 8 days to transfer them" # Copyright (c) 2012 Randy Stauner # Licensed under the MIT License: http://opensource.org/licenses/MIT from PIL import Image import os from os.path import join, isfile, isdir, dirname, basename import re import sys # configur...
from twisted.internet.defer import inlineCallbacks, returnValue from floranet.models.model import Model from floranet.models.appinterface import AppInterface class Application(Model): """LoRa application class Model representing a LoRa application. Attributes: name (str): a user friendly...
# -*- coding: utf-8 -*- # Django settings for GeoNode project. from urllib import urlencode import os _ = lambda x: x DEBUG = True SITENAME = "GeoNode" SITEURL = "http://localhost:8000/" TEMPLATE_DEBUG = DEBUG PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__)) ADMINS = ( # ('Your Name', 'your_email@domai...
""" This module is essentially a broker to xmodule/tabs.py -- it was originally introduced to perform some LMS-specific tab display gymnastics for the Entrance Exams feature """ from django.conf import settings from django.utils.translation import ugettext as _, ugettext_noop from courseware.access import has_access f...
""" 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 use this ...
#!/usr/bin/env python3 import sys from pathlib import Path import jinja2 import pypandoc import pytoml as toml from common import list_ops, list_mods, validate_toml, get_tt_version if (sys.version_info.major, sys.version_info.minor) < (3, 6): raise Exception("need Python 3.6 or later") THIS_FILE = Path(__file_...
import qrcode from PyQt5.QtGui import QColor, QPen import PyQt5.QtGui as QtGui from PyQt5.QtCore import Qt from PyQt5.QtWidgets import ( QApplication, QVBoxLayout, QTextEdit, QHBoxLayout, QPushButton, QWidget, QFileDialog, ) from electrum_ltc.i18n import _ from electrum_ltc.simple_config import SimpleConfig ...
# ---------------------------------------------------------------------------- # Helper functions for logging and printing. # #For a systemwide unique logger, import the module like this: #from logger import SystemLogger # # ---------------------------------------------------------------------------- import os import ...
""" Test std::vector functionality when it's contents are vectors. """ from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil class TestVectorOfVectors(TestBase): mydir = TestBase.compute_mydir(__file__) @add_test_categories(["libc++"]) @skipIf...
from helper_helper import * from helper_helper import _time from collections import OrderedDict @unittest.skipUnless( os.environ.get('TEST_HISTOGRAM','true').lower()=='true', 'skipping histogram' ) class HistogramHelper(Chai): def setUp(self): super(HistogramHelper,self).setUp() self.series = Timeseries(s...
import argparse import os import multiprocessing from multiprocessing import Process, Queue, Array import pickle import gym from gym.spaces import Box, Discrete from keras.models import Model from keras.layers import Input, TimeDistributed, Convolution2D, Flatten, LSTM, Dense from keras.objectives import categorical...
def exactPayment(balance, annualInterestRate): """ The following variables contain values as described below: balance - the outstanding balance on the credit card annualInterestRate - annual interest rate as a decimal valueLow - Balance without interest valueHigh - Balance with f...
#! /usr/bin/env python3 import logging import shutil from shutil import copy2, move from os import path, scandir, makedirs import os from sys import maxsize from guessit import guessit import configparser from .cinefiles import Cinefiles # from guessit import guessit # # defaultPath = "/Volumes/Holland Gibson Ext ...
#!/usr/bin/env python # -*- coding: utf-8; py-indent-offset:4 -*- ############################################################################### # # Copyright (C) 2015, 2016, 2017 Daniel Rodriguez # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (c) 2013,2014 Rodolphe Quiédeville <rodolphe@quiedeville.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either ver...
# coding: utf-8 """ Onshape REST API The Onshape REST API consumed by all clients. # noqa: E501 The version of the OpenAPI document: 1.113 Contact: api-support@onshape.zendesk.com Generated by: https://openapi-generator.tech """ from __future__ import absolute_import import re # noqa: F401 im...
#! /usr/bin/python2.6 # KEYCODE TRANSLATOR #-----------------------------------------# # Filename: KeycodeTranslator.py # Belongs To: keyModder # Usage: from KeycodeTranslator import KeycodeTranslator # Description: Offers function to convert key codes to the key name and vice versa. # Cr...
import re import javabridge ## Dictionary holding the symbols for primatives in javabridge signatures primative_dict = {'boolean':'Z','byte':'B','char':'C','short':'S', 'int':'I','long':'J','float':'F','double':'D', 'void':'V'} ## Constructs the signature needed by javabridge for a...
# -*- coding: utf-8 -*- ## ## Copyright © 2007-2012, Matthias Urlichs <matthias@urlichs.de> ## ## 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 ## (a...
import math import numpy as np from scipy.misc import imread, imresize from scipy import spatial import skimage.morphology as mp def get_ellipse(N = 16, skew = 0.7): X = skew * np.cos(np.arange(N) * 2.0 * math.pi / N) Y = np.sin(np.arange(N) * 2.0 * math.pi / N) vertices = np.array([X,Y]).T edges = np.array([np....
""" RESTx: Sane, simple and effective data publishing and integration. Copyright (C) 2010 MuleSoft Inc. http://www.mulesoft.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...
""" Tests constraint routines """ from builtins import range import pytest import numpy as np import moldesign as mdt from moldesign import units as u from .molecule_fixtures import * from . import helpers registered_types = {} def typedfixture(*types, **kwargs): """This is a decorator that lets us associate fix...
# -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; coding:utf-8 -*- # vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 # # MDAnalysis --- https://www.mdanalysis.org # Copyright (c) 2006-2017 The MDAnalysis Development Team and contributors # (see the file AUTHORS for the full list of names) # # Released under t...
# Lint as: python3 # 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 ...
import os import sys import requests import time from pocket import Pocket import webbrowser import collections import json sys.dont_write_bytecode = True os.environ.setdefault("DJANGO_SETTINGS_MODULE", "trex.settings") import django django.setup() from restapi.models import * from random import randint # POCKET_CON...
#!/usr/bin/python # -*- coding: utf-8 -*- # Facilis # João Moreno <http://www.joaomoreno.com/> # GPLv3 import os, yaml, sys, clipboard from urllib2 import urlopen, HTTPError from re import search from web import ServerHandler from db import FilesDatabase from misc import PortInUse from threading import Event, Thre...
from typing import Union, Dict, Optional, List from CommonServerPython import * # noqa: E402 lgtm [py/polluting-import] # Disable insecure warnings requests.packages.urllib3.disable_warnings() INTEGRATION_CONTEXT_BRAND = "DeHashed" BASE_URL = "https://api.dehashed.com/" RESULTS_FROM = 1 RESULTS_TO = 50 class Clie...
from handlers import handlers from handlers import handler from conf import config, debug_logger from handlers.base import BaseHandler from db.database import PinDB import logging from notification.event_notification import MITMNotification import base64 logger = logging.getLogger(__name__) #TODO rewrite this handl...
import json import math from etherealpost.db import helpers from etherealpost.db.cache import Cache from etherealpost.db.helpers import gold_string, time_left_string from etherealpost.db.item import Item import time from etherealpost.db.realm import Realm from etherealpost.db.realm_name import RealmName class Db(ob...
"""Unittests for heapq.""" import sys import random from test import support from unittest import TestCase, skipUnless py_heapq = support.import_fresh_module('heapq', blocked=['_heapq']) c_heapq = support.import_fresh_module('heapq', fresh=['_heapq']) # _heapq.nlargest/nsmallest are saved in heapq._nlargest/_smalle...
"""Tests for :py:mod:`cheroot.makefile`.""" from cheroot import makefile __metaclass__ = type class MockSocket: """A mock socket.""" def __init__(self): """Initialize :py:class:`MockSocket`.""" self.messages = [] def recv_into(self, buf): """Simulate ``recv_into`` for Python 3...
# -*- coding: utf-8 -*- # # This file is part of CERN Analysis Preservation Framework. # Copyright (C) 2016 CERN. # # CERN Analysis Preservation Framework 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...
#!/usr/bin/env python # # Supertree Toolkit. Software for managing and manipulating sources # trees ready for supretree construction. # Copyright (C) 2011, Jon Hill, Katie Davis # # 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 # # Seccomp Library test program # # Copyright (c) 2012 Red Hat <pmoore@redhat.com> # Author: Paul Moore <pmoore@redhat.com> # # # This library is free software; you can redistribute it and/or modify it # under the terms of version 2.1 of the GNU Lesser General Public License as # published by t...
# -*- coding: latin1 -*- ################################################################################################ # # import tweepy, datetime, sys, time, json, os, os.path, shutil, time, struct, random import multi_oauth_n6 #Script que contém as chaves para autenticação do twitter reload(sys) sys.setdefaulten...
''' CYK algorithm for Context Free Language Author: Chenguang Zhu CS154, Stanford University ''' import sys,traceback import os import string maxProductionNum = 100 #max number of productions VarNum = 4 production = [[0] * 3 for i in range(maxProductionNum+1)] '''Prouductions in Chomsky Normal Form (C...
''' Compare feathering with different SD data. ''' import os from shutil import copytree from copy import copy import subprocess # Job parameters NODE = "1" PROCS = "12" PMEM = "4000mb" HOURS = "72" # Run imaging tests w/ different parameters/CASA versions output_path = os.path.expanduser("~/m33/14B-088/testing") ...
#!/usr/bin/env python # -*- coding: utf-8 -*- # import subprocess import sys import json import glob import threading import time import os ### #dryrun=True dryrun=False # generic_parse_list=["mkdir", "execshell", "editcron", "editat", "deletefile", "modifyuseros", "passwdresetos", "setpublickey" ] ### finallyjobidlis...
# -*- coding: utf-8 -*- """ Author: Gustavo Vargas <xgvargas@gmail.com> Repository and issues: https://github.com/xgvargas/sublime-ascii-art Font BIG _____ _____ _____ _____ _____ _______ /\ / ____|/ ____|_ _|_ _| /\ | __ \__ __| / \ | (___ | | | | | |______ / ...
#!/usr/bin/env python # -*- coding: utf-8 -*- # vim:ts=2:sw=2:expandtab # # Copyright (c) 2011, Nik Cubrilovic. All rights reserved. # # <nikcub@gmail.com> <http://nikcub.appspot.com> # # Licensed under a BSD license. You may obtain a copy of the License at # # http://nikcub.appspot.com/bsd-license # """ Sketch...
# -*- coding: utf-8 -*- from __future__ import absolute_import import os import httplib as http import requests import urlparse import waffle import json from flask import request from flask import send_from_directory from flask import Response from flask import stream_with_context from flask import g from django.core...
# -*- coding: utf-8 -*- # #################################################################### # Copyright (C) 2005-2013 by the FIFE team # http://www.fifengine.net # This file is part of FIFE. # # FIFE is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public #...
''' Problem 4 16 November 2001 A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 x 99. Find the largest palindrome made from the product of two 3-digit numbers. ---------------------------------------------------------- Created ...
""" The MIT License Copyright (c) 2007 Leah Culver Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publis...
import commands class Node: def __init__(self,nodeID,cores): self.nodeID = nodeID self.cores=cores def getCores(self): return self.cores def getID(self): return self.nodeID def getNumCores(self): return len(self.cores) class Job: def __init__(self): self.jo...
from random import randint import sys def sort(arr): length = len(arr) pivot_index = randint(0, length-1) pivot = arr[pivot_index] swap(arr, 0, pivot_index) i = j = 1 while j < length: if arr[j] < pivot: swap(arr, j, i) i += 1 j += 1 swap(arr, 0, i-1) first_part = arr[:i-1] second_part = arr[i:]...
import matplotlib as mpl from scipy.optimize import curve_fit mpl.use('pgf') import matplotlib.pyplot as plt plt.rcParams['lines.linewidth'] = 1 import numpy as np mpl.rcParams.update({ 'font.family': 'serif', 'text.usetex': True, 'pgf.rcfonts': False, 'pgf.texsystem': 'lualatex', 'pgf.preamble': r'\use...
from datetime import date, timedelta from django.test import TestCase from django.urls import reverse from .models import CorporateMember, IndividualMember, Team from .utils import get_temporary_image class IndividualMemberListViewTests(TestCase): url = reverse('members:individual-members') @classmethod ...
from abc import ABCMeta, abstractmethod class AbstractEnsemble(object): __metaclass__ = ABCMeta @abstractmethod def fit(self, base_models_predictions, true_targets, model_identifiers): """Fit an ensemble given predictions of base models and targets. Parameters ---------- ...
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (c) 2005-2010 ActiveState Software Inc. # Copyright (c) 2013 Eddy Petrișor # This is the MIT license # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal...
# -*- coding: utf-8 -*- # Inspired by: # https://github.com/lingdb/CoBL/issues/223#issuecomment-256815113 from __future__ import unicode_literals, print_function from django.db import migrations from ielex.source_scripts.handle_duplicate_sources import handle_sources, \ sourcesExist sources_changes = {'merge': {36...
#! /usr/bin/python ''' Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST. Calling next() will return the next smallest number in the BST. Note: next() and hasNext() should run in average O(1) time and uses O(h) memory, where h is the height of the tree...
#!/usr/bin/env python # encoding: utf-8 import grid_image_provider from functools import reduce class CombinedProvider(grid_image_provider.GridImageProvider): def __init__(self, *args): """ Creates a CombinedProvider out of the providers that were passed in `args` ORDER MATTERS. `image_for_rom` will ...
# Protocol Buffers - Google's data interchange format # Copyright 2008 Google Inc. All rights reserved. # http://code.google.com/p/protobuf/ # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions o...
# pylint: skip-file # -*- coding: utf-8 -*- """Tests for django comment client views.""" from __future__ import absolute_import import json import logging from contextlib import contextmanager import ddt import mock import six from django.contrib.auth.models import User from django.core.management import call_command...
import json from plenum.common.types import f from anoncreds.protocol.issuer import Issuer from anoncreds.protocol.types import ID from anoncreds.protocol.types import ClaimRequest from sovrin_client.agent.constants import EVENT_NOTIFY_MSG, CLAIMS_LIST_FIELD from sovrin_client.agent.msg_constants import CLAIM, CLAIM_R...