text stringlengths 3.07k 22.1k |
|---|
import numpy as np
import pandas as pd
import random
from collections import deque
import tensorflow as tf
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, Dropout, LSTM, BatchNormalization
from tensorflow.keras.callbacks import ModelCheckpoint
from tensorflow.keras.callbacks im... |
import datetime
from enum import Enum
from pathlib import Path
import shutil
from typing import Iterable, Tuple
from pymediainfo import MediaInfo
from xml.etree.ElementTree import ParseError
class MediaType(Enum):
# NB: These must match camtasia's codes for media types.
# TODO: Audio
Video = 0
Image ... |
import pygame, sys, math, random, time
from pygame.locals import*
pygame.init()
FPS = 25
fpsClock = pygame.time.Clock()
#set up window
windowX = 1080
windowY = 720
DISPLAYSURF = pygame.display.set_mode((windowX,windowY))
pygame.display.set_caption('graphs')
font = pygame.font.SysFont('consolas',20)
#set up... |
import torch
import torch.nn.functional as F
from typing import List
def get_pixel_grids(height, width):
x_coord = (torch.arange(width, dtype=torch.float32).cuda() + 0.5).repeat(height, 1)
y_coord = (torch.arange(height, dtype=torch.float32).cuda() + 0.5).repeat(width, 1).t()
ones = torch.ones_like(x_coor... |
#!/usr/bin/env python3
#Copyright (C) 2011 by <NAME>
#
#Released under the MIT license, see LICENSE.txt
""" Schedule jobs based on the dependencies between their associated
events. These dependencies are based 1, on the phylogeny and 2,
on outgroups. The input is a DAG, the output is a TREE
"""
import os
import x... |
# ----------------------------------------------------------------------------
# Copyright 2019-2021 Pelion
#
# SPDX-License-Identifier: Apache-2.0
#
# 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 Licens... |
# -- Imports --------------------------------------------------------------------------
from sanic import Blueprint
from sanic.request import Request
from sanic.response import HTTPResponse, json as original_json, text
from orjson import dumps as orjson_dumps
from functools import partial
json = partial(original_json,... |
""" Tests for item.py
"""
from item import Item
from website import Website
TEST_WEBSITE = Website('tests/config/test_magnetizer.cfg')
TEST_WEBSITE.refresh()
def test_article_is_valid():
""" Verify the Item.is_valid() function
"""
article = Item(TEST_WEBSITE)
article.markdown_source = 'Just some t... |
# SPDX-License-Identifier: BSD-3-Clause
# Copyright Contributors to the OpenColorIO Project.
"""
*ACES* Computer Graphics (CG) Config Generator
==============================================
Defines various objects related to the generation of the *ACES* Computer
Graphics (CG) *OpenColorIO* config:
- :func:`opencol... |
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 16 13:31:32 2018
@author: <NAME>
"""
import numpy as np
import scipy.sparse
from sklearn.base import clone
from sklearn.exceptions import NotFittedError
from tests.helpers.testing_help import rec_assert_equal
from aikit.tools.data_structure_helper import convert_gener... |
from datetime import datetime, timedelta
from nose.tools import eq_, ok_
from mock import Mock, patch
from django.core.exceptions import ObjectDoesNotExist
import amo
import amo.tests
from addons.models import Addon
from market.models import AddonPremium, Price
from users.models import UserProfile
from devhub.model... |
from concurrent.futures import (
ThreadPoolExecutor,
as_completed,
)
from dataclasses import (
dataclass,
)
from logging import (
getLogger,
)
from threading import (
BoundedSemaphore,
)
import time
from typing import (
Mapping,
Optional,
)
from urllib.parse import (
urlencode,
)
from a... |
import sys
from os import path
import re
from pathlib import Path
from textwrap import dedent
def get_html_tags(string, start_tag='>', end_tag='>'):
tags = list()
for s in string.split(start_tag):
tags.append(s.split(end_tag, 1)[0])
return tags
def get_tags(string, start_tag, end_tag, include_t... |
from django.contrib.auth.models import AbstractUser
from django.contrib.postgres.fields import JSONField, CICharField, ArrayField
from django.db import models
from simple_history.models import HistoricalRecords
from django_elasticsearch_dsl_drf.wrappers import dict_to_obj
from .managers import CustomUserManager
YMD_... |
"""Implementation of the Observer pattern."""
import sys
import threading
import warnings
import weakref
from weakref import WeakMethod
from kombu.utils.functional import retry_over_time
from celery.exceptions import CDeprecationWarning
from celery.local import PromiseProxy, Proxy
from celery.utils.functional import ... |
#!/usr/bin/env python
# imports
import copy
import classes
# class
class subclass:
def __init__(self, name, masterclass, startinglevel, perks):
self.name = name
self.masterclass = masterclass
self.startinglevel = startinglevel
self.perks = perks
path_berserker = subclass(
... |
from datetime import timedelta
import depthai as dai
import tempfile
import PySimpleGUI as sg
def check_ip(s: str):
spl = s.split(".")
if len(spl) != 4:
sg.Popup("Wrong IP format.\nValue should be similar to 255.255.255.255")
return False
for num in spl:
if 255 < int(num):
... |
import os
from typing import Dict, List, Tuple
import gym
import matplotlib.pyplot as plt
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from net.replay import ReplayBuffer
from net.utils import initial_seed
initial_seed(42)
#REF:https://github.com/... |
# most of this code was politely stolen from https://github.com/berkeleydeeprlcourse/homework/
# all creadit goes to https://github.com/abhishekunique (if i got the author right)
import sys
import random
import numpy as np
try:
from IPython.display import display
from graphviz import Digraph
import graphvi... |
"""
Implementation of PPO
ref: Schulman, John, et al. "Proximal policy optimization algorithms." arXiv preprint arXiv:1707.06347 (2017).
ref: https://github.com/Jiankai-Sun/Proximal-Policy-Optimization-in-Pytorch/blob/master/ppo.py
ref: https://github.com/openai/baselines/tree/master/baselines/ppo2
NOTICE:
... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from timm.models.layers import DropPath, trunc_normal_
from timm.models.registry import register_model
class MLP(nn.Module):
def __init__(
self,
in_features,
hidden_features=None,
out_features=None,
act_laye... |
# -- VERY PRELIMINARY!!!! -----
import numpy as np
try:
from matplotlib import path
except(ImportError):
pass
region_types = ['circle', 'ellipse', 'polygon', 'box']
def load_regfile(regfile):
reglist = []
f = open(regfile, 'r')
for line in f:
istype = [r in line for r in region_types]
... |
import re
# https://www.tldp.org/LDP/Bash-Beginners-Guide/html/Bash-Beginners-Guide.html#chap_04
zen = """The Zen of Python, by <NAME>
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Code for preparing data frames and other data constructs for use by
the Dash app.
"""
from datetime import datetime
from copy import deepcopy
from os.path import join, exists
from pickle import load, dump
import logging
import pandas as pd
import plotly.graph_objects... |
import os
import torch
import numpy as np
import random
from torch import optim
from torchvision import datasets, models, transforms
import matplotlib.pyplot as plt
import torch.nn as nn
import time
from sklearn.metrics import precision_score, recall_score
import config
def train_LinearClassifier(pic_matrix, label_... |
# -*- coding: utf-8 -*-
"""
@author: <NAME>, GEUS (Geological Survey of Denmark and Greenland)
"""
import numpy as np
import pandas as pd
import geopandas as gpd
import xarray as xr
from scipy.spatial import distance
from shapely.geometry import Point
import glob
import os
from tqdm import tqdm
imp... |
import attr
import click
import shutil
import delegator
import itertools
import click_completion
import pandas as pd
from Bio import SeqIO
from loguru import logger
from pathlib import Path
click_completion.init()
CURRENT_DIR = Path().cwd()
class BlastFormatError(Exception):
pass
class BlastNotFound(Exception)... |
from Bio.Seq import Seq
from Bio.SeqRecord import SeqRecord
from ..alphabets import gap_letter
def add_seqnums_to_letter_annotations(seqrec, include_gaps=True):
# If seqnums is already present, don't override it.
if "seqnums" in seqrec.letter_annotations:
return seqrec
if include_gaps:
se... |
import numpy as np
import networkx as nx
from typing import *
from framework import *
from .mda_problem import *
from .cached_air_distance_calculator import CachedAirDistanceCalculator
__all__ = ['MDAMaxAirDistHeuristic', 'MDASumAirDistHeuristic',
'MDAMSTAirDistHeuristic', 'MDATestsTravelDistToNearestLabH... |
"""Module doom bolts."""
__author__ = '<NAME> (japinol)'
import random
import pygame as pg
from codemaster.config.constants import BM_MAGIC_FOLDER, DIRECTION_RIGHT
from codemaster.utils.colors import Color
from codemaster.utils import utils_graphics as libg_jp
from codemaster.models.experience_points import Experie... |
# This must be done BEFORE importing numpy or anything else.
# Therefore it must be in your main script.
import os
os.environ["MKL_NUM_THREADS"] = "1"
os.environ["NUMEXPR_NUM_THREADS"] = "1"
os.environ["OMP_NUM_THREADS"] = "1"
import numpy as np
import jax.numpy as jnp
import jax
import h5py
from functools import pa... |
import torch
import torchvision
import torchvision.datasets as tdata
import torchvision.transforms as tTrans
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optm
import matplotlib.pyplot as plt
# Python Imaging Library
import PIL
import numpy as np
import sys as sys
# Index definitions to b... |
# -*- coding: utf-8 -*-
# Copyright 2018 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Unit tests for chromite.lib.repo and helpers for testing that module."""
from __future__ import print_function
import os
impo... |
# Copyright (C) 2019 Intel Corporation
#
# SPDX-License-Identifier: MIT
format_spec = {
"name": "TFRecord",
"dumpers": [
{
"display_name": "{name} {format} {version}",
"format": "ZIP",
"version": "1.0",
"handler": "dump"
},
],
"loaders": [... |
import random
import inspect
import string
import shutil
import re
import keyword
import ast
from datetime import timedelta
import numpy as np
from swutil.validation import String, Integer
class no_context:
def __enter__(self, *args):
pass
def __exit__(self, *args):
pass
def smart_range(*arg... |
#!python36
# -*- coding: utf-8 -*-
"""
NCams Toolbox
Copyright 2019-2020 <NAME>, <NAME>
https://github.com/CMGreenspon/NCams
"""
import os
import matplotlib.pyplot as mpl_pp
from scipy.spatial.transform import Rotation as R
import ncams
def import_kinematics():
# Translate the triangulated data into OSim trc f... |
import gzip
import sys
import orjson as json
from src.objects import Work, Venue, Institution, Author, Concept
sys.path.extend(['../', './'])
from tqdm.auto import tqdm
from src.entities import Works
from src.utils import Paths, ParquetIndices, IDMap, combined_dump_work_refs, process_and_dump_references, \
conv... |
# Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import torch
import torch.nn as nn
from torch.autograd import Variable
from copy import deepcopy
from collections impor... |
# ==============================================================================
# Copyright (c) 2017 Octavio
#
# This work is licensed under the terms of the MIT license.
# For a copy, see https://opensource.org/licenses/MIT.
# ==============================================================================
# ==... |
import random # because we'll need this ha, ha, ha
# the vocabulary could just be a single list but I've organized more-or-less
# in case I want to try a few grammaticaly rules later:
people = [
'<NAME>',
'<NAME>',
'<NAME>',
'<NAME>',
'<NAME>',
'<NAME>',
'<NAME>',
'Jaybez',
'... |
import redis
import modules
import json
import datetime
from zope.interface import implements
from zope.interface import Interface
from twisted.internet import defer
from twisted.internet import task
from twisted.plugin import IPlugin
from twisted.plugin import getPlugins
from twisted.python import log
from twisted.tri... |
# This file is part of QuTiP: Quantum Toolbox in Python.
#
# Copyright (c) 2011 and later, <NAME> and <NAME>.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistribut... |
'''
WGAN implementation gan-defense paper
wgan based on paper: https://arxiv.org/abs/1610.09585
gan-defense paper: https://arxiv.org/pdf/1805.06605.pdf
by <NAME> <EMAIL>
'''
import torch
import torch.nn as nn
import torch.optim as optim
import os
import random
from CNN.resnet import BasicBlock
import torch.nn.func... |
# Copyright (c) 2020 <NAME>
# Licensed under the MIT License
import datetime
import json
import os
import re
from urllib.parse import unquote
import aiohttp
import asyncpg
from bs4 import BeautifulSoup as Bs4
GAME_YEAR_OFFSET = 1286
async def upgrade():
old_settings = await fetch_settings()
try:
... |
import os
import re
import json
import argparse
import nltk
from tqdm import tqdm
from collections import Counter
from utils.utils import get_word_span, get_word_idx, process_tokens
def main():
config = argparser()
load(config)
def argparser():
p = argparse.ArgumentParser()
p.add_argument('-mode', typ... |
import numpy as np
import tensorflow as tf
import tensorflow.python.platform
from tensorflow.models.rnn import rnn
from tensorflow.models.rnn import rnn_cell
from bi_rnn import bi_rnn
from utils import *
###############################################
# NN creation functions #
#################... |
import torch
from torch import nn
from torch.nn.utils.rnn import pad_packed_sequence, pack_padded_sequence, PackedSequence
from utils.utils import get_rnn
class RNN(nn.Module):
""" RNN Module """
def __init__(self, input_size, hidden_size,
output_projection_size=None, num_layers=1,
... |
import time
import warnings
from distutils.version import LooseVersion
from .proto.attr_value_pb2 import AttrValue
from .proto.graph_pb2 import GraphDef
from .proto.node_def_pb2 import NodeDef
from .proto.step_stats_pb2 import RunMetadata, StepStats, DeviceStepStats, NodeExecStats, AllocatorMemoryUsed
from .proto.ten... |
import os
import cv2
import glob
import h5py
import json
import joblib
import argparse
import numpy as np
from tqdm import tqdm
import os.path as osp
import scipy.io as sio
import sys
sys.path.append('.')
from lib.models import spin
from lib.core.config import TCMR_DB_DIR, BASE_DATA_DIR
from lib.utils.utils import tq... |
"""
This is a version of FMI-PPN used for probability of lightning
nowcasts.
"""
import datetime as dt
import os
import random
import numpy as np
import h5py
import pysteps
from pysteps import rcparams as pystepsrc
import ppn_logger
import ppn_config
import utils
from eccodes import *
import matplotlib.pyplot as pl... |
from bpy.types import (
Operator,
Panel,
UIList,
UI_UL_list,
)
from .internals import *
from .operators import (
rto_history,
rename,
phantom_history,
)
class CollectionManager(Operator):
bl_label = "Collection Manager"
bl_idname = "view3d.collection_manager"
last... |
from z3 import *
from random import *
#If you want to create a new flag, ensure it is printable (32 <= c <= 127)
# and add it to flag_mid
flag_start = "GLUG{"
flag_mid = "C01nc1d3nc3_c4n_b3_fr3aky_T6LSERDYB6"
flag_end = "}"
flag = flag_start + flag_mid + flag_end
len_flag = len(flag)
print(len(flag))
s = Solver()
#i... |
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
from future import standard_library
standard_library.install_aliases()
from builtins import str
from past.utils import old_div
from builtins import object
try:
from . import mesh
except:
import mesh
fr... |
import os
import typing as t
import logging
from typing import TYPE_CHECKING
from datetime import datetime
from datetime import timezone
import fs
import attr
import yaml
import cattr
import fs.osfs
import pathspec
import fs.errors
import fs.mirror
from fs.copy import copy_file
from simple_di import inject
from simple... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
import settings
from models.specs import get_update_ops, keep_my_loss, my_losses, ModelsSaveLoadManager
from models.specs.heatmap import FeatureMap, HeatMap
from models.specs.heatmap i... |
import glob
from datetime import datetime, timedelta
import fasteners
import re
import os
from os import path
# import datetime
# from utils.saver import Saver
_LOG_DATE_FORMAT = "%m%d-%H%M" # month day _ hour minute
_RESTORE_PREFIX = 'RESTORE@'
def create_unique_log_dir(config_path, log_dir_root, line_breaking_c... |
from guillotina import app_settings
from guillotina import glogging
from guillotina_amqp import amqp
from guillotina_amqp.job import Job
from guillotina_amqp.state import get_state_manager
from guillotina_amqp.state import TaskState
from guillotina_amqp.state import TaskStatus
from guillotina_amqp.state import update_t... |
import json
import random
from dataclasses import dataclass
from typing import Any, cast
import numpy as np
from srl.base.define import RLObservationType
from srl.base.env.base import EnvRun
from srl.base.rl.algorithms.discrete_action import DiscreteActionConfig
from srl.base.rl.base import RLParameter, RLTrainer, RLW... |
"""
NOMIS
=====
Collect official data from the NOMIS API, using configuration files.
"""
import requests
from collections import Counter
from io import StringIO
import pandas as pd
from collections import defaultdict
import re
import logging
import datetime
import configparser
NOMIS = "http://www.nomisweb.co.uk/api/... |
import dash
import dash_core_components as dcc
import dash_html_components as html
import dash_table_experiments as dt
from dash.dependencies import Input, Output, State
from propnet import log_stream
from propnet.web.layouts_models import model_layout, models_index
from propnet.web.layouts_symbols import symbol_layo... |
from copy import copy
class SortingUtilClass:
@staticmethod
def list_to_string(values):
count = len(values) - 1
res = ''
for n in values:
fmt_string = '{:<3}'
res += fmt_string.format(n)
return res
@staticmethod
def print_results(comparisons, swaps):
print()
print('Analysis: ')
print('\t{0:<... |
# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
# Lean CLI v1.0. Copyright 2021 QuantConnect 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... |
import logging, numpy as np, rpxdock as rp
from rpxdock.app import dock
log = logging.getLogger(__name__)
class quasi_body():
def __init__(self):
self.pdb = ""
self.resis_int1 = []
self.resis_int2 = []
self.overlap_int1 = 0
self.overlap_int2 = 0
self.is_quasi = False... |
import numpy as np
import pandas as pd
import h3.api.numpy_int as h3
import multiprocessing as mp
import math
import geo.geomath as gm
from functools import partial
from timeit import default_timer as timer
class GeoBrute(object):
def __init__(self, locations: np.ndarray):
self.lats = locations[:, 0]
... |
'''
Overwatch aim bot program
This code runs in the background of your computer as you play Overwatch.
It identifies the location of enemies through image analysis.
Specifically, in Overwatch, each enemy is outlined in Red.
This program takes a screenshot, identifies red pixels on the screen, and moves
your cur... |
import numpy as np
import tensorflow as tf
import pandas as pd
from copy import deepcopy
import random
import math
import time
class Agent:
'''Agent Base.'''
def __init__(self, game, display=None):
self.game = game
self.display = display
def play(self, max_iter=np.inf, verbose=False):
... |
"""Collection of routines used to post process (magnetisation)
vector data.
Part of ovf2vtk.
<NAME>, <EMAIL>
# Some helping functions:
#
# Set of functions used for ovf2vtk. General data format is a rank-2
# matrix with the row corresponding to the data in the vector field, and
# the 3-component column correspondin... |
#!/usr/bin/env python
'''
This script starts all Turtlebot control services
which are defined under `srv/` folder.
The key setence is:
turtle_services = TurtlebotControlRosServices()
turtle_services.start()
WARNING: `SetPose` is not supported for real robot, only for Gazebo simulation.
'''
from ros_turtl... |
#
# This software is licensed under the Apache 2 license, quoted below.
#
# Copyright 2019 Astraea, 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/LI... |
"""
Django settings for main project.
Generated by 'django-admin startproject' using Django 3.2.9.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.2/ref/settings/
"""
import logging
... |
"""
Created on 2018-04-27
Project: Test
File: md_mnist.py
...
@author: <NAME>
"""
import tensorflow as tf
import numpy as np
from tensorflow.examples.tutorials.mnist import input_data
from sklearn.utils import shuffle
import os
os.environ["CUDA_VISIBLE_DEVICES"] = ""
import argparse
parser = argparse.ArgumentParser(des... |
import logging
import os
import pathlib
import queue
import shlex
import signal
import simpleaudio
import threading
import time
import wave
import zmq
logging.basicConfig(level=logging.INFO,
format='(%(threadName)s) %(levelname)s: %(message)s')
SONGS_DIR = 'songs/'
BUF_SIZE = 10
q = queue.Queue(B... |
# -*- coding: ascii -*-
""" The resolver provides various mechanisms for doing things automatically
that might be found in the configuration file. For example, it handles matching
the [-v] in a file path to the various files it can match. """
import glob
import os
from subprocess import Popen
from subprocess import P... |
# -*- coding: utf-8 -*-
"""
Generate voter ballots.
Ballot generation parameters
-----------------------------
norm : bool
Normalize ratings
cut_ranks : bool
Cut away ranks according to voter tolerance
compromise : int (0 default)
Number of frontrunners to consider in compromise strategy.
Compromise... |
# This file is a part of the USBIPManager software
# library/performance.py
# Implements interfaces for measuring the performance of software and its modules
#
# Copyright (c) 2018-2019 <NAME>
# Repository: https://github.com/lompal/USBIPManager
# TODO Change documentation URL
# Documentation: https://gthb.in/blog/post... |
# The MIT License (MIT)
#
# Copyright (c) 2015 <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... |
def quantizate_colors(img1,num_colors,bl):
import cv2
import numpy as np
from sklearn.cluster import KMeans,MiniBatchKMeans
#https://www.pyimagesearch.com/2014/07/07/color-quantization-opencv-using-k-means-clustering/
blur = cv2.bilateralFilter(img1.copy(), bl, bl, bl)
(h, w) = blur.shape[:2]
... |
import tkinter
from tkinter import *
from tkinter import Tk, Button, Label, ttk, messagebox, filedialog
import os
import sys
import webbrowser
import subprocess
def resource_path0(relative_path):
base_path = getattr(
sys,
'_MEIPASS',
os.path.dirname(os.path.abspath(__file__)))
... |
import os
import numpy as np
import matplotlib.pyplot as plt
import yaml
import _pickle as cpickle
def process_yaml_list(x):
if type(x) is np.ndarray:
return x
else:
return np.array([eval(i) if type(i) is str else i for i in x])
class MobileArm:
"""TODO
type: str
type of ... |
#!/usr/bin/env
# Standard library
import pytest
import logging as log
import sys
import unittest
from unittest import TestCase
# Third-party
import numpy as np
# First-party
from stormtrack.core.constants import default_constants
from stormtrack.core.identification import find_features_2d_threshold
from stormtrack.c... |
#! /usr/bin/env python
import logging
import os
from timeit import default_timer as timer
import numpy
import pandas
import gzip
import pyliftover
import metax
from metax import Utilities
from metax import Logging
from metax import Exceptions
from metax import PredictionModel
from metax.genotype import Genotype
from ... |
""" Utility functions and shortcuts for the WSC winter school
(c) 2022 <EMAIL>
"""
# ========= Utility functions for accounts and credentials ==========
def load_credentials(filename):
import os, json
# filename = '..'+os.path.sep+'..'+os.path.sep+'credentials'
with open(filename) as json_file:
... |
#!/usr/bin/python
# (c) 2020, NetApp, Inc
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = """
module: na_santricity_client_certificate
short_description: NetApp E-Series ... |
##############################################################################
#
# Copyright (c) 2003 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOF... |
# -*- coding: utf-8 -*-
r'''This module contains classes for different types of network layers.
.. image:: _static/feedforward_neuron.svg
In a standard feedforward neural network layer, each node :math:`i` in layer
:math:`k` receives inputs from all nodes in layer :math:`k-1`, then transforms
the weighted sum of the... |
# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
# Lean CLI v1.0. Copyright 2021 QuantConnect 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... |
from xml.dom.minidom import parse
import os
import re
import shutil
from string import Template
from lxml import etree
from bs4 import BeautifulSoup as BS
from bs4 import Comment
def prompt_from_html(html_filename, id):
"""
Search for a question or task prompt from the html file by ID
"""
with open(htm... |
# -*- coding: utf-8 -*-
# Copyright (c) 2020-2021 <NAME>.
# All rights reserved.
# Licensed under BSD-3-Clause-Clear. See LICENSE file for details.
from django.http import HttpResponseRedirect
from django.urls import reverse
from django.utils import timezone
from django.shortcuts import render, redirect
from djang... |
import numpy as np
import sys
import paddle
import random
from paddle.nn import Transformer,TransformerEncoderLayer,TransformerEncoder,TransformerDecoderLayer,TransformerDecoder
from paddle.nn import Linear
from paddle.io import Dataset
import paddle.fluid as fluid
import paddle.distributed as dist
import os
os.environ... |
"""
grid_objs
=========
"""
from __future__ import absolute_import
import _plotly_utils.exceptions
try:
from collections.abc import MutableSequence
except ImportError:
from collections import MutableSequence
import json as _json
from _plotly_utils.optional_imports import get_module
from chart_studio import... |
import numpy as np
import plotly.graph_objs as go
from plotly.subplots import make_subplots
import plotly.express as px
from statsmodels.distributions.empirical_distribution import ECDF
from .base_experiment import BaseExperiment
from .trial import FixedRatioTrial, TreeTrial, Trial
_PLOTLY_COLORS = [
'#1f77b4', ... |
import sys
import os
import torch
import argparse
from tqdm.std import trange
sys.path.append('./lib')
from bert import BERTLM
from treelstm import TreeLSTM
from kvbert import myModel
from kvbert import TreeArgs
from treelstm import treeVocab
import numpy as np
from google_bert import BasicTokenizer
from treelstm imp... |
import sys
import math
def merge(x, y, left, mid, right):
l = left
r = mid + 1
xs = [0 for i in range(right - left + 1)]
ys = [0 for i in range(right - left + 1)]
i = 0
while l <= mid and r <= right:
if x[l] <= x[r]:
xs[i] = x[l]
ys[i] = y[l]
l += 1
... |
import plotly.express as px
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
import dash_bootstrap_components as dbc
from dash.exceptions import PreventUpdate
import pandas as pd
import time
import edgeiq
from helpers import *
from sample_wri... |
from saml2_tophat.saml import AuthnContext, AuthnContextClassRef
from saml2_tophat.samlp import RequestedAuthnContext
__author__ = 'rolandh'
from saml2_tophat import extension_elements_to_elements
UNSPECIFIED = "urn:oasis:names:tc:SAML:2.0:ac:classes:unspecified"
INTERNETPROTOCOLPASSWORD = \
'urn:oasis:names:tc... |
import cv2
import os
import numpy as np
from tkinter import *
import tkinter,os
import cv2
import shutil
from tkinter import filedialog
from PIL import Image, ImageTk
subjects = ["", "Abhijit", "Nikhita","Dev"]
class person_detect():
def __init__(self):
self.face_recognizer = cv2.face.LBPHFaceRecognizer_create()... |
"""
create_demo_site management command
"""
import logging
import random
from datetime import timedelta
from django.conf import settings
from django.contrib.sites.models import Site
from django.core.management.base import BaseCommand, CommandError
from django.utils import timezone, translation
from cms import models ... |
# -*- coding: utf-8 -*-
# Copyright (C) 2014 Yahoo! 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... |
# Copyright (c) 2013, Chris and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import re
from past.builtins import cmp
import functools
import math
from datetime import datetime
import frappe, erpnext
from erpnext.accounts.report.utils import get_currency, conve... |
import os
import glob
from . import data_analysis
import trimesh
import shutil
import numpy as np
import pandas as pd
import subprocess
from sklearn.model_selection import train_test_split
from . import utils
from . import binvox_rw
def build_csv(pInFolder, pOutFolder, pFileName) :
test_file = os.path.join(pOutF... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.