text
stringlengths
2
999k
from shared import * # Input data is in INPUT_DATA. #INPUT_DATA = [int(x) for x in INPUT_DATA] stack = [] rules = {} pc = 1 for i in range(14): divVal = 0 xVal = 0 yVal = 0 while pc < len(INPUT_DATA): line = INPUT_DATA[pc] if 'inp' in line: pc += 1 break...
import socket import FWCore.ParameterSet.Config as cms import FWCore.ParameterSet.VarParsing as VarParsing from CondCore.CondDB.CondDB_cfi import * options = VarParsing.VarParsing() options.register( 'runNumber' , 1 #default value , VarParsing.VarParsing.multiplicity.singleton ...
import torch import torch.nn as nn import torchvision.models.vgg as vgg from mmcv.runner import load_checkpoint from mmedit.utils import get_root_logger from ..registry import LOSSES class PerceptualVGG(nn.Module): """VGG network used in calculating perceptual loss. In this implementation, we allow users to...
# -*- coding:utf-8 -*- # Author: hankcs # Date: 2020-05-09 11:25 import os import warnings from hanlp.layers.transformers.resource import get_mirror if os.environ.get('USE_TF', None) is None: os.environ["USE_TF"] = 'NO' # saves time loading transformers if os.environ.get('TOKENIZERS_PARALLELISM', None) is None: ...
import json from exchangelib import DELEGATE, Account, Credentials credentials = Credentials( username='OLYMPUS\\druker', password='' ) account = Account( primary_smtp_address='a.druker@f5.com', credentials=credentials, autodiscover=True, access_type=DELEGATE ) data = {} # this should somehow...
from __future__ import annotations import math import time from copy import copy from typing import TYPE_CHECKING from objects import Vector3, Action from routines import OffCenterKickoff, GotoBoost, Shadow, DiagonalKickoff, JumpShot, AerialShot, Aerial from utils import cap, in_field, post_correction, find_slope, cl...
# -*- coding: utf-8 -*- # !/usr/bin/env python """ ------------------------------------------------- File Name: DbClient.py Description : DB工厂类 Author : JHao date: 2016/12/2 ------------------------------------------------- Change Activity: 2016/12/2: ---------------...
# /usr/bin/env python3.5 # -*- mode: python -*- # ============================================================================= # @@-COPYRIGHT-START-@@ # # Copyright (c) 2019, Qualcomm Innovation Center, Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification,...
# Copyright (c) 2015 Canonical Ltd # # 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 ...
# 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...
#!/usr/bin/env python import numpy as np import matplotlib.pylab as pl def entropy(p): """calculate the entropy""" h = -p * np.log2(p) - (1 - p) * np.log2(1 - p) return h x = np.linspace(0.01, 0.99, 100) y = entropy(x) pl.plot(x, y) pl.xlabel('p(X=1)') pl.ylabel('H(X)') pl.savefig('bernoulliEntropyFig....
""" CryptoAPIs Crypto APIs 2.0 is a complex and innovative infrastructure layer that radically simplifies the development of any Blockchain and Crypto related applications. Organized around REST, Crypto APIs 2.0 can assist both novice Bitcoin/Ethereum enthusiasts and crypto experts with the development of thei...
""" 9. Roman to Integer Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M. Symbol Value I 1 V 5 X 10 L 50 C 100 D 500 M 1000 For example, two is written as II in Roman numeral, just two one's add...
from django.conf import settings from django.conf.urls.static import static from config.urls.base import * from core.views import error404 urlpatterns = urlpatterns + [ url( regex=r'^error404/$', view=error404, name='error404' ), ] + static(settings.MEDIA_URL, document_root=settings.M...
#!/usr/bin/env python3 import cv2 import depthai as dai import numpy as np # Start defining a pipeline pipeline = dai.Pipeline() # Define a source - two mono (grayscale) cameras cam_left = pipeline.createMonoCamera() cam_left.setCamId(1) cam_left.setResolution(dai.MonoCameraProperties.SensorResolution.THE_720_P) ca...
# # 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...
# Special Pythagorean triplet # Problem 9 # A Pythagorean triplet is a set of three natural numbers, a < b < c, for which, # # a^2 + b^2 = c^2 # For example, 3^2 + 4^2 = 9 + 16 = 25 = 5^2. # # There exists exactly one Pythagorean triplet for which a + b + c = 1000. # Find the product abc. import math from functools im...
import sys from notifier.util import * from notifier.providers import PrintNotify def init(**providers): if 'print' not in providers: providers['print'] = PrintNotify() provider = sys.argv[1] if len(sys.argv) > 1 else 'print' if provider not in providers: exit('Unknown provider. Known ...
# For more details about routing, see # http://www.tornadoweb.org/en/stable/routing.html from tornado.web import url from anthill.framework.utils.urls import include, root from admin.handlers import report as handlers, LogRequestHandler @root(pattern=r'^/report/', namespace='report') def route_patterns(): return ...
from __future__ import unicode_literals __version__ = '1.8.2' def register( model, app=None, manager_name='history', records_class=None, table_name=None, **records_config): """ Create historical model for `model` and attach history manager to `model`. Keyword arguments: app -- App to...
# -*- coding: future_fstrings -*- # # Copyright 2019 Gianluca Frison, Dimitris Kouzoupis, Robin Verschueren, # Andrea Zanelli, Niels van Duijkeren, Jonathan Frey, Tommaso Sartor, # Branimir Novoselnik, Rien Quirynen, Rezart Qelibari, Dang Doan, # Jonas Koenemann, Yutao Chen, Tobias Schöls, Jonas Schlagenhauf, Moritz Di...
# This file is part of twitter-text-python. # # The MIT License (MIT) # # Copyright (c) 2012-2013 Ivo Wetzel # # twitter-text-python is free software: you can redistribute it and/or # modify it under the terms of the MIT License. # # You should have received a copy of the MIT License along with # twitter-text-py...
#!/usr/bin/env python # -*- coding: utf-8 -*- from argparse import ArgumentParser as ap from astropy.table import QTable from astropy.coordinates import SkyCoord, Longitude, Latitude, Angle import numpy as np import astropy.units as u import warpfield as w from warpfield.DUMMY import get_jasmine description=''' This s...
from mnist import MNIST import matplotlib.pyplot as plt import numpy as np import time import datetime as dt import sys #Import datasets, classifiers and performance metrics from sklearn import datasets, svm, metrics from scipy.io import loadmat from sklearn.datasets import fetch_mldata # import custom module from Cl...
from __future__ import annotations _shared_docs: dict[str, str] = {} _shared_docs[ "aggregate" ] = """ Aggregate using one or more operations over the specified axis. Parameters ---------- func : function, str, list or dict Function to use for aggregating the data. If a function, must either work when pa...
# some exception classes for the Smalltalk VM class SmalltalkException(Exception): """Base class for Smalltalk exception hierarchy""" class PrimitiveFailedError(SmalltalkException): pass class PrimitiveNotYetWrittenError(PrimitiveFailedError): pass class UnwrappingError(PrimitiveFailedError): pass ...
"""Example from python3 docs - All credit to them :)""" from socket import socket, AF_INET, SOCK_STREAM import sys HOST = '127.0.0.1' PORT = 48423 RECV_BYTES = 1024 if __name__ == '__main__': with socket(AF_INET, SOCK_STREAM) as my_sock: # Bind Socket to Host on Port my_sock.bind((HOST, PORT)) ...
import json from qtpy.QtCore import QSize, Signal from qtpy.QtWidgets import ( QDialog, QHBoxLayout, QLabel, QListWidget, QPushButton, QStackedWidget, QVBoxLayout, QWidget, ) from ..._vendor.qt_json_builder.qt_jsonschema_form import WidgetBuilder from ...utils.settings import SETTINGS ...
from __future__ import absolute_import from builtins import object from django.conf import settings from django.core.exceptions import ObjectDoesNotExist from django.db import models from django.utils.translation import gettext_lazy as _ from future.utils import python_2_unicode_compatible from multiselectfield impor...
# coding: utf-8 """ Talon.One API The Talon.One API is used to manage applications and campaigns, as well as to integrate with your application. The operations in the _Integration API_ section are used to integrate with our platform, while the other operations are used to manage applications and campaigns. #...
# encoding: utf-8 import setuptools with open("README.md", mode='r') as fh: long_description = fh.read() setuptools.setup( name="cpcctool", version="0.0.4", author="l2m2", author_email="l2m2lq@gmail.com", description="CPCC Tool.", long_description=long_description, long_description_content_type="text...
# -*- coding: utf-8 -*- ################ Server Ver. 28 (2021. 6. 23.) ##################### import sys, os, ctypes import asyncio, discord, aiohttp import random, re, datetime, time, logging from discord.ext import tasks, commands from discord.ext.commands import CommandNotFound, MissingRequiredArgument fr...
from .base import * # noqa from .base import env # GENERAL # ------------------------------------------------------------------------------ # https://docs.djangoproject.com/en/dev/ref/settings/#debug DEBUG = env.bool('DJANGO_DEBUG', default=True) # https://docs.djangoproject.com/en/dev/ref/settings/#secret-key SECRET...
from keras.engine import Layer import tensorflow as tf class LetterBoxLayer(Layer): def __init__(self,net_size,**kwargs): super(LetterBoxLayer, self).__init__(**kwargs) self.net_size = net_size # save config to save and load the keras model correctly def get_config(self): ...
import logging import click from clearly.server import start_server logger = logging.getLogger('clearly.command_line') @click.group() @click.version_option() def clearly(): """Clearly command line tools.""" pass @clearly.command() @click.argument('broker') @click.option('--backend', '-b', h...
#!/usr/bin/python import optparse, os, re, shutil, sys, tempfile, glob, shlex, vcf, pysam, tarfile, csv, operator from subprocess import * import subprocess import multiprocessing from joblib import Parallel, delayed from itertools import izip NCPU = multiprocessing.cpu_count() CHUNK_SIZE = 2**20 #1mb def create_dic...
"""Base settings to build other settings files upon.""" import os import environ # Build paths inside the project like this: os.path.join(BASE_DIR, ...) # BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) ROOT_DIR = environ.Path(__file__) - 3 APPS_DIR = ROOT_DIR.path('apps') env = environ.Env( ...
import unittest import asyncio import dns.resolver import os COLLECTOR_USER = os.getenv('COLLECTOR_USER') if COLLECTOR_USER is None: COLLECTOR_USER = "root" my_resolver = dns.resolver.Resolver(configure=False) my_resolver.nameservers = ['127.0.0.1'] my_resolver.port = 5553 my_resolver.timeout = 20 my_resolver.li...
from __future__ import absolute_import, division, print_function import json import os import nlp from pyarrow import csv _DESCRIPTION = """Aspect-oriented Document Similarity from the CORD-19 dataset""" _HOMEPAGE = "https://github.com/malteos/aspect-document-similarity" _CITATION = """ @InProceedings{Ostendorff20...
ALL = "all" CP529 = "529" PI = "PI" WI = "WI" ACCT_TYPES = ["529", "PI", "WI"] def ERR_DICT(speech="something wrong"): return { "speech": speech, "displayText": "something very wrong", #"data": {}, # "contextOut": [], "source": "home" } TEST_1 = { "529": [("Martha", ...
#!/usr/bin/env python from setuptools import setup, Extension import sys import platform import os packages = ['bluetooth'] package_dir = dict() ext_modules = list() install_requires = list() package_data = dict() eager_resources = list() zip_safe = True class SDKException(Exception): def __init__(self,message=None...
from __future__ import print_function, absolute_import, division # makes KratosMultiphysics backward compatible with python 2.6 and 2.7 # Importing the Kratos Library import KratosMultiphysics # Import applications import KratosMultiphysics.ConvectionDiffusionApplication as ConvectionDiffusionApplication # Import b...
#!/usr/bin/env python3 import argparse import os import http.server import socketserver import requests # Arguments parsing parser = argparse.ArgumentParser( description="Expose acestreams from morningstreams in you local network.", epilog="Source code: https://github.com/S1M0N38/morningstreams", ) parser.ad...
# This file is part of GridCal. # # GridCal 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. # # GridCal is distributed in the hope that...
import contextlib import distutils.spawn # pylint: disable=no-name-in-module,import-error import functools import os import shutil import subprocess import sys import tempfile from pathlib import Path from typing import Generator, List, Mapping, Optional, Tuple, Union import pytest from pkg_resources import Requireme...
# -*- coding: utf-8 -*- from cPickle import load from datetime import datetime, timedelta from flask import Flask, jsonify, render_template, request app = Flask("Simple C'n'C") events = None def get_events(date): global events if events == None: try: events_file = open("events.pickled", ...
from functools import wraps from typing import Callable, TypeVar from graphene import ResolveInfo from typing_extensions import Concatenate, ParamSpec R_f = TypeVar("R_f") R_fn = TypeVar("R_fn") P = ParamSpec("P") def context(fn: Callable[Concatenate[ResolveInfo, P], R_fn]) -> Callable[P, R_fn]: """ Injects...
#!/usr/bin/env python # -*- encoding: utf-8 -*- # Copyright 2011-2021, Nigel Small # # 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 # # Unle...
#!/usr/bin/env python3 # Copyright (c) 2016-2018 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test compact blocks (BIP 152). Version 1 compact blocks are pre-segwit (txids) Version 2 compact block...
# Copyright 2015 PerfKitBenchmarker Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
from obdlib.obd.protocols.base import Base class ProtocolsCan(Base): """ Supports the CAN protocol (from 6 ...) """ def __init__(self, number, head=True): """ :param number - the number of protocol :param head - flag for init header """ Base.__init_...
from test_plus.test import TestCase from never_saiddit.core.models import Job class TestJobModel(TestCase): def test_ordering(self): self.first = Job.objects.create(state=50) self.last = Job.objects.create(state=10)
#!/usr/bin/env python3 # -*- coding: utf-8 -*- ################################################################## LAB 2 ################################################################## """ List you collaborators here: Jainam Shah Your task is to fill in the body of the functions be...
# Driver for microwave source RS_SMR40 # # Written by Takafumi Fujita (t.fujita@tudelft.nl) # This program is based on RS_SMR40.py in QTlab # import logging from qcodes import VisaInstrument from qcodes import validators as vals from qcodes.utils.deprecate import deprecate_moved_to_qcd log = logging.getLogger(__name...
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys from setuptools import setup import versioneer # Give setuptools a hint to complain if it's too old a version # 30.3.0 allows us to put most metadata in setup.cfg # Should match pyproject.toml # Not going to help us much without numpy or new pip, but gives us a...
# -*- coding: UTF-8 -*- """ 模型固化 """ import paddle.fluid as fluid # from YOLOv3 import get_yolo #from ShuffleNetV2_YOLOv3 import get_yolo from MobileNet_yolov3 import get_yolo import config train_parameters = config.init_train_parameters() def freeze_model(score_threshold): """ 模型固化 :param score_thresho...
#coding:utf-8 """ Created by cheng star at 2022/1/15 14:17 @email : xxcheng0708@163.com """ # classifier inference def inference_classifier(): pass def inference_embedding(): pass`
''' Created on 01 gen 2018 @author: Andrea Graziani - matricola 0189326 @version: 1.0 ''' from GraphNode import GraphAdjacencyListNode from AcyclicDirectGraph import AcyclicDirectGraph class AdjacencyListGraph(AcyclicDirectGraph): ''' This class represents a graph rappresented with adjacency list. ''' ...
"""Tests for queues.py""" import unittest from unittest import mock import asyncio from asyncio import test_utils class _QueueTestBase(unittest.TestCase): def setUp(self): self.loop = test_utils.TestLoop() asyncio.set_event_loop(None) def tearDown(self): self.loop.close() class Q...
from datetime import datetime from django.test import TestCase from monitoring.constants import TYRE_POSITION_FRONT_LEFT from monitoring.loaders.tyre_csv_loader import TyreCsvLoader from monitoring.models import TyreMeasurement from monitoring.tests.fixtures import TEST_CSV_PATH class TyreCsvLoaderTestCase(TestCase...
import plotly.plotly as py import plotly.graph_objs as go data = open('Real_Final_database_02.csv') alldata = data.readlines() listdata = [] for i in alldata: listdata.append(i.strip().split(',')) type_z = ['Flood', 'Epidemic', 'Drought', 'Earthquake', 'Storm'] size = [22, 19, 10, 7, 5] fill_colors = ['#00d0f5', '...
# Copyright (c) 2019 Andreas Klintberg # # 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, publish, ...
import numpy as np from numpy.testing import assert_almost_equal from numpy.testing import assert_allclose from scipy.optimize import newton from sklearn.utils import assert_all_finite from sklearn.utils.fixes import sp_version import pytest from sklearn.ensemble._hist_gradient_boosting.loss import _LOSSES fr...
# Scrapy settings for daytonlocal project # # For simplicity, this file contains only the most important settings by # default. All the other settings are documented here: # # http://doc.scrapy.org/en/latest/topics/settings.html # BOT_NAME = 'codefordayton' SPIDER_MODULES = ['dayton.spiders'] NEWSPIDER_MODULE = '...
"""This file contains the DataLoader class that can be used for training. It has an optional flag to load in either the propriety cubqiue data or the benchmark foresqaure data. Note that currently the cubqiue data is only a portion of the full (and very large) dataset. """ import pickle from torch.utils.data import D...
import sys from collections import deque from cStringIO import StringIO pathStack = [] visitedStack = [] #nodes that were already visited stateQueue = deque([]) state = 1 class Node(object): def __init__(self): self.problem = None #current node (containers) list self.parent = None self.ac...
import numpy as np from hypothesis import given, settings import hypothesis.strategies as strat import strax from strax.testutils import fake_hits import straxen from straxen.plugins.peaklet_processing import get_tight_coin @settings(deadline=None) @given(strat.lists(strat.integers(min_value=0, max_value=10), ...
from distutils.core import setup package = ['arhuaco'] service_packages = ['arhuaco.service'] sensors_packages = ['arhuaco.sensors', 'arhuaco.sensors.source', 'arhuaco.sensors.util'] analysis_packages = ['arhuaco.analysis', 'arhuaco.ana...
import sys import machine import os from wifuxlogger import WifuxLogger as LOG from time import sleep as delay class EngineErrors: @staticmethod def command_not_found(): LOG.error("There is no command") class EngineTemplate(): _filesystem_list = ["ls","pwd","cd","rm","rmdir","cat","cle...
"""This module contains code from Think Python by Allen B. Downey http://thinkpython.com Copyright 2012 Allen B. Downey License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html """ from swampy.Gui import * from Tkinter import PhotoImage g = Gui() photo = PhotoImage(file='danger.gif') g.bu(image=photo) canvas = g.ca...
class Solution: def convertToBase7(self, num): """ :type num: int :rtype: str """ negative = num < 0 num = abs(num) res = '' while num > 0: q = num // 7 r = num % 7 res = str(r) + res num = q ...
import pytest import cuxfilter import cudf import pandas as pd import numpy as np class TestDashBoard: df = cudf.DataFrame( {"key": [0, 1, 2, 3, 4], "val": [float(i + 10) for i in range(5)]} ) cux_df = cuxfilter.DataFrame.from_dataframe(df) dashboard = cux_df.dashboard(charts=[], title="test...
#!/home/ubuntu/notejam/flask/my-project-env/bin/python3 # Author: # Contact: grubert@users.sf.net # Copyright: This module has been placed in the public domain. """ man.py ====== This module provides a simple command line interface that uses the man page writer to output from ReStructuredText source. """ import lo...
# -*- coding: utf-8 -*- from urllib.parse import parse_qs def test_get_authorization_url(): from annict.auth import OAuthHandler auth = OAuthHandler("dummy_client_id", "dummy_client_secret") url = auth.get_authorization_url() endpoint, qs = url.split("?") assert endpoint == "https://api.annict.c...
# -*- coding: utf-8 -*- # # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 # # GAT-based model for regression and classification on graphs. # pylint: disable= no-member, arguments-differ, invalid-name import torch.nn as nn from .mlp_predictor import MLPPredict...
import math from django.contrib.auth.models import User from django.db import models from django.utils.html import mark_safe from django.utils.text import Truncator from markdown import markdown class Board(models.Model): name = models.CharField(max_length=30, unique=True) description = models.CharField(max...
import time from metaflow import Run, Parameter, FlowSpec, step, profile class ClientAPICheck(FlowSpec): """ Run ClientAPIFlow before this flow. Supply its run id and the nonce used parameters. This flow uses the Client API to fetch and validate its results. """ nonce = Parameter('nonce') run_...
from nirjas import extract import itertools import argparse import os import json import numpy import spacy nlp = spacy.load("en_core_web_sm") def newtest(filename): customize_stop_words = [ ',', ':', ';', '.', ' ', "'",'/','(',')','<','>','\n','\"','-','*' ] def licenseComment(data): list = ['s...
## @file # This file is used to create a database used by build tool # # Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR> # (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR> # This program and the accompanying materials # are licensed and made available under the terms and con...
""" @author: Rodrigo Vargas modulo encargado del comportamiento de los disparos estandar """ class Disparo : """ modulo encargado del comportamiento de los disparos estandar Attributes: XY (list):coordenadas (x,y) del disparo Velocidad (int):velocidad del disparo Index(...
# Copyright (C) 2019 The Raphielscape Company LLC. # # Licensed under the Raphielscape Public License, Version 1.d (the "License"); # you may not use this file except in compliance with the License. # """ Userbot module for keeping control who PM you. """ from sqlalchemy.exc import IntegrityError from telethon.tl.func...
class Component: def update(self): return self def print_to(self, x, y, media): return media
# Copyright 2013-2022 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.package import * class RGenomeinfodbdata(RPackage): """for mapping between NCBI taxonomy ID and species. ...
# -*- coding: utf-8 -*- # PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN: # https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code from ccxt.async_support.base.exchange import Exchange import hashlib import math from ccxt.base.errors import ExchangeError from ccxt.base....
# 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...
import torch from a_star.neighbor_utils import NeighborUtils from model.feature_extractor.fe_factory import get_feature_extractor from model.wh_model import WHModel from utils.collections import ModelSolution class DNWA(WHModel): def __init__(self, **kwargs): super().__init__(**kwargs) self.w_ext...
import time import random from deuces import Card, Deck, Evaluator def setup(n, m): deck = Deck() boards = [] hands = [] for i in range(n): boards.append(deck.draw(m)) hands.append(deck.draw(2)) deck.shuffle() return boards, hands n = 10000 cumtime = 0.0 evaluator = Ev...
import setuptools with open("README.md", "r") as fh: long_description = fh.read() setuptools.setup( name="postgres-helper", version="0.0.3", author="Tek Kshetri", author_email="iamtekson@gmail.com", description="Package for Postgres query on python", py_modules=['pg'], long_description...
# -*- coding: utf-8 -*- # Define here the models for your scraped items # # See documentation in: # http://doc.scrapy.org/en/latest/topics/items.html import scrapy from scrapy.item import Item,Field class MyscrapyDemoItem(scrapy.Item): # define the fields for your item here like: # name = scrapy.Field() ...
# Insights Feedback Analysis documentation build configuration file # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in this autogenerated # file. # # All configuration values have a default; values that are commented out ...
import pandas as pd import streamlit as st import plotly.express as px from PIL import Image @st.cache def load_data(file): data = pd.read_csv(file) return data ##################### ### HTML SETTINGS ### ##################### ucloud_color = '#006AFF' pwrai_color = 'red' dgx1_color = 'green' dgx2_color = '...
#! /usr/bin/env python # -*- coding: utf-8 -*- import tensorflow as tf import numpy as np class TextCNN(object): """ A CNN for text classification. Uses an embedding layer, followed by a convolutional, max-pooling and softmax layer. """ def __init__( self, sequence_length, num_classes, voca...
#!/usr/bin/env python3 '''aionfpga ~ threshold graphic Copyright (C) 2020 Dominik Müller and Nico Canzani ''' import numpy as np import matplotlib.pyplot as plt def y(t): return 0.4*np.sin(2*np.pi/4*t + np.pi/6) + 1.7 t1 = np.linspace(-0.5, 8.5, 1001) y1 = y(t1) t2 = np.linspace(1, 8, 8) y2 = y(t2) t3 = np.li...
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # 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 License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # ...
# -------------------------------------------------------- # Fast R-CNN # Copyright (c) 2015 Microsoft # Licensed under The MIT License [see LICENSE for details] # Written by Ross Girshick # # Modified by Peng Tang for Deep Patch Learning # -------------------------------------------------------- """Set up paths for F...
# Copyright (c) 2017-2018 Dell Inc. or its subsidiaries. # 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...
from styler import Styler from .information import Information s = Styler() class Header(Information): justifies = { "left": "{0} {1}", "right": "{1} {0}", "center": "{1} {0} {1}" } def __init__( self, text, width=30, align="center"...
import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt pair = open('pair.txt', 'r').readlines() pic1= [] num1 = [] pic2_num2 = [] num2 = [] for i in range(len(pair)): d = pair[i].split() if 0<len(d): pic1.append(d[0]) else: pic1.append(None) if 1<len(d): num1.app...
from collections import OrderedDict import logging import torch from panoptic_benchmark.utils.imports import import_file def align_and_update_state_dicts(model_state_dict, loaded_state_dict): """ Strategy: suppose that the models that we will create will have prefixes appended to each of its keys, for e...
from .models import Foo