text stringlengths 3.07k 12.6k |
|---|
import streamlit as st
import plotly.express as px
def plot_single_feature(df, feature):
"""
This function will be used to plot a single feature.
Every feature's type will be first evaluated and then the
feature's distribution will be graphed accordingly.
Rules for single variable visualizations:... |
# Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
import math
import pytest
import torch
import pyro
from pyro.contrib.timeseries import (
DependentMaternGP,
GenericLGSSM,
GenericLGSSMWithGPNoiseModel,
IndependentMaternGP,
LinearlyCoupledMaternGP,
)
from pyro... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Dell EMC OpenManage Ansible Modules
# Version 3.5.0
# Copyright (C) 2018-2021 Dell Inc. or its subsidiaries. All Rights Reserved.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
#
from __future__ import (absolute_import, divi... |
from cmath import pi
from math import sqrt
from turtle import Screen
import pygame
import sys
import random
from pyparsing import Or
from scipy import rand
from soupsieve import match
from sqlalchemy import case, false
pygame.init()
SCREEN_WIDTH = 1400
SCREEN_HEIGHT = 800
COLOR_BLACK = (0, 0, 0)
COLOR_WHITE = (25... |
import turtle as t
import random as r
import math
import os
WIDTH = 600
HEIGHT = 600
NUMGOALS = 6
NUMALIENS = 4
class Sprite(t.Turtle):
def __init__(self, tshape, tcolor):
t.Turtle.__init__(self)
self.penup()
self.speed(0)
self.shape(tshape)
self.color(tcolor)
... |
#!/usr/bin/env python3
import monocle.sanitized as conf
from asyncio import gather, set_event_loop_policy, Task, wait_for, TimeoutError
try:
if conf.UVLOOP:
from uvloop import EventLoopPolicy
set_event_loop_policy(EventLoopPolicy())
except ImportError:
pass
from multiprocessing.managers impor... |
import snap
import numpy as np
import matplotlib.pyplot as plt
def load_graph(name):
'''
Helper function to load graphs.
Use "epinions" for Epinions graph and "email" for Email graph.
Check that the respective .txt files are in the same folder as this script;
if not, change the paths below as requi... |
import struct
import re
import functools
@functools.total_ordering
class StringPiece:
npos = -1
def __init__(self, value=None, size=None, offset=None):
self.set(value)
if offset is not None:
self.remove_prefix(offset)
if size is not None:
self.remove_suffix(self.size() - size)
def data(... |
"""Reconstructs a football season fixture by fixture, outputting the table as it stood for every event.
Uses the football data API to provide raw match data.
Documentation here: http://www.xmlsoccer.com/FootballData.asmx
Key values:
EPL:
UEFA Champions League:
FA Cup:
FA Community Shield:
Get competitions: http://a... |
import logging
import numpy as np
import theano
import pymc3 as pm
from bambi.priors import Prior
import bambi.version as version
from .base import BackEnd
_log = logging.getLogger("bambi")
class PyMC3BackEnd(BackEnd):
"""PyMC3 model-fitting backend."""
# Available link functions
links = {
"id... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2018 <NAME> <<EMAIL>>
#
# Distributed under terms of the MIT license.
"""Utilities for handling the trimer molecule."""
import logging
from itertools import product
from pathlib import Path
from typing import List, NamedTuple, Optional
i... |
###
### Copyright (C) 2018-2019 Intel Corporation
###
### SPDX-License-Identifier: BSD-3-Clause
###
from datetime import datetime as dt
import functools
import os
import slash
import subprocess
import threading
import time
def sorted_by_resolution(cases):
size = lambda kv: kv[1]["width"] * kv[1]["height"]
return ... |
import sys
import os
sys.path.append("../")
from shared import intcode
SCAFFOLD = 35
ROBOT_UP = 94
ROBOT_RIGHT = 62
ROBOT_LEFT = 60
ROBOT_DOWN = 118
SPACE = 46
NEWLINE = 10
def get_image(outputs):
x, y = 0, 0
image = dict()
for v in outputs:
image[(x, y)] = v
x += 1
if v == NEWLI... |
"""
This module is aimed at signal analysis and beamforming of data (.wav format) from microphones in a ULA configuration.
This package contains the following functions :
find_extrema(wavform_data, maxima_or_minima) :
Finds the values of the maximas or the minimas (and their index locations) of a given si... |
import json
from urllib import response
import pandas as pd
from league import League
from team import Team
import requests
import time
import config
from env import api_key
class DataLoadException(Exception):
pass
class DataLoad():
endpoint_url = "https://api-football-v1.p.rapidapi.com/v3/"
headers = {
... |
from time import sleep
import requests
import re
import subprocess
import threading
import sys
import os
K_CURRENT_PATH = os.path.dirname(os.path.abspath(__file__))
K_MAIN_M3U8 = "Main.m3u8"
K_SUB_M3U8 = "Sub.m3u8"
K_CHANNEL_NAME = "ultra-games"
_g_IsUsingMainM3u8 = True
_g_split_mark = "#EXTM3U"
def runFuncAsyncT... |
from __future__ import division
"""
This is an example of how to render pygame fonts with rabbyt.
It's far from optimal, but it works. However, I recommend using pyglet for
font rendering.
"""
__credits__ = (
"""
Copyright (C) 2007 <NAME>
Permission is hereby granted, free of charge, to any person obtaining a cop... |
# Getting mu and sigma of activation features of GCNN classifier for the FID score
import torch
import torch.nn.functional as F
import torch_geometric.transforms as T
from torch_geometric.utils import normalized_cut
from torch_geometric.nn import (graclus, max_pool, global_mean_pool)
from torch_geometric.nn import G... |
r"""$W\to\ell\nu$ decays."""
import flavio
from flavio.physics.zdecays import smeftew
from math import sqrt, pi
def gWl_SM(f1, f2, par):
if f1 == f2:
return 1 / 2 # using neutrino flavour eigenstates
else:
return 0
def gWq_SM(f1, f2, par):
i = smeftew._sectors['u'][f1]
j = smeftew... |
from typing import (
Union,
List,
Dict,
Mapping,
Set,
Tuple,
Optional,
Collection,
NamedTuple,
Any,
Iterable,
)
import enum
from abc import ABC, abstractmethod
from contextlib import AbstractContextManager
URI = str
Literal = str
Node = Union[URI, Literal]
class Asset(Abst... |
import argparse
import build_project_distro
import os
import re
import sys
import tempfile
import utils
def download_distro(project_name):
src_path = utils.get_meta_data(build_project_distro.ARCHIVE_META_DATA_KEY)
dest_dir = tempfile.mkdtemp()
# Buildkite wants a trailing slash
if not dest_dir.endswi... |
# MIT License
# Copyright (c) 2022 <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, merge, publis... |
# Copyright 2018 DeepMind Technologies Limited. 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 ... |
"""
The roseguarden project
Copyright (C) 2018-2020 <NAME>,
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 3 of the License, or (at your option) any later
version.
This program is ... |
import sys
import csv
import argparse
import logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
def main ():
options = _set_options()
data,headers = _read_map_file(options.map)
html = _print_html(data,headers,options.out)
index_file = options.out + '/index.html'
... |
#!/usr/bin/env python3
'''
filterProtein.py -- filter protein(.fa|.fa.gz) file by length, and whether the start amino acid "M" exists.
Author:
<EMAIL>
Bugs:
Any bugs should be reported to the above E-mail.
'''
import os
import sys
import gzip
import argparse
def parse_args():
'''Parse command-line argume... |
from torch import nn
import torch
# import torch_scatter
import torch.autograd.profiler as profiler
from .. import util
# Resnet Blocks
class ResnetBlockFC(nn.Module):
"""
Fully connected ResNet Block class.
Taken from DVR code.
:param size_in (int): input dimension
:param size_out (int): output... |
"""Export to PDF via latex"""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
import subprocess
import os
import sys
from ipython_genutils.py3compat import which, cast_bytes_py2, getcwd
from traitlets import Integer, List, Bool, Instance, Unicode, default
from tes... |
import os
import sys
import abc
import glob
import json
import shutil
import datetime
import contextlib
import oommfc as oc
import ubermagtable as ut
import discretisedfield as df
import micromagneticmodel as mm
@contextlib.contextmanager
def _changedir(dirname):
"""Context manager for changing directory.
""... |
# BSD 3-Clause License
#
# Copyright (c) 2012, the Sentry Team, see AUTHORS for more details
# Copyright (c) 2019, Elasticsearch BV
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Red... |
from __future__ import print_function
import json
import logging
import os
from cgi import escape
from git_stacktrace import api
from six.moves.html_parser import HTMLParser
from six.moves.urllib_parse import parse_qs
from string import Template
log = logging.getLogger(__name__)
dir_path = os.path.dirname(os.path.re... |
import typing
import asyncio
from starlette import status
from fastapi import Path, APIRouter, Depends
from opentrons.hardware_control import ThreadManager, modules
from opentrons.hardware_control.modules import AbstractModule
from robot_server.errors import LegacyErrorResponse
from robot_server.service.dependencies ... |
from flask import Flask,request,make_response,jsonify
import uuid
import requests
import re, sys
import pyrebase
firebaseConfig = { FIREBASE_CONFIG }
ANSWER_NORM = {
"yes": "present",
"y": "present",
"yep":"present",
"yup": "present",
"definitely": "present",
"sure": "present",
"surely": "... |
import torch
import numpy as np
def soft_overlaps(bboxes1, bboxes2, is_aligned=False):
rows = bboxes1.size(0)
cols = bboxes2.size(0)
if is_aligned:
assert rows == cols
if rows * cols == 0:
return bboxes1.new(rows, 1) if is_aligned else bboxes1.new(rows, cols)
if is_aligned:
... |
# -*- coding: utf-8 -*-
# Copyright (c) 2019 BuildGroup Data Services Inc.
import logging
from django.utils import timezone
from haystack import indexes
from caravaggio_rest_api.haystack.indexes import BaseSearchIndex
from davinci_crawling.example.bovespa import BOVESPA_CRAWLER
from .models import BovespaCompany, B... |
import numpy as np
from astropy.io import fits
from get_helio import GET_HELIO
from tell_model import TELL_MODEL
from ern_rv import ERN_RV
def DO_RVSHIFTS(rv0, hdr, shdr, rv_std=None, quiet=0):
"""
Get and apply heliocentric correction for both the object and standard.
Only applies if the standard spectrum... |
"""
Author: <NAME>, <NAME>
"""
__license__ = """
Copyright 2015 Parse.ly, 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 app... |
import os
import pickle
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence
import config
from utils import ConceptNetDict
class CNN(nn.Module):
'''
CNN module processes images. Output is fed into main ... |
import random
import math
import os
import time
import matplotlib.pyplot as plt
nodes = {
0: (82, 76),
1: (96, 44),
2: (50, 5),
3: (49, 8),
4: (13, 7),
5: (29, 89),
6: (58, 30),
7: (84, 39),
8: (14, 24),
9: (2, 39),
10: (3, 82),
11: (5, 10),
12: (98,... |
from flask import Blueprint, render_template, abort, request, redirect, session, Response
from flask.ext.login import current_user
from sqlalchemy import desc
from KerbalStuff.objects import Featured, BlogPost, Mod
from KerbalStuff.search import search_mods
from KerbalStuff.common import *
from KerbalStuff.config impor... |
import os
import pytest
from unittest.mock import Mock
from aiogtts.tts import aiogTTS, aiogTTSError
from aiogtts.langs import _main_langs
from aiogtts.lang import _extra_langs
# Testing all languages takes some time.
# Set TEST_LANGS envvar to choose languages to test.
# * 'main': Languages extracted from the Web
#... |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-strict
from __future__ import print_function
import base64
import json
import os
import re
from typing import Dict, List, Tuple
# ... |
import logging
import random
import re
from django.conf import settings
from django.core.mail import send_mail
from django_redis import get_redis_connection
from itsdangerous import TimedJSONWebSignatureSerializer, BadData
from rest_framework import status
from rest_framework.generics import CreateAPIView
from rest_fr... |
#!/usr/bin/python3
# This script will to help to manage rhdm components modules version, it will update all needed files
# Example of usage:
# # move the current version to the next one or rcX
# python3 scripts/update-version.py -v 7.15.1 --confirm
#
# # to only see the proposed changes (dry run):
# python3 scr... |
import torch
import torch.nn as nn
import numpy as np
from .ClassifierHelper import Classifier
from sklearn.metrics import hamming_loss
class ImageClassifier(Classifier):
""" Parent class for Image Classifiers handles input formatting and testing """
def __init__(self, cfg, loss_function):
super(Imag... |
"""
Methods to evaluate a single predictor whose parameters are passed as arguments to the script
The only parameter that changes is the number of point cloud, in order to assess how the predictor
in question scales in terms of time and performance (SGW or WS)
"""
import argparse
import pickle as pk
import time
from p... |
# -*- coding: utf-8 -*-
"""
Dictionary-based maximal matching word segmentation, constrained with
Thai Character Cluster (TCC) boundaries.
The code is based on the notebooks created by <NAME>,
with heuristic graph size limit added to avoid exponential wait time.
:See Also:
* \
https://colab.research.googl... |
import argparse
import os
from multiprocessing import Pool
from numpy.core.numeric import normalize_axis_tuple
import psutil
import datetime as dt
import numpy as np
from dateutil.parser import parse
import pyDOE
def run_in_parallel(num_simulations, num_parallel, config, log_folder, verbose,
book_... |
# Copyright (c) 2017 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 ... |
#import os
from __future__ import division
import configparser
import pexpect
#import subprocess as sp
import gc
import numpy as np
from scipy.interpolate import interp1d
from utils import safe_remove, create_dir
def compute_coeff(airfoil, reynolds=500000, mach=0, alpha=3, n_iter=200, tmp_dir='tmp'):
... |
import numpy as np
from sklearn import datasets
from sklearn.preprocessing import StandardScaler
from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.m... |
from abc import ABC, abstractmethod
from typing import List, Optional, Type
from sonic_pi_code_generator.lib.raw_ast import RawASTNode, VALUE_EMPTY
import sys
RAW_NODE_TYPE_PREFIX_FOR_SCALARS = 'scalar_'
RAW_NODE_TYPE_PREFIX_FOR_LISTS = 'list_'
class ASTNode(ABC):
@abstractmethod
def render_as_lines(self) ... |
import requests,json,re,csv,os,subprocess,urllib3,argparse,getpass,sys
from pprint import pprint
from os.path import expanduser
from clip_idlist import idlist
from clip_geojson import geojsonc
from cli_aoi2json import aoijson
from clip_json import jsonc
from clip_download import downloadclips
from cli_sorter import sor... |
import abc, math
from spatial import Matrix4, Vector3
class Projection(abc.ABC):
def __init__(self, near_clip, far_clip):
self.near_clip = near_clip
self.far_clip = far_clip
self.update()
@abc.abstractmethod
def __setattr__(self, attribute, value, allowed):
# Watch values in the `allowed` lis... |
"""
Cross-validation analysis of diffusion models
"""
from __future__ import division, print_function, absolute_import
from dipy.utils.six.moves import range
import numpy as np
import dipy.core.gradients as gt
def coeff_of_determination(data, model, axis=-1):
"""
Calculate the coefficient of determination fo... |
# In[]
import glob
import random
import pandas as pd
import shutil
import os
import MakeNeonYoloAppropriate
from shutil import copyfile
from PIL import Image, ImageDraw
from pathlib import Path
# In[]
Image.MAX_IMAGE_PIXELS = None
_UTM_UNITS = 1000
# In[]
def crop_satellite_refactored(imPath, dim_x1, dim_y1):... |
#!/usr/bin/env python3
#
# This file is:
# Copyright (C) 2018 <NAME> <<EMAIL>>
#
# MIT License
#
from .uikit_bindings import *
from . import gui
from . import utils
import ElectronCash.app
import time
class PythonAppDelegate(UIResponder):
firstRun = objc_property()
@objc_method
def init(sel... |
# Copyright 2016-2020 Blue Marble Analytics 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 ag... |
import os
import sys
import json
import datetime
import numpy as np
import skimage.draw
from PIL import Image ## added new
import argparse
# import cv2
import pandas as pd
ap = argparse.ArgumentParser()
ap.add_argument("-i", "--input_image_directory", required=True,
help="Input image directory name")
ap.add_argument(... |
#!usr/bin/python3
import unittest
from csvdiff3.headers import *
def headers_merge3(LCA, A, B):
headers = Headers(LCA, A, B)
return headers.header_map
class TestHeaders(unittest.TestCase):
def check_column(self, headers, name, column):
if column == None:
self.assertFalse(name in heade... |
import sqlite3
import argparse
import sys
from os import path
parser = argparse.ArgumentParser()
parser.add_argument('--sentences', '-s', help="Output sentences", action='store_true')
parser.add_argument('--sentence-number', '-sn', default='0', help="Output sentences by id-s [example: 1 or 1-3 or 1-3,7-9]. Default is ... |
import collections
import numpy as np
from ..physical_constants import constants
def to_string(molrec, dtype, units='Angstrom', atom_format=None, ghost_format=None, width=17, prec=12):
"""Format a string representation of QM molecule.
Parameters
----------
molrec : dict
Psi4 json Molecule s... |
from . import db
from .. import global_values
from bson.objectid import ObjectId
from collections import defaultdict
from datetime import datetime, timedelta
USER = global_values.User.USER.value
EMAIL = global_values.User.EMAIL.value
STRMS = global_values.User.STRMS.value
PAPER = global_values.Paper.PAPER.value
ABSTRA... |
import torch
from torch import nn as nn
from basicsr.utils.registry import ARCH_REGISTRY
from .arch_util import Upsample, make_layer
class ChannelAttention(nn.Module):
"""Channel attention used in RCAN.
Args:
num_feat (int): Channel number of intermediate features.
squeeze_factor (int): Chan... |
"""
file: augment.py
----------------
Increases the size of the dataset by performing data augmentation. The factor
by which the dataset increases is specified by the FACTOR variable.
This should take around 1 minute per additional factor for 853 images.
Reference:
https://www.kaggle.com/tomahim/image-manipulatio... |
from ..search import SearchLattice, SearchNet
from .common import ParsingException
weights_corr = {
'Product': 'product:',
'Order-Dependent': 'order-dependent:',
'POD': 'POD:',
'Projection-Dependent' :'projection-dependent:'
}
def update(string, form, s):
string += '0:'
for i in range(int(s.di... |
#!/usr/bin/env python
###############################################################################
# $Id$
#
# Project: GDAL/OGR Test Suite
# Purpose: Test read/write functionality for GIF driver.
# Author: <NAME> <<EMAIL>>
#
###############################################################################
# Copyr... |
from datetime import datetime
from bs4 import BeautifulSoup
from config import *
'''
https://www.crummy.com/software/BeautifulSoup/bs4/doc/
https://docs.python.org/3/library/random.html
'''
#import pdfkit
# Template of Worksheets (#1, #2) on either side of a section
section_template = '''<div id=section-{} class="co... |
import html
from telethon.tl.functions.photos import GetUserPhotosRequest
from telethon.tl.functions.users import GetFullUserRequest
from telethon.tl.types import MessageEntityMentionName
from telethon.utils import get_input_location
from . import *
@Andencento.on(andencento_cmd(pattern="getpic ?(.*)", outgoing=Tru... |
"""
A script to identify the most retweeted tweets from curated user lists
"""
import pandas as pd
import json
import config
"""
# Grab data from twitter and dump to text files.
"""
class GetData(object):
def __init__(self):
pass
def get_tweets(self, listname, listcollection):
for each_li... |
""" Misc utilities for the library
Authors: <NAME>, <NAME>, 2015
"""
import sys
import scipy.linalg as spl
import numpy as np
from scipy.stats import norm
from warnings import warn
import pandas as pd
py3 = sys.version_info[0] >= 3
def _check_list_length_match(list_1, list_2, var_name_1, var_name_2):
"""Check l... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2020 CERN.
#
# invenio-app-ils is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Test ILL borrowing requests."""
import json
from flask import url_for
from invenio_search import current_sear... |
import os
import math
import RTIMU
import rclpy
from rclpy.node import Node
from ament_index_python.packages import get_package_share_directory
from sensor_msgs.msg import Imu
from geometry_msgs.msg import Quaternion, Vector3
from ros2_rtimulib.imu_utils import get_altitude, G_TO_MPSS
from ros2_rtimulib import bet... |
from pytest import raises
from sme.util import (
change_waveunit, change_energyunit,
air_to_vacuum, vacuum_to_air, vacuum_angstroms)
def test_change_waveunit():
"""Test code paths and cases in util.change_waveunit().
Test conversion from/to Angstroms to/from all units listed in `cases`.
Test unit... |
"""
the overfitting value is the gap between the train loss L_i^T and
the groundtruth L_i^* w.r.t the hypothetical target distribution
Note: the L^* is approximated by the validation loss L^V
"""
import numpy as np
def compute_overfitting_o(eval_avg_loss, train_avg_loss):
""" We define overfitting at epoch N a... |
"""Utility functions for data input and output."""
import logging
import subprocess
import numpy as np
def data_in_label(intvl_in, dtype_in_time, dtype_in_vert=False):
"""Create string label specifying the input data of a calculation."""
intvl_lbl = intvl_in
time_lbl = dtype_in_time
lbl = '_'.join(['... |
# -*- coding: utf-8 -*-
"""
Created on Mon May 27 17:09:19 2019
@author: eledib
"""
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
import keras
from keras import backend as K
from keras.models import Sequential, Model
from keras.layers import Input, LSTM, RepeatVector, Add, Multiply
from ker... |
from bs4 import BeautifulSoup
import re
import requests
import datetime
import pandas as pd
from typing import Any, List
from dataclasses import dataclass
#from .._db import db as db
#import BTCInput2 as btc
#import ui
#pd.options.display.max_colwidth = 200
DEBUG_MODE = True
def read_text(prompt):
'''
Displa... |
import tensorflow as tf
from tensorflow.keras import backend as K
from tensorflow.keras.models import Model
from tensorflow.keras.layers import Dense, Activation, Dropout, MaxPooling2D
from tensorflow.keras.layers import Conv2D, AveragePooling2D
from tensorflow.keras.layers import BatchNormalization, Lambda
from tensor... |
import hashlib
import hmac
import json
import os
import re
import urllib.parse
from typing import Any, Dict
import requests
from requests.adapters import HTTPAdapter
from requests.packages.urllib3.util.retry import Retry
slack_signing_secret = bytes(os.environ["SLACK_SIGNING_SECRET"], "utf-8")
api_key = os.environ["I... |
# coding=utf-8
# Copyright 2013 Hewlett-Packard Development Company, L.P.
# 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/li... |
#!/usr/bin/env python3
#
# This file is distributed under the MIT License. See LICENSE for details.
#
import argparse
import re
import pprint
import subprocess
import json
from smackgen import *
from smackverify import *
VERSION = '2.8.0'
def reachParser():
parser = argparse.ArgumentParser(add_help=False, paren... |
import numpy as np
import torch
from PIL import Image
import argparse
from torch import nn
from torchvision import transforms
from torchray.utils import imsc
from tools.scripts.features.frcnn.modeling_frcnn import GeneralizedRCNN
from tools.scripts.features.frcnn.frcnn_utils import Config
from mmxai.utils.cache_ma... |
# from lib.core.mscgnet import *
# score 0.547, no TTA
import datetime
import logging
import os
import numpy as np
import torch
from PIL import Image
# from core.net import *
from core.net import get_model
from utils.data.augmentation import img_load
from utils.data.preprocess import IDS, GT, IMG
from utils import P... |
from collections import OrderedDict
import yaml
import copy
import networkx as nx
import importlib
from .node import Node
__all__ = ['run', 'save_workflow', 'load_workflow', 'viz_graph', 'build_workflow']
DEFAULT_MODULE = "gquant.plugin_nodes"
mod_lib = importlib.import_module(DEFAULT_MODULE)
__SETUP_YAML_ONCE = F... |
# This file is part of the MapProxy project.
# Copyright (C) 2011 Omniscale <http://omniscale.de>
#
# 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... |
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 29 21:16:10 2015
@author: JMcLarty
"""
import ctypes
import time
SendInput = ctypes.windll.user32.SendInput
VKs = {'\t' : (0x09,),
'0' : (0x30,),
'1' : (0x31,),
'2' : (0x32,),
'3' : (0x33,),
'4' : (0x34,),
'5' : (0x35,),
'6' : (0x36,),
'7' : (0x37,),
'8' : (0x38,),
'9'... |
# All views todo with votes + profiles.
from voting.models import Vote
from voting.views import vote_on_object
from voting.managers import possible_votes, votes
from django.utils.translation import ugettext_lazy as _
from django.contrib.auth.models import User
from django.contrib.auth.decorators import login_required
... |
import mock
import os
import pandas as pd
import pytest
from flexmock import flexmock
from sportsreference import utils
from sportsreference.nba.constants import SEASON_PAGE_URL
from sportsreference.nba.teams import Teams
MONTH = 1
YEAR = 2017
def read_file(filename):
filepath = os.path.join(os.path.dirname(__f... |
# call this script with `python -m evaluation.evaluate_poselines_globalaction`
import numpy as np
from numpy.core.fromnumeric import sort
import pandas as pd
import datetime
import torch
from torch.functional import norm
from tqdm import tqdm
from . import eval_utils
import cv2
from .compare_deepfeatures import negati... |
from collections.abc import Mapping
from xml.etree import ElementTree
import logging
log = logging.getLogger(__name__)
def xmlstr(node):
""" Helper function dumping the full XML representation of a node
"""
return ElementTree.tostring(node, encoding="unicode", method="xml")
def innerXML(node):
"""... |
import argparse
import datetime
import os
import subprocess
import numpy as np
from src.general.directory_handling import make_and_cd
class LaunchQsub(object):
def __init__(self, steps, lf=30, self_foreign=False, early_pos=False, toy_model=False, latpp_ext=False):
self.steps = steps
self.lf = lf... |
"""
##############################################################################
# PyramidNet: Deep Pyramidal Residual Networks
# https://arxiv.org/pdf/1610.02915v4.pdf
# PyramidNet(bottleneck, a=200| 26.0M| ----- | 3.31 +- 0.08 |
##############################################################################
"""... |
import collections
import os
import re
from os.path import dirname, abspath
from pathlib import Path
def parse_gitignore(full_path, base_dir=None):
if base_dir is None:
base_dir = dirname(full_path)
rules = []
with open(full_path) as ignore_file:
counter = 0
for line in ignore_file:
counter += 1
line =... |
"""Default template variables."""
import datetime
from pyramid.events import BeforeRender
# TODO: We expose this as a global for documentation. Migrate to non-global map in the future.
from pyramid.path import AssetResolver, DottedNameResolver
from websauna.utils.time import now
_template_variables = {}
def var(n... |
#!/usr/bin/env python3
from argparse import ArgumentParser, RawTextHelpFormatter
from os import remove
from os.path import exists, join
from subprocess import CalledProcessError, CompletedProcess, run
from sys import stderr
from typing import Tuple
class OptionsGetter:
"""Class to get options from command line.""... |
import logging
import os.path
import cv2
import hydra
from matplotlib.animation import ArtistAnimation
import matplotlib.pyplot as plt
import numpy as np
from omegaconf import DictConfig
from pytorch_lightning import seed_everything
from sklearn.manifold import TSNE
from tqdm import tqdm
"""This script will collect d... |
"""Utilities for calcualting and saving prediction error for GMM models.
"""
import numpy as np
import scipy as sp
import json_tricks
import json
import itertools
from copy import deepcopy
from . import regression_mixture_lib as rm_lib
def timepoint_to_int(orig_timepoints):
"""Convert the timepoints to integ... |
# Copyright (c) 2017-2018 Uber Technologies, 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 ... |
# -*- coding: utf-8 -*-
import random
import numpy as np
import time
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
from torch.autograd import Variable
import datetime
from dateutil import parser
import os
import csv
import matplotlib.pyplot as plt
import pandas as pd
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.