text stringlengths 3.07k 22.1k |
|---|
import sympy
import catamount
from catamount.api import utils
from catamount.tests.utils.helpers import *
def softmax(name, out_shape, input, axis=1):
output = pointwise('{}/exp'.format(name), catamount.ExpOp, out_shape, input)
reduce_shape = [out_shape[1 - axis]]
reduced = reduce('{}/reduce'.format(nam... |
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... |
#!/usr/bin/env python
'''
The script uses a simple procedure to combine semantic segmentation and instance
segmentation predictions. The procedure is described in section 7 of the
panoptic segmentation paper https://arxiv.org/pdf/1801.00868.pdf.
On top of the procedure described in the paper. This script remove from
p... |
import os
import torch
import argparse
import torch.nn as nn
from pathlib import Path
import torch.onnx as onnx
import torch.optim as optim
import torch.nn.functional as F
from torch.utils.data import DataLoader
from torchvision import datasets, transforms
from azureml.core.run import Run
############################... |
# -*- coding: utf-8 -*-
# https://github.com/cvzi/foodemoji
import sys
import os
import timeit
try:
import foodemoji
except ImportError:
include = os.path.relpath(os.path.join(os.path.dirname(__file__), ".."))
sys.path.insert(0, include)
import foodemoji
print("Imported foodemoji from %s" % os.path... |
import tensorflow as tf
import argparse
import os, re
import numpy as np
from tensorflow.contrib.layers import variance_scaling_initializer
from tensorpack import *
from tensorpack.utils import logger
from tensorpack.utils.stat import RatioCounter
from tensorpack.tfutils.symbolic_functions import *
from tensorpack.tfu... |
import sys
import os
import hookio
import argparse
import functools
import logging.config
import json
debug = '-d' in getattr(sys, 'argv', [])
log = logging.getLogger(__name__)
def parse_argv(argv):
if os.path.relpath(argv[0], os.path.dirname(hookio.__file__)) == '__main__.py':
argv[0] = sys.executable +... |
import importlib
import json
import os
import shutil
import subprocess
from pathlib import Path
from shutil import which
from typing import List, Optional, Tuple
from setuptools import find_packages
from typer import Argument, Option, Typer
from .paths import (
GLOBAL_APP_DIR,
GLOBAL_EXTENSIONS_DIR,
GLOBA... |
# coding: utf-8
import json
import datetime
import hashlib
import webapp2
from google.appengine.api import users, memcache
from google.appengine.ext import ndb
import sil_model
import split_pgn
CHUNK_SIZE = 10
"""
Make sample opening PGN
parse_stm verkar inte klara kommentarer (med åäö?)
--- LATER ---
Memorize gam... |
"""
NAME
Custom Colormaps for Matplotlib
PURPOSE
This program shows how to implement make_cmap which is a function that
generates a colorbar
PROGRAMMER(S)
<NAME>
<NAME>
REVISION HISTORY
20130411 -- Initial version created
20140313 -- Small changes made and code posted online
20140320 -- ... |
import pandas as pd
import re
from spacy.lang.en.stop_words import STOP_WORDS
from string import punctuation
from sklearn.feature_extraction.text import CountVectorizer, TfidfVectorizer
from sklearn.decomposition import NMF, LatentDirichletAllocation, TruncatedSVD
from gensim.models.phrases import Phrases
def cleaning... |
#!/usr/bin/bash
# Author: GMFTBY, sfs, hyx
# Time: 2019.11.5
from nltk.translate.bleu_score import sentence_bleu, corpus_bleu
from nltk.translate.bleu_score import SmoothingFunction
from nltk.collocations import BigramCollocationFinder
from nltk.probability import FreqDist
import argparse
import codecs
import numpy as... |
# Copyright 2022 Huawei Technologies Co., Ltd
#
# 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 sys
from ruamel.yaml import YAML
from itertools import chain
from tx.functional.either import Left, Right
from io import StringIO
import logging
def update_key(d, ok, nk):
curr_keys = list(d.keys())
if ok in curr_keys:
i = curr_keys.index(ok)
d.insert(i, nk, d.pop(ok))
return Rig... |
#!/usr/bin/env python
#! -*- coding: utf-8 -*-
"""Link-history-retrieval for the goo.gl client."""
from __future__ import unicode_literals
import apiclient.discovery
import click
import ecstasy
import warnings
from collections import namedtuple
from datetime import datetime, timedelta
import lnk.beauty
import lnk.... |
from datetime import datetime
from sqlalchemy import Table, Column, Integer, String, ForeignKey, Text, DateTime, UniqueConstraint, MetaData, join
from sqlalchemy.orm import relationship, backref, column_property
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class AutoRepr:
de... |
#!/usr/bin/env python
"""Easily convert RGB video data (e.g. .avi) to the TensorFlow tfrecords file format with the provided 3 color channels.
Allows to subsequently train a neural network in TensorFlow with the generated tfrecords.
Due to common hardware/GPU RAM limitations, this implementation allows to limit the n... |
import tensorflow as tf
import numpy as np
'''An issue is that after combined with attention, half of base_model would
maintain two nodes (with and without attention), which is inefficient.'''
class MiniImagenetModel(tf.keras.Model):
name = 'MiniImagenetModel'
# can be replaced with other solver network
... |
#!/usr/bin/env python3
#
# __init__.py
"""
Sphinx directives for showing license information.
.. _choosealicense.com: https://choosealicense.com/
"""
#
# Copyright © 2021 <NAME> <<EMAIL>>
#
# HTML styling and license-sprite.png from https://github.com/github/choosealicense.com
# Copyright (c) 2013-2021 GitHub, Inc... |
#!/usr/bin/env python3
# https://sqlite.org/lang_datefunc.html
# CREATE TABLE "content_type_conf_contrib" (
# "vid" INTEGER NOT NULL DEFAULT '0' ,
# "nid" INTEGER NOT NULL DEFAULT '0' ,
# "field_conf_contrib_type_value" TEXT NULL ,
# "field_urlabstract_url" VARCHAR(255) NOT NULL DEFAULT '' ,
# "field_urlabstract_ti... |
import errno
from rpython.rlib import _rsocket_rffi as _c, rpoll
from rpython.rlib.rarithmetic import USHRT_MAX
from rpython.rtyper.lltypesystem import lltype, rffi
from rpython.rlib import objectmodel
from pypy.interpreter.baseobjspace import W_Root
from pypy.interpreter.error import OperationError, oefmt, wrap_oser... |
#!/usr/bin/env python
# Copyright 2014-2020 The PySCF Developers. 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
#
# U... |
import glob
import os
import os.path as osp
import shutil
import zipfile
import numpy as np
import torch
import torch.nn.functional as F
from cogdl.data.dataset import MultiGraphDataset
from cogdl.data import Graph
from cogdl.utils import download_url
def normalize_feature(data):
x_sum = torch.sum(data.x, dim=1... |
#!/usr/bin/env python3
import sys
import os.path
import math
import random
import argparse
import time
import itertools
import functools
import pygame
import futracer
class FutFly:
def __init__(self, size=None, render_approach=None):
if size is None:
size = (800, 600)
self.size = si... |
from datetime import datetime, time, date
import pandas as pd
from flask import current_app
from flask_table import Table, Col, create_table
from app.extensions import db
from app.data_analysis.oee import get_activity_duration_dict, get_schedule_dict
from app.default.models import Job, ActivityCode, Machine
from app.... |
"""
3D Channel and Spatial Attention Network (CSA-Net 3D).
"""
from __future__ import division
import torch
import torch.nn as nn
import torch.nn.functional as F
def downsample():
return nn.MaxPool3d(kernel_size=2, stride=2)
def deconv(in_channels, out_channels):
return nn.ConvTranspose3d(in_channels, out_c... |
import copy
import sys
import time
import numpy as np
import random
import pygame
from sudoku_alg import valid
class Population:
"""
A Population is an ensemble of chromosomes.
"""
def __init__(self, initial_board):
self.chromosomes = []
self.initial_board = initial_board
def gen... |
from pyknotid.catalogue.getdb import find_database, download_database
from pyknotid.representations.dtnotation import DTNotation
from pyknotid.catalogue.identify import from_invariants
from pyknotid.spacecurves import Knot
import subprocess
import os
import sys
import numpy as np
from contextlib import contextmanager
f... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: chengdicao
"""
import tensorflow as tf
from tensorflow.keras import layers
import tensorflow.keras.backend as K
# global hyperparameters
_regularizer = None
_class_num = None
def _set_class_num(class_num):
global _class_num
_class_num = class_num
... |
import json
import os
import subprocess
import urllib.request
import koji
from modulemd_tools.modulemd_tools.yaml import _yaml2stream
from modulemd_tools.bld2repo.utils import mbs_valid
def get_koji_build_info(build_id, session, config):
"""
Returns build information from koji based on build id.
:param... |
"""A high-level, convenient abstraction for interacting with the LG
SmartThinQ API for most use cases.
"""
import json
import enum
import logging
import requests
import base64
from collections import namedtuple
from typing import Any, Optional
from . import core
DEFAULT_COUNTRY = 'SE'
DEFAULT_LANGUAGE = 'sv-SE'
#: Re... |
# (c) 2012 <NAME>
# Licensed under the GNU General Public Licence version 3
r'''
Peglet extends Python's regular expressions to handle recursive
grammars. It aims to be the simplest generally-useful parsing library.
For example, to parse a tiny subset of HTML:
>>> grammar = r"""
... parts = part parts |
... |
#!/usr/bin/env python
""" Downloads images from HDFS and ships them to AWS for processing. """
import subprocess
import os
import sys
import json
import datetime
import time
from util import util_send_email, util_run_cmd, util_get_platform
import multiprocessing
import shutil
from pid import PidFile
__author__ = "<... |
import tkinter as tk # python 3
from tkinter import font as tkfont # python 3
import subprocess
import tkinter.messagebox as box
# from puzzle import GameGrid
from logic import *
from random import *
from tkinter import *
#import Tkinter as tk # python 2
#import tkFont as tkfont # python 2
SIZE = ... |
import argparse
from collections import deque
import numpy as np
from sklearn.preprocessing import StandardScaler
import tensorflow as tf
from tensorflow.python import keras as K
from PIL import Image
import gym
import gym_ple
from fn_framework import FNAgent, Trainer, Observer
tf.compat.v1.disable_eager_execution()
... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Jun 4 11:46:32 2020
@author: petrapoklukar
"""
from matplotlib import pyplot as plt
import numpy as np
import h5py
# methods for creating splits for the sample efficiency test
def create_top_splits(images):
""" Randomly splits the entire 3dshape... |
# Copyright 2020 The TensorFlow 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 applica... |
from pathlib import Path
from sklearn.model_selection import train_test_split
from sklearn.svm import SVC
from threading import Thread, Lock
import random
import scipy
import logging
import fire
import uuid
import shutil
import os
import tqdm
import spacy
import numpy as np
import pickle
from sklearn_crfsuite import... |
# This file is part of datacube-ows, part of the Open Data Cube project.
# See https://opendatacube.org for more information.
#
# Copyright (c) 2017-2021 OWS Contributors
# SPDX-License-Identifier: Apache-2.0
import datetime
from unittest.mock import MagicMock
import numpy as np
import pytest
import pytz
from datacube... |
__author__ = 'Chirag'
import datetime
class Person(object):
def __init__(self, name):
"""create a person called name"""
self.name = name
self.birthday = None
self.last_name = name.split(' ')[-1]
def get_last_name(self):
"""return self's last name"""
return self.last_name
def __str__(self):
"""retur... |
import os
import re
import threading
import subprocess
from sklearn.model_selection import ParameterGrid
import json
import matplotlib.pyplot as plt
import matplotlib.colors as colors
import pandas as pd
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
import pkg_resources
import numpy as np
from matplotlib.l... |
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import importlib
import traceback
from textwrap import fill, indent
from typing import Dict, List
from pkg_resources import Requirement, WorkingSet
from pants.base.deprecated import warn... |
#! /usr/bin/env python
#
#
# GOAL
# - takes two sets of samples, and some parameter(s)
# - should be able to interchange samples provided with ILE *.xml.gz, *.composite, or posterior samples (preferred). FLEXIBILITY NOT YET IMPLEMENTED.
# Postfix determines behavior
# - performs specified test, with... |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (c) 2015-2017 <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
#
# ... |
# Copyright 2020 LMNT, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... |
"""
@author: lileilei
@file: views.py
@time: 2018/1/31 13:31
"""
from flask import redirect,request,\
render_template,session,url_for,flash,Blueprint,\
jsonify,make_response,send_from_directory
from app.models import *
from common.pares_excel_inter import pasre_inter
from flask.views import Meth... |
# Copyright 2021 The gRPC Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... |
from __future__ import annotations
from typing import Generator, TypeVar, Generic, Callable, Iterable, List
from abc import ABC, abstractmethod
from utils import compose, curry
E = TypeVar("E")
F = TypeVar("F")
A = TypeVar("A")
B = TypeVar("B")
class ResultError(Exception):
pass
class Result(ABC, Generic[A, E... |
import datetime as dt
from typing import Iterable, Tuple
from bravado.exception import HTTPForbidden, HTTPUnauthorized
from django.db import models
from django.utils.timezone import now
from esi.models import Token
from eveuniverse.models import EveEntity, EveSolarSystem, EveType
from allianceauth.services.hooks imp... |
# 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.
from typing import Optional, Sequence, Tuple
import jax
import jax.lax as lax
import jax.numpy as jnp
from jax.numpy import ndarray
from .... |
r"""Convert raw HAGA dataset in the format PASCAL to TFRecord for object_detection.
Example usage:
PYTHONPATH=$PYTHONPATH:/home/ubuntu/myproj/models/:/home/ubuntu/myproj/models/research:/home/ubuntu/myproj/models/research/object_detection python dataset_tools/create_haga_tf_record.py \
--set train \
... |
import json
from asyncio import CancelledError, create_task, ensure_future, shield, wait
from contextlib import suppress
from typing import Any, AsyncIterator, Callable, Dict, Optional, Set
from aiohttp import WSMsgType, web
from tartiflette_aiohttp._constants import (
GQL_COMPLETE,
GQL_CONNECTION_ACK,
G... |
#! /usr/bin/python
"""
Varmint Pest - Attempts to frighten away varmints such as raccoons
Created 7/04/17 by <NAME>
"""
import time, sys, os
import logging
from automat import MethodicalMachine
##import RPi.GPIO as GPIO
##import pigpio # http://abyz.co.uk/rpi/pigpio/python.html
##import spidev
##import Adafruit_ADS... |
# Tools for generating a simulation dataset that can be used to test and train strategy software
import json
import random
import math
class Array:
def __init__(self, cell_type="Max3", mode="Total_Area", area=4, cells=0, subs=2):
if mode == "Total_Area":
self.area = area # Use a single valu... |
# Events and event sequences
# Copyright (c) 2018-2019 <NAME>.
#
# This is free software released under the MIT License. See `LICENSE`
# for details.
import heapq
import itertools as itools
import operator
import sys
from . import interval
from . import sorted_search as sose
# Export public API
__all__ = (
'... |
# Standard import:
import os
import sys
import time
import shutil
import base64
from tkinter import *
from tkinter import StringVar
from tkinter import messagebox
# Downloaded packages import:
import cv2
import dlib
import pickle
import openpyxl as xl
import PIL.Image
import numpy as np
from openpyxl import *
from PIL... |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import copy
import logging
import numpy as np
import torch
from detectron2.data import detection_utils as utils
from detectron2.data import transforms as T
from detectron2.data.transforms import TransformGen
from detectron2.data import MetadataCat... |
# ===============================================================================
# Copyright 2015 <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/LI... |
from aldryn_apphooks_config.admin import BaseAppHookConfig
from aldryn_translation_tools.admin import AllTranslationsMixin
from cms.admin.placeholderadmin import FrontendEditableAdminMixin
from cms.admin.placeholderadmin import PlaceholderAdminMixin
from django.contrib import admin
from django.contrib.admin.filters imp... |
'''
Created on 02-Feb-2017
@author: dharmikp
'''
import logging
import getpass
from django.core.exceptions import ObjectDoesNotExist
from django.db import models, transaction
from django.utils import six
from django.shortcuts import get_object_or_404
from django.contrib.auth import get_user_model
from audit_trail.co... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
version = "1.1.0"
#imports:
import argparse #parsing arguments
import codecs #file encoding
from bs4 import UnicodeDammit #encoding detector
import csv #file read as csv and proccess
import os ... |
# Copyright 2014-2020 <NAME> <<EMAIL>>.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... |
# -*- coding: utf-8 -*-
# FOGLAMP_BEGIN
# See: http://foglamp.readthedocs.io/
# FOGLAMP_END
""" Test GCP Gateway plugin
"""
import os
import subprocess
import http.client
import json
import time
import pytest
from pathlib import Path
import utils
from datetime import datetime
__author__ = "<NAME>"
__copyright__ = ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: <NAME>
"""
from sklearn.metrics import f1_score
import numpy as np
import random
import xgboost as xgb
import matplotlib.pyplot as plt
random.seed(723)
np.random.seed(723)
def initilialize_poplulation(numberOfParents):
learningRate = np.empty([numberOf... |
# usr/bin/env python
# -*- coding:utf-8- -*-
# Up mode (上浮模式)
import tkinter as tk
from tkinter import messagebox
import random
cell_size = 30
C = 12
R = 20
height = R * cell_size
width = C * cell_size
FPS = 200 # 刷新页面的毫秒间隔
UP_SPACE = 2 # 上浮时间间隔
# 定义各种形状
SHAPES = {
"O": [(-1, -1), (0, -1), (-1, 0), (0, 0)],
... |
from functools import reduce
from dateutil.parser import parse
from django.db.models import Case, Count, F, IntegerField, Manager, Max, Sum, When
from kolibri.auth.models import FacilityUser
from kolibri.content.content_db_router import default_database_is_attached, get_active_content_database
from kolibri.content.mod... |
#!/usr/bin/env python
"""
Patroni exporter.
Collects metrics from Patroni (https://github.com/zalando/patroni)
and exports them in Prometheus (https://prometheus.io/) format
"""
__author__ = '<NAME>, Showmax Engineering'
__email__ = '<EMAIL>'
__date__ = '2019/03/22'
__version__ = '0.0.1'
from dateutil.parser import p... |
import json
import logging.config
import os
import re
from string import Template
from jans.pycloudlib import get_manager
from jans.pycloudlib.persistence import render_couchbase_properties
from jans.pycloudlib.persistence import render_base_properties
from jans.pycloudlib.persistence import render_hybrid_properties
f... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** 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 _utilities
fro... |
# -*- coding: utf-8 -*-
from bs4 import BeautifulSoup # 网页解析,获取数据
import re # 正则表达式,进行文字匹配
# import urllib.request # 制定URL,获取网页数据
# import urllib.error # 制定URL,获取网页数据
import requests # 制定URL,获取网页数据
# import xlwt # 进行Excel操作
import openpyxl # 进行Excel操作
import sqlite3 # 进行SQLite数据库操作
# 请求头 - header
headers = {... |
import os
import sqlite3
from typing import List, Optional, Union, cast
import structlog
from eth_utils import decode_hex, encode_hex, to_canonical_address, to_checksum_address, to_hex
from monitoring_service.events import (
ActionClaimRewardTriggeredEvent,
ActionMonitoringTriggeredEvent,
ScheduledEvent,
... |
# ## Description
#
# Topic Modelling is all about extracting **topics** from a corpus of documents. There are numerous methods to do this, however the end goal is the same. Determining what a particular document is about. Topic Modelling and Topic Classification are two entirely different aspects of the same problem ... |
"""Utilities to produce visualizations."""
from typing import List
import matplotlib.pyplot as plt
import numpy as np
import pywt
from common import GramType
very_light_gray = "#efefef"
light_gray = "#999999"
dark_gray = "#444444"
orange = "#EF6C00"
teal = "#007b96"
def _style_axis2d(ax, xlabel: str, ylabel: str)... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
import codecs
import shutil
import argparse
from functools import partial
import six
from six.moves import configparser
from . import docs, __version__
from .objects import KeyMap
PACKAGE = os.path.dirname(__file__)
HOME = os.path.expanduser(... |
import os
import cudf
import pandas as pd
import datetime
import argparse
import xgboost
from cuml.preprocessing.model_selection import train_test_split as cumlTTS
from cuml.ensemble import RandomForestRegressor as cumlRF
from cuml.metrics.regression import r2_score as cuml_r2
from azureml.core.run import Run
######... |
import logging
import os
import json
import unittest
from sarpy.io.complex.converter import open_complex
from sarpy.io.complex.sicd import SICDReader
from sarpy.io.complex.radarsat import RadarSatReader
from sarpy.io.complex.sentinel import SentinelReader
from sarpy.io.complex.tsx import TSXReader
from sarpy.io.comple... |
# Copyright 2013 OpenStack Foundation
# Copyright 2013 Antoine "hashar" Musso
# Copyright 2013 Wikimedia Foundation Inc.
# Copyright 2014 Hewlett-Packard Development Company, L.P.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You m... |
"""
model.py is used to train the Convolution Neural Network on dataset.
"""
from .helper import read_data
import tensorflow as tf
from numpy.random import seed
seed(43)
# Initialize parameters
batch_size = 16
classes = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
n_class = len(classes)
val_size = 0.25
img_size ... |
#! /usr/bin/env python
"""
Author: <NAME>
Date:
graph_helper, plotting output of the network
"""
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import cm
from termcolor import colored
from scipy.stats import gaussian_kde
import pandas as pd
from copy import deepcopy
from termcolor import colored
im... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
__init__.py
---------------------
Date : January 2016
Copyright : (C) 2016 by <NAME>
Email : <EMAIL>
****************************************************... |
#*********************************************************************
#* klt.h
#*
#* Kanade-Lucas-Tomasi tracker
#*********************************************************************/
from __future__ import print_function
#typedef float KLT_locType;
#typedef unsigned char KLT_PixelType;
#define KLT_BOOL int
#ifnd... |
"""
Author: Anonymous
Description:
Main file to run the algorithm.
"""
import os
import sys
import argparse
import datetime
import json
import logging
import warnings
warnings.filterwarnings('ignore')
import operator
from functools import reduce # forward compatibility for Python 3
import be... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Pictobot is a `Telegram <https://www.telegram.org/>`_ Bot, that is, a
`conversational program <https://en.wikipedia.org/wiki/Chatterbot>`_.
It is designed to help you communicate while you are traveling abroad.
"""
import logging
from collections import OrderedDict
fro... |
import logging
import re
import requests
import json
import base64
import time
from redash.query_runner import *
from redash.utils import json_dumps, json_loads
from tencentcloud.common import credential
from tencentcloud.common.profile.client_profile import ClientProfile
from tencentcloud.common.profile.http_profile... |
import os
import sys
import environs
import re
from sqlalchemy import create_engine
from sqlalchemy import text
import lib.utils as utils
from config import get_configs_by_filename
SELECT_ZEPHIR_BY_OCLC = """SELECT distinct z.cid cid, i.identifier ocn
FROM zephir_records as z
INNER JOIN zephir_identifier_rec... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# __author__ = "Sponge_sy"
# Date: 2021/6/30
from tqdm import tqdm
from sklearn import metrics
from bert4keras.tokenizers import Tokenizer
from bert4keras.models import build_transformer_model
from bert4keras.snippets import sequence_padding, DataGenerator
from utils imp... |
"""
Motivation:
The main idea is that one can manipulate entities by reference without possessing the actual source data.
Each entity is identified as a string 'origin/external_ref', where an origin is a hierarchical specification
with semantic significance (e.g. ecoinvent.3.4.cutoff) and the 'external_ref' is the uniq... |
import os
import tkinter as tk
from tkinter import ttk
from tkinter import messagebox
from tkinter import filedialog
import tkinter.font as font
from rFactory import MainWindow, Tabs
import tabScenarios
from data.rFactoryConfig import modMakerFilesFolder, rF2root, SteamExe
from data.utils import readFile, readTextFile... |
"""
@file
@brief Common functions to reduce the number of
nodes of an :epkg:`ONNX` graphs.
"""
from onnx.helper import make_graph, ValueInfoProto, make_model
from onnx import AttributeProto, NodeProto
from onnx.helper import make_attribute
def _apply_optimisation_on_graph(fct, onnx_model, recursive=True, debug_info=N... |
# -*- coding: utf-8 -*-
"""Message migration tools (Broker <-> Broker)."""
from __future__ import absolute_import, print_function, unicode_literals
import socket
from functools import partial
from itertools import cycle, islice
from kombu import Queue, eventloop
from kombu.common import maybe_declare
from k... |
# -*- coding: utf-8 -*-
'''
:synopsis: Unit Tests for Advanced Packaging Tool module 'module.aptpkg'
:platform: Linux
:maturity: develop
versionadded:: 2017.7.0
'''
import copy
import textwrap
from tests.support.mixins import LoaderModuleMockMixin
from tests.support.unit import TestCase, skipIf
from t... |
"""Sets up the weights and biases script and
provides functionality to get data from wandb."""
import os
from typing import Optional, List, Union, Tuple
import math
import numpy as np
import pandas as pd
import wandb
import logging
from omegaconf import DictConfig, OmegaConf
from subprocess import PIPE, run
from src.co... |
# Copyright 2021, 2022 IBM Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... |
"""
"""
import decimal
import itertools
from typing import Union
import boto3
from botocore.exceptions import ClientError as BotoCoreClientError
from bson import decimal128, ObjectId
from bson.dbref import DBRef
from eve.io.base import DataLayer
from eve.utils import ParsedRequest, config, debug_error_message, str_to_... |
"""
The minimize module handles helper routines for equilibrium calculation.
"""
from __future__ import division
import pycalphad.variables as v
import scipy.spatial.distance
from sympy.utilities import default_sort_key
from sympy.utilities.lambdify import lambdify
from sympy.printing.lambdarepr import LambdaPrinter, N... |
# coding=utf-8
# Copyright 2018 The Google AI Language Team 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 ... |
# -*- coding: utf-8 -*-
"""
lantz.drivers.newport.motionesp301
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Implements the drivers to control ESP300 and ESP301 motion controller
via USB or serial.
For USB, one first have to install the windows driver from newport.
:copyright: 2015, see AUTHORS... |
#!/usr/bin/python
import db
import rest
import unittest
class MockDb(db.Db):
def __init__(self):
self.objs = {
"": (db.Db.DIR, [("a")]),
"a": (db.Db.DIR, [("a/5566", ), ("a/183", ), ]),
"a/183": (db.Db.FILE, "183 club"),
"a/5566": (db.Db.FILE, "Asian god group: 5566"),
"not_exist"... |
'''
Build the pipeline workflow by plumbing the stages together.
'''
from ruffus import Pipeline, suffix, formatter, add_inputs, output_from, regex
from stages import Stages
import glob
from utils import safe_make_dir
def make_pipeline_map(state):
'''Build the pipeline by constructing stages and connecting them t... |
from tqdm import tqdm
import numpy as np
import math
import torch
from torch import nn
from torch.nn import functional as F
import modules
import commons
import attentions
import monotonic_align
import unet
class DurationPredictor(nn.Module):
def __init__(self, in_channels, filter_channels, kernel_size, p_dropout):... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.