text
stringlengths
2
999k
from gemd.entity.object.base_object import BaseObject from gemd.entity.object.has_parameters import HasParameters from gemd.entity.object.has_conditions import HasConditions from gemd.entity.object.has_template import HasTemplate class MeasurementSpec(BaseObject, HasParameters, HasConditions, HasTemplate): """ ...
"""Test NETCONF get.""" from nornir_netconf.plugins.tasks import netconf_get def test_netconf_get(nornir): """Test NETCONF get operation.""" nr = nornir.filter(name="netconf1") result = nr.run(netconf_get, xmldict=True) assert result["netconf1"].result["ok"] assert "netconf-start-time" in result[...
""" Loop Detection: Given a circular linked list, implement an algorithm that returns the node at the beginning of the loop. DEFINITION Circular linked list: A (corrupt) linked list in which a node's next pointer points to an earlier node, so as to make a loop in the linked list. EXAMPLE Input: A -> B -> C -> D -> E ->...
# ------------------------------------------------------------------ # # Module for generation of public places in an ABM population # # ------------------------------------------------------------------ import math import random class Workplaces(object): ''' Class for generation of workplaces ''' def __init__(sel...
# Build a version of the site with compressed javascript and css files import sys, os, re, subprocess, hashlib, datetime, distutils.spawn, shutil SKIA_DIR = ".\\skia" DEPOT_TOOLS_DIR = ".\\depot_tools" #VISUAL_C_DIR = "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\VC" VISUAL_C_DIR = "C:\\Progr...
# Generated by Django 2.1.4 on 2018-12-12 17:19 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('control', '0005_theme_reference_code'), ] operations = [ migrations.AlterModelOptions( name='qu...
# engine/cursor.py # Copyright (C) 2005-2020 the SQLAlchemy authors and contributors # <see AUTHORS file> # # This module is part of SQLAlchemy and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php """Define cursor-specific result set constructs including :class:`.BaseCursorResult...
class Solution: def XXX(self, prices: List[int]) -> int: inf = int(1e9) minprice = inf maxprofit = 0 for price in prices: maxprofit = max(price - minprice, maxprofit) minprice = min(price, minprice) return maxprofit
""" 'ffmpeg' should be build in windows """ import os BITRATE = [600, 1500, 3000, 5000, 10000, 20000] # Kbps BITRATE_file = ['600Kbps', '1500Kbps', '3000Kbps', '5000Kbps', '10000Kbps', '20000Kbps'] filepath = 'F:\\Research\\Video\\Bridge\\multi-bitrate' tile_number = 64 os.chdir(filepath) for bitrat...
from .BaseApi import BaseApi from .NamedEndpoint import NamedEndpoint from .ChampionApiV3 import ChampionApiV3 from .LolStatusApiV3 import LolStatusApiV3 from .DataDragonApi import DataDragonApi from .ChampionMasteryApiV4 import ChampionMasteryApiV4 from .LeagueApiV4 import LeagueApiV4 from .MatchApiV4 import MatchApi...
import sys import os import pandas as pd import numpy as np import tensorflow as tf from src.utils import setup_murabei_imaging if __name__ == '__main__': # --------------------------- # # UNPACK ANALYSIS PATHS # # =========================== # paths = setup_murabei_imaging(mode='local') da...
#!/usr/bin/env python # encoding=utf-8 """ Author:zcyuefan Topic:django-import-export plugin for xadmin to help importing and exporting data using .csv/.xls/.../.json files Use: +++ settings.py +++ INSTALLED_APPS = ( ... 'import_export', ) +++ model.py +++ from django.db import models class Foo(models.Model)...
from day2 import Day2 def test_part1(): d = Day2() input_1 = [] input_1.append("abcdef") assert (0, 0, 0) == d.part1(input=input_1[0]) input_1.append("bababc") assert (1, 1, 1) == d.part1(input=input_1[1]) input_1.append("abbcde") assert (1, 0, 0) == d.part1(input=input_1[2]) input...
#!/usr/bin/env python3 # Copyright (c) 2016 The Bitcoin Core developers # Copyright (c) 2017 The Gpunion Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test account RPCs. RPCs tested are: - getaccountaddres...
from rpython.jit.metainterp.optimizeopt.optimizer import Optimization from rpython.jit.metainterp.optimizeopt.util import make_dispatcher_method from rpython.jit.metainterp.resoperation import ResOperation, rop, OpHelpers from rpython.jit.metainterp.history import TargetToken, JitCellToken class OptSimplify(Optimizati...
SEQ_IDS_TRAIN = ["%04d" % idx for idx in [0, 1, 3, 4, 5, 9, 11, 12, 15, 17, 19, 20]] SEQ_IDS_VAL = ["%04d" % idx for idx in [2, 6, 7, 8, 10, 13, 14, 16, 18]] TIMESTEPS_PER_SEQ = {"0000": 154, "0001": 447, "0002": 233, "0003": 144, "0004": 314, "0005": 297, "0006": 270, "0007": 800, "0008": 390, "00...
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. # Copyright The Cloud Custodian Authors. # SPDX-License-Identifier: Apache-2.0 import pygit2 import click from datetime import datetime, timedelta from dateutil.tz import tzoffset, tzutc from dateutil.parser import parse as parse_date def comm...
# coding: utf-8 """ Kubernetes No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) OpenAPI spec version: v1.12.4 Generated by: https://github.com/swagger-api/swagger-codegen.git """ from __future__ import absolute_import import os import sys i...
# Copyright 2009-2012 Yelp # # 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, softwa...
import logging from datetime import timedelta from urllib.parse import urljoin from uuid import uuid4 from celery import shared_task from django.conf import settings from django.db.models import Q from django.urls import reverse, NoReverseMatch from django.utils.timezone import now from dumblock import lock_or_exit, l...
# 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) """The pty module handles pseudo-terminals. Currently, the infrastructure here is only used to test llnl.util.tty.log. I...
# Copyright 2018 The TensorFlow Probability 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 law o...
SOURCE_URL = "http://ecc.ssu.ac.kr/sap/bc/webdynpro/sap/zcmw2100?sap-language=KO" ECC_URL = "http://ecc.ssu.ac.kr" SAINT_URL = "https://saint.ssu.ac.kr" PORTAL_URL = "https://saint.ssu.ac.kr/irj/portal" POPUP_URL = "https://saint.ssu.ac.kr/ssu_logon/jsp/popupCheck.jsp" REQUEST_HEADERS = { 'Accept': 'text/html,appl...
# -*- coding: utf-8 from __future__ import unicode_literals, absolute_import import os from tests.jsonenv import env DEBUG = True USE_TZ = True USE_I18N = True # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = "lf=g&ei5pq)3)1c9p*1e@_pl-2y64+rcc44+rv-02zc)6=ichc" BASE_DIR = os.path.dirname...
""" WSGI config for EvaP project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/ """ import os import sys # this adds the project root to the python path. pwd = os.path.dirname(os.path...
base_architecture = 'basic' img_size = 32 prototype_shape = (100, 128, 1, 1) num_classes = 10 prototype_activation_function = 'log' add_on_layers_type = 'regular' experiment_run = '006' data_path = '../data/MNIST_Proto/' train_dir = data_path + 'train/' test_dir = data_path + 'test/' train_push_dir = data_path + 'tra...
# 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 ...
#!/usr/bin/python3 """getquote script for ledger-cli.""" import configparser import os import sys from urllib import error from urllib import request from datetime import datetime cfg = configparser.ConfigParser() cfg.read('getquote.ini') IEX_TOKEN = os.getenv('IEX_TOKEN') or cfg.get('IEX', 'TOKEN') def quote(symbo...
n = int(input()) bn = bin(n) s = str(bn) l = list(s) longest = 0 current = 0 for num in l : if num == "1": current += 1 else: longest = max(current,longest) current = 0 print(max(longest,current))
import argparse import torch class ArgsUtil(object): def __init__(self, given_root=None): self.args_parser = argparse.ArgumentParser('Run learning to rank for pytorch') self.ini_l2r_args() def ini_l2r_args(self): '''data''' self.args_parser.add_argument('--data', help='the d...
from Model.database import Base from sqlalchemy import Column, Integer, String, DateTime, Table from sqlalchemy.orm import relationship, backref from datetime import datetime class Video(Base) : __tablename__ = 'video' no = Column(Integer, primary_key = True) title = Column(String(256)) outerpath = Column(String(2...
from __future__ import print_function, division, absolute_import from fontTools.misc.py23 import * from fontTools.misc import sstruct from fontTools.misc.textTools import safeEval from . import DefaultTable vheaFormat = """ > # big endian tableVersion: 16.16F ascent: h descent: h lineGap: h advanceHei...
#!/usr/bin/env python # Concatenation of tests in each of the 6 elements in CI matrix f = open('./ci_matrix_elements.txt') ; matrix_elements = f.readlines() ; f.close() # All tests read by prepare_file_ci.py f = open('./ci_all_tests.txt') ; all_tests = f.readlines() ; f.close() # Now let's make sure these two are equ...
# -*- coding: utf-8 -*- # Generated by Django 1.10.5 on 2020-02-04 11:17 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('bills', '0013_auto_20190805_1134'), ] operations = [ migrations.CreateModel...
# # @lc app=leetcode id=202 lang=python3 # # [202] Happy Number # # https://leetcode.com/problems/happy-number/description/ # # algorithms # Easy (51.72%) # Likes: 4403 # Dislikes: 629 # Total Accepted: 731.1K # Total Submissions: 1.4M # Testcase Example: '19' # # Write an algorithm to determine if a number n is...
import numpy as np __all__ = ["ll1lats", "ll1lons"] ll1lats = np.arange(-89.5, 90) ll1lons = np.arange(0, 360) # longitudes centered on 180
import unittest from pyats.topology import loader from genie.libs.sdk.apis.iosxe.interface.get import get_interface_netmask class TestGetInterfaceNetmask(unittest.TestCase): @classmethod def setUpClass(self): testbed = """ devices: R1_xe: connections: defau...
# -*- coding: utf-8 -*- { 'name': "new_module", 'summary': """ Inheriting model and odoo view""", 'description': """ Inheriting model and odoo view """, 'author': "Student", 'website': "http://www.yourcompany.com", # Categories can be used to filter modules in modules lis...
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (c) 2012-2019 SoftBank Robotics. All rights reserved. # Use of this source code is governed by a BSD-style license (see the COPYING file). """ Test QiTest List """ from __future__ import absolute_import from __future__ import unicode_literals from __future__ imp...
""" CORE MARKDOWN BLOCKPARSER ============================================================================= This parser handles basic parsing of Markdown blocks. It doesn't concern itself with inline elements such as **bold** or *italics*, but rather just catches blocks, lists, quotes, etc. The BlockParser is made ...
"""photosite URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/4.0/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-bas...
# coding: utf-8 """ DocuSign REST API The DocuSign REST API provides you with a powerful, convenient, and simple Web services API for interacting with DocuSign. OpenAPI spec version: v2.1 Contact: devcenter@docusign.com Generated by: https://github.com/swagger-api/swagger-codegen.git """ from p...
# coding: utf8 from __future__ import unicode_literals from ...lemmatizer import Lemmatizer from ...symbols import POS, NOUN, VERB, ADJ, ADV, PRON, DET, AUX, PUNCT, ADP from ...symbols import SCONJ, CCONJ from ...symbols import VerbForm_inf, VerbForm_none, Number_sing, Degree_pos class FrenchLemmatizer(Lemmatizer): ...
from django.db import models from django.utils import timezone from django.contrib.auth.models import User from .post import Post from django.urls import reverse class Comment(models.Model): author = models.ForeignKey(User, on_delete=models.CASCADE) comment_parent = models.ForeignKey('self', on_delete=models....
import os from core import ( checks, constants, host_helpers, plugintools, ) SERVICES = [r"etcd\S*", r"calico\S*", r"flannel\S*", r"containerd\S*", r"dockerd\S*", r"kubelet\S*", r"kube-\S*", ] # Packages that only exi...
from django.contrib.auth.base_user import AbstractBaseUser from django.contrib.auth.models import User, PermissionsMixin, AbstractUser from django.db import models from gym.auth_app.managers import GymUserManager class GymUser(AbstractBaseUser, PermissionsMixin): email = models.EmailField(unique=True, verbose_na...
import datetime import MySQLdb from itemadapter import ItemAdapter from scrapy.exceptions import DropItem from naver_movie.config import db_info class NaverMoviePipeline: def __init__(self): self.conn = MySQLdb.connect(**db_info) self.curs = self.conn.cursor() def open_spider(self, spider): ...
from locust import HttpUser, TaskSet, task, between from common_flows import flow_sign_up, flow_helper class SignUpLoad(TaskSet): def on_start(self): print("*** Starting Sign-Up load tests ***") def on_stop(self): print("*** Ending Sign-Up load tests ***") """ @task(<weight>) : value=3 e...
#!/usr/bin/env python # ----------------------------------------------------------------------- # # Copyright 2017, Gregor von Laszewski, Indiana University # # # # Licensed under the Apache License, Version 2.0 (the "License"); you ...
import os import sys from Solver import solve_function import Core.DataImport.parse_data_cmds import Core.DataImport.import_data_class as import_data_class import time import itertools import random import math import Core.scenario_class as scenario_class from Core.Solvers.SAA.SNAC_Alg import NAC_Generator as NAC from ...
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. from . import transforms as T from maskrcnn_benchmark.config import cfg def build_transforms(cfg, is_train=True): if is_train: if cfg.INPUT.MIN_SIZE_RANGE_TRAIN[0] == -1: min_size = cfg.INPUT.MIN_SIZE_TRAIN else: ...
"""이것은 길이가 2인 벡터의 합 혹은 차를 구하는 모듈입니다.""" def vec2_add(a,b): print("이것은 myfuns2.py에 정의된 함수입니다") return [a[0]+b[0], a[1]+b[1]] def vec2_sub(a,b): return [a[0]-b[0], a[1]-b[1]]
# coding=utf-8 # Copyright 2020 The Google Research 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 applicab...
# Copyright 2021 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...
# Copyright 2017 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...
from abc import ABC, abstractmethod import contextlib from enum import Enum, unique from typing import Dict from mlpiot.base.utils.timestamp import set_now from mlpiot.proto import \ EventExtraction, EventExtractorMetadata, SceneDescription class EventExtractor(ABC): """`EventExtractor` is a base for a decis...
class palindrome: def __init__(self): self.a="" def input(self,k1): self.a=k1 def calculate(self): f=0 j=len(k1)-1 while i<len(k1)/2: if k1[i]!=k1[j]: f=1 break i=i+1 j=j-1 if f==0: print "self.a is palindrome" else: print "self.a i...
######################################### # Common: # {obj} - ObjectStr # {recep} - RecepStr # usage: .format(obj=constants.OBJECTS[self.object_target], recep=constants.OBJECTS[self.parent_target]) # NOTE: order of and/or conditions matters ######################################### gdict = {} #######################...
# # Lincense: Academic Free License (AFL) v3.0 # import numpy as np import tables as tb def read_chunks(N=1000, sz=30, disc=1): h5f = tb.open_file('/users/ml/xoex6879/data/TIMIT/TIMIT'+str(disc)+'_TRAIN.h5','r') it = h5f.walk_nodes(h5f.root) audio_samples = [] for node in it: if node._v_name=='audio': audi...
# coding:utf-8 from typing import Union, Dict, Mapping, Any, Optional import os import io import sys from pathlib import Path from warnings import warn from logging import Logger, StreamHandler from _io import TextIOWrapper from logging import NOTSET, DEBUG, INFO, WARNING, ERROR, CRITICAL from logging.config import dic...
#!/usr/bin/env python # # ******APP externa de prueba para matar los flows ****** #---------------------------------> APP de prueba para matar los flows import argparse import os import hpsdnclient as hp from hpsdnclient.datatypes import Flow, Match, Action #---------------------------------> Librerias de modulos ...
class Employee: increment = 5 no_of_employees = 0 def __init__(self, fname, lname, salary): self.fname = fname self.lname = lname self.salary = salary Employee.no_of_employees +=1 def increase_salary(self): # self.salary = self.salary*Employee.increment s...
# Parse reviews in a Postgres database # Version 1.0 # Author: Manoj Pravakar Saha # This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. # Import Psycopg Postgres adapter for Python import psycopg2 # Import Python's default JSON encoder and decoder import ...
from batchglm.models.base import _Estimator_Base import batchglm.utils.stats as stat_utils from batchglm import pkg_constants
import requests class TestRemoteBackend: url = "http://127.0.0.1:9100/dns/" def test_lookup_example_com_SOA(self): data = requests.get(self.url + 'lookup/example.com./SOA').json() record = data['result'][0] assert(record['content'] == 'ns1.example.nl. hostmaster.example.nl. 2020011501 ...
import matplotlib.pyplot as plt def generate_and_save_images(model, epoch, test_input,moldename): # Notice `training` is set to False. # This is so all layers run in inference mode (batchnorm). predictions = model(test_input, training=False) fig = plt.figure(figsize=(8,8)) plt.imshow(predictions[...
import torch.jit import inspect # this file is for generating documentation using sphinx autodoc # > help(torch.jit.supported_ops) will also give a nice listed of the # supported ops programmatically def _list_supported_ops(): def emit_type(type): return str(type) def emit_arg(indent, i, arg): ...
import errno import multiprocessing import os import tempfile from functools import partial from toil.lib.threading import cpu_count from toil.test import ToilTest, travis_test class SystemTest(ToilTest): """ Test various assumptions about the operating system's behavior """ @travis_test def tes...
from __future__ import print_function from builtins import object from builtins import str from lib.common import helpers class Module(object): def __init__(self, mainMenu, params=[]): self.info = { 'Name': 'Get-SQLQuery', 'Author': ['@_nullbind', '@0xbadjuju'], 'De...
# configobj.py # A config file reader/writer that supports nested sections in config files. # Copyright (C) 2005-2006 Michael Foord, Nicola Larosa # E-mail: fuzzyman AT voidspace DOT org DOT uk # nico AT tekNico DOT net # ConfigObj 4 # http://www.voidspace.org.uk/python/configobj.html # Released subject to th...
''' THIS CODE WAS WRITTEN SPECIFICALLY FOR OUR D3D12 DXR PROJECT, IT MIGHT NOT WORK AS INTENDED IN OTHER CASES. How to run this file: Run the file with the input folder as argument, this folder should contain three tsv files. Each of these files MUST have the same amount of rows and columns, along with two headers. Th...
#!/usr/bin/env python3 import re, random from ..utilities import BasePlugin def weighted_choose(items): assert len(items), "`items` must be a non-empty collection" target = random.random() * sum(weight for item, weight in items) current = 0 for item, weight in items: current += weight ...
import json,sys,re with open(sys.argv[2],"a") as bedout: with open(sys.argv[3],"a") as jsonout: temp_json={} with open(sys.argv[1]) as infile: for line in infile: if line.startswith('chr'): nline=re.split(r':|#|\t',line.strip()) st...
from ... import io, style from ...vendor.Qt import QtCore from ...vendor import qtawesome from ..models import TreeModel, Item from .. import lib def is_filtering_recursible(): """Does Qt binding support recursive filtering for QSortFilterProxyModel? (NOTE) Recursive filtering was introduced in Qt 5.10. ...
"""some util features""" import discord import pandas as pd from typing import Tuple async def basic_message(ctx: object, msg: str, footer: str = None) -> object: """ Sends a message and returns the object """ embed = discord.Embed(color=0x000000, description=msg) if (footer): embed...
# Copyright (C) 2018 Intel Corporation # # SPDX-License-Identifier: MIT import os import copy from django.utils import timezone from collections import OrderedDict import numpy as np from scipy.optimize import linear_sum_assignment from collections import OrderedDict from distutils.util import strtobool from xml.sax....
# -*-coding:utf-8-*-
#!/usr/bin/env python3 # -*- coding:utf-8 -*- # @lint-avoid-python-3-compatibility-imports # # mdflush Trace md flush events. # For Linux, uses BCC, eBPF. # # Todo: add more details of the flush (latency, I/O count). # # Copyright 2016 Netflix, Inc. # Licensed under the Apache License, Version 2.0 (the "Licen...
""" Copyright (c) 2021 Intel Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writin...
""" Copyright 2020 The OneFlow 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 applicable law or agr...
# -*- coding: utf-8 -*- """Objects representing MediaWiki families.""" # # (C) Pywikibot team, 2004-2017 # # Distributed under the terms of the MIT license. # from __future__ import absolute_import, unicode_literals __version__ = '$Id: 79f4f33e88e6eb4d6589a6fa82644e568d7275a0 $' # import collections import logging im...
#!/usr/bin/env python # Description: # ChangeLog # ChangeLog 2013-01-28 # K, R residues that are >= MAX_DIST (e.g. 100) away from the TM helix are # not counted in statistics # ChangeLog 2013-07-09 # Re-define the inter-distance and outer distance. # MAX_DIST should be much shorter, for SCAMPI, it us...
import numpy from radiomics import base, cMatrices, deprecated class RadiomicsGLDM(base.RadiomicsFeaturesBase): r""" A Gray Level Dependence Matrix (GLDM) quantifies gray level dependencies in an image. A gray level dependency is defined as a the number of connected voxels within distance :math:`\delta` that a...
import numpy as np def sigmoid(x): return 1 / (1 + np.exp(-x)) def sigmoid_derivative(x): return x * (1 - x) X = np.array([[0, 0], [0, 1], [1, 0], [1, 1]]) Y = np.array([[0], [1], [1], [0]]) epochs = 10000 lr = 0.1 W1 = np.random.uniform(size=(2, 2)) B1 = np.random.uniform(size=(1, 2)) W2 = np.rand...
import unittest import geopandas as gpd import numpy as np from libpysal.examples import load_example from segregation.inference import SingleValueTest, TwoValueTest from segregation.multigroup import MultiDissim from segregation.singlegroup import Dissim class Inference_Tester(unittest.TestCase): def test_Infer...
import diefpy.dief as diefpy traces_email_enron = diefpy.load_trace("/Users/juan/Projects/upc/upc-miri-tfm/connected-comp/results/diefpy/email-Enron.csv") diefpy.plot_answer_trace(traces_email_enron, "email-Enron",["#ECC30B","#D56062"]).show() metrics_enron = diefpy.load_metrics("/Users/juan/Projects/upc/upc-miri-tfm/...
# -*- coding: utf-8 -*- """ Optimization algorithms for OT """ import numpy as np from scipy.optimize.linesearch import scalar_search_armijo from .lp import emd from .bregman import sinkhorn # The corresponding scipy function does not work for matrices def line_search_armijo(f,xk,pk,gfk,old_fval,args=(),c1=1e-4,alpha...
#!/usr/bin/env python3 import json import logging import os import signal import socket import subprocess import sys import urllib.parse from http.server import BaseHTTPRequestHandler, HTTPServer import requests LOG_LEVEL = logging.DEBUG TEST_UUID_VARNAME = "DCOS_TEST_UUID" TEST_DATA_CACHE = "" class RequestProcess...
#!/usr/bin/env python # -*- coding: utf-8 -*- import re import sys from setuptools import setup, find_packages from setuptools.command.test import test as TestCommand TEST_REQUIREMENTS = ['pytest', 'pytz'] class PyTest(TestCommand): def finalize_options(self): TestCommand.finalize_options(self) s...
# -*- coding: utf-8 -*- """ Solution to Project Euler problem X Author: Jaime Liew https://github.com/jaimeliew1/Project_Euler_Solutions """ from EulerFunctions import timeit, primelist from numpy import argmin def sequence_slow(N, primes): A = [1, 0] i_cand = [0, 1] for n in range(1, N): for i,...
from flask import Flask import twilio.twiml app = Flask(__name__) @app.route("/", methods=['GET', 'POST']) def hello_monkey(): """Respond to incoming calls with a simple text message.""" resp = twilio.twiml.Response() resp.say("Hello from your pals at Twilio! Have fun.") return str(resp) if __name...
def armsfront(): i01.rightArm.shoulder.attach() i01.rightArm.shoulder.moveTo(180) sleep(8) i01.detach()
#!/usr/bin/env python import pika connection = pika.BlockingConnection( pika.ConnectionParameters(host='rabbitmq')) channel = connection.channel() channel.queue_declare(queue='hello') channel.basic_publish(exchange='', routing_key='hello', body='Hello World! from Python') print(" [x] Sent 'Hello World! from Pyth...
# comment_header.py # This module has a simple comment header # which is wrong but sometimes exists. import os import sys def add_ten(number): return number + 10 if __name__ == '__main__': [print(add_ten(i)) for i in range(100)]
""" This file offers the methods to automatically retrieve the graph Stomoxys calcitrans. The graph is automatically retrieved from the STRING repository. References --------------------- Please cite the following if you use the data: ```bib @article{szklarczyk2019string, title={STRING v11: protein--protein as...
import pytest import pandas as pd from pandas.testing import assert_frame_equal import io from rbp.random import gen_random_intervals def test_gen_random_intervals(): df = gen_random_intervals( sample_size=2, interval_size=100, reference='hg19' ) expected_intervals = io.StringIO( """chr3\t...
# --------- # This source file is part of the Dependency Extractor python open source package. # Copyright (c) 2021, Alexandros Raikos tou Konstantinou. # # Licensed under the MIT License. # --------- # Standard library. import os from os import name, path from typing import Set # Third party dependencies. from color...
#!/usr/bin/env python from collections import namedtuple from ansible.parsing.dataloader import DataLoader from ansible.vars import VariableManager from ansible.inventory import Inventory from ansible.playbook.play import Play from ansible.executor.task_queue_manager import TaskQueueManager from ansible.plugins.callbac...
import numpy as np import matplotlib.pyplot as plt import torch.nn as nn import glob import os import sys import torch import pandas as pd from torch.utils.data import Dataset, DataLoader from torchvision import transforms, utils import torchvision import cv2 import json import torch.nn.functional as F from pytorch3d.l...
from geoapps.simpegPF.EM.NSEM import *