text
stringlengths
2
999k
#!/usr/bin/env python2 # -*- coding: UTF-8 -*- # File: google.py # Date: Wed Mar 11 09:21:06 2015 +0800 # Author: Yuxin Wu <ppwwyyxxc@gmail.com> from . import register_searcher from ..job import SearchResult from ..uklogger import * from ..lib.textutil import title_correct, filter_title_fileformat from ..ukconfig impo...
# -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # Copyright (c) 2015 Yann Lanthony # Copyright (c) 2017-2018 Spyder Project Contributors # # Licensed under the terms of the MIT License # (See LICENSE.txt for details) # ---------------------------------------------...
from tensorflow.keras.utils import Sequence import numpy as np import mrcfile import os # Here, `x_set` is list of path to the images # and `y_set` are the associated classes. class dataSequence(Sequence): def __init__(self, x_set, y_set, batch_size): self.x, self.y = x_set, y_set self.batch_size ...
#!/usr/bin/env python3 # Copyright (c) 2016 The Ai the coins developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test the bumpfee RPC. Verifies that the bumpfee RPC creates replacement transactions successfully when its ...
# Auto generated from NMRspec.yaml by pythongen.py version: 0.9.0 # Generation date: 2022-03-23T11:24:25 # Schema: NMRspec # # id: https://raw.githubusercontent.com/StroemPhi/NMRspec/main/model/schema/NMRspec.yaml # description: This model is to be used to semantify NMR spectroscopy research data. # license: https://cr...
from blabla.sentence_processor.morpho_syntactic_feature_engine import ( num_inflected_verbs, num_gerund_verbs, num_participle_verbs, ) from blabla.utils.global_params import * class Prop_Inflected_Verbs(object): """Class to calculcate the proportion of inflected verbs """ def __init__(self, s...
from django.urls import reverse_lazy from django.http import HttpResponse from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger from django.http import Http404 from django.shortcuts import render, get_object_or_404, redirect from django.db.models import Q from django.utils.text import slugify from dj...
from datetime import datetime from osmium import SimpleWriter from osmium.osm.mutable import Way, Node OSM_ID_START = 10**10 def transform_plazas(plazas, node_file, way_file, footway_tags): """ transforms plazas to OSM and write them to a file """ node_writer = SimpleWriter(node_file) way_writer = Simpl...
# # MAKEPLOTS--A library for making plots for demaniacs # # # from pylab import * import numpy def plotframe(data): """Plot the entire data array returns a figure """ nimg = 10 ywidth = 0.08 xlen = len(data[0]) / nimg for i in range(nimg): yax = 0.90 - ywidth * 1.1 * i ...
import json import logging from typing import Dict, Union, List, Optional from fastapi import APIRouter, HTTPException from pydantic import BaseModel, Field from rest_api.controller.search import PIPELINE import langid langid.set_languages(['de', 'en']) # ISO 639-1 codes router = APIRouter() logger = logging.getLogg...
#!/usr/bin/python ######################################################################################################################## # # Copyright (c) 2014, Regents of the University of California # All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, are permi...
# Copyright (c) 2012-2018 SoftBank Robotics. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the COPYING file. import qisys.sh import qitoolchain.qipackage import qisrc.svn class SvnPackage(qitoolchain.qipackage.QiPackage): # pylint: disable=too-many-instance-...
# test.py # example client to consume the stats import ssl import requests # disable SSL certificate validation ctx = ssl.create_default_context() ctx.check_hostname = False ctx.verify_mode = ssl.CERT_NONE content = { 'Stats-Credential': '3u58o9q7kff8h9n3wvjejiqs2p1rt0yq5kw4uly26if6b53v4piuffoiy6s39ppplr9b0e9vtnbhz...
from pythondjangoapp.settings.base import * DEBUG = True INSTALLED_APPS += ( # other apps for local development )
import os class Empresa(): def __init__(self,nom="",ruc=0,dire="",tele=0,ciud="",tipEmpr=""): self.nombre=nom self.ruc=ruc self.direccion=dire self.telefono=tele self.ciudad=ciud self.tipoEmpresa=tipEmpr def datosEmpresa(self):#3 self.nombre=input("Ingres...
import warnings from functools import reduce import datajoint as dj import numpy as np import scipy.stats as stats import spikeinterface as si from spikeinterface.core.segmentutils import AppendSegmentRecording from ..common.common_interval import IntervalList from ..common.nwb_helper_fn import get_valid_intervals fr...
import json import os import pytz def _bool_convert(value): truthy = {"t", "true", "on", "y", "yes", "1", 1, 1.0, True} falsy = {"f", "false", "off", "n", "no", "0", 0, 0.0, False} if isinstance(value, str): value = value.lower() if value in truthy: return True if value in falsy: ...
import torch import torch.nn as nn import torch.nn.functional as F import numpy as np from torch.utils.cpp_extension import load import os current_path = os.path.dirname(os.path.realpath(__file__)) if torch.cuda.is_available(): quant_cuda = load( name='quant_cuda', sources=[ os.path.joi...
import os import sys # Add the parent directory to the path to import the parent component as # dummy_components.dummy_component_2.DummyComponent1 this_directory = os.path.dirname(os.path.abspath(__file__)) parent_directory = os.path.abspath(os.path.join(this_directory, '..')) sys.path.append(parent_directory) from a...
""" .. _2d_streamlines_example: 2D Streamlines ~~~~~~~~~~~~~~ Integrate a vector field to generate streamlines on a 2D surface. """ # sphinx_gallery_thumbnail_number = 3 ############################################################################### # This example generates streamlines of flow around a cylinder in c...
""" This module implements the Request class which is used to represent HTTP requests in Scrapy. See documentation in docs/topics/request-response.rst """ import copy from scrapy.http.headers import Headers from scrapy.utils.url import safe_url_string from scrapy.utils.trackref import object_ref from scrapy.utils.de...
"""Test input for unit tests.""" # Source: https://www.un.org/en/universal-declaration-human-rights/ UDHR_ARTICLE_1 = ("Article 1.\n" "All human beings are born free and equal in dignity and rights.\n" "They are endowed with reason and conscience and should act towards one another\n" "in a spirit of brothe...
# coding: utf-8 """ Domain Group API V1 Provides public access to Domain's microservices # noqa: E501 OpenAPI spec version: v1 Generated by: https://github.com/swagger-api/swagger-codegen.git """ import pprint import re # noqa: F401 import six class DomainListingsServiceV1ModelDomainListi...
# coding=utf-8 # Copyright 2019 The Tensor2Tensor Authors. # # 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...
#!/usr/bin/env python """ ====== Atlas2 ====== Write first 20 graphs from the graph atlas as graphviz dot files Gn.dot where n=0,19. """ # Author: Aric Hagberg (hagberg@lanl.gov) # Date: 2005-05-19 14:23:02 -0600 (Thu, 19 May 2005) # Copyright (C) 2006-2019 by # Aric Hagberg <hagberg@lanl.gov> # Dan Schult <...
# coding: utf-8 from __future__ import absolute_import # import models into model package from huaweicloudsdkdcs.v2.model.attrs_object import AttrsObject from huaweicloudsdkdcs.v2.model.autoscan_config_request import AutoscanConfigRequest from huaweicloudsdkdcs.v2.model.available_zones import AvailableZones from huaw...
#!/usr/bin/env python import datetime import os import sys def extract_datetime_from_line(line, year): # Expected format: I0210 13:39:22.381027 25210 solver.cpp:204] Iteration 100, lr = 0.00992565 line = line.strip().split() month = int(line[0][1:3]) day = int(line[0][3:]) timestamp = line[1] p...
# Copyright (C) 2017 Google Inc. # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> """Constants for URLs construction.""" # pylint: disable=wildcard-import # pylint: disable=unused-wildcard-import from lib.constants.objects import * # noqa; the names are later exported # URL's parts for...
from pylons.i18n import _ import ckan.logic as logic import ckan.new_authz as new_authz def package_create(context, data_dict=None): user = context['user'] if not new_authz.auth_is_registered_user(): check1 = new_authz.check_config_permission('anon_create_dataset') else: check1 = new_auth...
import math import rclpy from rclpy.clock import Clock from rclpy.qos import QoSProfile, qos_profile_sensor_data, QoSDurabilityPolicy from rclpy.node import Node from rclpy.logging import get_logger from tf2_msgs.msg import TFMessage from geometry_msgs.msg import Vector3, Quaternion from geometry_msgs.msg import Trans...
from utils.config import * import logging import os import sys logging.basicConfig(format='%(asctime)s - %(levelname)s - %(name)s - %(message)s', datefmt='%m/%d/%Y %H:%M:%S', level=logging.INFO, stream=sys.stdout) logger = logging.getLogger(__name__) """...
from unittest import TestCase from pykotor.resource.formats.gff import load_gff from pykotor.resource.generics.ute import construct_ute, dismantle_ute TEST_FILE = "../../files/test.ute" class TestUTE(TestCase): def test_io(self): gff = load_gff(TEST_FILE) ute = construct_ute(gff) self.va...
# EE348N: Ocean Acoustics # Sound speed profiles used in class from numpy import exp, sin ### FUNCTIONS ### def cSTD (t,s,z, lat=0, eqn='mackenzie81'): # Inputs: # t : tempurature [degC] # s : salinity [ppt] # z : column depth [m] # lat : latitude [deg] # eqn : mackenzie81, leroy08 # Returns: # c : seawa...
from vyper.exceptions import ArrayIndexException, OverflowException def test_list_tester_code(get_contract_with_gas_estimation): list_tester_code = """ z: int128[3] z2: int128[2][2] z3: int128[2] @external def foo(x: int128[3]) -> int128: return x[0] + x[1] + x[2] @external def goo(x: int128[2][2]) -> int12...
# # PySNMP MIB module ELTEX-MES-SYSLOG-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ELTEX-MES-SYSLOG-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:01:59 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (defau...
import itertools import numpy as np from solvers.grid_solver import GridSolver from solvers.math import interpolate_signal, ls_fit from solvers.tests.base_test_case import BaseTestCase from solvers.tests.correction_models import linear_correction class TestGridSolver(BaseTestCase): offset_candidates = np.arange...
"""Version number""" __version__ = "0.1.2"
# -*- coding: utf-8 -*- """ Created on Sat Feb 6 10:02:25 2021 @author: John """ import pdb import pandas as pd import votesim import os # from votesim.benchmarks.simpleNd import SimpleThreeWay from votesim.benchmarks import runtools, simple print(os.getcwd()) import definitions benchmark = simple.simple_base_compa...
from requests import post as reqpost, get as reqget, put as reqput class D42: __lastResponse = None __user = None __pass = None __baseUrl = None def __init__(self, baseUrl, d42user, d42pass): self.__user = d42user self.__pass = d42pass self.__baseUrl = baseUrl def api_...
import os import py_compile import shutil import sys import tempfile import unittest import zipfile from test import support from java.lang import Thread import pkgutil class ClasspathImporterTestCase(unittest.TestCase): def setUp(self): self.orig_context = Thread.currentThread().contextClassLoader ...
# Copyright 2016 Amazon Web Services, Inc. or its affiliates. All Rights Reserved. # This file is licensed to you under the AWS Customer Agreement (the "License"). # You may not use this file except in compliance with the License. # A copy of the License is located at http://aws.amazon.com/agreement/ . # This file...
import argparse import math import sys import time import os import socket import statistics import torch import torch.nn as nn from torch.utils.data import DataLoader from model import MLMTask, MLMTask2, MLMTaskEmbedding, MLMTaskEncoder, MLMTaskHead from cuda_local_pipeline import LocalSequential, sync_all_device ...
from Jumpscale import j class Car(j.baseclasses.object_config): """ one car instance """ _SCHEMATEXT = """ @url = jumpscale.example.car.1 name** = "" city = "" mother_id** = 0 """ def _init(self, **kwargs): pass class Cars(j.baseclasses....
from a10sdk.common.A10BaseClass import A10BaseClass class AclCfg(A10BaseClass): """This class does not support CRUD Operations please use parent. :param ve: {"type": "number", "description": "Virtual ethernet interface. help-val Virtual ethernet interface number", "format": "interface"} :param loopb...
from src.loginparse import loginparse as parse import unittest class stress(unittest.TestCase): #not implemented def test_parse_data(self): ''' testuser = 'testuser', testpassword = 'testpassword' testparse = parse(r'tests\testdata.JSON') test.parseUser(testuser, testpa...
"""Services module.""" class ConfigService: def __init__(self, config): self._config = config def build(self): self._config.from_dict({"default": {"db_path": "~/test"}})
# Generated by the protocol buffer compiler. DO NOT EDIT! # source: pose.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf import reflection as _reflecti...
import os import sys ABSPATH = os.path.abspath(os.path.realpath(os.path.dirname(__file__)) + "/..") sys.path.append(ABSPATH) import asposecellscloud from asposecellscloud.rest import ApiException from asposecellscloud.apis.cells_api import CellsApi import AuthUtil from asposecellscloud.models import CalculationOptions...
#!/usr/bin/env python # -*- coding: utf-8 -*- import simplejson as json from alipay.aop.api.constant.ParamConstants import * class KoubeiRetailItemQueryModel(object): def __init__(self): self._city_id = None self._item_id = None @property def city_id(self): return self._city_id ...
# Code referenced from https://gist.github.com/gyglim/1f8dfb1b5c82627ae3efcfbbadb9f514 import tensorflow as tf import numpy as np import scipy.misc import logging try: from StringIO import StringIO # Python 2.7 except ImportError: from io import BytesIO # Python 3.5+ class Logger(object): def __init__...
# -*- coding: utf-8 -*- """ Base definitions for models of programs. ** under construction ** """ from __future__ import (absolute_import, division, print_function, unicode_literals) import collections from grako.util import asjson, asjsons from grako.exceptions import SemanticError from grako...
# Copyright 2013-2019 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) """This module contains the following external, potentially separately licensed, packages that are included in Spack: arg...
# coding: utf-8 """ Seido User REST API No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 The version of the OpenAPI document: 2.4.8 Generated by: https://openapi-generator.tech """ import pprint import re # noqa: F401 import ...
from __future__ import annotations from . import Endpoint import web_framework_v2.http.http_request as http_request class EndpointMap: def __init__(self): self._method_routes_map = {} # HttpMethod: {route_str: Route} def get_endpoint(self, request: http_request.HttpRequest) -> tuple[Endpoint | None...
import streamlit as st from PIL import Image import matplotlib.pyplot as plt from gluoncv import model_zoo, data, utils @st.cache def load_image(image_file): img = Image.open(image_file) return img @st.cache(allow_output_mutation=True) def load_model(model_name): model = model_zoo.get_model(model_name, pret...
from .t_adapters import MemoryDataAdapterTestCase from .t_state import StateManagerTestCase, StateProviderTestCase if __name__ == "__main__": MemoryDataAdapterTestCase StateManagerTestCase StateProviderTestCase
#! /usr/bin/env python from setuptools import setup from s3query import __version__ setup( name='s3query', version=__version__, description='Read parted and encrypted S3 files like a single file object', long_description=open('readme.md').read(), author='Kexin Xie', author_email='ikexinxie@gm...
from collections import deque N, Q = map(int, input().split()) #G=: _番目の町に隣接している町リスト G = [[] for _ in range(N)] for _ in range(N - 1): a, b = map(int, input().split()) G[a - 1].append(b - 1) G[b - 1].append(a - 1) que = deque() color = [-1] * N color[0] = 0 que.append(0) while que: now = que.pop() ...
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import division from __future__ import print_function import argparse import os import json import logging import sys from functools import wraps import numpy as np from flask import Flask, Response, jsonify, render_t...
import math class A1: def __init__(self,name): self.objects=[] data1 = open(name,"r").read().splitlines() data2 =[] ret =[] for i in range(0,len(data1)): data2.append(data1[i].split()) for i in range(0,len(data2)): if len(data2[i])>7: ...
# -*- coding: utf-8 -*- """ werkzeug.useragents ~~~~~~~~~~~~~~~~~~~ This module provides a helper to inspect user agent strings. This module is far from complete but should work for most of the currently available browsers. :copyright: (c) 2014 by the Werkzeug Team, see AUTHORS for more deta...
"""@package evpytools Python tools for managing EstaVoir simulations """
from direct.directnotify.DirectNotifyGlobal import directNotify from direct.gui.DirectGui import * from pandac.PandaModules import * from pirates.piratesgui import PiratesGuiGlobals from pirates.piratesgui import GuiPanel, RedeemCodeGUI from pirates.piratesgui import GuiButton, DialogButton from pirates.piratesbase imp...
import asyncio from time import sleep from userbot import CMD_HANDLER as cmd from userbot import CMD_HELP, bot from userbot.events import man_cmd @bot.on(man_cmd(pattern=r"(.*)", outgoing=True)) async def _(event): if event.fwd_from: return input_str = event.pattern_match.group(1) if input_st...
# exported from PySB model 'model' from pysb import Model, Monomer, Parameter, Expression, Compartment, Rule, Observable, Initial, MatchOnce, Annotation, ANY, WILD Model() Monomer('Ligand', ['Receptor']) Monomer('ParpU', ['C3A']) Monomer('C8A', ['BidU', 'C3pro']) Monomer('SmacM', ['BaxA']) Monomer('BaxM', ['BidM', '...
from core.utils import dict_finder from projects.workers.base import Worker class GetObjectProperty(Worker): id = 'get_object_property' name = 'get_object_property' image = None description = 'Get Object Property if exists' schema = { "type": "object", "required": [ "in...
__version__ = 0.0.1
"""Transform mypy AST functions to IR (and related things). Normal functions are translated into a list of basic blocks containing various IR ops (defined in mypyc.ir.ops). This also deals with generators, async functions and nested functions. All of these are transformed into callable classes. These have a custom __...
import heapq from math import pow, sqrt class PriorityQueue: def __init__(self): self.elements = [] def empty(self): return len(self.elements) == 0 def put(self, item, priority): heapq.heappush(self.elements, (priority, item)) def get(self): return heapq.heappop(self...
import csv import gzip import sys infile = sys.argv[1] outfile = sys.argv[2] reader = csv.DictReader(gzip.open(infile, "rt"), dialect="excel-tab", fieldnames=["#CHROM", "POS", "REF", "ALT", "FATHMM_XF"]) writer = csv.DictWriter(open(outfile, "w"), fieldnames=["#CHROM", "POS", "ID", "REF", "ALT", "QUAL", "FILTER", "IN...
""" Tests for yamelish.cli. """ import os import pytest from yamelish.cli import * # pylint: disable=C0111 @pytest.fixture def json_file_path(tmp_path): filepath = os.path.join(tmp_path, 'example.json') with open(filepath, 'w') as filedesc: filedesc.write('{"foo": "bar"}') return filepath def test_load_json(jso...
from __future__ import print_function import sot_talos_balance.talos.parameter_server_conf as param_server_conf from sot_talos_balance.create_entities_utils import Example, create_parameter_server # --- Parameter server --- print("--- Parameter server ---") dt = 1e-3 robot_name = 'robot' param_server = create_parame...
import pytest import os import sys import time from plumbum import local, NOHUP try: from plumbum.cmd import bash, echo except ImportError: bash = None echo = None from plumbum.path.utils import delete from plumbum._testtools import skip_on_windows @skip_on_windows class TestNohupLocal: def read_file(s...
from rest_framework import generics, authentication, permissions from rest_framework.authtoken.views import ObtainAuthToken from rest_framework.settings import api_settings from users.serializers import UserSerializer, AuthTokenSerializer class CreateUserView(generics.CreateAPIView): """Create a new user in the ...
# Copyright (C) 2017, Nicholas Carlini <nicholas@carlini.com> # All rights reserved. import sys import time import tensorflow as tf import numpy as np import random from setup_cifar import CIFARModel, CIFAR from setup_mnist import MNISTModel, MNIST sys.path.append("../..") from nn_robust_attacks.l2_attack import Car...
# ============================================================================ # FILE: lsp/document_symbols.py # AUTHOR: Takahiro Shirasaka <tk.shirasaka@gmail.com> # License: MIT license # ============================================================================ import os import sys sys.path.insert(1, os.path.dir...
#!/usr/bin/python # # Copyright 2018-2021 Polyaxon, 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 required by applicable ...
""" Dirac delta distribution. """ import operator import numpy as np from probnum.prob.distributions.distribution import Distribution class Dirac(Distribution): """ The Dirac delta distribution. This distribution models a point mass and can be useful to represent numbers as random variables with Di...
# Generated by Django 3.1.7 on 2021-03-27 12:02 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('auctions', '0002_auto_20210327_1643'), ] operations = [ migrations.CreateModel( name='Image', ...
# Māras risinājums total = 0 saraksts2 = [] n = 0 while True: skaitlis = input("ievadi skaitli vai q lai beigtu") if skaitlis == "q": break skaitlis = float(skaitlis) # TODO check for correct numeric types total += skaitlis n += 1 saraksts2.append(skaitlis) saraksts2 = sorted(sarak...
from pygrank.core import backend, GraphSignalData, BackendPrimitive from pygrank.measures.utils import Measure from typing import Iterable, Tuple, Optional from math import log, exp class MeasureCombination(Measure): """Combines several measures. Measures can be aggregated either by passing them to the constructo...
from __future__ import unicode_literals from leapcast.services.leap_factory import LEAPfactory class ChromeCast(LEAPfactory): url = "https://www.gstatic.com/cv/receiver.html?$query" class YouTube(LEAPfactory): url = "https://www.youtube.com/tv?$query" class PlayMovies(LEAPfactory): url = "https://pla...
import os import threading import time import timeit import pytest from ddtrace.vendor import six from ddtrace.vendor.six.moves import _thread from ddtrace.profiling import recorder from ddtrace.profiling.collector import stack from . import test_collector TESTING_GEVENT = os.getenv("DD_PROFILE_TEST_GEVENT", False...
class Solution: def findMin(self, nums: List[int]) -> int: if nums[0] <= nums[-1]: return nums[0] left = 0 right = len(nums) - 1 while left <= right: mid = (left + right) // 2 if mid == 0 and nums[mid] <= nums[right]: return nums[mi...
# Generated by Django 3.2.8 on 2021-11-14 22:04 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] ope...
## # Copyright (c) 2007-2016 Apple Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable l...
import functools import graphene import operator from django.db.models import Q from graphene import relay from graphene_django import DjangoObjectType, DjangoConnectionField from graphene_django.debug import DjangoDebug from django_prices.templatetags import prices_i18n from ..product.models import (Attrib...
import pytest np = pytest.importorskip("numpy") npt = pytest.importorskip("numpy.testing") scipy = pytest.importorskip("scipy") import networkx as nx from networkx.generators.degree_seq import havel_hakimi_graph class TestModularity: @classmethod def setup_class(cls): deg = [3, 2, 2, 1, 0] c...
# -*- coding: utf-8 -*- from __future__ import division, print_function, absolute_import import os import tensorflow as tf import math """ v3 + weight This is your result for task 1: mAP: 0.694278910759864 ap of each class: plane:0.88866159706304, baseball-diamond:0.7860352276239824, bridge:0.473...
from django.db import models from django.utils import timezone import datetime # Create your models here. class Question(models.Model): question_text = models.CharField(max_length=200) pub_date = models.DateTimeField('date published') # def was_published_recently(self): # return self.pub_date >= t...
#!/usr/bin/python # # Copyright (c) 2017 Sertac Ozercan <seozerca@microsoft.com> # # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', ...
import Fib as f def Last(lst): return lst[len(lst)-1] print(Last(f.Fib(10)))
""" Webspider module will crawl through the configured sites and gather the rss feeds and blogs/data. """
import numpy as np fwhm_m = 2 * np.sqrt(2 * np.log(2)) def fwhm(sigma): """ Get full width at half maximum (FWHM) for a provided sigma / standard deviation, assuming a Gaussian distribution. """ return fwhm_m * sigma def gaussian(x_mean, x_std, shape): return np.random.normal(x_mean, x_...
import SimpleITK as sitk import numpy as np from scipy.optimize import minimize from pywt import wavedecn class ImageSymmetry(object): def plane_normalised(self, plane): if not type(plane) is np.ndarray: plane = np.array(plane) if not np.abs(np.sum(plane[0:-1]**2) - 1.0) < 1e-10: ...
# -*- coding: utf-8 -*- """ Verbose and colourful traceback formatting. **ColorTB** I've always found it a bit hard to visually parse tracebacks in Python. The ColorTB class is a solution to that problem. It colors the different parts of a traceback in a manner similar to what you would expect from a syntax-highlig...
# Copyright 2012 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2012 Nebula, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the...
""" Name: Kerr References: - Boyer, J. Math. Phys., v8, p265, (1967) - Stephani (18.25) p205 Coordinates: Boyer Lindquist Symmetry: Axial """ from sympy import cos, sin, symbols, zeros coords = symbols("t r theta phi", real=True) variables = symbols("a M", constant=True) functions = () t, r, th, ph = coords a,...
#!/usr/bin/python3 ''' Copyright 2018-2019 Erdinc Ozturk, SABANCI UNIVERSITY 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 applic...
# This file is dual licensed under the terms of the Apache License, Version # 2.0, and the MIT License. See the LICENSE file in the root of this # repository for complete details. """ Processors and tools specific to the `Twisted <https://twistedmatrix.com/>`_ networking engine. See also :doc:`structlog's Twisted su...