text stringlengths 3.07k 22.1k |
|---|
## For Fine-Tuning on downstream task of Argument Classification
import copy
import numpy as np
from functools import partial
from copy import deepcopy
import pickle
import jax
import jax.numpy as jnp
import haiku as hk
from haiku.data_structures import to_immutable_dict, to_mutable_dict
import optax
from transformer... |
import re
from castile.ast import AST
class CastileSyntaxError(ValueError):
pass
class Parser(object):
"""Parse a Castile program into an AST.
The parser includes the scanner as part of it. (Delegating to an external
scanner is rather verbose ("self.scanner.expect(...)"; inheriting from a
Sca... |
"""SOHO Map subclass definitions"""
import numpy as np
from matplotlib import colors
import astropy.units as u
from astropy.coordinates import CartesianRepresentation, SkyCoord, HeliocentricMeanEcliptic
from astropy.visualization import PowerStretch
from astropy.visualization.mpl_normalize import ImageNormalize
from... |
#!/usr/bin/env python3
# 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
# "... |
"""
This is a Python Web Service using Flask that returns results for AI/ML Web Services
using TensorFlow, Keras, and scikit-learn. Both TensorFlow and Keras uses a lot of
CPU so these services are installed on another server to avoid using to many resources
on the main server.
Server Setup Docs:
Website\docs\Pyth... |
import time
import logging
import platform
import requests
from .leakybucket import LeakyBucket
from .__version__ import __version__
class TokenExpireException(Exception):
pass
class NoResultsException(Exception):
pass
# pylint: disable=too-many-instance-attributes,too-few-public-methods
class Torrent(o... |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program 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 (at your option) any later version.
#
# This program is distrib... |
import logging
import os
import shutil
import stat
import subprocess
from concurrent.futures.thread import ThreadPoolExecutor
from datetime import timedelta
from io import StringIO
from pathlib import Path
from unittest.mock import Mock, ANY
import click
import pytest
from kong.util import (
strip_colors,
lju... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Dec 16 10:44:39 2020
@author: <NAME>
"""
#imbreports.py
from collections import defaultdict
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
"""Genera una tabla LaTeX a partir de un diccionario con informes."""
def reports_to_tex... |
# Copyright (c) IBM Corp. 2018. All Rights Reserved.
# Project name: Constrained Exploration and Recovery from Experience Shaping
# This project is licensed under the MIT License, see LICENSE
from baselines import logger
import baselines.common.tf_util as U
import numpy as np
from ceres.baselines.common import mpi_sel... |
import os
import shutil
import unittest
import random
from unittest import mock
import yaml
from server.test import FIXTURES_ROOT
def mockenv(**envvars):
return mock.patch.dict(os.environ, envvars)
class ConfigTests(unittest.TestCase):
tmp_fixtures_directory = os.path.join(FIXTURES_ROOT, "tmp_dir")
@c... |
import argparse
import tensorflow as tf
import json
import numpy as np
import os
import sys
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.append(BASE_DIR)
sys.path.append(os.path.dirname(BASE_DIR))
import provider
import part_seg.pointnet_part_seg as model
parser = argparse.ArgumentParser()
parser.ad... |
"""
Utilities for manipulating sublattice models.
"""
import itertools
import numpy as np
def tuplify(x):
"""Convert a list to a tuple, or wrap an object in a tuple if it's not a list or tuple."""
if isinstance(x, list) or isinstance(x, tuple):
return tuple(x)
else:
return tuple([x])
d... |
import asyncio
from discord.ext import commands
import discord
from .utils.paginator import Pages
from lxml import etree
import random
import logging
from urllib.parse import quote as uriquote
from lru import LRU
import yarl
import io
import re
import unicodedata
log = logging.getLogger(__name__)
class UrbanDictionar... |
# -*- coding: utf-8 -*-
"""This implements a psuedo-TTY that tees its output into a Python buffer.
This file was forked from a version distibuted under an MIT license and
Copyright (c) 2011 <NAME>.
See http://sqizit.bartletts.id.au/2011/02/14/pseudo-terminals-in-python/ for
more information.
"""
import io
import re
im... |
from __future__ import annotations
import json
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from telegram.Chat import Chat
from utils import database as db
from telegram import telegram as tg
from codeforces import codeforces as cf
from utils import util
from utils.util import logger
from commands import bot, se... |
import tensorflow as tf
import os
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"] = "0"
config = tf.ConfigProto()
config.gpu_options.allow_growth = True
sess = tf.Session(config=config)
import math
import json
import sys
import keras
from keras.layers import Input, Dense, Conv2D, Ma... |
""" Embeddings module """
import six
import math
import warnings
import torch
import torch.nn as nn
from onmt.modules.util_class import Elementwise
from onmt.utils.logging import logger
class SequenceTooLongError(Exception):
pass
class PositionalEncoding(nn.Module):
"""Sinusoidal positional encoding for n... |
import io
import os
import pathlib
import random
import av
import librosa
import torchaudio
from torch.utils.data import Dataset as TorchDataset, ConcatDataset, DistributedSampler, WeightedRandomSampler
import torch
from ba3l.ingredients.datasets import Dataset
from sacred.config import DynamicIngredient, CMD
from sc... |
"""Various regularizers that can be re-used for multiple attacks."""
import torch
from .deepinversion import DeepInversionFeatureHook
class _LinearFeatureHook:
"""Hook to retrieve input to given module."""
def __init__(self, module):
self.features = None
self.hook = module.register_forward_... |
# Import libraries
import sys
import re
import pickle
import pandas as pd
import numpy as np
from sqlalchemy import create_engine
from sklearn.model_selection import train_test_split, GridSearchCV, KFold
from nltk.tokenize import word_tokenize
from nltk.stem.wordnet import WordNetLemmatizer
from nltk.stem import Porter... |
"""
Training script 4 Detection
"""
from dataloaders.mscoco import CocoDetection, CocoDataLoader
from dataloaders.visual_genome import VGDataLoader, VG
from lib.object_detector import ObjectDetector
import numpy as np
from torch import optim
import torch
import pandas as pd
import time
import os
from config import Mode... |
# -*- coding: utf-8 -*-
# @Time : 6/23/21 5:38 PM
# @Author : <NAME>
# @Affiliation : Massachusetts Institute of Technology
# @Email : <EMAIL>
# @File : ensemble.py
# get the ensemble result
import os, sys, argparse
parentdir = str(os.path.abspath(os.path.join(__file__ ,"../../..")))+'/src'
sys.path.append(... |
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Dec 27 02:12:36 2018
@author: xavier.qiu
https://www.kaggle.com/christofhenkel/how-to-preprocessing-when-using-embeddings
"""
import re
from keras.preprocessing.text import Tokenizer
from keras.preprocessing.sequence import pad_sequences
def getWordI... |
import subprocess
import json
import itertools
import time
import re
import os
from pprint import pprint
from gollyx_python.manager import GOL
HERE = os.path.dirname(os.path.abspath(__file__))
def lists_equal(a, b):
if len(a) != len(b):
return False
sa = sorted(a)
sb = sorted(b)
for ia, ib i... |
#!/usr/bin/python
# Copyright 2012 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 applic... |
#!/usr/bin/env python3
# Copyright 2014 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.
"""Tool to manage building of system libraries... |
"""
Support for the IKEA Tradfri platform.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/light.tradfri/
"""
import asyncio
import logging
from homeassistant.core import callback
from homeassistant.components.light import (
ATTR_BRIGHTNESS, ATTR_COL... |
# coding=utf-8
# Copyright 2020 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... |
import sys
import argparse
import time
import shutil
from .config import app_config
from .lib.logger import logger
from .lib.aws import is_asg_scaled, is_asg_healthy, instance_terminated, get_asg_tag, modify_aws_autoscaling, \
count_all_cluster_instances, save_asg_tags, get_asgs, scale_asg, plan_asgs, terminate_ins... |
# encoding: utf-8
# Sample-based Monte Carlo Denoising using a Kernel-Splatting Network
# <NAME> <NAME>
# Siggraph 2019
#
# Copyright (c) 2019 <NAME>
#
# 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 Lice... |
"""
Compute
Inception Score (IS),
Frechet Inception Discrepency (FID), ref "https://github.com/mseitzer/pytorch-fid/blob/master/fid_score.py"
Maximum Mean Discrepancy (MMD)
for a set of fake images
use numpy array
Xr: high-level features for real images; nr by d array
Yr: labels for real images
Xg: high-level features... |
import yaml
from tunetools import db_utils
import numpy as np
import pandas as pd
from scipy import stats
import json
def _singleton_dict_to_tuple(singleton_dict):
return list(singleton_dict.items())[0]
def _check_param(param, total_param, mark_param: set):
if param is None:
return []
new_param... |
"""Affine transformation matrices
The 3x3 augmented affine transformation matrix for transformations in two
dimensions is illustrated below.
| x' | | a b c | | x |
| y' | = | d e f | | y |
| 1 | | 0 0 1 | | 1 |
The Affine package is derived from Casey Duncan's Planar package. See the
copyright state... |
# Submit job to the remote cluster
import yaml
import sys
import time
import random
import os, subprocess
import pickle, datetime
from math import floor
from functools import reduce
def load_yaml_conf(yaml_file):
with open(yaml_file) as fin:
data = yaml.load(fin, Loader=yaml.FullLoader)
return data
d... |
# Python functions for drawing
import mcpi.minecraft as minecraft
import mcpi.block as block
import time
import minecraftstuff as minecraftstuff
import numpy as np
# Circles and Spheres
# requires mc and mcdrawing to be defined as follows
# TODO: pass in mc and make drawings a class that is initialized with mc created... |
from __future__ import annotations
import logging
import os
import uuid
import pytest
from dask.sizeof import sizeof
from distributed.compatibility import WINDOWS
from distributed.protocol import serialize_bytelist
from distributed.spill import SpillBuffer, has_zict_210, has_zict_220
from distributed.utils_test imp... |
# Copyright 2012 OpenStack Foundation
#
# 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... |
import os
import re
import subprocess
import sys
import threading
HTTP_EXPORT = 'export'
HTTP_IMPORT = 'import'
class ExaSQLThread(threading.Thread):
"""
Thread class which re-throws any Exception to parent thread
"""
def __init__(self, connection, compression):
self.connection = connection
... |
# Copyright 2018 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... |
def _GetPath(ctx, path):
if ctx.label.workspace_root:
return ctx.label.workspace_root + '/' + path
else:
return path
def _IsNewExternal(ctx):
# Bazel 0.4.4 and older have genfiles paths that look like:
# bazel-out/local-fastbuild/genfiles/external/repo/foo
# After the exec root rearrangement, they ... |
import abc
import numpy as np
import jax
import jax.numpy as jnp
import optax
import chex
from .data import Trajectory, LearnerState, LogsDict, Transition
import tree
from typing import Mapping, Tuple
from acme import types, specs
import haiku as hk
from .networks import PolicyNetworkDDPG, ValueNetworkDDPG
# A very... |
#!/usr/bin/env python
"""
Skyline 2D Bin Algorithm
<NAME>
<EMAIL>
"""
from typing import List, NamedTuple, Tuple
from sortedcontainers import SortedList
from . import guillotine
from .item import Item
SkylineSegment = NamedTuple('SkylineSegment', [('x', int),
('y', int... |
from utils.angle_utils import normalize_angle_pi_minus_pi
from utils.ctrv_motion_model import calculate_odometry_from_controls, calculate_jacobian_from_controls
from utils.measurement_model import add_measurement_to_pose
import numpy as np
import math
def initialize_xi_omega():
# Initial state is extremely reli... |
# coding=utf-8
# Copyright 2020 The Trax 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 a... |
# MODULE: TypeRig / Core / Delta (Objects)
# -----------------------------------------------------------
# (C) <NAME>, 2018-2021 (http://www.kateliev.com)
# (C) Karandash Type Foundry (http://www.karandash.eu)
#------------------------------------------------------------
# www.typerig.com
# No warranties. By using ... |
#!/usr/bin/env python3
import sys
import xml.etree.ElementTree as ET
from collections import OrderedDict
import re
from kbdrefs import nf_z71_300 as nf
from kbdrefs import iso_cei_9995_11 as iso9995_11
from kbdrefs import iso_cei_9995_1 as iso9995_1
# The keylayout file format is described in Apple Technical Note TN... |
# Copyright 2016, 2018-2019, Optimizely
# 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 writ... |
''' Absurdle challenge mode bot
(https://qntm.org/files/absurdle/absurdle.html)
'''
import time
import random
import keyboard
import pyautogui
from PIL import Image
import pytesseract
pytesseract.pytesseract.tesseract_cmd = "C:\\install\\tesseract\\tesseract.exe"
import wordle
import wordle_tree
import ... |
#!/usr/bin/env python2
'''
Tests for the completer
You can see the real life behaviour on the CLI like this:
3 ~/GitHub/b2p $ cat test.sh
rl_tab_compgen () {
echo "$COMP_WORDBREAKS" >> /tmp/wb
cur=${COMP_WORDS[$COMP_CWORD]}
cmd=( ${COMP_WORDS[@]} )
last="$3"
pos="$COMP_POINT"
COMPREPLY=(... |
import os
import shutil
import time
import yaml
import copy
import numpy as np
from argparse import *
from contextlib import ContextDecorator
from torch.nn import init
import torch
from torch.utils.tensorboard import SummaryWriter
from scipy import ndimage
from torch.nn import functional as F
from .utility import *
fr... |
# Copyright 2012 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... |
# stdlib
import time
import ddtrace
from json import loads
import socket
# project
from .encoding import get_encoder, JSONEncoder
from .compat import httplib, PYTHON_VERSION, PYTHON_INTERPRETER, get_connection_response
from .internal.logger import get_logger
from .internal.runtime import container
from .payload import... |
from distutils.ccompiler import CCompiler, new_compiler
from distutils.command.build_ext import build_ext
from distutils.sysconfig import customize_compiler
from distutils import log
import numpy.distutils.misc_util as np_misc
import functools
import os
import subprocess
import sys
from tempfile import mkdtemp
from p... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Simple Javascript engines' wrapper
Description:
This library wraps the system's built-in Javascript interpreter to python.
It also support PyChakra.
Platform:
macOS: Use JavascriptCore
Linux: Use gjs on Gnome, cjs on Ci... |
# 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 accompan... |
##################################################
# Copyright (c) <NAME> [GitHub D-X-Y], 2019 #
##################################################
import math, random, torch
import warnings
import torch.nn as nn
import torch.nn.functional as F
from copy import deepcopy
from ..cell_operations import OPS
# This module... |
import logging
import numpy as np
from ..models.base import ModellingError
from ..models.discontinuous import Factory as DFactory
from .base import AnalysisBase
class EventDetectionError(ModellingError): pass
critical_values = {
0.00001: 25.0, #not real
0.0001: 10.0, #???
0.001: 4.5,
0.005: 4.... |
# coding: utf-8
# Author: 阿财(<EMAIL>)(<EMAIL>)
# Created date: 2020-02-27
#
# The MIT License (MIT)
#
# Copyright (c) 2016-2018 yutiansut/QUANTAXIS
#
# 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 So... |
"""Provides a QtPluginSorter that allows the user to change plugin call order.
"""
from __future__ import annotations
import re
from typing import TYPE_CHECKING, List, Optional, Union
from napari_plugin_engine import HookCaller, HookImplementation
from qtpy.QtCore import QEvent, Qt, Signal, Slot
from qtpy.QtWidgets i... |
# coding=utf-8
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
#
# 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/lice... |
import numpy as np
class Ranking(object):
def __init__(self, topic_id, gains, costs, max_gain=1.0, min_gain=0.0, max_cost=1.0, min_cost=1.0, max_n=1000):
"""
The ranking object encapsulates the data about the items in the ranked list.
The gains and costs vectors should only be acc... |
import argparse
import json
import logging
import os
import sagemaker_containers
import sys
import torch
import torch.distributed as dist
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import torch.utils.data
import torch.utils.data.distributed
from torchvision import datasets, transf... |
"""
Deep Molecule Generator
author: <NAME>
date 03/11/2021
"""
import os
import json
import math
import pdb
import time
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
import matplotlib.pyplot as plt
from torch.utils.data import DataLoader
from torch.autograd import Variable
f... |
# Copyright (c) 2013 OpenStack Foundation.
#
# 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... |
# from __future__ import absolute_import, unicode_literals
import contextlib
import os
import sys
import traceback
import logging
from celery import Celery
# set the default Django settings module for the 'celery' program.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'settings.config')
import django
django.setup()... |
'''Meta Noughts and Crosses core game. Requires Python 3.'''
import random
# Helper functions
ERRORS = {
1: "House rules: cannot start in middle",
11: "That cell is already taken.",
21: "Cannot send player to own grid.",
22: "Cannot send player to taken grid."
}
class MoveError(Exception):
__sl... |
#!/usr/bin/env python
# coding: utf-8
import datetime
import requests
import toml
import json
from urllib.parse import urlparse
import ssl
import socket
import urllib3
import re
import dns.resolver
import tldextract
from address_domain import address_domain
# Required, since we fetch from domains with invalid SSL cer... |
"""
File: safe_pendulum.py
Author: <NAME> modified code from
https://github.com/openai/gym/blob/master/gym/envs/classic_control/pendulum.py
Description: An update to the inverted pendulum environment that adds a safety constraint and a runtime assurance (RTA)
strategy to ensure it. The initial co... |
#! python3
"""
from: https://adventofcode.com/2021/day/4
--- Day 4: Giant Squid ---
You're already almost 1.5km (almost a mile) below the surface of the ocean, already so deep that
you can't see any sunlight. What you can see, however, is a giant squid that has attached itself to
the outside of your submarine.
Maybe ... |
# This code is built from the PyTorch examples repository: https://github.com/pytorch/vision/tree/master/torchvision/models.
# Copyright (c) 2017 Torch Contributors.
# The Pytorch examples are available under the BSD 3-Clause License.
#
# =================================================================================... |
# -*- coding: utf-8 -*-
"""
sphinx.cmd.build
~~~~~~~~~~~~~~~~
Build documentation from a provided source.
:copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from __future__ import print_function
import argparse
import locale
import multipr... |
import pytest
import os
import sys
import librosa
from configparser import ConfigParser
from helpers import MockingFunction, EPSILON, slow
from itertools import product
import random
from pprint import pprint
import gc
my_path = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, my_path + '/../')
import dj... |
import random
import string
import traceback
from tests.cephfs.cephfs_utilsV1 import FsUtils
from utility.log import Log
log = Log(__name__)
def run(ceph_cluster, **kw):
"""
Pre-requisites :
1. create fs volume create cephfs and cephfs-ec
Subvolume Group Operations :
1. ceph fs subvolumegroup c... |
"""
A script to collect a batch of human demonstrations that can be used
to generate a learning curriculum (see `demo_learning_curriculum.py`).
The demonstrations can be played back using the `playback_demonstrations_from_pkl.py`
script.
"""
import os
import shutil
import time
import argparse
import datetime
import h... |
"""Blend features extracted with Conv Nets and make predictions/submissions."""
from datetime import datetime
from glob import glob
import click
import numpy as np
import pandas as pd
import theano
from lasagne import init
from lasagne.updates import adam
from lasagne.nonlinearities import rectify
from la... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# SPDX-FileCopyrightText: 2018-2021 by <NAME> <<EMAIL>>
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
release = "1.2"
"""
Quick-Pandoc-Filter: include_exclude.py
(C)opyleft in 2018-2021 by <NAME> (<EMAIL>)
Release:
========
0.1 - 26.12.2018 (nm) - Erste V... |
'''
Deep-Q Reinforcement Learning for Flappy Bird
File: flappy.py
Author: <NAME>
Date: March 8, 2019
Modified Python clone of Flappy Bird game, altered
with a Deep-Q RL agent in mind. Serves as the TASK
for the AGENT to carry out in this project.
References:
FlapPy Bird
Author: <NAME>
github.com/s... |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
#
# Copyright 2021 The NiPreps Developers <<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 ... |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
import numpy as np
import scipy.linalg as spl
from ...externals.transforms3d.quaternions import mat2quat, quat2axangle
from .transform import Transform
from ..utils.affines import apply_affine
# Globals
R... |
from __future__ import annotations
from time import time
from typing import Union
import trakt
import trakt.movies
import trakt.sync
import trakt.users
from trakt import post
from trakt.errors import ForbiddenException, OAuthException
from trakt.movies import Movie
from trakt.sync import Scrobbler
from trakt.tv impor... |
import numpy as np
from .base import Homogeneous, HomogFamilyAlignment
from functools import reduce
class Affine(Homogeneous):
r"""
Base class for all ``n``-dimensional affine transformations. Provides
methods to break the transform down into its constituent
scale/rotation/translation, to view the ho... |
"""helper methods
"""
import pandas as pd
import numpy as np
from numpy import pi
from collections import OrderedDict
from pyscores2.output import OutputFile
from rolldecayestimators.ikeda import Ikeda, IkedaR
from pyscores2.runScores2 import Calculation
from pyscores2.indata import Indata
import rolldecayestimators
f... |
import sys
from collections import deque
class Process:
def __init__(self, program, input, output):
self._program = program.copy()
self._input = input
self._output = output
self._heap = {}
self._wait_input = False
self._halted = False
self._instruction_ptr = 0
self._relative_base = 0... |
import json
import base64
import time
import random
import string
import warnings
import hashlib
from . import oauth2
def decode_part(raw, encoding="utf-8"):
"""Decode a part of the JWT.
JWT is encoded by padding-less base64url,
based on `JWS specs <https://tools.ietf.org/html/rfc7515#appendix-C>`_.
... |
# -*- coding: utf-8 -*-
"""
Created on Sun Nov 10 15:57:42 2019
@author: mahal
"""
import numpy as np
import scipy.stats as ss
import heapq
class Cell:
def __init__(self, cell_coord, instantiated_motion, instantiated_iteration):
self.coord = cell_coord
self.coverage = 1
self.instantiated_... |
'''Segmentator app server'''
from functools import wraps
import io
import os
import re
import time
from urllib.parse import quote
from urllib.parse import urlparse
from base64 import b64encode
from flask import Flask
from flask import flash
from flask import request
from flask import redirect
from flask import render... |
# flake8: noqa: E501
"""
XGBoost-Ray with Dask
======================
This notebook includes an example workflow using
`XGBoost-Ray <https://docs.ray.io/en/latest/xgboost-ray.html>`_ and
`Dask <https://docs.dask.org/en/latest/>`_ for distributed model training,
hyperparameter optimization, and prediction.
"""
#######... |
import lemoncheesecake.api as lcc
import git
import os
import shutil, time, datetime
import logging
import requests
import subprocess
import helpers.base as base
from selenium import webdriver
from helpers import utilities
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.chrome.options i... |
#!/usr/bin/env python
# stdlib imports
import os.path
import argparse
from collections import OrderedDict
import sys
import warnings
import textwrap
import logging
# third party imports
import pandas as pd
# local imports
from gmprocess.io.read import _get_format, read_data
from gmprocess.utils.args import add_share... |
#! /usr/bin/env python
"""Creates an OData service from weather data"""
import io
import logging
import os
import os.path
import threading
import time
from wsgiref.simple_server import make_server
from pyslet import iso8601 as iso
from pyslet.http import client as http
from pyslet.odata2 import csdl as edm
from pysl... |
import json
import shutil
from IPython.core.display import display, HTML
def configure(n):
config = {
'version' : 'nxt',
'number' : n
}
with open('../task/robot_config.json', 'w') as f:
json.dump(config, f)
shutil.copyfile('./functions.py', '../task/functions.py')
print("\x... |
import collections.abc
import logging
import builtins
import subprocess
import feedparser
import networkx as nx
import requests
from conda.models.version import VersionOrder
from pkg_resources import parse_version
from .utils import parse_meta_yaml, setup_logger, executor, load_graph, \
dump_graph
logger = loggi... |
import util
from util import box2d
import math
import Sprite
import ContactListener
import WeaponLib
import os
import pygame
import random
"""
class Weapon(Sprite.Sprite):
w = None
h = None
damage = None
density = None
sprite = None
x_offset = None
y_offset = None
x = 0
y = 0
WE... |
import pickle
import unittest
import numpy as np
import hnswlib
def get_dist(metric, pt1, pt2):
if metric == 'l2':
return np.sum((pt1-pt2)**2)
elif metric == 'ip':
return 1. - np.sum(np.multiply(pt1, pt2))
elif metric == 'cosine':
return 1. - np.sum(np.multiply(pt1, pt2)) / (np.s... |
# coding=utf-8
# Copyright 2018 The Tensor2Tensor 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... |
import skimage
from skimage.color import rgb2gray
from skimage import data
import matplotlib.pyplot as plt
import matplotlib
matplotlib.rcParams['font.size'] = 18
import numpy as np
from skimage import io
import os
def kernel_creator(kernel_s,kernel_v=1, f_type=1):
kernel = np.ones(kernel_s*kernel_s).reshape(kerne... |
import sys
#sys.path.append("../")
from manager import workflow
import os
import pony.orm as pny
import datetime
import time
import yaml
import json
from base64 import b64decode
from Database import LocalDataStorage
from Database.workflow import Simulation, Incident
#from DataManager.client import registerDataWithDM, p... |
from __future__ import annotations
import time
from collections import defaultdict
from contextlib import contextmanager
from typing import TYPE_CHECKING
from typing import FrozenSet
from typing import Tuple
from typing import TypeVar
try:
from poetry.core.packages.dependency_group import MAIN_GROUP
except Impo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.