text stringlengths 3.07k 22.1k |
|---|
####
#### MNIST classification by ESN implemented with python
####
# Import essential modules
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt # For visualization only
from scipy import linalg
from sklearn import preprocessing
from sklearn.model_selection import train_test_split # For data select... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 26 16:47:45 2020
@author: djemi
I Need this :
For sam project I need to use Contextual Recognition and Reolution
-> undestanding natular language and includes both syntactic and semantic-based reasoning.
Text Summarization
-> retains the key ... |
import copy
import math
from collections import defaultdict
import cv2
import numpy as np
from opensfm import geo
from opensfm import pygeometry
from opensfm import pysfm
from opensfm import reconstruction as rc
from opensfm import types
def derivative(func, x):
eps = 1e-10
d = (func(x + eps) - func(x)) / ep... |
from __future__ import print_function, division
import numpy as np
from .helpers import ensure_rng, unique_rows
def _hashable(x):
""" ensure that an point is hashable by a python dict """
return tuple(map(float, x))
class TargetSpace(object):
"""
Holds the param-space coordinates (X) and target valu... |
"""
This module defines pyHanko's high-level API entry points.
"""
from datetime import datetime
from typing import Optional
import tzlocal
from asn1crypto import cms
from pyhanko.pdf_utils import embed
from pyhanko.pdf_utils.writer import BasePdfFileWriter
from pyhanko.sign.fields import SigFieldSpec
from pyhanko.s... |
from django.shortcuts import render, redirect, get_object_or_404
from django.http import HttpResponse
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.db.models import Count
from app_sme12.models import SmeCompetition, FormRegister, Employment, Revenue, Authoriz... |
import logging
from collections import defaultdict
from itertools import count
from claripy.utils.orderedset import OrderedSet
from ...sim_variable import SimStackVariable, SimMemoryVariable, SimRegisterVariable
from ...keyed_region import KeyedRegion
from .variable_access import VariableAccess
from ..plugin import... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Developed by <NAME> <<EMAIL>>
'''ref: http://pytorch.org/docs/master/torchvision/transforms.html'''
import cv2
import numpy as np
import torch
import torchvision.transforms.functional as F
from config import cfg
from PIL import Image
import random
import numbers
class Co... |
import torch.nn as nn
from collections import OrderedDict
import torch.nn.functional as F
import torch
class conv_bn(nn.Module):
def __init__(self, inp, oup, kernel, stride, padding, activate='relu6'):
super(conv_bn, self).__init__()
if activate == 'relu6':
self.convbn = nn.Sequential(... |
# Copyright 2021 The Bazel 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 la... |
# -*- coding: utf-8 -*-
"""
threaded.network_down_detectors.py
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
A fully-functional connection-observer using socket & threading.
Works on Python 2.7 as well as on 3.6
This is Layer_2 example:
- uses Moler provided external-IO TCP implementation (moler.io.raw.tcp.ThreadedTcp)
- uses f... |
"""
.. module:: soap.program.flow
:synopsis: Program flow graphs.
"""
from collections import OrderedDict
from soap.common import base_dispatcher, indent
from soap.datatype import ArrayType
from soap.expression import AccessExpr, Variable
from soap.semantics import is_numeral, ErrorSemantics
def _decl_str(name, ... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import logging as log
import math
import os
import matplotlib.pyplot as plt
import torch
from torch.utils.tensorboard import SummaryWriter
from torchvision.utils import make_grid
import corr_net.utils.logging as logging
imp... |
import numpy as np
import tensorflow as tf
import sarnet_td3.common.tf_util as U
import sarnet_td3.common.buffer_util_td3 as butil
from sarnet_td3 import MAgentTrainer
from sarnet_td3.common.distributions import make_pdtype
def discount_with_dones(rewards, dones, gamma):
discounted = []
r = 0
for reward,... |
'''
Gramex {__version__} Copyright (c) 2017 by Gramener
Start the Gramex server on port 9988 at the current directory.
If no gramex.yaml exists, show the guide (https://learn.gramener.com/guide/)
Options
--listen.port=9090 Starts Gramex at port 9090
--browser Open the browser after ... |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import math
from functools import lru_cache
import torch
from torch import nn
from torch.autograd import Function
from torch.autograd.function import once_differentiable
from torch.nn.modules.utils import _pair
from continuous import _C
from detect... |
from __future__ import absolute_import, division, print_function
from six.moves import range
from xfel.ui.db import db_proxy
from scitbx.array_family import flex
from six.moves import zip
class Event(db_proxy):
def __init__(self, app, event_id = None, **kwargs):
db_proxy.__init__(self, app, "%s_event" % app.para... |
from abc import ABC, abstractmethod
from collections.abc import MutableMapping
from copy import deepcopy
from itertools import product
from functools import reduce
from numbers import Number
from typing import Any, Callable, Iterable
class NestedDict(MutableMapping):
"""Class to represent data organised... |
"""
Startup operations.
"""
# pylint: disable=too-many-branches,too-many-statements
import logging
import os
import platform
import sys
import time
from distutils.version import StrictVersion
import defaults
import helper_random
import paths
import state
from bmconfigparser import BMConfigParser
try:
from plugin... |
import torch
import numpy as np
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
from torch.autograd import Variable
from torch import autograd
from tqdm import tqdm
from google_drive_downloader import GoogleDriveDownloader as gdd
from .AAE_Nets import *
def train(data_path='./Data/no_... |
import numpy as np
from scipy import interpolate, integrate, constants
from os import path
class PowerSpectrum:
def __init__(self, start_w: float = 280.0, stop_w: float = 4000.0, spectra: str = "AM1.5G"):
"""
Initilizer for PowerSpectrum class. Builds custom spectrum if variables are passed when c... |
from core_tools.data.SQL.SQL_common_commands import execute_statement, execute_query
from core_tools.data.SQL.SQL_common_commands import select_elements_in_table, insert_row_in_table, update_table
from core_tools.data.SQL.connect import sample_info
import psycopg2, json
import numpy as np
class virtual_gate_queries:
... |
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
from matplotlib.ticker import FuncFormatter
from matplotlib.figure import Figure
import pandas as pd
import os
import warnings
warnings.filterwarnings("ignore", lineno=114) # this is dirt cheap and I know it
class DataPage():
''' Manages one table... |
# -*- coding: utf-8 -*-
"""
Created on Fri Oct 13 15:31:22 2017
This script advects particles in the POP model. It releases particles at the bottom,
tracks back in time and writes the particles once they reach the depth which is
determined by the variable 'dd.'
@author: nooteboom
"""
from parcels import (FieldSet,P... |
# This file is part of the clacks framework.
#
# http://clacks-project.org
#
# Copyright:
# (C) 2010-2012 GONICUS GmbH, Germany, http://www.gonicus.de
#
# License:
# GPL-2: http://www.gnu.org/licenses/gpl-2.0.html
#
# See the LICENSE file in the project's top-level directory for details.
"""
The *HTTPService* and t... |
#
from __future__ import print_function
import warnings
warnings.filterwarnings("ignore")
import numpy as np
import sklearn.model_selection as ms
import tabulate as tb
from .hyperxgb import HyperXGBClassifier
from .hyperlgbm import HyperLGBMClassifier
import xgboost as xgb
from xgboost.compat import XGBLabelEncode... |
import zlib
import os
import sys
import getopt
import xml.dom.minidom as minidom
#import hashlib
import traceback
from Crypto import Random
from Crypto.Hash import SHA256
from Crypto.Signature import pss as pss
from Crypto.PublicKey import RSA
import binascii
import base64
'''
'''
OK = 0
ERR = 1
STOP = 2
RET_INVALID... |
# MIT License
# Copyright (c) 2018 the NJUNMT-pytorch authors.
# 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, m... |
# Copyright 2021 The IREE Authors
#
# Licensed under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
from types import ModuleType
from typing import Any, Mapping, Optional, Sequence, Union
import contex... |
import os
from bcbio.rnaseq import (featureCounts, cufflinks, oncofuse, count, dexseq,
express, variation)
from bcbio.ngsalign import bwa, bowtie2
import bcbio.pipeline.datadict as dd
from bcbio.utils import filter_missing
from bcbio.log import logger
def rnaseq_variant_calling(samples, run_p... |
# coding: utf-8
import sys
import time
import json
import logging
import traceback
import certifi
import paho.mqtt.client as mqtt
from datetime import datetime
from .client import MessageClient, WoClient
MSG_QOS = 1
MSG_KEEPALIVE = 60
COMMAND_CATEGORY = 'command'
MSG_HANDLERS = {}
def get_logger(level=logging.DEBU... |
# Copyright lowRISC contributors.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
r"""TestplanEntry and Testplan classes for maintaining testplan entries
"""
import re
import sys
from collections import OrderedDict
import mistletoe
from tabulate import ... |
import sys, os
sys.path.insert(1,os.path.join(".."))
from fmdtools.modeldef import FxnBlock
from fmdtools.modeldef import Flow
from fmdtools.modeldef import Model
from fmdtools.modeldef import m2to1
class StoreEE(FxnBlock):
def __init__(self, name, flows):
super().__init__(name, flows, ['EEout', 'FS'], {'... |
"""Classes to represent financial instruments."""
from collections import OrderedDict
from decimal import Decimal
from io import StringIO
import csv
import datetime
import logging
import os
import re
import requests
import time
import urllib.parse
class Instrument(object):
"""Base class for all Instruments."""
... |
from ctypes import *
from ctypes.util import find_library
import sys
WIN=False
if sys.platform.startswith('win'):
WIN=True
if WIN:
SOCKET = c_uint
_lib=CDLL('dnet')
else:
SOCKET = c_int
_lib_name = find_library('dnet')
if not _lib_name:
raise OSError("Cannot find libdnet.so")
_lib=C... |
#! /usr/bin/env python
"""
An implementation of the MD2 message digest algorithm, as specified in RFC 1319 (corrected for the reported erratum). The API is pretty much the same as in the standard md5 module.
(c) 2006 <NAME> <<EMAIL>>
Redistribution and use in source and binary forms, with or without modification, ar... |
# -*- coding: utf-8 -*-
import pytest
import numpy as np
from vispy import scene
from vispy.testing import (TestingCanvas, requires_application,
run_tests_if_main, requires_pyopengl,
raises)
from vispy.testing.image_tester import assert_image_approved, downsample
... |
import re
import inspect
from enum import Enum
from datetime import datetime
from pykintone.account import kintoneService as ks
import pykintone.structure_field as sf
class kintoneStructure(object):
def __init__(self):
self._property_details = []
def _pd(self, name, field_type=None, sub_type=None, u... |
from django.db.models import Count, Max, F, Q
from django.contrib.auth.mixins import LoginRequiredMixin, UserPassesTestMixin, PermissionRequiredMixin
from django.contrib.auth.decorators import login_required
from django.contrib.messages import add_message as django_add_message
from django.contrib import messages as dja... |
"""Controller class for radio subsystem."""
from shared import config
from shared.controller import Controller
from player.threadedplayer import ThreadedPlayer
import logging
# import pygame
import time
import os
import glob
import random
logger = logging.getLogger()
logger.setLevel(config.LOG_LEVEL)
class Radio(Co... |
"""Provides callable models of the Kepler Pixel Response Function (PRF)."""
from __future__ import division, print_function
import math
from astropy.io import fits as pyfits
import numpy as np
import scipy
import scipy.interpolate
from ..utils import channel_to_module_output, plot_image
__all__ = ["KeplerPRF", "Si... |
###############################################################################
#MIT License
#
#Copyright (c) 2019 <NAME>
#
#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, i... |
##############################################################################
# Copyright (c) 2015 <NAME> and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
#... |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See COPYING file distributed along with the PyMVPA package for the
# copyright and license terms.
#
### ### ### ### ###... |
"""
First, a few handler functions are defined. Then, those functions are passed to
the Dispatcher and registered at their respective places.
Usage:
Press Ctrl-C on the command line or send a signal to the process to stop the bot.
"""
import datetime
import logging
import sqlite3
from urllib.request import Request, ur... |
__import__('pkg_resources').declare_namespace(__name__)
import isodate, re, os
import lxml.etree
class ParseError(Exception):
def __init__(self, message, sourceline=None):
Exception.__init__(self, message)
self.sourceline = sourceline
class Parser(object):
def __init__(self, tree, formats=Non... |
import os
import time
from collections import deque
import numpy as np
import torch
from a2c_ppo_acktr import algo, utils
from a2c_ppo_acktr.arguments import get_args
from a2c_ppo_acktr.envs import make_vec_envs
from a2c_ppo_acktr.model import Policy
from a2c_ppo_acktr.storage import RolloutStorage
from tianshou.dat... |
"""
Contains the :class:`database <tinydb.database.TinyDB>` and
:class:`tables <tinydb.database.Table>` implementation.
"""
import warnings
from tinydb import JSONStorage
from tinydb.utils import LRUCache
class Element(dict):
"""
Represents an element stored in the database.
This is a transparent proxy ... |
from flask import Blueprint, render_template, request, flash, redirect, url_for, Response
import resticweb.interfaces.repository_list as repository_interface
import resticweb.interfaces.repository_type as repository_type_interface
from resticweb.models.general import Repository, RepositoryType
from resticweb.engine_cla... |
#!/usr/bin/python
# Copyright (c) 2020, 2021 Oracle and/or its affiliates.
# This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Apache License v2.0
# See LICENSE.TXT for d... |
"""
Based on https://github.com/SainsburyWellcomeCentre/niftynet_cell_count by
<NAME> (https://github.com/cniedwor).
"""
import os
import re
import math
from functools import total_ordering
from collections import defaultdict
from xml.etree import ElementTree
from xml.etree.ElementTree import Element as EtElement
im... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License... |
"""
Author: <NAME>
Date: 2017-09-26
Purpose: Create/reconfigure a Jenkins node using desired SSH connection defaults. The approach in code is to conform
with a desired state approach (i.e. rerunning this script won't hurt anything).
http://python-jenkins.readthedocs.io/en/latest/index.html
"""
import argparse
import ... |
import os.path
import re
from copy import deepcopy
from traitlets import Unicode, Integer, Dict, Bool
from traitlets.config import Configurable
from jupyterhub.spawner import _quote_safe
def _get_voila_template(args, spawner):
voila_template = getattr(spawner, 'voila_template', '')
if voila_template != '':
... |
import curses
import json
from os import mkdir
from os.path import isfile, dirname
from pathlib import Path
import signal
import subprocess
import sys
import time
OUTER_PACKAGE_DIR = dirname(dirname(__file__))
if OUTER_PACKAGE_DIR not in sys.path:
sys.path.append(OUTER_PACKAGE_DIR)
from cl_timer.art import (
... |
import numpy as np
import pandas as pd
from sklearn import preprocessing
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score, auc, roc_curve
from collections import defaultdict
class AdaBoost:
def __init__(self, col_names):
self.data, self.labels = AdaBoost.get... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from core.task import Task, on_start, on_message, on_timeout, on_output_message
from tasks.competition.base import BaseTask
import logging
import random
import math
import string
# NB: wit this random seed, alw... |
# -*- coding: utf-8 -*-
"""
The :program:`celery worker` command (previously known as ``celeryd``)
.. program:: celery worker
.. seealso::
See :ref:`preload-options`.
.. cmdoption:: -c, --concurrency
Number of child processes processing the queue. The default
is the number of CPUs available on your sy... |
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
import cmd
import os
import random
import sys
from pprint import pformat
import ampy.files
import ampy.pyboard
import serial.tools.list_ports
PROTECTED_PATHS = [
'/boot.py',
'/bt-lk1.dat',
'/bt-lk2.dat',
'/commands/__init__.mpy',
'/commands/abstract_handler.mpy',
'/commands/hub_methods.mpy',
... |
from ..module import get_introspection_module
from ..overrides import override
import warnings
GElektra = get_introspection_module('GElektra')
def __func_alias(klass, old, new):
func = getattr(klass, old)
setattr(klass, new, func)
def __func_rename(klass, old, new):
__func_alias(klass, old, new)
delattr(klass, o... |
import csv
import sys
import logging
from .grafana import *
from .ldap import *
from ldap3.core.exceptions import LDAPSocketOpenError
from requests.exceptions import ConnectionError
from .config import *
logger = logging.getLogger()
PERMISSION_MAP = {
"View": 1,
"Edit": 2,
"Admin": 4
}
configuration = "... |
# 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... |
#!/usr/bin/python
# Copyright (c) 2020, 2021 Oracle and/or its affiliates.
# This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Apache License v2.0
# See LICENSE.TXT for d... |
# Demo script
# author: ynie
# date: April, 2020
from net_utils.utils import load_device, load_model
from net_utils.utils import CheckpointIO
from configs.config_utils import mount_external_config
import numpy as np
import torch
from torchvision import transforms
import os
from time import time
from PIL import Image
im... |
__author__ = "<NAME>"
__date__ = "Feb 12, 2020"
import os
from dataclasses import dataclass
from sqlalchemy import create_engine, Column, Integer, String, Float, LargeBinary, ForeignKey
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.exc import SQLAlchemyError
from sqlalchemy.orm import ses... |
import io
import json
import os
import pytest
import yaml
from cryptojwt import KeyJar
from idpyoidc.message.oidc import AuthorizationRequest
from idpyoidc.server import Server
from idpyoidc.server.configure import OPConfiguration
from idpyoidc.server.oidc.authorization import Authorization
from idpyoidc.server.user_... |
#!/usr/bin/env python
# coding: utf-8
# # mlflow-energyforecast
#
# This is a showcase for ML Flow capabilities, based on the article
# http://the-odd-dataguy.com/be-more-efficient-to-produce-ml-models-with-mlflow
# and a github https://github.com/jeanmidevacc/mlflow-energyforecast
#
# In[2]:
get_ipython().system('p... |
# -*- coding: utf-8 -*-
'''
Network Config
==============
Manage the configuration on a network device given a specific static config or template.
:codeauthor: <NAME> <<EMAIL>> & <NAME> <<EMAIL>>
:maturity: new
:depends: napalm
:platform: unix
Dependencies
------------
- :mod:`NAPALM proxy minion <salt.proxy.... |
import requests
from bs4 import BeautifulSoup
import urllib.parse as urlparse
import re
import time
from .parsers import (
search_parsers,
series_parsers,
releases_parsers,
adv_search_parser,
group_parsers,
author_parsers,
)
def search(query):
"""
Performs a name-based search of MangaU... |
#!/usr/bin/env python
# coding: utf-8
from flask import Response
from flask import Flask
from flask import render_template
import threading
import argparse
import datetime
import time
import cv2
from jetcam.usb_camera import USBCamera
import torch
from torch2trt import TRTModule
import trt_pose.models
import json
impor... |
# 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... |
# copyright (c) 2021 paddlepaddle authors. all rights reserved.
#
# licensed under the apache license, version 2.0 (the "license");
# you may not use this file except in compliance with the license.
# you may obtain a copy of the license at
#
# http://www.apache.org/licenses/license-2.0
#
# unless required by app... |
# -*- coding: UTF-8 -*-
# Copyright (c) 2019 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
#
... |
import networkx as nx
import numpy as np
import itertools, logging
import pandas as pd
#from .nodes import ProteinInteractionNode
# THESE ARE THE KEY METAPATH FUNCTIONS, SOME MAYBE REMOVED OVERTIME
def listCompute(graph,falseP,trueP,middleNode,edgeNode):
# this is now the slowest operation ... followed up w/ this... |
import locale
import logging
import os
import re
import subprocess
from io import open
import click
import sqlparse
from .favoritequeries import favoritequeries
from .main import NO_QUERY, PARSED_QUERY, special_command
from .utils import handle_cd_command
TIMING_ENABLED = False
use_expanded_output = False
PAGER_ENA... |
# 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
# d... |
# Copyright 2019 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... |
import numpy as np
import matplotlib.pyplot as plt
from tqdm import tqdm
from wireframe.utils import argsort2d
DX = [0, 0, 1, -1, 1, 1, -1, -1]
DY = [1, -1, 0, 0, 1, -1, 1, -1]
def ap(tp, fp, npos):
recall = tp / npos
precision = tp / np.maximum(tp + fp, 1e-9)
recall = np.concatenate(([0.0], recall, [1... |
##
# @file independent_set_matching_unitest.py
# @author <NAME>
# @date Mar 2019
#
import os
import sys
import math
import numpy as np
import unittest
import cairocffi as cairo
import time
import math
import torch
from torch.autograd import Function, Variable
from scipy.optimize import linear_sum_assignment ... |
import logging
import json
import pandas as pd
import numpy as np
import os
import boto3
import tensorflow as tf
import datetime
import argparse
from sklearn import model_selection
from sklearn.metrics import confusion_matrix, roc_curve
from sklearn.linear_model import LogisticRegression
from tensorflow.python.lib.io ... |
import torch.nn as nn
from transformers import BertTokenizer, BertModel
import torch.nn.functional as F
from torch.nn import Parameter
import torch
import gensim.downloader as api
from nltk import sent_tokenize, word_tokenize
from typing import Tuple
import numpy as np
PAD = 0
UNK = 1
START = 2
END = 3
PAD_TOKEN = '<p... |
import pygame, random
pygame.init()
pygame.mixer.init()
font = pygame.font.SysFont(None, 70)
fps_clock = pygame.time.Clock()
winx, winy = 750, 900
gamex, gamey = 750, 750
#Difference between winx, winy and gamex, gamey is:
#becuse game has score board i must to consider more height for scord board
#and becus... |
#!/usr/bin/env python
# Copyright 2018 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import argparse
import contextlib
import errno
import json
import os
import shutil
import sys
import tarfile
import tempfile
@contextl... |
from __future__ import annotations
import collections
import os
import shutil
import sys
import sysconfig
from contextlib import contextmanager
from pathlib import Path
from typing import TYPE_CHECKING, Any, Dict, Iterator, List, Optional, Tuple
from pip._internal.req import req_uninstall
from pip._internal.utils imp... |
"""Display data from an uploaded activity or route file.
Basically want to have an encapsulated demo that I can deploy to
pythonanywhere etc. I have built cool stuff, but it is hard to show
my work!
https://dash.plotly.com/dash-core-components/upload
dcc.Upload properties:
https://dash.plotly.com/dash-core-component... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from basicsr.utils.registry import ARCH_REGISTRY
class SeqConv3x3(nn.Module):
def __init__(self, seq_type, inp_planes, out_planes, depth_multiplier=1):
super(SeqConv3x3, self).__init__()
self.seq_type = seq_type
self.inp_... |
import tensorflow as tf
import numpy as np
def fc_op(input_op, name, n_out, layer_collector, act_func=tf.nn.leaky_relu):
n_in = input_op.get_shape()[-1].value
with tf.name_scope(name) as scope:
kernel = tf.Variable(tf.contrib.layers.xavier_initializer()([n_in, n_out]), dtype=tf.float32, name=scope + "... |
"""Contains widgets for textarea forms"""
from .. import skiboot, tag, excepts
from . import Widget, ClosedWidget, FieldArg, FieldArgList, FieldArgTable, FieldArgDict
class SubmitTextArea(Widget):
"""Defines a form containing a div with a text area input field"""
error_location = (0,0,0)
arg_descrip... |
###############################################################################
# ProteusLib Copyright (c) 2021, The Regents of the University of California,
# through Lawrence Berkeley National Laboratory, Oak Ridge National
# Laboratory, National Renewable Energy Laboratory, and National Energy
# Technology Laborator... |
import numpy as np
import networkx as nx
import copy
import multiprocessing as mp
from scipy.stats import norm
def sz_n(network, c, x):
return np.bincount(list(c.values())).tolist()
def sz_degree(network, c, x):
K = max(c.values())+1
w = [0 for i in range(K)]
for key, val in c.items():
w[val]+=... |
#! author : <NAME>
import os
from typing import Iterator, Dict, Any
from shutil import copyfile
import elasticsearch
import time
import re
from datetime import datetime, timedelta
import re
from pathlib import Path
from datetime import datetime as dt, timedelta
import json
import logging
import sched
impo... |
def GetExtent(gt,cols,rows):
''' Return list of corner coordinates from a geotransform
@type gt: C{tuple/list}
@param gt: geotransform
@type cols: C{int}
@param cols: number of columns in the dataset
@type rows: C{int}
@param rows: number of rows in the dataset... |
# -*- encoding: utf-8 -*-
#
# The MIT License (MIT)
#
# Copyright © 2021 <NAME>
#
# 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 ... |
#################################################
# Implementation of BTW Sandpile simulation #
# <NAME>, May 2017 #
# SYSEN6000 Cornell University #
#################################################
import pdb
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.colorbar as cbar
from nump... |
# coding: utf-8
"""
Alignment module.
"""
from collections import namedtuple
from atropos.align._align import Aligner, MultiAligner, compare_prefixes, locate
from atropos.util import RandomMatchProbability, reverse_complement
# flags for global alignment
# The interpretation of the first flag is:
# An initial portion... |
# -*- coding: utf-8 -*-
#
# Helper functions for the reddit chessbot
# Includes functions to parse FEN strings and get pithy quotes
import re
from helper_functions import lengthenFEN
from message_template import *
#########################################################
# ChessBot Message Generation Functions
def i... |
# torch
import torch
import torch.nn as nn
import torch.optim as optim
import torch.optim.lr_scheduler as lr_scheduler
import torchvision.transforms as transforms
import numpy as np
# project
from utils.config_utils import load_config
from utils.Timer import Timer
from utils.AverageMeter import AverageMeter
from m... |
#!/usr/bin/env python3
# Parser for Peninsular Malaysia (West Malaysia).
# This does not include the states of Sarawak and Sarawak.
# There is pumped storage in the Peninsular but no data is currently available.
# https://www.scribd.com/document/354635277/Doubling-Up-in-Malaysia-International-Water-Power
from bs4 imp... |
import re
import sys
import threading
import time
from collections import defaultdict
from concurrent import futures
from typing import List, Optional, Sequence, Union
import requests
import tritonclient.grpc as triton
from hermes.stillwater.logging import listener
from hermes.stillwater.process import Pi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.