text stringlengths 3.07k 22.1k |
|---|
#!/usr/bin/env python
#############################################################################
##
# This file is part of Taurus
##
# http://taurus-scada.org
##
# Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
##
# Taurus is free software: you can redistribute it and/or modify
# it under the terms of t... |
# Copyright 2018, OpenCensus 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 w... |
"""
The core m3gnet model
"""
import json
import logging
import os
import urllib.request
from typing import List, Optional
import numpy as np
import tensorflow as tf
from m3gnet.graph import Index, RadiusCutoffGraphConverter, tf_compute_distance_angle
from m3gnet.layers import (
MLP,
AtomReduceState,
Atom... |
#!/usr/bin/env vpython3
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Usage: %prog [options] [<commitref>]*
If no <commitref>'s are supplied, it defaults to HEAD.
Calculates the generation number fo... |
#!/usr/bin/env python
"""Implementation of artifact types."""
import json
import re
import yaml
from grr.lib import artifact_lib
from grr.lib import objectfilter
from grr.lib import parsers
from grr.lib import rdfvalue
from grr.lib.rdfvalues import structs
from grr.proto import artifact_pb2
from grr.proto import flow... |
import asyncio
import cbor
import sys
from recoverable_wallet import RecoverableWallet
from chiasim.clients.ledger_sim import connect_to_ledger_sim
from chiasim.wallet.deltas import additions_for_body, removals_for_body
from chiasim.hashable import Coin, Header, HeaderHash, Body
from chiasim.hashable import ProgramHash... |
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
from datetime import datetime
import logging
from rest_framework import status
from rest_framework.mixins import RetrieveModelMixin, ListModelMixin, DestroyModelMixin
from rest_framework.parsers import MultiPartParser
from rest_framework.relations import PrimaryKeyRelatedField
from rest_framework.renderers import JSON... |
# -*- coding: utf-8 -*-
import operator
import os.path
from django.conf import settings
from django.core.urlresolvers import reverse
from django.db import models
from django.dispatch import receiver
from django_extensions.db.fields.json import JSONField
import mkt
from lib.utils import static_url
from mkt.api.fields... |
#python script to convert a croesus rebalancing output to a national bank independent network
#mutual fund trade list.
import pandas as pd
import numpy as np
import argparse
import sys
import datetime as dt
import os
from enum import Enum
from pathlib import Path, PureWindowsPath
pd.set_option('display.min_rows', 100... |
import json
import unittest
from argparse import ArgumentParser
from contextlib import contextmanager
from pprint import pprint
from typing import Dict, List
from unittest.mock import MagicMock, patch
import sys
import shlex
from wx._core import CommandEvent
from gooey import GooeyParser
from python_bindings.coms im... |
#
# Tests for the struct-wrappers for NSPoint, NSSize, NSRange and NSRect.
#
from Foundation import *
from PyObjCTools.TestSupport import *
import operator
def do_set_slice(op, start, stop, value):
op[start:stop] = value
def do_del_slice(op, start, stop):
del op[start:stop]
class TestNSPoint (TestCase):
... |
"""The tests for the nx584 sensor platform."""
import requests
import unittest
from unittest import mock
from nx584 import client as nx584_client
from homeassistant.components.nx584 import binary_sensor as nx584
from homeassistant.setup import setup_component
from tests.common import get_test_home_assistant
import p... |
"""Tests for profiles.serializers"""
import pytest
from rest_framework.exceptions import ValidationError
from profiles.factories import UserFactory, LegalAddressFactory
from profiles.models import ChangeEmailRequest
from profiles.serializers import ChangeEmailRequestUpdateSerializer
from profiles.serializers import L... |
from datetime import date
from typing import Dict
from fastapi import APIRouter, Request
from fastapi.param_functions import Depends
from sqlalchemy.orm.session import Session
from starlette.responses import RedirectResponse, Response
from app.database.models import SalarySettings
from app.dependencies import get_db,... |
import logging
from typing import Iterator, List, Optional, Tuple
import ida_ua
import ida_name
import ida_funcs
import ida_idaapi
import ida_kernwin
import ida_dirtree
from ida_dirtree import dirtree_t
logger = logging.getLogger("tag_func")
def dirtree_find(dir, pattern) -> Iterator[ida_dirtree.dir... |
# SPDX-License-Identifier: MIT
from ..utils import chexdump
from ..malloc import Heap
from construct.core import *
from ..fw.agx.channels import *
from ..fw.agx.cmdqueue import *
from ..fw.agx.controllist import *
from ..hw.uat import MemoryAttr
from .object import *
import textwrap
class GPUContext:
def __init__(... |
# !/usr/bin/env python3
"""DeepGRP main for prediction with pretrained model """
from typing import Iterator, Tuple, TextIO, List
import sys
import os
import argparse
import logging
import numpy as np
import tensorflow as tf
import deepgrp.prediction as dgpred
import deepgrp.model as dgmodel
import deepgrp.training as ... |
"""Clip tests."""
import copy
import cupy as np
import pytest
from moviepy.Clip import Clip
from moviepy.video.VideoClip import BitmapClip, ColorClip
def test_clip_equality():
bitmap = [["RR", "RR"], ["RB", "RB"]]
different_bitmap = [["RR", "RB"], ["RB", "RB"]]
different_duration_bitmap = [["RR", "RR"... |
import re
import numpy as np
import pytest
from pandas.compat import pa_version_under1p01
import pandas as pd
import pandas._testing as tm
from pandas.core.arrays.string_ import (
StringArray,
StringDtype,
)
from pandas.core.arrays.string_arrow import ArrowStringArray
skip_if_no_pyarrow = pytest.mark.skipif... |
# TODO: Ensure that functions marked for inlining aren't recursive to
# prevent infinite loops.
from typing import Collection, List, Sequence, Set, Tuple
from asts import lowered, visitor
from scope import Scope
calc_threshold = lambda value: value * 20
def expand_inline(tree: lowered.LoweredASTNode, level: int) -... |
import threading
import queue
from .DyEvent import *
class DyTimerHand(threading.Thread):
def __init__(self, queue, eventEngine):
super().__init__()
self._intervals = {} # {interval: interval count}
self._queue = queue
self._eventEngine = eventEngine
def run(self):
w... |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
"""Provides a non - parametric two - stage least squares instrumental variable estimator."""
import numpy as np
from copy import deepcopy
from sklearn import clone
from sklearn.linear_model import LinearRegression
from .util... |
#!/usr/bin/env python3 -u
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import pathlib
import random
import numpy as np
import torch
import torch.nn.utils.prune as prune
im... |
import pycuda.driver as cuda
import pycuda.autoinit
import numpy as np
import tensorrt as trt
import cv2
import torch
import time
from albumentations import Resize, Compose
from albumentations.pytorch.transforms import ToTensorV2
from albumentations.augmentations.transforms import Normalize
from data import test_datase... |
import os
import unittest
import ray
from ray.tune import run_experiments
from examples.rllib.figure_eight import setup_exps as figure_eight_setup
from examples.rllib.traffic_light_grid import setup_exps as traffic_light_grid_setup
from examples.rllib.stabilizing_highway import setup_exps as highway_setup
from exampl... |
from math import inf
import re
import itertools
import bisect
import typing
__all__ = [
'IntSeqPredicate',
'IntSeqIter',
'UnboundedPredicateError',
]
IntOrISeq = typing.Union[int, typing.Sequence[int]]
_DNFAtom = typing.Optional[typing.Tuple[typing.Optional[int],
t... |
import boto3
import config
import argparse
import json
from collections import defaultdict
from sawmill.logger import Sawmill
logger = Sawmill.new_logger(__name__)
def get_instance_data(region, token) -> dict:
'''Get all of the data about EC2 instances in a region
param region: The region the instanc... |
"""Compare free Green's function solvers in imaginary time,
DLR, and Matsubara space.
Copyright 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://www.apache.org/licenses/LICENSE-... |
# coding:utf-8
# Produced by <NAME>
# 13_Aug_2019
import os
import re
import gc
import sys
import json
import pickle
import codecs
import collections
from itertools import chain
from pathlib import Path
from utils.log import log_info as _info
from utils.log import log_error as _error
from multiprocessing import Pool
... |
from flask import *
from datetime import datetime
import config
from app import db, utils
from .model import User
from ..changelog.model import ChangeLog
from ..transaction.model import Transaction
from ..trade.model import Trade
import re
from flask_cors import CORS
mod_user = Blueprint('user', __name__)
CORS(mod_u... |
from rllab.misc import ext
from rllab.misc import krylov
from rllab.misc import logger
from rllab.core.serializable import Serializable
# from rllab.misc.ext import flatten_tensor_variables
import itertools
import numpy as np
import tensorflow as tf
from sandbox.rocky.tf.misc import tensor_utils
from rllab.misc.ext imp... |
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import os
from typing import Any, Callable, Iterator, List, Optional, Sequence, Tuple, Union
from torch.utils... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Aug 26 21:38:13 2020
@author: elijahsheridan
"""
import numpy as np
import opt_helper as opt
import bisect as bs
import scipy
import matplotlib.pyplot as plt
def cross_sec_heatmap():
ms = np.log10([1, 1e3, 1e5])
Ls = np.array([i/2 for i in ran... |
import torch as th
import torchvision as vision
import pytorch_lightning as thl
from pytorch_lightning.utilities.enums import DistributedType
import os
import re
import pytorch_lightning.metrics.functional
import torch.nn.functional as F
from torch.utils.data import DataLoader
from .. import datasets
from .. import con... |
import os
import sys
import shutil
import numpy as np
import time, datetime
import torch
import random
import logging
import argparse
import torch.nn as nn
import torch.utils
import torch.backends.cudnn as cudnn
import torch.distributed as dist
import torch.utils.data.distributed
sys.path.append("../../")
from utils.u... |
# Copyright 2021 c00k1ez (https://github.com/c00k1ez). 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 requi... |
# Authors: <NAME>
# <NAME>
# <NAME>
#
# License: BSD-3
import mne
import numpy as np
from mne.io import concatenate_raws
from skorch.helper import predefined_split
from torch import optim
from torch.nn.functional import nll_loss
from braindecode.classifier import EEGClassifier
from braindecode.datas... |
from abc import ABCMeta, abstractmethod
from piquery.piqimg import ImgDownloader, ImgTransformer, ImgFeature
from piquery.piqdb import MysqlDb
from piquery.piqlog import PiqLog
from time import time
from piquery.piq_config import config as db_cfg
from piquery.piq_error import DownloadError, ImageFormatError
from piquer... |
import itertools
import unittest
from unittest import mock
from devpotato_bot.dice_parser import Dice, ParseError, ValueRangeError, ResultsKeepStrategy, RollResult
class ResultsKeepStrategyMock:
def __init__(self, total, discard):
self._expected_total = total
self._discarded_default = discard
... |
"""
Module with functions for plotting the results of the full workup and a small script at the end.
"""
import os
import shutil
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from read import *
results_folder = r'E:\hurricane\results'
# folder of results (each csv represents a parameter and... |
from brownie import *
from brownie.network.contract import InterfaceContainer
import json
import time;
import copy
from scripts.utils import *
import scripts.contractInteraction.config as conf
def redeemFromAggregator(aggregatorAddress, tokenAddress, amount):
abiFile = open('./scripts/contractInteraction/ABIs/ag... |
from datetime import datetime
from functools import lru_cache
from houdini.data import db
class Penguin(db.Model):
__tablename__ = 'penguin'
id = db.Column(db.Integer, primary_key=True, server_default=db.text("nextval('\"penguin_id_seq\"'::regclass)"))
username = db.Column(db.String(12), nullable=False,... |
import numpy as _numpy
import matplotlib.pyplot as _plt
from typing import Tuple as _Tuple
from ._version import get_versions
from __psvWave_cpp import fdModel as fdModel
__version__ = get_versions()["version"]
__full_revisionid__ = get_versions()["full-revisionid"]
__date__ = get_versions()["date"]
# No need to mak... |
from io import BufferedIOBase, BytesIO
from typing import Dict, List, Optional, Tuple
import typing
import magic
from werkzeug.datastructures import FileStorage
from neo4japp.models.files import Files
from neo4japp.services.file_types.exports import ExportFormatError, FileExport
class BaseFileTypeProvider:
"""... |
import os
import shutil
from time import time
from functools import wraps
from subprocess import Popen, DEVNULL, PIPE, STDOUT
from tempfile import mkdtemp
import multiprocessing
import multiprocessing.pool
from autode.log import logger
from autode.exceptions import (NoAtomsInMolecule,
NoC... |
# coding: utf-8
from __future__ import (unicode_literals, print_function, absolute_import,
division)
import uuid
from datetime import datetime
from django.conf import settings
from django.contrib.auth.models import User
from django.shortcuts import render, get_object_or_404, redirect
from dj... |
import serial
import serial.tools.list_ports
import datetime
import random
import signal
#import numpy as data_array
#import os
from time import sleep
import sys
poly32 = 0x1EDC6F41
CDC_DATA_IN_BUFFER_SIZE = (64*1024)
def py_crc32(L):
rem = 0
for b in L:
rem = rem ^ (b << 24)
for i in range... |
import six
import os
import time
import numpy as np
import tensorflow as tf
import logging
from eight_mile.tf.optz import optimizer
from eight_mile.utils import to_spans, Offsets, revlut, span_f1, per_entity_f1, conlleval_output, write_sentence_conll
from eight_mile.progress import create_progress_bar
from baseline.tr... |
#!/usr/bin/env python3
# standard libraries
import datetime as dt
import logging
import os
import sys
seek_count = 0
def binary_search(fh, width, state_width, linecount, state_to_find):
global seek_count
first = 0
last = linecount - 1
b_state_to_find = bytearray(state_to_find, encoding="utf-8")
... |
import pandas as pd
# import numpy as np
import networkx as nx
import pyodbc
import sqlite3
import matplotlib.pyplot as plt
from matplotlib.backends.backend_pdf import PdfPages
import matplotlib.gridspec as gridspec
from datetime import datetime
import os
import config.sql_queries as sql_queries # sql_quer... |
"""
To run the code for each problem, simply run the 'runP#.py' file.
So for this problem, run runP1.py
The P#classes.py files are very similar across problems,
but each includes a scaling which is (roughly) optimized for that specific problem.
The runP#.py file will automatically import the necessary classes from th... |
# <NAME>, 2019
# Institute of Astrophysics and Space Sciences, Porto, Portugal
# <EMAIL>
# compatibility with python 2/3:
from __future__ import print_function
from __future__ import division
import numpy as np
try:
from astroquery.simbad import Simbad
except:
print("*** WARNING: astroquery is not installed bu... |
import numpy as np
import torch
from up.utils.general.registry_factory import ROI_SUPERVISOR_REGISTRY
from up.tasks.det_3d.models.utils.center_utils import gaussian_radius
__all__ = ['BaseCenterSupervisor', 'CenterSupervisor']
class BaseCenterSupervisor(object):
def __init__(self, feature_map_stride, num_max_obj... |
#! /usr/bin/env python
# Copyright 2017 Google 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 o... |
import torch
import operator
from torch.autograd import Variable
from .lazy_variable import LazyVariable
from functools import reduce
def _prod(iterable):
return reduce(operator.mul, iterable, 1)
def _matmul(sub_matmul_closures, sizes, tensor):
res = tensor.contiguous()
is_batch = tensor.ndimension() ==... |
#!/usr/bin/env python3
# An open-source IDE for python, java, and C++
# By <NAME> <EMAIL>
# Feel free to change code as you feel
import sys
import os
# For running commands in the terminal
try:
from tkinter import *
from tkinter import messagebox
from tkinter import filedialog
except:
os.system('sudo ... |
"""
Implementation of "Attention is All You Need"
"""
import math
import torch.nn as nn
import torch
from abstractive.attn import MultiHeadedAttention, MultiHeadedPooling
from abstractive.neural import PositionwiseFeedForward, PositionalEncoding, sequence_mask
class TransformerEncoderLayer(nn.Module):
"""
A... |
# -*- coding: utf-8 -*-
"""
Miscellaneous functions for plotting, logging, data output, fitting etc
"""
import numpy as np
import matplotlib
from matplotlib import rcParams
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import matplotlib.animation as animation
from matplotlib.ticker import MaxNLocator, For... |
from app.linuxweb.common import *
import urllib,traceback
class modeldoctext(model.model):
"文档内容"
config={'type':'sqlite','db':config.doc['db']}
model.dbtype.conf=config
table="doctext"
fields={
"id":model.dbtype.int(LEN=11,PRI=True,A_L=True), #设置id为自增主键
'doclist_id':model.dbt... |
# Profile settings
# Author: <NAME>, 2019, 2020
"""Profile settings to setup common configurations.
Each profile has a default set of settings, which can be modified through
"modifier" sub-profiles with groups of settings that overwrite the
given default settings.
"""
from enum import Enum, auto
import glob
import ... |
import cv2
import os
import sys
import shutil
import tempfile
import numpy as np
import face_alignment
from model import LipNet
from dataset import MyDataset
from PIL import ImageFont, ImageDraw, Image
import torch
import torch.nn as nn
def get_position(size, padding=0.25):
x = [0.000213256, 0.0752622, 0.181... |
#! /usr/bin/python
# -*- coding:utf-8 -*-
import sys
import random
from time import sleep
from threading import Thread
from flask import Flask, request, render_template
from flask_socketio import SocketIO, emit
sys.path.append("d:/workspace/pylivy/")
sys.path.append("../../lib")
# from livy.session import *
import l... |
import tensorflow as tf
import numpy as np
import time
import random
import pickle
import math
import datetime
from keras.preprocessing.image import ImageDataGenerator
#预先定义的变量
class_num = 10
image_size = 32
img_channels = 3
iterations = 200
batch_size = 250
weight_decay = 0.0003
dropout_rate = 0.5
momentum_rate = 0.9... |
# Copyright (consent) 2017-2018 CRS4
#
# 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, dis... |
import os
import traceback
from datetime import datetime
from typing import Tuple
from ....general.AbstractLineAction import AbstractLineAction
from ....models.ChiaWatchdog import ChiaWatchdog
from ....models.MadMaxPlotInProgress import MadMaxPercentages, MadMaxPlotInProgress
from ....utils.logger import get_logger
... |
"""
Utility functions for dbbackup.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import sys
import os
import traceback
import tempfile
import gzip
import re
import logging
from getpass import getpass
from shutil import copyfileobj
from functools import wraps
from datetime impo... |
#!/usr/bin/env python3
import argparse
import io
import json
import os
import sys
import copy
from datetime import datetime
from decimal import Decimal
from tempfile import mkstemp
from joblib import Parallel, delayed, parallel_backend
from jsonschema import Draft7Validator, FormatChecker
from pipelinewise_singer imp... |
#!/usr/bin/env python3
import sqlite3
import youtube_dl
import json
import re
import os
import spotify
#******************************************************************************
# Table structure:
# 1. The whole title text of the video
# - id --> primary key
# - title
# - length
# - youtubeID
# - id_trac... |
"""
Utilities for programmatically constructing a latex document
"""
import os
import pyllars.shell_utils as shell_utils
def vspace(out, vspace):
out.write("\n\\vspace{")
out.write(vspace)
out.write("}\n\n")
def begin_numbered_list(out):
out.write("\\begin{enumerate}\n")
def end_numbered_list(out):
... |
# coding: utf-8
from __future__ import unicode_literals
import random
import re
import string
import time
from .common import InfoExtractor
from ..utils import (
ExtractorError,
get_element_by_class,
js_to_json,
str_or_none,
strip_jsonp,
)
class YoukuIE(InfoExtractor):
IE_NAME = 'youku'
... |
import time
import math
import sys
import os
"""
# simplepytimer
Measure the duration of python code by creating an timer objects with only a name.
Two simple time measurement classes:
Timer is single entrant and measure time since last occurrence.
MultiTimer remembers the name for a measure point and can be used in ... |
# encoding: utf-8
import numpy as np
import chainer
from chainer import cuda
import chainer.functions as F
import chainer.links as L
from chainer import reporter
from seq2seq import source_pad_concat_convert
from subfuncs import gradient_multiplier
from weight_normalization import weight_normalization as WN
scale05... |
import logging
import sys
import time
import random
import pprint
from disco.worker.classic.worker import Params
from disco.job import Job
from inferno.lib.archiver import Archiver
from inferno.lib.disco_ext import get_disco_handle
from inferno.lib.job_options import JobOptions
from inferno.lib.result import reduce_r... |
"""
Line-intersection-based fitting.
Contact: <NAME> <<EMAIL>>
"""
from ctapipe.reco.reco_algorithms import (
Reconstructor,
InvalidWidthException,
TooFewTelescopesException
)
from ctapipe.containers import ReconstructedShowerContainer
from itertools import combinations
from ctapipe.coordinates import (... |
"""Multi-agent traffic light example (single shared policy)."""
import json
import argparse
import ray
try:
from ray.rllib.agents.agent import get_agent_class
except ImportError:
from ray.rllib.agents.registry import get_agent_class
from ray.rllib.agents.ppo.ppo_policy_graph import PPOPolicyGraph
from ray imp... |
from astropy.io import fits
import scipy.io as sio
from scipy.ndimage.filters import convolve as convolveim
import matplotlib.pyplot as plt
import ikernal23 as iker
import cv2
import os
from sklearn import cluster
import numpy as np
import pandas as pd
"""
fits.getdata()
return file style:numpy.ndarray
... |
# -*- coding: utf-8 -*-
"""Views tests for the Box addon."""
from django.utils import timezone
import httplib
from nose.tools import * # noqa (PEP8 asserts)
import mock
import pytest
from urllib3.exceptions import MaxRetryError
from framework.auth import Auth
from website.util import api_url_for
from boxsdk.exception... |
# Copyright (c) 2011-2015 Berkeley Model United Nations. All rights reserved.
# Use of this source code is governed by a BSD License (see LICENSE).
import json
import requests
from decimal import Decimal
from django.conf import settings
from django.core.exceptions import ValidationError
from django.core.mail import ... |
# Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use ... |
# -*- coding: utf-8 -*-
"""
Preprocess the reaxys data (.xlsx)
"""
import os
import pandas as pd
import argparse
from rxn_yield_context.preprocess_data.preprocess import CheckNaN, CheckYield, GetFrequencyDict, plot_frequency
from rxn_yield_context.preprocess_data.preprocess import remove_invalid_smiles, tr... |
# Copyright 2018-2019 ForgeFlow, S.L.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl-3.0).
from datetime import datetime
from odoo import _, api, fields, models
from odoo.exceptions import UserError
class PurchaseRequestLineMakePurchaseOrder(models.TransientModel):
_name = "purchase.request.line... |
import numpy as np
from scipy.spatial.distance import pdist, squareform, cdist
import scipy.stats
import scipy.integrate
import math
import yaml
import os
import torch
import mdtraj
import multiprocessing as mp
"""
Compute the KSD divergence using samples, adapted from the theano code
"""
# From https://github.com/Y... |
# Copyright 2014 PerfKitBenchmarker 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... |
from __future__ import annotations
from typing import *
import sys # for exception chaining
from . import edgir
class PathException(Exception):
pass
class Path(NamedTuple): # internal helper type
blocks: Tuple[str, ...]
links: Tuple[str, ...]
ports: Tuple[str, ...]
params: Tuple[str, ...]
def __hash... |
"""
The Trainer class prepares and launches training of a model.
Most importantly, it compiles the tf.keras Model object with according to the
specified optimizer, loss and metrics and implements the .fit method for
training the model given a set of parameters and (non-initialized) callbacks.
"""
import tensorflow as ... |
import random
import typing
from enum import IntEnum
from importlib import import_module
from pathlib import Path
import joblib
import numpy as np
from sklearn.ensemble import (
RandomForestClassifier,
GradientBoostingClassifier
)
from sklearn.metrics import (
accuracy_score,
precision_recall_fscore_su... |
import math
from teacher import TQs
from timedWord import TimedWord, DRTW_to_LRTW, LRTW_to_LTW, ResetTimedWord
class ObsTable(object):
def __init__(self, S, R, E):
self.S = S
self.R = R
self.E = E
def show(self):
print("new_E:" + str(len(self.E)))
for e in self.E:
... |
import numpy as np
import torch
import torch.nn.functional as F
def complex_mul(tensor_1: torch.Tensor,tensor_2: torch.Tensor,mode='cc')-> torch.Tensor:
'''
:param tensor_1(2) [...,2] for real part and image part
'''
if mode == 'cc':
assert tensor_1.shape[-1]==2
assert tensor_2.shape[-1... |
# Copyright 2019-2020 <NAME> All Right 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... |
import math
from scipy.optimize import fsolve
from sim21.data.chemsep_consts import GAS_CONSTANT
from sim21.data.eqn import eval_eqn, eval_eqn_int, eval_eqn_int_over_t
import numpy as np
def fixed_properties(tb, sg, mw):
"""
Obtain the key fixed properties using the Twu correlations
:param tb: boiling poi... |
import json
import codecs
import tldextract
import pickle
import random
import copy
import matplotlib.pyplot as plt
# One of 'city', 'name', 'phone'
VARIABLE = 'phone'
with open('backpage.com/nebraska.json', "rb") as fp:
urls = pickle.load(fp)
count = 0
def preprocess(urls):
ad_to_extraction = dict()
ex... |
##############################################################################
# Copyright (c) 2003 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTW... |
#!/usr/bin/env python
__Author__ = "<NAME>"
# ROS import
import rospy
import rospkg
from geometry_msgs.msg import Twist, Vector3Stamped, Pose, PoseWithCovarianceStamped
from sensor_msgs.msg import Imu
#from cv_bridge import CvBridge, CvBridgeError
from std_msgs.msg import Empty
# Required Libraries
import time, csv
i... |
# 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
#
# Authors:
# - <NAME>, <EMAIL>, 2017-2018
import json
import logging
import os
import Queue
impor... |
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
# import palettable # tcrdist not found
from sklearn.decomposition import PCA, KernelPCA
from sklearn.manifold import Isomap, LocallyLinearEmbedding, TSNE, MDS
"""Embedding of pairwise-distance matrices."""
__all__ = [ 'embedDistanceMatrix',
... |
#!/usr/bin/python
import logging
import os
import xml
import tensorflow as tf
from math import ceil
from xl_tool.xl_io import file_scanning, save_to_json
import threading
import tensorflow_addons as tfa
import random
from xl_tensorflow.utils.common import _bytes_feature, _bytes_list_feature, _float_feature, _float_lis... |
# -*- coding: utf-8 -*-
"""
GitHub-Flask
============
Authenticate users in your Flask app with GitHub.
"""
import logging
try:
from urllib.parse import urlencode, parse_qs
except ImportError:
from urllib import urlencode
from urlparse import parse_qs
from functools import wraps
import reques... |
#
# This source file is part of the EdgeDB open source project.
#
# Copyright 2011-present MagicStack Inc. and the EdgeDB 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... |
import json
import os
from io import BytesIO
from os.path import join
import corehq.blobs.migrate as mod
from corehq.blobs import get_blob_db, CODES
from corehq.blobs.s3db import maybe_not_found
from corehq.blobs.tests.util import (
new_meta,
TemporaryFilesystemBlobDB,
TemporaryMigratingBlobDB,
)
from dja... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.