text stringlengths 3.07k 12.6k |
|---|
from IMLearn.utils import split_train_test
from IMLearn.learners.regressors import LinearRegression
from typing import NoReturn
import numpy as np
import pandas as pd
import plotly.graph_objects as go
import plotly.express as px
import plotly.io as pio
pio.templates.default = "simple_white"
def load_data(filename: ... |
"""
Criado em 28/03/2022
por <NAME>
Soluções e Serviços
v1.0.2 => Correção para novo formato de extração do mongocsv
v1.1.0 => Nova funcionalidade de análise de baterias das estações
"""
import os
import sys
import time
import getopt
import pathlib
import xlsxwriter
import pandas as pd
from dask import dataframe ... |
#!/bin/env python3
"""The same model as Ipopt/examples/hs071
You can set Ipopt options by calling ipyopt.Problem.set().
For instance, to set the tolarance, use
nlp = ipyopt.Problem(...)
nlp.set(tol=1e-8)
For a complete list of Ipopt options, use
print(ipyopt.get_ipopt_options())
"""
from numpy import o... |
# Defines the tilt mode. Expects asset_list.yaml entries for:
# sounds: 'tilt warning' and 'tilt'
# fonts: tilt_small and tilt_big
import logging
import procgame
from ..game import Mode
from ..game.advancedmode import AdvancedMode
from .. import dmd
import time
import os
class Tilted(AdvancedMode):
"""docstring... |
# -*- coding: utf-8 -*-
"""
MNISTデータセットを畳み込みニューラルネットで学習します
"""
import os
import numpy as np
from cntk import Trainer
from cntk.io import MinibatchSource, CTFDeserializer, StreamDef, StreamDefs, \
INFINITELY_REPEAT, FULL_DATA_SWEEP
from cntk.ops import input_variable, constant, element_times, cross_e... |
######################################################################################################################
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
# ... |
#
# This file is part of LUNA.
#
# Copyright (c) 2020 <NAME> <<EMAIL>>
# SPDX-License-Identifier: BSD-3-Clause
""" Boilerplate for LUNA unit tests. """
import os
import math
import unittest
from functools import wraps
from nmigen import Signal
from nmigen.sim import Simulator
def sync_test_case(process_function, ... |
#
# Copyright 2020 Intellivoid Technologies
#
# 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... |
import re
import warnings
from .. import options as opts
from .. import file_types, path, shell
from ..iterutils import first, iterate, listify, slice_dict
_modes = {
'shared_library': 'EXPORTS',
'static_library': 'STATIC',
}
_macro_ex = re.compile(r'([^A-Za-z0-9_]|^(?=[0-9]))')
_macro_ex2 = re.compile(r'^_'... |
#!/usr/bin/python3
import sys
import kdb
base_key = "/sw/org/kdbdummy/#0/current"
spec_base_key = "spec" + base_key
spec = kdb.KeySet(10, kdb.Key(spec_base_key, kdb.KEY_META, "command", ""),
kdb.Key(spec_base_key + "/printversion",
kdb.KEY_META, "description", "print version information and exit (ignoring a... |
# coding=utf-8
# Copyright 2020 The TF-Agents 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... |
import logging
import queue
import random
import threading
import time
import uuid
import boto3
from kombu.utils import json
logger = logging.getLogger("zentral.core.queues.backends.aws_sns_sqs.sqs")
class SQSReceiveThread(threading.Thread):
attribute_names = ['All']
message_attribute_names = ['All']
ma... |
#!/usr/bin/env python3
"""
Kenzie assignment: Strings!
"""
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Instructions:
# Complete each function below by writing the code for it. main() is already
# set up to test all the functions with a fe... |
#!/usr/bin/env python3
#
# Copyright 2016 Spotify AB.
#
# 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 applicabl... |
# coding: utf8
from ...symbols import (
ADJ, ADV, NOUN, NUM, PRON, ADP, PUNCT, VERB, POS, X, CCONJ, INTJ, SCONJ
)
from ...lemmatizer import Lemmatizer
class PolishLemmatizer(Lemmatizer):
_morph = None
def __init__(self):
super(PolishLemmatizer, self).__init__()
try:
from morfeusz2 import Morfeusz
... |
import pandas as pd
import numpy as np
import yfinance as yf #Yahoo Finance API
from datetime import datetime as dt, date
import time
df = pd.DataFrame()
tickers = ["^KS11", "^GSPC", "^N225", "^HSI", "^N100", "^FTSE", "^DJI"]
start_day = dt(2019, 12, 1)
today = str(date.today())
kospi = yf.download('^KS11', start=dt(... |
from lstm_architecture import one_hot, run_with_config
import numpy as np
import os
#--------------------------------------------
# Neural net's config.
#--------------------------------------------
class Config(object):
"""
define a class to store parameters,
the input should be feature mat of traini... |
"""
Trilinear attention
This code is written by <NAME>.
"""
import torch
import torch.nn as nn
from torch.nn.utils.weight_norm import weight_norm
from src.fc import FCNet
from src.bc import BCNet
from src.tc import TCNet
import time
class BiAttention(nn.Module):
def __init__(self, x_dim, y_dim, z_dim, glimpse, dr... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... |
from tabpy.tabpy_server.handlers import BaseHandler
import logging
import time
from tabpy.tabpy_server.common.messages import (
Query,
QuerySuccessful,
QueryError,
UnknownURI,
)
from hashlib import md5
import uuid
import json
from tabpy.tabpy_server.common.util import format_exception
import urllib
from... |
# -*- coding: utf-8 -*-
"""Main routines which will be used in simulations."""
import numpy as np
from tqdm import tqdm
import scipy.integrate as integrate
import matplotlib.pyplot as plt
from celluloid import Camera
from .operations import (
schrodinger_propagate,
get_vibrational_positions,
get_q_from_st... |
import pprint
# Get the html end.
def get_html_begin():
return "<!DOCTYPE html> \n" + " <html> \n"
# Get the html end.
def get_html_end():
return "\n </html>"
def writeErrorMessageHtml(error_message):
html_code = ""
html_code = html_code + get_html_begin()
html_code = html_code + "<body>"
... |
from __future__ import (
annotations,
)
from functools import (
lru_cache,
)
from typing import (
TYPE_CHECKING,
Any,
Iterable,
NamedTuple,
Optional,
Type,
Union,
)
from ...exceptions import (
MinosImportException,
)
from ...importlib import (
import_module,
)
from .generic... |
from datetime import datetime
import pytz
from django.core.mail import EmailMultiAlternatives
from saleor.plugins.allegro.enums import AllegroErrors
from saleor.plugins.allegro import ProductPublishState
from saleor.plugins.manager import get_plugins_manager
from saleor.product.models import Product, ProductVariant, ... |
import sys
sys.path.insert(0, 'build/shared_model/bindings')
import iroha
import block_pb2
import endpoint_pb2
import endpoint_pb2_grpc
import queries_pb2
import grpc
import time
tx_builder = iroha.ModelTransactionBuilder()
query_builder = iroha.ModelQueryBuilder()
crypto = iroha.ModelCrypto()
proto_tx_helper = iroh... |
#!/usr/bin/python3
"""
MIT License
Copyright (c) 2017 <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, mer... |
# Copyright (c) 2015-2019, Activision Publishing, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of ... |
"""
# Standard preprocessing for VGG on ImageNet taken from here:
# https://github.com/tensorflow/models/blob/master/research/slim/preprocessing/vgg_preprocessing.py
# Also see the VGG paper for more details: https://arxiv.org/pdf/1409.1556.pdf
"""
import os
import tensorflow as tf
VGG_MEAN = [123.68, 116.78, 103.94]
... |
#!/usr/bin/env python
#
# Installs gcam v4.3 on Windows, Mac OS X, and Linux
#
# Author: <NAME> (<EMAIL>)
# Created: 10 Nov 2016
#
from __future__ import print_function
import os
import sys
import argparse
import subprocess
import platform
import urllib
from urlparse import urlparse
import tarfile
PlatformName = platf... |
import json
import logging
import os
import camelot
import jsonpickle
import pandas as pd
from src.coinverscrapy.model.formatting_handlers.CompetenceNewlineHandler import CompetenceNewlineHandler
from src.coinverscrapy.model.formatting_handlers.ExcessNewlineHandler import ExcessNewlineHandler
from src.coinverscrapy.m... |
# import lib
import gym
import tensorflow as tf
import numpy as np
# Create the Cart-Pole game environment
env = gym.make('CartPole-v0')
# Q-network
class QNetwork:
def __init__(self, learning_rate=0.01, state_size=4,
action_size=2, hidden_size=10,
name='QNetwork'):
# sta... |
#!/usr/bin/env python3
import sys
from aiohttp import web, ClientSession
import asyncio
async def http_root_handler(request):
with open('resources/index.html') as f:
return web.Response(text=f.read(), content_type='text/html')
async def forward(request, url):
#print('>', url)
headers = {'Accept': 'ap... |
import os
from os import listdir
from os.path import isfile, join
import numpy as np
import pandas as pd
from datetime import timedelta
from flask import Flask, make_response, request, current_app
from functools import update_wrapper
import persist as pt
import torch
from torch.autograd import Variable
import tor... |
import os, sys, time, logging
from random import choice
from functools import wraps
import pyric
import pyric.pyw as pyw
from pyric.lib import libnl as nl
from scapy.all import *
from scapy.contrib.wpa_eapol import WPA_key
MGMT_ASSOC_REQ = (0, 0)
MGMT_ASSOC_RESP = (0, 1)
MGMT_REASSOC_REQ = (0, 2)
MGMT_REASSO... |
#! /usr/local/bin/stackless2.6
# by <EMAIL> at Sat May 8 18:47:38 CEST 2010
"""Demo for hosting a gevent application within a Syncless process."""
__author__ = '<EMAIL> (<NAME>)'
import sys
# Import best_greenlet before gevent to add greenlet emulation for Stackless
# if necessary.
from syncless.best_greenlet.gree... |
import os
import pathlib
import pytest
from geolib.models.dsettlement.dsettlement_parserprovider import *
from geolib.models.dsettlement.internal import (
Boundaries,
Curves,
Layers,
PiezoLine,
PiezoLines,
Points,
)
from tests.utils import TestUtils
class Test_DSettlementInputParser:
@py... |
# pragma: no cover
import logging
import warnings
from esteid_certificates import get_certificate_file_name
from esteid import settings
from esteid.util import parse_legacy_dn, parse_rfc_dn
from .ocsp import OCSPVerifier
try:
from django.utils.deprecation import MiddlewareMixin
except ImportError: # Django < ... |
import argparse
import sys
from index import create_document_list, reindex
from prepare import load_features, init_default_store
from search import ltr_query
from train import save_model, train_model, collect_train_data
from utils import Logger, elastic_connection, FEATURE_SET_FILE, JUDGMENTS_FILE, QUERIES_FILE, \
... |
import json
import os
import urllib.request
import arrow
from pdf2image import convert_from_path
import pytesseract
from PIL import Image
class Case:
def __init__(self, filename):
with open(filename, 'r') as f:
self.__data = json.load(f)
self.entries = []
for entry_data in sel... |
#######################################################
# ---------- Network Propagation Functions ---------- #
#######################################################
import networkx as nx
import time
import numpy as np
import pandas as pd
# Normalize network (or network subgraph) for random walk propagation
# If sy... |
"""
Post-deploy script to create resources and automatically create a deployment step
for the Greengrass Group
"""
import json
import sys
import logging
from pathlib import Path
from urllib import request
import boto3
from botocore.exceptions import ClientError
logger = logging.getLogger()
logger.setLevel(logging.I... |
from tkinter import Toplevel
from tkinter import Label
from tkinter import Frame
from tkinter import Button
from tkinter import GROOVE
from tkinter import NSEW
from tkinter import PhotoImage
from tkinter import Tk
import util.funcoes as funcoes
class SetLanguage():
def __init__(self, master, design, idioma, inter... |
# ADC DMA web server using MicroPython on Pico
#
# For detailed description, see https://iosoft.blog
#
# Copyright (c) 2021 <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 License at
#
# http... |
import os
import logging
import shutil
import tempfile
import six
from . import process
from . import runtime
from . import path
yatest_logger = logging.getLogger("ya.test")
def _copy(src, dst, universal_lines=False):
if universal_lines:
with open(dst, "wb") as f:
for line in open(src, "rbU... |
import pandas as pd
import numpy as np
def full_data(dataframe):
return dataframe.drop(['DATETIME', 'ATT_T1', 'ATT_T2', 'ATT_T3', 'ATT_T4', 'ATT_T5',
'ATT_T6', 'ATT_T7','ATT_PU1', 'ATT_PU2', 'ATT_PU3', 'ATT_PU4',
'ATT_PU5','ATT_PU6', 'ATT_PU7', 'ATT_PU8', 'AT... |
from typing import AnyStr, Dict, List, Optional, Type
from django import forms
from django.contrib import messages
from django.contrib.auth import get_user_model
from django.contrib.auth.mixins import LoginRequiredMixin
from django.db import models
from django.http import Http404
from django.shortcuts import get_objec... |
import numpy as np
import segyio
from pyvds.accessors import VdsReader
VDS_FILE = 'test_data/small.vds'
SGY_FILE = 'test_data/small.sgy'
def test_read_ilines_list():
reader = VdsReader(VDS_FILE)
with segyio.open(SGY_FILE) as sgyfile:
assert np.all(reader.ilines == sgyfile.ilines)
def test_read_xline... |
import logging
import os
from typing import Dict, Tuple, Union
import torch
import random
import numpy as np
from torch import Tensor
from torch.nn import Module, Softmax
from torch.optim import Optimizer
from torchmetrics.functional import confusion_matrix
from config.default import CfgNode, get_cfg_from_file
log... |
import json
import logging
import pickle
import collections
from datetime import datetime, timedelta
from django.http import HttpResponse
from django.views.decorators.cache import never_cache
from core.monitor.modelsMonitor import AtlasDBA
from core.libs.cache import getCacheEntry, setCacheEntry
from core.views impor... |
import pyautogui
import numpy as np
import time
import datetime
import pkg_resources
import serial
import re
from res.settings import DEV, MOCK
PORT_GAUSS = 'COM7' # Nobody else is going to use this library anyway!
PORT_PSU = 'COMX'
# IMG_XPLUS = 'res/x+.png'
IMG_XPLUS = pkg_resources.resource_filename(__name__, 'res... |
# 预处理部分
#
#
import re
from nltk import word_tokenize, pos_tag
from nltk.corpus import stopwords, wordnet
from nltk.stem import WordNetLemmatizer
"""
从文本到文本,使用正则去除标点、缩写、html符号
"""
def regUse(text):
text = re.sub(r"[,.?!\":]", '', text) # 去标点
text = re.sub(r"'\w*\s", ' ', text) # 去缩写
text = re.sub(r"#?&.{1,3}... |
from __future__ import print_function, division
import dicom
import numpy as np
import glob
import os,sys
import cv2
import json
from natsort import natsorted
import multiprocessing
from joblib import Parallel, delayed
import SimpleITK as sitk
import scipy.ndimage
from tqdm import tqdm
np.random.seed(17) # do NOT cha... |
import os
from osgeo import gdal
from ..helper import generate_output_file_tif, create_zip_shapefiles
from ..constant import CM_NAME
import pandas as pd
import time
import numpy as np , pandas as pd
from .my_calculation_module_directory.dispatch import run
from .my_calculation_module_directory.preprocessing import p... |
from model import *
from flask import request, jsonify
from flasgger.utils import swag_from
from flasgger import Swagger
import json
app.config["SWAGGER"] = {"title": "ANIME-TV-API", "universion": 1}
swagger_config = {
"headers": [],
"specs": [{
"title": "anime-tv-api",
"description":
... |
import pystan
import os
import pickle as pkl
import numpy as np
import pandas as pd
from .utils import do_ols
__dir__ = os.path.abspath(os.path.dirname(__file__))
class HierarchicalModel(object):
def __init__(self, X, subject_ids, subjectwise_errors=False, cauchy_priors=False):
self.X = pd.DataFrame(X)... |
import numpy as np
from typing import Tuple
from keras.models import Sequential
from keras.layers import Dense
from keras.optimizers import Adam
#
# This is the environment that returns rewards. The reward profile is -x2 where the state is
# x between -1 and 1 on 0.05 step intervals. This means the optimal action to ... |
# Copyright 2020 The SODA Authors.
# Copyright 2016 Red Hat, 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/LI... |
"""
Project Euler Problem 68: https://projecteuler.net/problem=68
Magic 5-gon ring
Problem Statement:
Consider the following "magic" 3-gon ring,
filled with the numbers 1 to 6, and each line adding to nine.
4
\
3
/ \
1 - 2 - 6
/
5
Working clockwise, and starting from the group of three
with th... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# TAKEN FROM: https://github.com/i3/i3status/blob/master/contrib/wrapper.py
# MUTILATED BY: Architector #4
# This script is a simple wrapper which prefixes each i3status line with custom
# information. It is a python reimplementation of:
# http://code.stapelberg.de/git/i3s... |
import json
import pathlib
import random
import re
from collections import defaultdict, namedtuple
from itertools import zip_longest
import discord
from discord.ext import commands
Result = namedtuple('Result', 'cmp name image')
class RockPaperScissors:
@staticmethod
def pick(choice, elements):
beats... |
import os
import argparse
import logging
import time
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data import DataLoader
import torchvision.datasets as datasets
import torchvision.transforms as transforms
from torchdiffeq import odeint_adjoint as odeint_adjoint... |
import sys
import os
from pathlib import Path, WindowsPath
import importlib
from functools import wraps, reduce
import base64
import shutil
import inspect
from collections.abc import Iterable
from contextlib import contextmanager
from ploomber.exceptions import (CallbackSignatureError, CallbackCheckAborted,
... |
# ===============================================================================
# Copyright 2013 <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 License at
#
# http://www.apache.org/licenses/... |
import os
import time
import spacy
import platform
import functools
import operator
import CordisKG.config
from suffix_trees import STree
from string import punctuation
from difflib import get_close_matches
from keybert import KeyBERT
from collections import OrderedDict
from stempel import StempelStemmer
from nltk.stem... |
'''Infrastructure layer for representing agent observations
Maintains a synchronized + serialized representation of agent observations in
flat tensors. This allows for fast observation processing as a set of tensor
slices instead of a lengthy traversal over hundreds of game properties.
Synchronization bugs are notori... |
__all__ = ['console', 'EProg', 'ESpark', 'SpkMap', 'Stats', 'colors', 'colors2']
import time,random
from collections import defaultdict
from typing import List
from collections import deque, OrderedDict, namedtuple
from .all_rich import (Console, Color, FixedPanel, box, Segments, Live,
g... |
import io
import xlsxwriter
from fastapi import APIRouter, Depends
from fastapi.responses import UJSONResponse
from starlette.responses import StreamingResponse
from starlette.status import HTTP_409_CONFLICT
from tortoise import Model
from tortoise.contrib.pydantic import pydantic_model_creator
from tortoise.exception... |
"""
Use imagemagick to convert all pfds to a sequence of thumbnail images
requires: sudo apt-get install imagemagick
"""
import datetime
import os, sys
import threading
import time
import shutil
from subprocess import Popen
from utils import Config, get_left_time_str
def create_thumbnail(thread_number, pdf_path, thu... |
import numpy as np
from .base import ConfigFrame
import wx
from . import gTurbSim_wdr as gts_wdr
class cho_windtype_turbclass(object):
def __init__(self, cho_type, cho_class):
self.windtype = cho_type
self.turbclass = cho_class
def Disable(self,):
self.windtype.Disable()
self... |
# Examples of smileys on a LED matrix display.
# This example and library is meant to work with Adafruit CircuitPython API.
# 2017-0522 PePo - MicroPython, SDA/SCL pins are different for NodeMCU and LoLin32
# source: https://learn.adafruit.com/micropython-hardware-led-backpacks-and-featherwings?view=all
# 2017-0520 PeP... |
# -*- coding: utf-8 -*-
# cython: language_level=3
# Copyright (c) 2021-present VincentRPS
# 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 t... |
"""Sparse matrix norms.
"""
from __future__ import division, print_function, absolute_import
import numpy as np
from scipy.sparse import issparse
from numpy.core import Inf, sqrt, abs
__all__ = ['norm']
def _sparse_frobenius_norm(x):
if np.issubdtype(x.dtype, np.complexfloating):
sqnorm = abs(x).power... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
slim = tf.contrib.slim
import tensorflow as tf
import tensorflow.contrib.layers as layers
import tensorflow.contrib.framework as ops
def get_inception_layer(inputs, conv11_size, conv3... |
import time
import copy
import pandas as pd
from more_itertools import split_at
from sqlalchemy import create_engine
from sqlalchemy.engine.url import URL
from transformers import BatchEncoding
def add_insep_token(tokenizer):
special_tokens_dict = {'sep_token': str('<|insep|>')}
tokenizer.add_special_tokens(s... |
#!/usr/bin/env python
# -*- coding: utf-8; py-indent-offset: 4 -*-
#
# Author: Linuxfabrik GmbH, Zurich, Switzerland
# Contact: info (at) linuxfabrik (dot) ch
# https://www.linuxfabrik.ch/
# License: The Unlicense, see LICENSE file.
# Make coding more python3-ish
from __future__ import (absolute_import, divi... |
import bpy
from bpy.props import *
from ...nodes.BASE.node_tree import RenderStackNode
def update_node(self, context):
self.update_parms()
class RSNodeOctaneRenderSettingsNode(RenderStackNode):
"""A simple input node"""
bl_idname = 'RSNodeOctaneRenderSettingsNode'
bl_label = 'Octane Settings'
#... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import glob
import os
import inwx.inwx
import inwx.configuration
import dns.zone
NS = ['ns.inwx.de', 'ns2.inwx.de', 'ns3.inwx.eu', 'ns4.inwx.com', 'ns5.inwx.net']
def dns_name_to_text(name, dnsorigin):
return name.derelativize(origin=dnsorigin).to_text().rstrip('.')
... |
from collections import defaultdict
from pathlib import Path
import re
import tempfile
from typing import Any, Dict, List, NamedTuple, Tuple, Union
import zipfile
import edn_format
Path_T = Union[Path, str]
class Card(NamedTuple):
""" Represents a single card to be put into Mochi
Assumes that the card is ... |
"""
Deploys have the same name as in ``grammar.yml``, are stored as python modules
in the ``deploy`` package. These need to contain a ``deploy()`` function that
returns a list of commands - either python functions (remember to use fabric!)
- or strings that need to be executed, as well as a list of dependencies.
Depen... |
"""
Utility functions for WPS processes.
"""
from netCDF4 import Dataset
import os
from malleefowl import config
import logging
LOGGER = logging.getLogger("PYWPS")
def esgf_archive_path(url):
from os.path import join, isfile
archive_path = None
if 'thredds/fileServer/' in url:
url_path = url.... |
# Copyright 2020 DeepMind Technologies Limited.
#
#
# 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 agre... |
from __future__ import absolute_import, unicode_literals
import sys
import logging
import inspect
class EagerFormattingAdapter(logging.LoggerAdapter):
"""
A `logging.LoggerAdapter` that add unterpolation support but performs the
evaluation immediately if the appropriate loglevel is set.
"""
def _... |
"""
ankisync.py - sync TiddlyWiki notes to Anki
After finding all notes in a user's TiddlyWikis, we need to sync with Anki.
This is a unidirectional, destructive sync -- all TiddlyWiki notes found are
compared with all Anki notes in the collection, and the Anki collection is
updated to match, by adding and updating no... |
from os.path import join, dirname
import pandas as pd
#from bokeh.application import Application
#from bokeh.application.handlers import FunctionHandler
from bokeh.io import output_notebook, show, curdoc
# output_notebook()
from bokeh.layouts import widgetbox, row, column, layout
from bokeh.plotting import figure
from... |
# coding=utf-8
# Copyright 2021 The TensorFlow Datasets 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 appl... |
from os import set_blocking
import sys
import math
import csv
#if __name__ == "__main__":
#
# print(f"Arguments count: {len(sys.argv)}")
# for i, arg in enumerate(sys.argv):
# print(f"Argument {i:>6}: {arg}")
#
# parameters:
#
# 1 - Design coefficient of lift (real, 0.05 to 1)
# 2 - Camber position & refex (inte... |
import yaml
from fibertree import Tensor
import sys
import time
from fibertree import Codec
# matrix market converter
def mm_to_hfa_yaml(infilename, tensor_name, rank_ids, outfilename):
# read mm into csr
shape_m = 0
shape_n = 0
nnz = 0
csr = None
m_coords = list()
with open(infilename, 'r'... |
import os
import os.path as osp
from config import cfg, get_data_dir
import random
import argparse
import numpy as np
import scipy.io as sio
import h5py
from sklearn.preprocessing import MinMaxScaler
from sklearn.feature_extraction.text import CountVectorizer, TfidfTransformer
def make_reuters_data(path, N):
did... |
# Copyright 2020 NVIDIA. 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 agree... |
# Author: <NAME> <<EMAIL>>
import numpy as np
import tensorflow as tf
from tensorpack.utils import logger
import six,copy
from tensorpack.tfutils.common import get_op_tensor_name
from tensorpack.tfutils.varmanip import (SessionUpdate, get_savename_from_varname,
is_training_name, get_checkpoint_pa... |
from flask import Flask, render_template, request, redirect, session, url_for
from flask_paginate import Pagination, get_page_args
from functools import wraps
from rank_dic import rank_dic
from game_dic import game_dic
from game2_dic import game2_dic
#from views.api_player import edubot
from api.api_school import edub... |
import uuid
import graphene
from django.utils import timezone
from django.utils.translation import override
from django.utils.translation import ugettext_lazy as _
from django_ilmoitin.utils import send_notification
from graphene_django.types import DjangoObjectType
from graphql import GraphQLError
from graphql_jwt.de... |
import multiprocessing
import os
import logging
import Queue
from fs.errors import ParentDirectoryMissingError, ResourceNotFoundError
from apn_storage.utils import copy_file, walk_files
def sync_fs(source_fs, target_fs, delete_missing=False, processes=0, verbosity=0):
"""
Synchronize two filesystems, so tha... |
# Copyright (c) 2016-present, Facebook, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... |
#!/usr/bin/env python3
# ************************************************************************
#
# SYCL Conformance Test Suite
#
# Copyright: (c) 2018 by Codeplay Software LTD. All Rights Reserved.
#
# ************************************************************************
import sys
import argparse
from strin... |
import os
import arrow
import logging
import argparse
import numpy as np
import torch
import torch as th
import torch.nn as nn
from pathlib import Path
from leibniz.unet.base import UNet
from leibniz.unet.warpped_hyperbolic2d import HyperBottleneck
from leibniz.nn.activation import CappingRelu
from blks.direct impor... |
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 12 16:39:19 2016
@author: dendrondal
"""
import glob
import os
import re
from pathlib import Path
import click
import matplotlib.pyplot as plt
import pandas as pd
from cycler import cycler
from matplotlib import ticker
def csv_extraction(path, save=False):
"""Takes... |
import graphics
from graphics import Drawable
from constants import *
from state import tempState, permState
from pygame import Rect
UNIQUE_ITEM = 1
NORMAL_ITEM = 2
class ItemType:
def __init__ (self, id, type, cost, duration, effect):
self.id, self.type, self.cost, self.duration, self.effect = id, type,... |
#!/usr/bin/env python
#
# BrainBrowser: Web-based Neurological Visualization Tools
# (https://brainbrowser.cbrain.mcgill.ca)
#
# Copyright (C) 2011 McGill University
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by t... |
import torch
import numpy as np
from cscPy.Const.const import *
from progress.bar import Bar
from termcolor import colored, cprint
from torch.utils.tensorboard import SummaryWriter
def meanEuclideanLoss(pred, gt, scale, jointNr=21):
pred = pred.view([-1, jointNr, 3])
gt = gt.reshape([-1, jointNr, 3])
eu... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.