text stringlengths 3.07k 22.1k |
|---|
# Copyright 2017 Intel Corporation
# Copyright 2017 Wind River
#
# 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 applic... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import logging
import itertools
from six.moves import range
from curtsies import fsarray, fmtstr
from curtsies.formatstring import linesplit
from curtsies.fmtfuncs import bold
from bpython.curtsiesfrontend.parse import func_for_letter
from bpython._py3c... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import logging
import ray
from ray.rllib.evaluation.postprocessing import compute_advantages, \
Postprocessing
from ray.rllib.policy.sample_batch import SampleBatch
from ray.rllib.policy.tf_policy import L... |
import io, glob, os, csv, re, random
# testUSFM = "C://Users//benja//Documents//uwgit//hbo_uhb//02-EXO.usfm"
pathUSFM = "C://Users//benja//Documents//uwgit//hbo_uhb//"
# testTWL= "C://Users//benja//Documents//uwgit//en_twl//twl_EXO.tsv"
pathTWL= "C://Users//benja//Documents//uwgit//en_twl//"
wordStrongsGrabber = r"... |
# -*- coding: utf-8 -*-
"""
Common method for reuse code
Generate certificate
openssl req -x509 -out localhost.crt -keyout localhost.key \
-newkey rsa:2048 -nodes -sha256 \
-subj '/CN=localhost' -extensions EXT -config <( \
printf "[dn]\nCN=localhost\n[req]\ndistinguished_name = dn\n[EXT]\nsubjectAltName=DNS:l... |
from typing import Callable, Optional
from blspy import G1Element, G2Element
from clvm_rs import serialized_length
from chia.types.blockchain_format.program import SerializedProgram
def skip_list(buf: memoryview, skip_item: Callable[[memoryview], memoryview]) -> memoryview:
n = int.from_bytes(buf[:4], "big", si... |
# !/usr/local/u-mail/app/engine/bin/python
# -*-coding:utf8-*-
#
import re
import copy
import datetime
import common
import base64
import email
common.init_django_enev()
from apps.mail.models import get_mail_model, Settings
from apps.collect_mail.models import get_mail_model as get_mail_model2
from lib.parse_email imp... |
# USAGE:
# python seam_carving.py (-resize | -remove) -im IM -out OUT [-mask MASK]
# [-rmask RMASK] [-dy DY] [-dx DX] [-vis] [-hremove] [-backward_energy]
# Examples:
# python seam_carving.py -resize -im demos/ratatouille.jpg -out ratatouille_resize.jpg
# -mask demos/ratatouille_mask.jpg ... |
from decimal import Decimal
import pandas as pd
import threading
import time
from typing import (
Set,
Tuple,
TYPE_CHECKING,
List,
Optional
)
from datetime import datetime
from hummingbot.client.config.global_config_map import global_config_map
from hummingbot.client.settings import (
MAXIMUM_TR... |
from __future__ import print_function
import numpy as np
import os
import scipy
import sys
import torch
import torch
import torch.nn as nn
from collections import Counter
from scipy.stats import t
from sklearn import metrics
from sklearn.ensemble import RandomForestClassifier
from sklearn.linear_model import LogisticR... |
import sys
import os
import re
import copy
from parser import *
rm_sidebar_regx = r'(?:.*sidebar.*contents.*\s)(^(?:.*\s)*?)\s*(?:\s*?<\/nav>$)'
# Can contain 1 or more <ul>..,/ul> pairings...
ing_html_regx = r'(?:.*header.*ingredients.*?\s)(^(?:.*?\s)*?)\s*(?:^<.*header.*(method|direction|directions).*$)'
# Grab this... |
import os
import sys
import json
from http.server import BaseHTTPRequestHandler, HTTPServer
from urllib.parse import urlparse
from gym_backgammon.envs.backgammon import WHITE, BLACK
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
COLORS = {WHITE: "White", BLACK: 'Black'}
class Ha... |
"""`Nate` importers involving pandas.
This module provides common importers for the `Nate` class. They use existing
pandas import functionality as an interface to `Nate`. These importers are the
reccomended way to import data into `Nate`, unless the user needs to import data
in ways not covered by this module's functi... |
# Copyright 2019 Mycroft AI Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... |
# Copyright 2015 The Chromium 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 posixpath
import re
from telemetry.timeline import event as timeline_event
class MmapCategory(object):
_DEFAULT_CATEGORY = None
def __init__(s... |
#!/usr/bin/env python
import torch
import torch.nn as nn
from torch.autograd import Variable
import matplotlib.pyplot as plt
import gensim
import argparse
import datetime
import random
import numpy as np
from pprint import pprint
args = argparse.ArgumentParser(
description="Train GRU NLG model")
args.add_argument... |
# -*- coding: utf-8 -*-
# @Author : William
# @Project : TextGAN-william
# @FileName : text_process.py
# @Time : Created at 2019-05-14
# @Blog : http://zhiweil.ml/
# @Description :
# Copyrights (C) 2018. All Rights Reserved.
import nltk
import numpy as np
import os
import torch
import... |
import math
import numpy as np
from cereal import log
import cereal.messaging as messaging
from cereal import log
import cereal.messaging as messaging
from selfdrive.config import Conversions as CV
from selfdrive.controls.lib.planner import calc_cruise_accel_limits
from selfdrive.controls.lib.speed_smoother import s... |
import xml.etree.ElementTree as ET
from django.contrib.auth.models import User
from django.core.exceptions import ObjectDoesNotExist
from django.http import HttpResponse
from rdkit import Chem
from rdkit.Chem import AllChem, Draw, Atom, rdFMCS, rdDepictor
import re
from rdkit.Chem.Draw.MolDrawing import DrawingOptions... |
import logging
import os
import time
import warnings
import sys
from threading import local
from py2neo import neo4j
from py2neo.exceptions import ClientError
from py2neo.packages.httpstream import SocketError
from py2neo import cypher as py2neo_cypher
from .exception import CypherException, UniqueProperty, Transaction... |
#!/usr/bin/python
#coding=utf-8
#@+leo-ver=5-thin
#@+node:bob.20180205135005.1: * @file ../plugins/leo_babel/tests/lib_test.py
#@@first
#@@first
#@@language python
#@@tabwidth -4
#@+<< imports >>
#@+node:bob.20180205135704.1: ** << imports >>
import datetime
# import time
from leo.core import leoGlobals as leoG
#@-<<... |
import pyautogui
import keyboard
import pickle
from pathlib import Path
import time
# directkeys.py
# http://stackoverflow.com/questions/13564851/generate-keyboard-events
# msdn.microsoft.com/en-us/library/dd375731
import ctypes
from ctypes import wintypes
import time
import pyautogui
user32 = ctypes.WinDLL('user32'... |
import hashlib
import logging
from pathlib import Path, PurePath
from collections import deque
from datetime import datetime, timezone
from typing import List, Optional, Type, Dict, Any, Deque
from types import TracebackType
import boto3 # pylint: disable=unused-import
from dateutil.parser import parse
from git impor... |
"""PSPNet model.
PSPNet: Pyramid Scene Parsing Network
https://arxiv.org/pdf/1612.01105.pdf
Adapted from code contributed by ykamikawa.
https://github.com/ykamikawa/PSPNet
"""
import keras.backend as K
from keras.models import Model
from keras.engine import InputSpec
from keras.utils import conv_utils
from keras.eng... |
from shapely import geometry
import numpy as np
import xarray as xr
import pandas as pd
import geopandas as gpd
from .base_class_for_query_of_nearest_points import Query_Nearest_Points
def _get_nearest_pixels(ground_pixel_tree,
xy,
radius=100 # in meters
... |
# 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 appli... |
#!/usr/bin/python3
"""Simple script to run top on multiple machines at once.
This script runs top through ssh on all specified machines.
On every refresh it runs 'ssh -x top -bn 1' for every host.
Uses ssh connexion multiplexing to avoid too many connections.
Hosts that cannot be contacted are listed at the bottom
F... |
# BenchExec is a framework for reliable benchmarking.
# This file is part of BenchExec.
#
# Copyright (C) 2007-2015 <NAME>
# 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... |
import argparse, os, csv, sys, errno
import networkx as nx
"""
This is functionally equivalent to the mkdir -p [fname] bash command
"""
def mkdir_p(path):
try:
os.makedirs(path)
except OSError as exc: # Python >2.5
if exc.errno == errno.EEXIST and os.path.isdir(path):
pass
e... |
#
# Copyright 2018 Analytics Zoo Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
# Copyright 2015 The Emscripten Authors. All rights reserved.
# Emscripten is available under two separate licenses, the MIT license and the
# University of Illinois/NCSA Open Source License. Both these licenses can be
# found in the LICENSE file.
import os, shutil, logging, subprocess, sys, stat
TAG = 'version_4'
... |
# 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
#
# Unless required by applicable law or a... |
#!python
# codatag: utf-8
"""This module provides a pipe-like mechanism to cascade commands."""
import copy
class UnregisteredPipeType(Exception):
"""Exception for unknown data type when cascading pipes.
If the type of pipe item is not registered in Pipe class, this exception
will be raised.
"""
... |
#!/usr/bin/env python3
import datetime
import os
import re
import shutil
import signal
import subprocess
import time
import glob
import sentry_sdk
from common.params import Params
from common.file_helpers import mkdirs_exists_ok
from selfdrive.hardware import TICI, HARDWARE
from selfdrive.loggerd.config import ROOT
f... |
import pygame
from classes import Graph,Map,Button
# Colors
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
RED = (255, 50, 50)
YELLOW = (255, 255, 0)
GREEN = (0, 255, 50)
SNOW = (255,250,250)
BLUE = (50,50,255)
GREY = (70,70,70)
#------CUSTOMIZING VARIABLES------
dimensions = (1000,1000)
start = (300,300)
goal = (510,510... |
# -*- coding: utf-8 -*-
"""Default typedefs, references, and other structures."""
from dataclasses import dataclass, field
from typing import Dict, Iterable, List, Optional, Tuple, Union
from .reference import Reference, Referenced
from ..identifier_utils import normalize_curie
from ..resources.ro import load_ro
__... |
import sqlite3
import time
from typing import Callable
from typing import List
from typing import Optional
from typing import Set
from typing import Tuple
import colorlog
from backuppy.crypto import compress_and_encrypt
from backuppy.crypto import decrypt_and_unpack
from backuppy.crypto import decrypt_and_verify
from... |
import pytest
import numpy.testing as npt
import numpy as np
import unittest
import lenstronomy.Util.util as util
import lenstronomy.Util.kernel_util as kernel_util
from lenstronomy.ImSim.image_model import ImageModel
class TestNumerics(object):
def setup(self):
# we define a model consisting of a sing... |
"""
This module contains functions which enable the user to run TEDOPA for
certain settings without having to know ``mpnum``. This is a wrapper for the
tedopa/tedopa.py module.
TEDOPA proceeds in two steps: (i) Map the Hamiltonian from a system,
composed of one or two sites that are each linearly coupled to a
distinct... |
#!/usr/bin/env python
import wx
import os
import sys
import random
try:
dirName = os.path.dirname(os.path.abspath(__file__))
except:
dirName = os.path.dirname(os.path.abspath(sys.argv[0]))
sys.path.append(os.path.split(dirName)[0])
try:
from agw import genericmessagedialog as GMD
except ImportError: # ... |
# This file will track sectors and will provide get/set interface for sectors.
import numpy as np
import math
import time
import rospy
import yaml
from grid_map_msgs.srv import GetGridMap
import multiprocessing as mp
import queue
class RayTracer:
NUMBER_OF_PROCESSES = 4
def __init__(self):
mp.set_sta... |
import pickle
import random
import os
import sys
import time
from PIL import Image
import torch
import torch.nn.functional as F
from utils.augmentations import horisontal_flip
from utils.utils import *
from torch.utils.data import Dataset, IterableDataset
import torchvision.transforms as transforms
def pad_to_square... |
import tensorflow as tf
from tensorflow.keras import backend
from tensorflow.keras import layers
from tensorflow.keras import models
initializer = {'class_name': 'VarianceScaling',
'config': {'scale': 2.0, 'mode': 'fan_out', 'distribution': 'normal'}}
@tf.function
def activation_fn(x):
return tf.... |
# =============================================================================
# Automated trading script I - MACD
# Author : <NAME>
# Please report bug/issues in the Q&A section
# =============================================================================
import fxcmpy
import numpy as np
from stocktrends... |
import os
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from sqlalchemy import or_, and_
from sqlalchemy.orm import load_only, Load
from models import Advertisement, Municipality
import json
import sys
import requests
from models import utils
import pdb
import time
OPENSTREETMAP_BASE_UR... |
# coding=utf-8
# Copyright 2022 The Robustness Metrics Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
# -*- coding: utf-8 -*- #
# Copyright 2018 Google LLC. 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 requir... |
"""
mf module. Contains the ModflowGlobal, ModflowList, and Modflow classes.
"""
import os
import sys
import flopy
from flopy.mbase import BaseModel, Package
from flopy.utils import mfreadnam
from flopy.modflow.mfpar import ModflowPar
class ModflowGlobal(Package):
"""
ModflowGlobal Package... |
#!/usr/bin/env python2
#####################################################################
# Software License Agreement (BSD License)
#
# Copyright (c) 2016, <NAME>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following ... |
"""Abstract Handler with helper methods."""
from clang.cindex import CursorKind, TypeKind
from ctypeslib.codegen import typedesc
from ctypeslib.codegen.util import log_entity
import logging
log = logging.getLogger('handler')
class CursorKindException(TypeError):
"""When a child node of a VAR_DECL is parsed as... |
import json
import time
from contextlib import closing
from rest_client.exceptions import (
ServerResponseException, SaltAuthenticationError,
SaltModuleUnavailableException, SaltClientError)
from .core import Client
MAGIC_SLEEP_INTERVAL = [2, 4, 8, 16]
class Salt(Client):
_url_base = None
_timeout =... |
"""
.. module: dispatch.plugins.google_drive.drive
:platform: Unix
:copyright: (c) 2019 by Netflix Inc., see AUTHORS for more
:license: Apache, see LICENSE for more details.
.. moduleauthor:: <NAME> <<EMAIL>>
"""
import functools
import io
import json
import logging
import tempfile
import time
import uuid
f... |
"""
LendingClub Python Client Library
AUTHOR
<NAME>
Github: porkbutts
LICENSE (The MIT License)
Copyright (c) 2017 <NAME> "<EMAIL>"
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 restrict... |
import pandas as pd
import numpy as np
import PySimpleGUI as sg
import matplotlib.pyplot as plt
import sweetviz as sv
import os
import webbrowser #for displaying pandas-profiling report on a separate page
from pandas_profiling import ProfileReport
# for UI integration a bridge/helper methods or drop down to a level wh... |
#
# blood_graph.py
#
# vanilla_core execution visualizer.
#
# input: vanilla_operation_trace.csv.log
# vanilla_stats.csv (for timing)
# output: blood graph file (blood_abstrat/detailed.png)
# blood graph key (key_abstract/detailed.png)
#
# @author <NAME>
#
# How to use:
# python blood_... |
# coding: utf-8
import os
import docker
import pytest
import subprocess
import pymysql.connections
from docker.models.containers import Container
from helpers.cluster import ClickHouseCluster
SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
config_dir = os.path.join(SCRIPT_DIR, './configs')
cluster = Clic... |
import torch
from torch.utils.data.sampler import BatchSampler, SubsetRandomSampler
def _flatten_helper(T, N, _tensor):
return _tensor.view(T * N, *_tensor.size()[2:])
class RolloutStorage_feat(object):
def __init__(self, num_steps, num_processes, obs_shape, feat_dim, action_space, ntasks, recurrent_hidden_s... |
from .depth import Depth
from .doctree2md import Translator, Writer
from docutils import nodes
from pydash import _
import html2text
import os
import sys
h = html2text.HTML2Text()
class MarkdownTranslator(Translator):
depth = Depth()
enumerated_count = {}
table_entries = []
table_rows = []
tables ... |
# Copyright 2021 The TEMPO Collaboration
#
# 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... |
import importlib
import logging
import os
from pathlib import Path
import sys
from django.conf import settings
from django.core.exceptions import PermissionDenied, ValidationError
from django.db import models, transaction
from django.db.utils import Error as DBError
from .settings import get_setting
logger = loggin... |
#--------------------------------
# Name: fishnet_generator.py
# Purpose: GSFLOW fishnet generator
# Notes: ArcGIS 10.2 Version
# Python: 2.7
#--------------------------------
import argparse
import ConfigParser
import datetime as dt
from decimal import Decimal
import logging
impo... |
# Copyright (c) 2014 Cisco Systems, 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
#
# Unless r... |
from tkinter import *
from tkinter import messagebox
import pymysql
#--------Title of the widget and root object creation--------------------#
root=Tk()
root.geometry("1600x700")
root.title("Covid-19 Pandemic Tracker")
#---------Frames of the widget which are Main,Sub1 and Sub2---------#
Main = Frame(root... |
# Copyright Amazon.com Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompany... |
# import the necessary packages
from multiprocessing import Process
from multiprocessing import Queue
import os
import time
import logging
import json
import db
from classifier_yolo import Detection
from flask import Flask, render_template, Response, request, redirect, jsonify, send_from_directory
from flask_cors im... |
# Copyright 2020 University of Groningen
#
# 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 i... |
# Copyright 2017,2018,2019,2020,2021 Sony 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... |
import ffmpeg
import json
import math
import numpy as np
import os
import subprocess
from threading import Event, Thread
from queue import Full as QueueFull, Queue
from terran.io.video import DEFAULT_READER_BUFFER_SIZE, EndOfVideo, VideoClosed
def youtube_dl_available():
"""Check if `youtube-dl` is available in... |
import os
import re
import sys
import time
import json
import math
import random
import pickle
import logging
import argparse
import subprocess
from collections import defaultdict
import lxml.html as html
import lxml.html.clean as html_clean
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
parser = argparse.Ar... |
import ctypes
import graphsurgeon as gs
import numpy as np
import os
import subprocess
import tensorrt as trt
import uff
TRT_INPUT_NAME = 'input'
TRT_OUTPUT_NAME = 'nms'
FROZEN_GRAPH_NAME = 'frozen_inference_graph.pb'
LABEL_IDX = 1
CONFIDENCE_IDX = 2
X0_IDX = 3
Y0_IDX = 4
X1_IDX = 5
Y1_IDX = 6
def parse_boxes(output... |
from models_project.models import History
def history_handler(list_of_args):
if len(list_of_args) > 0:
return '=>Command history do not take any arguments'
else:
h_list = History.objects.all()
h_str = ''
for i in range(len(h_list)-1):
h_str += str(h_list[i])+'\n'
... |
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
__author__ = '<NAME>'
import bisect
from copy import copy
from math import floor
from numpy import log2, float64
from .computations import *
from .utils import *
def ApproxMaxMI(D, x, y, k_hat):
assert x > 1 and y > 1 and k_hat > 1
Q = EquipartitionYAxis(s... |
# Copyright 2019 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
import os
import random
import numpy as np
import pandas as pd
from cloud_ranger.get_link_matrix import build_graph_pc
from util_funcs.draw_graph import draw_weighted_graph
from util_funcs.evaluation_function import prCal, my_acc, print_prk_acc
from util_funcs.excel_utils import readExl, saveToExcel
from ... |
#!/usr/bin/env python3
# Copyright (c) 2021 Johns Hopkins University (<NAME>)
# Apache 2.0
import argparse
import os
import re
import subprocess
import sys
from contextlib import contextmanager
from pathlib import Path
import torch
from asr_datamodule import get_context_suffix
from lhotse import (
CutSet,
... |
#!/usr/bin/env python
"""
Converts an event price (tax-included) to a retail price (pre-tax)
or vice versa.
Event prices are calculated by applying a discount to the online
price, adding sales tax, and rounding to the nearest dollar.
Retail prices are calculated by removing sales tax, inverting the
discount, roundin... |
import logging
import os
import numpy as np
import offsetbasedgraph as obg
from pyvg.conversion import vg_json_file_to_interval_collection
from . import Configuration, CallPeaks
from .multiplegraphscallpeaks import MultipleGraphsCallpeaks
from .util import create_linear_map
from .peakfasta import PeakFasta
from .repo... |
#!/usr/bin/python
#author : <NAME>
#Date : 02/26/2016
#comment : This module runs a DTN monitoring server to receive system records from the client
# and write to the output in result directory
import TransferMon, time, socket, threading, os, signal, sys, datetime
from nmon_analyser import System_Data
from FlowMon imp... |
# Pure Python AES encryption routines.
#
# AES is integer based and inplace so doesn't use the heap. It is therefore
# a good test of raw performance and correctness of the VM/runtime.
#
# The AES code comes first (code originates from a C version authored by D.P.George)
# and then the test harness at the bottom.
#
# ... |
from __future__ import absolute_import
# TODO(dcramer): this heavily inspired by pytest-selenium, and it's possible
# we could simply inherit from the plugin at this point
import logging
import os
import pytest
from datetime import datetime
from django.conf import settings
from selenium import webdriver
from seleniu... |
# Copyright (c) 2018 MetPy Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
"""Test the `geometry` module."""
from __future__ import division
import logging
import numpy as np
from numpy.testing import assert_almost_equal, assert_array_almost_equal, asser... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 OpenStack 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required... |
from math import floor
import numpy as np
from joblib import Parallel, delayed
from fh.flyhash import FlyHash
from utils.parproc import split_for_parallelism
import logging
logger = logging.getLogger('FBFC')
class FHBloomFilter:
def __init__(self, **kwargs):
self.k = None
self.fh = FlyHash(**kwar... |
# This code is a reimplementation of the wrapper methods that are also present in
# https://github.com/ilastik/ilastik-feature-selection. The implementation here is a lot cleaner and supports multi-
# processing.
from copy import deepcopy
import numpy as np
from multiprocessing import Pool
def evaluate_set(args):
... |
# Copyright (c) 2020, Xilinx
# 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 the above copyright notice, this
# list of conditions and the follow... |
"""User input parameter validation.
This module handles user input parameter validation
against a provided input model.
Note that the objects in this module do *not* mutate any
arguments. No type version happens here. It is up to another
layer to properly convert arguments to any required types.
Validation Errors
... |
import torch
from torch import nn
from torch.nn import functional as F
from torch.nn.parameter import Parameter
from torch.autograd import Variable
from .lvm import LVM
from .utils import load_embedding
from .crf import *
SLOT_PAD = 0
class Lstm(nn.Module):
def __init__(self, params, vocab):
super(Lstm,... |
import collections
import copy
import new
import warnings
from operator import itemgetter
class EnumConstructionException(Exception):
"""
Raised whenever there's an error in an Enum's declaration.
"""
pass
class EnumLookupError(Exception):
"""
Raised when an enum cannot be found by the spec... |
from pyMCDS_ECM import *
import numpy as np
# Script REQUIRES ffmpeg to make movei!!!!!!!
######## If using on remote system, uncomment this line below to load correct matplotlib backend ################
# matplotlib.use('Agg')
import matplotlib.pyplot as plt
from matplotlib.patches import Circle
import math, os, sy... |
# -*- coding: utf-8 -*-
"""
.. note::
The current implementation doesn't support merging or detaching a document
simultaneously observed by at least two entity manager.
"""
import hashlib
from imagination.loader import Loader
from passerine.db.exception import DuplicatedRelationalMapping
from passerine.db.met... |
# Copyright 2017 Open Source Robotics Foundation, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... |
__author__ = 'AlexH'
import sys
import numpy as np
import log
from sklearn.cluster import KMeans
from sklearn import metrics
from sklearn.cluster import AgglomerativeClustering
from sklearn.feature_extraction.text import TfidfTransformer
from sklearn.metrics import silhouette_samples, silhouette_score
import... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
from __future__ import annotations
from textwrap import indent
from lona.html.attribute_dict import AttributeDict, StyleDict
from lona.html.attribute_list import ClassList, IDList
from lona.html.node_event_list import NodeEventList
from lona.events import ChangeEventType, EventType
from lona.html.abstract_node import... |
#!/usr/bin/env python3
######################
# User configuration #
######################
username = ""
user_agent = "script:League of Legends flair generator:v1.1 (by /u/TheEnigmaBlade), run by /u/{}".format(username)
sprite_dir = "sprites/"
css_dir = "css/"
configs = [
{
"enabled": True,
"cdn_key": "champi... |
import os
import sys
sys.path.append(os.getcwd())
import torch
import argparse
from model.deeplab import *
from tqdm import tqdm
import json
from utils.metrics import Evaluator
from data import spacenet
from common import config
from torch.utils.data import DataLoader
import numpy as np
import cv2
def CORAL(Xs, Xt):
... |
import abc
import collections
import typing
import warnings
from typing import AbstractSet, Deque, Dict, Optional, Set, Tuple, cast
from ..utils.meta import roundrepr
if typing.TYPE_CHECKING:
from ..entity import Entity
from ..term import Term, TermSet, TermData
from ..relationship import Relationship, Re... |
import torch
import torchvision
from torch import nn
from torch.nn import functional as F
from torchvision import models
def conv3x3(in_: int, out: int) -> nn.Module:
return nn.Conv2d(in_, out, 3, padding=1)
class ConvRelu(nn.Module):
def __init__(self, in_: int, out: int) -> None:
super().__init__(... |
#!/usr/bin/env python3
# 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 to u... |
#!/usr/bin/env python
# Copyright 2017 F5 Networks Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.