text stringlengths 3.07k 12.6k |
|---|
#!/usr/bin/env python
from __future__ import print_function
import os
import collections
import logging
from mruutility import groupby
from expandmenu import ExpandMenu
from tags import TagFile, Tag
from pythontag import py_get_nearest_tag
# get directory of this file @i @python
PLUGIN_HOME = os.path.dirname(os.path... |
import logging
import urllib.request
import requests
from hashlib import md5
import json
import os
from time import gmtime, strftime, sleep
# Needs to match corresponding value in apiserver/config.py
# This is the default value, 100 MiB
MAX_BOT_UPLOAD_SIZE = 100 * 1024 * 1024
# Maximum wait time in between compiled b... |
#
# Copyright (c) 2021, NVIDIA 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 ... |
import os
import argparse
import numpy as np
import matplotlib.pyplot as plt
import time
import utils
import data_reader
import network_maker
import network_helper
plt.interactive(False)
INPUT_SIZE = 2
CLIP = 15
FC_FILTERS = (100, 500, 1000, 1500, 500, 2000, 1000, 500, 165)
TCONV_FNUMS = (4, 4, 4)
TCONV_DIMS = (165,... |
#
# Copyright (c) 2017 Palo Alto Networks, Inc. <<EMAIL>>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AU... |
import apex.amp as amp
import torch
import torch.nn.functional as F
from torchvision import datasets, transforms
from torch.utils.data.sampler import SubsetRandomSampler
import numpy as np
import os
import logging
import datetime
cifar10_mean = (0.4914, 0.4822, 0.4465)
cifar10_std = (0.2471, 0.2435, 0.2616)
mu = torc... |
'''
This generates synthetic data from the hospital_ae_data_deidentify.csv
file. It generates three types of synthetic data and saves them in
different files.
'''
import random
import os
import time
import pandas as pd
import numpy as np
import filepaths
from DataDescriber import DataDescriber
from DataGenerator ... |
#!/usr/bin/env python
# Copyright 2017 Google 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
#
# Unle... |
import pyxinput
import torch
import numpy as np
import time
import datetime
import utils
import neural_net
from neural_net import Net
import torchvision.models as models
import torch.nn as nn
from torchvision import transforms
PATH = "WGANGP_withPrevAction_NEW_was_mse_30_sgd_16_0_01_e50.pt"
class XController(pyxinput... |
import pygame
import sys
import pygame.gfxdraw
import random
from infra import Vector
from collections import namedtuple
# from math import sin, cos, pi
# import wordgen
rand = random.Random()
Env = namedtuple("Env", ['name', 'color', 'mask'])
Attrs = namedtuple("Attrs", ['metals', 'stones', 'gazes', ... |
#!/usr/bin/env python3
'''
Common types
'''
import sys
import os.path
import datetime
import json
import yaml
import pprint
import argparse
import importlib.machinery
from orderedattrdict import AttrDict
class TypesException(Exception):
pass
class MAC_Address:
"""
Represents one MAC address
"""
... |
from django.shortcuts import render, redirect, get_object_or_404
from django.views.generic.edit import CreateView
from django.db.models import Count
from django.http import Http404
from .forms import MealForm
from .models import Nation, Meal
from django.contrib.auth.decorators import login_required
import random
def... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# code for python2
import rospy
import serial
import time
import signal
import sys
from std_msgs.msg import Int16, Int8
from kondo_b3mservo_rosdriver.msg import Multi_servo_command
from kondo_b3mservo_rosdriver.msg import Multi_servo_info
import drive_function as Drive
tar... |
import time
from enum import Enum
from .util import to_str, to_bytes
from pythreader import Primitive, synchronized
from socket import timeout as socket_timeout
class AckMode(Enum):
Auto = "auto"
Client = "client"
ClientInd = "client-individual"
class STOMPError(Exception):
def __init__(self, mes... |
#<NAME>, et al. "DeepGauge: Multi-Granularity Testing Criteria for Deep Learning Systems." (2018):120-131.#
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import sys
import os
import gc
import numpy as np
import tens... |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import sys
import tempfile
import typing as tp
from pathlib import Path
import numpy as np
from nevergrad.common import t... |
import json
from random import randint, choice
from typing import Callable, List, Dict
from pygments import highlight, lex
from pygments.lexers import get_lexer_by_name
from asciimatics.effects import Print
from asciimatics.screen import Screen
from asciimatics.effects import Stars, Matrix
from asciimatics.particles i... |
# -*- coding: utf-8 -*-
# Copyright (c) 2018, Zlash65 and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.model.document import Document
from frappe.utils import add_years, get_timestamp, flt
from frappe.chat.doctype.... |
#!/usr/bin/env python3
# Copyright (c) 2008-10 Qtrac Ltd. All rights reserved.
# This program or module 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 2 of the License, or
# version 3 of the Li... |
from django.utils.safestring import mark_safe
from django_tables2.utils import Accessor, AttributeDict
import django_tables2 as tables
from .models import currentrosterinfo
import itertools
from django.conf import settings
from .utils import tir
class MaterializeCheckColumn(tables.CheckBoxColumn):
def render(sel... |
# Feature Relevance based Unsupervised Feature Selection
from sklearn.base import TransformerMixin, BaseEstimator
from tqdm import tqdm
import contextlib
import joblib
import numpy as np
from joblib import Parallel, delayed
import pandas as pd
from sklearn.tree import DecisionTreeClassifier, DecisionTreeRegre... |
import collections
import markdown
from . import dsref
from . import loader
from . import version_info
from .util import set_fields, build_repr, ensure_string, max_len
NO_META_TITLE = '(untitled dataset)'
class Meta(object):
def __init__(self, obj):
set_fields(self, obj, ['accessURL', 'accrualPeriodici... |
import math
import os
import pdb
import random
import sys
from typing import Any, Dict, NamedTuple, Optional, Tuple, Union, overload
import numpy as np
import torch
from abcd.components.feature_dataclasses import (
ActionFeature,
BaseFeature,
CascadeFeature,
)
from abcd.utils.arguments import Config
from t... |
from __future__ import print_function
from .sqlschema import SQLSchema, SQLResultSet
import sqlite3
import os
from datetime import datetime
import traceback, sys
show_track = 0
class DebugConnection(sqlite3.Connection):
def commit(self):
if show_track and 0:
print('============== commit', file=sys.stderr)
... |
'''
Solver for step index fiber using analytical expression of the mode profile
and solving numerically the analytical dispersion equation.
'''
import time
import numpy as np
from scipy.optimize import root
from scipy.special import jv, kn
from ..modes import Modes
from ..logger import get_logger
logger = get_logger... |
import hashlib, pickle
import torch
import torch.nn as nn
import transformers
#
# Embedding Models
#
class EmbeddingModel(nn.Module):
def __init__(self, lm_name, layers, cache=None):
super(EmbeddingModel, self).__init__()
# load transformer
self._tok = transformers.AutoTokenizer.from_pretrained(lm_name, use_... |
# -*- coding: utf-8 -*-
# Copyright 2010 British Broadcasting Corporation and Kamaelia Contributors(1)
#
# (1) Kamaelia Contributors are listed in the AUTHORS file and at
# http://www.kamaelia.org/AUTHORS - please extend this file,
# not this notice.
#
# Licensed under the Apache License, Version 2.0 (the "Lice... |
"""
Break an MD4 keyed MAC using length extension
"""
# Implementation of MD4 taken and modified from
# https://gist.github.com/BenWiederhake/eb6dfc2c31d3dc8c34508f4fd091cea9
import math
import struct
def leftrotate(i, n):
return ((i << n) & 0xFFFFFFFF) | (i >> (32 - n))
def F(x, y, z):
return (x & y) | (... |
# -*- coding: utf-8 -*-
# Copyright (C) 2017-2020 Mag. <NAME> All rights reserved
# Glasauergasse 32, A--1130 Wien, Austria. <EMAIL>
# #*** <License> ************************************************************#
# This module is part of the package TFL_STP.
#
# This module is licensed under the terms of the BSD 3-Claus... |
'''
module for galaxy catalogs. Module includes functions to construct galaxy
catalogs using halo occupation distribution (HOD) models. HOD models paint
galaxies onto halo catalogs constructed from N-body simulations
References
----------
* make_survey pipeline from BOSS: https://trac.sdss3.org/browser/repo/mockFa... |
import numpy as np
def diff(sequence, ghost=True):
"""Implements backwards difference, which is necessary to avoid looking forward in time
Args:
sequence(iterable): sequence to difference
ghost: type ghost: bool (Default value = True)
Returns:
numpy.ndarray: backwards difference given ... |
"""
Helper to check which categorical attributes of PeerRead are predictable from the text
"""
import tensorflow as tf
import bert.modeling as modeling
import bert.optimization as optimization
from causal_bert.bert_unsupervised import get_masked_lm_output
from causal_bert.logging import make_label_binary_prediction_su... |
"""
The mlnn module provides a multi-layer neural network
algorithm
Based on excellent tutorial 'How to build a multi-layered neural network in Python'
by <NAME>
See: https://medium.com/technology-invention-and-more/how-to-build-a-multi \
-layered-neural-network-in-python-53ec3d1d326a
"""
... |
'''
A flash card based study tool for VCE Unit One and Two Business Management
Copyright <NAME> 2017
Released under the MIT lisence, for more information go to https://github.com/monoxane/Taskwords-Flash-Cards/blob/master/LICENSE.md
'''
import os
import time
global correctScore
global incorrectScore
correctScore = ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Copyright (c) 2021, ICGC ARGO
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 righ... |
#!/usr/bin/env python
"""
A simple phrase detector. This algorithm is based up dictionary-lookups with
dependency parse.
"""
from annotation import read_dataset, write_dataset, get_head_word_index, Phrase
import gzip
import argparse
import pdb
PHRASE_END = '</E>'
def detect_phrases(dataset, phrase_dict, deps):
... |
# -*- coding: utf-8 -*-
# This file is part of the tabi project licensed under the MIT license.
# Copyright (C) 2017 ANSSI
import argparse
from collections import defaultdict
import json
from itertools import chain
from agnostic_loader import DataLoader
import os
from radix import Radix
from src.related_work_implem.t... |
import torch
import torch.nn as nn
class ResNetUnit(nn.Module):
r"""Parameters
----------
in_channels : int
Number of channels in the input vectors.
out_channels : int
Number of channels in the output vectors.
strides: tuple
Strides of the two convolutional layers, in the f... |
import numpy as np
from tianshou.data import Batch, PrioritizedReplayBuffer, ReplayBuffer
if __name__ == '__main__':
from env import MyTestEnv
else: # pytest
from test.base.env import MyTestEnv
def test_replaybuffer(size=10, bufsize=20):
env = MyTestEnv(size)
buf = ReplayBuffer(bufsize)
obs = e... |
# -*- coding: utf-8 -*-
# Copyright (c) 2016, French National Center for Scientific Research (CNRS)
# Distributed under the (new) BSD License. See LICENSE for more info.
import atexit
import logging
from .rpc import RPCServer, RPCClient, ProcessSpawner
from .host import Host
from .rpc import log as rpc_log
logger =... |
# GPL # "author": Paulo_Gomes
import bpy
from mathutils import Quaternion, Vector
from math import cos, sin, pi
from bpy.props import (
FloatProperty,
IntProperty,
BoolProperty,
)
# Create a new mesh (object) from verts/edges/faces
# verts/edges/faces ... List of vertices/edges/faces ... |
from __future__ import print_function
import numpy
import scipy
import scipy.linalg
from scipy.sparse.linalg import lsqr
def ridge_svd(X, y, alpha, cutoff = 1e-10):
N1, N2 = X.shape
U, s, Vt = scipy.linalg.svd(X, full_matrices=False)
Nm = s.size
idx = s > cutoff * s[0]
s_nnz = s[idx][:, numpy.newa... |
import numpy as np
from scipy.integrate import odeint
from math import cos,pi,exp
import matplotlib.pyplot as plt
# Define species concentrations
#C_ER # μM ER-located collagen
#C_H # μM Collagen-HSP47 complex in ERGIC
#C_G # μM Golgi-located colla... |
"""Methods that allow to learn and build a BT from demonstration."""
# Copyright (c) 2022, ABB
# All rights reserved.
#
# Redistribution and use in source and binary forms, with
# or without modification, are permitted provided that
# the following conditions are met:
#
# * Redistributions of source code must retain... |
from starlette.applications import Starlette
from starlette.responses import JSONResponse as J
from starlette.endpoints import HTTPEndpoint
import marshmallow as ma
from webargs import fields
from webargs_starlette import (
parser,
use_args,
use_kwargs,
use_annotations,
WebargsHTTPException,
)
app ... |
# The MIT License (MIT)
#
# Copyright (c) 2016 <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
# to use, copy, modify, me... |
import os, shutil, psutil, json, copy
import datetime
import numpy as np
import tensorflow as tf
import evaluate_classification
import evaluate_segmentation
class color:
PURPLE = '\033[95m'
CYAN = '\033[96m'
DARKCYAN = '\033[36m'
BLUE = '\033[94m'
GREEN = '\033[92m'
YELLOW = '\033[93m'
RED = '\033[91m... |
#!/usr/bin/env python3
"""Misc. bot commands."""
###############################################################################
# Module Imports
###############################################################################
import arrow
import random
import tweepy
from . import core, parser, lex, __version__
####... |
"""
Count the kmers in a file and report entropy and eveness
NOTE: DO NOT USE THIS VERSION
It is designed to work with an old version of python (3.3) and you should not use it!
"""
import os
import sys
import argparse
from itertools import product
import json
from math import log2
def rc(dna):
"""
Reverse... |
#! -*- coding: utf-8 -*-
#---------------------------------
# モジュールのインポート
#---------------------------------
import os
import tqdm
import argparse
import numpy as np
import matplotlib.pyplot as plt
from sklearn import datasets
from sklearn.decomposition import PCA
#---------------------------------
# 定数定義
#----------... |
# vim: set encoding=utf-8
import re
from unittest import TestCase
from mock import Mock, patch
from regparser.history import annual
from regparser.test_utils.http_mixin import HttpMixin
class HistoryAnnualVolumeTests(HttpMixin, TestCase):
def test_init(self):
uri = re.compile(r'.*gpo.gov.*1010.*12.*4.*x... |
"""
/*
* This file is part of PySide: Python for Qt
*
* Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
*
* Contact: PySide team <<EMAIL>>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* version 2.1 as pu... |
# -*- coding: utf-8 -*-
#
# Functions to query host platform
#
# Copyright (c) Honda Research Institute Europe GmbH
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions of source code must reta... |
from pyg_base._inspect import call_with_callargs, getcallargs, getargspec, kwargs2args, argspec_add, argspec_required, getargs, argspec_defaults, argspec_update
import inspect
import pytest
def test_call_with_callargs():
function = lambda a, b, *args, **kwargs: 1+b+len(args)+10*len(kwargs)
args = (1,2,3,4,5);... |
from enum import Enum
from typing import List, Optional, Sequence, Type, Union
import numpy
from acoustic_feature_extractor.data.phoneme import BasePhoneme
class LinguisticFeatureType(str, Enum):
PHONEME = "PHONEME"
PRE_PHONEME = "PRE_PHONEME"
POST_PHONEME = "POST_PHONEME"
PHONEME_ID = "PHONEME_ID"
... |
from agent_dir.agent import Agent
import scipy
import numpy as np
import os
import keras
import tensorflow as tf
from keras.models import Sequential,load_model
from keras.layers import Dense, Dropout, Flatten
from keras.layers import Conv2D, MaxPooling2D
from keras.optimizers import Adam, Adamax, RMSprop
from keras im... |
import math
import torch
import torch.nn.functional as F
import torch.utils.model_zoo as model_zoo
from torch import nn
from torch.nn import Parameter
import pdb
import numpy as np
class Conv2d_cd(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size=3, stride=1,
padding=1, dila... |
from photons_canvas.animations import options, Animation, an_animation
from photons_canvas import font, point_helpers as php
from delfick_project.norms import dictobj, sb
import time
import math
class Options(dictobj.Spec):
hour24 = dictobj.Field(sb.boolean, default=True)
ignore_coordinates = dictobj.Field(s... |
import pytest
import random
import datetime
from threading import Thread, RLock
from Acquire.Accounting import Account, Transaction, TransactionRecord, \
Ledger, Receipt, Refund, \
create_decimal
from Acquire.Identity import Authorisation
from Acquire.Se... |
import logging
from collections import OrderedDict
from django.conf import settings
from django.db import transaction, DEFAULT_DB_ALIAS
from django.db.transaction import get_connection
from contextlib import contextmanager, ContextDecorator
logger = logging.getLogger(__name__)
def atomic(using=None, savepoint=Tr... |
import os
import webbrowser
from tkinter import *
from tkinter import filedialog
import win32com.client
import winshell
from PIL import Image
from PyInstaller.utils.hooks import collect_data_files
from tkinterdnd2 import *
datas = collect_data_files('tkinterdnd2')
iconPath = r"%systemroot%\system32\imag... |
from typing import Union
from collections import OrderedDict
from multiprocessing import cpu_count
from multiprocessing.dummy import Pool
import fiona
from shapely.geometry import LineString, Point
import dask.array as da
import numpy as np
from hydrotools.raster import (
Raster,
TempRasterFile,
raster_wh... |
import os
import pprint
import numpy as np
from scipy.interpolate import RectBivariateSpline
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
from bag import BagProject
from bag.io import load_sim_results, save_sim_results, load_sim_file
# Global variables
# schemati... |
"""
An extension to SQLAlchemy to treat aggregated columns and clauses as Models
>>> from sqlalchemy import Column, BigInteger, Text, ForeignKey
>>> from sqlalchemy.orm import declarative_base, relationship, sessionmaker
>>> from sqlalchemy.engine import create_engine
>>> from sqlalchemy_bundle_model import BundleMode... |
# -*- coding: utf-8 -*-
"""Main CLI program."""
import sys
import os
import logging
import time
import argparse
from functools import partial
import json_logging
from .plugins.manager import DefaultPluginManager
from .updater.manager import updater_classes
from .detector.manager import detector_classes
from .core i... |
from interface import *
import multiprocessing as mp
import multiprocessing.queues
from ctypes import c_bool
import pyarrow as pa
import threading
import time
class FasterSimpleQueue(mp.queues.SimpleQueue):
def get(self):
with self._rlock:
res = self._reader.recv_bytes()
# unserialize ... |
"""Client for calling ArmCalc web service
"""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from sys import version_info
import re
from datetime import datetime, date
from json import JSONEncoder, dumps, loads
from .parseutils import to_wcf_date, parse... |
"""
:mod:`fastf1.utils` - Utils module
==================================
"""
from functools import reduce
import numpy as np
from datetime import datetime, timedelta
def delta_time(reference_lap, compare_lap):
# TODO move somewhere else
"""Calculates the delta time of a given lap, along the 'Distance' axis
... |
# -*- encoding: utf-8 -*-
#
# Copyright © 2013 eNovance <<EMAIL>>
#
# Author: <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
#
# 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.a... |
# -*- coding: utf-8 -*-
from collections import OrderedDict
import pykintone
import numpy as np
import pandas as pd
from karura.core.dataframe_extension import DataFrameExtension, FType
from karura.env import get_kintone_env
class Field():
def __init__(self, code, f_type, label, is_unique):
self.code = c... |
# -*- coding: utf-8 -*-
"""
Module containing utilities to create/manipulate grids.
"""
import logging
import math
from typing import List, Tuple, Union
import geopandas as gpd
import pyproj
import shapely.ops as sh_ops
import shapely.geometry as sh_geom
#-------------------------------------------------------------... |
# Copyright 2017 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 wri... |
import bpy
import os.path
import math
import sys
C = bpy.context
D = bpy.data
scene = D.scenes['Scene']
# cameras: a list of camera positions
# a camera position is defined by two parameters: (theta, phi),
# where we fix the "r" of (r, theta, phi) in spherical coordinate system.
# # 5 orientations: front, right, bac... |
#!/usr/bin/env python3
import logging
import os
import os.path
import signal
import sys
import time
from multiprocessing import freeze_support
import bitshares.exceptions
import click # noqa: E402
import graphenecommon.exceptions
from bitshares.market import Market
from uptick.decorators import online
from dexbot.cl... |
import operator as op
from flask import Flask, render_template, escape, request, redirect
from bughouse import BughouseBoard
import chess
import chess_com
import tcn_parser
app = Flask(__name__)
@app.route("/")
def index():
return render_template("index.html")
def build_game_header(first_game_data, second_game_d... |
import os
import re
import logging
import lxml.html
from typing import List, Tuple, Optional, Union
import bs4
log = logging.getLogger(__name__)
def is_html(s: str) -> bool:
# from bs4 import BeautifulSoup
# bool(BeautifulSoup(html, "html.parser").find())
# True
# bool(BeautifulSoup(non_html, "html... |
#!/usr/bin/env python3
# Python libs
import argparse
import ipaddress
import logging
import sys
# Flag to turn off AWS functionality (for lightweight use case)
REQUIRE_BOTO = True
# Third-party libs
try:
if REQUIRE_BOTO:
from botocore.exceptions import ClientError
import boto3
from tabulate i... |
import RPi.GPIO as GPIO
import os
import time
import datetime
import logging
pins = [2, 3, 4, 17, 27, 22, 10, 9]
class ScriptItem:
time_until = 0
off = []
on = []
def __init__(self, time_until, off, on):
self.time_until = time_until
self.off = off
self.on = on
basic_sequenc... |
import sys
from pavilion import commands
from pavilion import schedulers
from pavilion import series
from pavilion import utils
from pavilion.pav_test import PavTest, PavTestError, PavTestNotFoundError
from pavilion.status_file import STATES
def status_from_test_obj(pav_cfg, test_obj):
"""Takes a test object or ... |
from tflib.layers import *
def mnist_generator_conditional(z, target_class, num_classes, is_training=True):
net_dim = 64
use_sn = False
update_collection = None
with tf.variable_scope('Generator', reuse=tf.AUTO_REUSE):
bn_linear = ConditionalBatchNorm(num_classes, name='cbn_linear')
bn... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
__author__ = 'ar'
import os
import multiprocessing as mp
import time
import numpy as np
from run01_CNN_Cls_Cervix_Only_train_v2 import BatchGenerator
from run03_CNN_Cls_Cervix_And_Channel_train_v1 import BatchGeneratorCervixOnly
import threading
class ThreadedDataGeneratorV2(... |
import random
from collections import deque
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.distributions import Normal
class MLP(nn.Module):
""" MLP with dense connections """
def __init__(self, input_size, output_size, hidden_size, num_hidden_layers=3):
... |
"""
gpustat.web
MIT License
Copyright (c) 2018-2020 <NAME> (@wookayin)
"""
from typing import List, Tuple, Optional
import os
import traceback
import urllib
import asyncio
import asyncssh
from datetime import datetime
from collections import OrderedDict, Counter
from termcolor import cprint, colored
import jinja... |
from __future__ import unicode_literals
from numpy.random import choice
from collections import Counter
import pandas as pd
import numpy as np
from django.apps import apps
import string
def sample_no_replacement(full_set, previous_set=None):
# print "starting sample_no_replacement"
# if previous_set:
# print "prev... |
import os
import time
from argparse import ArgumentParser
import torch
from torch import distributed as dist
from accelerate import Accelerator, DistributedDataParallelKwargs
from torch import optim
from torch.nn import SyncBatchNorm
from torch.utils.data import DataLoader
from torch.utils.tensorboard.writer import Su... |
# -*- coding: utf-8 -*-
"""A Python implementation of Conway's Game of Life.
This module demonstrantes an implementation of Conway's Game of Life in
Python. It is meant to be run, and its output viewed, from the terminal.
.. moduleauthor:: <NAME> <<EMAIL>>
I am going to implement some of these classes with propertie... |
#! /bin/python
import os
import sys
import json
import luigi
import nifty.tools as nt
import nifty.distributed as ndist
import cluster_tools.utils.volume_utils as vu
import cluster_tools.utils.function_utils as fu
from cluster_tools.cluster_tasks import SlurmTask, LocalTask, LSFTask
#
# Graph Tasks
#
class MergeS... |
from tkinter import *
import tkinter.font as font
expression = ""
def press(num):
global expression
expression = expression + str(num)
equation.set(expression)
def equalpress():
try:
global expression
total = str(eval(expression))
equa... |
""" Cisco_IOS_XR_iedge4710_cfg
This module contains a collection of YANG definitions
for Cisco IOS\-XR iedge4710 package configuration.
This module contains definitions
for the following management objects\:
subscriber\-manager\: iEdge subscriber manager configuration
iedge\-license\-manager\: iedge license mana... |
#!/usr/bin/env python3
import os
import sys
import argparse
import subprocess
from utils import (
get_json_from_github
)
from utils import PLUGINS_JSON_FILE, THEMES_JSON_FILE
from dirutils import use_directory, readable_dir
class DownloaderOptions:
def __init__(self):
self.parser = self.make_parser(... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compli... |
import os
from shutil import copy
from kivy.logger import Logger
# the string to use when prefilling the name for copied file
COPY_EXTENSION = "_copy"
def read_file(filepath):
"""
Reads a file's content as a string
:param filepath: the filepath to open
:return: a string, the file's content
"""
... |
#' ---
#' title: "Shortest Path"
#' ---
#' This file provides the algorithms implemented
#' in the Visualising Data notebook in order to
#' use as a standalone module.
#'
#' The NetworkX object for the Departures Board
#' query used in the notebook is also provided
#' to avoid having to setup a database and run
#' any... |
# -*- python -*-
# -*- coding utf-8 -*-
# This file is part of GDSCTools software
#
# Copyright (c) 2015 - Wellcome Trust Sanger Institute
# All rights reserved
#
# File author(s): <NAME> <<EMAIL>>
#
# Distributed under the BSD 3-Clause License.
# See accompanying file LICENSE.txt distributed with this software
... |
# -*- coding: utf-8 -*-
"""Export the Bioregistry to RDF."""
import os
from io import BytesIO
from typing import Callable, List, Optional, Tuple, Union, cast
import click
import rdflib
from rdflib import BNode, Literal
from rdflib.namespace import DC, DCTERMS, FOAF, RDF, RDFS, XSD
from rdflib.term import Node, URIRe... |
import disnake
from disnake import file
from disnake.ext import commands
from typing import TYPE_CHECKING
from src.utils.utils import EmbedFactory, ExitButton, add_lines, get_info
if TYPE_CHECKING:
from src.utils import File
def clear_codeblock(content: str):
if content.startswith("```"):
content =... |
import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
from datetime import date
import tensorflow.keras as keras
from tensorflow.keras import applications
from tensorflow.keras.layers import Flatten, LeakyReLU, Dense
from tensorflow.keras.models import *
from tensorflow.keras impo... |
import numpy as np
import copy
def softmax(x):
assert len(x.shape) == 1
probs = np.exp(x - np.max(x))
probs /= np.sum(probs)
return probs
class TreeNode(object):
def __init__(self, parent):
self.parent = parent
self.W_ = 0
# action -> tree node
self.children_ = {}
... |
import re
from collections import namedtuple
PYTHON_IDENTIFIER = re.compile("^[a-z_][a-z0-9_]*$", re.I)
class Asm(object):
def to_regex(self, syntax, wrap=False):
raise NotImplementedError()
def maybe_wrap(self, should_wrap, regex):
if not should_wrap:
return regex
return... |
# Copyright 2018 The TensorFlow Constrained Optimization 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
#
#... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.