text stringlengths 3.07k 22.1k |
|---|
# -*- coding: utf-8 -*-
# usage:
# > python seoreporter/__init__.py [type] [format] [run_id]
# example:
# > python seoreporter/__init__.py build junit d09b8571-5c8a-42ff-8ab7-c38f4f8871c4
# todo
# output valid jUnit XML output
# output html files in a folder
# output html pages that show the data
# output json
impo... |
###################################################################################################
# MIT Licence (C) 2022 <EMAIL>path@Github #
###################################################################################################
"""Module for the ... |
import pandas as pd
from torch.utils.data import DataLoader
import os
import torch
from torchvision.transforms import ToTensor
import cv2
import numpy as np
import json
import segmentation_models_pytorch as smp
import albumentations as alb
import timm
from torch.utils.data._utils.collate import default_collate
from f... |
"""
Copyright 2021 Dynatrace 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, software
... |
from intcode import run
import sys
from functools import reduce
data = [int(n) for n in sys.stdin.read().strip().split(',')]
i = []
m = list(data)
o = []
# Test run once
p,r = run(i,m,o)
# Create a grid
os = ''.join([chr(i) for i in o]).strip()
"""
os = '''#######...#####
#.....#...#...#
#.....#...#...#
......#...#... |
# -*- coding:utf-8 -*-
import time
import tornado.web
import tornado.ioloop
import tornado.options
import tornado.httpserver
from tornado.web import url, RequestHandler, StaticFileHandler
import json
import config
import os
import torndb # 如果有问题安装 pip install mysqlclient 可解决MYSQLDB问题
from tornado.httpclient import Asy... |
# -*- coding: UTF-8 -*-
import os
import platform
import sys
import traceback
import warnings
import twisted
import generic_logging
from data.states import *
## TODO
# Come up with a actual name...
# Optimize test_mode.py:53-62 (Do we need to update these every frame?)
# Client doesn't quit after backing out.
# Is ... |
"""
Customized dataset. Extended from vanilla PANet script by Wang et al.
"""
import os
import random
import torch
import numpy as np
from dataloaders.common import ReloadPairedDataset, ValidationDataset
from dataloaders.ManualAnnoDatasetv2 import ManualAnnoDataset
def attrib_basic(_sample, class_id):
"""
Ad... |
# Magic 8 Ball
# This version is stripped down and ready to be uploaded to a Thumby
#
# MIT License
# Copyright (c) 2021 Raymond
#
# 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 rest... |
# Original work Copyright 2017 Palantir Technologies, Inc. (MIT)
# Original work Copyright 2020 Open Law Library. (Apache 2)
# See ThirdPartyNotices.txt in the project root for license information.
# All modifications Copyright (c) Robocorp Technologies Inc.
# All rights reserved.
#
# Licensed under the Apache License,... |
#!/usr/bin/env python3
import datetime
import glob
import os
import re
import logging
import subprocess
import threading
import time
import utils
import network
from prometheus_client.core import GaugeMetricFamily
logger = logging.getLogger(__name__)
HOST_FS = "/host-fs"
INFINIBAND_PATH = os.path.join(HOST_FS, "sy... |
import logging
import os
from datetime import datetime
import sys
from src.models import Source, So, Dbentity, Locusdbentity, Referencedbentity, Alleledbentity,\
AlleleReference, LocusAllele, LocusalleleReference, AlleleAlias, \
AllelealiasReference
from scripts.loading.dat... |
# Copyright 2020 Rubrik, Inc.
#
# 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, publish, distri... |
#!/usr/bin/env python
# vim: set sw=4 ts=4 softtabstop=4 expandtab:
import argparse
import concurrent.futures
import datetime
import logging
import os
import pprint
import psutil
import random
import signal
import subprocess
import sys
import time
import yaml
"""
Script to run a set of queries found in directory and
re... |
from flask import Flask, jsonify, request
from flask_restful import Resource, Api, reqparse
from flask_cors import CORS
import json
from dotenv import load_dotenv
from models.disputable_voting import DisputableVotingModel
from models.token_lockup import TokenLockupModel
from models.augmented_bonding_curve import Bondi... |
# Volatility
# Copyright (C) 2007-2013 Volatility Foundation
# Copyright (c) 2010, 2011, 2012 <NAME> <<EMAIL>>
#
# This file is part of Volatility.
#
# Volatility 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... |
# coding=utf-8
# Copyright 2020 The Google Research 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 applicab... |
import time,datetime,os,subprocess,sys,shutil,hashlib,grp,mmap,fnmatch,gzip,re,random
import distutils.dir_util
from glob import glob
from os.path import exists,join,split,splitext,abspath,basename,dirname,isdir,samefile,getsize
from shutil import copyfile,copytree,rmtree,ignore_patterns
from os import system,environ,m... |
from jax.lax import while_loop
from jax import custom_jvp
from optimism.JaxConfig import *
from optimism.material.MaterialModel import MaterialModel
from optimism.material import Hardening
from optimism import TensorMath
from optimism import ScalarRootFind
from jax.scipy.linalg import solve, expm
# props
PROPS_E ... |
import copy
import random
def read_coeffiecients_from_file(path):
"""
Reads a file with path given and returns a list of coefficients. First coefficient is considered to be the
coefficient of the largest number (?).
:param path: string, representing the path to the file
:return coefficients: a lis... |
""" Module for I/O in arclines
"""
from __future__ import (print_function, absolute_import, division, unicode_literals)
import numpy as np
import os
import datetime
import pdb
from astropy.table import Table, Column, vstack
from astropy.io import fits
from linetools import utils as ltu
import arclines # For path
fr... |
import glob
import re
from collections import defaultdict
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from matplotlib.axes import Axes
from matplotlib.lines import Line2D
matplotlib.style.use("bmh")
tab20 = matplotlib.cm.get_cmap("tab20")
poss = np.li... |
import re
import time
import urllib
import numpy as np
import requests
from bs4 import BeautifulSoup
from loguru import logger
from retrying import retry
from database import MongoDB
from url_formats import (buff_index_json_fmt, c5_csgo_search_page_fmt,
c5_dota_search_page_fmt, igxe_search_pa... |
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import random
import seaborn as sns
import imgkit
import re
import nltk
import spacy
import string
from textblob import TextBlob
from collections import Counter
from sklearn import tree
from sklearn import preprocessing
from sklearn.tree import Deci... |
from stylegan import StyledGenerator, Discriminator
import jittor as jt
from jittor import init
from jittor import nn
from jittor.dataset.dataset import Dataset
import jittor.transform as transform
import argparse
import numpy as np
import math, random, os
from tqdm import tqdm
import matplotlib.pyplot as plt
jt.flags.... |
"""
The MIT License (MIT)
Copyright (c) 2016 <NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publi... |
#!/usr/bin/env python
from __future__ import absolute_import, division, print_function
import argparse
import collections
import csv
import json
import math
import time
from collections import OrderedDict
from pathlib import Path
import requests
from PIL import Image, ImageDraw, ImageFilter, ImageFont
def parse_arg... |
from os.path import join, dirname
import torch
from torch import nn
from torchvision import datasets, transforms
from abs_models import utils as u
from abs_models import nets
from abs_models.inference import inference
from abs_models import sampling
DEFAULT_PATH = dirname(__file__)
class ELBOVAE(nn.Module):
def... |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import os
import os.path
import math
from PIL import Image, ImageDraw
import random
import numpy as np
import torch
import torchvision
import torch.utils.data as data
from maskrcnn_benchmark.structures.bounding_box import BoxList
f... |
# encoding: utf-8
"""
@desc:
"""
import argparse
from typing import Dict, Union
import pytorch_lightning as pl
import torch
from pytorch_lightning.callbacks import ModelCheckpoint, LearningRateMonitor
from torch.optim import AdamW
from torch.utils.data import DataLoader
from fast_knn_nmt.data import *
from fast... |
#written in python 3.x
from time import sleep
import re
# pip install telethon
from telethon.utils import get_display_name
from telethon import TelegramClient
from threading import Timer
### pip install python-telegram-bot
#from TDD import telegram_tdd
###pip install git+https://github.com/ericsomdahl/... |
# -*- coding: utf-8 -*-
"""
This code allows us to run classical clustering approaches namely Kmeans, Spherical Kmeans and Auto-encoder
"""
import numpy as np
import pandas as pd
from sklearn.utils import check_random_state
from coclust import clustering
from sklearn.cluster import KMeans
from sklearn.mix... |
import argparse
import logging
import os
import random
import sys
from tqdm import tqdm
import torch
import torch.nn as nn
import torch.nn.functional as functional
import torch.optim as optim
from torch.utils.data import DataLoader
from torchnet.meter import ConfusionMeter
from data_prep.yelp_dataset import get_yelp_... |
import tensorflow as tf
from utils.config import *
import pdb
from tensorflow.python.ops import embedding_ops
from models.GraphAttentionLayer import GraphAttentionLayer
import numpy as np
class KnowledgeGraph(tf.keras.Model):
def __init__(self, vocab, embedding_dim, hop, nhid, nheads, alpha, dropout, graph_layer_... |
"""
test pandabase against supported databases through fixtures:
sqlite: automatic - because SQLite is filesystem- or memory-based, sqlite does not require any setup
postgres: not automatic; execute these with pytest --run-postgres. postgresql requires:
postgres service to be running in background
a database ... |
# 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... |
# Stdlib imports
from abc import ABC
from abc import abstractmethod
from dataclasses import dataclass
from datetime import date
from enum import Enum
from pathlib import Path
from typing import Optional
from typing import Union
# Dependency imports
from dacite import from_dict
from dacite import Config
from pycountry ... |
#!/usr/bin/python3
import os, sys
import logging, argparse
import re
import networkx as nx
import matplotlib.pyplot as plt
import multiprocessing
from multiprocessing.managers import BaseManager
from queue import LifoQueue
from tqdm import tqdm
from nltk.tokenize import word_tokenize
from datasketch import MinHash
... |
# file to store properties of different restaurants
from pprint import pprint
prompts_dict = {"Name of the Establishment >> ": str,
# "Number of Seats at Largest Table >> ":int,
"Number of Stars in Rating >> ": int,
"Number of Dollars of Cost >> ": int,
... |
from typing import Dict, Optional, List
import numpy as np
import Box2D
from gym import spaces
from gym.utils import EzPickle
from gym.envs.box2d import bipedal_walker
from gym.envs.box2d import bipedal_walker as bpw
from Box2D.b2 import (edgeShape, fixtureDef, polygonShape)
from carl.envs.carl_env import CARLEnv
fro... |
import numpy as np
# import matplotlib.pyplot as plt
#import h5py
#import time
#h5fname_in ='/data/tomobank/tomo_00001/tomo_00001.h5'
import h5py
import time
import argparse
#import json
#import textwrap
ap = argparse.ArgumentParser( formatter_class=argparse.RawTextHelpFormatter)
# epilog='_'*60+'\n Note op... |
import os
import torch
import torch.nn as nn
from torch.utils import data
import torch.optim as optim
import torch.backends.cudnn as cudnn
import torch.nn.functional as F
from network import *
from dataset.zurich_pair_dataset import zurich_pair_DataSet
from dataset.cityscapes_dataset import cityscapesDataSet
from co... |
#!/usr/bin/env python3
# Weather Summary
import argparse
import datetime
import fnmatch
import os
import piexif
from libxmp.utils import file_to_dict
from lib import srtm
parser = argparse.ArgumentParser(description="Lookup a weather report for the location/time an image was captured.")
parser.add_argument("project... |
from model import Generator, Discriminator
from torch.autograd import Variable
from torchvision.utils import save_image
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
import os
import time
import datetime
from sys import exit
from vgg import VGG16FeatureExtractor
from loss import... |
import re
import collections
def token_with_escape(a, escape = '\\', separator = ',', quote='"'):
result = []
token = ''
state = 0#0 is normal, 1 is escaped, 2 is quoted, 3 is quoted and escaped
for c in a:
if state == 0:
if c == escape:
state = 1
elif c ... |
"""
this module represents a CSP backtracking algorithm which can solve binary puzzle,
binary puzzle consists of an n * n table where n is an even number and
the player must place the numbers zero or one in the empty cells so that:
\n
1- each row and each column must have an equal number of zeros and ones\n
2-... |
""" representation and processing of an ANSI stream into an 'ast' of sorts
such that it can be rendered
"""
from __future__ import annotations
from typing import Optional
from ansitoimg.utils import ansiColourToRGB, findLen
import os
class AnsiBlock():
""" represent a block of ANSI text. eg \033[31mhello!\033[0m
... |
# coding: utf-8
from __future__ import (
absolute_import, division, print_function, unicode_literals)
import os
import sys
import tempfile
import click
from .._pip_compat import Command, install_req_from_line, parse_requirements
from ..exceptions import PrequError
from ..logging import log
from ..repositories im... |
import os
import logging
import urlparse
import simplejson as json
import itertools
from os.path import join
from uuid import uuid4
from zipfile import ZipFile
from datetime import datetime
from lxml import etree
from shutil import rmtree
from django.utils.functional import cached_property
from .config import DATETI... |
import os
dir_path = os.path.dirname(os.path.abspath(__file__))
import random
import torch
from torch import nn
from torch.nn import functional as F
from torchvision import datasets, transforms
from . import copying, adding
from . import utils
from .tasks import BinaryClassification, MulticlassClassification, MSEReg... |
"""
batch_adjust.py
Batch adjustment methods for Prism data.
"""
import os
import sys
import glob
import argparse
import logging
import multiprocessing as mp
import numpy as np
import merino.normalization.combat as combat
import merino.setup_logger as setup_logger
import cmapPy.pandasGEXpress.parse as pe
import cma... |
"functions shared by digest related activities"
from pprint import pformat
import os
import traceback
import re
import requests
from docx.opc.exceptions import PackageNotFoundError
from digestparser import jats, build, conf
import provider.utils as utils
from provider.storage_provider import storage_context
from provid... |
import numpy as np
from skimage import data, color, io, img_as_float
import cv2
from skimage import measure
from plotly.offline import download_plotlyjs, init_notebook_mode, plot
from plotly.tools import FigureFactory as FF
from pydicom.data import get_testdata_files
import pydicom
import matplotlib.pyplot as plt
from ... |
import arrow
import defusedxml.lxml
import json
import libvirt
import logging
import lxml.etree
import os
import subprocess
import tarfile
from tqdm import tqdm
import virt_backup
from virt_backup.domains import get_xml_block_of_disk
from virt_backup.tools import (
copy_file_progress, get_progress_bar_tar
)
from .... |
# coding: utf-8
import sys
import numpy as np # linear algebra
subset = sys.argv[1]
crop_window_len = np.int(sys.argv[2])
# subset = 'train1'
# crop_window_len = 13
saving_mm_name = str(crop_window_len * 2 +1) + 'mm_POI'
import cv2
from skimage import segmentation
from sklearn.cluster import DBSCAN
import pandas a... |
import numpy as np
from sklearn.mixture import GaussianMixture
from scipy.spatial import distance
from numpy.linalg import inv
import utils
def gmm_global_threshold(features, label_dict):
runs_eer = []
runs_hter = []
for experiment_i in range(5):
train_set, development_set, test_set, train_d... |
# -*- coding: utf-8 -*-
"""
==============================================================================
MWNT structure class (:mod:`sknano.structures._mwnt`)
==============================================================================
.. currentmodule:: sknano.structures._mwnt
"""
from __future__ import absolute... |
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2020 Intel Corporation
""" EIS integration module """
import enum
import os
import sys
import json
import logging
import argparse
import shlex
import subprocess
import zmq
import zmq.auth
LOGGER_PATH = "/var/log/eis_integ.log"
LOGGER_LEVEL = logging.DEBUG
LOGGER ... |
from bitcoin import messages
from bitcoin.utils import checksum
from six import BytesIO
from gevent import pool
from gevent import event
from gevent import socket
import logging
import threading
import struct
import gevent
__author__ = 'cdecker'
__version__ = '0.2.1'
SERVICES = 1
USER_AGENT = "/Snoopy:%s/" % __versi... |
# coding: utf-8
# YYeTsBot - bot.py
# 2019/8/15 18:27
__author__ = 'Benny <<EMAIL>>'
import io
import time
import re
import os
import logging
from urllib.parse import quote_plus
import telebot
from telebot import types, apihelper
from tgbot_ping import get_runtime
from html_request import get_sea... |
import numpy as np
import argparse
import rdkit
import rdkit.Chem
import rdkit.Chem.AllChem
import rdkit.Geometry
import os
from sklearn.externals import joblib
class Grid3D:
def __init__(self, xmin, ymin, zmin, xmax, ymax, zmax, resolution):
"""
Represents a uniformly spaced 3D grid of certain s... |
# encoding: utf-8
# Copyright 2011 Tree.io Limited
# This file is part of Treeio.
# License www.tree.io/license
"""
Everpick connector for Nuvius
Processes data requests to Nuvius and provides
convenience method to simplify data manipulations via
Nuvius data points.
See NUVIUS_URL in settings to configure where Nuvi... |
import os
from io import BytesIO
from . import config
from .exception import ScreenshotError
# ----------------------------------------------------------------------
# -------- [ cross-platform multiple screenshots module ] --------------
# ----------------------------------------------------------------------
'''
... |
import logging
import os
import pytest
from pyega3.libs import utils
from pyega3.libs.data_set import DataSet
OUTPUT_DIR = 'user_specified_directory'
def file_and_md5_file_paths(mock_dataset_file):
return [
f'/{OUTPUT_DIR}/{mock_dataset_file["fileId"]}/{mock_dataset_file["displayFileName"]}',
f... |
"""Paint4Brains Segmenter
This file contains the relevant functions for producing the segmented labeled brains, a core function of the Paint4Brains Software.
The functions and methods in this file were extracted from the several files associated with the original QuickNAT implementation.
Attributes:
label_names (... |
# -*- coding: utf-8 -*-
# @Time : 2020/8/11
# @Author : handsomezhou
import math
import time
from datetime import datetime
from constant import Constant, TimePatternConstant
HOUR_PER_DAY = 24
MINUTE_PER_HOUR = 60
SECOND_PER_MINUTE = 60
MILLISECOND_PER_SECOND = 1000
def getCurrentTimeMillis():
return round(ti... |
# ---
# jupyter:
# jupytext:
# formats: ipynb,py:percent
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.11.4
# kernelspec:
# display_name: Python 3 (ipykernel)
# language: python
# name: python3
# ---
# %% [ma... |
import datetime
import multiprocessing
import time
from multiprocessing import Pool, Process, Queue
import matplotlib.pyplot as plt
import numpy as np
from scipy.optimize import linear_sum_assignment
import bss
# --- HACK ---
# fix the implementation of auxiva-iss used
# to allow monitoring of ISR
from bss.overiva im... |
import tensorflow as tf
def conv1d_transpose(inputs,filters,kernel_width,stride=4,padding='same'):
inputs = tf.expand_dims(inputs, axis=1)
result = tf.layers.conv2d_transpose(inputs,filters,(1, kernel_width),strides=(1, stride),padding='same')
return result[:, 0]
"""
Input: z:[None, 100],y:[None,512... |
import datetime
import math
from textwrap import wrap
"""
Align text into columns [("a", 10), ("b", 10), ("c", 20), ...]
cols is a list of (text, width) tupels
width is the screenwidth to fit into if the sum width is < width
"""
def _align(cols, width=80):
if len(cols) < 2:
return str(cols[0][0])
# for c in col... |
# -*- coding: utf-8 -*-
import os
import re
import logging
import base64
from pyquery import PyQuery as pq
from lxml import etree
import execjs
from proxypool.utils import downloader
logger = logging.getLogger(__name__)
TEMPLATES_PATH = os.path.dirname(os.path.dirname(__file__)) + r'/templates/decodeip.js'
BAIBIAN_P... |
from .ply import lex
from .ply.lex import TOKEN
# ############################################ TOKENS ##################################################
tokens_collection = (
# Identifiers
"ID", "TYPE",
# Primitive Types
"INTEGER", "STRING", "BOOLEAN",
# Literals
"LPAREN", "RPAREN", "LBRACE",... |
#
# Copyright (c) 2011, 2012
# <NAME> <<EMAIL>>
# and the IceCube Collaboration <http://www.icecube.wisc.edu>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all... |
"""
Implements the Rocket.Chat REST API
"""
import requests
import json
import traceback
import asyncio
import websockets
from collections import namedtuple
class APIError(IOError):
"""
Exception raised on API call failure
"""
def __init__(self, call="", payload=None, response=None):
IOError._... |
# -*- coding: utf-8 -*-
# @Author: Nessaj
# @Date: 2018-03-31 19:29:21
# @Last Modified by: Nessaj
# @Last Modified time: 2018-04-02 22:02:10
import requests
import json
import mysql.connector
from bs4 import BeautifulSoup
import re
from urllib.request import Request,urlopen
import time
from datetime import dateti... |
import numpy as np
import prettytable as pt
import matplotlib.patches as patches
import matplotlib.pyplot as plt
import os
import matplotlib.colors as col
import matplotlib.cm as cm
import matplotlib.gridspec as gs
from matplotlib.patches import Polygon
range_color = 'hotpink'
colors = [ 'cornflowerblue', '#a0c8c0'... |
"""Main views."""
from datetime import date
from typing import Any, Dict
from django.conf import settings
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.contrib.auth.mixins import LoginRequiredMixin
from django.core.exceptions import PermissionDenied
from djan... |
#!/usr/bin/python
# Copyright 2021 Expedient
#
# 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 agr... |
"""Tools for creating, managing, and processing rules."""
__all__ = ["Rule", "Rules", "AssociativeRules", "ActionRules"]
from ..base.symbols import ConstructType, Symbol, rule, chunk
from ..base.components import Process
from .. import numdicts as nd
from typing import (
Mapping, MutableMapping, TypeVar, Gener... |
from ulauncher.api.client.Extension import Extension
from ulauncher.api.client.EventListener import EventListener
from ulauncher.api.shared.event import KeywordQueryEvent
from ulauncher.api.shared.item.ExtensionResultItem import ExtensionResultItem
from ulauncher.api.shared.action.RenderResultListAction import RenderRe... |
import streamlit as st
import pandas as pd
import json
import random
import streamlit.components.v1 as components
import SessionState
from dialogue_helper import header, footer, render, display_app_header
from prompts.generic_prompt import load_prefix, generate_response_interactive, select_prompt_interactive
from promp... |
import numpy as np
import pandas as pd
import pytest
from dppd import dppd
import plotnine as p9
import dppd_plotnine # noqa: F401
from plotnine.data import mtcars
dp, X = dppd()
def test_simple():
actual = dp(mtcars).p9().geom_point({"x": "cyl", "y": "hp"}).pd
assert actual == "test_simple"
def test_scal... |
'''
@author <NAME>
@file ion/processes/data/transforms/viz/highcharts.py
@description Convert CDM data to Highcharts datasets used to populate the charts
'''
from pyon.core.exception import BadRequest, Timeout
from pyon.public import log
from ion.core.function.transform_function import SimpleGranuleTransformFunctio... |
#!/usr/bin/env python
import matplotlib as mpl
import os
import seaborn as sb
import numpy as np
import pandas as pd
GRID_STYLES = ['darkgrid', 'whitegrid', 'dark', 'white', 'ticks', 'white_ticks', 'whitegrid_ticks', 'despine_ticks']
ESTIMATORS = {'mean': np.mean, 'median': np.median, 'max': max, 'min': min, 'std': n... |
# ___________________________________________________________________________
#
# Two-stage stochastic linear optimization of water supply portfolio
# Concrete Pyomo model
#
# Author: <NAME>
# References: Lund 1995, Wilchfort & Lund 1997, Rosenberg 2009
# _________________________________________________... |
from __future__ import annotations
import abc
import re
from numbers import Number
from typing import Awaitable # noqa: F401
from typing import (
TYPE_CHECKING,
Any,
Callable,
Generic,
List,
Optional,
Sequence,
Type,
TypeVar,
Union,
overload,
)
from zucker.filtering import... |
from collections import namedtuple
from itertools import product
column = [x for x in range(2, 10)]
# todo: check every case with key (this should imply rangescan) and without (fullscan)
# it can be checked from .plan file whether rangescan was triggered - as a precondition
interval_pairs = [
(["[3..5]", "[7..9]"]... |
import ibv
import os
import numpy as np
import argparse
import datetime
import json
from google.cloud import storage
"""
python create_experiment_file.py -nf=2000 -nc=20 -np=100000 -ps=8 -ls=64 -la 0.05 0.05 1 -lp 0.5 1.5 10 -lt 1 4 8 -lr 4 4 1
"""
def generate_parameter_steps(min,max,step):
return np.linspace... |
import math
from abc import ABC, abstractmethod
from params import Length, Colour, Ratio, Angle, MathHelpers
from gui import GUI
import constants
class ConvexPolygon(ABC):
fill_colour = Colour(name="Fill colour")
outline_colour = Colour(name="Outline colour")
@abstractmethod
def __init__(self):
... |
from sqlalchemy.sql import func
from sqlalchemy import text
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy.ext.hybrid import hybrid_property , hybrid_method
from flask import current_app
db = SQLAlchemy()
def get_mongo_connection():
try:
return current_app.MONGODB_DATABASE_URI
except Exception... |
"""
# - scheduling rate tips
- Do "But the most commonly used method is when the validation loss does not improve for a few epochs." according to https://debuggercafe.com/using-learning-rate-scheduler-and-early-stopping-with-pytorch/
- for epochs it seems every epoch step is common: https://pytorch.org/docs/stable/opt... |
from train.models import TonicNet
from torch import cat, multinomial
from torch import cuda, load, device, tensor, zeros
from torch.nn import LogSoftmax
import pickle
import random
from copy import deepcopy
"""
Functions to sample from trained models
"""
def sample_TonicNet_random(load_path, max_tokens=2999, tempera... |
# Copyright 2020 Softwerks 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... |
"""
140. Word Break II
Hard
Given a string s and a dictionary of strings wordDict, add spaces in s to construct a sentence where each word is a valid dictionary word. Return all such possible sentences in any order.
Note that the same word in the dictionary may be reused multiple times in the segmentation.
Examp... |
# Base imports
import sys, os, time
sys.path.insert(0, '/app/pysource')
from argparse import ArgumentParser
import numpy as np
# Devito imports
from devito.logger import info
# tti imports from docker image
from models import *
from sources import *
from propagators import *
# segy
import segyio as so
# Interpola... |
'''
hi_rct_sim.py
=== Description ===
Main simulation workhorse for the Heterogeneous-Intent
Randomized Clinical Trial Recommender System
=== Parameters ===
- Unobserved Confounder Distributions: defines the priors on
UCs, U: P(U)
- True Reward Distribution: defines the causal distribu... |
from insights.parsers.ls_var_log import LsVarLog
from insights.tests import context_wrap
from insights.util.file_permissions import FilePermissions
# from RHEL 7.2
LS_1 = """
/var/log:
total 1016
drwxr-xr-x. 7 root root 4096 Oct 19 15:38 .
drwxr-xr-x. 19 root root 4096 Oct 19 15:38 ..
drwxr-xr-x. 2 root root 4... |
""" Shared stuff between producer and consumer
Author: <NAME>
Source: https://github.com/SensorsINI/joker-network
"""
import logging
import math
import os
import sys
import time
from pathlib import Path
from subprocess import TimeoutExpired
import os
from typing import Optional
os.environ['TF_CPP_MIN_LOG_LEVEL'] = ... |
# encoding: UTF-8
import os
import argparse
import yaml
import tensorflow as tf
from tensorflow.contrib import slim
from tensorflow.contrib.learn import ModeKeys
# ====================================
# ====== Define Log system ======
# ====================================
# TODO logger
# ======================... |
import csv
import optparse
import os
import textwrap
import sys
from .. import DuplicateReceipt
from .. import NoSuchReceipt
from .. import NoSuchReport
from .. import delete_receipt
from .. import download_receipt
from .. import initialize_gcloud
from .. import list_receipts
from .. import upload_receipt
class Inva... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.