text stringlengths 3.07k 22.1k |
|---|
import tensorflow as tf
import utils
extract_patches_module = tf.load_op_library('extract_patches_op/extract_patches.so')
extract_patches = extract_patches_module.extract_patches
tf.NotDifferentiable('ExtractPatches')
def align_reference_shape(reference_shape, reference_shape_bb, im, bb):
def norm(x):
re... |
import os
import os.path as osp
import re
from typing import Tuple
from pathlib import Path
import torch
from colossalai.context import Config
from colossalai.context.parallel_mode import ParallelMode
from colossalai.core import global_context as gpc
__all__ = [
'get_checkpoint_path', 'get_latest_checkpoint_path... |
"""
sphinx.util.i18n
~~~~~~~~~~~~~~~~
Builder superclass for all builders.
:copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import gettext
import os
import re
import warnings
from collections import namedtuple
from datetime import datetim... |
"""Driver for CCS811 VOC sensor"""
from smbus2 import SMBus
from time import sleep
from .i2c_base import (
Device,
Encoder,
Register,
Field,
LookupTable,
BaseDeviceAPI,
BaseRegisterAPI,
ReadOnlyRegisterAPI,
)
class HumidityFixedPoint(Encoder):
def encode(self, value: float, field:... |
import sys
import threading
import time
import warnings
from collections import namedtuple
from contextlib import contextmanager
from math import log10
from threading import Thread, Lock
from typing import Tuple
from phi import field
from phi.field import SampledField, Scene
from phi.math import Shape, EMPTY_SHAPE
Co... |
# -*- coding: utf-8 -*-
__author__ = "<NAME>, <NAME>"
__copyright__ = "CentraleSupelec, 2020"
__license__ = "MIT"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
__status__ = "alpha"
import math
import os
from multiprocessing import Pool
import emcee
import numpy as np
import matplotlib.pyplot as plt
from scipy impor... |
# -*- coding: utf-8 -*-
###############################################################################
# This file is part of metalibm (https://github.com/kalray/metalibm)
###############################################################################
# MIT License
#
# Copyright (c) 2018 Kalray
#
# Permission is here... |
import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
import gym
import matplotlib.pyplot as plt
import random
from collections import OrderedDict
from copy import copy
import argparse
import sys
import os
sys.path.append("../utility/")
from torch.utils.tensorboard import SummaryWriter
f... |
#!/usr/bin/env python
"""Tests of the geometry package."""
from math import sqrt
from numpy import (
all,
allclose,
arange,
array,
insert,
isclose,
mean,
ones,
sum,
take,
)
from numpy.linalg import inv, norm
from numpy.random import choice, dirichlet
from numpy.testing import as... |
import collections
import functools
import json
import os
import shutil
import sys
from distutils.dir_util import copy_tree
from io import BytesIO
from pathlib import Path
from typing import Callable, Iterable, List, Tuple
from urllib.parse import urlparse
import pytest
from click.testing import CliRunner
from pip._in... |
# coding=utf-8
# Copyright 2019 The Tensor2Tensor 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... |
"""Support for package tracking sensors from 17track.net."""
from datetime import timedelta
import logging
from py17track import Client as SeventeenTrackClient
from py17track.errors import SeventeenTrackError
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const... |
import os
import sys
import numpy as np
from scipy.stats import logistic
from scipy.stats import spearmanr
from sklearn.naive_bayes import MultinomialNB
from sklearn.linear_model import LogisticRegression
from sklearn.linear_model import LinearRegression, Ridge
from sklearn.metrics import r2_score
from sklearn.neural_n... |
import csv
import io
import json
import os
import platform
import re
import sys
import time
from builtins import next
from time import sleep
import progressbar
from django.conf import settings
from django.contrib.sites.models import Site
from django.db.models import OuterRef
from django.db.models import Q
from django.... |
"""Nomad Class Handler for Interaction with NomadBLDC Board"""
# DataContainers.py
#
# Created on: March 28, 2020
# Author: <NAME>
#
# Copyright (c) <2020> <<NAME> - <EMAIL>/>
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files... |
#!/usr/bin/env python
import re
import random
import string
import threading
from tests import unittest, OrderedDict
from jmespath import parser
from jmespath import visitor
from jmespath import ast
from jmespath import exceptions
class TestParser(unittest.TestCase):
def setUp(self):
self.parser = parser... |
import importlib
import logging
import os
from datetime import datetime
from time import sleep
from random import randint
from tenacity import before_sleep_log, retry, stop_after_attempt, wait_exponential
from migrator.utilities.AwsUtilities import AwsUtilities
from migrator.utilities.LambdaUtilities import lambda_code... |
# --------------------------------------------------------
# Relation Networks for Object Detection
# Copyright (c) 2017 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by <NAME>
# --------------------------------------------------------
import os
import random
import cv2
import numpy ... |
#!/usr/bin/python3
from __future__ import print_function
import os
import sys
import torch
import torch.optim as optim
import torch.backends.cudnn as cudnn
import torch.utils.data as data
import argparse
import time
import datetime
import math
import numpy as np
from config import cfg
sys.path.append(os.getcwd() + ... |
"""
AWAD API requester.
"""
import aiohttp
import asyncio
import settings
from xmlschema import XMLSchema
import xml.etree.ElementTree as ETree
from datetime import datetime
from pyawad.util import updated, load_schema
class RequestException(Exception):
""" Base AWAD API request exception. """
_request = N... |
# This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2018.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivat... |
# Pathfinding - Part 5
# A* Search
# KidsCanCode 2017
import pygame as pg
from os import path
import heapq
vec = pg.math.Vector2
TILESIZE = 48
GRIDWIDTH = 28
GRIDHEIGHT = 15
WIDTH = TILESIZE * GRIDWIDTH
HEIGHT = TILESIZE * GRIDHEIGHT
FPS = 30
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
RED = (255, 0, 0)
GREEN = (0, 255,... |
from django.shortcuts import render, redirect, get_object_or_404
from django.contrib.auth.decorators import login_required
from django.contrib.auth import logout
from django.contrib import messages
from django.shortcuts import HttpResponseRedirect
from django.db.models import Q
from django.core.exceptions import Valida... |
import json
from datetime import timedelta
from core_data_modules.cleaners import URNCleaner
from core_data_modules.logging import Logger
from engagement_database.data_models import (Message, MessageDirections, MessageStatuses, HistoryEntryOrigin,
MessageOrigin)
from storag... |
#!/usr/bin/env python3
# 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.
from copy import deepcopy
from typing import (
Callable,
List,
Mapping,
... |
from __future__ import print_function
from __future__ import division
import os
import sys
import time
import datetime
import os.path as osp
import numpy as np
from tensorboardX import SummaryWriter
from tqdm import tqdm
import glog as log
import torch
import torch.nn as nn
import torch.backends.cudnn as cudnn
from t... |
# Copyright (c) 2017 Ericsson India Global Service Pvt Ltd.
# 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-... |
# coding: utf-8
# # Subplots
# In[1]:
get_ipython().magic('matplotlib notebook')
import matplotlib.pyplot as plt
import numpy as np
get_ipython().magic('pinfo plt.subplot')
# In[2]:
plt.figure()
# subplot with 1 row, 2 columns, and current axis is 1st subplot axes
plt.subplot(1, 2, 1)
linear_data = np.array([... |
# stdlib
import os
from pathlib import Path
from secrets import randbelow
from typing import Any
from typing import List
from typing import Optional
from typing import Union
# third party
from forbiddenfruit import curse
from nacl.signing import SigningKey
from nacl.signing import VerifyKey
# syft absolute
import syf... |
import copy
from typing import List, Generator, Iterable
from pathlib import Path
from app.application.service.mecab_parser import MecabParser
from app.application.service.mecab_storage import MecabStorage
from app.application.service.mecab_reader import MecabDataController
from domain.mecab_domain import MecabWordCa... |
# coding: utf-8
###
# @file loss.py
# @author <NAME> <<EMAIL>>
#
# @section LICENSE
#
# Copyright © 2019-2021 École Polytechnique Fédérale de Lausanne (EPFL).
# See LICENSE file.
#
# @section DESCRIPTION
#
# Loss/criterion wrappers/helpers.
###
__all__ = ["Loss", "Criterion"]
import tools
import torch
... |
"""Message passing layer."""
from abc import abstractmethod
from typing import Dict, List, NamedTuple, Tuple, Any
import tensorflow as tf
from tf2_gnn.utils.param_helpers import get_activation_function, get_aggregation_function
class MessagePassingInput(NamedTuple):
"""A named tuple to hold input to the message... |
# QAPI texi generator
#
# This work is licensed under the terms of the GNU LGPL, version 2+.
# See the COPYING file in the top-level directory.
"""This script produces the documentation of a qapi schema in texinfo format"""
import re
from qapi.gen import QAPIGenDoc, QAPISchemaVisitor
MSG_FMT = """
@deftypefn {type} ... |
import os
import random
import dash
import dash_bootstrap_components as dbc
import dash_html_components as html
import dash_core_components as dcc
from dash.dependencies import Input, Output, State
import dash_vtk
from dash_vtk.utils import to_mesh_state, preset_as_options
import vtk
random.seed(42)
# ----------... |
import http.client, urllib.parse
import json
global my_server_path
my_server_path = 'ewetasker.cluster.gsi.dit.upm.es'
'''
-->CREATERULE
REQUEST:
rule_title(String): Name of the new rule you want to create. Example: "My example rule".
rule_description(String): Decription of your rule. Example: "When users enters G... |
import os,sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import numpy as np
import h5py
import argparse
import torch
import torch.utils.data
import torchvision.utils as vutils
import gc
# tensorboardX
from tensorboardX import SummaryWriter
from em_net.data.dataset import AffinityDat... |
import numpy as np
import scipy.optimize
from sklearn import metrics
import logging
log = logging.getLogger(__name__)
def cost_cross_validation_auc(model, opt_el, x, y, param, k_folds=10,
split='uniform'):
""" Minimize cost of the overall -AUC.
Cost function: given a partic... |
## www.pubnub.com - PubNub Real-time push service in the cloud.
# coding=utf8
## PubNub Real-time Push APIs and Notifications Framework
## Copyright (c) 2010 <NAME>
## http://www.pubnub.com/
import sys
from Pubnub import Pubnub
from optparse import OptionParser
parser = OptionParser()
parser.add_option("--publish... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
# -*- coding: utf-8 -*-
# Authors: <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# License: Simplified BSD
import numpy as np
from scipy.sparse import csc_matrix
from .open import read_tag, fiff_open
from .tree import dir_tree_find
from .write import (start_block, end_block, write_int, write_float,
... |
r"""
Enumeration of rational points on affine schemes
Naive algorithms for enumerating rational points over `\QQ` or finite fields
over for general schemes.
.. WARNING::
Incorrect results and infinite loops may occur if using a wrong function.
(For instance using an affine function for a projective scheme o... |
import pytest
from .context import mango
from .fakes import fake_account_info, fake_seeded_public_key, fake_token_bank, fake_instrument, fake_instrument_value, fake_perp_account, fake_token
from decimal import Decimal
from mango.layouts import layouts
def test_construction() -> None:
account_info = fake_account... |
"""Module defining UniprotData class."""
# python 2/3 compatibility
from __future__ import division, print_function, absolute_import
# global imports
from collections import Counter, namedtuple
import os.path
import re
import pandas
Cofactor = namedtuple('Cofactor', 'chebi name stoichiometry uniprot_note')
class U... |
from django import forms
from django.contrib.auth.models import User, Group
from django.shortcuts import get_object_or_404
from ckeditor.widgets import CKEditorWidget
from wouso.core.qpool.models import Question, Answer, Schedule, Category, Tag
from wouso.core.magic.models import Spell
from wouso.core.scoring.models ... |
import tensorflow as tf
# TRAIN_FILE = 'C:/bank/data_set/bank_dummy_train_up.csv'
# TEST_FILE = 'C:/bank/data_set/bank_dummy_test.csv'
# FEATURE_NUMBER = 56
# TRAIN_FILE = 'C:/bank/data_set/bank_train_duration_dropped.csv'
# TEST_FILE = 'C:/bank/data_set/bank_test_duration_dropped.csv'
# FEATURE_NUMBER = 64
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 17-9-25 下午3:56
# @Author : MaybeShewill-CV
# @Site : https://github.com/MaybeShewill-CV/CRNN_Tensorflow
# @File : evaluate_shadownet.py
# @IDE: PyCharm Community Edition
"""
Evaluate the crnn model on the synth90k test dataset
"""
import argparse
import ... |
#!/usr/bin/env python3.7
# Copyright [2020] EMBL-European Bioinformatics Institute
#
# 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... |
'''
This is going to be the client Bob aka A for Cryptography and Network Security HW2 taught by Professor
Yener in F18. This will connect to the KDC and through Diffie-Hellman, gets a key Ka to use in N-S with
A.
'''
import random
import time
import socket
import sys
import toy_des
# define all the crypto stuff ... |
#
# ex:ts=4:sw=4:sts=4:et
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
#
# BitBake Toaster Implementation
#
# Copyright (C) 2013 Intel Corporation
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# pub... |
# coding: utf-8
from __future__ import unicode_literals
import json
import re
import sys
from .common import InfoExtractor
from ..utils import (
ExtractorError,
int_or_none,
qualities,
)
class IviIE(InfoExtractor):
IE_DESC = 'ivi.ru'
IE_NAME = 'ivi'
_VALID_URL = r'https?://(?:www\.)?ivi\.(?:... |
# Copyright (C) 2001-2006 Python Software Foundation
# Author: <NAME>
# Contact: <EMAIL>
"""Quoted-printable content transfer encoding per RFCs 2045-2047.
This module handles the content transfer encoding method defined in RFC 2045
to encode US ASCII-like 8-bit data called `quoted-printable'. It is used to
safely en... |
# Copyright 2022 Sony Semiconductors Israel, 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 b... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its 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 multiprocessing as mp
import signal
import time
import unittest
import unittest.moc... |
#!/usr/bin/env python
# encoding: utf-8
u'''
Asynchronous background jobs.
Note that most job management functions are not available from this
module but via the various ``job_*`` API functions.
Internally, RQ queue names are prefixed with a string containing the
CKAN site ID to avoid key collisions when the same Re... |
# -*- coding: utf-8 -*-
"""
Unit tests for the causality module.
:copyright: Copyright 2014-2020 by the Elephant team, see `doc/authors.rst`.
:license: Modified BSD, see LICENSE.txt for details.
"""
from __future__ import division, print_function
import sys
import unittest
import numpy as np
import quantities as pq
... |
# coding=utf-8
# Copyright 2018 The Tensor2Tensor 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... |
import os
import os.path
import subprocess
import shutil
import logging
logger = logging.getLogger("mkdocs")
from mkdocs.config import config_options as mkd
from .configitems import ConfigItems
from mkdocs.plugins import BasePlugin
import mkdocs.structure.files
from mkdocs.structure.files import File
import copy
''... |
#!/usr/bin/env python3
'''A script to connect to an log any body weight measurements
from the Etekcity ESF37 on a Raspberry Pi'''
import os
import sys
import csv
import pwd
import grp
import time
import bluepy
import logging
import datetime
import argparse
import subprocess
import collections
__version__ = '0.1.2'
... |
from typing import Dict, List, Any, Optional
import json
import pyarrow
# TODO: implement this module in Rust land to avoid JSON serialization
# https://github.com/delta-io/delta-rs/issues/95
class DataType:
"""
Base class of all Delta data types.
"""
def __init__(self, type_class: str):
... |
import abc
import os
import subprocess as sp
import uuid
from shlex import quote as shq
import aiohttp
from hailtop.batch_client.client import BatchClient, Job
from .resource import InputResourceFile, TaskResourceFile
from .utils import PipelineException
class Backend:
@abc.abstractmethod
def _run(self, pipe... |
"""Module provider for Mythic Beasts"""
import binascii
import json
import logging
import requests
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import hashes
from requests.adapters import HTTPAdapter
from urllib3.util.retry import Retry # type: ignore
from lexicon.exce... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import torch
import torch.nn.functional as F
import torchvision.transforms.functional as tvF
from torch.utils.data import Dataset, DataLoader
from utils import load_hdr_as_tensor
import os
from sys import platform
import numpy as np
import random
from string import asci... |
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import argparse
import os
import time
import math
import numpy as np
import torch
import lib.optimizers as optim
import lib.layers.base as base_layers
import lib.layers as layers
import lib.toy_data as toy_data
import lib.utils as utils
from lib... |
import torch
import torch.distributed as dist
import shutil
import os
import logging
def accuracy(output, target, topk=(1,)):
"""Computes the accuracy over the k top predictions for the specified values of k"""
with torch.no_grad():
maxk = max(topk)
batch_size = target.size(0)
_, pred... |
# Copyright (c) 2020 Graphcore Ltd. 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 ... |
# -*- coding=utf-8 -*-
"""
Shared utility functions which are not specific to any particular module.
"""
from __future__ import absolute_import
import contextlib
import copy
import inspect
import sys
from functools import wraps
import packaging.version
import six
from .environment import MYPY_RUNNING
# format: off
... |
"""
TODO:
* support for requirements.txt
* create and destroy env
"""
from urllib import parse
import logging
from pathlib import Path, PurePosixPath
import jupytext
import yaml
from jinja2 import Environment, FileSystemLoader, DebugUndefined, Template
from jupyblog import util, images, models, medium
from jupyblog.e... |
# nichols.py - Nichols plot
#
# Contributed by <NAME> <<EMAIL>>
#
# This file contains some standard control system plots: Bode plots,
# Nyquist plots, Nichols plots and pole-zero diagrams
#
# Copyright (c) 2010 by California Institute of Technology
# All rights reserved.
#
# Redistribution and use in source and binary... |
#!/usr/bin/env python
import sys
import tempfile
import time
import os
import subprocess
import argparse
import logging
from contextlib import contextmanager
import uuid
log = logging.getLogger("serviced-tests")
SERVICED_ROOT = os.path.dirname(os.path.abspath(__file__))
DEVNULL = open(os.devnull, 'w')
def fail(m... |
#!/usr/bin/env python
# example packbox.py
import pygtk
pygtk.require('2.0')
import gtk
import sys, string
# Helper function that makes a new hbox filled with button-labels. Arguments
# for the variables we're interested are passed in to this function. We do
# not show the box, but do show everything inside.
def m... |
#!/usr/local/bin/python
# Visualization
# <NAME>
# California Institute of Technology
# July 17, 2018
import sys
import pdb
sys.path.append('..') # enable importing modules from an upper directory:
from prepare.helper import *
import time, platform, warnings, matplotlib, random
import components.scheduler as scheduler
... |
import datetime
import time
import datedelta
import sqlalchemy.orm
import models.collateral
import models.database
import models.financing_statement
import models.party
import models.payment
import models.search
import schemas.financing_statement
import schemas.payment
def create_test_financing_statement(**kwargs):... |
#-- coding:UTF-8 --
import transformers
import torch
import os
import json
import random
import numpy as np
import argparse
#from torch.utils.tensorboard import SummaryWriter
from datetime import datetime
from tqdm import tqdm
from torch.nn import DataParallel
from tokenizations.bpe_tokenizer import get_encoder
def ite... |
#https://hackernoon.com/beginners-guide-simple-chat-bot-fb-based-on-flask-and-heroku-2g7v32ab
import random
from flask import Flask, request
from pymessenger.bot import Bot
#from tensorflow import keras
from keras.models import load_model, Model
from keras.layers import Input, LSTM, Dense
from keras.models import mode... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# (c) B.Kerler 2020 under MIT license
# If you use my code, make sure you refer to my name
# If you want to use in a commercial product, ask me before integrating it
import time
import serial
import serial.tools.list_ports
import argparse
import requests
from telnetlib imp... |
import tensorflow as tf
def heatmap_focal_loss(outputs, training_data, predictions):
return focal_loss(outputs["heatmap"], predictions[0])
def size_l1_loss(outputs, training_data, predictions):
heatmap_size = outputs["size"]
indices = training_data["indices"]
mask = training_data["mask"]
return... |
import sys
import math
#import sqlite3
import mysql.connector
import functools
### score functions ###
def get_doc_score(doca, docb):
score = 0
total = 0
for topic_id in range(len(doca)):
thetaa = doca[topic_id]
thetab = docb[topic_id]
if not ((thetaa != 0.0 and thetab == 0.0) or... |
from flask_wtf import FlaskForm
#from wtforms import StringField
#from wtforms.validators import DataRequired
#from flask_bootstrap import Bootstrap
from flask import Flask, request, render_template,redirect
from tensorflow.python.keras.preprocessing.text import Tokenizer
from tensorflow.python.keras.preprocessing.seq... |
from __future__ import print_function
import argparse
import torch
import torch.backends.cudnn as cudnn
import torch.nn as nn
import torch.nn.functional as F
from torch.optim import lr_scheduler
import torch.optim as optim
from torchvision import datasets, transforms
from torch.utils.data import Dataset, DataLoader
fro... |
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See COPYING file distributed along with the PyMVPA package for the
# copyright and license terms.
#
### ### ### ### ###... |
# Copyright 2022 Xiaomi Corp. (authors: <NAME>
# <NAME>
# <NAME>)
#
# See ../LICENSE for clarification regarding multiple authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you m... |
import numpy as np
from faker import Faker
import random
from tqdm import tqdm
from babel.dates import format_date
from keras.utils import to_categorical
import keras.backend as K
import matplotlib.pyplot as plt
fake = Faker()
fake.seed(12345)
random.seed(12345)
# Define format of the data we would like to generate
F... |
import math
import random
import asyncio
import numpy as np
from scipy import optimize
from cess.agent import Agent, AgentProxy
from cess.agent.learn import QLearner
class Firm(Agent):
def __init__(self, labor_cost_per_good, material_cost_per_good, labor_per_equipment, labor_per_worker, supply_increment, profit_i... |
from django.urls import reverse
from django.shortcuts import render
from django.http import HttpResponseRedirect, HttpResponse
from django.contrib.auth.models import User
from django.shortcuts import get_object_or_404, render, redirect
from .models import CarMake, CarModel # from .models import related models
from .re... |
"""Top-level model classes.
Author:
<NAME> (<EMAIL>)
"""
import layers
import torch
import torch.nn as nn
class BiDAF(nn.Module):
"""Baseline BiDAF model for SQuAD.
Based on the paper:
"Bidirectional Attention Flow for Machine Comprehension"
by <NAME>, <NAME>, <NAME>, <NAME>
(https://arxiv.... |
from collections import OrderedDict
from config.rewards_config import rewards_config
from assistant.rewards.BadgerGeyserMock import BadgerGeyserMock
from assistant.subgraph.client import fetch_all_geyser_events
from brownie import *
from dotmap import DotMap
from helpers.constants import AddressZero
from rich.console ... |
# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
# Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
#
# 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 Licen... |
# -*- coding: utf-8 -*-
#
# changes.py — .changes file handling class
#
# This file was originally part of debexpo
# https://alioth.debian.org/projects/debexpo/
#
# Copyright © 2008 <NAME> <<EMAIL>>
# Copyright © 2010 <NAME> <<EMAIL>>
# Copyright © 2012 <NAME> <<EMAIL>>
# Copyright © 2012 <NAME> <<EMAIL>... |
import itertools
import yaml
from collections import OrderedDict
import logging
import sys
from dauber import Playbook, Inventory
import os
import hashlib
from jinja2 import Template
from utils import recursive_hash
logger = logging.getLogger('cluster_test_runner')
PLAY_STATUS = ["RUNNING", "COMPLETE", "ERROR"]
clas... |
'''
/*
* Copyright 2010-2016 Amazon.com, Inc. or its affiliates. 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.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "... |
# coding=utf-8
"""
qs的普通文件下载器!干翻迅雷,并且支持设置代理,设置referer,好看的命令行交互,啥j8文件都能下;(仅支持http[s]协议)
QS ordinary file downloader! Dry out Thunder, and support to set the proxy, set the Referer,
good-looking command line interaction, and it can download fuck any files; (only supports HTTP[S])
Author: RhythmLian (https://rhythmlian.... |
#!/usr/bin/env python
import actionlib
import control_msgs.msg
import trajectory_msgs.msg
import rospy
import tf
from .arm_joints import ArmJoints
from .moveit_goal_builder import MoveItGoalBuilder
from moveit_msgs.msg import MoveItErrorCodes, MoveGroupAction
from moveit_msgs.srv import GetPositionIK, GetPositionIKReq... |
"""
ckwg +31
Copyright 2020 by Kitware, 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:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the ... |
# -*- coding: utf-8 -*-
import random
from flask_security.utils import encrypt_password
from flask_login import AnonymousUserMixin
from flask_security import UserMixin, RoleMixin
from purchasing.database import Column, db, Model, ReferenceCol, SurrogatePK
from sqlalchemy.orm import backref
roles_users = db.Table(
... |
import click
import docker
import os
import time
from hashlib import sha256
from jinja2 import Template
from pathlib import Path
from shutil import which
from subprocess import check_output
from subprocess import CalledProcessError
from pip._internal.network.session import PipSession
from pip._internal.req import pars... |
# -*- coding: utf-8 -*- #
# Copyright 2021 Google LLC. 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 requir... |
#!/usr/bin/env python3
# Copyright 2004-present Facebook. All Rights Reserved.
import random
from typing import List, Optional, Tuple, Union
import numpy as np
from colorednoise import powerlaw_psd_gaussian
from ..utils.doc.docfill import fill_in_docstring
from .dummy_generator import (
dummy_physiological_noise,... |
import datetime
import re
from flask import redirect, render_template, request, session, url_for, flash, jsonify
from ..models import db, Role, User, Log
from .. import login_required
from . import auth
@auth.route('/login_required/')
def login():
return redirect(url_for('main.index', show_login=True))
# 响应登录a... |
"""Tests for Phono3pyWorkChain."""
import numpy as np
import pytest
from phonopy.structure.cells import isclose
from aiida_phonoxpy.utils.utils import phonopy_atoms_from_structure
def test_initialize_with_dataset(
generate_workchain,
generate_structure,
generate_displacement_dataset,
generate_setting... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.